@spaceinvoices/react-ui 0.4.11 → 0.4.12
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 +3 -2
- package/registry.json +30 -31
- package/src/common/autocomplete.tsx +41 -25
- package/src/components/activities/locales/bg.ts +21 -0
- package/src/components/activities/locales/cs.ts +21 -0
- package/src/components/activities/locales/en.ts +21 -0
- package/src/components/activities/locales/et.ts +21 -0
- package/src/components/activities/locales/fi.ts +21 -0
- package/src/components/activities/locales/is.ts +21 -0
- package/src/components/activities/locales/nb.ts +21 -0
- package/src/components/activities/locales/sk.ts +21 -0
- package/src/components/activities/locales/sv.ts +21 -0
- package/src/components/advance-invoices/advance-invoices.hooks.ts +2 -3
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +290 -69
- package/src/components/advance-invoices/create/locales/bg.ts +48 -0
- package/src/components/advance-invoices/create/locales/cs.ts +48 -0
- package/src/components/advance-invoices/create/locales/en.ts +48 -0
- package/src/components/advance-invoices/create/locales/et.ts +48 -0
- package/src/components/advance-invoices/create/locales/fi.ts +48 -0
- package/src/components/advance-invoices/create/locales/hr.ts +17 -17
- package/src/components/advance-invoices/create/locales/is.ts +48 -0
- package/src/components/advance-invoices/create/locales/nb.ts +48 -0
- package/src/components/advance-invoices/create/locales/sk.ts +48 -0
- package/src/components/advance-invoices/create/locales/sl.ts +9 -7
- package/src/components/advance-invoices/create/locales/sv.ts +48 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +16 -2
- package/src/components/advance-invoices/list/list-row-actions.tsx +48 -16
- package/src/components/advance-invoices/list/list-table.tsx +33 -8
- package/src/components/advance-invoices/list/locales/bg.ts +51 -0
- package/src/components/advance-invoices/list/locales/cs.ts +51 -0
- package/src/components/advance-invoices/list/locales/en.ts +33 -2
- package/src/components/advance-invoices/list/locales/et.ts +51 -0
- package/src/components/advance-invoices/list/locales/fi.ts +51 -0
- package/src/components/advance-invoices/list/locales/hr.ts +15 -15
- package/src/components/advance-invoices/list/locales/is.ts +51 -0
- package/src/components/advance-invoices/list/locales/nb.ts +51 -0
- package/src/components/advance-invoices/list/locales/sk.ts +51 -0
- package/src/components/advance-invoices/list/locales/sv.ts +51 -0
- package/src/components/advance-invoices/list/use-advance-invoice-download.ts +3 -5
- package/src/components/common/autocomplete-locales.ts +101 -0
- package/src/components/company-registry/company-registry.hooks.ts +3 -7
- package/src/components/credit-notes/create/create-credit-note-form.tsx +211 -22
- package/src/components/credit-notes/create/locales/bg.ts +87 -0
- package/src/components/credit-notes/create/locales/cs.ts +87 -0
- package/src/components/credit-notes/create/locales/en.ts +87 -0
- package/src/components/credit-notes/create/locales/et.ts +87 -0
- package/src/components/credit-notes/create/locales/fi.ts +87 -0
- package/src/components/credit-notes/create/locales/hr.ts +24 -24
- package/src/components/credit-notes/create/locales/is.ts +87 -0
- package/src/components/credit-notes/create/locales/nb.ts +87 -0
- package/src/components/credit-notes/create/locales/sk.ts +87 -0
- package/src/components/credit-notes/create/locales/sl.ts +9 -9
- package/src/components/credit-notes/create/locales/sv.ts +87 -0
- package/src/components/credit-notes/create/prepare-credit-note-submission.ts +32 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +15 -3
- package/src/components/credit-notes/list/list-row-actions.tsx +19 -7
- package/src/components/credit-notes/list/list-table.tsx +58 -7
- package/src/components/credit-notes/list/locales/bg.ts +48 -0
- package/src/components/credit-notes/list/locales/cs.ts +48 -0
- package/src/components/credit-notes/list/locales/en.ts +31 -2
- package/src/components/credit-notes/list/locales/et.ts +48 -0
- package/src/components/credit-notes/list/locales/fi.ts +48 -0
- package/src/components/credit-notes/list/locales/hr.ts +12 -12
- package/src/components/credit-notes/list/locales/is.ts +48 -0
- package/src/components/credit-notes/list/locales/nb.ts +48 -0
- package/src/components/credit-notes/list/locales/sk.ts +48 -0
- package/src/components/credit-notes/list/locales/sv.ts +48 -0
- package/src/components/credit-notes/list/use-credit-note-download.ts +3 -5
- package/src/components/customers/create-customer-form/locales/bg.ts +21 -0
- package/src/components/customers/create-customer-form/locales/cs.ts +21 -0
- package/src/components/customers/create-customer-form/locales/en.ts +21 -0
- package/src/components/customers/create-customer-form/locales/et.ts +21 -0
- package/src/components/customers/create-customer-form/locales/fi.ts +21 -0
- package/src/components/customers/create-customer-form/locales/hr.ts +11 -11
- package/src/components/customers/create-customer-form/locales/is.ts +21 -0
- package/src/components/customers/create-customer-form/locales/nb.ts +21 -0
- package/src/components/customers/create-customer-form/locales/sk.ts +21 -0
- package/src/components/customers/create-customer-form/locales/sv.ts +21 -0
- package/src/components/customers/customer-autocomplete.tsx +32 -4
- package/src/components/customers/customer-list-table/customer-list-table.tsx +8 -6
- package/src/components/customers/customer-list-table/locales/bg.ts +25 -0
- package/src/components/customers/customer-list-table/locales/cs.ts +25 -0
- package/src/components/customers/customer-list-table/locales/en.ts +17 -2
- package/src/components/customers/customer-list-table/locales/et.ts +25 -0
- package/src/components/customers/customer-list-table/locales/fi.ts +25 -0
- package/src/components/customers/customer-list-table/locales/hr.ts +11 -11
- package/src/components/customers/customer-list-table/locales/is.ts +25 -0
- package/src/components/customers/customer-list-table/locales/nb.ts +25 -0
- package/src/components/customers/customer-list-table/locales/sk.ts +25 -0
- package/src/components/customers/customer-list-table/locales/sv.ts +25 -0
- package/src/components/customers/customers.hooks.ts +14 -17
- package/src/components/customers/edit-customer-form/locales/bg.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/cs.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/en.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/et.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/fi.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/hr.ts +5 -5
- package/src/components/customers/edit-customer-form/locales/is.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/nb.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/sk.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/sv.ts +13 -0
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +7 -6
- package/src/components/dashboard/collection-rate-card/locales/en.ts +3 -0
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +8 -7
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +7 -4
- package/src/components/dashboard/invoice-status-chart/locales/bg.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/cs.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/de.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/en.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/es.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/et.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/fi.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/fr.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/hr.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/is.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/it.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/nb.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/nl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/pl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/pt.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/sk.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/sl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/sv.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/bg.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/cs.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/en.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/et.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/fi.ts +6 -6
- package/src/components/dashboard/payment-methods-chart/locales/hr.ts +3 -3
- package/src/components/dashboard/payment-methods-chart/locales/is.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/nb.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/sk.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/sv.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +4 -3
- package/src/components/dashboard/payment-trend-chart/locales/bg.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/cs.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/en.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/et.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/fi.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/is.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/nb.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/sk.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/sv.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +4 -3
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +12 -9
- package/src/components/dashboard/revenue-card.tsx +3 -3
- package/src/components/dashboard/revenue-trend-chart/locales/bg.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/cs.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/en.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/et.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/fi.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/is.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/nb.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/sk.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/sv.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +4 -3
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +4 -3
- package/src/components/dashboard/shared/local-date.ts +11 -0
- package/src/components/dashboard/shared/use-revenue-data.ts +6 -5
- package/src/components/dashboard/shared/use-stats-query.ts +7 -11
- package/src/components/dashboard/stat-card.tsx +3 -3
- package/src/components/dashboard/tax-collected-card/tax-collected-card.tsx +11 -9
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +3 -2
- package/src/components/dashboard/top-customers-chart/locales/bg.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/cs.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/en.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/et.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/fi.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/is.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/nb.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/sk.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/sv.ts +2 -2
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +4 -3
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +7 -20
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +61 -31
- package/src/components/delivery-notes/create/locales/bg.ts +68 -0
- package/src/components/delivery-notes/create/locales/cs.ts +68 -0
- package/src/components/delivery-notes/create/locales/en.ts +68 -0
- package/src/components/delivery-notes/create/locales/et.ts +68 -0
- package/src/components/delivery-notes/create/locales/fi.ts +68 -0
- package/src/components/delivery-notes/create/locales/hr.ts +6 -6
- package/src/components/delivery-notes/create/locales/is.ts +68 -0
- package/src/components/delivery-notes/create/locales/nb.ts +68 -0
- package/src/components/delivery-notes/create/locales/sk.ts +68 -0
- package/src/components/delivery-notes/create/locales/sl.ts +5 -5
- package/src/components/delivery-notes/create/locales/sv.ts +68 -0
- package/src/components/delivery-notes/delivery-notes.hooks.ts +20 -3
- package/src/components/delivery-notes/list/list-row-actions.tsx +62 -16
- package/src/components/delivery-notes/list/list-table.tsx +42 -9
- package/src/components/delivery-notes/list/locales/bg.ts +40 -0
- package/src/components/delivery-notes/list/locales/cs.ts +40 -0
- package/src/components/delivery-notes/list/locales/et.ts +40 -0
- package/src/components/delivery-notes/list/locales/fi.ts +40 -0
- package/src/components/delivery-notes/list/locales/is.ts +40 -0
- package/src/components/delivery-notes/list/locales/nb.ts +40 -0
- package/src/components/delivery-notes/list/locales/sk.ts +40 -0
- package/src/components/delivery-notes/list/locales/sv.ts +40 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +3 -5
- package/src/components/documents/create/document-add-item-form.tsx +256 -147
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +2 -1
- package/src/components/documents/create/document-details-section.tsx +30 -12
- package/src/components/documents/create/document-item-validation.ts +50 -0
- package/src/components/documents/create/document-items-section.tsx +44 -6
- package/src/components/documents/create/document-recipient-section.tsx +10 -2
- package/src/components/documents/create/linked-documents-info.tsx +4 -3
- package/src/components/documents/create/live-preview.tsx +19 -15
- package/src/components/documents/create/mark-as-paid-section.tsx +77 -20
- package/src/components/documents/create/payment-rows.ts +291 -0
- package/src/components/documents/create/prepare-document-submission.ts +24 -13
- package/src/components/documents/create/scroll-to-first-invalid-field.ts +27 -0
- package/src/components/documents/create/smart-code-insert-button.tsx +5 -53
- package/src/components/documents/create/use-document-customer-form.ts +74 -25
- package/src/components/documents/documents.hooks.ts +3 -5
- package/src/components/documents/index.ts +1 -0
- package/src/components/documents/public/index.ts +1 -0
- package/src/components/documents/public/public-document-summary.tsx +343 -0
- package/src/components/documents/shared/document-preview-display.tsx +65 -39
- package/src/components/documents/shared/index.ts +6 -1
- package/src/components/documents/shared/scaled-document-preview.tsx +33 -19
- package/src/components/documents/types.ts +24 -0
- package/src/components/documents/view/document-actions-bar.tsx +241 -62
- package/src/components/documents/view/document-activities-list.tsx +23 -11
- package/src/components/documents/view/document-details-card.tsx +7 -27
- package/src/components/documents/view/document-payments-list.tsx +114 -57
- package/src/components/documents/view/document-relations-list.tsx +26 -6
- package/src/components/documents/view/document-sidebar.tsx +25 -3
- package/src/components/documents/view/document-version-history.tsx +137 -0
- package/src/components/documents/view/index.ts +1 -0
- package/src/components/documents/view/locales/bg.ts +143 -0
- package/src/components/documents/view/locales/cs.ts +143 -0
- package/src/components/documents/view/locales/de.ts +13 -0
- package/src/components/documents/view/locales/en.ts +143 -0
- package/src/components/documents/view/locales/es.ts +13 -0
- package/src/components/documents/view/locales/et.ts +143 -0
- package/src/components/documents/view/locales/fi.ts +143 -0
- package/src/components/documents/view/locales/fr.ts +13 -0
- package/src/components/documents/view/locales/hr.ts +13 -0
- package/src/components/documents/view/locales/is.ts +143 -0
- package/src/components/documents/view/locales/it.ts +13 -0
- package/src/components/documents/view/locales/nb.ts +143 -0
- package/src/components/documents/view/locales/nl.ts +13 -0
- package/src/components/documents/view/locales/pl.ts +13 -0
- package/src/components/documents/view/locales/pt.ts +13 -0
- package/src/components/documents/view/locales/sk.ts +143 -0
- package/src/components/documents/view/locales/sl.ts +13 -0
- package/src/components/documents/view/locales/sv.ts +143 -0
- package/src/components/documents/view/use-document-download.ts +18 -17
- package/src/components/entities/create-entity-form.tsx +200 -12
- package/src/components/entities/entities.hooks.ts +15 -7
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +121 -65
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +28 -4
- package/src/components/entities/entity-settings-form/locales/bg.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/cs.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/en.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/et.ts +198 -0
- package/src/components/entities/entity-settings-form/locales/fi.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/hr.ts +16 -11
- package/src/components/entities/entity-settings-form/locales/is.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/nb.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/pl.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/pt.ts +8 -3
- package/src/components/entities/entity-settings-form/locales/sk.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +20 -15
- package/src/components/entities/entity-settings-form/locales/sv.ts +205 -0
- package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +34 -9
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +2 -0
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +14 -45
- package/src/components/entities/fina-settings-form/locales/bg.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/cs.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/et.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/fi.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/hr.ts +11 -10
- package/src/components/entities/fina-settings-form/locales/is.ts +164 -0
- package/src/components/entities/fina-settings-form/locales/nb.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/sk.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/sl.ts +8 -7
- package/src/components/entities/fina-settings-form/locales/sv.ts +165 -0
- package/src/components/entities/furs-settings-form/furs-operator-required-dialog.tsx +34 -9
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +13 -1
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +141 -42
- package/src/components/entities/furs-settings-form/locales/bg.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/cs.ts +241 -0
- package/src/components/entities/furs-settings-form/locales/de.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/en.ts +24 -0
- package/src/components/entities/furs-settings-form/locales/es.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/et.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/fi.ts +243 -0
- package/src/components/entities/furs-settings-form/locales/fr.ts +43 -15
- package/src/components/entities/furs-settings-form/locales/hr.ts +44 -19
- package/src/components/entities/furs-settings-form/locales/is.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/it.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/nb.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/nl.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/pl.ts +40 -15
- package/src/components/entities/furs-settings-form/locales/pt.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/sk.ts +243 -0
- package/src/components/entities/furs-settings-form/locales/sl.ts +34 -10
- package/src/components/entities/furs-settings-form/locales/sv.ts +242 -0
- package/src/components/entities/furs-settings-form/sections/enable-fiscalization-section.tsx +11 -0
- package/src/components/entities/furs-settings-form/sections/furs-internal-act-download-card.tsx +111 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +27 -0
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +23 -16
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +89 -31
- package/src/components/entities/settings/branding-settings-form.tsx +11 -30
- package/src/components/entities/settings/company-settings-form.tsx +2 -1
- package/src/components/entities/settings/defaults-settings-form.tsx +106 -3
- package/src/components/entities/settings/email-settings-form.tsx +245 -3
- package/src/components/entities/settings/eslog-settings-form.tsx +2 -1
- package/src/components/entities/settings/number-format-settings-form.tsx +2 -1
- package/src/components/entities/settings/pdf-template-selector/locales/bg.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/cs.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/en.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/et.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/fi.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/is.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/nb.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/sk.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/sv.ts +19 -0
- package/src/components/entities/settings/tax-rules-settings-form.tsx +21 -6
- package/src/components/estimates/create/create-estimate-form.tsx +70 -34
- package/src/components/estimates/create/locales/bg.ts +76 -0
- package/src/components/estimates/create/locales/cs.ts +76 -0
- package/src/components/estimates/create/locales/en.ts +76 -0
- package/src/components/estimates/create/locales/et.ts +76 -0
- package/src/components/estimates/create/locales/fi.ts +76 -0
- package/src/components/estimates/create/locales/hr.ts +8 -8
- package/src/components/estimates/create/locales/is.ts +76 -0
- package/src/components/estimates/create/locales/nb.ts +76 -0
- package/src/components/estimates/create/locales/sk.ts +76 -0
- package/src/components/estimates/create/locales/sl.ts +8 -8
- package/src/components/estimates/create/locales/sv.ts +76 -0
- package/src/components/estimates/create/prepare-estimate-submission.ts +4 -1
- package/src/components/estimates/estimates.hooks.ts +15 -3
- package/src/components/estimates/list/list-row-actions.tsx +34 -7
- package/src/components/estimates/list/list-table.tsx +78 -10
- package/src/components/estimates/list/locales/bg.ts +38 -0
- package/src/components/estimates/list/locales/cs.ts +38 -0
- package/src/components/estimates/list/locales/en.ts +27 -2
- package/src/components/estimates/list/locales/et.ts +38 -0
- package/src/components/estimates/list/locales/fi.ts +38 -0
- package/src/components/estimates/list/locales/hr.ts +2 -2
- package/src/components/estimates/list/locales/is.ts +38 -0
- package/src/components/estimates/list/locales/nb.ts +38 -0
- package/src/components/estimates/list/locales/sk.ts +38 -0
- package/src/components/estimates/list/locales/sv.ts +38 -0
- package/src/components/estimates/list/use-estimate-download.ts +3 -5
- package/src/components/export/document-export-form.tsx +72 -15
- package/src/components/export/sales-per-item-export-form.tsx +3 -2
- package/src/components/invoices/create/create-invoice-form.tsx +294 -76
- package/src/components/invoices/create/eslog-validation.ts +97 -8
- package/src/components/invoices/create/locales/bg.ts +164 -0
- package/src/components/invoices/create/locales/cs.ts +164 -0
- package/src/components/invoices/create/locales/de.ts +24 -0
- package/src/components/invoices/create/locales/en.ts +164 -0
- package/src/components/invoices/create/locales/es.ts +24 -0
- package/src/components/invoices/create/locales/et.ts +164 -0
- package/src/components/invoices/create/locales/fi.ts +164 -0
- package/src/components/invoices/create/locales/fr.ts +23 -0
- package/src/components/invoices/create/locales/hr.ts +32 -9
- package/src/components/invoices/create/locales/is.ts +164 -0
- package/src/components/invoices/create/locales/it.ts +24 -0
- package/src/components/invoices/create/locales/nb.ts +164 -0
- package/src/components/invoices/create/locales/nl.ts +23 -0
- package/src/components/invoices/create/locales/pl.ts +23 -0
- package/src/components/invoices/create/locales/pt.ts +24 -0
- package/src/components/invoices/create/locales/sk.ts +164 -0
- package/src/components/invoices/create/locales/sl.ts +32 -9
- package/src/components/invoices/create/locales/sv.ts +166 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +19 -2
- package/src/components/invoices/invoices-furs.hooks.ts +11 -8
- package/src/components/invoices/invoices.hooks.ts +27 -10
- package/src/components/invoices/list/list-row-actions.tsx +54 -21
- package/src/components/invoices/list/list-table.tsx +92 -11
- package/src/components/invoices/list/locales/bg.ts +49 -0
- package/src/components/invoices/list/locales/cs.ts +49 -0
- package/src/components/invoices/list/locales/en.ts +34 -2
- package/src/components/invoices/list/locales/et.ts +49 -0
- package/src/components/invoices/list/locales/fi.ts +49 -0
- package/src/components/invoices/list/locales/is.ts +49 -0
- package/src/components/invoices/list/locales/nb.ts +49 -0
- package/src/components/invoices/list/locales/sk.ts +49 -0
- package/src/components/invoices/list/locales/sv.ts +49 -0
- package/src/components/invoices/list/use-invoice-download.ts +3 -5
- package/src/components/invoices/send-email-dialog/locales/bg.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/cs.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/de.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/en.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/et.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/fi.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/is.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/nb.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/sk.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +21 -0
- package/src/components/invoices/send-email-dialog/locales/sv.ts +58 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +188 -93
- package/src/components/invoices/view/eslog-info-display.tsx +2 -0
- package/src/components/invoices/view/fiscalization-status-card.tsx +2 -0
- package/src/components/items/create-item-form/create-item-form.tsx +29 -0
- package/src/components/items/create-item-form/locales/bg.ts +13 -0
- package/src/components/items/create-item-form/locales/cs.ts +13 -0
- package/src/components/items/create-item-form/locales/et.ts +13 -0
- package/src/components/items/create-item-form/locales/fi.ts +13 -0
- package/src/components/items/create-item-form/locales/is.ts +13 -0
- package/src/components/items/create-item-form/locales/nb.ts +13 -0
- package/src/components/items/create-item-form/locales/sk.ts +13 -0
- package/src/components/items/create-item-form/locales/sv.ts +13 -0
- package/src/components/items/edit-item-form/edit-item-form.tsx +39 -1
- package/src/components/items/edit-item-form/locales/bg.ts +12 -0
- package/src/components/items/edit-item-form/locales/cs.ts +12 -0
- package/src/components/items/edit-item-form/locales/en.ts +12 -0
- package/src/components/items/edit-item-form/locales/et.ts +12 -0
- package/src/components/items/edit-item-form/locales/fi.ts +12 -0
- package/src/components/items/edit-item-form/locales/is.ts +12 -0
- package/src/components/items/edit-item-form/locales/nb.ts +12 -0
- package/src/components/items/edit-item-form/locales/sk.ts +12 -0
- package/src/components/items/edit-item-form/locales/sv.ts +12 -0
- package/src/components/items/item-combobox.tsx +51 -18
- package/src/components/items/item-list-table/item-list-table.tsx +47 -23
- package/src/components/items/item-list-table/locales/bg.ts +16 -0
- package/src/components/items/item-list-table/locales/cs.ts +16 -0
- package/src/components/items/item-list-table/locales/en.ts +4 -3
- package/src/components/items/item-list-table/locales/et.ts +16 -0
- package/src/components/items/item-list-table/locales/fi.ts +16 -0
- package/src/components/items/item-list-table/locales/is.ts +16 -0
- package/src/components/items/item-list-table/locales/nb.ts +16 -0
- package/src/components/items/item-list-table/locales/sk.ts +16 -0
- package/src/components/items/item-list-table/locales/sv.ts +16 -0
- package/src/components/items/items.hooks.ts +15 -15
- package/src/components/payments/create-payment-form/create-payment-form.tsx +11 -7
- package/src/components/payments/create-payment-form/locales/bg.ts +20 -0
- package/src/components/payments/create-payment-form/locales/cs.ts +20 -0
- package/src/components/payments/create-payment-form/locales/en.ts +20 -0
- package/src/components/payments/create-payment-form/locales/et.ts +20 -0
- package/src/components/payments/create-payment-form/locales/fi.ts +20 -0
- package/src/components/payments/create-payment-form/locales/hr.ts +2 -2
- package/src/components/payments/create-payment-form/locales/is.ts +20 -0
- package/src/components/payments/create-payment-form/locales/nb.ts +20 -0
- package/src/components/payments/create-payment-form/locales/sk.ts +20 -0
- package/src/components/payments/create-payment-form/locales/sl.ts +4 -4
- package/src/components/payments/create-payment-form/locales/sv.ts +20 -0
- package/src/components/payments/edit-payment-form/edit-payment-form.tsx +5 -1
- package/src/components/payments/edit-payment-form/locales/bg.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/cs.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/en.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/et.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/fi.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/hr.ts +2 -2
- package/src/components/payments/edit-payment-form/locales/is.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/nb.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/sk.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/sl.ts +4 -4
- package/src/components/payments/edit-payment-form/locales/sv.ts +20 -0
- package/src/components/payments/list/list-row-actions.tsx +10 -2
- package/src/components/payments/list/list-table.tsx +51 -45
- package/src/components/payments/list/locales/bg.ts +42 -0
- package/src/components/payments/list/locales/cs.ts +42 -0
- package/src/components/payments/list/locales/de.ts +18 -0
- package/src/components/payments/list/locales/en.ts +37 -2
- package/src/components/payments/list/locales/es.ts +18 -0
- package/src/components/payments/list/locales/et.ts +42 -0
- package/src/components/payments/list/locales/fi.ts +42 -0
- package/src/components/payments/list/locales/fr.ts +18 -0
- package/src/components/payments/list/locales/hr.ts +18 -0
- package/src/components/payments/list/locales/is.ts +42 -0
- package/src/components/payments/list/locales/it.ts +18 -0
- package/src/components/payments/list/locales/nb.ts +42 -0
- package/src/components/payments/list/locales/nl.ts +18 -0
- package/src/components/payments/list/locales/pl.ts +18 -0
- package/src/components/payments/list/locales/pt.ts +18 -0
- package/src/components/payments/list/locales/sk.ts +42 -0
- package/src/components/payments/list/locales/sl.ts +18 -1
- package/src/components/payments/list/locales/sv.ts +42 -0
- package/src/components/payments/payments.hooks.ts +13 -6
- package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +23 -17
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/bg.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/cs.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/en.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/et.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fi.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +6 -6
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/is.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nb.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sk.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +4 -4
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sv.ts +44 -0
- package/src/components/recurring-invoices/list/list-row-actions.tsx +3 -5
- package/src/components/recurring-invoices/list/list-table.tsx +10 -7
- package/src/components/recurring-invoices/list/locales/bg.ts +28 -0
- package/src/components/recurring-invoices/list/locales/cs.ts +28 -0
- package/src/components/recurring-invoices/list/locales/en.ts +23 -0
- package/src/components/recurring-invoices/list/locales/et.ts +28 -0
- package/src/components/recurring-invoices/list/locales/fi.ts +28 -0
- package/src/components/recurring-invoices/list/locales/is.ts +28 -0
- package/src/components/recurring-invoices/list/locales/nb.ts +28 -0
- package/src/components/recurring-invoices/list/locales/sk.ts +28 -0
- package/src/components/recurring-invoices/list/locales/sv.ts +28 -0
- package/src/components/recurring-invoices/recurring-invoices.hooks.ts +11 -8
- package/src/components/request-logs/request-log-detail.tsx +30 -23
- package/src/components/request-logs/request-log-list-table.tsx +88 -45
- package/src/components/table/README.md +47 -9
- package/src/components/table/data-table.tsx +232 -92
- package/src/components/table/filter-bar.tsx +1 -1
- package/src/components/table/filter-panel.tsx +51 -22
- package/src/components/table/hooks/use-table-state.ts +64 -11
- package/src/components/table/index.ts +3 -0
- package/src/components/table/locales.ts +119 -4
- package/src/components/table/selection-toolbar.tsx +65 -9
- package/src/components/table/sorting.ts +80 -0
- package/src/components/table/table-skeleton.tsx +15 -9
- package/src/components/table/types.ts +17 -0
- package/src/components/tax-reports/index.ts +8 -0
- package/src/components/tax-reports/kir-export-form.tsx +4 -5
- package/src/components/tax-reports/slovenia-accounting-mappings-fields.tsx +271 -0
- package/src/components/tax-reports/slovenia-tax-profile-step.tsx +21 -10
- package/src/components/tax-reports/slovenia-vod-export-form.tsx +452 -0
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +17 -16
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +40 -18
- package/src/components/taxes/create-tax-form/create-tax-form.tsx +48 -2
- package/src/components/taxes/create-tax-form/locales/bg.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/cs.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/et.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/fi.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/is.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/nb.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/sk.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/sv.ts +8 -0
- package/src/components/taxes/edit-tax-form/edit-tax-form.tsx +80 -11
- package/src/components/taxes/edit-tax-form/locales/bg.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/cs.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/en.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/et.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/fi.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/is.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/nb.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/sk.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/sv.ts +6 -0
- package/src/components/taxes/tax-list-table/locales/bg.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/cs.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/en.ts +4 -3
- package/src/components/taxes/tax-list-table/locales/et.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/fi.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/is.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/nb.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/sk.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/sv.ts +17 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +53 -19
- package/src/components/taxes/taxes.hooks.ts +53 -12
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/drawer.tsx +2 -2
- package/src/components/ui/form.tsx +118 -2
- package/src/components/ui/progress.tsx +6 -4
- package/src/components/ui/select.tsx +118 -1
- package/src/components/ui/sonner.tsx +17 -36
- package/src/components/ui/sticky-form-footer.tsx +6 -1
- package/src/components/ui/tooltip.tsx +15 -2
- package/src/components/webhook-logs/webhook-delivery-detail.tsx +22 -22
- package/src/components/webhook-logs/webhook-delivery-list-table.tsx +92 -17
- package/src/components/wl-subscription/locked-feature.tsx +11 -10
- package/src/components/wl-subscription/paywall.tsx +184 -72
- package/src/components/wl-subscription/upgrade-modal.tsx +28 -31
- package/src/generate-schemas.ts +14 -4
- package/src/generated/schemas/account_webhook.ts +43 -0
- package/src/generated/schemas/accountwebhook.ts +67 -0
- package/src/generated/schemas/entity.ts +255 -16
- package/src/generated/schemas/exportsloveniavodxml_body.ts +16 -0
- package/src/generated/schemas/furssettings.ts +1 -0
- package/src/generated/schemas/incomingpurchasedocument.ts +198 -0
- package/src/generated/schemas/incomingpurchasedocumentpayment.ts +38 -0
- package/src/generated/schemas/index.ts +10 -0
- package/src/generated/schemas/item.ts +36 -0
- package/src/generated/schemas/me.ts +23 -19
- package/src/generated/schemas/order.ts +2 -0
- package/src/generated/schemas/orderintegration.ts +8 -4
- package/src/generated/schemas/payment.ts +5 -0
- package/src/generated/schemas/ptatcudseries.ts +30 -0
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +35 -3
- package/src/generated/schemas/rendercreditnotepreview_body.ts +35 -3
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +12 -5
- package/src/generated/schemas/renderestimatepreview_body.ts +38 -5
- package/src/generated/schemas/renderinvoicepreview_body.ts +39 -5
- package/src/generated/schemas/senddocument_body.ts +1 -0
- package/src/generated/schemas/sendemail_body.ts +67 -39
- package/src/generated/schemas/sloveniataxprofile.ts +97 -21
- package/src/generated/schemas/starteslogexport_body.ts +33 -0
- package/src/generated/schemas/startpdfexport_body.ts +94 -78
- package/src/generated/schemas/supplier.ts +59 -0
- package/src/generated/schemas/syncshopifyorders_body.ts +20 -0
- package/src/generated/schemas/tax.ts +2 -0
- package/src/generated/schemas/uploadfile_body.ts +1 -0
- package/src/generated/schemas/userptsettings.ts +26 -0
- package/src/generated/schemas/voidinvoice_body.ts +20 -0
- package/src/generated/schemas/webhook.ts +2 -0
- package/src/hooks/create-resource-hooks.ts +22 -19
- package/src/hooks/use-duplicate-document.ts +10 -8
- package/src/hooks/use-eslog-validation.ts +5 -1
- package/src/hooks/use-next-document-number.ts +13 -6
- package/src/hooks/use-resolved-entity-id.ts +14 -0
- package/src/hooks/use-resource-mutation.ts +11 -30
- package/src/hooks/use-transaction-type-check.ts +3 -8
- package/src/lib/browser-cookies.ts +1 -1
- package/src/lib/country-capabilities.ts +114 -0
- package/src/lib/date-fns-locale.ts +1 -20
- package/src/lib/eslog-export.ts +32 -0
- package/src/lib/fiscalization-options.ts +21 -1
- package/src/lib/formatting.ts +27 -0
- package/src/lib/furs-error-utils.ts +29 -0
- package/src/lib/locale.ts +4 -0
- package/src/lib/payment-display.ts +95 -0
- package/src/lib/pt-document-input.ts +67 -0
- package/src/lib/schemas/shared.ts +1 -0
- package/src/lib/template-variables.tsx +102 -4
- package/src/lib/translation.ts +51 -33
- package/src/lib/white-label-capabilities.ts +626 -0
- package/src/lib/zod-validation-message.ts +291 -0
- package/src/providers/entities-provider.tsx +32 -14
- package/src/providers/sdk-provider.tsx +112 -12
- package/src/providers/space-invoices-provider.tsx +129 -0
- package/src/providers/white-label-provider.tsx +96 -4
- package/src/providers/wl-subscription-provider.tsx +144 -10
|
@@ -5,18 +5,28 @@ import type { ReactNode } from "react";
|
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import type { Resolver } from "react-hook-form";
|
|
7
7
|
import { useForm, useWatch } from "react-hook-form";
|
|
8
|
+
import type { z } from "zod";
|
|
8
9
|
import { Alert, AlertDescription, AlertTitle } from "@/ui/components/ui/alert";
|
|
9
10
|
import { Button } from "@/ui/components/ui/button";
|
|
10
|
-
import { Form } from "@/ui/components/ui/form";
|
|
11
|
+
import { Form, FormRoot } from "@/ui/components/ui/form";
|
|
11
12
|
import { Skeleton } from "@/ui/components/ui/skeleton";
|
|
12
13
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/ui/components/ui/tooltip";
|
|
13
|
-
import type { CreateAdvanceInvoiceSchema } from "@/ui/generated/schemas";
|
|
14
14
|
import { createAdvanceInvoiceSchema } from "@/ui/generated/schemas";
|
|
15
15
|
import { useEslogValidation } from "@/ui/hooks/use-eslog-validation";
|
|
16
16
|
import { useNextDocumentNumber } from "@/ui/hooks/use-next-document-number";
|
|
17
17
|
import { usePremiseSelection } from "@/ui/hooks/use-premise-selection";
|
|
18
18
|
import { useTransactionTypeCheck } from "@/ui/hooks/use-transaction-type-check";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
buildEslogOptions,
|
|
21
|
+
buildFinaOptions,
|
|
22
|
+
buildFursOptions,
|
|
23
|
+
type FiscalizationOperatorOverride,
|
|
24
|
+
} from "@/ui/lib/fiscalization-options";
|
|
25
|
+
import {
|
|
26
|
+
normalizePtDocumentInput,
|
|
27
|
+
type PtDocumentInputForm,
|
|
28
|
+
ptDocumentInputFormSchema,
|
|
29
|
+
} from "@/ui/lib/pt-document-input";
|
|
20
30
|
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
21
31
|
import { createTranslation } from "@/ui/lib/translation";
|
|
22
32
|
import { cn } from "@/ui/lib/utils";
|
|
@@ -29,12 +39,39 @@ import {
|
|
|
29
39
|
DocumentSignatureField,
|
|
30
40
|
DocumentTaxClauseField,
|
|
31
41
|
} from "../../documents/create/document-details-section";
|
|
42
|
+
import { withRequiredDocumentItemFields } from "../../documents/create/document-item-validation";
|
|
32
43
|
import { DocumentItemsSection, type PriceModesMap } from "../../documents/create/document-items-section";
|
|
33
44
|
import { DocumentRecipientSection } from "../../documents/create/document-recipient-section";
|
|
34
45
|
import { MarkAsPaidSection } from "../../documents/create/mark-as-paid-section";
|
|
46
|
+
import {
|
|
47
|
+
calculateDocumentTotal,
|
|
48
|
+
coercePaymentRowsToType,
|
|
49
|
+
createEmptyPaymentRow,
|
|
50
|
+
type DraftPaymentRow,
|
|
51
|
+
getFirstValidPaymentType,
|
|
52
|
+
serializePaymentRows,
|
|
53
|
+
validatePaymentRows,
|
|
54
|
+
} from "../../documents/create/payment-rows";
|
|
55
|
+
import { scrollToFirstInvalidField } from "../../documents/create/scroll-to-first-invalid-field";
|
|
35
56
|
import { useDocumentCustomerForm } from "../../documents/create/use-document-customer-form";
|
|
36
57
|
import type { DocumentTypes } from "../../documents/types";
|
|
37
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
buildEslogFieldErrors,
|
|
60
|
+
getEntityErrors,
|
|
61
|
+
getFormFieldErrors,
|
|
62
|
+
mergeFieldErrors,
|
|
63
|
+
translateEslogValidationError,
|
|
64
|
+
validateEslogForm,
|
|
65
|
+
} from "../../invoices/create/eslog-validation";
|
|
66
|
+
import invoiceDe from "../../invoices/create/locales/de";
|
|
67
|
+
import invoiceEs from "../../invoices/create/locales/es";
|
|
68
|
+
import invoiceFr from "../../invoices/create/locales/fr";
|
|
69
|
+
import invoiceHr from "../../invoices/create/locales/hr";
|
|
70
|
+
import invoiceIt from "../../invoices/create/locales/it";
|
|
71
|
+
import invoiceNl from "../../invoices/create/locales/nl";
|
|
72
|
+
import invoicePl from "../../invoices/create/locales/pl";
|
|
73
|
+
import invoicePt from "../../invoices/create/locales/pt";
|
|
74
|
+
import invoiceSl from "../../invoices/create/locales/sl";
|
|
38
75
|
import { useCreateAdvanceInvoice } from "../advance-invoices.hooks";
|
|
39
76
|
import de from "./locales/de";
|
|
40
77
|
import es from "./locales/es";
|
|
@@ -48,24 +85,33 @@ import sl from "./locales/sl";
|
|
|
48
85
|
import { prepareAdvanceInvoiceSubmission } from "./prepare-advance-invoice-submission";
|
|
49
86
|
|
|
50
87
|
const translations = {
|
|
51
|
-
sl,
|
|
52
|
-
de,
|
|
53
|
-
it,
|
|
54
|
-
fr,
|
|
55
|
-
es,
|
|
56
|
-
pt,
|
|
57
|
-
nl,
|
|
58
|
-
pl,
|
|
59
|
-
hr,
|
|
88
|
+
sl: { ...invoiceSl, ...sl },
|
|
89
|
+
de: { ...invoiceDe, ...de },
|
|
90
|
+
it: { ...invoiceIt, ...it },
|
|
91
|
+
fr: { ...invoiceFr, ...fr },
|
|
92
|
+
es: { ...invoiceEs, ...es },
|
|
93
|
+
pt: { ...invoicePt, ...pt },
|
|
94
|
+
nl: { ...invoiceNl, ...nl },
|
|
95
|
+
pl: { ...invoicePl, ...pl },
|
|
96
|
+
hr: { ...invoiceHr, ...hr },
|
|
60
97
|
} as const;
|
|
98
|
+
const FORM_ID = "create-advance-invoice-form";
|
|
99
|
+
const createAdvanceInvoiceFormSchema = withRequiredDocumentItemFields(
|
|
100
|
+
createAdvanceInvoiceSchema.extend({
|
|
101
|
+
pt: ptDocumentInputFormSchema.optional(),
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
61
104
|
|
|
62
105
|
// Form values: extend schema with local-only fields (number is for display, not sent to API)
|
|
63
|
-
type CreateAdvanceInvoiceFormValues =
|
|
106
|
+
type CreateAdvanceInvoiceFormValues = z.infer<typeof createAdvanceInvoiceFormSchema> & {
|
|
64
107
|
number?: string;
|
|
65
108
|
};
|
|
66
109
|
|
|
67
110
|
/** Preview payload extends request with display-only fields */
|
|
68
|
-
type AdvanceInvoicePreviewPayload = Partial<CreateAdvanceInvoiceRequest> & {
|
|
111
|
+
type AdvanceInvoicePreviewPayload = Partial<CreateAdvanceInvoiceRequest> & {
|
|
112
|
+
number?: string;
|
|
113
|
+
pt?: PtDocumentInputForm;
|
|
114
|
+
};
|
|
69
115
|
|
|
70
116
|
type CreateAdvanceInvoiceFormProps = {
|
|
71
117
|
type: DocumentTypes;
|
|
@@ -77,6 +123,13 @@ type CreateAdvanceInvoiceFormProps = {
|
|
|
77
123
|
onHeaderActionChange?: (action: ReactNode) => void;
|
|
78
124
|
/** Initial values for form fields (used for document duplication) */
|
|
79
125
|
initialValues?: Partial<CreateAdvanceInvoiceRequest>;
|
|
126
|
+
/** Whether draft actions should be available in the UI */
|
|
127
|
+
allowDrafts?: boolean;
|
|
128
|
+
/** Optional app-level content rendered inside the details section. */
|
|
129
|
+
detailsExtras?: ReactNode;
|
|
130
|
+
/** Request-scoped operator override for embed fiscalization flows. */
|
|
131
|
+
operatorPrefill?: FiscalizationOperatorOverride;
|
|
132
|
+
translationLocale?: string;
|
|
80
133
|
} & ComponentTranslationProps;
|
|
81
134
|
|
|
82
135
|
export default function CreateAdvanceInvoiceForm({
|
|
@@ -88,6 +141,10 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
88
141
|
onAddNewTax,
|
|
89
142
|
onHeaderActionChange,
|
|
90
143
|
initialValues,
|
|
144
|
+
allowDrafts = true,
|
|
145
|
+
detailsExtras,
|
|
146
|
+
operatorPrefill,
|
|
147
|
+
translationLocale,
|
|
91
148
|
t: translateProp,
|
|
92
149
|
namespace,
|
|
93
150
|
locale,
|
|
@@ -96,14 +153,18 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
96
153
|
t: translateProp,
|
|
97
154
|
namespace,
|
|
98
155
|
locale,
|
|
156
|
+
translationLocale,
|
|
99
157
|
translations,
|
|
100
158
|
});
|
|
101
159
|
|
|
102
160
|
const { activeEntity } = useEntities();
|
|
103
161
|
|
|
104
|
-
//
|
|
105
|
-
// Note: Advance invoices don't have payment terms - they are documents requesting payment
|
|
106
|
-
const defaultNote =
|
|
162
|
+
// Advance invoices have their own default note setting.
|
|
163
|
+
// Note: Advance invoices don't have payment terms - they are documents requesting payment.
|
|
164
|
+
const defaultNote =
|
|
165
|
+
(activeEntity?.settings as any)?.default_advance_invoice_note ||
|
|
166
|
+
(activeEntity?.settings as any)?.default_invoice_note ||
|
|
167
|
+
"";
|
|
107
168
|
const defaultFooter = (activeEntity?.settings as any)?.document_footer || "";
|
|
108
169
|
|
|
109
170
|
// ============================================================================
|
|
@@ -112,11 +173,15 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
112
173
|
const furs = usePremiseSelection({ entityId, type: "furs" });
|
|
113
174
|
const fina = usePremiseSelection({ entityId, type: "fina" });
|
|
114
175
|
const eslog = useEslogValidation(activeEntity);
|
|
176
|
+
const eslogValidationModeRef = useRef<"submit" | "draft">("submit");
|
|
177
|
+
const eslogEntityErrorsRef = useRef(eslog.entityErrors);
|
|
178
|
+
eslogEntityErrorsRef.current = eslog.entityErrors;
|
|
115
179
|
const [skipFiscalization, setSkipFiscalization] = useState(false);
|
|
116
180
|
|
|
117
181
|
// UI-only state (not part of API schema)
|
|
118
182
|
const [markAsPaid, setMarkAsPaid] = useState(true);
|
|
119
|
-
const [
|
|
183
|
+
const [paymentRows, setPaymentRows] = useState<DraftPaymentRow[]>([createEmptyPaymentRow()]);
|
|
184
|
+
const [paymentValidationMessage, setPaymentValidationMessage] = useState<string | undefined>();
|
|
120
185
|
const [isDraftPending, setIsDraftPending] = useState(false);
|
|
121
186
|
|
|
122
187
|
// Price modes per item (gross vs net) - collected from component state at submit
|
|
@@ -129,9 +194,57 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
129
194
|
}, [initialValues?.items]);
|
|
130
195
|
const priceModesRef = useRef<PriceModesMap>(initialPriceModes);
|
|
131
196
|
|
|
197
|
+
const baseResolver = useMemo(
|
|
198
|
+
() => zodResolver(createAdvanceInvoiceFormSchema) as Resolver<CreateAdvanceInvoiceFormValues>,
|
|
199
|
+
[],
|
|
200
|
+
);
|
|
201
|
+
const eslogResolverStateRef = useRef({
|
|
202
|
+
activeEntity,
|
|
203
|
+
isEnabled: eslog.isEnabled === true,
|
|
204
|
+
translate: t,
|
|
205
|
+
setEntityErrors: eslog.setEntityErrors,
|
|
206
|
+
});
|
|
207
|
+
eslogResolverStateRef.current = {
|
|
208
|
+
activeEntity,
|
|
209
|
+
isEnabled: eslog.isEnabled === true,
|
|
210
|
+
translate: t,
|
|
211
|
+
setEntityErrors: eslog.setEntityErrors,
|
|
212
|
+
};
|
|
213
|
+
const resolver = useMemo<Resolver<CreateAdvanceInvoiceFormValues>>(
|
|
214
|
+
() => async (values, context, options) => {
|
|
215
|
+
const result = await baseResolver(values, context, options);
|
|
216
|
+
const resolverState = eslogResolverStateRef.current;
|
|
217
|
+
const shouldValidateEslog = eslogValidationModeRef.current === "submit" && resolverState.isEnabled;
|
|
218
|
+
|
|
219
|
+
if (!shouldValidateEslog) {
|
|
220
|
+
eslogEntityErrorsRef.current = [];
|
|
221
|
+
resolverState.setEntityErrors([]);
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const validationErrors = validateEslogForm(values as any, resolverState.activeEntity);
|
|
226
|
+
const entityErrors = getEntityErrors(validationErrors);
|
|
227
|
+
eslogEntityErrorsRef.current = entityErrors;
|
|
228
|
+
resolverState.setEntityErrors(entityErrors);
|
|
229
|
+
|
|
230
|
+
const fieldErrors = getFormFieldErrors(validationErrors);
|
|
231
|
+
if (fieldErrors.length === 0) {
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
values: {},
|
|
237
|
+
errors: mergeFieldErrors(
|
|
238
|
+
result.errors,
|
|
239
|
+
buildEslogFieldErrors<CreateAdvanceInvoiceFormValues>(fieldErrors, resolverState.translate),
|
|
240
|
+
),
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
[baseResolver],
|
|
244
|
+
);
|
|
245
|
+
|
|
132
246
|
const form = useForm<CreateAdvanceInvoiceFormValues>({
|
|
133
|
-
|
|
134
|
-
resolver: zodResolver(createAdvanceInvoiceSchema) as Resolver<CreateAdvanceInvoiceFormValues>,
|
|
247
|
+
resolver,
|
|
135
248
|
defaultValues: {
|
|
136
249
|
number: "", // Will be set by useNextAdvanceInvoiceNumber
|
|
137
250
|
date: initialValues?.date || new Date().toISOString(),
|
|
@@ -166,18 +279,65 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
166
279
|
note: initialValues?.note ?? defaultNote,
|
|
167
280
|
tax_clause: "",
|
|
168
281
|
footer: (initialValues as any)?.footer ?? defaultFooter,
|
|
282
|
+
pt: ((initialValues as any)?.pt as PtDocumentInputForm | undefined) ?? undefined,
|
|
169
283
|
},
|
|
170
284
|
});
|
|
171
285
|
|
|
172
|
-
|
|
173
|
-
const
|
|
286
|
+
const watchedItems = useWatch({ control: form.control, name: "items" });
|
|
287
|
+
const paymentDocumentTotal = useMemo(
|
|
288
|
+
() => calculateDocumentTotal((watchedItems as any[]) ?? [], priceModesRef.current),
|
|
289
|
+
[watchedItems],
|
|
290
|
+
);
|
|
291
|
+
const hasExplicitNonBankTransferPayment =
|
|
292
|
+
markAsPaid && paymentRows.some((row) => row.type != null && row.type !== "bank_transfer");
|
|
293
|
+
const skipPreferenceInitializedRef = useRef(false);
|
|
294
|
+
const skipPaymentCoercionPendingRef = useRef(false);
|
|
295
|
+
const previousSkipFiscalizationRef = useRef(skipFiscalization);
|
|
296
|
+
const previousMarkAsPaidRef = useRef(markAsPaid);
|
|
297
|
+
|
|
298
|
+
useEffect(() => {
|
|
299
|
+
if (skipPreferenceInitializedRef.current || furs.isLoading) return;
|
|
300
|
+
|
|
301
|
+
skipPreferenceInitializedRef.current = true;
|
|
302
|
+
if (furs.settings?.default_skip_fiscalization === true) {
|
|
303
|
+
setSkipFiscalization(true);
|
|
304
|
+
}
|
|
305
|
+
}, [furs.isLoading, furs.settings?.default_skip_fiscalization]);
|
|
174
306
|
|
|
175
|
-
// Auto-disable skip when it becomes invalid (e.g., user changes payment type to cash)
|
|
176
307
|
useEffect(() => {
|
|
177
|
-
|
|
308
|
+
const skipJustEnabled = skipFiscalization && !previousSkipFiscalizationRef.current;
|
|
309
|
+
const paidJustEnabled = markAsPaid && !previousMarkAsPaidRef.current;
|
|
310
|
+
|
|
311
|
+
if (skipFiscalization && markAsPaid && (skipJustEnabled || paidJustEnabled)) {
|
|
312
|
+
const nextPaymentRows = coercePaymentRowsToType(paymentRows, "bank_transfer");
|
|
313
|
+
const hasChanged = nextPaymentRows.some((row, index) => row.type !== paymentRows[index]?.type);
|
|
314
|
+
|
|
315
|
+
if (hasChanged) {
|
|
316
|
+
skipPaymentCoercionPendingRef.current = true;
|
|
317
|
+
setPaymentRows(nextPaymentRows);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
previousSkipFiscalizationRef.current = skipFiscalization;
|
|
322
|
+
previousMarkAsPaidRef.current = markAsPaid;
|
|
323
|
+
}, [markAsPaid, paymentRows, skipFiscalization]);
|
|
324
|
+
|
|
325
|
+
// Auto-disable skip when the user explicitly changes payment away from bank transfer.
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
if (skipPaymentCoercionPendingRef.current) return;
|
|
328
|
+
|
|
329
|
+
if (hasExplicitNonBankTransferPayment && skipFiscalization) {
|
|
178
330
|
setSkipFiscalization(false);
|
|
179
331
|
}
|
|
180
|
-
}, [
|
|
332
|
+
}, [hasExplicitNonBankTransferPayment, skipFiscalization]);
|
|
333
|
+
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
if (!skipPaymentCoercionPendingRef.current) return;
|
|
336
|
+
|
|
337
|
+
if (!markAsPaid || paymentRows.every((row) => row.type === "bank_transfer")) {
|
|
338
|
+
skipPaymentCoercionPendingRef.current = false;
|
|
339
|
+
}
|
|
340
|
+
}, [markAsPaid, paymentRows]);
|
|
181
341
|
|
|
182
342
|
// FURS is "active" for this advance invoice if enabled and we have a valid selection (and not skipped)
|
|
183
343
|
const isFursActive = furs.isActive && !skipFiscalization;
|
|
@@ -245,10 +405,9 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
245
405
|
size="sm"
|
|
246
406
|
className={cn(
|
|
247
407
|
"h-8 cursor-pointer gap-2",
|
|
248
|
-
!canSkipFiscalization && "cursor-not-allowed opacity-50",
|
|
249
408
|
!isFursChecked && "text-destructive hover:text-destructive",
|
|
250
409
|
)}
|
|
251
|
-
onClick={() =>
|
|
410
|
+
onClick={() => setSkipFiscalization(!skipFiscalization)}
|
|
252
411
|
>
|
|
253
412
|
<div
|
|
254
413
|
className={cn(
|
|
@@ -264,11 +423,9 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
264
423
|
</Button>
|
|
265
424
|
</TooltipTrigger>
|
|
266
425
|
<TooltipContent side="bottom" className="max-w-xs">
|
|
267
|
-
{
|
|
268
|
-
?
|
|
269
|
-
|
|
270
|
-
: t("Click to enable fiscalization")
|
|
271
|
-
: t("Cannot skip fiscalization for cash payments")}
|
|
426
|
+
{isFursChecked
|
|
427
|
+
? t("Click to skip fiscalization for this advance invoice")
|
|
428
|
+
: t("Click to enable fiscalization")}
|
|
272
429
|
</TooltipContent>
|
|
273
430
|
</Tooltip>
|
|
274
431
|
</TooltipProvider>
|
|
@@ -284,7 +441,6 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
284
441
|
furs.isEnabled,
|
|
285
442
|
furs.hasPremises,
|
|
286
443
|
skipFiscalization,
|
|
287
|
-
canSkipFiscalization,
|
|
288
444
|
eslog.isAvailable,
|
|
289
445
|
eslog.isEnabled,
|
|
290
446
|
eslog.setEnabled,
|
|
@@ -295,6 +451,47 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
295
451
|
const formValues = useWatch({
|
|
296
452
|
control: form.control,
|
|
297
453
|
});
|
|
454
|
+
const watchedValidationSnapshot = useMemo(
|
|
455
|
+
() =>
|
|
456
|
+
JSON.stringify({
|
|
457
|
+
date: formValues.date,
|
|
458
|
+
currency_code: formValues.currency_code,
|
|
459
|
+
customer: formValues.customer,
|
|
460
|
+
items: formValues.items,
|
|
461
|
+
}),
|
|
462
|
+
[formValues.customer, formValues.currency_code, formValues.date, formValues.items],
|
|
463
|
+
);
|
|
464
|
+
const lastRevalidatedSnapshotRef = useRef<string | null>(null);
|
|
465
|
+
|
|
466
|
+
useEffect(() => {
|
|
467
|
+
if (!form.formState.isSubmitted || form.formState.isSubmitting) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const hasErrors = Object.keys(form.formState.errors).length > 0 || eslog.entityErrors.length > 0;
|
|
472
|
+
if (!hasErrors) {
|
|
473
|
+
lastRevalidatedSnapshotRef.current = watchedValidationSnapshot;
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (lastRevalidatedSnapshotRef.current === watchedValidationSnapshot) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
lastRevalidatedSnapshotRef.current = watchedValidationSnapshot;
|
|
482
|
+
const timeoutId = window.setTimeout(() => {
|
|
483
|
+
void form.trigger();
|
|
484
|
+
}, 0);
|
|
485
|
+
|
|
486
|
+
return () => window.clearTimeout(timeoutId);
|
|
487
|
+
}, [
|
|
488
|
+
eslog.entityErrors.length,
|
|
489
|
+
form,
|
|
490
|
+
form.formState.errors,
|
|
491
|
+
form.formState.isSubmitted,
|
|
492
|
+
form.formState.isSubmitting,
|
|
493
|
+
watchedValidationSnapshot,
|
|
494
|
+
]);
|
|
298
495
|
const onChangeRef = useRef(onChange);
|
|
299
496
|
onChangeRef.current = onChange;
|
|
300
497
|
const prevPayloadRef = useRef("");
|
|
@@ -394,23 +591,8 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
394
591
|
// Shared submit logic for both regular save and save as draft
|
|
395
592
|
const submitAdvanceInvoice = useCallback(
|
|
396
593
|
(values: CreateAdvanceInvoiceFormValues, isDraft: boolean) => {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
const validationErrors = validateEslogForm(values as any, activeEntity);
|
|
400
|
-
|
|
401
|
-
if (validationErrors.length > 0) {
|
|
402
|
-
const entityErrors = getEntityErrors(validationErrors);
|
|
403
|
-
const formErrors = getFormFieldErrors(validationErrors);
|
|
404
|
-
eslog.setEntityErrors(entityErrors);
|
|
405
|
-
for (const error of formErrors) {
|
|
406
|
-
form.setError(error.field as any, {
|
|
407
|
-
type: "eslog",
|
|
408
|
-
message: error.message,
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
eslog.setEntityErrors([]);
|
|
594
|
+
if (!isDraft && eslog.isEnabled && eslogEntityErrorsRef.current.length > 0) {
|
|
595
|
+
return;
|
|
414
596
|
}
|
|
415
597
|
|
|
416
598
|
const fursOptions = buildFursOptions({
|
|
@@ -419,6 +601,7 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
419
601
|
skipFiscalization,
|
|
420
602
|
premiseName: furs.selectedPremiseName,
|
|
421
603
|
deviceName: furs.selectedDeviceName,
|
|
604
|
+
operator: operatorPrefill,
|
|
422
605
|
});
|
|
423
606
|
|
|
424
607
|
const finaOptions = buildFinaOptions({
|
|
@@ -426,7 +609,8 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
426
609
|
useFinaNumbering,
|
|
427
610
|
premiseName: fina.selectedPremiseName,
|
|
428
611
|
deviceName: fina.selectedDeviceName,
|
|
429
|
-
paymentType:
|
|
612
|
+
paymentType: getFirstValidPaymentType(paymentRows),
|
|
613
|
+
operator: operatorPrefill,
|
|
430
614
|
});
|
|
431
615
|
|
|
432
616
|
const eslogOptions = buildEslogOptions({
|
|
@@ -435,11 +619,22 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
435
619
|
isEnabled: eslog.isEnabled,
|
|
436
620
|
});
|
|
437
621
|
|
|
622
|
+
if (!isDraft && markAsPaid) {
|
|
623
|
+
const paymentValidation = validatePaymentRows(paymentRows, paymentDocumentTotal, "full_required");
|
|
624
|
+
const paymentMessage =
|
|
625
|
+
paymentValidation.typeError ?? paymentValidation.amountError ?? paymentValidation.totalError;
|
|
626
|
+
|
|
627
|
+
if (paymentMessage) {
|
|
628
|
+
setPaymentValidationMessage(paymentMessage);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
438
633
|
const payload = prepareAdvanceInvoiceSubmission(values, {
|
|
439
634
|
originalCustomer,
|
|
440
635
|
wasCustomerFormShown: showCustomerForm,
|
|
441
636
|
markAsPaid: isDraft ? false : markAsPaid,
|
|
442
|
-
|
|
637
|
+
payments: serializePaymentRows(paymentRows, paymentDocumentTotal),
|
|
443
638
|
furs: fursOptions,
|
|
444
639
|
fina: finaOptions,
|
|
445
640
|
eslog: eslogOptions,
|
|
@@ -450,18 +645,18 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
450
645
|
createAdvanceInvoice(payload);
|
|
451
646
|
},
|
|
452
647
|
[
|
|
453
|
-
activeEntity,
|
|
454
648
|
createAdvanceInvoice,
|
|
455
649
|
eslog,
|
|
456
650
|
furs,
|
|
457
651
|
fina,
|
|
458
|
-
form,
|
|
459
652
|
useFinaNumbering,
|
|
460
653
|
markAsPaid,
|
|
461
654
|
originalCustomer,
|
|
462
|
-
|
|
655
|
+
paymentDocumentTotal,
|
|
656
|
+
paymentRows,
|
|
463
657
|
showCustomerForm,
|
|
464
658
|
skipFiscalization,
|
|
659
|
+
operatorPrefill,
|
|
465
660
|
],
|
|
466
661
|
);
|
|
467
662
|
|
|
@@ -469,12 +664,16 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
469
664
|
const handleSaveAsDraft = useCallback(async () => {
|
|
470
665
|
setIsDraftPending(true);
|
|
471
666
|
try {
|
|
667
|
+
eslogValidationModeRef.current = "draft";
|
|
472
668
|
const isValid = await form.trigger();
|
|
473
669
|
if (isValid) {
|
|
474
670
|
const values = form.getValues();
|
|
475
671
|
submitAdvanceInvoice(values, true);
|
|
672
|
+
} else {
|
|
673
|
+
scrollToFirstInvalidField(FORM_ID);
|
|
476
674
|
}
|
|
477
675
|
} finally {
|
|
676
|
+
eslogValidationModeRef.current = "submit";
|
|
478
677
|
setIsDraftPending(false);
|
|
479
678
|
}
|
|
480
679
|
}, [form, submitAdvanceInvoice]);
|
|
@@ -484,16 +683,20 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
484
683
|
isPending,
|
|
485
684
|
isDirty: form.formState.isDirty || !!initialValues,
|
|
486
685
|
label: t("Save"),
|
|
487
|
-
secondaryAction:
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
686
|
+
secondaryAction: allowDrafts
|
|
687
|
+
? {
|
|
688
|
+
label: t("Save as Draft"),
|
|
689
|
+
onClick: handleSaveAsDraft,
|
|
690
|
+
isPending: isDraftPending,
|
|
691
|
+
}
|
|
692
|
+
: undefined,
|
|
492
693
|
});
|
|
493
694
|
|
|
494
695
|
// Set default note, footer, and signature from entity settings (advance invoices don't have payment terms)
|
|
495
696
|
useEffect(() => {
|
|
496
|
-
const entityDefaultNote =
|
|
697
|
+
const entityDefaultNote =
|
|
698
|
+
(activeEntity?.settings as any)?.default_advance_invoice_note ||
|
|
699
|
+
(activeEntity?.settings as any)?.default_invoice_note;
|
|
497
700
|
if (entityDefaultNote && !form.getValues("note")) {
|
|
498
701
|
form.setValue("note", entityDefaultNote);
|
|
499
702
|
}
|
|
@@ -536,6 +739,7 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
536
739
|
reference: values.reference,
|
|
537
740
|
note: values.note,
|
|
538
741
|
signature: values.signature,
|
|
742
|
+
...(normalizePtDocumentInput(values.pt) ? { pt: normalizePtDocumentInput(values.pt) } : {}),
|
|
539
743
|
};
|
|
540
744
|
}, []);
|
|
541
745
|
|
|
@@ -620,10 +824,10 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
620
824
|
|
|
621
825
|
return (
|
|
622
826
|
<Form {...form}>
|
|
623
|
-
<
|
|
827
|
+
<FormRoot id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
624
828
|
{/* e-SLOG entity-level validation errors */}
|
|
625
829
|
{eslog.entityErrors.length > 0 && (
|
|
626
|
-
<Alert variant="destructive">
|
|
830
|
+
<Alert variant="destructive" data-form-error-summary="true">
|
|
627
831
|
<AlertCircle className="h-4 w-4" />
|
|
628
832
|
<AlertTitle>{t("e-SLOG Validation Failed")}</AlertTitle>
|
|
629
833
|
<AlertDescription>
|
|
@@ -631,7 +835,7 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
631
835
|
<ul className="list-disc space-y-1 pl-4">
|
|
632
836
|
{eslog.entityErrors.map((error) => (
|
|
633
837
|
<li key={error.field} className="text-sm">
|
|
634
|
-
{error
|
|
838
|
+
{translateEslogValidationError(error, t)}
|
|
635
839
|
</li>
|
|
636
840
|
))}
|
|
637
841
|
</ul>
|
|
@@ -650,11 +854,13 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
650
854
|
selectedCustomerId={selectedCustomerId}
|
|
651
855
|
initialCustomerName={initialCustomerName}
|
|
652
856
|
t={t}
|
|
857
|
+
locale={locale}
|
|
653
858
|
/>
|
|
654
859
|
<DocumentDetailsSection
|
|
655
860
|
control={form.control}
|
|
656
861
|
documentType={_type}
|
|
657
862
|
t={t}
|
|
863
|
+
locale={locale}
|
|
658
864
|
fursInline={
|
|
659
865
|
furs.isEnabled && furs.hasPremises
|
|
660
866
|
? {
|
|
@@ -696,25 +902,40 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
696
902
|
{/* Mark as paid section (UI-only state, not in form schema) */}
|
|
697
903
|
<MarkAsPaidSection
|
|
698
904
|
checked={markAsPaid}
|
|
699
|
-
onCheckedChange={
|
|
700
|
-
|
|
701
|
-
|
|
905
|
+
onCheckedChange={(checked) => {
|
|
906
|
+
setMarkAsPaid(checked);
|
|
907
|
+
setPaymentValidationMessage(undefined);
|
|
908
|
+
}}
|
|
909
|
+
paymentRows={paymentRows}
|
|
910
|
+
onPaymentRowsChange={(rows) => {
|
|
911
|
+
setPaymentRows(rows);
|
|
912
|
+
setPaymentValidationMessage(undefined);
|
|
913
|
+
}}
|
|
914
|
+
documentTotal={paymentDocumentTotal}
|
|
702
915
|
t={t}
|
|
703
916
|
alwaysShowPaymentType={!!fina.isActive}
|
|
704
917
|
forced
|
|
918
|
+
validationMessage={paymentValidationMessage}
|
|
919
|
+
requireFullPayment
|
|
705
920
|
/>
|
|
921
|
+
{detailsExtras}
|
|
706
922
|
</DocumentDetailsSection>
|
|
707
923
|
</div>
|
|
708
924
|
|
|
709
925
|
<DocumentItemsSection
|
|
710
926
|
control={form.control}
|
|
927
|
+
documentType={_type}
|
|
711
928
|
watch={form.watch}
|
|
712
929
|
setValue={form.setValue}
|
|
930
|
+
clearErrors={form.clearErrors}
|
|
931
|
+
trigger={form.trigger}
|
|
932
|
+
isSubmitted={form.formState.isSubmitted}
|
|
713
933
|
getValues={form.getValues}
|
|
714
934
|
entityId={entityId}
|
|
715
935
|
currencyCode={activeEntity?.currency_code ?? undefined}
|
|
716
936
|
onAddNewTax={onAddNewTax}
|
|
717
937
|
t={t}
|
|
938
|
+
locale={locale}
|
|
718
939
|
taxesDisabled={reverseChargeApplies}
|
|
719
940
|
taxesDisabledMessage={
|
|
720
941
|
reverseChargeApplies ? t("Reverse charge - tax exempt EU B2B sale") : viesWarning ? viesWarning : undefined
|
|
@@ -775,7 +996,7 @@ export default function CreateAdvanceInvoiceForm({
|
|
|
775
996
|
customer: formValues.customer as any,
|
|
776
997
|
}}
|
|
777
998
|
/>
|
|
778
|
-
</
|
|
999
|
+
</FormRoot>
|
|
779
1000
|
</Form>
|
|
780
1001
|
);
|
|
781
1002
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
Save: "Запази",
|
|
3
|
+
"Save as Draft": "Save as Draft",
|
|
4
|
+
"Create Advance Invoice": "Създай авансова фактура",
|
|
5
|
+
"e-SLOG": "e-SLOG",
|
|
6
|
+
"Fiscally verify": "Fiscally verify",
|
|
7
|
+
"Click to skip e-SLOG validation for this advance invoice":
|
|
8
|
+
"Click to skip e-SLOG validation for this advance invoice",
|
|
9
|
+
"Click to enable e-SLOG validation": "Click to enable e-SLOG validation",
|
|
10
|
+
"Click to skip fiscalization for this advance invoice": "Click to skip fiscalization for this advance invoice",
|
|
11
|
+
"Click to enable fiscalization": "Click to enable fiscalization",
|
|
12
|
+
"Cannot skip fiscalization for cash payments": "Cannot skip fiscalization for cash payments",
|
|
13
|
+
"e-SLOG Validation Failed": "e-SLOG Validation Failed",
|
|
14
|
+
"The following entity settings need to be updated:": "The following entity settings need to be updated:",
|
|
15
|
+
"Reverse charge - tax exempt EU B2B sale": "Reverse charge - tax exempt EU B2B sale",
|
|
16
|
+
"Mark as Paid": "Mark as Paid",
|
|
17
|
+
Paid: "Платено",
|
|
18
|
+
"Advance invoice will be marked as fully paid upon creation":
|
|
19
|
+
"Advance invoice will be marked as fully paid upon creation",
|
|
20
|
+
"Payment Type": "Payment Type",
|
|
21
|
+
"Select payment type": "Изберете тип плащане",
|
|
22
|
+
Cash: "В брой",
|
|
23
|
+
"Bank Transfer": "Банков превод",
|
|
24
|
+
Card: "Карта",
|
|
25
|
+
Check: "Чек",
|
|
26
|
+
Other: "Друго",
|
|
27
|
+
Premise: "Premise",
|
|
28
|
+
Device: "Устройство",
|
|
29
|
+
"FINA fiscalized invoices always use the current date": "FINA fiscalized invoices always use the current date",
|
|
30
|
+
Signature: "Подпис",
|
|
31
|
+
"Add signature text...": "Добавете текст за подпис...",
|
|
32
|
+
"Add separator": "Add separator",
|
|
33
|
+
"Section header": "Section header",
|
|
34
|
+
"Section title...": "Section title...",
|
|
35
|
+
"Transaction type": "Transaction type",
|
|
36
|
+
Domestic: "Domestic",
|
|
37
|
+
"EU B2B": "EU B2B",
|
|
38
|
+
"EU B2C": "EU B2C",
|
|
39
|
+
"3W B2B": "3W B2B",
|
|
40
|
+
"3W B2C": "3W B2C",
|
|
41
|
+
"Determining transaction type...": "Determining transaction type...",
|
|
42
|
+
"This invoice will not be fiscalized (non-domestic transaction)":
|
|
43
|
+
"This invoice will not be fiscalized (non-domestic transaction)",
|
|
44
|
+
"Tax Clause": "Tax Clause",
|
|
45
|
+
"Add tax clause...": "Add tax clause...",
|
|
46
|
+
Footer: "Footer",
|
|
47
|
+
"Add document footer...": "Add document footer...",
|
|
48
|
+
} as const;
|