@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.
- package/cli/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/advance-invoices/advance-invoices.hooks.ts +2 -2
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +91 -35
- package/src/components/advance-invoices/create/locales/de.ts +5 -0
- package/src/components/advance-invoices/create/locales/es.ts +5 -0
- package/src/components/advance-invoices/create/locales/fr.ts +5 -0
- package/src/components/advance-invoices/create/locales/hr.ts +5 -0
- package/src/components/advance-invoices/create/locales/it.ts +5 -0
- package/src/components/advance-invoices/create/locales/nl.ts +5 -0
- package/src/components/advance-invoices/create/locales/pl.ts +5 -0
- package/src/components/advance-invoices/create/locales/pt.ts +5 -0
- package/src/components/advance-invoices/create/locales/sl.ts +5 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +5 -5
- package/src/components/credit-notes/create/create-credit-note-form.tsx +91 -35
- package/src/components/credit-notes/create/locales/de.ts +5 -0
- package/src/components/credit-notes/create/locales/es.ts +5 -0
- package/src/components/credit-notes/create/locales/fr.ts +5 -0
- package/src/components/credit-notes/create/locales/hr.ts +5 -0
- package/src/components/credit-notes/create/locales/it.ts +5 -0
- package/src/components/credit-notes/create/locales/nl.ts +5 -0
- package/src/components/credit-notes/create/locales/pl.ts +5 -0
- package/src/components/credit-notes/create/locales/pt.ts +5 -0
- package/src/components/credit-notes/create/locales/sl.ts +5 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +2 -2
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +47 -0
- package/src/components/delivery-notes/create/locales/de.ts +5 -0
- package/src/components/delivery-notes/create/locales/es.ts +5 -0
- package/src/components/delivery-notes/create/locales/fr.ts +5 -0
- package/src/components/delivery-notes/create/locales/hr.ts +5 -0
- package/src/components/delivery-notes/create/locales/it.ts +5 -0
- package/src/components/delivery-notes/create/locales/nl.ts +5 -0
- package/src/components/delivery-notes/create/locales/pl.ts +5 -0
- package/src/components/delivery-notes/create/locales/pt.ts +5 -0
- package/src/components/delivery-notes/create/locales/sl.ts +5 -0
- package/src/components/documents/create/document-details-section.tsx +472 -346
- package/src/components/documents/create/prepare-document-submission.ts +3 -1
- package/src/components/documents/create/smart-code-insert-button.tsx +6 -0
- package/src/components/documents/view/document-details-card.tsx +6 -0
- package/src/components/documents/view/locales/de.ts +1 -0
- package/src/components/documents/view/locales/es.ts +1 -0
- package/src/components/documents/view/locales/fr.ts +1 -0
- package/src/components/documents/view/locales/hr.ts +1 -0
- package/src/components/documents/view/locales/it.ts +1 -0
- package/src/components/documents/view/locales/nl.ts +1 -0
- package/src/components/documents/view/locales/pl.ts +1 -0
- package/src/components/documents/view/locales/pt.ts +1 -0
- package/src/components/documents/view/locales/sl.ts +1 -0
- package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +6 -0
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +2 -145
- package/src/components/entities/entity-settings-form/locales/de.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +4 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +4 -0
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +15 -0
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +5 -1
- package/src/components/entities/fina-settings-form/locales/de.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/en.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/es.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/fr.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/hr.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/it.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/nl.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/pl.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/pt.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/sl.ts +3 -0
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +4 -4
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +3 -3
- package/src/components/entities/settings/defaults-settings-form.tsx +38 -1
- package/src/components/entities/settings/tax-rules-settings-form.tsx +1 -2
- package/src/components/estimates/create/create-estimate-form.tsx +43 -2
- package/src/components/estimates/create/locales/de.ts +5 -0
- package/src/components/estimates/create/locales/es.ts +5 -0
- package/src/components/estimates/create/locales/fr.ts +5 -0
- package/src/components/estimates/create/locales/hr.ts +5 -0
- package/src/components/estimates/create/locales/it.ts +5 -0
- package/src/components/estimates/create/locales/nl.ts +5 -0
- package/src/components/estimates/create/locales/pl.ts +5 -0
- package/src/components/estimates/create/locales/pt.ts +5 -0
- package/src/components/estimates/create/locales/sl.ts +5 -0
- package/src/components/invoices/create/create-invoice-form.tsx +130 -40
- package/src/components/invoices/create/locales/de.ts +13 -0
- package/src/components/invoices/create/locales/es.ts +13 -0
- package/src/components/invoices/create/locales/fr.ts +13 -0
- package/src/components/invoices/create/locales/hr.ts +13 -0
- package/src/components/invoices/create/locales/it.ts +13 -0
- package/src/components/invoices/create/locales/nl.ts +13 -0
- package/src/components/invoices/create/locales/pl.ts +13 -0
- package/src/components/invoices/create/locales/pt.ts +13 -0
- package/src/components/invoices/create/locales/sl.ts +13 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +5 -5
- package/src/components/invoices/invoices.hooks.ts +2 -2
- package/src/components/table/table-pagination.tsx +1 -1
- package/src/generated/schemas/advanceinvoice.ts +2 -0
- package/src/generated/schemas/creditnote.ts +1 -0
- package/src/generated/schemas/deliverynote.ts +1 -0
- package/src/generated/schemas/entity.ts +4 -4
- package/src/generated/schemas/entityapikey.ts +19 -0
- package/src/generated/schemas/estimate.ts +2 -0
- package/src/generated/schemas/index.ts +1 -0
- package/src/generated/schemas/invoice.ts +2 -0
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +1 -1
- package/src/generated/schemas/rendercreditnotepreview_body.ts +1 -1
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +1 -1
- package/src/generated/schemas/renderestimatepreview_body.ts +1 -1
- package/src/generated/schemas/renderinvoicepreview_body.ts +1 -1
- package/src/generated/schemas/startpdfexport_body.ts +14 -2
- package/src/generated/schemas/webhook.ts +4 -0
- package/src/lib/template-variables.tsx +167 -0
- package/src/providers/entities-context.tsx +2 -2
|
@@ -22,8 +22,10 @@ import { useFormFooterRegistration } from "@/ui/providers/form-footer-context";
|
|
|
22
22
|
import { CUSTOMERS_CACHE_KEY } from "../../customers/customers.hooks";
|
|
23
23
|
import {
|
|
24
24
|
DocumentDetailsSection,
|
|
25
|
+
DocumentFooterField,
|
|
25
26
|
DocumentNoteField,
|
|
26
27
|
DocumentPaymentTermsField,
|
|
28
|
+
DocumentSignatureField,
|
|
27
29
|
DocumentTaxClauseField,
|
|
28
30
|
} from "../../documents/create/document-details-section";
|
|
29
31
|
import { DocumentItemsSection, type PriceModesMap } from "../../documents/create/document-items-section";
|
|
@@ -61,6 +63,8 @@ function calculateDueDate(dateIso: string, days: number): string {
|
|
|
61
63
|
return date.toISOString();
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
const DUE_DAYS_PRESETS = [0, 7, 14, 30, 60, 90] as const;
|
|
67
|
+
|
|
64
68
|
const translations = {
|
|
65
69
|
sl,
|
|
66
70
|
de,
|
|
@@ -132,6 +136,7 @@ export default function CreateInvoiceForm({
|
|
|
132
136
|
// Get default invoice note and payment terms from entity settings
|
|
133
137
|
const defaultInvoiceNote = (activeEntity?.settings as any)?.default_invoice_note || "";
|
|
134
138
|
const defaultPaymentTerms = (activeEntity?.settings as any)?.default_invoice_payment_terms || "";
|
|
139
|
+
const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
|
|
135
140
|
const defaultInvoiceDueDays = (activeEntity?.settings as any)?.default_invoice_due_days ?? 30;
|
|
136
141
|
|
|
137
142
|
// ============================================================================
|
|
@@ -169,8 +174,8 @@ export default function CreateInvoiceForm({
|
|
|
169
174
|
const hasFinaPremises = activeFinaPremises.length > 0;
|
|
170
175
|
|
|
171
176
|
// FINA premise/device selection state (no skip - all FINA invoices must be fiscalized)
|
|
172
|
-
const [
|
|
173
|
-
const [
|
|
177
|
+
const [selectedFinaBusinessPremiseName, setSelectedFinaBusinessPremiseName] = useState<string | undefined>();
|
|
178
|
+
const [selectedFinaElectronicDeviceName, setSelectedFinaElectronicDeviceName] = useState<string | undefined>();
|
|
174
179
|
|
|
175
180
|
// UI-only state (not part of API schema)
|
|
176
181
|
const [markAsPaid, setMarkAsPaid] = useState(false);
|
|
@@ -180,6 +185,12 @@ export default function CreateInvoiceForm({
|
|
|
180
185
|
// Service date type state (single date or range)
|
|
181
186
|
const [serviceDateType, setServiceDateType] = useState<"single" | "range">("single");
|
|
182
187
|
|
|
188
|
+
// Due days type state for invoice due date selector
|
|
189
|
+
const [dueDaysType, setDueDaysType] = useState<number | "custom">(() => {
|
|
190
|
+
if (mode === "edit" || initialValues?.date_due) return "custom";
|
|
191
|
+
return (DUE_DAYS_PRESETS as readonly number[]).includes(defaultInvoiceDueDays) ? defaultInvoiceDueDays : "custom";
|
|
192
|
+
});
|
|
193
|
+
|
|
183
194
|
// Price modes per item (gross vs net) - collected from component state at submit
|
|
184
195
|
// Initialize from initialValues for duplicated documents
|
|
185
196
|
const initialPriceModes = useMemo(() => {
|
|
@@ -269,22 +280,24 @@ export default function CreateInvoiceForm({
|
|
|
269
280
|
|
|
270
281
|
// Get active FINA devices for selected premise
|
|
271
282
|
const activeFinaDevices = useMemo(() => {
|
|
272
|
-
if (!
|
|
273
|
-
const premise = activeFinaPremises.find((p: any) => p.
|
|
283
|
+
if (!selectedFinaBusinessPremiseName) return [];
|
|
284
|
+
const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
|
|
274
285
|
return premise?.Devices?.filter((d: any) => d.is_active) || [];
|
|
275
|
-
}, [activeFinaPremises,
|
|
286
|
+
}, [activeFinaPremises, selectedFinaBusinessPremiseName]);
|
|
276
287
|
|
|
277
288
|
// Initialize FINA selection from localStorage or first active combo
|
|
278
289
|
useEffect(() => {
|
|
279
|
-
if (!isFinaEnabled || !hasFinaPremises ||
|
|
290
|
+
if (!isFinaEnabled || !hasFinaPremises || selectedFinaBusinessPremiseName) return;
|
|
280
291
|
|
|
281
292
|
const lastUsed = getLastUsedFinaCombo(entityId);
|
|
282
293
|
if (lastUsed) {
|
|
283
|
-
const premise = activeFinaPremises.find((p: any) => p.
|
|
284
|
-
const device = premise?.Devices?.find(
|
|
294
|
+
const premise = activeFinaPremises.find((p: any) => p.business_premise_name === lastUsed.business_premise_name);
|
|
295
|
+
const device = premise?.Devices?.find(
|
|
296
|
+
(d: any) => d.electronic_device_name === lastUsed.electronic_device_name && d.is_active,
|
|
297
|
+
);
|
|
285
298
|
if (premise && device) {
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
setSelectedFinaBusinessPremiseName(lastUsed.business_premise_name);
|
|
300
|
+
setSelectedFinaElectronicDeviceName(lastUsed.electronic_device_name);
|
|
288
301
|
return;
|
|
289
302
|
}
|
|
290
303
|
}
|
|
@@ -292,25 +305,25 @@ export default function CreateInvoiceForm({
|
|
|
292
305
|
const firstPremise = activeFinaPremises[0];
|
|
293
306
|
const firstDevice = firstPremise?.Devices?.find((d: any) => d.is_active);
|
|
294
307
|
if (firstPremise && firstDevice) {
|
|
295
|
-
|
|
296
|
-
|
|
308
|
+
setSelectedFinaBusinessPremiseName(firstPremise.business_premise_name);
|
|
309
|
+
setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
|
|
297
310
|
}
|
|
298
|
-
}, [isFinaEnabled, hasFinaPremises, activeFinaPremises, entityId,
|
|
311
|
+
}, [isFinaEnabled, hasFinaPremises, activeFinaPremises, entityId, selectedFinaBusinessPremiseName]);
|
|
299
312
|
|
|
300
313
|
// When FINA premise changes, select first active device
|
|
301
314
|
useEffect(() => {
|
|
302
|
-
if (!
|
|
303
|
-
const premise = activeFinaPremises.find((p: any) => p.
|
|
315
|
+
if (!selectedFinaBusinessPremiseName) return;
|
|
316
|
+
const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
|
|
304
317
|
const firstDevice = premise?.Devices?.find((d: any) => d.is_active);
|
|
305
|
-
if (firstDevice &&
|
|
318
|
+
if (firstDevice && selectedFinaElectronicDeviceName !== firstDevice.electronic_device_name) {
|
|
306
319
|
const currentDeviceInPremise = premise?.Devices?.find(
|
|
307
|
-
(d: any) => d.
|
|
320
|
+
(d: any) => d.electronic_device_name === selectedFinaElectronicDeviceName && d.is_active,
|
|
308
321
|
);
|
|
309
322
|
if (!currentDeviceInPremise) {
|
|
310
|
-
|
|
323
|
+
setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
|
|
311
324
|
}
|
|
312
325
|
}
|
|
313
|
-
}, [
|
|
326
|
+
}, [selectedFinaBusinessPremiseName, activeFinaPremises, selectedFinaElectronicDeviceName]);
|
|
314
327
|
|
|
315
328
|
const form = useForm<CreateInvoiceFormValues>({
|
|
316
329
|
// Cast resolver to accept extended form type (includes UI-only fields)
|
|
@@ -345,9 +358,11 @@ export default function CreateInvoiceForm({
|
|
|
345
358
|
},
|
|
346
359
|
],
|
|
347
360
|
currency_code: initialValues?.currency_code || activeEntity?.currency_code || "EUR",
|
|
361
|
+
reference: (initialValues as any)?.reference ?? "",
|
|
348
362
|
note: initialValues?.note ?? defaultInvoiceNote,
|
|
349
363
|
tax_clause: (initialValues as any)?.tax_clause ?? "",
|
|
350
364
|
payment_terms: initialValues?.payment_terms ?? defaultPaymentTerms,
|
|
365
|
+
footer: (initialValues as any)?.footer ?? defaultFooter,
|
|
351
366
|
date_due:
|
|
352
367
|
initialValues?.date_due ||
|
|
353
368
|
calculateDueDate(initialValues?.date || new Date().toISOString(), defaultInvoiceDueDays),
|
|
@@ -373,6 +388,20 @@ export default function CreateInvoiceForm({
|
|
|
373
388
|
}
|
|
374
389
|
}, [serviceDateType, form]);
|
|
375
390
|
|
|
391
|
+
// Handle due days type change - recalculate due date for presets
|
|
392
|
+
const handleDueDaysTypeChange = useCallback(
|
|
393
|
+
(type: number | "custom") => {
|
|
394
|
+
setDueDaysType(type);
|
|
395
|
+
if (type !== "custom") {
|
|
396
|
+
const currentDate = form.getValues("date");
|
|
397
|
+
if (currentDate) {
|
|
398
|
+
form.setValue("date_due", calculateDueDate(currentDate, type));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
[form],
|
|
403
|
+
);
|
|
404
|
+
|
|
376
405
|
// Check if FURS selection is ready (needed to prevent number flashing)
|
|
377
406
|
// Selection is ready when: FURS not enabled, OR no premises, OR we have a valid selection
|
|
378
407
|
const isFursSelectionReady = !isFursEnabled || !hasFursPremises || (!!selectedPremiseName && !!selectedDeviceName);
|
|
@@ -383,8 +412,9 @@ export default function CreateInvoiceForm({
|
|
|
383
412
|
|
|
384
413
|
// FINA selection ready and active checks
|
|
385
414
|
const isFinaSelectionReady =
|
|
386
|
-
!isFinaEnabled || !hasFinaPremises || (!!
|
|
387
|
-
const isFinaActive =
|
|
415
|
+
!isFinaEnabled || !hasFinaPremises || (!!selectedFinaBusinessPremiseName && !!selectedFinaElectronicDeviceName);
|
|
416
|
+
const isFinaActive =
|
|
417
|
+
isFinaEnabled && hasFinaPremises && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName;
|
|
388
418
|
|
|
389
419
|
// ============================================================================
|
|
390
420
|
// Next Invoice Number Preview
|
|
@@ -552,7 +582,10 @@ export default function CreateInvoiceForm({
|
|
|
552
582
|
});
|
|
553
583
|
|
|
554
584
|
// FINA non-domestic guard: hide FINA selectors for non-domestic transactions
|
|
555
|
-
|
|
585
|
+
// When unified_numbering is enabled (default: true), show FINA selectors for all transactions
|
|
586
|
+
const finaUnifiedNumbering = finaSettings?.unified_numbering !== false;
|
|
587
|
+
const isFinaNonDomestic =
|
|
588
|
+
isFinaEnabled && !finaUnifiedNumbering && viesCustomerCountryCode != null && viesCustomerCountryCode !== "HR";
|
|
556
589
|
|
|
557
590
|
// Auto-populate tax_clause from entity settings when transaction type changes
|
|
558
591
|
const effectiveTransactionType = transactionType ?? "domestic";
|
|
@@ -590,10 +623,10 @@ export default function CreateInvoiceForm({
|
|
|
590
623
|
});
|
|
591
624
|
}
|
|
592
625
|
// Save FINA combo to localStorage on successful creation
|
|
593
|
-
if (isFinaActive &&
|
|
626
|
+
if (isFinaActive && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName) {
|
|
594
627
|
setLastUsedFinaCombo(entityId, {
|
|
595
|
-
|
|
596
|
-
|
|
628
|
+
business_premise_name: selectedFinaBusinessPremiseName,
|
|
629
|
+
electronic_device_name: selectedFinaElectronicDeviceName,
|
|
597
630
|
});
|
|
598
631
|
}
|
|
599
632
|
// Invalidate customers cache when a customer was created/linked
|
|
@@ -656,8 +689,17 @@ export default function CreateInvoiceForm({
|
|
|
656
689
|
|
|
657
690
|
// Build FINA options (skip for drafts, edit mode, and non-domestic transactions)
|
|
658
691
|
const finaOptions =
|
|
659
|
-
!isDraft &&
|
|
660
|
-
|
|
692
|
+
!isDraft &&
|
|
693
|
+
!isEditMode &&
|
|
694
|
+
isFinaEnabled &&
|
|
695
|
+
!isFinaNonDomestic &&
|
|
696
|
+
selectedFinaBusinessPremiseName &&
|
|
697
|
+
selectedFinaElectronicDeviceName
|
|
698
|
+
? {
|
|
699
|
+
business_premise_name: selectedFinaBusinessPremiseName,
|
|
700
|
+
electronic_device_name: selectedFinaElectronicDeviceName,
|
|
701
|
+
payment_type: paymentTypes[0],
|
|
702
|
+
}
|
|
661
703
|
: undefined;
|
|
662
704
|
|
|
663
705
|
// Build e-SLOG options (skip for drafts and edit mode)
|
|
@@ -710,8 +752,8 @@ export default function CreateInvoiceForm({
|
|
|
710
752
|
paymentTypes,
|
|
711
753
|
selectedDeviceName,
|
|
712
754
|
selectedPremiseName,
|
|
713
|
-
|
|
714
|
-
|
|
755
|
+
selectedFinaBusinessPremiseName,
|
|
756
|
+
selectedFinaElectronicDeviceName,
|
|
715
757
|
showCustomerForm,
|
|
716
758
|
skipFiscalization,
|
|
717
759
|
],
|
|
@@ -776,14 +818,23 @@ export default function CreateInvoiceForm({
|
|
|
776
818
|
if (entityDefaultPaymentTerms && !form.getValues("payment_terms")) {
|
|
777
819
|
form.setValue("payment_terms", entityDefaultPaymentTerms);
|
|
778
820
|
}
|
|
821
|
+
const entityDefaultFooter = (activeEntity.settings as any)?.document_footer;
|
|
822
|
+
if (entityDefaultFooter && !form.getValues("footer")) {
|
|
823
|
+
form.setValue("footer", entityDefaultFooter);
|
|
824
|
+
}
|
|
825
|
+
const entityDefaultSignature = (activeEntity.settings as any)?.default_document_signature;
|
|
826
|
+
if (entityDefaultSignature && !form.getValues("signature")) {
|
|
827
|
+
form.setValue("signature", entityDefaultSignature);
|
|
828
|
+
}
|
|
779
829
|
|
|
780
|
-
// Auto-populate due date from entity settings when entity loads async
|
|
830
|
+
// Auto-populate due date and due days type from entity settings when entity loads async
|
|
781
831
|
if (!isEditMode && !initialValues?.date_due) {
|
|
782
832
|
const dueDays = (activeEntity.settings as any)?.default_invoice_due_days ?? 30;
|
|
783
833
|
const currentDate = form.getValues("date");
|
|
784
834
|
if (currentDate) {
|
|
785
835
|
form.setValue("date_due", calculateDueDate(currentDate, dueDays));
|
|
786
836
|
}
|
|
837
|
+
setDueDaysType((DUE_DAYS_PRESETS as readonly number[]).includes(dueDays) ? dueDays : "custom");
|
|
787
838
|
}
|
|
788
839
|
|
|
789
840
|
// Auto-add tax field for tax subject entities
|
|
@@ -797,15 +848,16 @@ export default function CreateInvoiceForm({
|
|
|
797
848
|
initialSetupDoneRef.current = true;
|
|
798
849
|
}, [activeEntity, form, isEditMode, initialValues?.date_due]);
|
|
799
850
|
|
|
800
|
-
// Recalculate due date when document date changes (skip in edit mode)
|
|
851
|
+
// Recalculate due date when document date changes (skip in edit mode and custom due days)
|
|
801
852
|
const prevDateRef = useRef(form.getValues("date"));
|
|
802
853
|
useEffect(() => {
|
|
803
854
|
if (isEditMode) return;
|
|
804
855
|
if (!watchedDate || watchedDate === prevDateRef.current) return;
|
|
805
856
|
prevDateRef.current = watchedDate;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
857
|
+
if (dueDaysType !== "custom") {
|
|
858
|
+
form.setValue("date_due", calculateDueDate(watchedDate, dueDaysType));
|
|
859
|
+
}
|
|
860
|
+
}, [watchedDate, isEditMode, form, dueDaysType]);
|
|
809
861
|
|
|
810
862
|
// Use form.watch subscription for onChange callback (avoids re-render loops)
|
|
811
863
|
const prevPayloadRef = useRef<string>("");
|
|
@@ -827,8 +879,10 @@ export default function CreateInvoiceForm({
|
|
|
827
879
|
customer: formValues.customer,
|
|
828
880
|
items: transformedItems,
|
|
829
881
|
currency_code: formValues.currency_code,
|
|
882
|
+
reference: formValues.reference,
|
|
830
883
|
note: formValues.note,
|
|
831
884
|
payment_terms: formValues.payment_terms,
|
|
885
|
+
signature: formValues.signature,
|
|
832
886
|
};
|
|
833
887
|
};
|
|
834
888
|
|
|
@@ -965,12 +1019,18 @@ export default function CreateInvoiceForm({
|
|
|
965
1019
|
finaInline={
|
|
966
1020
|
!isEditMode && isFinaEnabled && hasFinaPremises && !isFinaNonDomestic
|
|
967
1021
|
? {
|
|
968
|
-
premises: activeFinaPremises.map((p: any) => ({
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1022
|
+
premises: activeFinaPremises.map((p: any) => ({
|
|
1023
|
+
id: p.id,
|
|
1024
|
+
business_premise_name: p.business_premise_name,
|
|
1025
|
+
})),
|
|
1026
|
+
devices: activeFinaDevices.map((d: any) => ({
|
|
1027
|
+
id: d.id,
|
|
1028
|
+
electronic_device_name: d.electronic_device_name,
|
|
1029
|
+
})),
|
|
1030
|
+
selectedPremise: selectedFinaBusinessPremiseName,
|
|
1031
|
+
selectedDevice: selectedFinaElectronicDeviceName,
|
|
1032
|
+
onPremiseChange: setSelectedFinaBusinessPremiseName,
|
|
1033
|
+
onDeviceChange: setSelectedFinaElectronicDeviceName,
|
|
974
1034
|
}
|
|
975
1035
|
: undefined
|
|
976
1036
|
}
|
|
@@ -978,6 +1038,10 @@ export default function CreateInvoiceForm({
|
|
|
978
1038
|
dateType: serviceDateType,
|
|
979
1039
|
onDateTypeChange: setServiceDateType,
|
|
980
1040
|
}}
|
|
1041
|
+
dueDays={{
|
|
1042
|
+
dueDaysType,
|
|
1043
|
+
onDueDaysTypeChange: handleDueDaysTypeChange,
|
|
1044
|
+
}}
|
|
981
1045
|
>
|
|
982
1046
|
{/* Invoice-specific: Mark as paid section (UI-only state, not in form schema) */}
|
|
983
1047
|
{/* Hide in edit mode - payments are managed separately */}
|
|
@@ -1054,6 +1118,32 @@ export default function CreateInvoiceForm({
|
|
|
1054
1118
|
}}
|
|
1055
1119
|
/>
|
|
1056
1120
|
|
|
1121
|
+
<DocumentSignatureField
|
|
1122
|
+
control={form.control}
|
|
1123
|
+
t={t}
|
|
1124
|
+
entity={activeEntity}
|
|
1125
|
+
document={{
|
|
1126
|
+
number: watchedNumber,
|
|
1127
|
+
date: watchedDate,
|
|
1128
|
+
date_due: watchedDateDue,
|
|
1129
|
+
currency_code: watchedCurrencyCode,
|
|
1130
|
+
customer: watchedCustomer as any,
|
|
1131
|
+
}}
|
|
1132
|
+
/>
|
|
1133
|
+
|
|
1134
|
+
<DocumentFooterField
|
|
1135
|
+
control={form.control}
|
|
1136
|
+
t={t}
|
|
1137
|
+
entity={activeEntity}
|
|
1138
|
+
document={{
|
|
1139
|
+
number: watchedNumber,
|
|
1140
|
+
date: watchedDate,
|
|
1141
|
+
date_due: watchedDateDue,
|
|
1142
|
+
currency_code: watchedCurrencyCode,
|
|
1143
|
+
customer: watchedCustomer as any,
|
|
1144
|
+
}}
|
|
1145
|
+
/>
|
|
1146
|
+
|
|
1057
1147
|
{sourceDocuments && sourceDocuments.length > 0 && (
|
|
1058
1148
|
<LinkedDocumentsInfo documents={sourceDocuments} locale={locale || "en"} t={t} />
|
|
1059
1149
|
)}
|
|
@@ -40,6 +40,9 @@ export default {
|
|
|
40
40
|
"Insert variable": "Variable einfügen",
|
|
41
41
|
"Add payment instructions, terms, or other notes...":
|
|
42
42
|
"Zahlungsanweisungen, Bedingungen oder andere Notizen hinzufügen...",
|
|
43
|
+
// Signature field
|
|
44
|
+
Signature: "Unterschrift",
|
|
45
|
+
"Add signature text...": "Unterschriftstext hinzufügen...",
|
|
43
46
|
// Payment terms field
|
|
44
47
|
"Payment Terms": "Zahlungsbedingungen",
|
|
45
48
|
"Add payment terms...": "Zahlungsbedingungen hinzufügen...",
|
|
@@ -120,6 +123,14 @@ export default {
|
|
|
120
123
|
"Advance invoice": "Vorausrechnung",
|
|
121
124
|
"FINA fiscalized invoices always use the current date":
|
|
122
125
|
"FINA-fiskalisierte Rechnungen verwenden immer das aktuelle Datum",
|
|
126
|
+
// Due days selector
|
|
127
|
+
"On receipt": "Bei Erhalt",
|
|
128
|
+
"7 days": "7 Tage",
|
|
129
|
+
"14 days": "14 Tage",
|
|
130
|
+
"30 days": "30 Tage",
|
|
131
|
+
"60 days": "60 Tage",
|
|
132
|
+
"90 days": "90 Tage",
|
|
133
|
+
Custom: "Benutzerdefiniert",
|
|
123
134
|
// Service date
|
|
124
135
|
"Service Date": "Leistungsdatum",
|
|
125
136
|
"Single Date": "Datum",
|
|
@@ -141,4 +152,6 @@ export default {
|
|
|
141
152
|
"Diese Rechnung wird nicht fiskalisiert (nicht-inländische Transaktion)",
|
|
142
153
|
"Tax Clause": "Steuerklausel",
|
|
143
154
|
"Add tax clause...": "Steuerklausel hinzufügen...",
|
|
155
|
+
Footer: "Fußzeile",
|
|
156
|
+
"Add document footer...": "Dokumentfußzeile hinzufügen...",
|
|
144
157
|
} 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...": "Añada instrucciones de pago, condiciones u otras notas...",
|
|
41
|
+
// Signature field
|
|
42
|
+
Signature: "Firma",
|
|
43
|
+
"Add signature text...": "Añadir texto de firma...",
|
|
41
44
|
"Payment Terms": "Condiciones de pago",
|
|
42
45
|
"Add payment terms...": "Añada condiciones de pago...",
|
|
43
46
|
Entity: "Empresa",
|
|
@@ -106,6 +109,14 @@ export default {
|
|
|
106
109
|
"Advance invoice": "Factura anticipada",
|
|
107
110
|
"FINA fiscalized invoices always use the current date":
|
|
108
111
|
"Las facturas fiscalizadas con FINA siempre usan la fecha actual",
|
|
112
|
+
// Due days selector
|
|
113
|
+
"On receipt": "Al recibir",
|
|
114
|
+
"7 days": "7 días",
|
|
115
|
+
"14 days": "14 días",
|
|
116
|
+
"30 days": "30 días",
|
|
117
|
+
"60 days": "60 días",
|
|
118
|
+
"90 days": "90 días",
|
|
119
|
+
Custom: "Personalizado",
|
|
109
120
|
"Service Date": "Fecha de servicio",
|
|
110
121
|
"Single Date": "Fecha única",
|
|
111
122
|
"Date Range": "Rango de fechas",
|
|
@@ -126,4 +137,6 @@ export default {
|
|
|
126
137
|
"Esta factura no será fiscalizada (transacción no nacional)",
|
|
127
138
|
"Tax Clause": "Cláusula fiscal",
|
|
128
139
|
"Add tax clause...": "Agregar cláusula fiscal...",
|
|
140
|
+
Footer: "Pie de página",
|
|
141
|
+
"Add document footer...": "Añadir pie de página del documento...",
|
|
129
142
|
} as const;
|
|
@@ -40,6 +40,9 @@ export default {
|
|
|
40
40
|
"Insert variable": "Insérer une variable",
|
|
41
41
|
"Add payment instructions, terms, or other notes...":
|
|
42
42
|
"Ajoutez des instructions de paiement, des conditions ou d'autres notes...",
|
|
43
|
+
// Signature field
|
|
44
|
+
Signature: "Signature",
|
|
45
|
+
"Add signature text...": "Ajouter un texte de signature...",
|
|
43
46
|
"Payment Terms": "Conditions de paiement",
|
|
44
47
|
"Add payment terms...": "Ajoutez des conditions de paiement...",
|
|
45
48
|
Entity: "Entreprise",
|
|
@@ -108,6 +111,14 @@ export default {
|
|
|
108
111
|
"Advance invoice": "Facture d'acompte",
|
|
109
112
|
"FINA fiscalized invoices always use the current date":
|
|
110
113
|
"Les factures fiscalisées FINA utilisent toujours la date actuelle",
|
|
114
|
+
// Due days selector
|
|
115
|
+
"On receipt": "À réception",
|
|
116
|
+
"7 days": "7 jours",
|
|
117
|
+
"14 days": "14 jours",
|
|
118
|
+
"30 days": "30 jours",
|
|
119
|
+
"60 days": "60 jours",
|
|
120
|
+
"90 days": "90 jours",
|
|
121
|
+
Custom: "Personnalisé",
|
|
111
122
|
"Service Date": "Date de service",
|
|
112
123
|
"Single Date": "Date unique",
|
|
113
124
|
"Date Range": "Plage de dates",
|
|
@@ -128,4 +139,6 @@ export default {
|
|
|
128
139
|
"Cette facture ne sera pas fiscalisée (transaction non nationale)",
|
|
129
140
|
"Tax Clause": "Clause fiscale",
|
|
130
141
|
"Add tax clause...": "Ajouter une clause fiscale...",
|
|
142
|
+
Footer: "Pied de page",
|
|
143
|
+
"Add document footer...": "Ajouter un pied de page...",
|
|
131
144
|
} 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 plaćanje, uvjete ili druge napomene...",
|
|
41
|
+
// Signature field
|
|
42
|
+
Signature: "Potpis",
|
|
43
|
+
"Add signature text...": "Dodaj tekst potpisa...",
|
|
41
44
|
"Payment Terms": "Uvjeti plaćanja",
|
|
42
45
|
"Add payment terms...": "Dodajte uvjete plaćanja...",
|
|
43
46
|
Entity: "Tvrtka",
|
|
@@ -105,6 +108,14 @@ export default {
|
|
|
105
108
|
"Credit note": "Odobrenje",
|
|
106
109
|
"Advance invoice": "Avansni račun",
|
|
107
110
|
"FINA fiscalized invoices always use the current date": "FINA fiskalizirani računi uvijek koriste trenutni datum",
|
|
111
|
+
// Due days selector
|
|
112
|
+
"On receipt": "Po primitku",
|
|
113
|
+
"7 days": "7 dana",
|
|
114
|
+
"14 days": "14 dana",
|
|
115
|
+
"30 days": "30 dana",
|
|
116
|
+
"60 days": "60 dana",
|
|
117
|
+
"90 days": "90 dana",
|
|
118
|
+
Custom: "Prilagođeno",
|
|
108
119
|
"Service Date": "Datum usluge",
|
|
109
120
|
"Single Date": "Datum",
|
|
110
121
|
"Date Range": "Raspon datuma",
|
|
@@ -125,4 +136,6 @@ export default {
|
|
|
125
136
|
"Ovaj račun neće biti fiskaliziran (nedomaća transakcija)",
|
|
126
137
|
"Tax Clause": "Porezna klauzula",
|
|
127
138
|
"Add tax clause...": "Dodajte poreznu klauzulu...",
|
|
139
|
+
Footer: "Podnožje",
|
|
140
|
+
"Add document footer...": "Dodajte podnožje dokumenta...",
|
|
128
141
|
} as const;
|
|
@@ -39,6 +39,9 @@ export default {
|
|
|
39
39
|
Note: "Nota",
|
|
40
40
|
"Insert variable": "Inserisci variabile",
|
|
41
41
|
"Add payment instructions, terms, or other notes...": "Aggiungi istruzioni di pagamento, condizioni o altre note...",
|
|
42
|
+
// Signature field
|
|
43
|
+
Signature: "Firma",
|
|
44
|
+
"Add signature text...": "Aggiungi testo della firma...",
|
|
42
45
|
"Payment Terms": "Condizioni di pagamento",
|
|
43
46
|
"Add payment terms...": "Aggiungi condizioni di pagamento...",
|
|
44
47
|
Entity: "Azienda",
|
|
@@ -108,6 +111,14 @@ export default {
|
|
|
108
111
|
"Advance invoice": "Fattura di acconto",
|
|
109
112
|
"FINA fiscalized invoices always use the current date":
|
|
110
113
|
"Le fatture fiscalizzate FINA utilizzano sempre la data corrente",
|
|
114
|
+
// Due days selector
|
|
115
|
+
"On receipt": "Alla ricezione",
|
|
116
|
+
"7 days": "7 giorni",
|
|
117
|
+
"14 days": "14 giorni",
|
|
118
|
+
"30 days": "30 giorni",
|
|
119
|
+
"60 days": "60 giorni",
|
|
120
|
+
"90 days": "90 giorni",
|
|
121
|
+
Custom: "Personalizzato",
|
|
111
122
|
"Service Date": "Data del servizio",
|
|
112
123
|
"Single Date": "Data singola",
|
|
113
124
|
"Date Range": "Intervallo di date",
|
|
@@ -128,4 +139,6 @@ export default {
|
|
|
128
139
|
"Questa fattura non sarà fiscalizzata (transazione non nazionale)",
|
|
129
140
|
"Tax Clause": "Clausola fiscale",
|
|
130
141
|
"Add tax clause...": "Aggiungi clausola fiscale...",
|
|
142
|
+
Footer: "Piè di pagina",
|
|
143
|
+
"Add document footer...": "Aggiungi piè di pagina del documento...",
|
|
131
144
|
} 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 notities toe...",
|
|
42
|
+
// Signature field
|
|
43
|
+
Signature: "Handtekening",
|
|
44
|
+
"Add signature text...": "Handtekeningtekst toevoegen...",
|
|
42
45
|
"Payment Terms": "Betalingsvoorwaarden",
|
|
43
46
|
"Add payment terms...": "Voeg betalingsvoorwaarden toe...",
|
|
44
47
|
Entity: "Bedrijf",
|
|
@@ -107,6 +110,14 @@ export default {
|
|
|
107
110
|
"Advance invoice": "Voorschotfactuur",
|
|
108
111
|
"FINA fiscalized invoices always use the current date":
|
|
109
112
|
"FINA-gefiscaliseerde facturen gebruiken altijd de huidige datum",
|
|
113
|
+
// Due days selector
|
|
114
|
+
"On receipt": "Bij ontvangst",
|
|
115
|
+
"7 days": "7 dagen",
|
|
116
|
+
"14 days": "14 dagen",
|
|
117
|
+
"30 days": "30 dagen",
|
|
118
|
+
"60 days": "60 dagen",
|
|
119
|
+
"90 days": "90 dagen",
|
|
120
|
+
Custom: "Aangepast",
|
|
110
121
|
"Service Date": "Servicedatum",
|
|
111
122
|
"Single Date": "Enkele datum",
|
|
112
123
|
"Date Range": "Datumbereik",
|
|
@@ -127,4 +138,6 @@ export default {
|
|
|
127
138
|
"Deze factuur wordt niet gefiscaliseerd (niet-binnenlandse transactie)",
|
|
128
139
|
"Tax Clause": "Belastingclausule",
|
|
129
140
|
"Add tax clause...": "Belastingclausule toevoegen...",
|
|
141
|
+
Footer: "Voettekst",
|
|
142
|
+
"Add document footer...": "Documentvoettekst toevoegen...",
|
|
130
143
|
} as const;
|
|
@@ -39,6 +39,9 @@ export default {
|
|
|
39
39
|
Note: "Uwaga",
|
|
40
40
|
"Insert variable": "Wstaw zmienną",
|
|
41
41
|
"Add payment instructions, terms, or other notes...": "Dodaj instrukcje płatności, warunki lub inne uwagi...",
|
|
42
|
+
// Signature field
|
|
43
|
+
Signature: "Podpis",
|
|
44
|
+
"Add signature text...": "Dodaj tekst podpisu...",
|
|
42
45
|
"Payment Terms": "Warunki płatności",
|
|
43
46
|
"Add payment terms...": "Dodaj warunki płatności...",
|
|
44
47
|
Entity: "Firma",
|
|
@@ -106,6 +109,14 @@ export default {
|
|
|
106
109
|
"Credit note": "Nota kredytowa",
|
|
107
110
|
"Advance invoice": "Faktura zaliczkowa",
|
|
108
111
|
"FINA fiscalized invoices always use the current date": "Faktury fiskalizowane FINA zawsze używają bieżącej daty",
|
|
112
|
+
// Due days selector
|
|
113
|
+
"On receipt": "Przy odbiorze",
|
|
114
|
+
"7 days": "7 dni",
|
|
115
|
+
"14 days": "14 dni",
|
|
116
|
+
"30 days": "30 dni",
|
|
117
|
+
"60 days": "60 dni",
|
|
118
|
+
"90 days": "90 dni",
|
|
119
|
+
Custom: "Niestandardowe",
|
|
109
120
|
"Service Date": "Data usługi",
|
|
110
121
|
"Single Date": "Pojedyncza data",
|
|
111
122
|
"Date Range": "Zakres dat",
|
|
@@ -126,4 +137,6 @@ export default {
|
|
|
126
137
|
"Ta faktura nie będzie fiskalizowana (transakcja niekrajowa)",
|
|
127
138
|
"Tax Clause": "Klauzula podatkowa",
|
|
128
139
|
"Add tax clause...": "Dodaj klauzulę podatkową...",
|
|
140
|
+
Footer: "Stopka",
|
|
141
|
+
"Add document footer...": "Dodaj stopkę dokumentu...",
|
|
129
142
|
} as const;
|
|
@@ -39,6 +39,9 @@ export default {
|
|
|
39
39
|
"Insert variable": "Inserir variável",
|
|
40
40
|
"Add payment instructions, terms, or other notes...":
|
|
41
41
|
"Adicione instruções de pagamento, condições ou outras notas...",
|
|
42
|
+
// Signature field
|
|
43
|
+
Signature: "Assinatura",
|
|
44
|
+
"Add signature text...": "Adicionar texto de assinatura...",
|
|
42
45
|
"Payment Terms": "Condições de pagamento",
|
|
43
46
|
"Add payment terms...": "Adicione condições de pagamento...",
|
|
44
47
|
Entity: "Empresa",
|
|
@@ -107,6 +110,14 @@ export default {
|
|
|
107
110
|
"Credit note": "Nota de crédito",
|
|
108
111
|
"Advance invoice": "Fatura antecipada",
|
|
109
112
|
"FINA fiscalized invoices always use the current date": "As faturas fiscalizadas FINA usam sempre a data atual",
|
|
113
|
+
// Due days selector
|
|
114
|
+
"On receipt": "No recebimento",
|
|
115
|
+
"7 days": "7 dias",
|
|
116
|
+
"14 days": "14 dias",
|
|
117
|
+
"30 days": "30 dias",
|
|
118
|
+
"60 days": "60 dias",
|
|
119
|
+
"90 days": "90 dias",
|
|
120
|
+
Custom: "Personalizado",
|
|
110
121
|
"Service Date": "Data do serviço",
|
|
111
122
|
"Single Date": "Data única",
|
|
112
123
|
"Date Range": "Intervalo de datas",
|
|
@@ -127,4 +138,6 @@ export default {
|
|
|
127
138
|
"Esta fatura não será fiscalizada (transação não nacional)",
|
|
128
139
|
"Tax Clause": "Cláusula fiscal",
|
|
129
140
|
"Add tax clause...": "Adicionar cláusula fiscal...",
|
|
141
|
+
Footer: "Rodapé",
|
|
142
|
+
"Add document footer...": "Adicionar rodapé do documento...",
|
|
130
143
|
} as const;
|
|
@@ -39,6 +39,9 @@ export default {
|
|
|
39
39
|
Note: "Opomba",
|
|
40
40
|
"Insert variable": "Vstavi spremenljivko",
|
|
41
41
|
"Add payment instructions, terms, or other notes...": "Dodajte navodila za plačilo, pogoje ali druge opombe...",
|
|
42
|
+
// Signature field
|
|
43
|
+
Signature: "Podpis",
|
|
44
|
+
"Add signature text...": "Dodaj besedilo podpisa...",
|
|
42
45
|
// Payment terms field
|
|
43
46
|
"Payment Terms": "Plačilni pogoji",
|
|
44
47
|
"Add payment terms...": "Dodajte plačilne pogoje...",
|
|
@@ -115,6 +118,14 @@ export default {
|
|
|
115
118
|
"Credit note": "Dobropis",
|
|
116
119
|
"Advance invoice": "Avansni račun",
|
|
117
120
|
"FINA fiscalized invoices always use the current date": "FINA fiskalizirani računi vedno uporabijo trenutni datum",
|
|
121
|
+
// Due days selector
|
|
122
|
+
"On receipt": "Ob prejemu",
|
|
123
|
+
"7 days": "7 dni",
|
|
124
|
+
"14 days": "14 dni",
|
|
125
|
+
"30 days": "30 dni",
|
|
126
|
+
"60 days": "60 dni",
|
|
127
|
+
"90 days": "90 dni",
|
|
128
|
+
Custom: "Po meri",
|
|
118
129
|
// Service date
|
|
119
130
|
"Service Date": "Datum storitve",
|
|
120
131
|
"Single Date": "Datum",
|
|
@@ -136,4 +147,6 @@ export default {
|
|
|
136
147
|
"Ta račun ne bo fiskaliziran (nedomača transakcija)",
|
|
137
148
|
"Tax Clause": "Davčna klavzula",
|
|
138
149
|
"Add tax clause...": "Dodajte davčno klavzulo...",
|
|
150
|
+
Footer: "Noga dokumenta",
|
|
151
|
+
"Add document footer...": "Dodajte nogo dokumenta...",
|
|
139
152
|
} as const;
|
|
@@ -9,8 +9,8 @@ type FursData = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
type FinaData = {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
business_premise_name?: string;
|
|
13
|
+
electronic_device_name?: string;
|
|
14
14
|
payment_type?: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -77,10 +77,10 @@ export function prepareInvoiceSubmission(values: CreateInvoiceSchema, options: P
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Add FINA data if provided (FINA can't be skipped - all invoices must be fiscalized)
|
|
80
|
-
if (options.fina?.
|
|
80
|
+
if (options.fina?.business_premise_name && options.fina.electronic_device_name) {
|
|
81
81
|
(payload as any).fina = {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
business_premise_name: options.fina.business_premise_name,
|
|
83
|
+
electronic_device_name: options.fina.electronic_device_name,
|
|
84
84
|
...(options.fina.payment_type && { payment_type: options.fina.payment_type }),
|
|
85
85
|
};
|
|
86
86
|
}
|