@spaceinvoices/react-ui 0.4.5 → 0.4.7

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 (138) hide show
  1. package/cli/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/src/components/advance-invoices/advance-invoices.hooks.ts +2 -2
  4. package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +146 -74
  5. package/src/components/advance-invoices/create/locales/de.ts +5 -0
  6. package/src/components/advance-invoices/create/locales/es.ts +5 -0
  7. package/src/components/advance-invoices/create/locales/fr.ts +5 -0
  8. package/src/components/advance-invoices/create/locales/hr.ts +5 -0
  9. package/src/components/advance-invoices/create/locales/it.ts +5 -0
  10. package/src/components/advance-invoices/create/locales/nl.ts +5 -0
  11. package/src/components/advance-invoices/create/locales/pl.ts +5 -0
  12. package/src/components/advance-invoices/create/locales/pt.ts +5 -0
  13. package/src/components/advance-invoices/create/locales/sl.ts +5 -0
  14. package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +5 -5
  15. package/src/components/credit-notes/create/create-credit-note-form.tsx +138 -72
  16. package/src/components/credit-notes/create/locales/de.ts +5 -0
  17. package/src/components/credit-notes/create/locales/es.ts +5 -0
  18. package/src/components/credit-notes/create/locales/fr.ts +5 -0
  19. package/src/components/credit-notes/create/locales/hr.ts +5 -0
  20. package/src/components/credit-notes/create/locales/it.ts +5 -0
  21. package/src/components/credit-notes/create/locales/nl.ts +5 -0
  22. package/src/components/credit-notes/create/locales/pl.ts +5 -0
  23. package/src/components/credit-notes/create/locales/pt.ts +5 -0
  24. package/src/components/credit-notes/create/locales/sl.ts +5 -0
  25. package/src/components/credit-notes/credit-notes.hooks.ts +2 -2
  26. package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +48 -92
  27. package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +48 -82
  28. package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +22 -31
  29. package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +33 -48
  30. package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +56 -76
  31. package/src/components/dashboard/shared/index.ts +1 -1
  32. package/src/components/dashboard/shared/use-revenue-data.ts +106 -182
  33. package/src/components/dashboard/shared/use-stats-counts.ts +18 -68
  34. package/src/components/dashboard/shared/use-stats-query.ts +35 -5
  35. package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +57 -75
  36. package/src/components/dashboard/top-customers-chart/use-top-customers.ts +38 -49
  37. package/src/components/delivery-notes/create/create-delivery-note-form.tsx +50 -2
  38. package/src/components/delivery-notes/create/locales/de.ts +5 -0
  39. package/src/components/delivery-notes/create/locales/es.ts +5 -0
  40. package/src/components/delivery-notes/create/locales/fr.ts +5 -0
  41. package/src/components/delivery-notes/create/locales/hr.ts +5 -0
  42. package/src/components/delivery-notes/create/locales/it.ts +5 -0
  43. package/src/components/delivery-notes/create/locales/nl.ts +5 -0
  44. package/src/components/delivery-notes/create/locales/pl.ts +5 -0
  45. package/src/components/delivery-notes/create/locales/pt.ts +5 -0
  46. package/src/components/delivery-notes/create/locales/sl.ts +5 -0
  47. package/src/components/documents/create/document-details-section.tsx +478 -350
  48. package/src/components/documents/create/document-recipient-section.tsx +30 -1
  49. package/src/components/documents/create/live-preview.tsx +15 -28
  50. package/src/components/documents/create/prepare-document-submission.ts +4 -1
  51. package/src/components/documents/create/smart-code-insert-button.tsx +6 -0
  52. package/src/components/documents/create/use-document-customer-form.ts +4 -0
  53. package/src/components/documents/shared/document-preview-skeleton.tsx +63 -0
  54. package/src/components/documents/shared/index.ts +1 -0
  55. package/src/components/documents/view/document-actions-bar.tsx +29 -7
  56. package/src/components/documents/view/document-details-card.tsx +6 -0
  57. package/src/components/documents/view/locales/de.ts +1 -0
  58. package/src/components/documents/view/locales/es.ts +1 -0
  59. package/src/components/documents/view/locales/fr.ts +1 -0
  60. package/src/components/documents/view/locales/hr.ts +1 -0
  61. package/src/components/documents/view/locales/it.ts +1 -0
  62. package/src/components/documents/view/locales/nl.ts +1 -0
  63. package/src/components/documents/view/locales/pl.ts +1 -0
  64. package/src/components/documents/view/locales/pt.ts +1 -0
  65. package/src/components/documents/view/locales/sl.ts +1 -0
  66. package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +6 -0
  67. package/src/components/entities/entity-settings-form/input-with-preview.tsx +2 -145
  68. package/src/components/entities/entity-settings-form/locales/de.ts +4 -0
  69. package/src/components/entities/entity-settings-form/locales/es.ts +4 -0
  70. package/src/components/entities/entity-settings-form/locales/fr.ts +4 -0
  71. package/src/components/entities/entity-settings-form/locales/hr.ts +4 -0
  72. package/src/components/entities/entity-settings-form/locales/it.ts +4 -0
  73. package/src/components/entities/entity-settings-form/locales/nl.ts +4 -0
  74. package/src/components/entities/entity-settings-form/locales/pl.ts +4 -0
  75. package/src/components/entities/entity-settings-form/locales/pt.ts +4 -0
  76. package/src/components/entities/entity-settings-form/locales/sl.ts +4 -0
  77. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +15 -0
  78. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +5 -1
  79. package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
  80. package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
  81. package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
  82. package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
  83. package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
  84. package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
  85. package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
  86. package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
  87. package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
  88. package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
  89. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +4 -4
  90. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +3 -3
  91. package/src/components/entities/settings/defaults-settings-form.tsx +38 -1
  92. package/src/components/entities/settings/tax-rules-settings-form.tsx +32 -15
  93. package/src/components/estimates/create/create-estimate-form.tsx +46 -4
  94. package/src/components/estimates/create/locales/de.ts +5 -0
  95. package/src/components/estimates/create/locales/es.ts +5 -0
  96. package/src/components/estimates/create/locales/fr.ts +5 -0
  97. package/src/components/estimates/create/locales/hr.ts +5 -0
  98. package/src/components/estimates/create/locales/it.ts +5 -0
  99. package/src/components/estimates/create/locales/nl.ts +5 -0
  100. package/src/components/estimates/create/locales/pl.ts +5 -0
  101. package/src/components/estimates/create/locales/pt.ts +5 -0
  102. package/src/components/estimates/create/locales/sl.ts +5 -0
  103. package/src/components/invoices/create/create-invoice-form.tsx +258 -96
  104. package/src/components/invoices/create/locales/de.ts +19 -0
  105. package/src/components/invoices/create/locales/es.ts +19 -0
  106. package/src/components/invoices/create/locales/fr.ts +19 -0
  107. package/src/components/invoices/create/locales/hr.ts +19 -0
  108. package/src/components/invoices/create/locales/it.ts +19 -0
  109. package/src/components/invoices/create/locales/nl.ts +19 -0
  110. package/src/components/invoices/create/locales/pl.ts +19 -0
  111. package/src/components/invoices/create/locales/pt.ts +19 -0
  112. package/src/components/invoices/create/locales/sl.ts +19 -0
  113. package/src/components/invoices/create/prepare-invoice-submission.ts +5 -5
  114. package/src/components/invoices/invoices.hooks.ts +3 -3
  115. package/src/components/table/table-pagination.tsx +1 -1
  116. package/src/components/ui/progress.tsx +27 -0
  117. package/src/generate-schemas.ts +15 -2
  118. package/src/generated/schemas/advanceinvoice.ts +4 -0
  119. package/src/generated/schemas/creditnote.ts +3 -0
  120. package/src/generated/schemas/customer.ts +2 -0
  121. package/src/generated/schemas/deliverynote.ts +3 -0
  122. package/src/generated/schemas/entity.ts +14 -4
  123. package/src/generated/schemas/entityapikey.ts +19 -0
  124. package/src/generated/schemas/estimate.ts +4 -0
  125. package/src/generated/schemas/finasettings.ts +4 -3
  126. package/src/generated/schemas/index.ts +1 -0
  127. package/src/generated/schemas/invoice.ts +4 -0
  128. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +17 -11
  129. package/src/generated/schemas/rendercreditnotepreview_body.ts +17 -11
  130. package/src/generated/schemas/renderdeliverynotepreview_body.ts +15 -8
  131. package/src/generated/schemas/renderestimatepreview_body.ts +15 -8
  132. package/src/generated/schemas/renderinvoicepreview_body.ts +17 -11
  133. package/src/generated/schemas/startpdfexport_body.ts +12 -5
  134. package/src/generated/schemas/webhook.ts +4 -0
  135. package/src/hooks/use-transaction-type-check.ts +152 -0
  136. package/src/hooks/use-vies-check.ts +7 -131
  137. package/src/lib/template-variables.tsx +167 -0
  138. package/src/providers/entities-context.tsx +2 -2
