@spaceinvoices/react-ui 0.4.7 → 0.4.10
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/common/autocomplete.tsx +69 -6
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +124 -285
- package/src/components/advance-invoices/create/locales/de.ts +2 -1
- package/src/components/advance-invoices/create/locales/es.ts +2 -1
- package/src/components/advance-invoices/create/locales/fr.ts +2 -1
- package/src/components/advance-invoices/create/locales/hr.ts +2 -1
- package/src/components/advance-invoices/create/locales/it.ts +2 -1
- package/src/components/advance-invoices/create/locales/nl.ts +2 -1
- package/src/components/advance-invoices/create/locales/pl.ts +2 -1
- package/src/components/advance-invoices/create/locales/pt.ts +2 -1
- package/src/components/advance-invoices/create/locales/sl.ts +2 -1
- package/src/components/advance-invoices/list/list-table.tsx +10 -3
- package/src/components/advance-invoices/list/locales/de.ts +2 -0
- package/src/components/advance-invoices/list/locales/en.ts +1 -0
- package/src/components/advance-invoices/list/locales/es.ts +1 -0
- package/src/components/advance-invoices/list/locales/fr.ts +1 -0
- package/src/components/advance-invoices/list/locales/hr.ts +1 -0
- package/src/components/advance-invoices/list/locales/it.ts +1 -0
- package/src/components/advance-invoices/list/locales/nl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pt.ts +1 -0
- package/src/components/advance-invoices/list/locales/sl.ts +1 -0
- package/src/components/advance-invoices/list/use-advance-invoice-download.ts +1 -12
- package/src/components/credit-notes/create/create-credit-note-form.tsx +116 -238
- package/src/components/credit-notes/create/locales/de.ts +2 -1
- package/src/components/credit-notes/create/locales/es.ts +2 -1
- package/src/components/credit-notes/create/locales/fr.ts +2 -1
- package/src/components/credit-notes/create/locales/hr.ts +2 -1
- package/src/components/credit-notes/create/locales/it.ts +2 -1
- package/src/components/credit-notes/create/locales/nl.ts +2 -1
- package/src/components/credit-notes/create/locales/pl.ts +2 -1
- package/src/components/credit-notes/create/locales/pt.ts +2 -1
- package/src/components/credit-notes/create/locales/sl.ts +2 -1
- package/src/components/credit-notes/list/list-table.tsx +6 -3
- package/src/components/credit-notes/list/use-credit-note-download.ts +1 -12
- package/src/components/customers/customer-autocomplete.tsx +64 -11
- package/src/components/customers/customer-list-table/customer-list-table.tsx +3 -2
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +9 -1
- package/src/components/dashboard/collection-rate-card/locales/bg.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/cs.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/et.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/fi.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/is.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/nb.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/sk.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/sv.ts +3 -0
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +10 -2
- package/src/components/dashboard/invoice-status-chart/locales/bg.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/cs.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/de.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/es.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/et.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/fi.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/is.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/it.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/nb.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/sk.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/invoice-status-chart/locales/sv.ts +10 -0
- package/src/components/dashboard/payment-methods-chart/locales/bg.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/cs.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/et.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/fi.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/is.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/nb.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/sk.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/sv.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +9 -1
- package/src/components/dashboard/payment-trend-chart/locales/bg.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/cs.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/de.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/es.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/et.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/fi.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/is.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/it.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/nb.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/sk.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/payment-trend-chart/locales/sv.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +15 -8
- package/src/components/dashboard/revenue-trend-chart/locales/bg.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/cs.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/de.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/es.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/et.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/fi.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/fr.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/hr.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/is.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/it.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/nb.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/nl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pt.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sk.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sl.ts +1 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sv.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +15 -8
- package/src/components/dashboard/tax-collected-card/locales.ts +110 -0
- package/src/components/dashboard/tax-collected-card/tax-collected-card.tsx +8 -2
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +4 -4
- package/src/components/dashboard/top-customers-chart/locales/bg.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/cs.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/de.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/es.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/et.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/fi.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/fr.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/hr.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/is.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/it.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/nb.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/nl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/pl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/pt.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/sk.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/sl.ts +2 -0
- package/src/components/dashboard/top-customers-chart/locales/sv.ts +7 -0
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +23 -12
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +33 -20
- package/src/components/delivery-notes/create/locales/de.ts +2 -1
- package/src/components/delivery-notes/create/locales/es.ts +2 -1
- package/src/components/delivery-notes/create/locales/fr.ts +2 -1
- package/src/components/delivery-notes/create/locales/hr.ts +2 -1
- package/src/components/delivery-notes/create/locales/it.ts +2 -1
- package/src/components/delivery-notes/create/locales/nl.ts +2 -1
- package/src/components/delivery-notes/create/locales/pl.ts +2 -1
- package/src/components/delivery-notes/create/locales/pt.ts +2 -1
- package/src/components/delivery-notes/create/locales/sl.ts +2 -1
- package/src/components/delivery-notes/list/list-table.tsx +22 -13
- package/src/components/delivery-notes/list/locales/de.ts +2 -0
- package/src/components/delivery-notes/list/locales/en.ts +1 -0
- package/src/components/delivery-notes/list/locales/es.ts +1 -0
- package/src/components/delivery-notes/list/locales/fr.ts +1 -0
- package/src/components/delivery-notes/list/locales/hr.ts +1 -0
- package/src/components/delivery-notes/list/locales/it.ts +1 -0
- package/src/components/delivery-notes/list/locales/nl.ts +1 -0
- package/src/components/delivery-notes/list/locales/pl.ts +1 -0
- package/src/components/delivery-notes/list/locales/pt.ts +1 -0
- package/src/components/delivery-notes/list/locales/sl.ts +1 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +1 -12
- package/src/components/documents/create/document-add-item-form.tsx +28 -16
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +12 -2
- package/src/components/documents/create/document-items-section.tsx +70 -39
- package/src/components/documents/create/document-recipient-section.tsx +10 -1
- package/src/components/documents/create/live-preview.tsx +113 -15
- package/src/components/documents/create/prepare-document-submission.ts +35 -16
- package/src/components/documents/create/use-document-customer-form.ts +14 -3
- package/src/components/documents/documents.hooks.ts +7 -2
- package/src/components/documents/shared/document-preview-display.tsx +136 -67
- package/src/components/documents/shared/scaled-document-preview.tsx +45 -5
- package/src/components/documents/view/document-actions-bar.tsx +284 -182
- package/src/components/documents/view/document-activities-list.tsx +3 -0
- package/src/components/documents/view/document-payments-list.tsx +3 -0
- package/src/components/documents/view/locales/de.ts +8 -0
- package/src/components/documents/view/locales/es.ts +8 -0
- package/src/components/documents/view/locales/fr.ts +8 -0
- package/src/components/documents/view/locales/hr.ts +8 -0
- package/src/components/documents/view/locales/it.ts +8 -0
- package/src/components/documents/view/locales/nl.ts +8 -0
- package/src/components/documents/view/locales/pl.ts +8 -0
- package/src/components/documents/view/locales/pt.ts +8 -0
- package/src/components/documents/view/locales/sl.ts +8 -0
- package/src/components/documents/view/use-document-download.ts +14 -25
- package/src/components/entities/create-entity-form.tsx +101 -16
- package/src/components/entities/entity-settings-form/locales/de.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/es.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/fr.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/hr.ts +4 -2
- package/src/components/entities/entity-settings-form/locales/it.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/nl.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/pl.ts +6 -2
- package/src/components/entities/entity-settings-form/locales/pt.ts +6 -3
- package/src/components/entities/entity-settings-form/locales/sl.ts +4 -2
- package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +3 -3
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +78 -124
- package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +8 -1
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +14 -2
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +7 -2
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +56 -130
- package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +8 -1
- package/src/components/entities/furs-settings-form/sections/enable-fiscalization-section.tsx +1 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +15 -2
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +20 -3
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +38 -12
- package/src/components/entities/settings/eslog-settings-form.tsx +13 -1
- package/src/components/entities/settings/pdf-template-selector/demo-invoice-data.ts +3 -22
- package/src/components/entities/shared/fiscalization-step-flow.ts +77 -0
- package/src/components/entities/shared/fiscalization-step-tabs.tsx +71 -0
- package/src/components/estimates/create/create-estimate-form.tsx +34 -21
- package/src/components/estimates/create/locales/de.ts +2 -1
- package/src/components/estimates/create/locales/es.ts +2 -1
- package/src/components/estimates/create/locales/fr.ts +2 -1
- package/src/components/estimates/create/locales/hr.ts +2 -1
- package/src/components/estimates/create/locales/it.ts +2 -1
- package/src/components/estimates/create/locales/nl.ts +2 -1
- package/src/components/estimates/create/locales/pl.ts +2 -1
- package/src/components/estimates/create/locales/pt.ts +2 -1
- package/src/components/estimates/create/locales/sl.ts +2 -1
- package/src/components/estimates/list/list-table.tsx +23 -14
- package/src/components/estimates/list/locales/de.ts +2 -0
- package/src/components/estimates/list/locales/en.ts +1 -0
- package/src/components/estimates/list/locales/es.ts +1 -0
- package/src/components/estimates/list/locales/fr.ts +1 -0
- package/src/components/estimates/list/locales/hr.ts +1 -0
- package/src/components/estimates/list/locales/it.ts +1 -0
- package/src/components/estimates/list/locales/nl.ts +1 -0
- package/src/components/estimates/list/locales/pl.ts +1 -0
- package/src/components/estimates/list/locales/pt.ts +1 -0
- package/src/components/estimates/list/locales/sl.ts +1 -0
- package/src/components/estimates/list/use-estimate-download.ts +1 -12
- package/src/components/export/document-export-form.tsx +33 -7
- package/src/components/export/sales-per-item-export-form.tsx +23 -7
- package/src/components/invoices/create/create-invoice-form.tsx +295 -329
- package/src/components/invoices/create/locales/de.ts +2 -1
- package/src/components/invoices/create/locales/es.ts +2 -1
- package/src/components/invoices/create/locales/fr.ts +2 -1
- package/src/components/invoices/create/locales/hr.ts +2 -1
- package/src/components/invoices/create/locales/it.ts +2 -1
- package/src/components/invoices/create/locales/nl.ts +2 -1
- package/src/components/invoices/create/locales/pl.ts +2 -1
- package/src/components/invoices/create/locales/pt.ts +2 -1
- package/src/components/invoices/create/locales/sl.ts +2 -1
- package/src/components/invoices/create/prepare-invoice-submission.ts +0 -8
- package/src/components/invoices/list/list-table.tsx +7 -4
- package/src/components/invoices/list/use-invoice-download.ts +1 -11
- package/src/components/invoices/send-email-dialog/locales/de.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +2 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +2 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +77 -8
- package/src/components/invoices/view/eslog-info-display.tsx +17 -1
- package/src/components/invoices/view/fiscalization-status-card.tsx +7 -3
- package/src/components/items/item-combobox.tsx +26 -6
- package/src/components/items/item-list-table/item-list-table.tsx +5 -2
- package/src/components/payments/list/list-table.tsx +14 -4
- package/src/components/recurring-invoices/list/list-table.tsx +7 -4
- package/src/components/request-logs/locales.ts +412 -0
- package/src/components/request-logs/request-log-detail.tsx +37 -21
- package/src/components/request-logs/request-log-list-table.tsx +57 -11
- package/src/components/table/data-table.tsx +5 -2
- package/src/components/table/date-cell.tsx +3 -1
- package/src/components/table/filter-bar.tsx +14 -2
- package/src/components/table/hooks/use-table-query.ts +1 -1
- package/src/components/table/locales.ts +1116 -0
- package/src/components/table/search-input.tsx +12 -3
- package/src/components/table/selection-toolbar.tsx +23 -6
- package/src/components/table/table-empty-state.tsx +43 -3
- package/src/components/table/table-no-results.tsx +3 -3
- package/src/components/table/table-pagination.tsx +4 -3
- package/src/components/table/types.ts +1 -0
- package/src/components/tax-reports/index.ts +1 -0
- package/src/components/tax-reports/kir-export-form.tsx +46 -8
- package/src/components/tax-reports/slovenia-tax-profile-step.tsx +191 -0
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +509 -0
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +253 -0
- package/src/components/tax-reports/slovenia-yearly-summary.tsx +19 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +3 -2
- package/src/components/ui/sticky-form-footer.tsx +7 -1
- package/src/components/webhook-logs/index.ts +6 -0
- package/src/components/webhook-logs/locales.ts +392 -0
- package/src/components/webhook-logs/webhook-delivery-detail.tsx +255 -0
- package/src/components/webhook-logs/webhook-delivery-list-table.tsx +278 -0
- package/src/components/wl-subscription/index.ts +1 -0
- package/src/components/wl-subscription/locked-feature.tsx +1 -0
- package/src/components/wl-subscription/paywall.tsx +193 -0
- package/src/components/wl-subscription/upgrade-modal.tsx +93 -29
- package/src/generate-schemas.ts +10 -5
- package/src/generated/schemas/customer.ts +2 -0
- package/src/generated/schemas/entity.ts +34 -0
- package/src/generated/schemas/me.ts +20 -1
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +40 -34
- package/src/generated/schemas/rendercreditnotepreview_body.ts +42 -36
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +23 -13
- package/src/generated/schemas/renderestimatepreview_body.ts +23 -13
- package/src/generated/schemas/renderinvoicepreview_body.ts +40 -34
- package/src/generated/schemas/sendemail_body.ts +44 -0
- package/src/generated/schemas/startpdfexport_body.ts +91 -1
- package/src/generated/schemas/webhook.ts +10 -0
- package/src/hooks/use-duplicate-document.ts +51 -13
- package/src/hooks/use-eslog-validation.ts +59 -0
- package/src/hooks/use-premise-selection.ts +186 -0
- package/src/lib/browser-cookies.ts +4 -4
- package/src/lib/date-fns-locale.ts +48 -0
- package/src/lib/fiscalization-options.ts +81 -0
- package/src/lib/locale.ts +38 -0
- package/src/lib/template-variables.tsx +1 -1
- package/src/lib/translation.ts +14 -3
- package/src/providers/entities-context.tsx +1 -0
- package/src/providers/entities-provider.tsx +102 -3
- package/src/providers/form-footer-context.tsx +37 -4
- package/src/providers/sdk-provider.tsx +7 -2
- package/src/providers/white-label-provider.tsx +4 -1
- package/src/providers/wl-subscription-provider.tsx +90 -3
|
@@ -9,7 +9,9 @@ import { Form } from "@/ui/components/ui/form";
|
|
|
9
9
|
import { Skeleton } from "@/ui/components/ui/skeleton";
|
|
10
10
|
import { createCreditNoteSchema } from "@/ui/generated/schemas";
|
|
11
11
|
import { useNextDocumentNumber } from "@/ui/hooks/use-next-document-number";
|
|
12
|
+
import { usePremiseSelection } from "@/ui/hooks/use-premise-selection";
|
|
12
13
|
import { useTransactionTypeCheck } from "@/ui/hooks/use-transaction-type-check";
|
|
14
|
+
import { buildFinaOptions, buildFursOptions } from "@/ui/lib/fiscalization-options";
|
|
13
15
|
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
14
16
|
import { createTranslation } from "@/ui/lib/translation";
|
|
15
17
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
@@ -29,15 +31,7 @@ import { MarkAsPaidSection } from "../../documents/create/mark-as-paid-section";
|
|
|
29
31
|
import { prepareDocumentSubmission } from "../../documents/create/prepare-document-submission";
|
|
30
32
|
import { useDocumentCustomerForm } from "../../documents/create/use-document-customer-form";
|
|
31
33
|
import type { DocumentTypes } from "../../documents/types";
|
|
32
|
-
import {
|
|
33
|
-
import { useFursPremises, useFursSettings } from "../../entities/furs-settings-form/furs-settings.hooks";
|
|
34
|
-
import {
|
|
35
|
-
getLastUsedFinaCombo,
|
|
36
|
-
getLastUsedFursCombo,
|
|
37
|
-
setLastUsedFinaCombo,
|
|
38
|
-
setLastUsedFursCombo,
|
|
39
|
-
useCreateCreditNote,
|
|
40
|
-
} from "../credit-notes.hooks";
|
|
34
|
+
import { useCreateCreditNote } from "../credit-notes.hooks";
|
|
41
35
|
import de from "./locales/de";
|
|
42
36
|
import es from "./locales/es";
|
|
43
37
|
import fr from "./locales/fr";
|
|
@@ -102,44 +96,21 @@ export default function CreateCreditNoteForm({
|
|
|
102
96
|
const queryClient = useQueryClient();
|
|
103
97
|
|
|
104
98
|
// ============================================================================
|
|
105
|
-
// FURS
|
|
106
|
-
// ============================================================================
|
|
107
|
-
const { data: fursSettings, isLoading: isFursSettingsLoading } = useFursSettings(entityId);
|
|
108
|
-
const { data: fursPremises, isLoading: isFursPremisesLoading } = useFursPremises(entityId, {
|
|
109
|
-
enabled: fursSettings?.enabled === true,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const isFursLoading = isFursSettingsLoading || (fursSettings?.enabled && isFursPremisesLoading);
|
|
113
|
-
const isFursEnabled = fursSettings?.enabled === true;
|
|
114
|
-
const activePremises = useMemo(() => fursPremises?.filter((p) => p.is_active) || [], [fursPremises]);
|
|
115
|
-
const hasFursPremises = activePremises.length > 0;
|
|
116
|
-
|
|
117
|
-
// FURS premise/device selection state
|
|
118
|
-
const [selectedPremiseName, setSelectedPremiseName] = useState<string | undefined>();
|
|
119
|
-
const [selectedDeviceName, setSelectedDeviceName] = useState<string | undefined>();
|
|
120
|
-
|
|
121
|
-
// ============================================================================
|
|
122
|
-
// FINA Settings & Premises
|
|
99
|
+
// FURS & FINA Premise Selection (shared hook)
|
|
123
100
|
// ============================================================================
|
|
124
|
-
const {
|
|
125
|
-
const {
|
|
126
|
-
enabled: finaSettings?.enabled === true,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const isFinaLoading = isFinaSettingsLoading || (finaSettings?.enabled && isFinaPremisesLoading);
|
|
130
|
-
const isFinaEnabled = finaSettings?.enabled === true;
|
|
131
|
-
const activeFinaPremises = useMemo(() => finaPremises?.filter((p: any) => p.is_active) || [], [finaPremises]);
|
|
132
|
-
const hasFinaPremises = activeFinaPremises.length > 0;
|
|
133
|
-
|
|
134
|
-
// FINA premise/device selection state (no skip - all FINA credit notes must be fiscalized)
|
|
135
|
-
const [selectedFinaBusinessPremiseName, setSelectedFinaBusinessPremiseName] = useState<string | undefined>();
|
|
136
|
-
const [selectedFinaElectronicDeviceName, setSelectedFinaElectronicDeviceName] = useState<string | undefined>();
|
|
101
|
+
const furs = usePremiseSelection({ entityId, type: "furs" });
|
|
102
|
+
const fina = usePremiseSelection({ entityId, type: "fina" });
|
|
137
103
|
|
|
138
104
|
// UI-only state (not part of API schema)
|
|
139
105
|
const [markAsPaid, setMarkAsPaid] = useState(false);
|
|
140
106
|
const [paymentTypes, setPaymentTypes] = useState<string[]>(["bank_transfer"]);
|
|
141
107
|
const [isDraftPending, setIsDraftPending] = useState(false);
|
|
142
108
|
|
|
109
|
+
// Service date type state (single date or range)
|
|
110
|
+
const [serviceDateType, setServiceDateType] = useState<"single" | "range">(
|
|
111
|
+
initialValues && (initialValues as any).date_service_to ? "range" : "single",
|
|
112
|
+
);
|
|
113
|
+
|
|
143
114
|
// Price modes per item (gross vs net) - collected from component state at submit
|
|
144
115
|
const initialPriceModes = useMemo(() => {
|
|
145
116
|
if (!initialValues?.items) return {};
|
|
@@ -150,112 +121,6 @@ export default function CreateCreditNoteForm({
|
|
|
150
121
|
}, [initialValues?.items]);
|
|
151
122
|
const priceModesRef = useRef<PriceModesMap>(initialPriceModes);
|
|
152
123
|
|
|
153
|
-
// Get active FURS devices for selected premise
|
|
154
|
-
const activeDevices = useMemo(() => {
|
|
155
|
-
if (!selectedPremiseName) return [];
|
|
156
|
-
const premise = activePremises.find((p) => p.business_premise_name === selectedPremiseName);
|
|
157
|
-
return premise?.Devices?.filter((d) => d.is_active) || [];
|
|
158
|
-
}, [activePremises, selectedPremiseName]);
|
|
159
|
-
|
|
160
|
-
// Initialize FURS selection from localStorage or first active combo
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
if (!isFursEnabled || !hasFursPremises || selectedPremiseName) return;
|
|
163
|
-
|
|
164
|
-
const lastUsed = getLastUsedFursCombo(entityId);
|
|
165
|
-
if (lastUsed) {
|
|
166
|
-
const premise = activePremises.find((p) => p.business_premise_name === lastUsed.business_premise_name);
|
|
167
|
-
const device = premise?.Devices?.find(
|
|
168
|
-
(d) => d.electronic_device_name === lastUsed.electronic_device_name && d.is_active,
|
|
169
|
-
);
|
|
170
|
-
if (premise && device) {
|
|
171
|
-
setSelectedPremiseName(lastUsed.business_premise_name);
|
|
172
|
-
setSelectedDeviceName(lastUsed.electronic_device_name);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const firstPremise = activePremises[0];
|
|
178
|
-
const firstDevice = firstPremise?.Devices?.find((d) => d.is_active);
|
|
179
|
-
if (firstPremise && firstDevice) {
|
|
180
|
-
setSelectedPremiseName(firstPremise.business_premise_name);
|
|
181
|
-
setSelectedDeviceName(firstDevice.electronic_device_name);
|
|
182
|
-
}
|
|
183
|
-
}, [isFursEnabled, hasFursPremises, activePremises, entityId, selectedPremiseName]);
|
|
184
|
-
|
|
185
|
-
// When FURS premise changes, select first active device
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
if (!selectedPremiseName) return;
|
|
188
|
-
const premise = activePremises.find((p) => p.business_premise_name === selectedPremiseName);
|
|
189
|
-
const firstDevice = premise?.Devices?.find((d) => d.is_active);
|
|
190
|
-
if (firstDevice && selectedDeviceName !== firstDevice.electronic_device_name) {
|
|
191
|
-
const currentDeviceInPremise = premise?.Devices?.find(
|
|
192
|
-
(d) => d.electronic_device_name === selectedDeviceName && d.is_active,
|
|
193
|
-
);
|
|
194
|
-
if (!currentDeviceInPremise) {
|
|
195
|
-
setSelectedDeviceName(firstDevice.electronic_device_name);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}, [selectedPremiseName, activePremises, selectedDeviceName]);
|
|
199
|
-
|
|
200
|
-
// FURS selection ready and active checks
|
|
201
|
-
const isFursSelectionReady = !isFursEnabled || !hasFursPremises || (!!selectedPremiseName && !!selectedDeviceName);
|
|
202
|
-
const isFursActive = isFursEnabled && hasFursPremises && selectedPremiseName && selectedDeviceName;
|
|
203
|
-
|
|
204
|
-
// Get active FINA devices for selected premise
|
|
205
|
-
const activeFinaDevices = useMemo(() => {
|
|
206
|
-
if (!selectedFinaBusinessPremiseName) return [];
|
|
207
|
-
const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
|
|
208
|
-
return premise?.Devices?.filter((d: any) => d.is_active) || [];
|
|
209
|
-
}, [activeFinaPremises, selectedFinaBusinessPremiseName]);
|
|
210
|
-
|
|
211
|
-
// Initialize FINA selection from localStorage or first active combo
|
|
212
|
-
useEffect(() => {
|
|
213
|
-
if (!isFinaEnabled || !hasFinaPremises || selectedFinaBusinessPremiseName) return;
|
|
214
|
-
|
|
215
|
-
const lastUsed = getLastUsedFinaCombo(entityId);
|
|
216
|
-
if (lastUsed) {
|
|
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
|
-
);
|
|
221
|
-
if (premise && device) {
|
|
222
|
-
setSelectedFinaBusinessPremiseName(lastUsed.business_premise_name);
|
|
223
|
-
setSelectedFinaElectronicDeviceName(lastUsed.electronic_device_name);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const firstPremise = activeFinaPremises[0];
|
|
229
|
-
const firstDevice = firstPremise?.Devices?.find((d: any) => d.is_active);
|
|
230
|
-
if (firstPremise && firstDevice) {
|
|
231
|
-
setSelectedFinaBusinessPremiseName(firstPremise.business_premise_name);
|
|
232
|
-
setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
|
|
233
|
-
}
|
|
234
|
-
}, [isFinaEnabled, hasFinaPremises, activeFinaPremises, entityId, selectedFinaBusinessPremiseName]);
|
|
235
|
-
|
|
236
|
-
// When FINA premise changes, select first active device
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
if (!selectedFinaBusinessPremiseName) return;
|
|
239
|
-
const premise = activeFinaPremises.find((p: any) => p.business_premise_name === selectedFinaBusinessPremiseName);
|
|
240
|
-
const firstDevice = premise?.Devices?.find((d: any) => d.is_active);
|
|
241
|
-
if (firstDevice && selectedFinaElectronicDeviceName !== firstDevice.electronic_device_name) {
|
|
242
|
-
const currentDeviceInPremise = premise?.Devices?.find(
|
|
243
|
-
(d: any) => d.electronic_device_name === selectedFinaElectronicDeviceName && d.is_active,
|
|
244
|
-
);
|
|
245
|
-
if (!currentDeviceInPremise) {
|
|
246
|
-
setSelectedFinaElectronicDeviceName(firstDevice.electronic_device_name);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}, [selectedFinaBusinessPremiseName, activeFinaPremises, selectedFinaElectronicDeviceName]);
|
|
250
|
-
|
|
251
|
-
// FINA selection ready and active checks
|
|
252
|
-
const isFinaSelectionReady =
|
|
253
|
-
!isFinaEnabled || !hasFinaPremises || (!!selectedFinaBusinessPremiseName && !!selectedFinaElectronicDeviceName);
|
|
254
|
-
const isFinaActive =
|
|
255
|
-
isFinaEnabled && hasFinaPremises && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName;
|
|
256
|
-
|
|
257
|
-
// No header action for credit notes - FINA can't be skipped
|
|
258
|
-
|
|
259
124
|
// Get default payment terms and footer from entity settings
|
|
260
125
|
const defaultPaymentTerms = (activeEntity?.settings as any)?.default_credit_note_payment_terms || "";
|
|
261
126
|
const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
|
|
@@ -292,6 +157,7 @@ export default function CreateCreditNoteForm({
|
|
|
292
157
|
taxes: [],
|
|
293
158
|
},
|
|
294
159
|
],
|
|
160
|
+
date_service: (initialValues as any)?.date_service || new Date().toISOString(),
|
|
295
161
|
currency_code: initialValues?.currency_code || activeEntity?.currency_code || "EUR",
|
|
296
162
|
reference: (initialValues as any)?.reference ?? "",
|
|
297
163
|
note: initialValues?.note ?? "",
|
|
@@ -304,6 +170,9 @@ export default function CreateCreditNoteForm({
|
|
|
304
170
|
const formValues = useWatch({
|
|
305
171
|
control: form.control,
|
|
306
172
|
});
|
|
173
|
+
const onChangeRef = useRef(onChange);
|
|
174
|
+
onChangeRef.current = onChange;
|
|
175
|
+
const prevPayloadRef = useRef("");
|
|
307
176
|
|
|
308
177
|
// ============================================================================
|
|
309
178
|
// VIES Check - determine if reverse charge applies
|
|
@@ -324,35 +193,35 @@ export default function CreateCreditNoteForm({
|
|
|
324
193
|
});
|
|
325
194
|
|
|
326
195
|
// FINA numbering guard: use FINA numbering for domestic transactions (or all if unified numbering is on)
|
|
327
|
-
const finaUnifiedNumbering =
|
|
196
|
+
const finaUnifiedNumbering = fina.settings?.unified_numbering !== false;
|
|
328
197
|
const useFinaNumbering =
|
|
329
|
-
!!
|
|
330
|
-
const isFinaNonDomestic = !!
|
|
198
|
+
!!fina.isActive && (finaUnifiedNumbering || transactionType == null || transactionType === "domestic");
|
|
199
|
+
const isFinaNonDomestic = !!fina.isActive && !useFinaNumbering;
|
|
331
200
|
|
|
332
201
|
// ============================================================================
|
|
333
202
|
// Next Credit Note Number Preview
|
|
334
203
|
// ============================================================================
|
|
335
204
|
// Use same premise/device params for both FURS and FINA (entity is either one, never both)
|
|
336
|
-
const activePremiseNameForNumber =
|
|
337
|
-
? selectedPremiseName
|
|
205
|
+
const activePremiseNameForNumber = furs.isActive
|
|
206
|
+
? furs.selectedPremiseName
|
|
338
207
|
: useFinaNumbering
|
|
339
|
-
?
|
|
208
|
+
? fina.selectedPremiseName
|
|
340
209
|
: undefined;
|
|
341
|
-
const activeDeviceNameForNumber =
|
|
342
|
-
? selectedDeviceName
|
|
210
|
+
const activeDeviceNameForNumber = furs.isActive
|
|
211
|
+
? furs.selectedDeviceName
|
|
343
212
|
: useFinaNumbering
|
|
344
|
-
?
|
|
213
|
+
? fina.selectedDeviceName
|
|
345
214
|
: undefined;
|
|
346
215
|
|
|
347
216
|
const { data: nextNumberData, isLoading: isNextNumberLoading } = useNextDocumentNumber(entityId, "credit_note", {
|
|
348
217
|
businessPremiseName: activePremiseNameForNumber,
|
|
349
218
|
electronicDeviceName: activeDeviceNameForNumber,
|
|
350
|
-
enabled: !!entityId && !
|
|
219
|
+
enabled: !!entityId && !furs.isLoading && furs.isSelectionReady && !fina.isLoading && fina.isSelectionReady,
|
|
351
220
|
});
|
|
352
221
|
|
|
353
222
|
// Overall loading state
|
|
354
223
|
const isFormDataLoading =
|
|
355
|
-
|
|
224
|
+
furs.isLoading || !furs.isSelectionReady || fina.isLoading || !fina.isSelectionReady || isNextNumberLoading;
|
|
356
225
|
|
|
357
226
|
// Auto-populate tax_clause from entity settings when transaction type changes
|
|
358
227
|
const effectiveTransactionType = transactionType ?? "domestic";
|
|
@@ -368,6 +237,13 @@ export default function CreateCreditNoteForm({
|
|
|
368
237
|
form.setValue("tax_clause", clause);
|
|
369
238
|
}, [effectiveTransactionType, activeEntity, form]);
|
|
370
239
|
|
|
240
|
+
// Clear date_service_to when switching from range to single
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
if (serviceDateType === "single") {
|
|
243
|
+
form.setValue("date_service_to", undefined);
|
|
244
|
+
}
|
|
245
|
+
}, [serviceDateType, form]);
|
|
246
|
+
|
|
371
247
|
// Extract customer management logic into a shared hook
|
|
372
248
|
const {
|
|
373
249
|
originalCustomer,
|
|
@@ -389,20 +265,9 @@ export default function CreateCreditNoteForm({
|
|
|
389
265
|
const { mutate: createCreditNote, isPending } = useCreateCreditNote({
|
|
390
266
|
entityId,
|
|
391
267
|
onSuccess: (data) => {
|
|
392
|
-
// Save FURS
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
business_premise_name: selectedPremiseName,
|
|
396
|
-
electronic_device_name: selectedDeviceName,
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
// Save FINA combo to localStorage on successful creation
|
|
400
|
-
if (isFinaActive && selectedFinaBusinessPremiseName && selectedFinaElectronicDeviceName) {
|
|
401
|
-
setLastUsedFinaCombo(entityId, {
|
|
402
|
-
business_premise_name: selectedFinaBusinessPremiseName,
|
|
403
|
-
electronic_device_name: selectedFinaElectronicDeviceName,
|
|
404
|
-
});
|
|
405
|
-
}
|
|
268
|
+
// Save FURS/FINA combos to localStorage on successful creation
|
|
269
|
+
furs.saveCombo();
|
|
270
|
+
fina.saveCombo();
|
|
406
271
|
// Invalidate customers cache when a customer was created/linked
|
|
407
272
|
if (data.customer_id) {
|
|
408
273
|
queryClient.invalidateQueries({ queryKey: [CUSTOMERS_CACHE_KEY] });
|
|
@@ -416,20 +281,21 @@ export default function CreateCreditNoteForm({
|
|
|
416
281
|
const submitCreditNote = useCallback(
|
|
417
282
|
(values: CreateCreditNoteFormValues, isDraft: boolean) => {
|
|
418
283
|
// Build FURS options (skip for drafts; no skip toggle for credit notes)
|
|
419
|
-
const fursOptions =
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
284
|
+
const fursOptions = buildFursOptions({
|
|
285
|
+
isDraft,
|
|
286
|
+
isEnabled: furs.isEnabled,
|
|
287
|
+
premiseName: furs.selectedPremiseName,
|
|
288
|
+
deviceName: furs.selectedDeviceName,
|
|
289
|
+
});
|
|
423
290
|
|
|
424
291
|
// Build FINA options (skip for drafts; FINA can't be skipped)
|
|
425
|
-
const finaOptions =
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
: undefined;
|
|
292
|
+
const finaOptions = buildFinaOptions({
|
|
293
|
+
isDraft,
|
|
294
|
+
useFinaNumbering,
|
|
295
|
+
premiseName: fina.selectedPremiseName,
|
|
296
|
+
deviceName: fina.selectedDeviceName,
|
|
297
|
+
paymentType: paymentTypes[0],
|
|
298
|
+
});
|
|
433
299
|
|
|
434
300
|
const payload = prepareDocumentSubmission(values, {
|
|
435
301
|
originalCustomer,
|
|
@@ -453,19 +319,7 @@ export default function CreateCreditNoteForm({
|
|
|
453
319
|
|
|
454
320
|
createCreditNote(payload as CreateCreditNoteRequest);
|
|
455
321
|
},
|
|
456
|
-
[
|
|
457
|
-
createCreditNote,
|
|
458
|
-
isFursEnabled,
|
|
459
|
-
useFinaNumbering,
|
|
460
|
-
markAsPaid,
|
|
461
|
-
originalCustomer,
|
|
462
|
-
paymentTypes,
|
|
463
|
-
selectedDeviceName,
|
|
464
|
-
selectedFinaElectronicDeviceName,
|
|
465
|
-
selectedFinaBusinessPremiseName,
|
|
466
|
-
selectedPremiseName,
|
|
467
|
-
showCustomerForm,
|
|
468
|
-
],
|
|
322
|
+
[createCreditNote, furs, fina, useFinaNumbering, markAsPaid, originalCustomer, paymentTypes, showCustomerForm],
|
|
469
323
|
);
|
|
470
324
|
|
|
471
325
|
// Handle save as draft
|
|
@@ -524,36 +378,49 @@ export default function CreateCreditNoteForm({
|
|
|
524
378
|
}
|
|
525
379
|
}, [activeEntity?.is_tax_subject, form]);
|
|
526
380
|
|
|
381
|
+
const buildPreviewPayload = useCallback((values: CreateCreditNoteFormValues): CreditNotePreviewPayload => {
|
|
382
|
+
const currentItems = values.items || [];
|
|
383
|
+
|
|
384
|
+
const transformedItems = currentItems.map((item: any, index: number) => {
|
|
385
|
+
const { price, ...rest } = item;
|
|
386
|
+
const isGross = priceModesRef.current[index] ?? false;
|
|
387
|
+
return isGross ? { ...rest, gross_price: price } : { ...rest, price };
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
return {
|
|
391
|
+
number: values.number,
|
|
392
|
+
date: values.date,
|
|
393
|
+
date_service: (values as any).date_service,
|
|
394
|
+
date_service_to: (values as any).date_service_to,
|
|
395
|
+
customer_id: values.customer_id,
|
|
396
|
+
customer: values.customer,
|
|
397
|
+
items: transformedItems,
|
|
398
|
+
currency_code: values.currency_code,
|
|
399
|
+
reference: values.reference,
|
|
400
|
+
note: values.note,
|
|
401
|
+
payment_terms: values.payment_terms,
|
|
402
|
+
signature: values.signature,
|
|
403
|
+
};
|
|
404
|
+
}, []);
|
|
405
|
+
|
|
406
|
+
const emitPreviewPayload = useCallback((payload: CreditNotePreviewPayload) => {
|
|
407
|
+
const callback = onChangeRef.current;
|
|
408
|
+
if (!callback) return;
|
|
409
|
+
|
|
410
|
+
const payloadStr = JSON.stringify(payload);
|
|
411
|
+
if (payloadStr === prevPayloadRef.current) return;
|
|
412
|
+
prevPayloadRef.current = payloadStr;
|
|
413
|
+
|
|
414
|
+
callback(payload);
|
|
415
|
+
}, []);
|
|
416
|
+
|
|
527
417
|
useEffect(() => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
// Transform items to use gross_price when price mode is gross
|
|
532
|
-
const transformedItems = currentItems.map((item: any, index: number) => {
|
|
533
|
-
const { price, ...rest } = item;
|
|
534
|
-
const isGross = priceModesRef.current[index] ?? false;
|
|
535
|
-
if (isGross) {
|
|
536
|
-
return { ...rest, gross_price: price };
|
|
537
|
-
}
|
|
538
|
-
return { ...rest, price };
|
|
539
|
-
});
|
|
418
|
+
emitPreviewPayload(buildPreviewPayload(formValues as CreateCreditNoteFormValues));
|
|
419
|
+
}, [buildPreviewPayload, emitPreviewPayload, formValues]);
|
|
540
420
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
date: formValues.date,
|
|
545
|
-
customer_id: formValues.customer_id,
|
|
546
|
-
customer: formValues.customer,
|
|
547
|
-
items: transformedItems,
|
|
548
|
-
currency_code: formValues.currency_code,
|
|
549
|
-
reference: formValues.reference,
|
|
550
|
-
note: formValues.note,
|
|
551
|
-
payment_terms: formValues.payment_terms,
|
|
552
|
-
signature: formValues.signature,
|
|
553
|
-
};
|
|
554
|
-
onChange(payload);
|
|
555
|
-
}
|
|
556
|
-
}, [formValues, onChange, form]);
|
|
421
|
+
const emitCurrentPreviewPayload = useCallback(() => {
|
|
422
|
+
emitPreviewPayload(buildPreviewPayload(form.getValues()));
|
|
423
|
+
}, [buildPreviewPayload, emitPreviewPayload, form]);
|
|
557
424
|
|
|
558
425
|
const onSubmit = (values: CreateCreditNoteFormValues) => {
|
|
559
426
|
submitCreditNote(values, false);
|
|
@@ -629,32 +496,42 @@ export default function CreateCreditNoteForm({
|
|
|
629
496
|
documentType={_type}
|
|
630
497
|
t={t}
|
|
631
498
|
fursInline={
|
|
632
|
-
|
|
499
|
+
furs.isEnabled && furs.hasPremises
|
|
633
500
|
? {
|
|
634
|
-
premises: activePremises.map((p) => ({
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
501
|
+
premises: furs.activePremises.map((p) => ({
|
|
502
|
+
id: p.id,
|
|
503
|
+
business_premise_name: p.business_premise_name,
|
|
504
|
+
})),
|
|
505
|
+
devices: furs.activeDevices.map((d) => ({
|
|
506
|
+
id: (d as any).id,
|
|
507
|
+
electronic_device_name: d.electronic_device_name,
|
|
508
|
+
})),
|
|
509
|
+
selectedPremise: furs.selectedPremiseName,
|
|
510
|
+
selectedDevice: furs.selectedDeviceName,
|
|
511
|
+
onPremiseChange: furs.setSelectedPremiseName,
|
|
512
|
+
onDeviceChange: furs.setSelectedDeviceName,
|
|
640
513
|
}
|
|
641
514
|
: undefined
|
|
642
515
|
}
|
|
516
|
+
serviceDate={{
|
|
517
|
+
dateType: serviceDateType,
|
|
518
|
+
onDateTypeChange: setServiceDateType,
|
|
519
|
+
}}
|
|
643
520
|
finaInline={
|
|
644
521
|
useFinaNumbering
|
|
645
522
|
? {
|
|
646
|
-
premises:
|
|
523
|
+
premises: fina.activePremises.map((p: any) => ({
|
|
647
524
|
id: p.id,
|
|
648
525
|
business_premise_name: p.business_premise_name,
|
|
649
526
|
})),
|
|
650
|
-
devices:
|
|
527
|
+
devices: fina.activeDevices.map((d: any) => ({
|
|
651
528
|
id: d.id,
|
|
652
529
|
electronic_device_name: d.electronic_device_name,
|
|
653
530
|
})),
|
|
654
|
-
selectedPremise:
|
|
655
|
-
selectedDevice:
|
|
656
|
-
onPremiseChange:
|
|
657
|
-
onDeviceChange:
|
|
531
|
+
selectedPremise: fina.selectedPremiseName,
|
|
532
|
+
selectedDevice: fina.selectedDeviceName,
|
|
533
|
+
onPremiseChange: fina.setSelectedPremiseName,
|
|
534
|
+
onDeviceChange: fina.setSelectedDeviceName,
|
|
658
535
|
}
|
|
659
536
|
: undefined
|
|
660
537
|
}
|
|
@@ -666,7 +543,7 @@ export default function CreateCreditNoteForm({
|
|
|
666
543
|
paymentTypes={paymentTypes}
|
|
667
544
|
onPaymentTypesChange={setPaymentTypes}
|
|
668
545
|
t={t}
|
|
669
|
-
alwaysShowPaymentType={!!
|
|
546
|
+
alwaysShowPaymentType={!!fina.isActive}
|
|
670
547
|
/>
|
|
671
548
|
</DocumentDetailsSection>
|
|
672
549
|
</div>
|
|
@@ -683,6 +560,7 @@ export default function CreateCreditNoteForm({
|
|
|
683
560
|
maxTaxesPerItem={activeEntity?.country_rules?.max_taxes_per_item}
|
|
684
561
|
priceModesRef={priceModesRef}
|
|
685
562
|
initialPriceModes={initialPriceModes}
|
|
563
|
+
onItemsStateChange={emitCurrentPreviewPayload}
|
|
686
564
|
taxesDisabled={reverseChargeApplies}
|
|
687
565
|
taxesDisabledMessage={
|
|
688
566
|
reverseChargeApplies ? t("Reverse charge - tax exempt EU B2B sale") : viesWarning ? viesWarning : undefined
|
|
@@ -88,7 +88,8 @@ export default {
|
|
|
88
88
|
Domestic: "Inland",
|
|
89
89
|
"EU B2B": "EU B2B",
|
|
90
90
|
"EU B2C": "EU B2C",
|
|
91
|
-
|
|
91
|
+
"3W B2B": "3W B2B",
|
|
92
|
+
"3W B2C": "3W B2C",
|
|
92
93
|
"Determining transaction type...": "Transaktionstyp wird ermittelt...",
|
|
93
94
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
94
95
|
"Diese Rechnung wird nicht fiskalisiert (nicht-inländische Transaktion)",
|
|
@@ -87,7 +87,8 @@ export default {
|
|
|
87
87
|
Domestic: "Nacional",
|
|
88
88
|
"EU B2B": "EU B2B",
|
|
89
89
|
"EU B2C": "EU B2C",
|
|
90
|
-
|
|
90
|
+
"3W B2B": "3W B2B",
|
|
91
|
+
"3W B2C": "3W B2C",
|
|
91
92
|
"Determining transaction type...": "Determinando tipo de transacción...",
|
|
92
93
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
93
94
|
"Esta factura no será fiscalizada (transacción no nacional)",
|
|
@@ -87,7 +87,8 @@ export default {
|
|
|
87
87
|
Domestic: "Nationale",
|
|
88
88
|
"EU B2B": "EU B2B",
|
|
89
89
|
"EU B2C": "EU B2C",
|
|
90
|
-
|
|
90
|
+
"3W B2B": "3W B2B",
|
|
91
|
+
"3W B2C": "3W B2C",
|
|
91
92
|
"Determining transaction type...": "Détermination du type de transaction...",
|
|
92
93
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
93
94
|
"Cette facture ne sera pas fiscalisée (transaction non nationale)",
|
|
@@ -85,7 +85,8 @@ export default {
|
|
|
85
85
|
Domestic: "Domaća",
|
|
86
86
|
"EU B2B": "EU B2B",
|
|
87
87
|
"EU B2C": "EU B2C",
|
|
88
|
-
|
|
88
|
+
"3W B2B": "3W B2B",
|
|
89
|
+
"3W B2C": "3W B2C",
|
|
89
90
|
"Determining transaction type...": "Određivanje vrste transakcije...",
|
|
90
91
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
91
92
|
"Ovaj račun neće biti fiskaliziran (nedomaća transakcija)",
|
|
@@ -88,7 +88,8 @@ export default {
|
|
|
88
88
|
Domestic: "Nazionale",
|
|
89
89
|
"EU B2B": "EU B2B",
|
|
90
90
|
"EU B2C": "EU B2C",
|
|
91
|
-
|
|
91
|
+
"3W B2B": "3W B2B",
|
|
92
|
+
"3W B2C": "3W B2C",
|
|
92
93
|
"Determining transaction type...": "Determinazione tipo di transazione...",
|
|
93
94
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
94
95
|
"Questa fattura non sarà fiscalizzata (transazione non nazionale)",
|
|
@@ -87,7 +87,8 @@ export default {
|
|
|
87
87
|
Domestic: "Binnenland",
|
|
88
88
|
"EU B2B": "EU B2B",
|
|
89
89
|
"EU B2C": "EU B2C",
|
|
90
|
-
|
|
90
|
+
"3W B2B": "3W B2B",
|
|
91
|
+
"3W B2C": "3W B2C",
|
|
91
92
|
"Determining transaction type...": "Transactietype bepalen...",
|
|
92
93
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
93
94
|
"Deze factuur wordt niet gefiscaliseerd (niet-binnenlandse transactie)",
|
|
@@ -85,7 +85,8 @@ export default {
|
|
|
85
85
|
Domestic: "Krajowa",
|
|
86
86
|
"EU B2B": "EU B2B",
|
|
87
87
|
"EU B2C": "EU B2C",
|
|
88
|
-
|
|
88
|
+
"3W B2B": "3W B2B",
|
|
89
|
+
"3W B2C": "3W B2C",
|
|
89
90
|
"Determining transaction type...": "Określanie typu transakcji...",
|
|
90
91
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
91
92
|
"Ta faktura nie będzie fiskalizowana (transakcja niekrajowa)",
|
|
@@ -85,7 +85,8 @@ export default {
|
|
|
85
85
|
Domestic: "Nacional",
|
|
86
86
|
"EU B2B": "EU B2B",
|
|
87
87
|
"EU B2C": "EU B2C",
|
|
88
|
-
|
|
88
|
+
"3W B2B": "3W B2B",
|
|
89
|
+
"3W B2C": "3W B2C",
|
|
89
90
|
"Determining transaction type...": "Determinando tipo de transação...",
|
|
90
91
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
91
92
|
"Esta fatura não será fiscalizada (transação não nacional)",
|
|
@@ -84,7 +84,8 @@ export default {
|
|
|
84
84
|
Domestic: "Domača",
|
|
85
85
|
"EU B2B": "EU B2B",
|
|
86
86
|
"EU B2C": "EU B2C",
|
|
87
|
-
|
|
87
|
+
"3W B2B": "3W B2B",
|
|
88
|
+
"3W B2C": "3W B2C",
|
|
88
89
|
"Determining transaction type...": "Določanje vrste transakcije...",
|
|
89
90
|
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
90
91
|
"Ta račun ne bo fiskaliziran (nedomača transakcija)",
|
|
@@ -4,6 +4,7 @@ import { useCallback, useMemo, useState } from "react";
|
|
|
4
4
|
import { DataTable } from "@/ui/components/table/data-table";
|
|
5
5
|
import { FormattedDate } from "@/ui/components/table/date-cell";
|
|
6
6
|
import { useTableFetch } from "@/ui/components/table/hooks/use-table-fetch";
|
|
7
|
+
import { withTableTranslations } from "@/ui/components/table/locales";
|
|
7
8
|
import { SelectionToolbar } from "@/ui/components/table/selection-toolbar";
|
|
8
9
|
import type {
|
|
9
10
|
Column,
|
|
@@ -31,7 +32,7 @@ import pl from "./locales/pl";
|
|
|
31
32
|
import pt from "./locales/pt";
|
|
32
33
|
import sl from "./locales/sl";
|
|
33
34
|
|
|
34
|
-
const translations = {
|
|
35
|
+
const translations = withTableTranslations({
|
|
35
36
|
en,
|
|
36
37
|
sl,
|
|
37
38
|
de,
|
|
@@ -42,12 +43,13 @@ const translations = {
|
|
|
42
43
|
nl,
|
|
43
44
|
pl,
|
|
44
45
|
hr,
|
|
45
|
-
} as const;
|
|
46
|
+
} as const);
|
|
46
47
|
|
|
47
48
|
type CreditNoteListTableProps = {
|
|
48
49
|
t?: (key: string) => string;
|
|
49
50
|
namespace?: string;
|
|
50
51
|
locale?: string;
|
|
52
|
+
translationLocale?: string;
|
|
51
53
|
entityId?: string;
|
|
52
54
|
onView?: (creditNote: CreditNote) => void;
|
|
53
55
|
onAddPayment?: (creditNote: CreditNote) => void;
|
|
@@ -84,6 +86,7 @@ export default function CreditNoteListTable({
|
|
|
84
86
|
}: CreditNoteListTableProps) {
|
|
85
87
|
const t = createTranslation({
|
|
86
88
|
translations,
|
|
89
|
+
locale: i18nProps.translationLocale ?? i18nProps.locale,
|
|
87
90
|
...i18nProps,
|
|
88
91
|
});
|
|
89
92
|
|
|
@@ -209,7 +212,7 @@ export default function CreditNoteListTable({
|
|
|
209
212
|
{
|
|
210
213
|
id: "date",
|
|
211
214
|
header: t("Date"),
|
|
212
|
-
cell: (creditNote) => <FormattedDate date={creditNote.date} />,
|
|
215
|
+
cell: (creditNote) => <FormattedDate date={creditNote.date} locale={i18nProps.locale} />,
|
|
213
216
|
},
|
|
214
217
|
{
|
|
215
218
|
id: "total",
|