@spaceinvoices/react-ui 0.4.12 → 0.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/src/common/autocomplete.tsx +7 -1
  4. package/src/components/advance-invoices/advance-invoices.hooks.ts +35 -44
  5. package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +189 -73
  6. package/src/components/advance-invoices/create/locales/bg.ts +17 -9
  7. package/src/components/advance-invoices/create/locales/cs.ts +17 -9
  8. package/src/components/advance-invoices/create/locales/de.ts +15 -7
  9. package/src/components/advance-invoices/create/locales/en.ts +15 -7
  10. package/src/components/advance-invoices/create/locales/es.ts +15 -7
  11. package/src/components/advance-invoices/create/locales/et.ts +17 -9
  12. package/src/components/advance-invoices/create/locales/fi.ts +18 -10
  13. package/src/components/advance-invoices/create/locales/fr.ts +16 -8
  14. package/src/components/advance-invoices/create/locales/hr.ts +15 -7
  15. package/src/components/advance-invoices/create/locales/is.ts +17 -9
  16. package/src/components/advance-invoices/create/locales/it.ts +15 -7
  17. package/src/components/advance-invoices/create/locales/nb.ts +17 -9
  18. package/src/components/advance-invoices/create/locales/nl.ts +15 -7
  19. package/src/components/advance-invoices/create/locales/pl.ts +17 -9
  20. package/src/components/advance-invoices/create/locales/pt.ts +16 -8
  21. package/src/components/advance-invoices/create/locales/sk.ts +17 -9
  22. package/src/components/advance-invoices/create/locales/sl.ts +14 -5
  23. package/src/components/advance-invoices/create/locales/sv.ts +17 -9
  24. package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +47 -1
  25. package/src/components/advance-invoices/list/list-table.tsx +2 -1
  26. package/src/components/credit-notes/create/create-credit-note-form.tsx +253 -85
  27. package/src/components/credit-notes/create/locales/bg.ts +22 -8
  28. package/src/components/credit-notes/create/locales/cs.ts +22 -8
  29. package/src/components/credit-notes/create/locales/de.ts +20 -7
  30. package/src/components/credit-notes/create/locales/en.ts +19 -5
  31. package/src/components/credit-notes/create/locales/es.ts +20 -7
  32. package/src/components/credit-notes/create/locales/et.ts +22 -8
  33. package/src/components/credit-notes/create/locales/fi.ts +23 -9
  34. package/src/components/credit-notes/create/locales/fr.ts +21 -8
  35. package/src/components/credit-notes/create/locales/hr.ts +20 -7
  36. package/src/components/credit-notes/create/locales/is.ts +22 -8
  37. package/src/components/credit-notes/create/locales/it.ts +20 -7
  38. package/src/components/credit-notes/create/locales/nb.ts +22 -8
  39. package/src/components/credit-notes/create/locales/nl.ts +20 -7
  40. package/src/components/credit-notes/create/locales/pl.ts +22 -9
  41. package/src/components/credit-notes/create/locales/pt.ts +21 -8
  42. package/src/components/credit-notes/create/locales/sk.ts +22 -8
  43. package/src/components/credit-notes/create/locales/sl.ts +19 -5
  44. package/src/components/credit-notes/create/locales/sv.ts +22 -8
  45. package/src/components/credit-notes/create/prepare-credit-note-submission.ts +35 -1
  46. package/src/components/credit-notes/credit-notes.hooks.ts +21 -2
  47. package/src/components/credit-notes/list/list-table.tsx +2 -1
  48. package/src/components/delivery-notes/create/create-delivery-note-form.tsx +132 -30
  49. package/src/components/delivery-notes/create/locales/bg.ts +1 -0
  50. package/src/components/delivery-notes/create/locales/cs.ts +1 -0
  51. package/src/components/delivery-notes/create/locales/de.ts +1 -0
  52. package/src/components/delivery-notes/create/locales/en.ts +1 -0
  53. package/src/components/delivery-notes/create/locales/es.ts +1 -0
  54. package/src/components/delivery-notes/create/locales/et.ts +1 -0
  55. package/src/components/delivery-notes/create/locales/fi.ts +1 -0
  56. package/src/components/delivery-notes/create/locales/fr.ts +1 -0
  57. package/src/components/delivery-notes/create/locales/hr.ts +1 -0
  58. package/src/components/delivery-notes/create/locales/is.ts +1 -0
  59. package/src/components/delivery-notes/create/locales/it.ts +1 -0
  60. package/src/components/delivery-notes/create/locales/nb.ts +1 -0
  61. package/src/components/delivery-notes/create/locales/nl.ts +1 -0
  62. package/src/components/delivery-notes/create/locales/pl.ts +1 -0
  63. package/src/components/delivery-notes/create/locales/pt.ts +1 -0
  64. package/src/components/delivery-notes/create/locales/sk.ts +1 -0
  65. package/src/components/delivery-notes/create/locales/sl.ts +1 -0
  66. package/src/components/delivery-notes/create/locales/sv.ts +1 -0
  67. package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +34 -1
  68. package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -1
  69. package/src/components/delivery-notes/list/list-table.tsx +2 -1
  70. package/src/components/documents/create/custom-create-template.ts +114 -0
  71. package/src/components/documents/create/document-add-item-form.tsx +12 -8
  72. package/src/components/documents/create/document-add-item-tax-rate-field.tsx +1 -2
  73. package/src/components/documents/create/document-date-validation.ts +111 -0
  74. package/src/components/documents/create/document-details-section.tsx +93 -48
  75. package/src/components/documents/create/document-form-item.ts +67 -0
  76. package/src/components/documents/create/document-item-validation.ts +6 -2
  77. package/src/components/documents/create/form-types.ts +2 -2
  78. package/src/components/documents/create/linked-documents-info.tsx +2 -11
  79. package/src/components/documents/create/live-preview.tsx +3 -3
  80. package/src/components/documents/create/mark-as-paid-section.tsx +14 -11
  81. package/src/components/documents/create/payment-rows.ts +30 -0
  82. package/src/components/documents/create/prepare-document-submission.ts +143 -103
  83. package/src/components/documents/create/prepare-preview-data.ts +12 -0
  84. package/src/components/documents/create/preserved-expected-total.ts +90 -0
  85. package/src/components/documents/public/public-document-summary.tsx +6 -13
  86. package/src/components/documents/view/document-actions-bar.tsx +10 -1
  87. package/src/components/documents/view/document-details-card.tsx +4 -12
  88. package/src/components/documents/view/document-relations-list.tsx +4 -4
  89. package/src/components/documents/view/locales/bg.ts +8 -8
  90. package/src/components/documents/view/locales/cs.ts +8 -8
  91. package/src/components/documents/view/locales/de.ts +1 -1
  92. package/src/components/documents/view/locales/en.ts +14 -14
  93. package/src/components/documents/view/locales/es.ts +1 -1
  94. package/src/components/documents/view/locales/et.ts +8 -8
  95. package/src/components/documents/view/locales/fi.ts +10 -10
  96. package/src/components/documents/view/locales/fr.ts +1 -1
  97. package/src/components/documents/view/locales/hr.ts +6 -6
  98. package/src/components/documents/view/locales/is.ts +8 -8
  99. package/src/components/documents/view/locales/it.ts +1 -1
  100. package/src/components/documents/view/locales/nb.ts +8 -8
  101. package/src/components/documents/view/locales/nl.ts +1 -1
  102. package/src/components/documents/view/locales/pl.ts +1 -1
  103. package/src/components/documents/view/locales/pt.ts +1 -1
  104. package/src/components/documents/view/locales/sk.ts +8 -8
  105. package/src/components/documents/view/locales/sl.ts +9 -9
  106. package/src/components/documents/view/locales/sv.ts +1 -1
  107. package/src/components/documents/view/use-document-download.ts +2 -2
  108. package/src/components/entities/entity-settings-form/locales/bg.ts +7 -0
  109. package/src/components/entities/entity-settings-form/locales/cs.ts +7 -0
  110. package/src/components/entities/entity-settings-form/locales/de.ts +9 -0
  111. package/src/components/entities/entity-settings-form/locales/en.ts +7 -0
  112. package/src/components/entities/entity-settings-form/locales/es.ts +7 -0
  113. package/src/components/entities/entity-settings-form/locales/et.ts +7 -0
  114. package/src/components/entities/entity-settings-form/locales/fi.ts +7 -0
  115. package/src/components/entities/entity-settings-form/locales/fr.ts +7 -0
  116. package/src/components/entities/entity-settings-form/locales/hr.ts +7 -0
  117. package/src/components/entities/entity-settings-form/locales/is.ts +7 -0
  118. package/src/components/entities/entity-settings-form/locales/it.ts +7 -0
  119. package/src/components/entities/entity-settings-form/locales/nb.ts +7 -0
  120. package/src/components/entities/entity-settings-form/locales/nl.ts +7 -0
  121. package/src/components/entities/entity-settings-form/locales/pl.ts +7 -0
  122. package/src/components/entities/entity-settings-form/locales/pt.ts +7 -0
  123. package/src/components/entities/entity-settings-form/locales/sk.ts +7 -0
  124. package/src/components/entities/entity-settings-form/locales/sl.ts +12 -4
  125. package/src/components/entities/entity-settings-form/locales/sv.ts +7 -0
  126. package/src/components/entities/settings/tax-rules-settings-form.tsx +36 -0
  127. package/src/components/estimates/create/create-estimate-form.tsx +195 -47
  128. package/src/components/estimates/create/locales/bg.ts +6 -5
  129. package/src/components/estimates/create/locales/cs.ts +6 -5
  130. package/src/components/estimates/create/locales/de.ts +4 -3
  131. package/src/components/estimates/create/locales/en.ts +4 -3
  132. package/src/components/estimates/create/locales/es.ts +4 -3
  133. package/src/components/estimates/create/locales/et.ts +6 -5
  134. package/src/components/estimates/create/locales/fi.ts +9 -8
  135. package/src/components/estimates/create/locales/fr.ts +4 -3
  136. package/src/components/estimates/create/locales/hr.ts +7 -6
  137. package/src/components/estimates/create/locales/is.ts +6 -5
  138. package/src/components/estimates/create/locales/it.ts +4 -3
  139. package/src/components/estimates/create/locales/nb.ts +6 -5
  140. package/src/components/estimates/create/locales/nl.ts +4 -3
  141. package/src/components/estimates/create/locales/pl.ts +4 -3
  142. package/src/components/estimates/create/locales/pt.ts +4 -3
  143. package/src/components/estimates/create/locales/sk.ts +6 -5
  144. package/src/components/estimates/create/locales/sl.ts +7 -6
  145. package/src/components/estimates/create/locales/sv.ts +6 -5
  146. package/src/components/estimates/create/prepare-estimate-submission.ts +37 -3
  147. package/src/components/estimates/estimates.hooks.ts +11 -2
  148. package/src/components/estimates/list/list-table.tsx +11 -1
  149. package/src/components/estimates/list/locales/bg.ts +2 -0
  150. package/src/components/estimates/list/locales/cs.ts +2 -0
  151. package/src/components/estimates/list/locales/de.ts +2 -0
  152. package/src/components/estimates/list/locales/en.ts +2 -0
  153. package/src/components/estimates/list/locales/es.ts +2 -0
  154. package/src/components/estimates/list/locales/et.ts +2 -0
  155. package/src/components/estimates/list/locales/fi.ts +2 -0
  156. package/src/components/estimates/list/locales/fr.ts +2 -0
  157. package/src/components/estimates/list/locales/hr.ts +7 -5
  158. package/src/components/estimates/list/locales/is.ts +2 -0
  159. package/src/components/estimates/list/locales/it.ts +2 -0
  160. package/src/components/estimates/list/locales/nb.ts +2 -0
  161. package/src/components/estimates/list/locales/nl.ts +2 -0
  162. package/src/components/estimates/list/locales/pl.ts +2 -0
  163. package/src/components/estimates/list/locales/pt.ts +2 -0
  164. package/src/components/estimates/list/locales/sk.ts +2 -0
  165. package/src/components/estimates/list/locales/sl.ts +9 -7
  166. package/src/components/estimates/list/locales/sv.ts +2 -0
  167. package/src/components/invoices/create/create-invoice-form.tsx +230 -60
  168. package/src/components/invoices/create/locales/bg.ts +23 -14
  169. package/src/components/invoices/create/locales/cs.ts +23 -14
  170. package/src/components/invoices/create/locales/de.ts +17 -9
  171. package/src/components/invoices/create/locales/en.ts +16 -7
  172. package/src/components/invoices/create/locales/es.ts +18 -9
  173. package/src/components/invoices/create/locales/et.ts +23 -14
  174. package/src/components/invoices/create/locales/fi.ts +24 -15
  175. package/src/components/invoices/create/locales/fr.ts +19 -11
  176. package/src/components/invoices/create/locales/hr.ts +18 -9
  177. package/src/components/invoices/create/locales/is.ts +23 -14
  178. package/src/components/invoices/create/locales/it.ts +19 -11
  179. package/src/components/invoices/create/locales/nb.ts +23 -14
  180. package/src/components/invoices/create/locales/nl.ts +19 -10
  181. package/src/components/invoices/create/locales/pl.ts +19 -11
  182. package/src/components/invoices/create/locales/pt.ts +19 -10
  183. package/src/components/invoices/create/locales/sk.ts +23 -14
  184. package/src/components/invoices/create/locales/sl.ts +17 -9
  185. package/src/components/invoices/create/locales/sv.ts +17 -8
  186. package/src/components/invoices/create/prepare-invoice-submission.ts +55 -1
  187. package/src/components/invoices/invoices.hooks.ts +11 -2
  188. package/src/components/invoices/list/list-table.tsx +2 -1
  189. package/src/components/invoices/send-email-dialog/locales/bg.ts +5 -0
  190. package/src/components/invoices/send-email-dialog/locales/cs.ts +5 -0
  191. package/src/components/invoices/send-email-dialog/locales/de.ts +5 -0
  192. package/src/components/invoices/send-email-dialog/locales/en.ts +5 -0
  193. package/src/components/invoices/send-email-dialog/locales/es.ts +5 -0
  194. package/src/components/invoices/send-email-dialog/locales/et.ts +5 -0
  195. package/src/components/invoices/send-email-dialog/locales/fi.ts +5 -0
  196. package/src/components/invoices/send-email-dialog/locales/fr.ts +5 -0
  197. package/src/components/invoices/send-email-dialog/locales/hr.ts +8 -3
  198. package/src/components/invoices/send-email-dialog/locales/is.ts +5 -0
  199. package/src/components/invoices/send-email-dialog/locales/it.ts +5 -0
  200. package/src/components/invoices/send-email-dialog/locales/nb.ts +5 -0
  201. package/src/components/invoices/send-email-dialog/locales/nl.ts +5 -0
  202. package/src/components/invoices/send-email-dialog/locales/pl.ts +5 -0
  203. package/src/components/invoices/send-email-dialog/locales/pt.ts +5 -0
  204. package/src/components/invoices/send-email-dialog/locales/sk.ts +5 -0
  205. package/src/components/invoices/send-email-dialog/locales/sl.ts +8 -3
  206. package/src/components/invoices/send-email-dialog/locales/sv.ts +5 -0
  207. package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +2 -1
  208. package/src/components/items/item-combobox.tsx +4 -4
  209. package/src/components/payments/create-payment-form/create-payment-form.tsx +5 -2
  210. package/src/components/payments/edit-payment-form/edit-payment-form.tsx +5 -1
  211. package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +98 -22
  212. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/bg.ts +26 -26
  213. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/cs.ts +25 -25
  214. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/et.ts +26 -26
  215. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fi.ts +36 -36
  216. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/is.ts +26 -26
  217. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nb.ts +26 -26
  218. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sk.ts +25 -25
  219. package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sv.ts +26 -26
  220. package/src/components/recurring-invoices/list/list-row-actions.tsx +9 -1
  221. package/src/components/recurring-invoices/list/list-table.tsx +53 -5
  222. package/src/components/recurring-invoices/list/locales/bg.ts +4 -0
  223. package/src/components/recurring-invoices/list/locales/cs.ts +4 -0
  224. package/src/components/recurring-invoices/list/locales/de.ts +4 -0
  225. package/src/components/recurring-invoices/list/locales/en.ts +4 -0
  226. package/src/components/recurring-invoices/list/locales/es.ts +4 -0
  227. package/src/components/recurring-invoices/list/locales/et.ts +4 -0
  228. package/src/components/recurring-invoices/list/locales/fi.ts +4 -0
  229. package/src/components/recurring-invoices/list/locales/fr.ts +4 -0
  230. package/src/components/recurring-invoices/list/locales/hr.ts +4 -0
  231. package/src/components/recurring-invoices/list/locales/is.ts +4 -0
  232. package/src/components/recurring-invoices/list/locales/it.ts +4 -0
  233. package/src/components/recurring-invoices/list/locales/nb.ts +4 -0
  234. package/src/components/recurring-invoices/list/locales/nl.ts +4 -0
  235. package/src/components/recurring-invoices/list/locales/pl.ts +4 -0
  236. package/src/components/recurring-invoices/list/locales/pt.ts +4 -0
  237. package/src/components/recurring-invoices/list/locales/sk.ts +4 -0
  238. package/src/components/recurring-invoices/list/locales/sl.ts +4 -0
  239. package/src/components/recurring-invoices/list/locales/sv.ts +4 -0
  240. package/src/components/tax-reports/slovenia-tax-profile-step.tsx +4 -1
  241. package/src/components/tax-reports/slovenia-yearly-export-form.tsx +3 -0
  242. package/src/components/tax-reports/slovenia-yearly-review-step.tsx +2 -1
  243. package/src/components/ui/form.tsx +5 -13
  244. package/src/components/ui/select.tsx +0 -1
  245. package/src/components/ui/sidebar.tsx +2 -2
  246. package/src/generate-schemas.ts +132 -99
  247. package/src/generated/schemas/acceptentityinvitation_body.ts +4 -3
  248. package/src/generated/schemas/accountwebhook.ts +4 -8
  249. package/src/generated/schemas/addentityuser_body.ts +4 -3
  250. package/src/generated/schemas/advanceinvoice.ts +167 -168
  251. package/src/generated/schemas/authorizeshopify_body.ts +4 -3
  252. package/src/generated/schemas/calculatedocumentpreview.ts +120 -0
  253. package/src/generated/schemas/checktransactiontype.ts +35 -0
  254. package/src/generated/schemas/creditnote.ts +203 -76
  255. package/src/generated/schemas/customadvanceinvoice.ts +172 -165
  256. package/src/generated/schemas/customcreditnote.ts +183 -155
  257. package/src/generated/schemas/customdeliverynote.ts +166 -0
  258. package/src/generated/schemas/customer.ts +4 -8
  259. package/src/generated/schemas/customestimate.ts +123 -97
  260. package/src/generated/schemas/customincomingpurchasedocument.ts +142 -0
  261. package/src/generated/schemas/custominvoice.ts +183 -154
  262. package/src/generated/schemas/deliverynote.ts +124 -79
  263. package/src/generated/schemas/einvoice.ts +19 -0
  264. package/src/generated/schemas/einvoicingsettings.ts +21 -0
  265. package/src/generated/schemas/einvoicingsupplier.ts +45 -0
  266. package/src/generated/schemas/entity.ts +44 -40
  267. package/src/generated/schemas/entityapikey.ts +1 -3
  268. package/src/generated/schemas/entityuserrole.ts +1 -3
  269. package/src/generated/schemas/estimate.ts +120 -127
  270. package/src/generated/schemas/exportsloveniavodxml_body.ts +4 -3
  271. package/src/generated/schemas/exportsloveniayearlynormiranireport_body.ts +4 -3
  272. package/src/generated/schemas/finadevice.ts +15 -0
  273. package/src/generated/schemas/finalizedocument.ts +52 -0
  274. package/src/generated/schemas/finapremise.ts +15 -0
  275. package/src/generated/schemas/finasettings.ts +1 -3
  276. package/src/generated/schemas/furselectronicdevice.ts +15 -0
  277. package/src/generated/schemas/furssettings.ts +1 -3
  278. package/src/generated/schemas/image.ts +15 -0
  279. package/src/generated/schemas/incomingpurchasedocument.ts +7 -27
  280. package/src/generated/schemas/incomingpurchasedocumentattachment.ts +15 -0
  281. package/src/generated/schemas/incomingpurchasedocumentpayment.ts +1 -3
  282. package/src/generated/schemas/index.ts +20 -5
  283. package/src/generated/schemas/invoice.ts +182 -183
  284. package/src/generated/schemas/item.ts +6 -10
  285. package/src/generated/schemas/legacymigrationauth.ts +18 -0
  286. package/src/generated/schemas/me.ts +2 -24
  287. package/src/generated/schemas/migrationjob.ts +20 -0
  288. package/src/generated/schemas/order.ts +4 -8
  289. package/src/generated/schemas/orderintegration.ts +4 -8
  290. package/src/generated/schemas/payment.ts +4 -8
  291. package/src/generated/schemas/ptatcudseries.ts +1 -3
  292. package/src/generated/schemas/queryentitystats.ts +15 -0
  293. package/src/generated/schemas/recurringinvoice.ts +4 -8
  294. package/src/generated/schemas/registerfursmovablepremise_body.ts +1 -3
  295. package/src/generated/schemas/registerfursrealestatepremise_body.ts +1 -3
  296. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +10 -16
  297. package/src/generated/schemas/rendercreditnotepreview_body.ts +10 -16
  298. package/src/generated/schemas/renderdeliverynotepreview_body.ts +9 -5
  299. package/src/generated/schemas/renderestimatepreview_body.ts +11 -7
  300. package/src/generated/schemas/renderinvoicepreview_body.ts +10 -16
  301. package/src/generated/schemas/reviewsloveniayearlynormiranireport.ts +15 -0
  302. package/src/generated/schemas/searcheinvoicingcustomer.ts +18 -0
  303. package/src/generated/schemas/senddocument_body.ts +1 -3
  304. package/src/generated/schemas/sendemail_body.ts +2 -24
  305. package/src/generated/schemas/sloveniataxprofile.ts +8 -10
  306. package/src/generated/schemas/starteslogexport_body.ts +4 -3
  307. package/src/generated/schemas/startpdfexport_body.ts +8 -87
  308. package/src/generated/schemas/stripeappconnect_body.ts +4 -3
  309. package/src/generated/schemas/stripeappcreateinvoice_body.ts +4 -6
  310. package/src/generated/schemas/stripeappmarketplaceauthorize.ts +15 -0
  311. package/src/generated/schemas/stripeappupdatesettings_body.ts +6 -6
  312. package/src/generated/schemas/supplier.ts +4 -8
  313. package/src/generated/schemas/syncshopifyorders_body.ts +4 -3
  314. package/src/generated/schemas/tax.ts +6 -8
  315. package/src/generated/schemas/uploadfile_body.ts +1 -3
  316. package/src/generated/schemas/uploadfurscertificate_body.ts +6 -6
  317. package/src/generated/schemas/userfinasettings.ts +1 -3
  318. package/src/generated/schemas/userfurssettings.ts +1 -3
  319. package/src/generated/schemas/userptsettings.ts +1 -3
  320. package/src/generated/schemas/voidinvoice_body.ts +8 -3
  321. package/src/generated/schemas/webhook.ts +4 -8
  322. package/src/generated/schemas/wlsubscriptionbillingemail.ts +17 -0
  323. package/src/hooks/use-duplicate-document.ts +61 -30
  324. package/src/lib/date-only.ts +58 -0
  325. package/src/lib/document-display.ts +18 -0
  326. package/src/lib/payment-display.ts +5 -3
  327. package/src/lib/schemas/shared.ts +11 -0
  328. package/src/providers/wl-subscription-provider.tsx +5 -0
  329. package/src/generated/schemas/account_webhook.ts +0 -43
  330. package/src/generated/schemas/previewadvanceinvoice_body.ts +0 -354
  331. package/src/generated/schemas/previewestimate_body.ts +0 -309
  332. package/src/generated/schemas/registerfinamovablepremise_body.ts +0 -26
  333. package/src/generated/schemas/registerfinarealestatepremise_body.ts +0 -37
  334. package/src/generated/schemas/renderdocument_body.ts +0 -594
