@spaceinvoices/react-ui 0.4.4 → 0.4.6

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 (178) 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 +151 -45
  5. package/src/components/advance-invoices/create/locales/de.ts +20 -0
  6. package/src/components/advance-invoices/create/locales/es.ts +20 -0
  7. package/src/components/advance-invoices/create/locales/fr.ts +20 -0
  8. package/src/components/advance-invoices/create/locales/hr.ts +20 -0
  9. package/src/components/advance-invoices/create/locales/it.ts +20 -0
  10. package/src/components/advance-invoices/create/locales/nl.ts +20 -0
  11. package/src/components/advance-invoices/create/locales/pl.ts +20 -0
  12. package/src/components/advance-invoices/create/locales/pt.ts +20 -0
  13. package/src/components/advance-invoices/create/locales/sl.ts +20 -0
  14. package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +5 -5
  15. package/src/components/advance-invoices/list/list-row-actions.tsx +48 -1
  16. package/src/components/advance-invoices/list/list-table.tsx +21 -1
  17. package/src/components/advance-invoices/list/locales/de.ts +4 -0
  18. package/src/components/advance-invoices/list/locales/en.ts +3 -0
  19. package/src/components/advance-invoices/list/locales/es.ts +4 -0
  20. package/src/components/advance-invoices/list/locales/fr.ts +4 -0
  21. package/src/components/advance-invoices/list/locales/hr.ts +3 -0
  22. package/src/components/advance-invoices/list/locales/it.ts +4 -0
  23. package/src/components/advance-invoices/list/locales/nl.ts +4 -0
  24. package/src/components/advance-invoices/list/locales/pl.ts +3 -0
  25. package/src/components/advance-invoices/list/locales/pt.ts +4 -0
  26. package/src/components/advance-invoices/list/locales/sl.ts +3 -0
  27. package/src/components/credit-notes/create/create-credit-note-form.tsx +161 -42
  28. package/src/components/credit-notes/create/locales/de.ts +21 -0
  29. package/src/components/credit-notes/create/locales/es.ts +21 -0
  30. package/src/components/credit-notes/create/locales/fr.ts +21 -0
  31. package/src/components/credit-notes/create/locales/hr.ts +21 -0
  32. package/src/components/credit-notes/create/locales/it.ts +21 -0
  33. package/src/components/credit-notes/create/locales/nl.ts +21 -0
  34. package/src/components/credit-notes/create/locales/pl.ts +21 -0
  35. package/src/components/credit-notes/create/locales/pt.ts +21 -0
  36. package/src/components/credit-notes/create/locales/sl.ts +22 -1
  37. package/src/components/credit-notes/credit-notes.hooks.ts +2 -2
  38. package/src/components/credit-notes/list/list-row-actions.tsx +44 -1
  39. package/src/components/credit-notes/list/list-table.tsx +16 -2
  40. package/src/components/credit-notes/list/locales/de.ts +2 -0
  41. package/src/components/credit-notes/list/locales/en.ts +2 -0
  42. package/src/components/credit-notes/list/locales/es.ts +2 -0
  43. package/src/components/credit-notes/list/locales/fr.ts +2 -0
  44. package/src/components/credit-notes/list/locales/hr.ts +2 -0
  45. package/src/components/credit-notes/list/locales/it.ts +2 -0
  46. package/src/components/credit-notes/list/locales/nl.ts +2 -0
  47. package/src/components/credit-notes/list/locales/pl.ts +2 -0
  48. package/src/components/credit-notes/list/locales/pt.ts +2 -0
  49. package/src/components/credit-notes/list/locales/sl.ts +2 -0
  50. package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +48 -9
  51. package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +77 -48
  52. package/src/components/dashboard/shared/use-revenue-data.ts +77 -9
  53. package/src/components/delivery-notes/create/create-delivery-note-form.tsx +114 -7
  54. package/src/components/delivery-notes/create/locales/de.ts +21 -0
  55. package/src/components/delivery-notes/create/locales/es.ts +21 -0
  56. package/src/components/delivery-notes/create/locales/fr.ts +21 -0
  57. package/src/components/delivery-notes/create/locales/hr.ts +21 -0
  58. package/src/components/delivery-notes/create/locales/it.ts +21 -0
  59. package/src/components/delivery-notes/create/locales/nl.ts +21 -0
  60. package/src/components/delivery-notes/create/locales/pl.ts +21 -0
  61. package/src/components/delivery-notes/create/locales/pt.ts +21 -0
  62. package/src/components/delivery-notes/create/locales/sl.ts +22 -1
  63. package/src/components/delivery-notes/list/list-table.tsx +17 -8
  64. package/src/components/delivery-notes/list/locales/de.ts +32 -1
  65. package/src/components/delivery-notes/list/locales/en.ts +31 -0
  66. package/src/components/delivery-notes/list/locales/es.ts +32 -1
  67. package/src/components/delivery-notes/list/locales/fr.ts +32 -1
  68. package/src/components/delivery-notes/list/locales/hr.ts +32 -1
  69. package/src/components/delivery-notes/list/locales/it.ts +32 -1
  70. package/src/components/delivery-notes/list/locales/nl.ts +32 -1
  71. package/src/components/delivery-notes/list/locales/pl.ts +32 -1
  72. package/src/components/delivery-notes/list/locales/pt.ts +32 -1
  73. package/src/components/delivery-notes/list/locales/sl.ts +32 -1
  74. package/src/components/documents/create/document-add-item-form.tsx +70 -0
  75. package/src/components/documents/create/document-details-section.tsx +590 -344
  76. package/src/components/documents/create/document-items-section.tsx +21 -4
  77. package/src/components/documents/create/live-preview.tsx +24 -4
  78. package/src/components/documents/create/mark-as-paid-section.tsx +29 -20
  79. package/src/components/documents/create/prepare-document-submission.ts +22 -8
  80. package/src/components/documents/create/smart-code-insert-button.tsx +6 -0
  81. package/src/components/documents/shared/document-preview-display.tsx +3 -4
  82. package/src/components/documents/view/document-actions-bar.tsx +7 -27
  83. package/src/components/documents/view/document-details-card.tsx +32 -9
  84. package/src/components/documents/view/locales/de.ts +3 -0
  85. package/src/components/documents/view/locales/es.ts +3 -0
  86. package/src/components/documents/view/locales/fr.ts +3 -0
  87. package/src/components/documents/view/locales/hr.ts +3 -0
  88. package/src/components/documents/view/locales/it.ts +3 -0
  89. package/src/components/documents/view/locales/nl.ts +3 -0
  90. package/src/components/documents/view/locales/pl.ts +3 -0
  91. package/src/components/documents/view/locales/pt.ts +3 -0
  92. package/src/components/documents/view/locales/sl.ts +4 -1
  93. package/src/components/documents/view/use-document-download.ts +6 -3
  94. package/src/components/entities/create-entity-form.tsx +2 -1
  95. package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +6 -0
  96. package/src/components/entities/entity-settings-form/input-with-preview.tsx +2 -117
  97. package/src/components/entities/entity-settings-form/locales/de.ts +5 -0
  98. package/src/components/entities/entity-settings-form/locales/es.ts +5 -0
  99. package/src/components/entities/entity-settings-form/locales/fr.ts +5 -0
  100. package/src/components/entities/entity-settings-form/locales/hr.ts +5 -0
  101. package/src/components/entities/entity-settings-form/locales/it.ts +5 -0
  102. package/src/components/entities/entity-settings-form/locales/nl.ts +5 -0
  103. package/src/components/entities/entity-settings-form/locales/pl.ts +5 -0
  104. package/src/components/entities/entity-settings-form/locales/pt.ts +5 -0
  105. package/src/components/entities/entity-settings-form/locales/sl.ts +5 -0
  106. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +15 -0
  107. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +5 -1
  108. package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
  109. package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
  110. package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
  111. package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
  112. package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
  113. package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
  114. package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
  115. package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
  116. package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
  117. package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
  118. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +4 -4
  119. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +3 -3
  120. package/src/components/entities/settings/company-settings-form.tsx +173 -20
  121. package/src/components/entities/settings/defaults-settings-form.tsx +38 -1
  122. package/src/components/entities/settings/tax-rules-settings-form.tsx +1 -2
  123. package/src/components/estimates/create/create-estimate-form.tsx +107 -8
  124. package/src/components/estimates/create/locales/de.ts +21 -0
  125. package/src/components/estimates/create/locales/es.ts +21 -0
  126. package/src/components/estimates/create/locales/fr.ts +21 -0
  127. package/src/components/estimates/create/locales/hr.ts +21 -0
  128. package/src/components/estimates/create/locales/it.ts +21 -0
  129. package/src/components/estimates/create/locales/nl.ts +21 -0
  130. package/src/components/estimates/create/locales/pl.ts +21 -0
  131. package/src/components/estimates/create/locales/pt.ts +21 -0
  132. package/src/components/estimates/create/locales/sl.ts +22 -1
  133. package/src/components/estimates/list/list-table.tsx +11 -2
  134. package/src/components/estimates/list/locales/de.ts +1 -0
  135. package/src/components/estimates/list/locales/en.ts +1 -0
  136. package/src/components/estimates/list/locales/es.ts +1 -0
  137. package/src/components/estimates/list/locales/fr.ts +1 -0
  138. package/src/components/estimates/list/locales/hr.ts +1 -0
  139. package/src/components/estimates/list/locales/it.ts +1 -0
  140. package/src/components/estimates/list/locales/nl.ts +1 -0
  141. package/src/components/estimates/list/locales/pl.ts +1 -0
  142. package/src/components/estimates/list/locales/pt.ts +1 -0
  143. package/src/components/estimates/list/locales/sl.ts +1 -0
  144. package/src/components/export/document-export-form.tsx +46 -12
  145. package/src/components/invoices/create/create-invoice-form.tsx +186 -48
  146. package/src/components/invoices/create/locales/de.ts +28 -0
  147. package/src/components/invoices/create/locales/es.ts +28 -0
  148. package/src/components/invoices/create/locales/fr.ts +28 -0
  149. package/src/components/invoices/create/locales/hr.ts +28 -0
  150. package/src/components/invoices/create/locales/it.ts +28 -0
  151. package/src/components/invoices/create/locales/nl.ts +28 -0
  152. package/src/components/invoices/create/locales/pl.ts +28 -0
  153. package/src/components/invoices/create/locales/pt.ts +28 -0
  154. package/src/components/invoices/create/locales/sl.ts +29 -1
  155. package/src/components/invoices/create/prepare-invoice-submission.ts +5 -5
  156. package/src/components/invoices/invoices.hooks.ts +2 -2
  157. package/src/components/invoices/view/fiscalization-status-card.tsx +10 -8
  158. package/src/components/table/search-input.tsx +17 -0
  159. package/src/components/table/table-pagination.tsx +1 -1
  160. package/src/generated/schemas/advanceinvoice.ts +6 -2
  161. package/src/generated/schemas/creditnote.ts +3 -1
  162. package/src/generated/schemas/deliverynote.ts +3 -1
  163. package/src/generated/schemas/entity.ts +4 -4
  164. package/src/generated/schemas/entityapikey.ts +19 -0
  165. package/src/generated/schemas/estimate.ts +6 -2
  166. package/src/generated/schemas/index.ts +1 -0
  167. package/src/generated/schemas/invoice.ts +4 -1
  168. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +17 -23
  169. package/src/generated/schemas/rendercreditnotepreview_body.ts +17 -23
  170. package/src/generated/schemas/renderdeliverynotepreview_body.ts +17 -23
  171. package/src/generated/schemas/renderestimatepreview_body.ts +17 -23
  172. package/src/generated/schemas/renderinvoicepreview_body.ts +19 -23
  173. package/src/generated/schemas/startpdfexport_body.ts +14 -2
  174. package/src/generated/schemas/webhook.ts +4 -0
  175. package/src/hooks/use-duplicate-document.ts +16 -9
  176. package/src/hooks/use-vies-check.ts +3 -0
  177. package/src/lib/template-variables.tsx +167 -0
  178. package/src/providers/entities-context.tsx +2 -2
