@spaceinvoices/react-ui 0.4.5 → 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 (115) 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 +91 -35
  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 +91 -35
  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/delivery-notes/create/create-delivery-note-form.tsx +47 -0
  27. package/src/components/delivery-notes/create/locales/de.ts +5 -0
  28. package/src/components/delivery-notes/create/locales/es.ts +5 -0
  29. package/src/components/delivery-notes/create/locales/fr.ts +5 -0
  30. package/src/components/delivery-notes/create/locales/hr.ts +5 -0
  31. package/src/components/delivery-notes/create/locales/it.ts +5 -0
  32. package/src/components/delivery-notes/create/locales/nl.ts +5 -0
  33. package/src/components/delivery-notes/create/locales/pl.ts +5 -0
  34. package/src/components/delivery-notes/create/locales/pt.ts +5 -0
  35. package/src/components/delivery-notes/create/locales/sl.ts +5 -0
  36. package/src/components/documents/create/document-details-section.tsx +472 -346
  37. package/src/components/documents/create/prepare-document-submission.ts +3 -1
  38. package/src/components/documents/create/smart-code-insert-button.tsx +6 -0
  39. package/src/components/documents/view/document-details-card.tsx +6 -0
  40. package/src/components/documents/view/locales/de.ts +1 -0
  41. package/src/components/documents/view/locales/es.ts +1 -0
  42. package/src/components/documents/view/locales/fr.ts +1 -0
  43. package/src/components/documents/view/locales/hr.ts +1 -0
  44. package/src/components/documents/view/locales/it.ts +1 -0
  45. package/src/components/documents/view/locales/nl.ts +1 -0
  46. package/src/components/documents/view/locales/pl.ts +1 -0
  47. package/src/components/documents/view/locales/pt.ts +1 -0
  48. package/src/components/documents/view/locales/sl.ts +1 -0
  49. package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +6 -0
  50. package/src/components/entities/entity-settings-form/input-with-preview.tsx +2 -145
  51. package/src/components/entities/entity-settings-form/locales/de.ts +4 -0
  52. package/src/components/entities/entity-settings-form/locales/es.ts +4 -0
  53. package/src/components/entities/entity-settings-form/locales/fr.ts +4 -0
  54. package/src/components/entities/entity-settings-form/locales/hr.ts +4 -0
  55. package/src/components/entities/entity-settings-form/locales/it.ts +4 -0
  56. package/src/components/entities/entity-settings-form/locales/nl.ts +4 -0
  57. package/src/components/entities/entity-settings-form/locales/pl.ts +4 -0
  58. package/src/components/entities/entity-settings-form/locales/pt.ts +4 -0
  59. package/src/components/entities/entity-settings-form/locales/sl.ts +4 -0
  60. package/src/components/entities/fina-settings-form/fina-settings-form.tsx +15 -0
  61. package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +5 -1
  62. package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
  63. package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
  64. package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
  65. package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
  66. package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
  67. package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
  68. package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
  69. package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
  70. package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
  71. package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
  72. package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +4 -4
  73. package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +3 -3
  74. package/src/components/entities/settings/defaults-settings-form.tsx +38 -1
  75. package/src/components/entities/settings/tax-rules-settings-form.tsx +1 -2
  76. package/src/components/estimates/create/create-estimate-form.tsx +43 -2
  77. package/src/components/estimates/create/locales/de.ts +5 -0
  78. package/src/components/estimates/create/locales/es.ts +5 -0
  79. package/src/components/estimates/create/locales/fr.ts +5 -0
  80. package/src/components/estimates/create/locales/hr.ts +5 -0
  81. package/src/components/estimates/create/locales/it.ts +5 -0
  82. package/src/components/estimates/create/locales/nl.ts +5 -0
  83. package/src/components/estimates/create/locales/pl.ts +5 -0
  84. package/src/components/estimates/create/locales/pt.ts +5 -0
  85. package/src/components/estimates/create/locales/sl.ts +5 -0
  86. package/src/components/invoices/create/create-invoice-form.tsx +130 -40
  87. package/src/components/invoices/create/locales/de.ts +13 -0
  88. package/src/components/invoices/create/locales/es.ts +13 -0
  89. package/src/components/invoices/create/locales/fr.ts +13 -0
  90. package/src/components/invoices/create/locales/hr.ts +13 -0
  91. package/src/components/invoices/create/locales/it.ts +13 -0
  92. package/src/components/invoices/create/locales/nl.ts +13 -0
  93. package/src/components/invoices/create/locales/pl.ts +13 -0
  94. package/src/components/invoices/create/locales/pt.ts +13 -0
  95. package/src/components/invoices/create/locales/sl.ts +13 -0
  96. package/src/components/invoices/create/prepare-invoice-submission.ts +5 -5
  97. package/src/components/invoices/invoices.hooks.ts +2 -2
  98. package/src/components/table/table-pagination.tsx +1 -1
  99. package/src/generated/schemas/advanceinvoice.ts +2 -0
  100. package/src/generated/schemas/creditnote.ts +1 -0
  101. package/src/generated/schemas/deliverynote.ts +1 -0
  102. package/src/generated/schemas/entity.ts +4 -4
  103. package/src/generated/schemas/entityapikey.ts +19 -0
  104. package/src/generated/schemas/estimate.ts +2 -0
  105. package/src/generated/schemas/index.ts +1 -0
  106. package/src/generated/schemas/invoice.ts +2 -0
  107. package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +1 -1
  108. package/src/generated/schemas/rendercreditnotepreview_body.ts +1 -1
  109. package/src/generated/schemas/renderdeliverynotepreview_body.ts +1 -1
  110. package/src/generated/schemas/renderestimatepreview_body.ts +1 -1
  111. package/src/generated/schemas/renderinvoicepreview_body.ts +1 -1
  112. package/src/generated/schemas/startpdfexport_body.ts +14 -2
  113. package/src/generated/schemas/webhook.ts +4 -0
  114. package/src/lib/template-variables.tsx +167 -0
  115. package/src/providers/entities-context.tsx +2 -2