@@ -1,3 +1,5 @@
1
+ import { normalizeDateOnlyInput } from "../../../lib/date-only";
2
+
1
3
  type CustomerData = {
2
4
  name?: string | null;
3
5
  address?: string | null;
@@ -8,7 +10,7 @@ type CustomerData = {
8
10
  country?: string | null;
9
11
  tax_number?: string | null;
10
12
  is_end_consumer?: boolean | null;
11
- save_customer?: boolean;
13
+ save_customer?: boolean | null;
12
14
  };
13
15
 
14
16
  type BaseDocumentValues = {
@@ -45,62 +47,31 @@ type PrepareDocumentOptions = {
45
47
  isDraft?: boolean;
46
48
  };
47
49
 
48
- /**
49
- * Prepares document form data for API submission.
50
- * Handles customer data transformation and payment data for all document types.
51
- *
52
- * This is a shared utility for invoices, estimates, and credit notes.
53
- *
54
- * @example
55
- * ```ts
56
- * // For invoice
57
- * const payload = prepareDocumentSubmission(values, {
58
- * originalCustomer,
59
- * wasCustomerFormShown: showCustomerForm,
60
- * markAsPaid: values.markAsPaid,
61
- * paymentType: values.paymentType,
62
- * documentType: "invoice",
63
- * secondaryDate: values.date_due,
64
- * });
65
- *
66
- * // For estimate
67
- * const payload = prepareDocumentSubmission(values, {
68
- * originalCustomer,
69
- * documentType: "estimate",
70
- * secondaryDate: values.date_valid_till,
71
- * });
72
- * ```
73
- */
74
- export function prepareDocumentSubmission<T extends BaseDocumentValues>(
75
- values: T,
76
- options: PrepareDocumentOptions,
77
- ): any {
78
- const nextValues: any = {
79
- ...values,
80
- customer: values.customer ? { ...values.customer } : values.customer,
81
- items: values.items
82
- ? values.items.map((item: any) => ({ ...item, taxes: item?.taxes ? [...item.taxes] : item?.taxes }))
83
- : values.items,
84
- };
50
+ const CLEARABLE_TEXT_FIELDS = ["note", "payment_terms", "reference", "signature", "tax_clause", "footer"] as const;
85
51
 
86
- // Document numbers are always auto-generated by the server
87
- // Remove number from payload (even if form provides a preview value)
52
+ export function normalizeClearableFormTextField(value: unknown): string | null | undefined {
53
+ if (value === undefined) return undefined;
54
+ if (value === null) return null;
55
+ if (typeof value !== "string") return undefined;
88
56
 
89
- // Handle customer logic
57
+ const trimmed = value.trim();
58
+ return trimmed === "" ? null : trimmed;
59
+ }
60
+
61
+ export function prepareDocumentCustomerData<T extends BaseDocumentValues>(
62
+ nextValues: T & { customer?: CustomerData | null; customer_id?: string | null },
63
+ options: Pick<PrepareDocumentOptions, "originalCustomer" | "wasCustomerFormShown">,
64
+ ): void {
90
65
  if (nextValues.customer_id && nextValues.customer) {
91
- // If customer form was not shown, remove customer data (keep only customer_id)
92
66
  if (options.wasCustomerFormShown === false) {
93
67
  delete nextValues.customer;
94
68
  } else {
95
- // Existing customer loaded - check if data was actually modified
96
69
  const customerChanged =
97
70
  options.originalCustomer && JSON.stringify(nextValues.customer) !== JSON.stringify(options.originalCustomer);
98
71
 
99
72
  if (!customerChanged) {
100
- // No changes - send only customer_id
101
73
  delete nextValues.customer;
102
74
  } else {
103
- // Changes detected - clean null/empty values and send with save_customer flag
104
75
  const cleanedCustomer: any = { save_customer: true };
105
76
  for (const [key, value] of Object.entries(nextValues.customer)) {
106
77
  if (key !== "save_customer" && value !== "" && value !== null && value !== undefined) {
@@ -111,7 +82,6 @@ export function prepareDocumentSubmission<T extends BaseDocumentValues>(
111
82
  }
112
83
  }
113
84
  } else if (nextValues.customer) {
114
- // New inline customer - clean null/empty values and add save flag
115
85
  const cleanedCustomer: any = { save_customer: true };
116
86
  let hasAnyValue = false;
117
87
 
@@ -128,84 +98,148 @@ export function prepareDocumentSubmission<T extends BaseDocumentValues>(
128
98
  nextValues.customer = cleanedCustomer;
129
99
  }
130
100
  }
101
+ }
131
102
 
132
- // Clean up customer_id if empty
103
+ export function cleanupEmptyCustomerId<T extends BaseDocumentValues>(nextValues: T & { customer_id?: string | null }): void {
133
104
  if (!nextValues.customer_id) {
134
105
  delete nextValues.customer_id;
135
106
  }
107
+ }
136
108
 
137
- // Clean up taxes and handle gross price transformation
138
- if (nextValues.items) {
139
- const priceModes = options.priceModes ?? {};
140
- nextValues.items = nextValues.items.map((item: any, index: number) => {
141
- // Separator items — pass through with only type, name, description
142
- if (item.type === "separator") {
143
- return {
144
- type: "separator",
145
- name: item.name,
146
- description: item.description || undefined,
147
- };
148
- }
149
-
150
- const { price, ...rest } = item;
151
-
152
- // Transform price based on price mode (from component state, not form)
153
- const isGrossPrice = priceModes[index] ?? false;
154
- const priceFields = isGrossPrice ? { gross_price: price } : { price };
109
+ export function prepareDocumentItems(items: any[] | undefined, priceModes: PriceModesMap = {}): any[] | undefined {
110
+ if (!items) {
111
+ return items;
112
+ }
155
113
 
114
+ return items.map((item: any, index: number) => {
115
+ if (item.type === "separator") {
156
116
  return {
157
- ...rest,
158
- ...priceFields,
159
- taxes: item.taxes
160
- ?.map((tax: any) => {
161
- if (tax.tax_id) {
162
- // Preserve PT exemption metadata while still allowing the API to resolve the tax rate by tax_id.
163
- return {
164
- tax_id: tax.tax_id,
165
- ...(tax.pt_exemption_code ? { pt_exemption_code: tax.pt_exemption_code } : {}),
166
- ...(tax.pt_exemption_reason ? { pt_exemption_reason: tax.pt_exemption_reason } : {}),
167
- };
168
- }
169
- return tax;
170
- })
171
- // Filter out empty placeholder taxes (UI adds { tax_id: undefined } for the dropdown)
172
- .filter((tax: any) => tax.tax_id || tax.rate !== undefined || tax.classification),
117
+ type: "separator",
118
+ name: item.name,
119
+ description: item.description || undefined,
173
120
  };
174
- });
175
- }
121
+ }
122
+
123
+ const { price, gross_price, ...rest } = item;
124
+ const isGrossPrice = priceModes[index] ?? false;
125
+ const effectivePrice = price ?? gross_price;
126
+ const priceFields =
127
+ effectivePrice === undefined ? {} : isGrossPrice ? { gross_price: effectivePrice } : { price: effectivePrice };
128
+
129
+ return {
130
+ ...rest,
131
+ ...priceFields,
132
+ taxes: item.taxes
133
+ ?.map((tax: any) => {
134
+ if (tax.tax_id) {
135
+ return {
136
+ tax_id: tax.tax_id,
137
+ ...(tax.pt_exemption_code ? { pt_exemption_code: tax.pt_exemption_code } : {}),
138
+ ...(tax.pt_exemption_reason ? { pt_exemption_reason: tax.pt_exemption_reason } : {}),
139
+ };
140
+ }
141
+ return tax;
142
+ })
143
+ .filter((tax: any) => tax.tax_id || tax.rate !== undefined || tax.classification),
144
+ };
145
+ });
146
+ }
176
147
 
177
- // Build payload with date conversions
178
- // Destructure to exclude fields we handle explicitly (number is always server-generated)
179
- const { number: _number, note, payment_terms, reference, signature, pt: _pt, ...restValues } = nextValues as any;
180
- const payload: any = {
148
+ export function buildDocumentBasePayload(
149
+ nextValues: Record<string, any>,
150
+ options: Pick<PrepareDocumentOptions, "documentType" | "secondaryDate">,
151
+ ): Record<string, any> {
152
+ const {
153
+ number: _number,
154
+ note,
155
+ payment_terms,
156
+ reference,
157
+ signature,
158
+ tax_clause,
159
+ footer,
160
+ pt: _pt,
161
+ ...restValues
162
+ } = nextValues;
163
+
164
+ const payload: Record<string, any> = {
181
165
  ...restValues,
182
- ...(note?.trim() && { note: note.trim() }),
183
- ...(reference?.trim() && { reference: reference.trim() }),
184
- // Advance invoices don't have payment terms - they are documents requesting payment
185
- ...(options.documentType !== "advance_invoice" && payment_terms?.trim() && { payment_terms: payment_terms.trim() }),
186
- ...(signature?.trim() && { signature: signature.trim() }),
187
- date: nextValues.date ? new Date(nextValues.date) : undefined,
166
+ date: normalizeDateOnlyInput(nextValues.date),
188
167
  };
189
168
 
190
- // Add secondary date field based on document type
169
+ for (const [key, value] of Object.entries({
170
+ note,
171
+ payment_terms: options.documentType !== "advance_invoice" ? payment_terms : undefined,
172
+ reference,
173
+ signature,
174
+ tax_clause,
175
+ footer,
176
+ })) {
177
+ const normalized = normalizeClearableFormTextField(value);
178
+ if (normalized !== undefined) {
179
+ payload[key] = normalized;
180
+ }
181
+ }
182
+
191
183
  if ((options.documentType === "invoice" || options.documentType === "advance_invoice") && options.secondaryDate) {
192
- payload.date_due = new Date(options.secondaryDate);
184
+ payload.date_due = normalizeDateOnlyInput(options.secondaryDate);
193
185
  } else if (options.documentType === "estimate" && options.secondaryDate) {
194
- payload.date_valid_till = new Date(options.secondaryDate);
186
+ payload.date_valid_till = normalizeDateOnlyInput(options.secondaryDate);
195
187
  }
196
- // Credit notes don't have a secondary date field
197
188
 
198
- // Add service date fields for invoices and credit notes
199
189
  if (options.documentType === "invoice" || options.documentType === "credit_note") {
200
- const v = nextValues as any;
201
- if (v.date_service) {
202
- payload.date_service = new Date(v.date_service);
190
+ if (nextValues.date_service) {
191
+ payload.date_service = normalizeDateOnlyInput(nextValues.date_service);
203
192
  }
204
- if (v.date_service_to) {
205
- payload.date_service_to = new Date(v.date_service_to);
193
+ if (nextValues.date_service_to) {
194
+ payload.date_service_to = normalizeDateOnlyInput(nextValues.date_service_to);
206
195
  }
207
196
  }
208
197
 
198
+ return payload;
199
+ }
200
+
201
+ /**
202
+ * Prepares document form data for API submission.
203
+ * Handles customer data transformation and payment data for all document types.
204
+ *
205
+ * This is a shared utility for invoices, estimates, and credit notes.
206
+ *
207
+ * @example
208
+ * ```ts
209
+ * // For invoice
210
+ * const payload = prepareDocumentSubmission(values, {
211
+ * originalCustomer,
212
+ * wasCustomerFormShown: showCustomerForm,
213
+ * markAsPaid: values.markAsPaid,
214
+ * paymentType: values.paymentType,
215
+ * documentType: "invoice",
216
+ * secondaryDate: values.date_due,
217
+ * });
218
+ *
219
+ * // For estimate
220
+ * const payload = prepareDocumentSubmission(values, {
221
+ * originalCustomer,
222
+ * documentType: "estimate",
223
+ * secondaryDate: values.date_valid_till,
224
+ * });
225
+ * ```
226
+ */
227
+ export function prepareDocumentSubmission<T extends BaseDocumentValues>(
228
+ values: T,
229
+ options: PrepareDocumentOptions,
230
+ ): any {
231
+ const nextValues: any = {
232
+ ...values,
233
+ customer: values.customer ? { ...values.customer } : values.customer,
234
+ items: values.items
235
+ ? values.items.map((item: any) => ({ ...item, taxes: item?.taxes ? [...item.taxes] : item?.taxes }))
236
+ : values.items,
237
+ };
238
+ prepareDocumentCustomerData(nextValues, options);
239
+ cleanupEmptyCustomerId(nextValues);
240
+ nextValues.items = prepareDocumentItems(nextValues.items, options.priceModes ?? {});
241
+ const payload: any = buildDocumentBasePayload(nextValues, options);
242
+
209
243
  // Handle markAsPaid for invoices and credit notes
210
244
  if (options.documentType !== "estimate" && options.markAsPaid) {
211
245
  const serializedPayments =
@@ -233,5 +267,11 @@ export function prepareDocumentSubmission<T extends BaseDocumentValues>(
233
267
  payload.is_draft = true;
234
268
  }
235
269
 
270
+ for (const field of CLEARABLE_TEXT_FIELDS) {
271
+ if (payload[field] === undefined || payload[field] === null) {
272
+ delete payload[field];
273
+ }
274
+ }
275
+
236
276
  return payload;
237
277
  }
@@ -1,4 +1,5 @@
1
1
  import type { CreateInvoiceRequest } from "@spaceinvoices/js-sdk";
2
+ import { normalizeDateOnlyInput } from "../../../lib/date-only";
2
3
 
3
4
  type ItemWithTaxes = NonNullable<CreateInvoiceRequest["items"]>[number];
4
5
 
@@ -14,3 +15,14 @@ export function filterUnresolvedTaxes(items: ItemWithTaxes[] | undefined): ItemW
14
15
  taxes: (item.taxes || []).filter((tax) => tax.tax_id != null),
15
16
  }));
16
17
  }
18
+
19
+ export function normalizeDocumentPreviewDates<T extends Record<string, any>>(document: T): T {
20
+ return {
21
+ ...document,
22
+ ...(document.date ? { date: normalizeDateOnlyInput(document.date) } : {}),
23
+ ...(document.date_due ? { date_due: normalizeDateOnlyInput(document.date_due) } : {}),
24
+ ...(document.date_valid_till ? { date_valid_till: normalizeDateOnlyInput(document.date_valid_till) } : {}),
25
+ ...(document.date_service ? { date_service: normalizeDateOnlyInput(document.date_service) } : {}),
26
+ ...(document.date_service_to ? { date_service_to: normalizeDateOnlyInput(document.date_service_to) } : {}),
27
+ };
28
+ }
@@ -0,0 +1,90 @@
1
+ import { prepareDocumentItems } from "./prepare-document-submission";
2
+
3
+ type PriceModesMap = Record<number, boolean>;
4
+
5
+ type ResolvePreservedExpectedTotalOptions = {
6
+ initialExpectedTotalWithTax?: number | null;
7
+ initialItems?: any[];
8
+ currentItems?: any[];
9
+ initialCurrencyCode?: string | null;
10
+ currentCurrencyCode?: string | null;
11
+ initialCalculationMode?: string | null;
12
+ currentCalculationMode?: string | null;
13
+ initialPriceModes?: PriceModesMap;
14
+ currentPriceModes?: PriceModesMap;
15
+ };
16
+
17
+ function round2(value: number): number {
18
+ return Math.round(value * 100) / 100;
19
+ }
20
+
21
+ function normalizeTaxes(taxes: any[] | undefined): any[] {
22
+ return (taxes ?? []).map((tax) => ({
23
+ tax_id: tax?.tax_id ?? null,
24
+ rate: tax?.rate ?? null,
25
+ classification: tax?.classification ?? null,
26
+ reverse_charge: tax?.reverse_charge ?? false,
27
+ pt_exemption_code: tax?.pt_exemption_code ?? null,
28
+ pt_exemption_reason: tax?.pt_exemption_reason ?? null,
29
+ }));
30
+ }
31
+
32
+ function normalizeDiscounts(discounts: any[] | undefined): any[] {
33
+ return (discounts ?? []).map((discount) => ({
34
+ value: discount?.value ?? null,
35
+ type: discount?.type ?? "percent",
36
+ }));
37
+ }
38
+
39
+ function normalizeComparableItems(items: any[] | undefined, priceModes: PriceModesMap = {}): any[] {
40
+ return (prepareDocumentItems(items, priceModes) ?? []).map((item) => {
41
+ if (item?.type === "separator") {
42
+ return { type: "separator" };
43
+ }
44
+
45
+ return {
46
+ type: item?.type ?? null,
47
+ quantity: item?.quantity ?? null,
48
+ price: item?.price ?? null,
49
+ gross_price: item?.gross_price ?? null,
50
+ taxes: normalizeTaxes(item?.taxes),
51
+ discounts: normalizeDiscounts(item?.discounts),
52
+ };
53
+ });
54
+ }
55
+
56
+ export function financialInputsMatchInitial(options: Omit<ResolvePreservedExpectedTotalOptions, "initialExpectedTotalWithTax">): boolean {
57
+ if ((options.initialCurrencyCode ?? null) !== (options.currentCurrencyCode ?? null)) {
58
+ return false;
59
+ }
60
+
61
+ if ((options.initialCalculationMode ?? null) !== (options.currentCalculationMode ?? null)) {
62
+ return false;
63
+ }
64
+
65
+ const initialComparableItems = normalizeComparableItems(options.initialItems, options.initialPriceModes);
66
+ const currentComparableItems = normalizeComparableItems(options.currentItems, options.currentPriceModes);
67
+
68
+ return JSON.stringify(initialComparableItems) === JSON.stringify(currentComparableItems);
69
+ }
70
+
71
+ export function resolvePreservedExpectedTotal(options: ResolvePreservedExpectedTotalOptions): number | undefined {
72
+ const initialExpectedTotalWithTax = options.initialExpectedTotalWithTax;
73
+ if (initialExpectedTotalWithTax == null) {
74
+ return undefined;
75
+ }
76
+
77
+ return financialInputsMatchInitial(options) ? initialExpectedTotalWithTax : undefined;
78
+ }
79
+
80
+ export function totalsDifferByCents(left: number | null | undefined, right: number | null | undefined): boolean {
81
+ if (left == null || right == null) {
82
+ return false;
83
+ }
84
+
85
+ return Math.round(left * 100) !== Math.round(right * 100);
86
+ }
87
+
88
+ export function roundMoney(value: number): number {
89
+ return round2(value);
90
+ }
@@ -1,6 +1,8 @@
1
1
  import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
2
2
  import { Badge } from "@/ui/components/ui/badge";
3
3
  import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/card";
4
+ import { formatDateOnlyForDisplay } from "@/ui/lib/date-only";
5
+ import { getDisplayDocumentNumber } from "@/ui/lib/document-display";
4
6
  import type { ComponentTranslationProps } from "@/ui/lib/translation";
5
7
  import { createTranslation } from "@/ui/lib/translation";
6
8
  import { getDocumentConfig, type DocumentTypes } from "../types";
@@ -235,16 +237,6 @@ function formatCurrency(amount: number, currencyCode: string, locale: string): s
235
237
  }).format(amount);
236
238
  }
237
239
 
238
- function formatDate(date: Date | string | null | undefined, locale: string): string {
239
- if (!date) return "-";
240
- const d = typeof date === "string" ? new Date(date) : date;
241
- return new Intl.DateTimeFormat(locale, {
242
- year: "numeric",
243
- month: "short",
244
- day: "numeric",
245
- }).format(d);
246
- }
247
-
248
240
  export function PublicDocumentSummary({
249
241
  document,
250
242
  documentType,
@@ -256,9 +248,10 @@ export function PublicDocumentSummary({
256
248
  const currencyCode = document.currency_code;
257
249
  const sign = documentType === "credit_note" ? -1 : 1;
258
250
  const fmt = (amount: number) => formatCurrency(amount, currencyCode, locale);
259
- const fmtDate = (date: Date | string | null | undefined) => formatDate(date, locale);
251
+ const fmtDate = (date: Date | string | null | undefined) => formatDateOnlyForDisplay(date, locale);
260
252
  const config = getDocumentConfig(documentType);
261
253
  const resolvedDocumentTypeLabel = documentTypeLabel ?? t(config.singularName);
254
+ const displayNumber = getDisplayDocumentNumber(document, t);
262
255
  const isInvoiceLike = documentType === "invoice" || documentType === "advance_invoice";
263
256
  const isEstimate = documentType === "estimate";
264
257
  const invoiceDoc = document as Invoice | AdvanceInvoice;
@@ -275,7 +268,7 @@ export function PublicDocumentSummary({
275
268
 
276
269
  const rows: Array<{ label: string; value: string }> = [
277
270
  { label: t("Type"), value: resolvedDocumentTypeLabel },
278
- { label: t("Number"), value: document.number },
271
+ { label: t("Number"), value: displayNumber },
279
272
  { label: t("Date"), value: fmtDate(document.date) },
280
273
  ];
281
274
 
@@ -323,7 +316,7 @@ export function PublicDocumentSummary({
323
316
  <div className="flex items-start justify-between gap-3">
324
317
  <div className="space-y-1">
325
318
  <CardTitle>{resolvedDocumentTypeLabel}</CardTitle>
326
- <p className="text-muted-foreground text-sm">{document.number}</p>
319
+ <p className="text-muted-foreground text-sm">{displayNumber}</p>
327
320
  </div>
328
321
  <Badge variant={statusBadge.variant}>{statusBadge.label}</Badge>
329
322
  </div>
@@ -32,18 +32,27 @@ import { getDocumentCountryCapabilities } from "@/ui/lib/country-capabilities";
32
32
  import type { ComponentTranslationProps } from "@/ui/lib/translation";
33
33
  import { createTranslation } from "@/ui/lib/translation";
34
34
  import type { Entity } from "@/ui/providers/entities-context";
35
+ import bg from "./locales/bg";
36
+ import cs from "./locales/cs";
35
37
  import de from "./locales/de";
38
+ import en from "./locales/en";
36
39
  import es from "./locales/es";
40
+ import et from "./locales/et";
41
+ import fi from "./locales/fi";
37
42
  import fr from "./locales/fr";
38
43
  import hr from "./locales/hr";
44
+ import is from "./locales/is";
39
45
  import it from "./locales/it";
46
+ import nb from "./locales/nb";
40
47
  import nl from "./locales/nl";
41
48
  import pl from "./locales/pl";
42
49
  import pt from "./locales/pt";
50
+ import sk from "./locales/sk";
43
51
  import sl from "./locales/sl";
52
+ import sv from "./locales/sv";
44
53
  import { useDocumentDownload } from "./use-document-download";
45
54
 
46
- const translations = { sl, de, it, fr, es, pt, nl, pl, hr } as const;
55
+ const translations = { en, sl, de, it, fr, es, pt, nl, pl, hr, sv, fi, et, bg, cs, sk, nb, is } as const;
47
56
 
48
57
  type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
49
58
 
@@ -2,6 +2,8 @@ import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from
2
2
  import { Badge } from "@/ui/components/ui/badge";
3
3
  import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/card";
4
4
  import { Separator } from "@/ui/components/ui/separator";
5
+ import { formatDateOnlyForDisplay } from "@/ui/lib/date-only";
6
+ import { getDisplayDocumentNumber } from "@/ui/lib/document-display";
5
7
  import type { ComponentTranslationProps } from "@/ui/lib/translation";
6
8
  import { createTranslation } from "@/ui/lib/translation";
7
9
  import de from "./locales/de";
@@ -33,16 +35,6 @@ function formatCurrency(amount: number, currencyCode: string, locale: string): s
33
35
  }).format(amount);
34
36
  }
35
37
 
36
- function formatDate(date: Date | string | null | undefined, locale: string): string {
37
- if (!date) return "-";
38
- const d = typeof date === "string" ? new Date(date) : date;
39
- return new Intl.DateTimeFormat(locale, {
40
- year: "numeric",
41
- month: "short",
42
- day: "numeric",
43
- }).format(d);
44
- }
45
-
46
38
  /**
47
39
  * Get payment status for invoice/advance invoice
48
40
  */
@@ -74,7 +66,7 @@ export function DocumentDetailsCard({
74
66
  const currencyCode = document.currency_code;
75
67
  const sign = documentType === "credit_note" ? -1 : 1;
76
68
  const fmt = (amount: number) => formatCurrency(amount, currencyCode, locale);
77
- const fmtDate = (date: Date | string | null | undefined) => formatDate(date, locale);
69
+ const fmtDate = (date: Date | string | null | undefined) => formatDateOnlyForDisplay(date, locale);
78
70
 
79
71
  const isInvoiceOrAdvance = documentType === "invoice" || documentType === "advance_invoice";
80
72
  const isEstimate = documentType === "estimate";
@@ -86,7 +78,7 @@ export function DocumentDetailsCard({
86
78
  <>
87
79
  <div className="grid grid-cols-2 gap-x-4 gap-y-2 text-sm">
88
80
  <div className="text-muted-foreground">{t("Number")}</div>
89
- <div className="text-right font-medium">{document.number}</div>
81
+ <div className="text-right font-medium">{getDisplayDocumentNumber(document, t)}</div>
90
82
 
91
83
  <div className="text-muted-foreground">{t("Date")}</div>
92
84
  <div className="text-right">{fmtDate(document.date)}</div>
@@ -18,7 +18,7 @@ type RelatedDocumentSummary = {
18
18
  id: string;
19
19
  type: "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
20
20
  number: string;
21
- title_type?: "estimate" | "quote" | null;
21
+ title_type?: "estimate" | "proforma_invoice" | null;
22
22
  };
23
23
  type DocumentRelationWithSummary = DocumentRelation & {
24
24
  related_document?: RelatedDocumentSummary;
@@ -35,10 +35,10 @@ interface DocumentRelationsListProps extends ComponentTranslationProps {
35
35
  function getDocumentTypeLabel(
36
36
  type: string,
37
37
  t: (key: string) => string,
38
- titleType?: "estimate" | "quote" | null,
38
+ titleType?: "estimate" | "proforma_invoice" | null,
39
39
  ): string {
40
- if (type === "estimate" && titleType === "quote") {
41
- return t("Quote");
40
+ if (type === "estimate" && titleType === "proforma_invoice") {
41
+ return t("Proforma invoice");
42
42
  }
43
43
 
44
44
  const labels: Record<string, string> = {
@@ -14,14 +14,14 @@ export default {
14
14
  "e-SLOG download failed": "e-SLOG download failed",
15
15
  Recurring: "Recurring",
16
16
  Duplicate: "Duplicate",
17
- "Duplicate invoice": "Duplicate invoice",
18
- "Duplicate estimate": "Duplicate estimate",
19
- "Duplicate credit_note": "Duplicate credit_note",
20
- "Duplicate advance_invoice": "Duplicate advance_invoice",
21
- "Duplicate delivery_note": "Duplicate delivery_note",
22
- "Create invoice": "Create invoice",
17
+ "Duplicate invoice": "Дублирай фактура",
18
+ "Duplicate estimate": "Дублирай оферта",
19
+ "Duplicate credit_note": "Дублирай кредитно известие",
20
+ "Duplicate advance_invoice": "Дублирай авансова фактура",
21
+ "Duplicate delivery_note": "Дублирай доставна бележка",
22
+ "Create invoice": "Създай фактура",
23
23
  "Create estimate": "Създайте оценка",
24
- "Create credit_note": "Create credit_note",
24
+ "Create credit_note": "Създай кредитно известие",
25
25
  "Create advance_invoice": "Създай авансова фактура",
26
26
  "Create delivery_note": "Създай доставна бележка",
27
27
  Details: "Детайли",
@@ -46,7 +46,7 @@ export default {
46
46
  Voided: "Анулирана",
47
47
  Overdue: "Просрочени",
48
48
  Shareable: "Shareable",
49
- Quote: "Quote",
49
+ "Proforma invoice": "Проформа фактура",
50
50
  "Packing list": "Packing list",
51
51
  "FURS fiscalization failed": "FURS fiscalization failed",
52
52
  "FINA fiscalization failed": "FINA fiscalization failed",
@@ -14,14 +14,14 @@ export default {
14
14
  "e-SLOG download failed": "e-SLOG download failed",
15
15
  Recurring: "Recurring",
16
16
  Duplicate: "Duplicate",
17
- "Duplicate invoice": "Duplicate invoice",
18
- "Duplicate estimate": "Duplicate estimate",
19
- "Duplicate credit_note": "Duplicate credit_note",
20
- "Duplicate advance_invoice": "Duplicate advance_invoice",
21
- "Duplicate delivery_note": "Duplicate delivery_note",
22
- "Create invoice": "Create invoice",
17
+ "Duplicate invoice": "Duplikovat fakturu",
18
+ "Duplicate estimate": "Duplikovat odhad",
19
+ "Duplicate credit_note": "Duplikovat dobropis",
20
+ "Duplicate advance_invoice": "Duplikovat zálohovou fakturu",
21
+ "Duplicate delivery_note": "Duplikovat dodací list",
22
+ "Create invoice": "Vytvořit fakturu",
23
23
  "Create estimate": "Vytvořte odhad",
24
- "Create credit_note": "Create credit_note",
24
+ "Create credit_note": "Vytvořit dobropis",
25
25
  "Create advance_invoice": "Vytvořit zálohovou fakturu",
26
26
  "Create delivery_note": "Vytvořit dodací list",
27
27
  Details: "Údaje",
@@ -46,7 +46,7 @@ export default {
46
46
  Voided: "Stornováno",
47
47
  Overdue: "Po splatnosti",
48
48
  Shareable: "Shareable",
49
- Quote: "Quote",
49
+ "Proforma invoice": "Proforma faktura",
50
50
  "Packing list": "Packing list",
51
51
  "FURS fiscalization failed": "FURS fiscalization failed",
52
52
  "FINA fiscalization failed": "FINA fiscalization failed",
@@ -52,7 +52,7 @@ export default {
52
52
  Voided: "Storniert",
53
53
  Overdue: "Überfällig",
54
54
  Shareable: "Freigegeben",
55
- Quote: "Angebot",
55
+ "Proforma invoice": "Proformarechnung",
56
56
  "Packing list": "Packliste",
57
57
  "FURS fiscalization failed": "FURS-Fiskalisierung fehlgeschlagen",
58
58
  "FINA fiscalization failed": "FINA-Fiskalisierung fehlgeschlagen",