@@ -2,6 +2,7 @@ import type { Entity, Estimate, Invoice } from "@spaceinvoices/js-sdk";
2
2
  import { forwardRef, useState } from "react";
3
3
  import { Input } from "@/ui/components/ui/input";
4
4
  import { Textarea } from "@/ui/components/ui/textarea";
5
+ import { replaceTemplateVariablesForPreview } from "@/ui/lib/template-variables";
5
6
  import { cn } from "@/ui/lib/utils";
6
7
 
7
8
  interface InputWithPreviewProps {
@@ -16,122 +17,6 @@ interface InputWithPreviewProps {
16
17
  disabled?: boolean;
17
18
  }
18
19
 
19
- function formatVariableName(varName: string): string {
20
- // Convert snake_case to Title Case with spaces
21
- // e.g., "document_number" -> "Document Number"
22
- return varName
23
- .split("_")
24
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
25
- .join(" ");
26
- }
27
-
28
- function getVariableValue(varName: string, entity: Entity, document?: Invoice | Estimate | null): string | null {
29
- // Entity-related variables
30
- if (varName === "entity_name") return entity.name || null;
31
- if (varName === "entity_email") return (entity.settings as any)?.email || null;
32
-
33
- // Date variables
34
- if (varName === "current_date") {
35
- return new Date().toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
36
- }
37
- if (varName === "current_year") return new Date().getFullYear().toString();
38
-
39
- // Document-specific variables (only available when document is provided)
40
- if (document) {
41
- if (varName === "document_number") return document.number || null;
42
- if (varName === "document_date") {
43
- return document.date
44
- ? new Date(document.date).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })
45
- : null;
46
- }
47
- if (varName === "document_total") {
48
- return document.total_with_tax
49
- ? new Intl.NumberFormat("en-US", { style: "currency", currency: document.currency_code || "USD" }).format(
50
- Number(document.total_with_tax),
51
- )
52
- : null;
53
- }
54
- if (varName === "document_currency") return document.currency_code || null;
55
-
56
- // Invoice-specific
57
- if ("date_due" in document && varName === "document_due_date") {
58
- return document.date_due
59
- ? new Date(document.date_due).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })
60
- : null;
61
- }
62
-
63
- // Estimate-specific
64
- if ("date_valid_till" in document && varName === "document_valid_until") {
65
- return document.date_valid_till
66
- ? new Date(document.date_valid_till).toLocaleDateString("en-US", {
67
- month: "long",
68
- day: "numeric",
69
- year: "numeric",
70
- })
71
- : null;
72
- }
73
-
74
- // Customer variables
75
- if (document.customer) {
76
- if (varName === "customer_name") return document.customer.name || null;
77
- if (varName === "customer_email") return (document.customer as any).email || null;
78
- }
79
- }
80
-
81
- // Return null for unavailable variables - they will show as placeholders
82
- return null;
83
- }
84
-
85
- function replaceTemplateVariables(
86
- template: string,
87
- entity: Entity,
88
- document?: Invoice | Estimate | null,
89
- ): React.ReactNode[] {
90
- if (!template) return [];
91
-
92
- // Split by variable pattern and process
93
- const parts: React.ReactNode[] = [];
94
- const regex = /\{([^}]+)\}/g;
95
- let lastIndex = 0;
96
- let match: RegExpExecArray | null = null;
97
-
98
- match = regex.exec(template);
99
- while (match !== null) {
100
- // Add text before the match
101
- if (match.index > lastIndex) {
102
- parts.push(template.slice(lastIndex, match.index));
103
- }
104
-
105
- // Add the replaced variable with styling
106
- // Green for resolved values, primary color for placeholders
107
- const varName = match[1];
108
- const actualValue = getVariableValue(varName, entity, document);
109
- const displayValue = actualValue || formatVariableName(varName);
110
-
111
- parts.push(
112
- <span
113
- key={match.index}
114
- className={cn(
115
- "rounded px-1.5 py-0.5 font-medium text-xs",
116
- actualValue ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary",
117
- )}
118
- >
119
- {displayValue}
120
- </span>,
121
- );
122
-
123
- lastIndex = regex.lastIndex;
124
- match = regex.exec(template);
125
- }
126
-
127
- // Add remaining text
128
- if (lastIndex < template.length) {
129
- parts.push(template.slice(lastIndex));
130
- }
131
-
132
- return parts;
133
- }
134
-
135
20
  export const InputWithPreview = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputWithPreviewProps>(
136
21
  function InputWithPreview(
137
22
  { value, onChange, placeholder, entity, document, multiline = false, className, rows, disabled = false },
@@ -139,7 +24,7 @@ export const InputWithPreview = forwardRef<HTMLInputElement | HTMLTextAreaElemen
139
24
  ) {
140
25
  const [isFocused, setIsFocused] = useState(false);
141
26
 
142
- const preview = replaceTemplateVariables(value, entity, document);
27
+ const preview = replaceTemplateVariablesForPreview(value, entity, document);
143
28
  const hasValue = Boolean(value);
144
29
 
145
30
  const showPreview = !isFocused && hasValue && !disabled;
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Steuerpflichtig",
3
4
  "Tax ID 2": "Steuernummer",
4
5
  "Secondary tax identification number (optional)": "Sekundäre Steueridentifikationsnummer (optional)",
5
6
  "Company Information": "Unternehmensinformationen",
@@ -105,6 +106,10 @@ export default {
105
106
  "Footer text displayed at the bottom of all PDF documents": "Fußzeilentext am unteren Rand aller PDF-Dokumente",
106
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
108
  "{entity_name} | Fällig am: {document_due_date} | Rechnung #{document_number}",
109
+ // Document signature
110
+ "Document Signature": "Dokumentunterschrift",
111
+ "Signature text displayed on all PDF documents": "Unterschriftstext auf allen PDF-Dokumenten",
112
+ "Add signature text...": "Unterschriftstext hinzufügen...",
108
113
  // Overdue Notifications section
109
114
  "Overdue Notifications": "Überfälligkeits-Benachrichtigungen",
110
115
  "Automatically remind customers about overdue invoices": "Erinnern Sie Kunden automatisch an überfällige Rechnungen",
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Sujeto fiscal",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Información de la empresa",
@@ -105,6 +106,10 @@ export default {
105
106
  "Texto del pie de página mostrado en la parte inferior de todos los documentos PDF",
106
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
108
  "{entity_name} | Vencimiento: {document_due_date} | Factura #{document_number}",
109
+ // Document signature
110
+ "Document Signature": "Firma del documento",
111
+ "Signature text displayed on all PDF documents": "Texto de firma mostrado en todos los documentos PDF",
112
+ "Add signature text...": "Añadir texto de firma...",
108
113
  // Overdue Notifications section
109
114
  "Overdue Notifications": "Notificaciones de vencimiento",
110
115
  "Automatically remind customers about overdue invoices":
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Assujetti à la TVA",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Informations sur l'entreprise",
@@ -105,6 +106,10 @@ export default {
105
106
  "Texte de pied de page affiché en bas de tous les documents PDF",
106
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
108
  "{entity_name} | Échéance : {document_due_date} | Facture #{document_number}",
109
+ // Document signature
110
+ "Document Signature": "Signature du document",
111
+ "Signature text displayed on all PDF documents": "Texte de signature affiché sur tous les documents PDF",
112
+ "Add signature text...": "Ajouter un texte de signature...",
108
113
  // Overdue Notifications section
109
114
  "Overdue Notifications": "Notifications de retard",
110
115
  "Automatically remind customers about overdue invoices":
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Porezni obveznik",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Podaci o tvrtki",
@@ -104,6 +105,10 @@ export default {
104
105
  "Footer text displayed at the bottom of all PDF documents": "Tekst podnožja prikazan na dnu svih PDF dokumenata",
105
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
106
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...",
107
112
  // Overdue Notifications section
108
113
  "Overdue Notifications": "Obavijesti o dospjelim računima",
109
114
  "Automatically remind customers about overdue invoices": "Automatski podsjećajte kupce o dospjelim računima",
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Soggetto fiscale",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Informazioni aziendali",
@@ -105,6 +106,10 @@ export default {
105
106
  "Testo del piè di pagina mostrato in fondo a tutti i documenti PDF",
106
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
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...",
108
113
  // Overdue Notifications section
109
114
  "Overdue Notifications": "Notifiche di scadenza",
110
115
  "Automatically remind customers about overdue invoices": "Ricorda automaticamente ai clienti le fatture scadute",
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Belastingplichtige",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Bedrijfsinformatie",
@@ -104,6 +105,10 @@ export default {
104
105
  "Footer text displayed at the bottom of all PDF documents": "Voettekst weergegeven onderaan alle PDF-documenten",
105
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
106
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...",
107
112
  // Overdue Notifications section
108
113
  "Overdue Notifications": "Herinneringen voor achterstallige betalingen",
109
114
  "Automatically remind customers about overdue invoices": "Klanten automatisch herinneren aan achterstallige facturen",
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Podatnik",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Informacje o firmie",
@@ -105,6 +106,10 @@ export default {
105
106
  "Tekst stopki wyświetlany na dole wszystkich dokumentów PDF",
106
107
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
107
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...",
108
113
  // Overdue Notifications section
109
114
  "Overdue Notifications": "Powiadomienia o zaległych płatnościach",
110
115
  "Automatically remind customers about overdue invoices": "Automatycznie przypominaj klientom o zaległych fakturach",
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Sujeito fiscal",
3
4
  "Tax ID 2": "Tax ID 2",
4
5
  "Secondary tax identification number (optional)": "Secondary tax identification number (optional)",
5
6
  "Company Information": "Informações da empresa",
@@ -104,6 +105,10 @@ export default {
104
105
  "Texto do rodapé apresentado na parte inferior de todos os documentos PDF",
105
106
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
106
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...",
107
112
  // Overdue Notifications section
108
113
  "Overdue Notifications": "Notificações de atraso",
109
114
  "Automatically remind customers about overdue invoices":
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  // Company settings
3
+ "Tax subject": "Davčni zavezanec",
3
4
  "Tax ID 2": "Davčna številka 2",
4
5
  "Secondary tax identification number (optional)": "Sekundarna davčna identifikacijska številka (neobvezno)",
5
6
  "Company Information": "Podatki o podjetju",
@@ -103,6 +104,10 @@ export default {
103
104
  "Footer text displayed at the bottom of all PDF documents": "Besedilo noge, prikazano na dnu vseh PDF dokumentov",
104
105
  "{entity_name} | Due Date: {document_due_date} | Invoice #{document_number}":
105
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...",
106
111
  // Overdue Notifications section
107
112
  "Overdue Notifications": "Opomniki o zapadlih računih",
108
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>