@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
|
@@ -21,6 +21,8 @@ const createTaxSchemaDefinition = z.object({
|
|
|
21
21
|
.min(1),
|
|
22
22
|
is_default: z.boolean().optional(),
|
|
23
23
|
classification: z.union([z.string(), z.null()]).optional(),
|
|
24
|
+
pt_exemption_code: z.union([z.string(), z.null()]).optional(),
|
|
25
|
+
pt_exemption_reason: z.union([z.string(), z.null()]).optional(),
|
|
24
26
|
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
25
27
|
});
|
|
26
28
|
|
|
@@ -14,6 +14,7 @@ const uploadFileSchemaDefinition = z
|
|
|
14
14
|
file: z.instanceof(File).optional(),
|
|
15
15
|
category: z.enum(["logo", "signature", "attachment"]),
|
|
16
16
|
account_payable_id: z.string().optional(),
|
|
17
|
+
incoming_purchase_document_id: z.string().optional(),
|
|
17
18
|
})
|
|
18
19
|
.passthrough();
|
|
19
20
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for userptsettings endpoints
|
|
10
|
+
|
|
11
|
+
// Schema for update userptsettings operation
|
|
12
|
+
const updateUserPtSettingsSchemaDefinition = z
|
|
13
|
+
.object({
|
|
14
|
+
operator_first_name: z.string(),
|
|
15
|
+
operator_last_name: z.string(),
|
|
16
|
+
operator_tax_number: z.string(),
|
|
17
|
+
account_first_name: z.string(),
|
|
18
|
+
account_last_name: z.string(),
|
|
19
|
+
account_tax_number: z.string(),
|
|
20
|
+
})
|
|
21
|
+
.partial();
|
|
22
|
+
|
|
23
|
+
// Type for update userptsettings operation
|
|
24
|
+
export type UpdateUserPtSettingsSchema = z.infer<typeof updateUserPtSettingsSchemaDefinition>;
|
|
25
|
+
|
|
26
|
+
export const updateUserPtSettingsSchema = updateUserPtSettingsSchemaDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for voidinvoice_body endpoints
|
|
10
|
+
|
|
11
|
+
// Dependency schema for voidinvoice_body
|
|
12
|
+
const voidInvoice_Body = z
|
|
13
|
+
.object({
|
|
14
|
+
reason: z.string().min(1),
|
|
15
|
+
has_original_document: z.union([z.boolean(), z.null()]),
|
|
16
|
+
})
|
|
17
|
+
.partial()
|
|
18
|
+
.passthrough();
|
|
19
|
+
|
|
20
|
+
|
|
@@ -53,6 +53,7 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
53
53
|
"advance_invoice.deleted",
|
|
54
54
|
"advance_invoice.restored",
|
|
55
55
|
"item.created",
|
|
56
|
+
"item.updated",
|
|
56
57
|
"item.deleted",
|
|
57
58
|
"item.restored",
|
|
58
59
|
"item.permanently_deleted",
|
|
@@ -153,6 +154,7 @@ const updateWebhookSchemaDefinition = z
|
|
|
153
154
|
"advance_invoice.deleted",
|
|
154
155
|
"advance_invoice.restored",
|
|
155
156
|
"item.created",
|
|
157
|
+
"item.updated",
|
|
156
158
|
"item.deleted",
|
|
157
159
|
"item.restored",
|
|
158
160
|
"item.permanently_deleted",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { SDKMethodOptions } from "@spaceinvoices/js-sdk";
|
|
2
2
|
import type { UseMutationOptions } from "@tanstack/react-query";
|
|
3
3
|
|
|
4
4
|
import { useQueryClient } from "@tanstack/react-query";
|
|
@@ -66,9 +66,14 @@ export function createResourceHooks<
|
|
|
66
66
|
TCreateData = unknown,
|
|
67
67
|
TUpdateData = Partial<Omit<TResource, "id">>,
|
|
68
68
|
>(
|
|
69
|
-
|
|
69
|
+
methods: {
|
|
70
|
+
create: (data: TCreateData, options?: SDKMethodOptions) => Promise<TResource>;
|
|
71
|
+
update: (id: string, data: TUpdateData, options?: SDKMethodOptions) => Promise<TResource>;
|
|
72
|
+
delete: (id: string, options?: SDKMethodOptions) => Promise<void>;
|
|
73
|
+
restore?: (id: string, options?: SDKMethodOptions) => Promise<TResource>;
|
|
74
|
+
permanentDelete?: (id: string, options?: SDKMethodOptions) => Promise<void>;
|
|
75
|
+
},
|
|
70
76
|
cacheKey: string,
|
|
71
|
-
options?: { restoreMethodName?: string; permanentDeleteMethodName?: string },
|
|
72
77
|
) {
|
|
73
78
|
/**
|
|
74
79
|
* Hook for creating a new resource
|
|
@@ -79,8 +84,8 @@ export function createResourceHooks<
|
|
|
79
84
|
const queryClient = useQueryClient();
|
|
80
85
|
|
|
81
86
|
return useResourceMutation<TResource, TError, TCreateData>({
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
mutationFn: methods.create,
|
|
88
|
+
operation: "create",
|
|
84
89
|
cacheKey,
|
|
85
90
|
entityId: options.entityId,
|
|
86
91
|
accountId: options.accountId,
|
|
@@ -157,8 +162,8 @@ export function createResourceHooks<
|
|
|
157
162
|
const queryClient = useQueryClient();
|
|
158
163
|
|
|
159
164
|
return useResourceMutation<TResource, TError, { id: string; data: TUpdateData }>({
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
mutationFn: methods.update,
|
|
166
|
+
operation: "update",
|
|
162
167
|
cacheKey: [cacheKey, `${cacheKey}-detail`],
|
|
163
168
|
entityId: options.entityId,
|
|
164
169
|
accountId: options.accountId,
|
|
@@ -260,8 +265,8 @@ export function createResourceHooks<
|
|
|
260
265
|
const queryClient = useQueryClient();
|
|
261
266
|
|
|
262
267
|
return useResourceMutation<void, TError, { id: string }>({
|
|
263
|
-
|
|
264
|
-
|
|
268
|
+
mutationFn: methods.delete,
|
|
269
|
+
operation: "idOnly",
|
|
265
270
|
cacheKey,
|
|
266
271
|
entityId: options.entityId,
|
|
267
272
|
accountId: options.accountId,
|
|
@@ -303,14 +308,13 @@ export function createResourceHooks<
|
|
|
303
308
|
hookOptions: ResourceMutationHookOptions<TResource, TError, { id: string }> = {},
|
|
304
309
|
) {
|
|
305
310
|
const queryClient = useQueryClient();
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
throw new Error(`restoreMethodName not configured for ${String(resourceName)}`);
|
|
311
|
+
if (!methods.restore) {
|
|
312
|
+
throw new Error("restore method not configured for this resource");
|
|
309
313
|
}
|
|
310
314
|
|
|
311
315
|
return useResourceMutation<TResource, TError, { id: string }>({
|
|
312
|
-
|
|
313
|
-
|
|
316
|
+
mutationFn: methods.restore,
|
|
317
|
+
operation: "idOnly",
|
|
314
318
|
cacheKey,
|
|
315
319
|
entityId: hookOptions.entityId,
|
|
316
320
|
accountId: hookOptions.accountId,
|
|
@@ -335,14 +339,13 @@ export function createResourceHooks<
|
|
|
335
339
|
hookOptions: ResourceMutationHookOptions<void, TError, { id: string }> = {},
|
|
336
340
|
) {
|
|
337
341
|
const queryClient = useQueryClient();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
throw new Error(`permanentDeleteMethodName not configured for ${String(resourceName)}`);
|
|
342
|
+
if (!methods.permanentDelete) {
|
|
343
|
+
throw new Error("permanentDelete method not configured for this resource");
|
|
341
344
|
}
|
|
342
345
|
|
|
343
346
|
return useResourceMutation<void, TError, { id: string }>({
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
mutationFn: methods.permanentDelete,
|
|
348
|
+
operation: "idOnly",
|
|
346
349
|
cacheKey,
|
|
347
350
|
entityId: hookOptions.entityId,
|
|
348
351
|
accountId: hookOptions.accountId,
|
|
@@ -11,9 +11,12 @@ import type {
|
|
|
11
11
|
Invoice,
|
|
12
12
|
} from "@spaceinvoices/js-sdk";
|
|
13
13
|
import { useQuery } from "@tanstack/react-query";
|
|
14
|
-
|
|
15
14
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
16
|
-
import {
|
|
15
|
+
import { advanceInvoices } from "../../../js-sdk/src/sdk/advance-invoices";
|
|
16
|
+
import { creditNotes } from "../../../js-sdk/src/sdk/credit-notes";
|
|
17
|
+
import { deliveryNotes } from "../../../js-sdk/src/sdk/delivery-notes";
|
|
18
|
+
import { estimates } from "../../../js-sdk/src/sdk/estimates";
|
|
19
|
+
import { invoices } from "../../../js-sdk/src/sdk/invoices";
|
|
17
20
|
|
|
18
21
|
const DUPLICATE_TIMING_EVENT = "si:duplicate-timing";
|
|
19
22
|
|
|
@@ -199,7 +202,6 @@ export function useDuplicateDocument({
|
|
|
199
202
|
targetType,
|
|
200
203
|
enabled = true,
|
|
201
204
|
}: UseDuplicateDocumentOptions): UseDuplicateDocumentResult {
|
|
202
|
-
const { sdk } = useSDK();
|
|
203
205
|
const { activeEntity } = useEntities();
|
|
204
206
|
|
|
205
207
|
const sourceType = sourceId ? getDocumentTypeFromId(sourceId) : null;
|
|
@@ -221,16 +223,16 @@ export function useDuplicateDocument({
|
|
|
221
223
|
// Fetch source document based on its type
|
|
222
224
|
let source: Document;
|
|
223
225
|
if (sourceType === "invoice") {
|
|
224
|
-
source = await
|
|
226
|
+
source = await invoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
225
227
|
} else if (sourceType === "estimate") {
|
|
226
|
-
source = await
|
|
228
|
+
source = await estimates.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
227
229
|
} else if (sourceType === "advance_invoice") {
|
|
228
|
-
source = await
|
|
230
|
+
source = await advanceInvoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
229
231
|
} else if (sourceType === "delivery_note") {
|
|
230
|
-
source = await
|
|
232
|
+
source = await deliveryNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
231
233
|
} else {
|
|
232
234
|
// Credit note
|
|
233
|
-
source = await
|
|
235
|
+
source = await creditNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
if (!source) {
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
9
9
|
|
|
10
|
-
type EslogError = {
|
|
10
|
+
type EslogError = {
|
|
11
|
+
field: string;
|
|
12
|
+
message: string;
|
|
13
|
+
params?: Record<string, number | string>;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
type Entity = {
|
|
13
17
|
country_code?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
|
|
3
|
-
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
2
|
+
import { documents } from "../../../js-sdk/src/sdk/documents";
|
|
4
3
|
|
|
5
4
|
export const NEXT_DOCUMENT_NUMBER_CACHE_KEY = "next-document-number";
|
|
6
5
|
|
|
@@ -13,6 +12,16 @@ export type NextDocumentNumberResponse = {
|
|
|
13
12
|
business_premise_name: string;
|
|
14
13
|
electronic_device_name: string;
|
|
15
14
|
} | null;
|
|
15
|
+
fina?: {
|
|
16
|
+
business_premise_name: string;
|
|
17
|
+
electronic_device_name: string;
|
|
18
|
+
} | null;
|
|
19
|
+
pt?: {
|
|
20
|
+
series_id: string;
|
|
21
|
+
series_code: string;
|
|
22
|
+
validation_code: string;
|
|
23
|
+
manual?: boolean;
|
|
24
|
+
} | null;
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
/**
|
|
@@ -30,8 +39,6 @@ export function useNextDocumentNumber(
|
|
|
30
39
|
enabled?: boolean;
|
|
31
40
|
},
|
|
32
41
|
) {
|
|
33
|
-
const { sdk } = useSDK();
|
|
34
|
-
|
|
35
42
|
return useQuery<NextDocumentNumberResponse>({
|
|
36
43
|
queryKey: [
|
|
37
44
|
NEXT_DOCUMENT_NUMBER_CACHE_KEY,
|
|
@@ -41,7 +48,7 @@ export function useNextDocumentNumber(
|
|
|
41
48
|
options?.electronicDeviceName,
|
|
42
49
|
],
|
|
43
50
|
queryFn: async () => {
|
|
44
|
-
const response = await
|
|
51
|
+
const response = await documents.getNextNumber(
|
|
45
52
|
{
|
|
46
53
|
type: type as "invoice",
|
|
47
54
|
business_premise_name: options?.businessPremiseName,
|
|
@@ -51,7 +58,7 @@ export function useNextDocumentNumber(
|
|
|
51
58
|
);
|
|
52
59
|
return response;
|
|
53
60
|
},
|
|
54
|
-
enabled: options?.enabled !== false && !!entityId
|
|
61
|
+
enabled: options?.enabled !== false && !!entityId,
|
|
55
62
|
staleTime: 0, // Always refetch when form opens
|
|
56
63
|
});
|
|
57
64
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEntitiesOptional } from "@/ui/providers/entities-context";
|
|
2
|
+
|
|
3
|
+
export function useResolvedEntityId(explicitEntityId?: string | null, consumerName = "Space Invoices component") {
|
|
4
|
+
const entitiesContext = useEntitiesOptional();
|
|
5
|
+
const resolvedEntityId = explicitEntityId ?? entitiesContext?.activeEntity?.id ?? null;
|
|
6
|
+
|
|
7
|
+
if (!resolvedEntityId) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
`${consumerName} requires an entity ID. Pass entityId explicitly or render it inside an EntitiesProvider with an active entity.`,
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return resolvedEntityId;
|
|
14
|
+
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import type SDK from "@spaceinvoices/js-sdk";
|
|
2
1
|
import type { SDKMethodOptions } from "@spaceinvoices/js-sdk";
|
|
3
2
|
import type { UseMutationOptions } from "@tanstack/react-query";
|
|
4
3
|
|
|
5
4
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
5
|
|
|
7
|
-
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
8
|
-
|
|
9
6
|
type ResourceMutationOptions<TData, TError, TVariables, TContext> = {
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
7
|
+
/** Concrete SDK module method */
|
|
8
|
+
mutationFn: (...args: any[]) => Promise<TData>;
|
|
9
|
+
/** How to map TVariables to the mutationFn signature */
|
|
10
|
+
operation: "create" | "update" | "idOnly";
|
|
14
11
|
/** The cache key(s) to invalidate after successful mutation */
|
|
15
12
|
cacheKey: string | string[];
|
|
16
13
|
/** Entity ID for multi-tenant filtering */
|
|
@@ -34,14 +31,13 @@ type ResourceMutationOptions<TData, TError, TVariables, TContext> = {
|
|
|
34
31
|
* Automatically handles cache invalidation and error handling
|
|
35
32
|
*/
|
|
36
33
|
export function useResourceMutation<TData, TError = Error, TVariables = unknown, TContext = unknown>({
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
mutationFn,
|
|
35
|
+
operation,
|
|
39
36
|
cacheKey,
|
|
40
37
|
entityId,
|
|
41
38
|
accountId,
|
|
42
39
|
mutationOptions,
|
|
43
40
|
}: ResourceMutationOptions<TData, TError, TVariables, TContext>) {
|
|
44
|
-
const { sdk } = useSDK();
|
|
45
41
|
const queryClient = useQueryClient();
|
|
46
42
|
|
|
47
43
|
// Destructure to separate onSuccess/onError from other options
|
|
@@ -50,35 +46,20 @@ export function useResourceMutation<TData, TError = Error, TVariables = unknown,
|
|
|
50
46
|
return useMutation<TData, TError, TVariables, TContext>({
|
|
51
47
|
...otherOptions,
|
|
52
48
|
mutationFn: async (variables: TVariables) => {
|
|
53
|
-
// SDK is guaranteed non-null by provider - no need to check
|
|
54
|
-
const resource = sdk[resourceName] as Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
55
|
-
|
|
56
|
-
if (!resource || typeof resource[methodName] !== "function") {
|
|
57
|
-
throw new Error(`Method ${methodName} not found on resource ${String(resourceName)}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
// Build SDK options (entity_id, etc.)
|
|
61
50
|
const options: SDKMethodOptions | undefined = entityId ? { entity_id: entityId } : undefined;
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
const isUpdateMethod = methodName === "update";
|
|
65
|
-
const isIdOnlyMethod =
|
|
66
|
-
methodName === "delete" || methodName.startsWith("restore") || methodName.startsWith("permanentDelete");
|
|
67
|
-
|
|
68
|
-
if (isUpdateMethod) {
|
|
69
|
-
// Update: method(id, data, options)
|
|
52
|
+
if (operation === "update") {
|
|
70
53
|
const { id, data } = variables as { id: string; data: unknown };
|
|
71
|
-
return (await
|
|
54
|
+
return (await mutationFn(id, data, options)) as TData;
|
|
72
55
|
}
|
|
73
56
|
|
|
74
|
-
if (
|
|
75
|
-
// Delete/Restore/PermanentDelete: method(id, options)
|
|
57
|
+
if (operation === "idOnly") {
|
|
76
58
|
const { id } = variables as { id: string };
|
|
77
|
-
return (await
|
|
59
|
+
return (await mutationFn(id, options)) as TData;
|
|
78
60
|
}
|
|
79
61
|
|
|
80
|
-
|
|
81
|
-
return (await resource[methodName](variables, options)) as TData;
|
|
62
|
+
return (await mutationFn(variables, options)) as TData;
|
|
82
63
|
},
|
|
83
64
|
|
|
84
65
|
onSuccess: (data, variables, context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TransactionTypeCheckRequest, TransactionTypeCheckResponse } from "@spaceinvoices/js-sdk";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { transactionType } from "../../../js-sdk/src/sdk/transaction-type";
|
|
5
5
|
import { useDebounce } from "./use-debounce";
|
|
6
6
|
|
|
7
7
|
export const TRANSACTION_TYPE_CHECK_CACHE_KEY = "transaction-type-check";
|
|
@@ -77,8 +77,6 @@ export function useTransactionTypeCheck({
|
|
|
77
77
|
customerIsEndConsumer,
|
|
78
78
|
enabled = true,
|
|
79
79
|
}: UseTransactionTypeCheckParams): UseTransactionTypeCheckResult {
|
|
80
|
-
const { sdk } = useSDK();
|
|
81
|
-
|
|
82
80
|
// Build the request object
|
|
83
81
|
const requestData = useMemo((): TransactionTypeCheckRequest | null => {
|
|
84
82
|
// Need at least issuer info to make a check
|
|
@@ -120,12 +118,9 @@ export function useTransactionTypeCheck({
|
|
|
120
118
|
queryKey,
|
|
121
119
|
queryFn: async () => {
|
|
122
120
|
if (!debouncedRequest) throw new Error("No request data");
|
|
123
|
-
|
|
124
|
-
// (sdk.transactionType is not reliably available in Vite pre-bundled builds)
|
|
125
|
-
const checkFn = sdk.transactionType?.checkTransactionType ?? sdk.vies.checkVies;
|
|
126
|
-
return checkFn(debouncedRequest);
|
|
121
|
+
return transactionType.checkTransactionType(debouncedRequest);
|
|
127
122
|
},
|
|
128
|
-
enabled: enabled && !!
|
|
123
|
+
enabled: enabled && !!debouncedRequest,
|
|
129
124
|
staleTime: CHECK_STALE_TIME,
|
|
130
125
|
refetchOnWindowFocus: false,
|
|
131
126
|
});
|
|
@@ -64,7 +64,7 @@ export function deleteCookie(name: string, path = "/") {
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// Also delete domain cookie (e.g. .spaceinvoices.com) if on spaceinvoices.com
|
|
67
|
-
const hostname = typeof window !== "undefined" ? window.location.hostname : globalThis.location?.hostname ?? "";
|
|
67
|
+
const hostname = typeof window !== "undefined" ? window.location.hostname : (globalThis.location?.hostname ?? "");
|
|
68
68
|
if (hostname === "spaceinvoices.com" || hostname.endsWith(".spaceinvoices.com")) {
|
|
69
69
|
setCookie(name, "", {
|
|
70
70
|
path,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
2
|
+
|
|
3
|
+
import type { PdfTemplateId } from "@/ui/components/documents/create/live-preview";
|
|
4
|
+
import type { Entity } from "@/ui/providers/entities-context";
|
|
5
|
+
|
|
6
|
+
export const PORTUGAL_COUNTRY_CODE = "PT";
|
|
7
|
+
export const PORTUGAL_PDF_LOCALE = "pt-PT";
|
|
8
|
+
export const PORTUGAL_CANONICAL_PDF_TEMPLATE: PdfTemplateId = "classic";
|
|
9
|
+
const ACTIVE_ACCOUNT_COOKIE = "l.account";
|
|
10
|
+
const SUPPORT_ACCOUNT_ID = import.meta.env.VITE_SUPPORT_ACCOUNT_ID || "acc_000000000000000000000001";
|
|
11
|
+
|
|
12
|
+
export type CountryAwareDocument = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
13
|
+
export type CountryAwareDocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
14
|
+
|
|
15
|
+
type CountryEntity = Pick<Entity, "country_code" | "settings"> | null | undefined;
|
|
16
|
+
|
|
17
|
+
export function isPortugalEntity(entity: CountryEntity): boolean {
|
|
18
|
+
return entity?.country_code === PORTUGAL_COUNTRY_CODE;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getCookieValue(name: string) {
|
|
22
|
+
if (typeof document === "undefined") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const cookiePrefix = `${name}=`;
|
|
27
|
+
const rawCookie = document.cookie
|
|
28
|
+
.split(";")
|
|
29
|
+
.map((cookie) => cookie.trim())
|
|
30
|
+
.find((cookie) => cookie.startsWith(cookiePrefix));
|
|
31
|
+
|
|
32
|
+
if (!rawCookie) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return decodeURIComponent(rawCookie.slice(cookiePrefix.length));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function hasPortugalUiAccess() {
|
|
39
|
+
if (typeof document === "undefined") {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const activeAccountId = getCookieValue(ACTIVE_ACCOUNT_COOKIE);
|
|
44
|
+
return !!SUPPORT_ACCOUNT_ID && activeAccountId === SUPPORT_ACCOUNT_ID;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function resolveDocumentPdfTemplate(entity: CountryEntity): PdfTemplateId {
|
|
48
|
+
if (isPortugalEntity(entity) && hasPortugalUiAccess()) {
|
|
49
|
+
return PORTUGAL_CANONICAL_PDF_TEMPLATE;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const settings = (entity?.settings as Record<string, unknown> | undefined) ?? {};
|
|
53
|
+
return (settings.pdf_template as PdfTemplateId) || "modern";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getPortugalEditBlockedReason(entity: CountryEntity): string | undefined {
|
|
57
|
+
if (!isPortugalEntity(entity) || !hasPortugalUiAccess()) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return "Issued Portugal documents cannot be edited. Void the document instead.";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getEntityCountryCapabilities(entity: CountryEntity) {
|
|
65
|
+
const isPortugal = isPortugalEntity(entity) && hasPortugalUiAccess();
|
|
66
|
+
const isSlovenia = entity?.country_code === "SI";
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
isPortugal,
|
|
70
|
+
isSlovenia,
|
|
71
|
+
usesFixedPdfTemplate: isPortugal,
|
|
72
|
+
showPtSaftExport: isPortugal,
|
|
73
|
+
showSloveniaVodExport: isSlovenia,
|
|
74
|
+
showPtAtcudSettings: isPortugal,
|
|
75
|
+
allowTemplateSettings: !isPortugal,
|
|
76
|
+
allowEmailSettings: !isPortugal,
|
|
77
|
+
showTemplatesSettings: !isPortugal,
|
|
78
|
+
showEmailSettings: !isPortugal,
|
|
79
|
+
allowPdfTemplateSelection: !isPortugal,
|
|
80
|
+
allowPdfLanguageSelection: !isPortugal,
|
|
81
|
+
allowDocumentDrafts: !isPortugal,
|
|
82
|
+
allowSavedItemFullEdit: !isPortugal,
|
|
83
|
+
resolvedPdfTemplate: resolveDocumentPdfTemplate(entity),
|
|
84
|
+
forcePdfLocale: isPortugal ? PORTUGAL_PDF_LOCALE : undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getDocumentCountryCapabilities(
|
|
89
|
+
entity: CountryEntity,
|
|
90
|
+
documentType: CountryAwareDocumentType,
|
|
91
|
+
document?: Partial<CountryAwareDocument> | null,
|
|
92
|
+
) {
|
|
93
|
+
const entityCapabilities = getEntityCountryCapabilities(entity);
|
|
94
|
+
const isDraft = document?.is_draft === true;
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
...entityCapabilities,
|
|
98
|
+
allowEmailSend: !entityCapabilities.isPortugal,
|
|
99
|
+
allowSendEmail: !entityCapabilities.isPortugal,
|
|
100
|
+
allowEditIssuedDocument: !entityCapabilities.isPortugal || isDraft,
|
|
101
|
+
allowEditDocument: !entityCapabilities.isPortugal || isDraft,
|
|
102
|
+
allowPaymentAction:
|
|
103
|
+
(documentType === "invoice" || documentType === "advance_invoice" || documentType === "credit_note") &&
|
|
104
|
+
!(entityCapabilities.isPortugal && documentType === "credit_note"),
|
|
105
|
+
allowPaymentActions:
|
|
106
|
+
(documentType === "invoice" || documentType === "advance_invoice" || documentType === "credit_note") &&
|
|
107
|
+
!(entityCapabilities.isPortugal && documentType === "credit_note"),
|
|
108
|
+
forceDocumentPdfLocale: entityCapabilities.forcePdfLocale,
|
|
109
|
+
isDraft,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const getCountryUiCapabilities = getEntityCountryCapabilities;
|
|
114
|
+
export const getDocumentUiCapabilities = getDocumentCountryCapabilities;
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import type { Locale } from "date-fns";
|
|
2
|
-
import {
|
|
3
|
-
bg,
|
|
4
|
-
cs,
|
|
5
|
-
de,
|
|
6
|
-
enUS,
|
|
7
|
-
es,
|
|
8
|
-
et,
|
|
9
|
-
fi,
|
|
10
|
-
fr,
|
|
11
|
-
hr,
|
|
12
|
-
is,
|
|
13
|
-
it,
|
|
14
|
-
nb,
|
|
15
|
-
nl,
|
|
16
|
-
pl,
|
|
17
|
-
pt,
|
|
18
|
-
sk,
|
|
19
|
-
sl,
|
|
20
|
-
sv,
|
|
21
|
-
} from "date-fns/locale";
|
|
2
|
+
import { bg, cs, de, enUS, es, et, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } from "date-fns/locale";
|
|
22
3
|
import { getLocaleLanguage } from "./locale";
|
|
23
4
|
|
|
24
5
|
const DATE_FNS_LOCALES: Record<string, Locale> = {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type EslogDocumentLike = {
|
|
2
|
+
eslog?: {
|
|
3
|
+
validation_status?: string | null;
|
|
4
|
+
} | null;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type EslogSelectionState = {
|
|
8
|
+
selectedCount: number;
|
|
9
|
+
eligibleCount: number;
|
|
10
|
+
hasEligibleDocuments: boolean;
|
|
11
|
+
hasIneligibleDocuments: boolean;
|
|
12
|
+
allEligible: boolean;
|
|
13
|
+
noneEligible: boolean;
|
|
14
|
+
partiallyEligible: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function getEslogSelectionState(documents: EslogDocumentLike[]): EslogSelectionState {
|
|
18
|
+
const selectedCount = documents.length;
|
|
19
|
+
const eligibleCount = documents.filter((document) => document.eslog?.validation_status === "valid").length;
|
|
20
|
+
const hasEligibleDocuments = eligibleCount > 0;
|
|
21
|
+
const hasIneligibleDocuments = eligibleCount < selectedCount;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
selectedCount,
|
|
25
|
+
eligibleCount,
|
|
26
|
+
hasEligibleDocuments,
|
|
27
|
+
hasIneligibleDocuments,
|
|
28
|
+
allEligible: selectedCount > 0 && eligibleCount === selectedCount,
|
|
29
|
+
noneEligible: selectedCount > 0 && eligibleCount === 0,
|
|
30
|
+
partiallyEligible: eligibleCount > 0 && eligibleCount < selectedCount,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -5,12 +5,26 @@
|
|
|
5
5
|
* and advance invoice forms where this logic was duplicated.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type FiscalizationOperatorOverride = {
|
|
9
|
+
label?: string;
|
|
10
|
+
tax_number?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type FursSubmitOptions =
|
|
14
|
+
| { skip: true }
|
|
15
|
+
| {
|
|
16
|
+
business_premise_name: string;
|
|
17
|
+
electronic_device_name: string;
|
|
18
|
+
operator_tax_number?: string;
|
|
19
|
+
operator_label?: string;
|
|
20
|
+
};
|
|
9
21
|
|
|
10
22
|
export type FinaSubmitOptions = {
|
|
11
23
|
business_premise_name: string;
|
|
12
24
|
electronic_device_name: string;
|
|
13
25
|
payment_type: string;
|
|
26
|
+
operator_oib?: string;
|
|
27
|
+
operator_label?: string;
|
|
14
28
|
};
|
|
15
29
|
|
|
16
30
|
export type EslogSubmitOptions = {
|
|
@@ -29,6 +43,7 @@ export function buildFursOptions(opts: {
|
|
|
29
43
|
skipFiscalization?: boolean;
|
|
30
44
|
premiseName?: string;
|
|
31
45
|
deviceName?: string;
|
|
46
|
+
operator?: FiscalizationOperatorOverride;
|
|
32
47
|
}): FursSubmitOptions | undefined {
|
|
33
48
|
if (opts.isDraft || opts.isEditMode || !opts.isEnabled) return undefined;
|
|
34
49
|
if (opts.skipFiscalization) return { skip: true };
|
|
@@ -36,6 +51,8 @@ export function buildFursOptions(opts: {
|
|
|
36
51
|
return {
|
|
37
52
|
business_premise_name: opts.premiseName,
|
|
38
53
|
electronic_device_name: opts.deviceName,
|
|
54
|
+
...(opts.operator?.tax_number ? { operator_tax_number: opts.operator.tax_number } : {}),
|
|
55
|
+
...(opts.operator?.label ? { operator_label: opts.operator.label } : {}),
|
|
39
56
|
};
|
|
40
57
|
}
|
|
41
58
|
return undefined;
|
|
@@ -53,6 +70,7 @@ export function buildFinaOptions(opts: {
|
|
|
53
70
|
premiseName?: string;
|
|
54
71
|
deviceName?: string;
|
|
55
72
|
paymentType?: string;
|
|
73
|
+
operator?: FiscalizationOperatorOverride;
|
|
56
74
|
}): FinaSubmitOptions | undefined {
|
|
57
75
|
if (opts.isDraft || opts.isEditMode || !opts.useFinaNumbering) return undefined;
|
|
58
76
|
if (opts.premiseName && opts.deviceName) {
|
|
@@ -60,6 +78,8 @@ export function buildFinaOptions(opts: {
|
|
|
60
78
|
business_premise_name: opts.premiseName,
|
|
61
79
|
electronic_device_name: opts.deviceName,
|
|
62
80
|
payment_type: opts.paymentType || "bank_transfer",
|
|
81
|
+
...(opts.operator?.tax_number ? { operator_oib: opts.operator.tax_number } : {}),
|
|
82
|
+
...(opts.operator?.label ? { operator_label: opts.operator.label } : {}),
|
|
63
83
|
};
|
|
64
84
|
}
|
|
65
85
|
return undefined;
|