Guest User

create_edit_invoices.html

a guest
Aug 8th, 2025
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. {% extends "layout/base.html" %}
  2. {% block content %}
  3. <h1 class="text-2xl font-bold mb-2">
  4. {% if estimate %}Factuur bewerken{% else %}Nieuwe factuur{% endif %}
  5. </h1>
  6. <div class="flex items-center justify-between mb-6">
  7. <nav class="text-sm text-gray-600 flex items-center space-x-2 font-semibold">
  8. <a href="/admin/dashboard" class="hover:underline font-medium">Startscherm</a>
  9. <span>/</span>
  10. <a href="/admin/invoices" class="hover:underline font-medium">Facturen</a>
  11. <span>/</span>
  12. <span class="text-blue-700 font-medium">
  13. {% if estimate %}Factuur bewerken{% else %}Nieuwe factuur{% endif %}
  14. </span>
  15. </nav>
  16. <button type="submit" form="estimate-form" class="bg-[#1F89D9] hover:bg-blue-800 text-white font-bold px-6 py-2 rounded-lg shadow flex items-center gap-2">
  17. <i class="lucide lucide-save"></i> Bewaar factuur
  18. </button>
  19. </div>
  20.  
  21. <form method="POST" enctype="multipart/form-data" action="{% if invoice %}/admin/invoices/{{ invoice.nummer }}/edit{% else %}/admin/invoices/create{% endif %}" id="estimate-form">
  22. <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
  23. <!-- Nieuwe klant button -->
  24. <div id="customer-card-container">
  25. <div class="bg-white rounded-xl shadow p-6 flex items-center min-h-[100px] relative">
  26. <button type="button" id="select-customer-btn" class="w-full flex items-center gap-4 text-left focus:outline-none">
  27. <div class="rounded-full bg-gray-100 w-12 h-12 flex items-center justify-center text-2xl text-gray-400">
  28. <i class="lucide lucide-user"></i>
  29. </div>
  30. <div>
  31. <span class="font-semibold text-lg text-gray-700" id="selected-customer-label">
  32. Nieuwe klant
  33. </span>
  34. <span class="text-red-500 ml-1">*</span>
  35. </div>
  36. </button>
  37. <div id="klant-selector" class="absolute left-0 top-full mt-2 w-full z-20 bg-white border rounded-xl shadow-lg p-4 hidden">
  38. <input type="text" id="klant-search" placeholder="Zoeken" class="w-full border rounded px-4 py-2 mb-2" autocomplete="off">
  39. <div id="klant-dropdown" class="max-h-60 overflow-y-auto"></div>
  40. </div>
  41. </div>
  42. </div>
  43. <input type="hidden" name="klant" id="selected-customer-id" value="">
  44. <!-- Offerte datum, nummer, vervaldatum -->
  45. <div class="grid grid-cols-2 gap-4">
  46. <div>
  47. <label class="block font-semibold mb-1">Factuur Datum <span class="text-red-500">*</span></label>
  48. <div class="relative">
  49. <input type="text" name="datum_display" id="datum_display" class="w-full border border-gray-300 rounded px-4 py-2 bg-gray-50 font-semibold text-gray-700"
  50. value="{{ today_display }}" autocomplete="off" placeholder="DD-MM-YYYY">
  51. <input type="hidden" name="datum" id="datum" value="{{ today }}">
  52. <span class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400">
  53. <i class="lucide lucide-calendar"></i>
  54. </span>
  55. </div>
  56. </div>
  57. <div>
  58. <label class="block font-semibold mb-1">Vervaldatum</label>
  59. <div class="relative">
  60. <input type="text" name="vervaldatum_display" id="vervaldatum_display" class="w-full border border-gray-300 rounded px-4 py-2 bg-gray-50 font-semibold text-gray-700"
  61. value="{{ vervaldatum_display }}" autocomplete="off" placeholder="DD-MM-YYYY">
  62. <input type="hidden" name="vervaldatum" id="vervaldatum" value="{{ vervaldatum }}">
  63. <span class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400">
  64. <i class="lucide lucide-calendar"></i>
  65. </span>
  66. </div>
  67. </div>
  68. <div class="col-span-2">
  69. <label class="block font-semibold mb-1">Factuur nummer <span class="text-red-500">*</span></label>
  70. <input type="text" name="nummer" class="w-full border border-gray-300 rounded px-4 py-2 focus:outline-none bg-gray-50 font-semibold text-gray-700" value="{{ invoice.nummer if invoice else nummer }}" read-only>
  71. </div>
  72. </div>
  73. </div>
  74.  
  75. <!-- Artikelen -->
  76. <script>
  77. window.selected_customer = "{{ selected_customer }}";
  78. window.selected_customer_name = "{{ selected_customer_name }}";
  79. window.valuta_symbol = "{{ valuta_symbol }}";
  80. </script>
  81.  
  82. <link href="https://cdn.jsdelivr.net/npm/tom-select/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
  83. <script src="https://cdn.jsdelivr.net/npm/tom-select/dist/js/tom-select.complete.min.js"></script>
  84.  
  85. <div id="section-title-hidden-inputs"></div>
  86. <div class="bg-white rounded-xl shadow mb-6">
  87. <table class="w-full">
  88. <thead>
  89. <tr class="bg-gray-50">
  90. <th class="px-2 py-3 w-8"></th>
  91. <th class="px-6 py-3 text-left font-semibold text-gray-700">Artikelen</th>
  92. <th class="px-6 py-3 text-center font-semibold text-gray-700">Aantal stuks</th>
  93. <th class="px-6 py-3 text-center font-semibold text-gray-700">Prijs</th>
  94. <th class="px-6 py-3 text-right font-semibold text-gray-700">Bedrag</th>
  95. <th class="px-2 py-3 w-8"></th>
  96. </tr>
  97. </thead>
  98. <tbody id="items-table">
  99. <!-- Table rows will be rendered by JS -->
  100. </tbody>
  101. </table>
  102. <div class="flex justify-end mt-2 mb-2 gap-2">
  103. <button type="button" id="add-section-btn" class="text-[#1F89D9] flex items-center gap-2 px-2 py-1 hover:underline text-sm">
  104. <i class="lucide lucide-heading"></i> Voeg sectietitel toe
  105. </button>
  106. <button type="button" id="add-item-btn" class="text-[#1F89D9] flex items-center gap-2 px-2 py-1 hover:underline text-sm">
  107. <i class="lucide lucide-plus"></i> Voeg een nieuw item toe
  108. </button>
  109. </div>
  110. </div>
  111. <style>
  112. .ts-dropdown, .ts-control {
  113. background: #fff !important;
  114. }
  115. </style>
  116.  
  117. <div class="flex flex-col md:flex-row gap-6 mb-6">
  118. <!-- Opmerkingen -->
  119. <div class="bg-white rounded-xl shadow p-6 flex-1">
  120. <label class="block font-semibold mb-2">Opmerkingen</label>
  121. <div class="flex justify-between items-center mb-2">
  122. <button type="button" class="text-[#1F89D9] text-sm hover:underline">+ Notitie invoegen</button>
  123. </div>
  124. <textarea name="opmerkingen" class="w-full border border-gray-300 rounded px-4 py-2" rows="5">{{ invoice.opmerkingen if invoice else "" }}</textarea>
  125. <div class="flex justify-end mt-2">
  126. <button type="button" class="text-[#1F89D9] flex items-center gap-2 px-2 py-1 hover:underline text-sm">
  127. <i class="lucide lucide-plus"></i> Velden invoegen
  128. </button>
  129. </div>
  130. </div>
  131. <!-- Subtotaal & totaal -->
  132. <div class="bg-white rounded-xl shadow p-6 flex-1 flex flex-col items-end justify-between max-w-md ml-auto">
  133. <div class="w-full md:w-80 text-right">
  134. <div class="text-gray-500 font-semibold">SUBTOTAAL</div>
  135. <div class="font-bold text-lg" id="subtotal">0,00 {{ valuta_symbol }}</div>
  136. <div class="text-gray-500 font-semibold mt-2">KORTING</div>
  137. <div class="flex items-center gap-2 justify-end">
  138. <input type="text" name="korting" class="w-24 border rounded px-2 py-2 text-right" value="{{ estimate.korting if estimate else '0' }}">
  139. <select name="korting_type" class="border rounded px-2 py-2">
  140. <option value="€">€</option>
  141. <option value="%">%</option>
  142. </select>
  143. </div>
  144. <button type="button" class="text-[#1F89D9] text-xs mt-2 hover:underline">+ Belasting toevoegen</button>
  145. </div>
  146. <div class="mt-6 w-full md:w-80 text-right">
  147. <div class="text-gray-500 font-semibold">TOTAAL BEDRAG:</div>
  148. <div class="font-bold text-2xl text-[#1F89D9]" id="total">0,00 {{ valuta_symbol }}</div>
  149. </div>
  150. </div>
  151. </div>
  152. </form>
  153.  
  154. <script src="https://cdn.jsdelivr.net/npm/[email protected]/Sortable.min.js"></script>
  155. <script src="/static/js/customer_selector.js"></script>
  156. <script src="/static/js/document_time.js"></script>
  157. <script src="/static/js/document_items.js"></script>
  158. <script>
  159. lucide.createIcons();
  160. </script>
  161. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment