@spaceinvoices/react-ui 0.1.1 → 0.3.0

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 (400) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/registry.json +287 -122
  4. package/src/components/activities/activity-timeline.tsx +8 -1
  5. package/src/components/activities/locales/es.ts +30 -0
  6. package/src/components/activities/locales/fr.ts +30 -0
  7. package/src/components/activities/locales/hr.ts +30 -0
  8. package/src/components/activities/locales/it.ts +30 -0
  9. package/src/components/activities/locales/nl.ts +30 -0
  10. package/src/components/activities/locales/pl.ts +30 -0
  11. package/src/components/activities/locales/pt.ts +30 -0
  12. package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +21 -7
  13. package/src/components/advance-invoices/create/locales/es.ts +29 -0
  14. package/src/components/advance-invoices/create/locales/fr.ts +28 -0
  15. package/src/components/advance-invoices/create/locales/hr.ts +27 -0
  16. package/src/components/advance-invoices/create/locales/it.ts +29 -0
  17. package/src/components/advance-invoices/create/locales/nl.ts +28 -0
  18. package/src/components/advance-invoices/create/locales/pl.ts +28 -0
  19. package/src/components/advance-invoices/create/locales/pt.ts +29 -0
  20. package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +3 -3
  21. package/src/components/advance-invoices/list/list-table.tsx +20 -3
  22. package/src/components/advance-invoices/list/locales/de.ts +9 -0
  23. package/src/components/advance-invoices/list/locales/en.ts +8 -0
  24. package/src/components/advance-invoices/list/locales/es.ts +41 -0
  25. package/src/components/advance-invoices/list/locales/fr.ts +41 -0
  26. package/src/components/advance-invoices/list/locales/hr.ts +41 -0
  27. package/src/components/advance-invoices/list/locales/it.ts +41 -0
  28. package/src/components/advance-invoices/list/locales/nl.ts +41 -0
  29. package/src/components/advance-invoices/list/locales/pl.ts +41 -0
  30. package/src/components/advance-invoices/list/locales/pt.ts +41 -0
  31. package/src/components/advance-invoices/list/locales/sl.ts +9 -0
  32. package/src/components/credit-notes/create/create-credit-note-form.tsx +19 -5
  33. package/src/components/credit-notes/create/locales/es.ts +68 -0
  34. package/src/components/credit-notes/create/locales/fr.ts +69 -0
  35. package/src/components/credit-notes/create/locales/hr.ts +68 -0
  36. package/src/components/credit-notes/create/locales/it.ts +68 -0
  37. package/src/components/credit-notes/create/locales/nl.ts +69 -0
  38. package/src/components/credit-notes/create/locales/pl.ts +68 -0
  39. package/src/components/credit-notes/create/locales/pt.ts +68 -0
  40. package/src/components/credit-notes/list/list-table.tsx +25 -8
  41. package/src/components/credit-notes/list/locales/de.ts +10 -2
  42. package/src/components/credit-notes/list/locales/en.ts +8 -0
  43. package/src/components/credit-notes/list/locales/es.ts +41 -0
  44. package/src/components/credit-notes/list/locales/fr.ts +41 -0
  45. package/src/components/credit-notes/list/locales/hr.ts +41 -0
  46. package/src/components/credit-notes/list/locales/it.ts +41 -0
  47. package/src/components/credit-notes/list/locales/nl.ts +41 -0
  48. package/src/components/credit-notes/list/locales/pl.ts +41 -0
  49. package/src/components/credit-notes/list/locales/pt.ts +41 -0
  50. package/src/components/credit-notes/list/locales/sl.ts +10 -2
  51. package/src/components/customers/create-customer-form/create-customer-form.tsx +21 -3
  52. package/src/components/customers/create-customer-form/locales/de.ts +1 -0
  53. package/src/components/customers/create-customer-form/locales/es.ts +21 -0
  54. package/src/components/customers/create-customer-form/locales/fr.ts +21 -0
  55. package/src/components/customers/create-customer-form/locales/hr.ts +21 -0
  56. package/src/components/customers/create-customer-form/locales/it.ts +21 -0
  57. package/src/components/customers/create-customer-form/locales/nl.ts +21 -0
  58. package/src/components/customers/create-customer-form/locales/pl.ts +21 -0
  59. package/src/components/customers/create-customer-form/locales/pt.ts +21 -0
  60. package/src/components/customers/create-customer-form/locales/sl.ts +1 -0
  61. package/src/components/customers/customer-list-table/customer-list-row-actions.tsx +72 -16
  62. package/src/components/customers/customer-list-table/customer-list-table.tsx +35 -2
  63. package/src/components/customers/customer-list-table/locales/de.ts +9 -0
  64. package/src/components/customers/customer-list-table/locales/en.ts +10 -0
  65. package/src/components/customers/customer-list-table/locales/es.ts +25 -0
  66. package/src/components/customers/customer-list-table/locales/fr.ts +25 -0
  67. package/src/components/customers/customer-list-table/locales/hr.ts +25 -0
  68. package/src/components/customers/customer-list-table/locales/it.ts +25 -0
  69. package/src/components/customers/customer-list-table/locales/nl.ts +25 -0
  70. package/src/components/customers/customer-list-table/locales/pl.ts +25 -0
  71. package/src/components/customers/customer-list-table/locales/pt.ts +25 -0
  72. package/src/components/customers/customer-list-table/locales/sl.ts +9 -0
  73. package/src/components/customers/customers.hooks.test.ts +8 -8
  74. package/src/components/customers/customers.hooks.ts +6 -1
  75. package/src/components/customers/edit-customer-form/edit-customer-form.tsx +143 -0
  76. package/src/components/customers/edit-customer-form/locales/de.ts +13 -0
  77. package/src/components/customers/edit-customer-form/locales/es.ts +13 -0
  78. package/src/components/customers/edit-customer-form/locales/fr.ts +13 -0
  79. package/src/components/customers/edit-customer-form/locales/hr.ts +13 -0
  80. package/src/components/customers/edit-customer-form/locales/it.ts +13 -0
  81. package/src/components/customers/edit-customer-form/locales/nl.ts +13 -0
  82. package/src/components/customers/edit-customer-form/locales/pl.ts +13 -0
  83. package/src/components/customers/edit-customer-form/locales/pt.ts +13 -0
  84. package/src/components/customers/edit-customer-form/locales/sl.ts +13 -0
  85. package/src/components/customers/index.ts +1 -0
  86. package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +9 -1
  87. package/src/components/dashboard/collection-rate-card/locales/de.ts +3 -0
  88. package/src/components/dashboard/collection-rate-card/locales/es.ts +3 -0
  89. package/src/components/dashboard/collection-rate-card/locales/fr.ts +3 -0
  90. package/src/components/dashboard/collection-rate-card/locales/hr.ts +3 -0
  91. package/src/components/dashboard/collection-rate-card/locales/it.ts +3 -0
  92. package/src/components/dashboard/collection-rate-card/locales/nl.ts +3 -0
  93. package/src/components/dashboard/collection-rate-card/locales/pl.ts +3 -0
  94. package/src/components/dashboard/collection-rate-card/locales/pt.ts +3 -0
  95. package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +9 -1
  96. package/src/components/dashboard/invoice-status-chart/locales/de.ts +9 -0
  97. package/src/components/dashboard/invoice-status-chart/locales/es.ts +9 -0
  98. package/src/components/dashboard/invoice-status-chart/locales/fr.ts +9 -0
  99. package/src/components/dashboard/invoice-status-chart/locales/hr.ts +9 -0
  100. package/src/components/dashboard/invoice-status-chart/locales/it.ts +9 -0
  101. package/src/components/dashboard/invoice-status-chart/locales/nl.ts +9 -0
  102. package/src/components/dashboard/invoice-status-chart/locales/pl.ts +9 -0
  103. package/src/components/dashboard/invoice-status-chart/locales/pt.ts +9 -0
  104. package/src/components/dashboard/payment-methods-chart/locales/de.ts +12 -0
  105. package/src/components/dashboard/payment-methods-chart/locales/es.ts +12 -0
  106. package/src/components/dashboard/payment-methods-chart/locales/fr.ts +12 -0
  107. package/src/components/dashboard/payment-methods-chart/locales/hr.ts +12 -0
  108. package/src/components/dashboard/payment-methods-chart/locales/it.ts +12 -0
  109. package/src/components/dashboard/payment-methods-chart/locales/nl.ts +12 -0
  110. package/src/components/dashboard/payment-methods-chart/locales/pl.ts +12 -0
  111. package/src/components/dashboard/payment-methods-chart/locales/pt.ts +12 -0
  112. package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +9 -1
  113. package/src/components/dashboard/payment-trend-chart/locales/de.ts +5 -0
  114. package/src/components/dashboard/payment-trend-chart/locales/es.ts +5 -0
  115. package/src/components/dashboard/payment-trend-chart/locales/fr.ts +5 -0
  116. package/src/components/dashboard/payment-trend-chart/locales/hr.ts +5 -0
  117. package/src/components/dashboard/payment-trend-chart/locales/it.ts +5 -0
  118. package/src/components/dashboard/payment-trend-chart/locales/nl.ts +5 -0
  119. package/src/components/dashboard/payment-trend-chart/locales/pl.ts +5 -0
  120. package/src/components/dashboard/payment-trend-chart/locales/pt.ts +5 -0
  121. package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +10 -2
  122. package/src/components/dashboard/revenue-trend-chart/locales/de.ts +5 -0
  123. package/src/components/dashboard/revenue-trend-chart/locales/es.ts +5 -0
  124. package/src/components/dashboard/revenue-trend-chart/locales/fr.ts +5 -0
  125. package/src/components/dashboard/revenue-trend-chart/locales/hr.ts +5 -0
  126. package/src/components/dashboard/revenue-trend-chart/locales/it.ts +5 -0
  127. package/src/components/dashboard/revenue-trend-chart/locales/nl.ts +5 -0
  128. package/src/components/dashboard/revenue-trend-chart/locales/pl.ts +5 -0
  129. package/src/components/dashboard/revenue-trend-chart/locales/pt.ts +5 -0
  130. package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +10 -2
  131. package/src/components/dashboard/top-customers-chart/locales/de.ts +5 -0
  132. package/src/components/dashboard/top-customers-chart/locales/es.ts +5 -0
  133. package/src/components/dashboard/top-customers-chart/locales/fr.ts +5 -0
  134. package/src/components/dashboard/top-customers-chart/locales/hr.ts +5 -0
  135. package/src/components/dashboard/top-customers-chart/locales/it.ts +5 -0
  136. package/src/components/dashboard/top-customers-chart/locales/nl.ts +5 -0
  137. package/src/components/dashboard/top-customers-chart/locales/pl.ts +5 -0
  138. package/src/components/dashboard/top-customers-chart/locales/pt.ts +5 -0
  139. package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +10 -2
  140. package/src/components/documents/create/document-add-item-form.tsx +1 -1
  141. package/src/components/documents/create/form-types.ts +1 -5
  142. package/src/components/documents/create/mark-as-paid-section.tsx +60 -23
  143. package/src/components/documents/create/prepare-document-submission.test.ts +2 -2
  144. package/src/components/documents/create/prepare-document-submission.ts +12 -7
  145. package/src/components/documents/create/prepare-preview-data.test.ts +1 -1
  146. package/src/components/documents/view/document-actions-bar.tsx +8 -1
  147. package/src/components/documents/view/document-details-card.tsx +8 -1
  148. package/src/components/documents/view/document-payments-list.tsx +8 -1
  149. package/src/components/documents/view/locales/es.ts +83 -0
  150. package/src/components/documents/view/locales/fr.ts +83 -0
  151. package/src/components/documents/view/locales/hr.ts +83 -0
  152. package/src/components/documents/view/locales/it.ts +83 -0
  153. package/src/components/documents/view/locales/nl.ts +84 -0
  154. package/src/components/documents/view/locales/pl.ts +83 -0
  155. package/src/components/documents/view/locales/pt.ts +83 -0
  156. package/src/components/entities/create-entity-form.tsx +12 -2
  157. package/src/components/entities/entity-settings-form/entity-settings-form.tsx +18 -0
  158. package/src/components/entities/entity-settings-form/locales/de.ts +3 -1
  159. package/src/components/entities/entity-settings-form/locales/es.ts +197 -0
  160. package/src/components/entities/entity-settings-form/locales/fr.ts +196 -0
  161. package/src/components/entities/entity-settings-form/locales/hr.ts +189 -0
  162. package/src/components/entities/entity-settings-form/locales/it.ts +195 -0
  163. package/src/components/entities/entity-settings-form/locales/nl.ts +192 -0
  164. package/src/components/entities/entity-settings-form/locales/pl.ts +193 -0
  165. package/src/components/entities/entity-settings-form/locales/pt.ts +194 -0
  166. package/src/components/entities/entity-settings-form/locales/sl.ts +2 -0
  167. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +461 -0
  168. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +215 -0
  169. package/src/components/entities/fina-settings-form/index.ts +3 -0
  170. package/src/components/entities/fina-settings-form/locales/de.ts +145 -0
  171. package/src/components/entities/fina-settings-form/locales/en.ts +142 -0
  172. package/src/components/entities/fina-settings-form/locales/es.ts +143 -0
  173. package/src/components/entities/fina-settings-form/locales/fr.ts +142 -0
  174. package/src/components/entities/fina-settings-form/locales/hr.ts +144 -0
  175. package/src/components/entities/fina-settings-form/locales/it.ts +144 -0
  176. package/src/components/entities/fina-settings-form/locales/nl.ts +144 -0
  177. package/src/components/entities/fina-settings-form/locales/pl.ts +142 -0
  178. package/src/components/entities/fina-settings-form/locales/pt.ts +144 -0
  179. package/src/components/entities/fina-settings-form/locales/sl.ts +144 -0
  180. package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +233 -0
  181. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +363 -0
  182. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +395 -0
  183. package/src/components/entities/furs-settings-form/furs-settings-form.tsx +9 -2
  184. package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +15 -11
  185. package/src/components/entities/furs-settings-form/locales/de.ts +52 -88
  186. package/src/components/entities/furs-settings-form/locales/en.ts +3 -0
  187. package/src/components/entities/furs-settings-form/locales/es.ts +196 -0
  188. package/src/components/entities/furs-settings-form/locales/fr.ts +196 -0
  189. package/src/components/entities/furs-settings-form/locales/hr.ts +195 -0
  190. package/src/components/entities/furs-settings-form/locales/it.ts +196 -0
  191. package/src/components/entities/furs-settings-form/locales/nl.ts +195 -0
  192. package/src/components/entities/furs-settings-form/locales/pl.ts +194 -0
  193. package/src/components/entities/furs-settings-form/locales/pt.ts +195 -0
  194. package/src/components/entities/furs-settings-form/locales/sl.ts +2 -0
  195. package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +19 -4
  196. package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +17 -66
  197. package/src/components/entities/keys.ts +1 -1
  198. package/src/components/entities/settings/company-settings-form.tsx +28 -0
  199. package/src/components/entities/settings/pdf-template-selector/locales/es.ts +18 -0
  200. package/src/components/entities/settings/pdf-template-selector/locales/fr.ts +18 -0
  201. package/src/components/entities/settings/pdf-template-selector/locales/hr.ts +18 -0
  202. package/src/components/entities/settings/pdf-template-selector/locales/it.ts +18 -0
  203. package/src/components/entities/settings/pdf-template-selector/locales/nl.ts +17 -0
  204. package/src/components/entities/settings/pdf-template-selector/locales/pl.ts +18 -0
  205. package/src/components/entities/settings/pdf-template-selector/locales/pt.ts +18 -0
  206. package/src/components/estimates/create/create-estimate-form.tsx +14 -0
  207. package/src/components/estimates/create/locales/es.ts +57 -0
  208. package/src/components/estimates/create/locales/fr.ts +58 -0
  209. package/src/components/estimates/create/locales/hr.ts +57 -0
  210. package/src/components/estimates/create/locales/it.ts +57 -0
  211. package/src/components/estimates/create/locales/nl.ts +58 -0
  212. package/src/components/estimates/create/locales/pl.ts +57 -0
  213. package/src/components/estimates/create/locales/pt.ts +58 -0
  214. package/src/components/estimates/create/prepare-estimate-submission.ts +1 -1
  215. package/src/components/estimates/list/list-table.tsx +20 -3
  216. package/src/components/estimates/list/locales/de.ts +9 -0
  217. package/src/components/estimates/list/locales/en.ts +8 -0
  218. package/src/components/estimates/list/locales/es.ts +32 -0
  219. package/src/components/estimates/list/locales/fr.ts +32 -0
  220. package/src/components/estimates/list/locales/hr.ts +32 -0
  221. package/src/components/estimates/list/locales/it.ts +32 -0
  222. package/src/components/estimates/list/locales/nl.ts +32 -0
  223. package/src/components/estimates/list/locales/pl.ts +32 -0
  224. package/src/components/estimates/list/locales/pt.ts +32 -0
  225. package/src/components/estimates/list/locales/sl.ts +9 -0
  226. package/src/components/export/document-export-form.tsx +0 -2
  227. package/src/components/invoices/create/create-invoice-form.tsx +24 -10
  228. package/src/components/invoices/create/eslog-validation.test.ts +2 -0
  229. package/src/components/invoices/create/locales/es.ts +103 -0
  230. package/src/components/invoices/create/locales/fr.ts +105 -0
  231. package/src/components/invoices/create/locales/hr.ts +103 -0
  232. package/src/components/invoices/create/locales/it.ts +105 -0
  233. package/src/components/invoices/create/locales/nl.ts +104 -0
  234. package/src/components/invoices/create/locales/pl.ts +104 -0
  235. package/src/components/invoices/create/locales/pt.ts +105 -0
  236. package/src/components/invoices/create/prepare-invoice-submission.test.ts +54 -55
  237. package/src/components/invoices/create/prepare-invoice-submission.ts +3 -3
  238. package/src/components/invoices/list/list-table.tsx +20 -3
  239. package/src/components/invoices/list/locales/de.ts +9 -0
  240. package/src/components/invoices/list/locales/en.ts +8 -0
  241. package/src/components/invoices/list/locales/es.ts +42 -0
  242. package/src/components/invoices/list/locales/fr.ts +42 -0
  243. package/src/components/invoices/list/locales/hr.ts +42 -0
  244. package/src/components/invoices/list/locales/it.ts +42 -0
  245. package/src/components/invoices/list/locales/nl.ts +42 -0
  246. package/src/components/invoices/list/locales/pl.ts +42 -0
  247. package/src/components/invoices/list/locales/pt.ts +42 -0
  248. package/src/components/invoices/list/locales/sl.ts +9 -0
  249. package/src/components/invoices/send-email-dialog/locales/es.ts +18 -0
  250. package/src/components/invoices/send-email-dialog/locales/fr.ts +18 -0
  251. package/src/components/invoices/send-email-dialog/locales/hr.ts +17 -0
  252. package/src/components/invoices/send-email-dialog/locales/it.ts +18 -0
  253. package/src/components/invoices/send-email-dialog/locales/nl.ts +18 -0
  254. package/src/components/invoices/send-email-dialog/locales/pl.ts +18 -0
  255. package/src/components/invoices/send-email-dialog/locales/pt.ts +18 -0
  256. package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +20 -12
  257. package/src/components/invoices/shared/scaled-document-preview.tsx +1 -0
  258. package/src/components/invoices/view/eslog-info-display.tsx +1 -0
  259. package/src/components/invoices/view/fina-info-display.tsx +196 -0
  260. package/src/components/items/create-item-form/create-item-form.tsx +14 -0
  261. package/src/components/items/create-item-form/locales/en.ts +5 -0
  262. package/src/components/items/create-item-form/locales/es.ts +14 -0
  263. package/src/components/items/create-item-form/locales/fr.ts +14 -0
  264. package/src/components/items/create-item-form/locales/hr.ts +14 -0
  265. package/src/components/items/create-item-form/locales/it.ts +14 -0
  266. package/src/components/items/create-item-form/locales/nl.ts +14 -0
  267. package/src/components/items/create-item-form/locales/pl.ts +14 -0
  268. package/src/components/items/create-item-form/locales/pt.ts +14 -0
  269. package/src/components/items/edit-item-form/edit-item-form.tsx +170 -0
  270. package/src/components/items/edit-item-form/locales/de.ts +12 -0
  271. package/src/components/items/edit-item-form/locales/es.ts +12 -0
  272. package/src/components/items/edit-item-form/locales/fr.ts +12 -0
  273. package/src/components/items/edit-item-form/locales/hr.ts +12 -0
  274. package/src/components/items/edit-item-form/locales/it.ts +12 -0
  275. package/src/components/items/edit-item-form/locales/nl.ts +12 -0
  276. package/src/components/items/edit-item-form/locales/pl.ts +12 -0
  277. package/src/components/items/edit-item-form/locales/pt.ts +12 -0
  278. package/src/components/items/edit-item-form/locales/sl.ts +12 -0
  279. package/src/components/items/item-list-table/item-list-table.tsx +20 -13
  280. package/src/components/items/item-list-table/locales/de.ts +6 -0
  281. package/src/components/items/item-list-table/locales/en.ts +5 -0
  282. package/src/components/items/item-list-table/locales/es.ts +16 -0
  283. package/src/components/items/item-list-table/locales/fr.ts +16 -0
  284. package/src/components/items/item-list-table/locales/hr.ts +16 -0
  285. package/src/components/items/item-list-table/locales/it.ts +16 -0
  286. package/src/components/items/item-list-table/locales/nl.ts +16 -0
  287. package/src/components/items/item-list-table/locales/pl.ts +16 -0
  288. package/src/components/items/item-list-table/locales/pt.ts +16 -0
  289. package/src/components/items/item-list-table/locales/sl.ts +6 -0
  290. package/src/components/items/items.hooks.ts +7 -2
  291. package/src/components/payments/create-payment-form/create-payment-form.tsx +14 -0
  292. package/src/components/payments/create-payment-form/locales/es.ts +20 -0
  293. package/src/components/payments/create-payment-form/locales/fr.ts +20 -0
  294. package/src/components/payments/create-payment-form/locales/hr.ts +20 -0
  295. package/src/components/payments/create-payment-form/locales/it.ts +20 -0
  296. package/src/components/payments/create-payment-form/locales/nl.ts +20 -0
  297. package/src/components/payments/create-payment-form/locales/pl.ts +20 -0
  298. package/src/components/payments/create-payment-form/locales/pt.ts +20 -0
  299. package/src/components/payments/edit-payment-form/edit-payment-form.tsx +18 -2
  300. package/src/components/payments/edit-payment-form/locales/es.ts +20 -0
  301. package/src/components/payments/edit-payment-form/locales/fr.ts +20 -0
  302. package/src/components/payments/edit-payment-form/locales/hr.ts +20 -0
  303. package/src/components/payments/edit-payment-form/locales/it.ts +20 -0
  304. package/src/components/payments/edit-payment-form/locales/nl.ts +20 -0
  305. package/src/components/payments/edit-payment-form/locales/pl.ts +20 -0
  306. package/src/components/payments/edit-payment-form/locales/pt.ts +20 -0
  307. package/src/components/payments/list/list-row-actions.tsx +14 -0
  308. package/src/components/payments/list/list-table.tsx +21 -2
  309. package/src/components/payments/list/locales/de.ts +6 -0
  310. package/src/components/payments/list/locales/en.ts +7 -0
  311. package/src/components/payments/list/locales/es.ts +25 -0
  312. package/src/components/payments/list/locales/fr.ts +25 -0
  313. package/src/components/payments/list/locales/hr.ts +25 -0
  314. package/src/components/payments/list/locales/it.ts +25 -0
  315. package/src/components/payments/list/locales/nl.ts +25 -0
  316. package/src/components/payments/list/locales/pl.ts +25 -0
  317. package/src/components/payments/list/locales/pt.ts +25 -0
  318. package/src/components/payments/list/locales/sl.ts +6 -0
  319. package/src/components/payments/payments.hooks.ts +7 -2
  320. package/src/components/request-logs/index.ts +1 -1
  321. package/src/components/table/data-table.tsx +8 -3
  322. package/src/components/table/filter-panel.tsx +4 -4
  323. package/src/components/table/hooks/use-table-query.ts +3 -0
  324. package/src/components/table/table-empty-state.tsx +11 -4
  325. package/src/components/table/table-no-results.tsx +6 -4
  326. package/src/components/table/types.ts +2 -2
  327. package/src/components/tax-reports/kir-export-form.tsx +0 -1
  328. package/src/components/taxes/create-tax-form/create-tax-form.tsx +14 -0
  329. package/src/components/taxes/create-tax-form/locales/en.ts +1 -0
  330. package/src/components/taxes/create-tax-form/locales/es.ts +8 -0
  331. package/src/components/taxes/create-tax-form/locales/fr.ts +8 -0
  332. package/src/components/taxes/create-tax-form/locales/hr.ts +8 -0
  333. package/src/components/taxes/create-tax-form/locales/it.ts +8 -0
  334. package/src/components/taxes/create-tax-form/locales/nl.ts +8 -0
  335. package/src/components/taxes/create-tax-form/locales/pl.ts +8 -0
  336. package/src/components/taxes/create-tax-form/locales/pt.ts +8 -0
  337. package/src/components/taxes/edit-tax-form/edit-tax-form.tsx +119 -0
  338. package/src/components/taxes/edit-tax-form/locales/de.ts +6 -0
  339. package/src/components/taxes/edit-tax-form/locales/es.ts +6 -0
  340. package/src/components/taxes/edit-tax-form/locales/fr.ts +6 -0
  341. package/src/components/taxes/edit-tax-form/locales/hr.ts +6 -0
  342. package/src/components/taxes/edit-tax-form/locales/it.ts +6 -0
  343. package/src/components/taxes/edit-tax-form/locales/nl.ts +6 -0
  344. package/src/components/taxes/edit-tax-form/locales/pl.ts +6 -0
  345. package/src/components/taxes/edit-tax-form/locales/pt.ts +6 -0
  346. package/src/components/taxes/edit-tax-form/locales/sl.ts +6 -0
  347. package/src/components/taxes/tax-list-table/locales/de.ts +6 -0
  348. package/src/components/taxes/tax-list-table/locales/en.ts +6 -0
  349. package/src/components/taxes/tax-list-table/locales/es.ts +17 -0
  350. package/src/components/taxes/tax-list-table/locales/fr.ts +17 -0
  351. package/src/components/taxes/tax-list-table/locales/hr.ts +17 -0
  352. package/src/components/taxes/tax-list-table/locales/it.ts +17 -0
  353. package/src/components/taxes/tax-list-table/locales/nl.ts +17 -0
  354. package/src/components/taxes/tax-list-table/locales/pl.ts +17 -0
  355. package/src/components/taxes/tax-list-table/locales/pt.ts +17 -0
  356. package/src/components/taxes/tax-list-table/locales/sl.ts +6 -0
  357. package/src/components/taxes/tax-list-table/tax-list-table.tsx +18 -0
  358. package/src/components/taxes/taxes.hooks.ts +12 -7
  359. package/src/components/ui/tooltip.tsx +2 -2
  360. package/src/components/wl-subscription/locked-feature.tsx +1 -0
  361. package/src/components/wl-subscription/upgrade-modal.tsx +1 -0
  362. package/src/generated/schemas/acceptentityinvitation_body.ts +17 -0
  363. package/src/generated/schemas/addentityuser_body.ts +18 -0
  364. package/src/generated/schemas/advanceinvoice.ts +184 -12
  365. package/src/generated/schemas/creditnote.ts +96 -127
  366. package/src/generated/schemas/customadvanceinvoice.ts +246 -0
  367. package/src/generated/schemas/customcreditnote.ts +237 -0
  368. package/src/generated/schemas/customer.ts +26 -0
  369. package/src/generated/schemas/customestimate.ts +181 -0
  370. package/src/generated/schemas/custominvoice.ts +237 -0
  371. package/src/generated/schemas/entity.ts +66 -7
  372. package/src/generated/schemas/entityuserrole.ts +19 -0
  373. package/src/generated/schemas/estimate.ts +149 -1
  374. package/src/generated/schemas/finasettings.ts +25 -0
  375. package/src/generated/schemas/furssettings.ts +1 -2
  376. package/src/generated/schemas/index.ts +24 -5
  377. package/src/generated/schemas/invoice.ts +224 -22
  378. package/src/generated/schemas/me.ts +22 -0
  379. package/src/generated/schemas/registerfinamovablepremise_body.ts +26 -0
  380. package/src/generated/schemas/registerfinarealestatepremise_body.ts +37 -0
  381. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +342 -0
  382. package/src/generated/schemas/rendercreditnotepreview_body.ts +344 -0
  383. package/src/generated/schemas/renderestimatepreview_body.ts +284 -0
  384. package/src/generated/schemas/renderinvoicepreview_body.ts +344 -0
  385. package/src/generated/schemas/senddocument_body.ts +23 -0
  386. package/src/generated/schemas/sendemail_body.ts +8 -10
  387. package/src/generated/schemas/stripeappconnect_body.ts +18 -0
  388. package/src/generated/schemas/stripeappcreateinvoice_body.ts +20 -0
  389. package/src/generated/schemas/stripeappupdatesettings_body.ts +26 -0
  390. package/src/generated/schemas/webhook.ts +143 -0
  391. package/src/hooks/create-resource-hooks.ts +85 -1
  392. package/src/hooks/use-next-document-number.ts +1 -1
  393. package/src/hooks/use-resource-mutation.ts +4 -3
  394. package/src/lib/browser-cookies.ts +12 -1
  395. package/src/lib/cookies.ts +2 -2
  396. package/src/lib/translation.ts +1 -1
  397. package/src/providers/entities-provider.tsx +84 -39
  398. package/src/providers/sdk-provider.tsx +7 -3
  399. package/src/providers/white-label-provider.tsx +5 -2
  400. package/src/providers/wl-subscription-provider.tsx +1 -0