@@ -105,6 +105,10 @@ export default {
105
105
  "Footer text displayed at the bottom of all PDF documents": "Tekst podnožja prikazan na dnu svih PDF dokumenata",
106
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
107
  "{entity_name} | Dospijeće: {document_due_date} | Račun #{document_number}",
108
+ // Document signature
109
+ "Document Signature": "Potpis dokumenta",
110
+ "Signature text displayed on all PDF documents": "Tekst potpisa prikazan na svim PDF dokumentima",
111
+ "Add signature text...": "Dodaj tekst potpisa...",
108
112
  // Overdue Notifications section
109
113
  "Overdue Notifications": "Obavijesti o dospjelim računima",
110
114
  "Automatically remind customers about overdue invoices": "Automatski podsjećajte kupce o dospjelim računima",
@@ -106,6 +106,10 @@ export default {
106
106
  "Testo del piè di pagina mostrato in fondo a tutti i documenti PDF",
107
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
108
108
  "{entity_name} | Scadenza: {document_due_date} | Fattura #{document_number}",
109
+ // Document signature
110
+ "Document Signature": "Firma del documento",
111
+ "Signature text displayed on all PDF documents": "Testo della firma visualizzato su tutti i documenti PDF",
112
+ "Add signature text...": "Aggiungi testo della firma...",
109
113
  // Overdue Notifications section
110
114
  "Overdue Notifications": "Notifiche di scadenza",
111
115
  "Automatically remind customers about overdue invoices": "Ricorda automaticamente ai clienti le fatture scadute",
@@ -105,6 +105,10 @@ export default {
105
105
  "Footer text displayed at the bottom of all PDF documents": "Voettekst weergegeven onderaan alle PDF-documenten",
106
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
107
  "{entity_name} | Vervaldatum: {document_due_date} | Factuur #{document_number}",
108
+ // Document signature
109
+ "Document Signature": "Documenthandtekening",
110
+ "Signature text displayed on all PDF documents": "Handtekeningtekst weergegeven op alle PDF-documenten",
111
+ "Add signature text...": "Handtekeningtekst toevoegen...",
108
112
  // Overdue Notifications section
109
113
  "Overdue Notifications": "Herinneringen voor achterstallige betalingen",
110
114
  "Automatically remind customers about overdue invoices": "Klanten automatisch herinneren aan achterstallige facturen",
@@ -106,6 +106,10 @@ export default {
106
106
  "Tekst stopki wyświetlany na dole wszystkich dokumentów PDF",
107
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
108
108
  "{entity_name} | Termin: {document_due_date} | Faktura #{document_number}",
109
+ // Document signature
110
+ "Document Signature": "Podpis dokumentu",
111
+ "Signature text displayed on all PDF documents": "Tekst podpisu wyświetlany na wszystkich dokumentach PDF",
112
+ "Add signature text...": "Dodaj tekst podpisu...",
109
113
  // Overdue Notifications section
110
114
  "Overdue Notifications": "Powiadomienia o zaległych płatnościach",
111
115
  "Automatically remind customers about overdue invoices": "Automatycznie przypominaj klientom o zaległych fakturach",
@@ -105,6 +105,10 @@ export default {
105
105
  "Texto do rodapé apresentado na parte inferior de todos os documentos PDF",
106
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
107
  "{entity_name} | Vencimento: {document_due_date} | Fatura #{document_number}",
108
+ // Document signature
109
+ "Document Signature": "Assinatura do documento",
110
+ "Signature text displayed on all PDF documents": "Texto de assinatura exibido em todos os documentos PDF",
111
+ "Add signature text...": "Adicionar texto de assinatura...",
108
112
  // Overdue Notifications section
109
113
  "Overdue Notifications": "Notificações de atraso",
110
114
  "Automatically remind customers about overdue invoices":
@@ -104,6 +104,10 @@ export default {
104
104
  "Footer text displayed at the bottom of all PDF documents": "Besedilo noge, prikazano na dnu vseh PDF dokumentov",
105
105
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
106
106
  "{entity_name} | Rok plačila: {document_due_date} | Račun #{document_number}",
107
+ // Document signature
108
+ "Document Signature": "Podpis dokumenta",
109
+ "Signature text displayed on all PDF documents": "Besedilo podpisa, prikazano na vseh PDF dokumentih",
110
+ "Add signature text...": "Dodaj besedilo podpisa...",
107
111
  // Overdue Notifications section
108
112
  "Overdue Notifications": "Opomniki o zapadlih računih",
109
113
  "Automatically remind customers about overdue invoices": "Samodejno opominjajte stranke o zapadlih računih",
@@ -178,6 +178,7 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
178
178
  const [formData, setFormData] = useState({
179
179
  enabled: false,
180
180
  numbering_sequence: "P" as "N" | "P",
181
+ unified_numbering: true,
181
182
  operator_oib: "",
182
183
  operator_label: "",
183
184
  u_sust_pdv: true,
@@ -189,6 +190,7 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
189
190
  setFormData({
190
191
  enabled: finaSettings.enabled || false,
191
192
  numbering_sequence: finaSettings.numbering_sequence || "P",
193
+ unified_numbering: finaSettings.unified_numbering !== false,
192
194
  operator_oib: finaSettings.operator_oib || "",
193
195
  operator_label: finaSettings.operator_label || "",
194
196
  u_sust_pdv: finaSettings.u_sust_pdv ?? true,
@@ -531,6 +533,19 @@ export const FinaSettingsForm: FC<FinaSettingsFormProps> = ({
531
533
  <Label htmlFor="seq-n">{translate("Per Device (N)")}</Label>
532
534
  </div>
533
535
  </RadioGroup>
536
+
537
+ <div className="mt-4 space-y-2">
538
+ <div className="flex items-center space-x-2">
539
+ <Switch
540
+ checked={formData.unified_numbering}
541
+ onCheckedChange={(checked) => setFormData((prev) => ({ ...prev, unified_numbering: checked }))}
542
+ />
543
+ <Label>{translate("Unified document numbering")}</Label>
544
+ </div>
545
+ <p className="text-muted-foreground text-sm">
546
+ {translate("Use the same numbering sequence for all documents, including non-fiscalized ones")}
547
+ </p>
548
+ </div>
534
549
  </div>,
535
550
  )}
536
551
 
@@ -174,7 +174,11 @@ export function useRegisterFinaElectronicDevice(
174
174
  ...options,
175
175
  mutationFn: async ({ entityId, premiseId, deviceId }) => {
176
176
  if (!sdk) throw new Error("SDK not initialized");
177
- return sdk.finaDevices.registerFinaDevice(premiseId, { device_id: deviceId }, { entity_id: entityId });
177
+ return sdk.finaDevices.registerFinaDevice(
178
+ premiseId,
179
+ { electronic_device_name: deviceId },
180
+ { entity_id: entityId },
181
+ );
178
182
  },
179
183
  onSuccess: (data, variables, context) => {
180
184
  queryClient.invalidateQueries({
@@ -165,4 +165,7 @@ export default {
165
165
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
166
166
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
167
167
  "Save & Retry": "Save & Retry",
168
+ "Unified document numbering": "Einheitliche Dokumentennummerierung",
169
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
170
+ "Verwenden Sie die gleiche Nummerierungsfolge für alle Dokumente, einschließlich nicht-fiskalisierter",
168
171
  } as const;
@@ -159,4 +159,7 @@ export default {
159
159
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
161
161
  "Save & Retry": "Save & Retry",
162
+ "Unified document numbering": "Unified document numbering",
163
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones",
162
165
  } as const;
@@ -159,4 +159,7 @@ export default {
159
159
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
161
161
  "Save & Retry": "Save & Retry",
162
+ "Unified document numbering": "Numeración unificada de documentos",
163
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
164
+ "Utilice la misma secuencia de numeración para todos los documentos, incluidos los no fiscalizados",
162
165
  } as const;
@@ -158,4 +158,7 @@ export default {
158
158
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
159
159
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
160
160
  "Save & Retry": "Save & Retry",
161
+ "Unified document numbering": "Numérotation unifiée des documents",
162
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
163
+ "Utiliser la même séquence de numérotation pour tous les documents, y compris les non-fiscalisés",
161
164
  } as const;
@@ -160,4 +160,7 @@ export default {
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
161
161
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
162
162
  "Save & Retry": "Save & Retry",
163
+ "Unified document numbering": "Jedinstveno numeriranje dokumenata",
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
165
+ "Koristite isti redoslijed numeriranja za sve dokumente, uključujući nefiskalizirane",
163
166
  } as const;
@@ -160,4 +160,7 @@ export default {
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
161
161
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
162
162
  "Save & Retry": "Save & Retry",
163
+ "Unified document numbering": "Numerazione unificata dei documenti",
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
165
+ "Utilizza la stessa sequenza di numerazione per tutti i documenti, compresi quelli non fiscalizzati",
163
166
  } as const;
@@ -160,4 +160,7 @@ export default {
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
161
161
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
162
162
  "Save & Retry": "Save & Retry",
163
+ "Unified document numbering": "Uniforme documentnummering",
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
165
+ "Gebruik dezelfde nummeringsvolgorde voor alle documenten, inclusief niet-gefiscaliseerde",
163
166
  } as const;
@@ -158,4 +158,7 @@ export default {
158
158
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
159
159
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
160
160
  "Save & Retry": "Save & Retry",
161
+ "Unified document numbering": "Jednolita numeracja dokumentów",
162
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
163
+ "Użyj tej samej sekwencji numeracji dla wszystkich dokumentów, w tym niefiskalizowanych",
161
164
  } as const;
@@ -160,4 +160,7 @@ export default {
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
161
161
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
162
162
  "Save & Retry": "Save & Retry",
163
+ "Unified document numbering": "Numeração unificada de documentos",
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
165
+ "Use a mesma sequência de numeração para todos os documentos, incluindo os não fiscalizados",
163
166
  } as const;
@@ -160,4 +160,7 @@ export default {
160
160
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.":
161
161
  "Your FINA operator information is needed to fiscalize this document. Please enter your operator details.",
162
162
  "Save & Retry": "Save & Retry",
163
+ "Unified document numbering": "Enotno številčenje dokumentov",
164
+ "Use the same numbering sequence for all documents, including non-fiscalized ones":
165
+ "Uporabite enako zaporedje številčenja za vse dokumente, tudi za nefiskalizirane",
163
166
  } as const;
@@ -5,7 +5,7 @@ import type { FinaSectionType } from "../fina-settings-form";
5
5
  type FinaBusinessPremise = {
6
6
  id: string;
7
7
  entity_id: string;
8
- premise_id: string;
8
+ business_premise_name: string;
9
9
  type: string;
10
10
  is_active: boolean;
11
11
  registered_at: Date | string | null;
@@ -13,7 +13,7 @@ type FinaBusinessPremise = {
13
13
  created_at: Date | string;
14
14
  Devices?: Array<{
15
15
  id: string;
16
- device_id?: string;
16
+ electronic_device_name?: string;
17
17
  }>;
18
18
  };
19
19
 
@@ -174,7 +174,7 @@ export const PremisesManagementSection: FC<PremisesManagementSectionProps> = ({
174
174
  <div className="flex items-start justify-between">
175
175
  <div className="space-y-1">
176
176
  <div className="flex items-center gap-2">
177
- <CardTitle className="text-base">{premise.premise_id}</CardTitle>
177
+ <CardTitle className="text-base">{premise.business_premise_name}</CardTitle>
178
178
  <Badge variant={premise.is_active ? "default" : "secondary"}>
179
179
  {premise.is_active ? t("Active") : t("Inactive")}
180
180
  </Badge>
@@ -219,7 +219,7 @@ export const PremisesManagementSection: FC<PremisesManagementSectionProps> = ({
219
219
  {premise.Devices.map((d) => (
220
220
  <div key={d.id} className="flex items-center gap-1 rounded border px-2 py-1 text-xs">
221
221
  <Cpu className="h-3 w-3 text-muted-foreground" />
222
- <span>{d.device_id || "?"}</span>
222
+ <span>{d.electronic_device_name || "?"}</span>
223
223
  {premise.is_active && (
224
224
  <button
225
225
  type="button"
@@ -24,7 +24,7 @@ import { Input } from "@/ui/components/ui/input";
24
24
  import { useCreateFinaPremise } from "../fina-settings.hooks";
25
25
 
26
26
  const createPremiseSchema = z.object({
27
- premise_id: z
27
+ business_premise_name: z
28
28
  .string()
29
29
  .min(1, "Premise ID is required")
30
30
  .max(20)
@@ -53,7 +53,7 @@ export const RegisterFinaPremiseDialog: FC<RegisterFinaPremiseDialogProps> = ({
53
53
  const form = useForm<CreatePremiseForm>({
54
54
  resolver: zodResolver(createPremiseSchema),
55
55
  defaultValues: {
56
- premise_id: "",
56
+ business_premise_name: "",
57
57
  },
58
58
  });
59
59
 
@@ -88,7 +88,7 @@ export const RegisterFinaPremiseDialog: FC<RegisterFinaPremiseDialogProps> = ({
88
88
  <form onSubmit={form.handleSubmit(handleSubmit)} className="space-y-4">
89
89
  <FormField
90
90
  control={form.control}
91
- name="premise_id"
91
+ name="business_premise_name"
92
92
  render={({ field }) => (
93
93
  <FormItem>
94
94
  <FormLabel>{t("Premise ID")}</FormLabel>
@@ -51,6 +51,7 @@ const defaultsSettingsSchema = z.object({
51
51
  default_credit_note_payment_terms: z.union([z.string(), z.null()]).optional(),
52
52
  // Shared
53
53
  document_footer: z.union([z.string(), z.null()]).optional(),
54
+ default_document_signature: z.union([z.string(), z.null()]).optional(),
54
55
  });
55
56
 
56
57
  type DefaultsSettingsSchema = z.infer<typeof defaultsSettingsSchema>;
@@ -89,6 +90,8 @@ export function DefaultsSettingsForm({
89
90
  const creditNotePaymentTermsRef = useRef<HTMLTextAreaElement>(null);
90
91
  // Ref for document footer (shared)
91
92
  const documentFooterRef = useRef<HTMLTextAreaElement>(null);
93
+ // Ref for document signature (shared)
94
+ const documentSignatureRef = useRef<HTMLTextAreaElement>(null);
92
95
 
93
96
  const form = useForm<DefaultsSettingsSchema>({
94
97
  resolver: zodResolver(defaultsSettingsSchema),
@@ -106,6 +109,7 @@ export function DefaultsSettingsForm({
106
109
  default_credit_note_payment_terms: currentSettings.default_credit_note_payment_terms || null,
107
110
  // Shared
108
111
  document_footer: currentSettings.document_footer || null,
112
+ default_document_signature: currentSettings.default_document_signature || null,
109
113
  },
110
114
  });
111
115
 
@@ -140,6 +144,7 @@ export function DefaultsSettingsForm({
140
144
  default_credit_note_payment_terms: values.default_credit_note_payment_terms || null,
141
145
  // Shared
142
146
  document_footer: values.document_footer || null,
147
+ default_document_signature: values.default_document_signature || null,
143
148
  },
144
149
  };
145
150
 
@@ -452,7 +457,39 @@ export function DefaultsSettingsForm({
452
457
 
453
458
  // Footer section content
454
459
  const footerContent = (
455
- <div className="border-t pt-6">
460
+ <div className="space-y-6 border-t pt-6">
461
+ <FormField
462
+ control={form.control}
463
+ name="default_document_signature"
464
+ render={({ field }) => (
465
+ <FormItem>
466
+ <div className="flex items-center justify-between">
467
+ <FormLabel className="font-medium text-sm">{t("Document Signature")}</FormLabel>
468
+ <SmartCodeInsertButton
469
+ textareaRef={documentSignatureRef}
470
+ value={field.value || ""}
471
+ onInsert={(newValue) => field.onChange(newValue)}
472
+ t={t}
473
+ />
474
+ </div>
475
+ <FormControl>
476
+ <InputWithPreview
477
+ ref={documentSignatureRef}
478
+ value={field.value || ""}
479
+ onChange={field.onChange}
480
+ placeholder={t("{entity_name}")}
481
+ entity={entity}
482
+ multiline
483
+ rows={2}
484
+ className="resize-y"
485
+ />
486
+ </FormControl>
487
+ <FormDescription className="text-xs">{t("Signature text displayed on all PDF documents")}</FormDescription>
488
+ <FormMessage />
489
+ </FormItem>
490
+ )}
491
+ />
492
+
456
493
  <FormField
457
494
  control={form.control}
458
495
  name="document_footer"
@@ -1,11 +1,5 @@
1
1
  import { zodResolver } from "@hookform/resolvers/zod";
2
- import type {
3
- Entity,
4
- EntitySettings,
5
- EntitySettingsTaxClauseDefaults,
6
- GetEntities200DataItem,
7
- TaxRules,
8
- } from "@spaceinvoices/js-sdk";
2
+ import type { Entity, EntitySettings, EntitySettingsTaxClauseDefaults, TaxRules } from "@spaceinvoices/js-sdk";
9
3
  import { ChevronDown, Globe, MessageSquareText } from "lucide-react";
10
4
  import type { ReactNode } from "react";
11
5
  import { useState } from "react";
@@ -40,7 +34,8 @@ const taxRulesSettingsSchema = z.object({
40
34
  require_gross_prices: z.boolean(),
41
35
  // Tax clause defaults per transaction type
42
36
  tax_clause_intra_eu_b2b: z.string().optional(),
43
- tax_clause_export: z.string().optional(),
37
+ tax_clause_3w_b2b: z.string().optional(),
38
+ tax_clause_3w_b2c: z.string().optional(),
44
39
  tax_clause_domestic: z.string().optional(),
45
40
  tax_clause_intra_eu_b2c: z.string().optional(),
46
41
  });
@@ -50,7 +45,7 @@ type TaxRulesSettingsSchema = z.infer<typeof taxRulesSettingsSchema>;
50
45
  type SectionType = "tax-rules" | "tax-clauses";
51
46
 
52
47
  /** Entity type with country_rules included (from getEntities response) */
53
- type EntityWithRules = GetEntities200DataItem;
48
+ type EntityWithRules = Entity;
54
49
 
55
50
  export type TaxRulesSettingsFormProps = {
56
51
  entity: EntityWithRules;
@@ -93,7 +88,8 @@ export function TaxRulesSettingsForm({
93
88
  auto_remove_tax_export: currentTaxRules.auto_remove_tax_export ?? false,
94
89
  require_gross_prices: currentTaxRules.require_gross_prices ?? false,
95
90
  tax_clause_intra_eu_b2b: currentTaxClauseDefaults.intra_eu_b2b ?? "",
96
- tax_clause_export: currentTaxClauseDefaults.export ?? "",
91
+ tax_clause_3w_b2b: (currentTaxClauseDefaults as any)["3w_b2b"] ?? currentTaxClauseDefaults.export ?? "",
92
+ tax_clause_3w_b2c: (currentTaxClauseDefaults as any)["3w_b2c"] ?? currentTaxClauseDefaults.export ?? "",
97
93
  tax_clause_domestic: currentTaxClauseDefaults.domestic ?? "",
98
94
  tax_clause_intra_eu_b2c: currentTaxClauseDefaults.intra_eu_b2c ?? "",
99
95
  },
@@ -128,7 +124,8 @@ export function TaxRulesSettingsForm({
128
124
  },
129
125
  tax_clause_defaults: {
130
126
  intra_eu_b2b: values.tax_clause_intra_eu_b2b || null,
131
- export: values.tax_clause_export || null,
127
+ "3w_b2b": values.tax_clause_3w_b2b || null,
128
+ "3w_b2c": values.tax_clause_3w_b2c || null,
132
129
  domestic: values.tax_clause_domestic || null,
133
130
  intra_eu_b2c: values.tax_clause_intra_eu_b2c || null,
134
131
  },
@@ -289,14 +286,34 @@ export function TaxRulesSettingsForm({
289
286
  )}
290
287
  />
291
288
 
292
- {/* Export */}
289
+ {/* 3W B2B (non-EU business) */}
293
290
  <FormField
294
291
  control={form.control}
295
- name="tax_clause_export"
292
+ name="tax_clause_3w_b2b"
296
293
  render={({ field }) => (
297
294
  <FormItem className="rounded-lg border p-4">
298
- <FormLabel>{t("tax-clauses.export.label")}</FormLabel>
299
- <FormDescription>{t("tax-clauses.export.description")}</FormDescription>
295
+ <FormLabel>{t("tax-clauses.3w_b2b.label")}</FormLabel>
296
+ <FormDescription>{t("tax-clauses.3w_b2b.description")}</FormDescription>
297
+ <FormControl>
298
+ <Textarea
299
+ placeholder={t("Enter export exemption clause...")}
300
+ className="min-h-[80px] resize-y"
301
+ {...field}
302
+ />
303
+ </FormControl>
304
+ <FormMessage />
305
+ </FormItem>
306
+ )}
307
+ />
308
+
309
+ {/* 3W B2C (non-EU consumer) */}
310
+ <FormField
311
+ control={form.control}
312
+ name="tax_clause_3w_b2c"
313
+ render={({ field }) => (
314
+ <FormItem className="rounded-lg border p-4">
315
+ <FormLabel>{t("tax-clauses.3w_b2c.label")}</FormLabel>
316
+ <FormDescription>{t("tax-clauses.3w_b2c.description")}</FormDescription>
300
317
  <FormControl>
301
318
  <Textarea
302
319
  placeholder={t("Enter export exemption clause...")}
@@ -11,7 +11,7 @@ import { Form } from "@/ui/components/ui/form";
11
11
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/ui/components/ui/tooltip";
12
12
  import { createEstimateSchema } from "@/ui/generated/schemas";
13
13
  import { useNextDocumentNumber } from "@/ui/hooks/use-next-document-number";
14
- import { useViesCheck } from "@/ui/hooks/use-vies-check";
14
+ import { useTransactionTypeCheck } from "@/ui/hooks/use-transaction-type-check";
15
15
  import type { ComponentTranslationProps } from "@/ui/lib/translation";
16
16
  import { createTranslation } from "@/ui/lib/translation";
17
17
  import { useEntities } from "@/ui/providers/entities-context";
@@ -19,8 +19,10 @@ import { useFormFooterRegistration } from "@/ui/providers/form-footer-context";
19
19
  import { CUSTOMERS_CACHE_KEY } from "../../customers/customers.hooks";
20
20
  import {
21
21
  DocumentDetailsSection,
22
+ DocumentFooterField,
22
23
  DocumentNoteField,
23
24
  DocumentPaymentTermsField,
25
+ DocumentSignatureField,
24
26
  DocumentTaxClauseField,
25
27
  } from "../../documents/create/document-details-section";
26
28
  import { DocumentItemsSection, type PriceModesMap } from "../../documents/create/document-items-section";
@@ -116,8 +118,9 @@ export default function CreateEstimateForm({
116
118
  enabled: !!entityId,
117
119
  });
118
120
 
119
- // Get default payment terms from entity settings
121
+ // Get default payment terms and footer from entity settings
120
122
  const defaultPaymentTerms = (activeEntity?.settings as any)?.default_estimate_payment_terms || "";
123
+ const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
121
124
 
122
125
  const form = useForm<CreateEstimateFormValues>({
123
126
  resolver: zodResolver(createEstimateSchema) as Resolver<CreateEstimateFormValues>,
@@ -151,9 +154,11 @@ export default function CreateEstimateForm({
151
154
  },
152
155
  ],
153
156
  currency_code: initialValues?.currency_code || activeEntity?.currency_code || "EUR",
157
+ reference: (initialValues as any)?.reference ?? "",
154
158
  note: initialValues?.note ?? defaultEstimateNote,
155
159
  tax_clause: (initialValues as any)?.tax_clause ?? "",
156
160
  payment_terms: initialValues?.payment_terms ?? defaultPaymentTerms,
161
+ footer: (initialValues as any)?.footer ?? defaultFooter,
157
162
  date_valid_till:
158
163
  initialValues?.date_valid_till ||
159
164
  calculateDueDate(initialValues?.date || new Date().toISOString(), defaultEstimateValidDays),
@@ -189,6 +194,10 @@ export default function CreateEstimateForm({
189
194
  if (entityDefaultNote && !form.getValues("note")) {
190
195
  form.setValue("note", entityDefaultNote);
191
196
  }
197
+ const entityDefaultSignature = (activeEntity?.settings as any)?.default_document_signature;
198
+ if (entityDefaultSignature && !form.getValues("signature")) {
199
+ form.setValue("signature", entityDefaultSignature);
200
+ }
192
201
  if (!initialValues?.date_valid_till) {
193
202
  const validDays = (activeEntity?.settings as any)?.default_estimate_valid_days ?? 30;
194
203
  const currentDate = form.getValues("date");
@@ -250,12 +259,13 @@ export default function CreateEstimateForm({
250
259
  transactionType,
251
260
  isFetching: isViesFetching,
252
261
  warning: viesWarning,
253
- } = useViesCheck({
262
+ } = useTransactionTypeCheck({
254
263
  issuerCountryCode: activeEntity?.country_code,
255
264
  isTaxSubject: activeEntity?.is_tax_subject ?? true,
256
265
  customerCountry: formValues.customer?.country,
257
266
  customerCountryCode: formValues.customer?.country_code,
258
267
  customerTaxNumber: formValues.customer?.tax_number,
268
+ customerIsEndConsumer: (formValues.customer as any)?.is_end_consumer,
259
269
  enabled: !!activeEntity,
260
270
  });
261
271
 
@@ -348,12 +358,16 @@ export default function CreateEstimateForm({
348
358
  secondaryAction,
349
359
  });
350
360
 
351
- // Set default payment terms from entity settings when entity data is available
361
+ // Set default payment terms and footer from entity settings when entity data is available
352
362
  useEffect(() => {
353
363
  const entityDefaultPaymentTerms = (activeEntity?.settings as any)?.default_estimate_payment_terms;
354
364
  if (entityDefaultPaymentTerms && !form.getValues("payment_terms")) {
355
365
  form.setValue("payment_terms", entityDefaultPaymentTerms);
356
366
  }
367
+ const entityDefaultFooter = (activeEntity?.settings as any)?.document_footer;
368
+ if (entityDefaultFooter && !form.getValues("footer")) {
369
+ form.setValue("footer", entityDefaultFooter);
370
+ }
357
371
  }, [activeEntity, form]);
358
372
 
359
373
  // Recalculate valid-till date when document date changes
@@ -389,8 +403,10 @@ export default function CreateEstimateForm({
389
403
  customer: formValues.customer,
390
404
  items: transformedItems,
391
405
  currency_code: formValues.currency_code,
406
+ reference: formValues.reference,
392
407
  note: formValues.note,
393
408
  payment_terms: formValues.payment_terms,
409
+ signature: formValues.signature,
394
410
  title_type: titleType,
395
411
  };
396
412
  callback(payload);
@@ -477,6 +493,32 @@ export default function CreateEstimateForm({
477
493
  customer: formValues.customer as any,
478
494
  }}
479
495
  />
496
+
497
+ <DocumentSignatureField
498
+ control={form.control}
499
+ t={t}
500
+ entity={activeEntity}
501
+ document={{
502
+ number: formValues.number,
503
+ date: formValues.date,
504
+ date_valid_till: formValues.date_valid_till,
505
+ currency_code: formValues.currency_code,
506
+ customer: formValues.customer as any,
507
+ }}
508
+ />
509
+
510
+ <DocumentFooterField
511
+ control={form.control}
512
+ t={t}
513
+ entity={activeEntity}
514
+ document={{
515
+ number: formValues.number,
516
+ date: formValues.date,
517
+ date_valid_till: formValues.date_valid_till,
518
+ currency_code: formValues.currency_code,
519
+ customer: formValues.customer as any,
520
+ }}
521
+ />
480
522
  </form>
481
523
  </Form>
482
524
  );
@@ -35,6 +35,9 @@ export default {
35
35
  "Insert variable": "Variable einfügen",
36
36
  "Add payment instructions, terms, or other notes...":
37
37
  "Zahlungsanweisungen, Bedingungen oder andere Notizen hinzufügen...",
38
+ // Signature field
39
+ Signature: "Unterschrift",
40
+ "Add signature text...": "Unterschriftstext hinzufügen...",
38
41
  // Payment terms field
39
42
  "Payment Terms": "Zahlungsbedingungen",
40
43
  "Add payment terms...": "Zahlungsbedingungen hinzufügen...",
@@ -76,5 +79,7 @@ export default {
76
79
  "Diese Rechnung wird nicht fiskalisiert (nicht-inländische Transaktion)",
77
80
  "Tax Clause": "Steuerklausel",
78
81
  "Add tax clause...": "Steuerklausel hinzufügen...",
82
+ Footer: "Fußzeile",
83
+ "Add document footer...": "Dokumentfußzeile hinzufügen...",
79
84
  "Reverse charge - tax exempt EU B2B sale": "Umkehrung der Steuerschuldnerschaft - steuerbefreiter EU B2B Verkauf",
80
85
  } as const;
@@ -33,6 +33,9 @@ export default {
33
33
  Note: "Nota",
34
34
  "Insert variable": "Insertar variable",
35
35
  "Add payment instructions, terms, or other notes...": "Añada instrucciones de pago, condiciones u otras notas...",
36
+ // Signature field
37
+ Signature: "Firma",
38
+ "Add signature text...": "Añadir texto de firma...",
36
39
  "Payment Terms": "Condiciones de pago",
37
40
  "Add payment terms...": "Añada condiciones de pago...",
38
41
  Quantity: "Cantidad",
@@ -69,5 +72,7 @@ export default {
69
72
  "Esta factura no será fiscalizada (transacción no nacional)",
70
73
  "Tax Clause": "Cláusula fiscal",
71
74
  "Add tax clause...": "Agregar cláusula fiscal...",
75
+ Footer: "Pie de página",
76
+ "Add document footer...": "Añadir pie de página del documento...",
72
77
  "Reverse charge - tax exempt EU B2B sale": "Inversión del sujeto pasivo - venta EU B2B exenta de impuestos",
73
78
  } as const;
@@ -34,6 +34,9 @@ export default {
34
34
  "Insert variable": "Insérer une variable",
35
35
  "Add payment instructions, terms, or other notes...":
36
36
  "Ajoutez des instructions de paiement, des conditions ou d'autres notes...",
37
+ // Signature field
38
+ Signature: "Signature",
39
+ "Add signature text...": "Ajouter un texte de signature...",
37
40
  "Payment Terms": "Conditions de paiement",
38
41
  "Add payment terms...": "Ajoutez des conditions de paiement...",
39
42
  Quantity: "Quantité",
@@ -70,5 +73,7 @@ export default {
70
73
  "Cette facture ne sera pas fiscalisée (transaction non nationale)",
71
74
  "Tax Clause": "Clause fiscale",
72
75
  "Add tax clause...": "Ajouter une clause fiscale...",
76
+ Footer: "Pied de page",
77
+ "Add document footer...": "Ajouter un pied de page...",
73
78
  "Reverse charge - tax exempt EU B2B sale": "Autoliquidation - vente B2B UE exonérée de taxe",
74
79
  } as const;