@@ -17,8 +17,10 @@ import { useFormFooterRegistration } from "@/ui/providers/form-footer-context";
17
17
  import { CUSTOMERS_CACHE_KEY } from "../../customers/customers.hooks";
18
18
  import {
19
19
  DocumentDetailsSection,
20
+ DocumentFooterField,
20
21
  DocumentNoteField,
21
22
  DocumentPaymentTermsField,
23
+ DocumentSignatureField,
22
24
  DocumentTaxClauseField,
23
25
  } from "../../documents/create/document-details-section";
24
26
  import { DocumentItemsSection, type PriceModesMap } from "../../documents/create/document-items-section";
@@ -130,8 +132,8 @@ export default function CreateCreditNoteForm({
130
132
  const hasFinaPremises = activeFinaPremises.length > 0;
131
133
 
132
134
  // FINA premise/device selection state (no skip - all FINA credit notes must be fiscalized)
133
- const [selectedFinaPremiseId, setSelectedFinaPremiseId] = useState<string | undefined>();
134
- const [selectedFinaDeviceId, setSelectedFinaDeviceId] = useState<string | undefined>();
135
+ const [selectedFinaBusinessPremiseName, setSelectedFinaBusinessPremiseName] = useState<string | undefined>();
136
+ const [selectedFinaElectronicDeviceName, setSelectedFinaElectronicDeviceName] = useState<string | undefined>();
135
137
 
136
138
  // UI-only state (not part of API schema)
137
139
  const [markAsPaid, setMarkAsPaid] = useState(false);
@@ -201,22 +203,24 @@ export default function CreateCreditNoteForm({
201
203
 
202
204
  // Get active FINA devices for selected premise
203
205
  const activeFinaDevices = useMemo(() => {
204
- if (!selectedFinaPremiseId) return [];
205
- const premise = activeFinaPremises.find((p: any) => p.premise_id === selectedFinaPremiseId);
206
+ if (!selectedFinaBusinessPremiseName) return [];
207
+ const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
206
208
  return premise?.Devices?.filter((d: any) => d.is_active) || [];
207
- }, [activeFinaPremises, selectedFinaPremiseId]);
209
+ }, [activeFinaPremises, selectedFinaBusinessPremiseName]);
208
210
 
209
211
  // Initialize FINA selection from localStorage or first active combo
210
212
  useEffect(() => {
211
- if (!isFinaEnabled || !hasFinaPremises || selectedFinaPremiseId) return;
213
+ if (!isFinaEnabled || !hasFinaPremises || selectedFinaBusinessPremiseName) return;
212
214
 
213
215
  const lastUsed = getLastUsedFinaCombo(entityId);
214
216
  if (lastUsed) {
215
- const premise = activeFinaPremises.find((p: any) => p.premise_id === lastUsed.premise_id);
216
- const device = premise?.Devices?.find((d: any) => d.device_id === lastUsed.device_id && d.is_active);
217
+ const premise = activeFinaPremises.find((p: any) => p.business_premise_name === lastUsed.business_premise_name);
218
+ const device = premise?.Devices?.find(
219
+ (d: any) => d.electronic_device_name === lastUsed.electronic_device_name && d.is_active,
220
+ );
217
221
  if (premise && device) {
218
- setSelectedFinaPremiseId(lastUsed.premise_id);
219
- setSelectedFinaDeviceId(lastUsed.device_id);
222
+ setSelectedFinaBusinessPremiseName(lastUsed.business_premise_name);
223
+ setSelectedFinaElectronicDeviceName(lastUsed.electronic_device_name);
220
224
  return;
221
225
  }
222
226
  }
@@ -224,30 +228,31 @@ export default function CreateCreditNoteForm({
224
228
  const firstPremise = activeFinaPremises[0];
225
229
  const firstDevice = firstPremise?.Devices?.find((d: any) => d.is_active);
226
230
  if (firstPremise && firstDevice) {
227
- setSelectedFinaPremiseId(firstPremise.premise_id);
228
- setSelectedFinaDeviceId(firstDevice.device_id);
231
+ setSelectedFinaBusinessPremiseName(firstPremise.business_premise_name);
232
+ setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
229
233
  }
230
- }, [isFinaEnabled, hasFinaPremises, activeFinaPremises, entityId, selectedFinaPremiseId]);
234
+ }, [isFinaEnabled, hasFinaPremises, activeFinaPremises, entityId, selectedFinaBusinessPremiseName]);
231
235
 
232
236
  // When FINA premise changes, select first active device
233
237
  useEffect(() => {
234
- if (!selectedFinaPremiseId) return;
235
- const premise = activeFinaPremises.find((p: any) => p.premise_id === selectedFinaPremiseId);
238
+ if (!selectedFinaBusinessPremiseName) return;
239
+ const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
236
240
  const firstDevice = premise?.Devices?.find((d: any) => d.is_active);
237
- if (firstDevice && selectedFinaDeviceId !== firstDevice.device_id) {
241
+ if (firstDevice && selectedFinaElectronicDeviceName !== firstDevice.electronic_device_name) {
238
242
  const currentDeviceInPremise = premise?.Devices?.find(
239
- (d: any) => d.device_id === selectedFinaDeviceId && d.is_active,
243
+ (d: any) => d.electronic_device_name === selectedFinaElectronicDeviceName && d.is_active,
240
244
  );
241
245
  if (!currentDeviceInPremise) {
242
- setSelectedFinaDeviceId(firstDevice.device_id);
246
+ setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
243
247
  }
244
248
  }
245
- }, [selectedFinaPremiseId, activeFinaPremises, selectedFinaDeviceId]);
249
+ }, [selectedFinaBusinessPremiseName, activeFinaPremises, selectedFinaElectronicDeviceName]);
246
250
 
247
251
  // FINA selection ready and active checks
248
252
  const isFinaSelectionReady =
249
- !isFinaEnabled || !hasFinaPremises || (!!selectedFinaPremiseId && !!selectedFinaDeviceId);
250
- const isFinaActive = isFinaEnabled && hasFinaPremises && selectedFinaPremiseId && selectedFinaDeviceId;
253
+ !isFinaEnabled || !hasFinaPremises || (!!selectedFinaBusinessPremiseName && !!selectedFinaElectronicDeviceName);
254
+ const isFinaActive =
255
+ isFinaEnabled && hasFinaPremises && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName;
251
256
 
252
257
  // ============================================================================
253
258
  // Next Credit Note Number Preview
@@ -264,8 +269,9 @@ export default function CreateCreditNoteForm({
264
269
 
265
270
  // No header action for credit notes - FINA can't be skipped
266
271
 
267
- // Get default payment terms from entity settings
272
+ // Get default payment terms and footer from entity settings
268
273
  const defaultPaymentTerms = (activeEntity?.settings as any)?.default_credit_note_payment_terms || "";
274
+ const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
269
275
 
270
276
  const form = useForm<CreateCreditNoteFormValues>({
271
277
  // Cast resolver to accept extended form type (includes UI-only fields)
@@ -300,9 +306,11 @@ export default function CreateCreditNoteForm({
300
306
  },
301
307
  ],
302
308
  currency_code: initialValues?.currency_code || activeEntity?.currency_code || "EUR",
309
+ reference: (initialValues as any)?.reference ?? "",
303
310
  note: initialValues?.note ?? "",
304
311
  tax_clause: (initialValues as any)?.tax_clause ?? "",
305
312
  payment_terms: initialValues?.payment_terms ?? defaultPaymentTerms,
313
+ footer: (initialValues as any)?.footer ?? defaultFooter,
306
314
  },
307
315
  });
308
316
 
@@ -374,10 +382,10 @@ export default function CreateCreditNoteForm({
374
382
  });
375
383
  }
376
384
  // Save FINA combo to localStorage on successful creation
377
- if (isFinaActive && selectedFinaPremiseId && selectedFinaDeviceId) {
385
+ if (isFinaActive && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName) {
378
386
  setLastUsedFinaCombo(entityId, {
379
- premise_id: selectedFinaPremiseId,
380
- device_id: selectedFinaDeviceId,
387
+ business_premise_name: selectedFinaBusinessPremiseName,
388
+ electronic_device_name: selectedFinaElectronicDeviceName,
381
389
  });
382
390
  }
383
391
  // Invalidate customers cache when a customer was created/linked
@@ -400,8 +408,16 @@ export default function CreateCreditNoteForm({
400
408
 
401
409
  // Build FINA options (skip for drafts; FINA can't be skipped)
402
410
  const finaOptions =
403
- !isDraft && isFinaEnabled && !isFinaNonDomestic && selectedFinaPremiseId && selectedFinaDeviceId
404
- ? { premise_id: selectedFinaPremiseId, device_id: selectedFinaDeviceId, payment_type: paymentTypes[0] }
411
+ !isDraft &&
412
+ isFinaEnabled &&
413
+ !isFinaNonDomestic &&
414
+ selectedFinaBusinessPremiseName &&
415
+ selectedFinaElectronicDeviceName
416
+ ? {
417
+ business_premise_name: selectedFinaBusinessPremiseName,
418
+ electronic_device_name: selectedFinaElectronicDeviceName,
419
+ payment_type: paymentTypes[0],
420
+ }
405
421
  : undefined;
406
422
 
407
423
  const payload = prepareDocumentSubmission(values, {
@@ -435,8 +451,8 @@ export default function CreateCreditNoteForm({
435
451
  originalCustomer,
436
452
  paymentTypes,
437
453
  selectedDeviceName,
438
- selectedFinaDeviceId,
439
- selectedFinaPremiseId,
454
+ selectedFinaElectronicDeviceName,
455
+ selectedFinaBusinessPremiseName,
440
456
  selectedPremiseName,
441
457
  showCustomerForm,
442
458
  ],
@@ -478,6 +494,14 @@ export default function CreateCreditNoteForm({
478
494
  if (entityDefaultPaymentTerms && !form.getValues("payment_terms")) {
479
495
  form.setValue("payment_terms", entityDefaultPaymentTerms);
480
496
  }
497
+ const entityDefaultFooter = (activeEntity?.settings as any)?.document_footer;
498
+ if (entityDefaultFooter && !form.getValues("footer")) {
499
+ form.setValue("footer", entityDefaultFooter);
500
+ }
501
+ const entityDefaultSignature = (activeEntity?.settings as any)?.default_document_signature;
502
+ if (entityDefaultSignature && !form.getValues("signature")) {
503
+ form.setValue("signature", entityDefaultSignature);
504
+ }
481
505
  }, [activeEntity, form]);
482
506
 
483
507
  // Auto-add tax field for tax subject entities
@@ -512,8 +536,10 @@ export default function CreateCreditNoteForm({
512
536
  customer: formValues.customer,
513
537
  items: transformedItems,
514
538
  currency_code: formValues.currency_code,
539
+ reference: formValues.reference,
515
540
  note: formValues.note,
516
541
  payment_terms: formValues.payment_terms,
542
+ signature: formValues.signature,
517
543
  };
518
544
  onChange(payload);
519
545
  }
@@ -607,12 +633,18 @@ export default function CreateCreditNoteForm({
607
633
  finaInline={
608
634
  isFinaEnabled && hasFinaPremises && !isFinaNonDomestic
609
635
  ? {
610
- premises: activeFinaPremises.map((p: any) => ({ id: p.id, premise_id: p.premise_id })),
611
- devices: activeFinaDevices.map((d: any) => ({ id: d.id, device_id: d.device_id })),
612
- selectedPremise: selectedFinaPremiseId,
613
- selectedDevice: selectedFinaDeviceId,
614
- onPremiseChange: setSelectedFinaPremiseId,
615
- onDeviceChange: setSelectedFinaDeviceId,
636
+ premises: activeFinaPremises.map((p: any) => ({
637
+ id: p.id,
638
+ business_premise_name: p.business_premise_name,
639
+ })),
640
+ devices: activeFinaDevices.map((d: any) => ({
641
+ id: d.id,
642
+ electronic_device_name: d.electronic_device_name,
643
+ })),
644
+ selectedPremise: selectedFinaBusinessPremiseName,
645
+ selectedDevice: selectedFinaElectronicDeviceName,
646
+ onPremiseChange: setSelectedFinaBusinessPremiseName,
647
+ onDeviceChange: setSelectedFinaElectronicDeviceName,
616
648
  }
617
649
  : undefined
618
650
  }
@@ -685,6 +717,30 @@ export default function CreateCreditNoteForm({
685
717
  customer: formValues.customer as any,
686
718
  }}
687
719
  />
720
+
721
+ <DocumentSignatureField
722
+ control={form.control}
723
+ t={t}
724
+ entity={activeEntity}
725
+ document={{
726
+ number: formValues.number,
727
+ date: formValues.date,
728
+ currency_code: formValues.currency_code,
729
+ customer: formValues.customer as any,
730
+ }}
731
+ />
732
+
733
+ <DocumentFooterField
734
+ control={form.control}
735
+ t={t}
736
+ entity={activeEntity}
737
+ document={{
738
+ number: formValues.number,
739
+ date: formValues.date,
740
+ currency_code: formValues.currency_code,
741
+ customer: formValues.customer as any,
742
+ }}
743
+ />
688
744
  </form>
689
745
  </Form>
690
746
  );
@@ -39,6 +39,9 @@ export default {
39
39
  "Insert variable": "Variable einfügen",
40
40
  "Add payment instructions, terms, or other notes...":
41
41
  "Zahlungsanweisungen, Bedingungen oder andere Notizen hinzufügen...",
42
+ // Signature field
43
+ Signature: "Unterschrift",
44
+ "Add signature text...": "Unterschriftstext hinzufügen...",
42
45
  // Payment terms field
43
46
  "Payment Terms": "Zahlungsbedingungen",
44
47
  "Add payment terms...": "Zahlungsbedingungen hinzufügen...",
@@ -91,5 +94,7 @@ export default {
91
94
  "Diese Rechnung wird nicht fiskalisiert (nicht-inländische Transaktion)",
92
95
  "Tax Clause": "Steuerklausel",
93
96
  "Add tax clause...": "Steuerklausel hinzufügen...",
97
+ Footer: "Fußzeile",
98
+ "Add document footer...": "Dokumentfußzeile hinzufügen...",
94
99
  "Reverse charge - tax exempt EU B2B sale": "Umkehrung der Steuerschuldnerschaft - steuerbefreiter EU B2B Verkauf",
95
100
  } as const;
@@ -38,6 +38,9 @@ export default {
38
38
  Note: "Nota",
39
39
  "Insert variable": "Insertar variable",
40
40
  "Add payment instructions, terms, or other notes...": "Agregue instrucciones de pago, terminos u otras notas...",
41
+ // Signature field
42
+ Signature: "Firma",
43
+ "Add signature text...": "Añadir texto de firma...",
41
44
  // Payment terms field
42
45
  "Payment Terms": "Terminos de pago",
43
46
  "Add payment terms...": "Agregue terminos de pago...",
@@ -90,5 +93,7 @@ export default {
90
93
  "Esta factura no será fiscalizada (transacción no nacional)",
91
94
  "Tax Clause": "Cláusula fiscal",
92
95
  "Add tax clause...": "Agregar cláusula fiscal...",
96
+ Footer: "Pie de página",
97
+ "Add document footer...": "Añadir pie de página del documento...",
93
98
  "Reverse charge - tax exempt EU B2B sale": "Inversión del sujeto pasivo - venta EU B2B exenta de impuestos",
94
99
  } as const;
@@ -39,6 +39,9 @@ export default {
39
39
  "Insert variable": "Inserer une variable",
40
40
  "Add payment instructions, terms, or other notes...":
41
41
  "Ajoutez des instructions de paiement, des conditions ou d'autres notes...",
42
+ // Signature field
43
+ Signature: "Signature",
44
+ "Add signature text...": "Ajouter un texte de signature...",
42
45
  // Payment terms field
43
46
  "Payment Terms": "Conditions de paiement",
44
47
  "Add payment terms...": "Ajoutez des conditions de paiement...",
@@ -90,5 +93,7 @@ export default {
90
93
  "Cette facture ne sera pas fiscalisée (transaction non nationale)",
91
94
  "Tax Clause": "Clause fiscale",
92
95
  "Add tax clause...": "Ajouter une clause fiscale...",
96
+ Footer: "Pied de page",
97
+ "Add document footer...": "Ajouter un pied de page...",
93
98
  "Reverse charge - tax exempt EU B2B sale": "Autoliquidation - vente B2B UE exonérée de taxe",
94
99
  } as const;
@@ -38,6 +38,9 @@ export default {
38
38
  Note: "Napomena",
39
39
  "Insert variable": "Umetni varijablu",
40
40
  "Add payment instructions, terms, or other notes...": "Dodajte upute za placanje, uvjete ili druge napomene...",
41
+ // Signature field
42
+ Signature: "Potpis",
43
+ "Add signature text...": "Dodaj tekst potpisa...",
41
44
  // Payment terms field
42
45
  "Payment Terms": "Uvjeti placanja",
43
46
  "Add payment terms...": "Dodajte uvjete placanja...",
@@ -88,5 +91,7 @@ export default {
88
91
  "Ovaj račun neće biti fiskaliziran (nedomaća transakcija)",
89
92
  "Tax Clause": "Porezna klauzula",
90
93
  "Add tax clause...": "Dodajte poreznu klauzulu...",
94
+ Footer: "Podnožje",
95
+ "Add document footer...": "Dodajte podnožje dokumenta...",
91
96
  "Reverse charge - tax exempt EU B2B sale": "Prijenos porezne obveze - porezno oslobođena EU B2B prodaja",
92
97
  } as const;
@@ -38,6 +38,9 @@ export default {
38
38
  Note: "Nota",
39
39
  "Insert variable": "Inserisci variabile",
40
40
  "Add payment instructions, terms, or other notes...": "Aggiungi istruzioni di pagamento, termini o altre note...",
41
+ // Signature field
42
+ Signature: "Firma",
43
+ "Add signature text...": "Aggiungi testo della firma...",
41
44
  // Payment terms field
42
45
  "Payment Terms": "Termini di pagamento",
43
46
  "Add payment terms...": "Aggiungi termini di pagamento...",
@@ -91,5 +94,7 @@ export default {
91
94
  "Questa fattura non sarà fiscalizzata (transazione non nazionale)",
92
95
  "Tax Clause": "Clausola fiscale",
93
96
  "Add tax clause...": "Aggiungi clausola fiscale...",
97
+ Footer: "Piè di pagina",
98
+ "Add document footer...": "Aggiungi piè di pagina del documento...",
94
99
  "Reverse charge - tax exempt EU B2B sale": "Inversione contabile - vendita B2B UE esente da imposta",
95
100
  } as const;
@@ -39,6 +39,9 @@ export default {
39
39
  "Insert variable": "Variabele invoegen",
40
40
  "Add payment instructions, terms, or other notes...":
41
41
  "Voeg betalingsinstructies, voorwaarden of andere opmerkingen toe...",
42
+ // Signature field
43
+ Signature: "Handtekening",
44
+ "Add signature text...": "Handtekeningtekst toevoegen...",
42
45
  // Payment terms field
43
46
  "Payment Terms": "Betalingsvoorwaarden",
44
47
  "Add payment terms...": "Voeg betalingsvoorwaarden toe...",
@@ -90,5 +93,7 @@ export default {
90
93
  "Deze factuur wordt niet gefiscaliseerd (niet-binnenlandse transactie)",
91
94
  "Tax Clause": "Belastingclausule",
92
95
  "Add tax clause...": "Belastingclausule toevoegen...",
96
+ Footer: "Voettekst",
97
+ "Add document footer...": "Documentvoettekst toevoegen...",
93
98
  "Reverse charge - tax exempt EU B2B sale": "Verlegging - belastingvrijgestelde EU B2B verkoop",
94
99
  } as const;
@@ -38,6 +38,9 @@ export default {
38
38
  Note: "Notatka",
39
39
  "Insert variable": "Wstaw zmienna",
40
40
  "Add payment instructions, terms, or other notes...": "Dodaj instrukcje platnosci, warunki lub inne uwagi...",
41
+ // Signature field
42
+ Signature: "Podpis",
43
+ "Add signature text...": "Dodaj tekst podpisu...",
41
44
  // Payment terms field
42
45
  "Payment Terms": "Warunki platnosci",
43
46
  "Add payment terms...": "Dodaj warunki platnosci...",
@@ -88,5 +91,7 @@ export default {
88
91
  "Ta faktura nie będzie fiskalizowana (transakcja niekrajowa)",
89
92
  "Tax Clause": "Klauzula podatkowa",
90
93
  "Add tax clause...": "Dodaj klauzulę podatkową...",
94
+ Footer: "Stopka",
95
+ "Add document footer...": "Dodaj stopkę dokumentu...",
91
96
  "Reverse charge - tax exempt EU B2B sale": "Odwrotne obciążenie - zwolniona z podatku sprzedaż EU B2B",
92
97
  } as const;
@@ -38,6 +38,9 @@ export default {
38
38
  Note: "Nota",
39
39
  "Insert variable": "Inserir variavel",
40
40
  "Add payment instructions, terms, or other notes...": "Adicione instrucoes de pagamento, termos ou outras notas...",
41
+ // Signature field
42
+ Signature: "Assinatura",
43
+ "Add signature text...": "Adicionar texto de assinatura...",
41
44
  // Payment terms field
42
45
  "Payment Terms": "Condicoes de pagamento",
43
46
  "Add payment terms...": "Adicione condicoes de pagamento...",
@@ -88,5 +91,7 @@ export default {
88
91
  "Esta fatura não será fiscalizada (transação não nacional)",
89
92
  "Tax Clause": "Cláusula fiscal",
90
93
  "Add tax clause...": "Adicionar cláusula fiscal...",
94
+ Footer: "Rodapé",
95
+ "Add document footer...": "Adicionar rodapé do documento...",
91
96
  "Reverse charge - tax exempt EU B2B sale": "Autoliquidação - venda B2B UE isenta de imposto",
92
97
  } as const;
@@ -37,6 +37,9 @@ export default {
37
37
  Note: "Opomba",
38
38
  "Insert variable": "Vstavi spremenljivko",
39
39
  "Add payment instructions, terms, or other notes...": "Dodajte navodila za plačilo, pogoje ali druge opombe...",
40
+ // Signature field
41
+ Signature: "Podpis",
42
+ "Add signature text...": "Dodaj besedilo podpisa...",
40
43
  // Payment terms field
41
44
  "Payment Terms": "Plačilni pogoji",
42
45
  "Add payment terms...": "Dodajte plačilne pogoje...",
@@ -87,5 +90,7 @@ export default {
87
90
  "Ta račun ne bo fiskaliziran (nedomača transakcija)",
88
91
  "Tax Clause": "Davčna klavzula",
89
92
  "Add tax clause...": "Dodajte davčno klavzulo...",
93
+ Footer: "Noga dokumenta",
94
+ "Add document footer...": "Dodajte nogo dokumenta...",
90
95
  "Reverse charge - tax exempt EU B2B sale": "Obrnjena davčna obveznost - davka oproščena EU B2B prodaja",
91
96
  } as const;
@@ -58,8 +58,8 @@ export function setLastUsedFursCombo(entityId: string, combo: FursCombo): void {
58
58
  const FINA_CN_LAST_USED_KEY = "hr:fina:cn:last-used";
59
59
 
60
60
  export type FinaCombo = {
61
- premise_id: string;
62
- device_id: string;
61
+ business_premise_name: string;
62
+ electronic_device_name: string;
63
63
  };
64
64
 
65
65
  export function getLastUsedFinaCombo(entityId: string): FinaCombo | null {
@@ -18,7 +18,9 @@ import { useFormFooterRegistration } from "@/ui/providers/form-footer-context";
18
18
  import { CUSTOMERS_CACHE_KEY } from "../../customers/customers.hooks";
19
19
  import {
20
20
  DocumentDetailsSection,
21
+ DocumentFooterField,
21
22
  DocumentNoteField,
23
+ DocumentSignatureField,
22
24
  DocumentTaxClauseField,
23
25
  } from "../../documents/create/document-details-section";
24
26
  import { DocumentItemsSection, type PriceModesMap } from "../../documents/create/document-items-section";
@@ -95,6 +97,7 @@ export default function CreateDeliveryNoteForm({
95
97
 
96
98
  // Hide prices state (delivery note specific)
97
99
  const defaultHidePrices = (activeEntity?.settings as any)?.delivery_note_hide_prices ?? false;
100
+ const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
98
101
  const [hidePrices, setHidePrices] = useState<boolean>((initialValues as any)?.hide_prices ?? defaultHidePrices);
99
102
 
100
103
  // Fetch next delivery note number
@@ -134,8 +137,10 @@ export default function CreateDeliveryNoteForm({
134
137
  },
135
138
  ],
136
139
  currency_code: initialValues?.currency_code || activeEntity?.currency_code || "EUR",
140
+ reference: (initialValues as any)?.reference ?? "",
137
141
  note: initialValues?.note ?? "",
138
142
  tax_clause: (initialValues as any)?.tax_clause ?? "",
143
+ footer: (initialValues as any)?.footer ?? defaultFooter,
139
144
  },
140
145
  });
141
146
 
@@ -159,6 +164,14 @@ export default function CreateDeliveryNoteForm({
159
164
  }
160
165
  }, [nextNumberData?.number, form]);
161
166
 
167
+ // Set default footer from entity settings when entity data is available
168
+ useEffect(() => {
169
+ const entityDefaultFooter = (activeEntity?.settings as any)?.document_footer;
170
+ if (entityDefaultFooter && !form.getValues("footer")) {
171
+ form.setValue("footer", entityDefaultFooter);
172
+ }
173
+ }, [activeEntity, form]);
174
+
162
175
  // Auto-add tax field for tax subject entities
163
176
  useEffect(() => {
164
177
  if (activeEntity?.is_tax_subject) {
@@ -169,6 +182,14 @@ export default function CreateDeliveryNoteForm({
169
182
  }
170
183
  }, [activeEntity?.is_tax_subject, form]);
171
184
 
185
+ // Set default signature from entity settings
186
+ useEffect(() => {
187
+ const entityDefaultSignature = (activeEntity?.settings as any)?.default_document_signature;
188
+ if (entityDefaultSignature && !form.getValues("signature")) {
189
+ form.setValue("signature", entityDefaultSignature);
190
+ }
191
+ }, [activeEntity, form]);
192
+
172
193
  const formValues = useWatch({
173
194
  control: form.control,
174
195
  });
@@ -302,7 +323,9 @@ export default function CreateDeliveryNoteForm({
302
323
  customer: formValues.customer,
303
324
  items: transformedItems,
304
325
  currency_code: formValues.currency_code,
326
+ reference: formValues.reference,
305
327
  note: formValues.note,
328
+ signature: formValues.signature,
306
329
  hide_prices: hidePrices,
307
330
  };
308
331
  callback(payload);
@@ -386,6 +409,30 @@ export default function CreateDeliveryNoteForm({
386
409
  transactionType={transactionType}
387
410
  isTransactionTypeFetching={isViesFetching}
388
411
  />
412
+
413
+ <DocumentSignatureField
414
+ control={form.control}
415
+ t={t}
416
+ entity={activeEntity}
417
+ document={{
418
+ number: formValues.number,
419
+ date: formValues.date,
420
+ currency_code: formValues.currency_code,
421
+ customer: formValues.customer as any,
422
+ }}
423
+ />
424
+
425
+ <DocumentFooterField
426
+ control={form.control}
427
+ t={t}
428
+ entity={activeEntity}
429
+ document={{
430
+ number: formValues.number,
431
+ date: formValues.date,
432
+ currency_code: formValues.currency_code,
433
+ customer: formValues.customer as any,
434
+ }}
435
+ />
389
436
  </form>
390
437
  </Form>
391
438
  );
@@ -27,6 +27,9 @@ export default {
27
27
  "Insert variable": "Variable einfügen",
28
28
  "Add payment instructions, terms, or other notes...":
29
29
  "Zahlungsanweisungen, Bedingungen oder andere Notizen hinzufügen...",
30
+ // Signature field
31
+ Signature: "Unterschrift",
32
+ "Add signature text...": "Unterschriftstext hinzufügen...",
30
33
  Quantity: "Menge",
31
34
  Price: "Preis",
32
35
  Unit: "Einheit",
@@ -62,5 +65,7 @@ export default {
62
65
  "Diese Rechnung wird nicht fiskalisiert (nicht-inländische Transaktion)",
63
66
  "Tax Clause": "Steuerklausel",
64
67
  "Add tax clause...": "Steuerklausel hinzufügen...",
68
+ Footer: "Fußzeile",
69
+ "Add document footer...": "Dokumentfußzeile hinzufügen...",
65
70
  "Reverse charge - tax exempt EU B2B sale": "Umkehrung der Steuerschuldnerschaft - steuerbefreiter EU B2B Verkauf",
66
71
  } as const;
@@ -26,6 +26,9 @@ export default {
26
26
  Note: "Nota",
27
27
  "Insert variable": "Insertar variable",
28
28
  "Add payment instructions, terms, or other notes...": "Añada instrucciones de pago, condiciones u otras notas...",
29
+ // Signature field
30
+ Signature: "Firma",
31
+ "Add signature text...": "Añadir texto de firma...",
29
32
  Quantity: "Cantidad",
30
33
  Price: "Precio",
31
34
  Unit: "Unidad",
@@ -61,5 +64,7 @@ export default {
61
64
  "Esta factura no será fiscalizada (transacción no nacional)",
62
65
  "Tax Clause": "Cláusula fiscal",
63
66
  "Add tax clause...": "Agregar cláusula fiscal...",
67
+ Footer: "Pie de página",
68
+ "Add document footer...": "Añadir pie de página del documento...",
64
69
  "Reverse charge - tax exempt EU B2B sale": "Inversión del sujeto pasivo - venta EU B2B exenta de impuestos",
65
70
  } as const;
@@ -27,6 +27,9 @@ export default {
27
27
  "Insert variable": "Insérer une variable",
28
28
  "Add payment instructions, terms, or other notes...":
29
29
  "Ajoutez des instructions de paiement, des conditions ou d'autres notes...",
30
+ // Signature field
31
+ Signature: "Signature",
32
+ "Add signature text...": "Ajouter un texte de signature...",
30
33
  Quantity: "Quantité",
31
34
  Price: "Prix",
32
35
  Unit: "Unité",
@@ -62,5 +65,7 @@ export default {
62
65
  "Cette facture ne sera pas fiscalisée (transaction non nationale)",
63
66
  "Tax Clause": "Clause fiscale",
64
67
  "Add tax clause...": "Ajouter une clause fiscale...",
68
+ Footer: "Pied de page",
69
+ "Add document footer...": "Ajouter un pied de page...",
65
70
  "Reverse charge - tax exempt EU B2B sale": "Autoliquidation - vente B2B UE exonérée de taxe",
66
71
  } as const;
@@ -26,6 +26,9 @@ export default {
26
26
  Note: "Napomena",
27
27
  "Insert variable": "Umetni varijablu",
28
28
  "Add payment instructions, terms, or other notes...": "Dodajte upute za plaćanje, uvjete ili druge napomene...",
29
+ // Signature field
30
+ Signature: "Potpis",
31
+ "Add signature text...": "Dodaj tekst potpisa...",
29
32
  Quantity: "Količina",
30
33
  Price: "Cijena",
31
34
  Unit: "Jedinica",
@@ -61,5 +64,7 @@ export default {
61
64
  "Ovaj račun neće biti fiskaliziran (nedomaća transakcija)",
62
65
  "Tax Clause": "Porezna klauzula",
63
66
  "Add tax clause...": "Dodajte poreznu klauzulu...",
67
+ Footer: "Podnožje",
68
+ "Add document footer...": "Dodajte podnožje dokumenta...",
64
69
  "Reverse charge - tax exempt EU B2B sale": "Prijenos porezne obveze - porezno oslobođena EU B2B prodaja",
65
70
  } as const;
@@ -26,6 +26,9 @@ export default {
26
26
  Note: "Nota",
27
27
  "Insert variable": "Inserisci variabile",
28
28
  "Add payment instructions, terms, or other notes...": "Aggiungi istruzioni di pagamento, condizioni o altre note...",
29
+ // Signature field
30
+ Signature: "Firma",
31
+ "Add signature text...": "Aggiungi testo della firma...",
29
32
  Quantity: "Quantità",
30
33
  Price: "Prezzo",
31
34
  Unit: "Unità",
@@ -61,5 +64,7 @@ export default {
61
64
  "Questa fattura non sarà fiscalizzata (transazione non nazionale)",
62
65
  "Tax Clause": "Clausola fiscale",
63
66
  "Add tax clause...": "Aggiungi clausola fiscale...",
67
+ Footer: "Piè di pagina",
68
+ "Add document footer...": "Aggiungi piè di pagina del documento...",
64
69
  "Reverse charge - tax exempt EU B2B sale": "Inversione contabile - vendita B2B UE esente da imposta",
65
70
  } as const;
@@ -27,6 +27,9 @@ export default {
27
27
  "Insert variable": "Variabele invoegen",
28
28
  "Add payment instructions, terms, or other notes...":
29
29
  "Voeg betalingsinstructies, voorwaarden of andere notities toe...",
30
+ // Signature field
31
+ Signature: "Handtekening",
32
+ "Add signature text...": "Handtekeningtekst toevoegen...",
30
33
  Quantity: "Aantal",
31
34
  Price: "Prijs",
32
35
  Unit: "Eenheid",
@@ -62,5 +65,7 @@ export default {
62
65
  "Deze factuur wordt niet gefiscaliseerd (niet-binnenlandse transactie)",
63
66
  "Tax Clause": "Belastingclausule",
64
67
  "Add tax clause...": "Belastingclausule toevoegen...",
68
+ Footer: "Voettekst",
69
+ "Add document footer...": "Documentvoettekst toevoegen...",
65
70
  "Reverse charge - tax exempt EU B2B sale": "Verlegging - belastingvrijgestelde EU B2B verkoop",
66
71
  } as const;
@@ -26,6 +26,9 @@ export default {
26
26
  Note: "Uwaga",
27
27
  "Insert variable": "Wstaw zmienną",
28
28
  "Add payment instructions, terms, or other notes...": "Dodaj instrukcje płatności, warunki lub inne uwagi...",
29
+ // Signature field
30
+ Signature: "Podpis",
31
+ "Add signature text...": "Dodaj tekst podpisu...",
29
32
  Quantity: "Ilość",
30
33
  Price: "Cena",
31
34
  Unit: "Jednostka",
@@ -61,5 +64,7 @@ export default {
61
64
  "Ta faktura nie będzie fiskalizowana (transakcja niekrajowa)",
62
65
  "Tax Clause": "Klauzula podatkowa",
63
66
  "Add tax clause...": "Dodaj klauzulę podatkową...",
67
+ Footer: "Stopka",
68
+ "Add document footer...": "Dodaj stopkę dokumentu...",
64
69
  "Reverse charge - tax exempt EU B2B sale": "Odwrotne obciążenie - zwolniona z podatku sprzedaż EU B2B",
65
70
  } as const;