@@ -0,0 +1,194 @@
1
+ export default {
2
+ // Company settings
3
+ "Company Information": "Informações da empresa",
4
+ "Basic information about your company": "Informações básicas sobre a sua empresa",
5
+ // Branding settings
6
+ Branding: "Marca",
7
+ "Primary Color": "Cor primária",
8
+ Logo: "Logotipo",
9
+ "Logo URL": "URL do logotipo",
10
+ "Enter the URL of your company logo": "Introduza o URL do logotipo da sua empresa",
11
+ "Upload your company logo for invoices": "Carregue o logotipo da sua empresa para as faturas",
12
+ "Upload Logo": "Carregar logotipo",
13
+ "Change Logo": "Alterar logotipo",
14
+ "Current logo (displayed on invoices)": "Logotipo atual (apresentado nas faturas)",
15
+ "Logo preview": "Pré-visualização do logotipo",
16
+ "Crop Your Logo": "Recortar o seu logotipo",
17
+ Signature: "Assinatura",
18
+ "Upload a signature image for PDFs (optional)": "Carregue uma imagem de assinatura para os PDF (opcional)",
19
+ "Upload Signature": "Carregar assinatura",
20
+ "Change Signature": "Alterar assinatura",
21
+ "Current signature (for PDF documents)": "Assinatura atual (para documentos PDF)",
22
+ "Signature preview": "Pré-visualização da assinatura",
23
+ "Crop Your Signature": "Recortar a sua assinatura",
24
+ "Adjust the crop area or upload the full image": "Ajuste a área de recorte ou carregue a imagem completa",
25
+ "Upload failed. Please try again.": "O carregamento falhou. Por favor, tente novamente.",
26
+ "Uploading...": "A carregar...",
27
+ "Upload & Save": "Carregar e guardar",
28
+ Cancel: "Cancelar",
29
+ Localization: "Localização",
30
+ "Currency Code": "Código de moeda",
31
+ "ISO 4217 currency code (e.g., USD, EUR, GBP)": "Código de moeda ISO 4217 (ex. USD, EUR, GBP)",
32
+ Locale: "Configuração regional",
33
+ "BCP 47 language tag (e.g., en-US, de-DE, sl-SI)": "Etiqueta de idioma BCP 47 (ex. en-US, de-DE, sl-SI)",
34
+ "Select currency": "Selecionar moeda",
35
+ "Select locale": "Selecionar configuração regional",
36
+ "Configure entity localization": "Configurar a localização da entidade",
37
+ "Email Settings": "Definições de email",
38
+ "Configure email settings for invoices": "Configurar as definições de email para as faturas",
39
+ "Email Address": "Endereço de email",
40
+ "Email address to send invoices to": "Endereço de email para enviar faturas",
41
+ "Email Subject": "Assunto do email",
42
+ "Subject line for email invoices": "Linha de assunto para as faturas por email",
43
+ "Email Body": "Corpo do email",
44
+ "Body content for email invoices": "Conteúdo do texto para as faturas por email",
45
+ "Save Settings": "Guardar definições",
46
+ // Document Defaults section
47
+ "Document Defaults": "Valores predefinidos de documentos",
48
+ "Default values for new documents": "Valores predefinidos para novos documentos",
49
+ "Default Note": "Nota predefinida",
50
+ "Default Invoice Note": "Nota de fatura predefinida",
51
+ "This note will be pre-filled when creating new invoices": "Esta nota será pré-preenchida ao criar novas faturas",
52
+ "This note will be pre-filled when creating new estimates": "Esta nota será pré-preenchida ao criar novos orçamentos",
53
+ "This note will be pre-filled when creating new credit notes":
54
+ "Esta nota será pré-preenchida ao criar novas notas de crédito",
55
+ "Payment terms pre-filled when creating new invoices":
56
+ "Condições de pagamento pré-preenchidas ao criar novas faturas",
57
+ "Payment terms pre-filled when creating new estimates":
58
+ "Condições de pagamento pré-preenchidas ao criar novos orçamentos",
59
+ "Payment terms pre-filled when creating new credit notes":
60
+ "Condições de pagamento pré-preenchidas ao criar novas notas de crédito",
61
+ "Payment due by {document_due_date}. Please reference invoice {document_number}.":
62
+ "Pagamento até {document_due_date}. Por favor, indique o número da fatura {document_number}.",
63
+ "Net 30 days. Payment due by {document_due_date}.": "Líquido 30 dias. Pagamento até {document_due_date}.",
64
+ "This estimate is valid until {document_valid_until}.": "Este orçamento é válido até {document_valid_until}.",
65
+ "Payment due upon acceptance.": "Pagamento na aceitação.",
66
+ "Credit note for invoice {document_number}.": "Nota de crédito para a fatura {document_number}.",
67
+ "Credit will be applied to your account.": "O crédito será aplicado à sua conta.",
68
+ "Invoice Notes": "Notas da fatura",
69
+ "Smart Template Variables": "Variáveis de modelo inteligentes",
70
+ "Use variables to personalize your notes automatically":
71
+ "Use variáveis para personalizar as suas notas automaticamente",
72
+ "Set a default note that will appear on all new invoices. Use template variables to personalize the note automatically.":
73
+ "Defina uma nota predefinida que aparecerá em todas as novas faturas. Use as variáveis de modelo para personalizar a nota automaticamente.",
74
+ // Smart code insert button
75
+ "Insert variable": "Inserir variável",
76
+ Entity: "Empresa",
77
+ Document: "Documento",
78
+ Customer: "Cliente",
79
+ Other: "Outro",
80
+ "Company name": "Nome da empresa",
81
+ "Email address": "Endereço de email",
82
+ "Invoice number": "Número da fatura",
83
+ "Invoice date": "Data da fatura",
84
+ "Due date": "Data de vencimento",
85
+ "Total amount": "Valor total",
86
+ Currency: "Moeda",
87
+ "Customer name": "Nome do cliente",
88
+ "Customer email": "Email do cliente",
89
+ "Today's date": "Data de hoje",
90
+ "Current year": "Ano corrente",
91
+ // Payment terms defaults
92
+ "Default Payment Terms": "Condições de pagamento predefinidas",
93
+ "This payment terms will be pre-filled when creating new documents":
94
+ "Estas condições de pagamento serão pré-preenchidas ao criar novos documentos",
95
+ "Payment Terms": "Condições de pagamento",
96
+ "Add payment terms...": "Adicionar condições de pagamento...",
97
+ // Document footer
98
+ "Document Footer": "Rodapé do documento",
99
+ "Footer text displayed at the bottom of PDF documents":
100
+ "Texto do rodapé apresentado na parte inferior dos documentos PDF",
101
+ "Footer text displayed at the bottom of all PDF documents":
102
+ "Texto do rodapé apresentado na parte inferior de todos os documentos PDF",
103
+ "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
104
+ "{entity_name} | Vencimento: {document_due_date} | Fatura #{document_number}",
105
+ // Overdue Notifications section
106
+ "Overdue Notifications": "Notificações de atraso",
107
+ "Automatically remind customers about overdue invoices":
108
+ "Lembrar automaticamente os clientes sobre faturas em atraso",
109
+ "Enable Notifications": "Ativar notificações",
110
+ "Send automatic payment reminder emails to customers with overdue invoices":
111
+ "Enviar emails de lembrete de pagamento automáticos a clientes com faturas em atraso",
112
+ "Reminder Days": "Dias de lembrete",
113
+ "Days after due date to send reminders (comma-separated). E.g., '7, 14, 30' sends reminders at 7, 14, and 30 days overdue.":
114
+ "Dias após a data de vencimento para enviar lembretes (separados por vírgulas). Ex. '7, 14, 30' envia lembretes aos 7, 14 e 30 dias de atraso.",
115
+ "Custom Reminder Templates": "Modelos de lembrete personalizados",
116
+ "Subject line for overdue notification emails": "Linha de assunto para os emails de notificação de atraso",
117
+ "Body content for overdue emails. Use {invoice_list} to include the invoice table, or it will be auto-appended.":
118
+ "Conteúdo do texto para os emails de atraso. Use {invoice_list} para incluir a tabela de faturas, ou será adicionada automaticamente.",
119
+ "Dear {customer_name},\n\nThis is a reminder about your overdue invoices...":
120
+ "Caro/a {customer_name},\n\nEste é um lembrete sobre as suas faturas em atraso...",
121
+ "Payment Reminders": "Lembretes de pagamento",
122
+ "When enabled, customers will automatically receive email reminders when their invoices become overdue. Emails are sent on the exact day each threshold is reached.":
123
+ "Quando ativado, os clientes receberão automaticamente lembretes por email quando as suas faturas ficarem em atraso. Os emails são enviados exatamente no dia em que cada limite é atingido.",
124
+ "Available Variables": "Variáveis disponíveis",
125
+ "{customer_name}, {entity_name}, {entity_email}, {invoice_list}, {total_amount}, {overdue_count}":
126
+ "{customer_name}, {entity_name}, {entity_email}, {invoice_list}, {total_amount}, {overdue_count}",
127
+ // UPN QR Payment section
128
+ "UPN QR Payment": "Pagamento UPN QR",
129
+ "Configure UPN QR payment slip for invoices": "Configurar o talão de pagamento UPN QR para faturas",
130
+ IBAN: "IBAN",
131
+ "Bank account IBAN for receiving payments": "IBAN da conta bancária para receber pagamentos",
132
+ "Enable UPN QR on invoices": "Ativar UPN QR nas faturas",
133
+ "Show payment QR code on PDF invoices for easy mobile banking payments":
134
+ "Mostrar código QR de pagamento nas faturas PDF para pagamentos bancários móveis fáceis",
135
+ "Display Mode": "Modo de exibição",
136
+ "QR code only": "Apenas código QR",
137
+ "Shows compact QR code inline with invoice content": "Mostra código QR compacto em linha com o conteúdo da fatura",
138
+ "Full UPN payment slip": "Talão de pagamento UPN completo",
139
+ "Shows complete payment slip at bottom of page": "Mostra o talão de pagamento completo no fundo da página",
140
+ "Purpose Code": "Código de finalidade",
141
+ "OTHR - Other": "OTHR - Outro",
142
+ "GDSV - Goods and Services": "GDSV - Bens e serviços",
143
+ "SUPP - Supplier Payment": "SUPP - Pagamento a fornecedor",
144
+ "Payment purpose code (ISO 20022)": "Código de finalidade de pagamento (ISO 20022)",
145
+ "UPN QR Payments": "Pagamentos UPN QR",
146
+ "UPN QR is a Slovenian standard for payment slips. When enabled, your invoices will include a QR code that customers can scan with their mobile banking app to pay instantly.":
147
+ "UPN QR é um padrão esloveno para talões de pagamento. Quando ativado, as suas faturas incluirão um código QR que os clientes podem digitalizar com a aplicação de banca móvel para pagar instantaneamente.",
148
+ // Number format settings
149
+ Invoice: "Fatura",
150
+ Estimate: "Orçamento",
151
+ "Credit Note": "Nota de crédito",
152
+ "Advance Invoice": "Fatura antecipada",
153
+ "Number Format": "Formato de numeração",
154
+ Preview: "Pré-visualização",
155
+ // Tax rules settings
156
+ "EU Tax Rules": "Regras fiscais da UE",
157
+ "Automatic tax handling for cross-border transactions":
158
+ "Gestão automática de impostos para transações transfronteiriças",
159
+ "tax-rules.vies_validate_vat.label": "Validação de IVA VIES",
160
+ "tax-rules.vies_validate_vat.description":
161
+ "Verificar os números de IVA da UE através da API VIES. Os números de IVA dos clientes são verificados antes da criação de faturas.",
162
+ "tax-rules.auto_reverse_charge.label": "Autoliquidação automática",
163
+ "tax-rules.auto_reverse_charge.description":
164
+ "Aplicar automaticamente a taxa 0% (autoliquidação) para transações B2B intra-UE com números de IVA válidos.",
165
+ "tax-rules.auto_remove_tax_export.label": "Remoção automática de imposto de exportação",
166
+ "tax-rules.auto_remove_tax_export.description":
167
+ "Remover automaticamente todos os impostos para exportações para países fora da UE.",
168
+ "tax-rules.require_gross_prices.label": "Exigir preços brutos",
169
+ "tax-rules.require_gross_prices.description":
170
+ "Exigir preços brutos quando a autoliquidação é aplicada. Previne variações inesperadas nos valores totais das faturas.",
171
+ // Tax clauses settings
172
+ "Default Tax Clauses": "Cláusulas fiscais predefinidas",
173
+ "Set default tax clauses that are automatically added to documents based on transaction type":
174
+ "Defina as cláusulas fiscais predefinidas que são automaticamente adicionadas aos documentos com base no tipo de transação.",
175
+ "tax-clauses.other-title": "Cláusulas fiscais transfronteiriças",
176
+ "tax-clauses.other-description":
177
+ "Cláusulas fiscais para transações UE e internacionais (autoliquidação, exportação).",
178
+ "tax-clauses.intra_eu_b2b.label": "Intra-UE B2B (autoliquidação)",
179
+ "tax-clauses.intra_eu_b2b.description":
180
+ "Para vendas a empresas da UE com números de IVA válidos. Normalmente inclui uma declaração de autoliquidação.",
181
+ "Enter reverse charge clause...": "Introduza a cláusula de autoliquidação...",
182
+ "tax-clauses.export.label": "Exportação (fora da UE)",
183
+ "tax-clauses.export.description":
184
+ "Para vendas a clientes fora da UE. Normalmente indica a isenção de IVA por exportação.",
185
+ "Enter export exemption clause...": "Introduza a cláusula de isenção de exportação...",
186
+ "tax-clauses.domestic.label": "Predefinido / Nacional",
187
+ "tax-clauses.domestic.description":
188
+ "Cláusula predefinida para transações nacionais. Para entidades não sujeitas a IVA, aparece em todos os documentos.",
189
+ "Enter default tax clause...": "Introduza a cláusula fiscal predefinida...",
190
+ "tax-clauses.intra_eu_b2c.label": "Intra-UE B2C",
191
+ "Enter EU consumer sales clause...": "Introduza a cláusula de venda ao consumidor UE...",
192
+ "tax-clauses.other.description":
193
+ "Estes tipos de transações normalmente não requerem cláusulas fiscais específicas, mas pode configurá-las conforme necessário.",
194
+ } as const;
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax ID 2": "Davčna številka 2",
4
+ "Secondary tax identification number (optional)": "Sekundarna davčna identifikacijska številka (neobvezno)",
3
5
  "Company Information": "Podatki o podjetju",
4
6
  "Basic information about your company": "Osnovni podatki o vašem podjetju",
5
7
  // Branding settings
@@ -0,0 +1,461 @@
1
+ import { AlertCircle, CheckCircle2, Info } from "lucide-react";
2
+ import { type FC, type ReactNode, useCallback, useEffect, useState } from "react";
3
+ import { Alert, AlertDescription, AlertTitle } from "@/ui/components/ui/alert";
4
+ import { Button } from "@/ui/components/ui/button";
5
+ import { Label } from "@/ui/components/ui/label";
6
+ import { PageLoadingSpinner } from "@/ui/components/ui/loading-spinner";
7
+ import { RadioGroup, RadioGroupItem } from "@/ui/components/ui/radio-group";
8
+ import { Switch } from "@/ui/components/ui/switch";
9
+ import { Tabs, TabsList, TabsTrigger } from "@/ui/components/ui/tabs";
10
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@/ui/components/ui/tooltip";
11
+ import type { ComponentTranslationProps } from "@/ui/lib/translation";
12
+ import { createTranslation } from "@/ui/lib/translation";
13
+ import { cn } from "@/ui/lib/utils";
14
+ import { useFinaPremises, useFinaSettings, useUpdateFinaSettings } from "./fina-settings.hooks";
15
+ import de from "./locales/de";
16
+ import en from "./locales/en";
17
+ import es from "./locales/es";
18
+ import fr from "./locales/fr";
19
+ import hr from "./locales/hr";
20
+ import it from "./locales/it";
21
+ import nl from "./locales/nl";
22
+ import pl from "./locales/pl";
23
+ import pt from "./locales/pt";
24
+ import sl from "./locales/sl";
25
+ import { CertificateSettingsSection } from "./sections/certificate-settings-section";
26
+ import { PremisesManagementSection } from "./sections/premises-management-section";
27
+
28
+ const translations = { sl, de, en, it, fr, es, pt, nl, pl, hr } as const;
29
+
30
+ export type FinaStepType = "settings" | "certificate" | "premises" | "enable";
31
+ export type FinaSectionType = "operator" | "numbering" | "certificate-upload" | "premises-list" | "enable-toggle";
32
+
33
+ interface FinaSettingsFormProps extends ComponentTranslationProps {
34
+ entity: any;
35
+ onSuccess?: () => void;
36
+ onError?: (error: unknown) => void;
37
+ initialStep?: FinaStepType;
38
+ onStepChange?: (step: FinaStepType) => void;
39
+ renderSection?: (section: FinaSectionType, content: ReactNode) => ReactNode;
40
+ }
41
+
42
+ /**
43
+ * FINA Settings Form Component
44
+ *
45
+ * Implements progressive unlocking flow (same as FURS):
46
+ * 1. General Settings - numbering sequence, operator OIB, PDV system
47
+ * 2. Certificate Upload - FINA P12/PFX certificate
48
+ * 3. Business Premises - register locations & devices with FINA
49
+ * 4. Enable Fiscalization - final activation
50
+ */
51
+ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
52
+ entity,
53
+ onSuccess,
54
+ onError,
55
+ t: translateFn,
56
+ namespace,
57
+ locale,
58
+ initialStep = "settings",
59
+ onStepChange,
60
+ renderSection,
61
+ }) => {
62
+ const [activeStep, setActiveStep] = useState<FinaStepType>(initialStep);
63
+ const [hasInitializedStep, setHasInitializedStep] = useState(false);
64
+
65
+ const translate = createTranslation({
66
+ t: translateFn,
67
+ namespace,
68
+ locale,
69
+ translations,
70
+ });
71
+
72
+ const handleStepChange = useCallback(
73
+ (newStep: FinaStepType) => {
74
+ setActiveStep(newStep);
75
+ onStepChange?.(newStep);
76
+ },
77
+ [onStepChange],
78
+ );
79
+
80
+ // Fetch FINA settings and premises
81
+ const { data: finaSettings, isLoading: settingsLoading } = useFinaSettings(entity.id);
82
+ const { data: premises, isLoading: premisesLoading } = useFinaPremises(entity.id);
83
+
84
+ const { mutate: updateSettings, isPending } = useUpdateFinaSettings({
85
+ onSuccess: () => {
86
+ onSuccess?.();
87
+ },
88
+ onError: (error) => {
89
+ onError?.(error);
90
+ },
91
+ });
92
+
93
+ // Form state for settings
94
+ const [formData, setFormData] = useState({
95
+ enabled: false,
96
+ numbering_sequence: "N" as "N" | "P",
97
+ operator_oib: "",
98
+ operator_label: "",
99
+ u_sust_pdv: true,
100
+ });
101
+
102
+ // Sync form data when settings load
103
+ useEffect(() => {
104
+ if (finaSettings) {
105
+ setFormData({
106
+ enabled: finaSettings.enabled || false,
107
+ numbering_sequence: finaSettings.numbering_sequence || "N",
108
+ operator_oib: finaSettings.operator_oib || "",
109
+ operator_label: finaSettings.operator_label || "",
110
+ u_sust_pdv: finaSettings.u_sust_pdv ?? true,
111
+ });
112
+ }
113
+ }, [finaSettings]);
114
+
115
+ // Determine completion status
116
+ const hasCertificate = finaSettings?.has_certificate || false;
117
+ const certificateValid = finaSettings?.certificate_status === "valid";
118
+ const hasPremises = (premises?.length || 0) > 0;
119
+ const hasPremiseWithDevice =
120
+ hasPremises && premises?.some((premise: any) => premise.Devices && premise.Devices.length > 0);
121
+
122
+ const finaEnabled = finaSettings?.enabled || false;
123
+ const canAccessPremises = hasCertificate && certificateValid;
124
+ const canAccessEnable = certificateValid && hasPremises && hasPremiseWithDevice;
125
+
126
+ const steps = [
127
+ { id: "settings" as const, title: translate("General Settings"), complete: true, unlocked: true },
128
+ {
129
+ id: "certificate" as const,
130
+ title: translate("Certificate"),
131
+ complete: hasCertificate && certificateValid,
132
+ unlocked: true,
133
+ },
134
+ {
135
+ id: "premises" as const,
136
+ title: translate("Business Premises"),
137
+ complete: !!hasPremiseWithDevice,
138
+ unlocked: canAccessPremises,
139
+ },
140
+ {
141
+ id: "enable" as const,
142
+ title: translate("Enable Fiscalization"),
143
+ complete: finaEnabled,
144
+ unlocked: canAccessEnable,
145
+ },
146
+ ];
147
+
148
+ const getDefaultStep = (): FinaStepType => {
149
+ if (initialStep) {
150
+ const stepInfo = steps.find((s) => s.id === initialStep);
151
+ if (stepInfo?.unlocked) return initialStep;
152
+ }
153
+ if (!certificateValid) return "certificate";
154
+ if (!hasPremiseWithDevice) return "premises";
155
+ if (!finaEnabled) return "enable";
156
+ return "settings";
157
+ };
158
+
159
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Intentionally run only when data loads
160
+ useEffect(() => {
161
+ if (!hasInitializedStep && !settingsLoading && !premisesLoading) {
162
+ const smartStep = getDefaultStep();
163
+ if (smartStep !== activeStep) {
164
+ handleStepChange(smartStep);
165
+ }
166
+ setHasInitializedStep(true);
167
+ }
168
+ }, [settingsLoading, premisesLoading, hasInitializedStep]);
169
+
170
+ // biome-ignore lint/correctness/useExhaustiveDependencies: steps is recreated on each render but values are stable
171
+ useEffect(() => {
172
+ const currentStepInfo = steps.find((s) => s.id === activeStep);
173
+ if (currentStepInfo && !currentStepInfo.unlocked) {
174
+ const firstUnlockedStep = steps.find((s) => s.unlocked);
175
+ if (firstUnlockedStep) {
176
+ handleStepChange(firstUnlockedStep.id);
177
+ }
178
+ }
179
+ }, [activeStep, handleStepChange]);
180
+
181
+ if (entity.country_code !== "HR") {
182
+ return (
183
+ <Alert variant="destructive">
184
+ <AlertCircle className="h-4 w-4" />
185
+ <AlertTitle>{translate("FINA is for Croatian Entities")}</AlertTitle>
186
+ <AlertDescription>
187
+ {translate("FINA fiscalization is only available for entities with country code HR")}
188
+ </AlertDescription>
189
+ </Alert>
190
+ );
191
+ }
192
+
193
+ if (settingsLoading || premisesLoading) {
194
+ return <PageLoadingSpinner />;
195
+ }
196
+
197
+ const isSandboxMode = entity.environment === "sandbox";
198
+
199
+ const handleSaveSettings = () => {
200
+ updateSettings({
201
+ entityId: entity.id,
202
+ data: formData,
203
+ });
204
+ };
205
+
206
+ const wrapSection = (section: FinaSectionType, content: ReactNode) => {
207
+ if (renderSection) {
208
+ return renderSection(section, content);
209
+ }
210
+ return content;
211
+ };
212
+
213
+ const tabsNavigation = (
214
+ <div className="grid items-start gap-6 lg:grid-cols-[1fr_280px]">
215
+ <Tabs value={activeStep} onValueChange={(value) => handleStepChange(value as FinaStepType)} className="w-full">
216
+ <TabsList className="grid w-full grid-cols-4 rounded-none p-0">
217
+ {steps.map((step, index) => {
218
+ const isLocked = !step.unlocked;
219
+ let tooltipText = "";
220
+ if (isLocked) {
221
+ if (step.id === "premises") {
222
+ tooltipText = translate("Upload and validate digital certificate first");
223
+ } else if (step.id === "enable") {
224
+ if (!certificateValid) {
225
+ tooltipText = translate("Upload and validate digital certificate first");
226
+ } else if (!hasPremises) {
227
+ tooltipText = translate("Register at least one business premise first");
228
+ } else {
229
+ tooltipText = translate("Register at least one electronic device first");
230
+ }
231
+ }
232
+ }
233
+
234
+ const trigger = (
235
+ <TabsTrigger
236
+ value={step.id}
237
+ disabled={isLocked}
238
+ className={cn("cursor-pointer justify-center", !step.unlocked && "opacity-50")}
239
+ >
240
+ <span className="flex items-center gap-2">
241
+ {step.complete ? (
242
+ <CheckCircle2 className="h-4 w-4 text-green-500" />
243
+ ) : (
244
+ <span className="text-xs">{index + 1}</span>
245
+ )}
246
+ {step.title}
247
+ </span>
248
+ </TabsTrigger>
249
+ );
250
+
251
+ if (isLocked) {
252
+ return (
253
+ <Tooltip key={step.id} delayDuration={0}>
254
+ <TooltipTrigger asChild>
255
+ <span className="flex cursor-not-allowed justify-center">{trigger}</span>
256
+ </TooltipTrigger>
257
+ <TooltipContent>
258
+ <p>{tooltipText}</p>
259
+ </TooltipContent>
260
+ </Tooltip>
261
+ );
262
+ }
263
+
264
+ return (
265
+ <span key={step.id} className="flex justify-center">
266
+ {trigger}
267
+ </span>
268
+ );
269
+ })}
270
+ </TabsList>
271
+ </Tabs>
272
+ <div className="hidden lg:block" />
273
+ </div>
274
+ );
275
+
276
+ return (
277
+ <div className="space-y-6">
278
+ {isSandboxMode && (
279
+ <div className="grid items-start gap-6 lg:grid-cols-[1fr_280px]">
280
+ <Alert>
281
+ <Info className="h-4 w-4" />
282
+ <AlertTitle>{translate("Test Mode (Sandbox)")}</AlertTitle>
283
+ <AlertDescription>
284
+ {translate(
285
+ "This entity is in test mode. FINA invoices will be sent to the test environment. No real fiscalization will occur.",
286
+ )}
287
+ </AlertDescription>
288
+ </Alert>
289
+ <div className="hidden lg:block" />
290
+ </div>
291
+ )}
292
+
293
+ {tabsNavigation}
294
+
295
+ {/* Settings step */}
296
+ {activeStep === "settings" && (
297
+ <div className="space-y-6">
298
+ {wrapSection(
299
+ "numbering",
300
+ <div className="space-y-4">
301
+ <div>
302
+ <Label className="font-medium text-sm">{translate("Numbering Sequence")}</Label>
303
+ <p className="text-muted-foreground text-sm">{translate("Choose how invoice numbers are sequenced")}</p>
304
+ </div>
305
+ <RadioGroup
306
+ value={formData.numbering_sequence}
307
+ onValueChange={(value) => setFormData((prev) => ({ ...prev, numbering_sequence: value as "N" | "P" }))}
308
+ className="space-y-2"
309
+ >
310
+ <div className="flex items-center space-x-2">
311
+ <RadioGroupItem value="N" id="seq-n" />
312
+ <Label htmlFor="seq-n">{translate("Per Premise (N)")}</Label>
313
+ </div>
314
+ <div className="flex items-center space-x-2">
315
+ <RadioGroupItem value="P" id="seq-p" />
316
+ <Label htmlFor="seq-p">{translate("Per Device (P)")}</Label>
317
+ </div>
318
+ </RadioGroup>
319
+ </div>,
320
+ )}
321
+
322
+ {wrapSection(
323
+ "operator",
324
+ <div className="space-y-4">
325
+ <div>
326
+ <Label className="font-medium text-sm">{translate("PDV System")}</Label>
327
+ <div className="mt-2 flex items-center space-x-2">
328
+ <Switch
329
+ checked={formData.u_sust_pdv}
330
+ onCheckedChange={(checked) => setFormData((prev) => ({ ...prev, u_sust_pdv: checked }))}
331
+ />
332
+ <Label>{translate("Entity is registered in the Croatian PDV (VAT) system")}</Label>
333
+ </div>
334
+ </div>
335
+ <div>
336
+ <Label className="font-medium text-sm">{translate("Operator OIB")}</Label>
337
+ <input
338
+ type="text"
339
+ value={formData.operator_oib}
340
+ onChange={(e) => setFormData((prev) => ({ ...prev, operator_oib: e.target.value }))}
341
+ placeholder={translate("OIB of the operator (11 digits, optional)")}
342
+ className="mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
343
+ maxLength={11}
344
+ />
345
+ </div>
346
+ <div>
347
+ <Label className="font-medium text-sm">{translate("Operator Label")}</Label>
348
+ <input
349
+ type="text"
350
+ value={formData.operator_label}
351
+ onChange={(e) => setFormData((prev) => ({ ...prev, operator_label: e.target.value }))}
352
+ placeholder={translate("Descriptive label for the operator (optional)")}
353
+ className="mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
354
+ />
355
+ </div>
356
+ </div>,
357
+ )}
358
+
359
+ <div className="grid items-start gap-6 lg:grid-cols-[1fr_280px]">
360
+ <Button onClick={handleSaveSettings} disabled={isPending}>
361
+ {isPending ? translate("Saving...") : translate("Save Settings")}
362
+ </Button>
363
+ <div className="hidden lg:block" />
364
+ </div>
365
+ </div>
366
+ )}
367
+
368
+ {/* Certificate step */}
369
+ {activeStep === "certificate" && (
370
+ <CertificateSettingsSection
371
+ entity={entity}
372
+ finaSettings={finaSettings}
373
+ t={translate}
374
+ onSuccess={onSuccess}
375
+ onError={onError}
376
+ wrapSection={wrapSection}
377
+ />
378
+ )}
379
+
380
+ {/* Premises step */}
381
+ {activeStep === "premises" && (
382
+ <PremisesManagementSection
383
+ entity={entity}
384
+ premises={premises || []}
385
+ t={translate}
386
+ onSuccess={onSuccess}
387
+ onError={onError}
388
+ wrapSection={wrapSection}
389
+ />
390
+ )}
391
+
392
+ {/* Enable step */}
393
+ {activeStep === "enable" && (
394
+ <div className="space-y-4">
395
+ {wrapSection(
396
+ "enable-toggle",
397
+ <div className="space-y-4">
398
+ <h3 className="font-medium text-sm">{translate("Setup Checklist")}</h3>
399
+ <div className="space-y-2">
400
+ <div className="flex items-center gap-2">
401
+ {certificateValid ? (
402
+ <CheckCircle2 className="h-4 w-4 text-green-500" />
403
+ ) : (
404
+ <AlertCircle className="h-4 w-4 text-muted-foreground" />
405
+ )}
406
+ <span className="text-sm">{translate("Valid certificate uploaded")}</span>
407
+ </div>
408
+ <div className="flex items-center gap-2">
409
+ {hasPremises ? (
410
+ <CheckCircle2 className="h-4 w-4 text-green-500" />
411
+ ) : (
412
+ <AlertCircle className="h-4 w-4 text-muted-foreground" />
413
+ )}
414
+ <span className="text-sm">{translate("At least one business premise registered")}</span>
415
+ </div>
416
+ <div className="flex items-center gap-2">
417
+ {hasPremiseWithDevice ? (
418
+ <CheckCircle2 className="h-4 w-4 text-green-500" />
419
+ ) : (
420
+ <AlertCircle className="h-4 w-4 text-muted-foreground" />
421
+ )}
422
+ <span className="text-sm">{translate("At least one electronic device registered")}</span>
423
+ </div>
424
+ </div>
425
+
426
+ {canAccessEnable ? (
427
+ <div className="mt-4 flex items-center space-x-2">
428
+ <Switch
429
+ checked={formData.enabled}
430
+ onCheckedChange={(checked) => {
431
+ setFormData((prev) => ({ ...prev, enabled: checked }));
432
+ updateSettings({
433
+ entityId: entity.id,
434
+ data: { ...formData, enabled: checked },
435
+ });
436
+ }}
437
+ />
438
+ <Label>{translate("Enable FINA Fiscalization")}</Label>
439
+ </div>
440
+ ) : (
441
+ <Alert>
442
+ <AlertCircle className="h-4 w-4" />
443
+ <AlertTitle>{translate("Cannot Enable Fiscalization")}</AlertTitle>
444
+ <AlertDescription>
445
+ {translate("Complete all prerequisites above before enabling FINA fiscalization.")}
446
+ </AlertDescription>
447
+ </Alert>
448
+ )}
449
+
450
+ {finaEnabled && (
451
+ <p className="text-green-600 text-sm">
452
+ {translate("Once enabled, all new B2C invoices will be automatically fiscalized with FINA")}
453
+ </p>
454
+ )}
455
+ </div>,
456
+ )}
457
+ </div>
458
+ )}
459
+ </div>
460
+ );
461
+ };