@spaceinvoices/react-ui 0.4.11 → 0.4.31
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 +48 -26
- 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 +36 -46
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +452 -115
- package/src/components/advance-invoices/create/locales/bg.ts +56 -0
- package/src/components/advance-invoices/create/locales/cs.ts +56 -0
- package/src/components/advance-invoices/create/locales/de.ts +15 -7
- package/src/components/advance-invoices/create/locales/en.ts +56 -0
- package/src/components/advance-invoices/create/locales/es.ts +15 -7
- package/src/components/advance-invoices/create/locales/et.ts +56 -0
- package/src/components/advance-invoices/create/locales/fi.ts +56 -0
- package/src/components/advance-invoices/create/locales/fr.ts +16 -8
- package/src/components/advance-invoices/create/locales/hr.ts +29 -21
- package/src/components/advance-invoices/create/locales/is.ts +56 -0
- package/src/components/advance-invoices/create/locales/it.ts +15 -7
- package/src/components/advance-invoices/create/locales/nb.ts +56 -0
- package/src/components/advance-invoices/create/locales/nl.ts +15 -7
- package/src/components/advance-invoices/create/locales/pl.ts +17 -9
- package/src/components/advance-invoices/create/locales/pt.ts +16 -8
- package/src/components/advance-invoices/create/locales/sk.ts +56 -0
- package/src/components/advance-invoices/create/locales/sl.ts +23 -12
- package/src/components/advance-invoices/create/locales/sv.ts +56 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +62 -2
- package/src/components/advance-invoices/list/list-row-actions.tsx +48 -16
- package/src/components/advance-invoices/list/list-table.tsx +35 -9
- 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 +437 -80
- package/src/components/credit-notes/create/locales/bg.ts +101 -0
- package/src/components/credit-notes/create/locales/cs.ts +101 -0
- package/src/components/credit-notes/create/locales/de.ts +20 -7
- package/src/components/credit-notes/create/locales/en.ts +101 -0
- package/src/components/credit-notes/create/locales/es.ts +20 -7
- package/src/components/credit-notes/create/locales/et.ts +101 -0
- package/src/components/credit-notes/create/locales/fi.ts +101 -0
- package/src/components/credit-notes/create/locales/fr.ts +21 -8
- package/src/components/credit-notes/create/locales/hr.ts +41 -28
- package/src/components/credit-notes/create/locales/is.ts +101 -0
- package/src/components/credit-notes/create/locales/it.ts +20 -7
- package/src/components/credit-notes/create/locales/nb.ts +101 -0
- package/src/components/credit-notes/create/locales/nl.ts +20 -7
- package/src/components/credit-notes/create/locales/pl.ts +22 -9
- package/src/components/credit-notes/create/locales/pt.ts +21 -8
- package/src/components/credit-notes/create/locales/sk.ts +101 -0
- package/src/components/credit-notes/create/locales/sl.ts +28 -14
- package/src/components/credit-notes/create/locales/sv.ts +101 -0
- package/src/components/credit-notes/create/prepare-credit-note-submission.ts +66 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +34 -3
- package/src/components/credit-notes/list/list-row-actions.tsx +19 -7
- package/src/components/credit-notes/list/list-table.tsx +60 -8
- 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 +179 -47
- package/src/components/delivery-notes/create/locales/bg.ts +69 -0
- package/src/components/delivery-notes/create/locales/cs.ts +69 -0
- package/src/components/delivery-notes/create/locales/de.ts +1 -0
- package/src/components/delivery-notes/create/locales/en.ts +69 -0
- package/src/components/delivery-notes/create/locales/es.ts +1 -0
- package/src/components/delivery-notes/create/locales/et.ts +69 -0
- package/src/components/delivery-notes/create/locales/fi.ts +69 -0
- package/src/components/delivery-notes/create/locales/fr.ts +1 -0
- package/src/components/delivery-notes/create/locales/hr.ts +7 -6
- package/src/components/delivery-notes/create/locales/is.ts +69 -0
- package/src/components/delivery-notes/create/locales/it.ts +1 -0
- package/src/components/delivery-notes/create/locales/nb.ts +69 -0
- package/src/components/delivery-notes/create/locales/nl.ts +1 -0
- package/src/components/delivery-notes/create/locales/pl.ts +1 -0
- package/src/components/delivery-notes/create/locales/pt.ts +1 -0
- package/src/components/delivery-notes/create/locales/sk.ts +69 -0
- package/src/components/delivery-notes/create/locales/sl.ts +6 -5
- package/src/components/delivery-notes/create/locales/sv.ts +69 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +34 -1
- package/src/components/delivery-notes/delivery-notes.hooks.ts +34 -3
- package/src/components/delivery-notes/list/list-row-actions.tsx +62 -16
- package/src/components/delivery-notes/list/list-table.tsx +44 -10
- 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/custom-create-template.ts +114 -0
- package/src/components/documents/create/document-add-item-form.tsx +266 -153
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +3 -3
- package/src/components/documents/create/document-date-validation.ts +111 -0
- package/src/components/documents/create/document-details-section.tsx +117 -54
- package/src/components/documents/create/document-form-item.ts +67 -0
- package/src/components/documents/create/document-item-validation.ts +54 -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/form-types.ts +2 -2
- package/src/components/documents/create/linked-documents-info.tsx +6 -14
- package/src/components/documents/create/live-preview.tsx +22 -18
- package/src/components/documents/create/mark-as-paid-section.tsx +80 -20
- package/src/components/documents/create/payment-rows.ts +321 -0
- package/src/components/documents/create/prepare-document-submission.ts +160 -109
- package/src/components/documents/create/prepare-preview-data.ts +12 -0
- package/src/components/documents/create/preserved-expected-total.ts +90 -0
- 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 +336 -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 +251 -63
- package/src/components/documents/view/document-activities-list.tsx +23 -11
- package/src/components/documents/view/document-details-card.tsx +11 -39
- 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 +18 -5
- 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 +21 -8
- 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 +206 -0
- package/src/components/entities/entity-settings-form/locales/cs.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +17 -3
- package/src/components/entities/entity-settings-form/locales/en.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/et.ts +205 -0
- package/src/components/entities/entity-settings-form/locales/fi.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/hr.ts +23 -11
- package/src/components/entities/entity-settings-form/locales/is.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/nb.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/pl.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/pt.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/sk.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +31 -18
- package/src/components/entities/entity-settings-form/locales/sv.ts +212 -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 +57 -6
- package/src/components/estimates/create/create-estimate-form.tsx +250 -66
- package/src/components/estimates/create/locales/bg.ts +77 -0
- package/src/components/estimates/create/locales/cs.ts +77 -0
- package/src/components/estimates/create/locales/de.ts +4 -3
- package/src/components/estimates/create/locales/en.ts +77 -0
- package/src/components/estimates/create/locales/es.ts +4 -3
- package/src/components/estimates/create/locales/et.ts +77 -0
- package/src/components/estimates/create/locales/fi.ts +77 -0
- package/src/components/estimates/create/locales/fr.ts +4 -3
- package/src/components/estimates/create/locales/hr.ts +13 -12
- package/src/components/estimates/create/locales/is.ts +77 -0
- package/src/components/estimates/create/locales/it.ts +4 -3
- package/src/components/estimates/create/locales/nb.ts +77 -0
- package/src/components/estimates/create/locales/nl.ts +4 -3
- package/src/components/estimates/create/locales/pl.ts +4 -3
- package/src/components/estimates/create/locales/pt.ts +4 -3
- package/src/components/estimates/create/locales/sk.ts +77 -0
- package/src/components/estimates/create/locales/sl.ts +13 -12
- package/src/components/estimates/create/locales/sv.ts +77 -0
- package/src/components/estimates/create/prepare-estimate-submission.ts +41 -4
- package/src/components/estimates/estimates.hooks.ts +24 -3
- package/src/components/estimates/list/list-row-actions.tsx +34 -7
- package/src/components/estimates/list/list-table.tsx +89 -11
- package/src/components/estimates/list/locales/bg.ts +40 -0
- package/src/components/estimates/list/locales/cs.ts +40 -0
- package/src/components/estimates/list/locales/de.ts +2 -0
- package/src/components/estimates/list/locales/en.ts +29 -2
- package/src/components/estimates/list/locales/es.ts +2 -0
- package/src/components/estimates/list/locales/et.ts +40 -0
- package/src/components/estimates/list/locales/fi.ts +40 -0
- package/src/components/estimates/list/locales/fr.ts +2 -0
- package/src/components/estimates/list/locales/hr.ts +9 -7
- package/src/components/estimates/list/locales/is.ts +40 -0
- package/src/components/estimates/list/locales/it.ts +2 -0
- package/src/components/estimates/list/locales/nb.ts +40 -0
- package/src/components/estimates/list/locales/nl.ts +2 -0
- package/src/components/estimates/list/locales/pl.ts +2 -0
- package/src/components/estimates/list/locales/pt.ts +2 -0
- package/src/components/estimates/list/locales/sk.ts +40 -0
- package/src/components/estimates/list/locales/sl.ts +9 -7
- package/src/components/estimates/list/locales/sv.ts +40 -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 +500 -112
- package/src/components/invoices/create/eslog-validation.ts +97 -8
- package/src/components/invoices/create/locales/bg.ts +173 -0
- package/src/components/invoices/create/locales/cs.ts +173 -0
- package/src/components/invoices/create/locales/de.ts +41 -9
- package/src/components/invoices/create/locales/en.ts +173 -0
- package/src/components/invoices/create/locales/es.ts +42 -9
- package/src/components/invoices/create/locales/et.ts +173 -0
- package/src/components/invoices/create/locales/fi.ts +173 -0
- package/src/components/invoices/create/locales/fr.ts +42 -11
- package/src/components/invoices/create/locales/hr.ts +50 -18
- package/src/components/invoices/create/locales/is.ts +173 -0
- package/src/components/invoices/create/locales/it.ts +43 -11
- package/src/components/invoices/create/locales/nb.ts +173 -0
- package/src/components/invoices/create/locales/nl.ts +42 -10
- package/src/components/invoices/create/locales/pl.ts +42 -11
- package/src/components/invoices/create/locales/pt.ts +43 -10
- package/src/components/invoices/create/locales/sk.ts +173 -0
- package/src/components/invoices/create/locales/sl.ts +49 -18
- package/src/components/invoices/create/locales/sv.ts +175 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +73 -2
- package/src/components/invoices/invoices-furs.hooks.ts +11 -8
- package/src/components/invoices/invoices.hooks.ts +36 -10
- package/src/components/invoices/list/list-row-actions.tsx +54 -21
- package/src/components/invoices/list/list-table.tsx +94 -12
- 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 +63 -0
- package/src/components/invoices/send-email-dialog/locales/cs.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/de.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/en.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/et.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/fi.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/is.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/nb.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/sk.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/sv.ts +63 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +189 -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 +55 -22
- 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 +16 -9
- 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 +10 -2
- 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 +121 -39
- 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 +12 -6
- package/src/components/recurring-invoices/list/list-table.tsx +63 -12
- package/src/components/recurring-invoices/list/locales/bg.ts +32 -0
- package/src/components/recurring-invoices/list/locales/cs.ts +32 -0
- package/src/components/recurring-invoices/list/locales/de.ts +4 -0
- package/src/components/recurring-invoices/list/locales/en.ts +27 -0
- package/src/components/recurring-invoices/list/locales/es.ts +4 -0
- package/src/components/recurring-invoices/list/locales/et.ts +32 -0
- package/src/components/recurring-invoices/list/locales/fi.ts +32 -0
- package/src/components/recurring-invoices/list/locales/fr.ts +4 -0
- package/src/components/recurring-invoices/list/locales/hr.ts +4 -0
- package/src/components/recurring-invoices/list/locales/is.ts +32 -0
- package/src/components/recurring-invoices/list/locales/it.ts +4 -0
- package/src/components/recurring-invoices/list/locales/nb.ts +32 -0
- package/src/components/recurring-invoices/list/locales/nl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/pl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/pt.ts +4 -0
- package/src/components/recurring-invoices/list/locales/sk.ts +32 -0
- package/src/components/recurring-invoices/list/locales/sl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/sv.ts +32 -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 +25 -11
- package/src/components/tax-reports/slovenia-vod-export-form.tsx +452 -0
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +20 -16
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +42 -19
- 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 -10
- package/src/components/ui/progress.tsx +6 -4
- package/src/components/ui/select.tsx +118 -2
- package/src/components/ui/sidebar.tsx +2 -2
- 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 +146 -103
- package/src/generated/schemas/acceptentityinvitation_body.ts +4 -3
- package/src/generated/schemas/accountwebhook.ts +63 -0
- package/src/generated/schemas/addentityuser_body.ts +4 -3
- package/src/generated/schemas/advanceinvoice.ts +167 -168
- package/src/generated/schemas/authorizeshopify_body.ts +4 -3
- package/src/generated/schemas/calculatedocumentpreview.ts +120 -0
- package/src/generated/schemas/checktransactiontype.ts +35 -0
- package/src/generated/schemas/creditnote.ts +203 -76
- package/src/generated/schemas/customadvanceinvoice.ts +172 -165
- package/src/generated/schemas/customcreditnote.ts +183 -155
- package/src/generated/schemas/customdeliverynote.ts +166 -0
- package/src/generated/schemas/customer.ts +4 -8
- package/src/generated/schemas/customestimate.ts +123 -97
- package/src/generated/schemas/customincomingpurchasedocument.ts +142 -0
- package/src/generated/schemas/custominvoice.ts +183 -154
- package/src/generated/schemas/deliverynote.ts +124 -79
- package/src/generated/schemas/einvoice.ts +19 -0
- package/src/generated/schemas/einvoicingsettings.ts +21 -0
- package/src/generated/schemas/einvoicingsupplier.ts +45 -0
- package/src/generated/schemas/entity.ts +267 -24
- package/src/generated/schemas/entityapikey.ts +1 -3
- package/src/generated/schemas/entityuserrole.ts +1 -3
- package/src/generated/schemas/estimate.ts +120 -127
- package/src/generated/schemas/exportsloveniavodxml_body.ts +17 -0
- package/src/generated/schemas/exportsloveniayearlynormiranireport_body.ts +4 -3
- package/src/generated/schemas/finadevice.ts +15 -0
- package/src/generated/schemas/finalizedocument.ts +52 -0
- package/src/generated/schemas/finapremise.ts +15 -0
- package/src/generated/schemas/finasettings.ts +1 -3
- package/src/generated/schemas/furselectronicdevice.ts +15 -0
- package/src/generated/schemas/furssettings.ts +2 -3
- package/src/generated/schemas/image.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocument.ts +178 -0
- package/src/generated/schemas/incomingpurchasedocumentattachment.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocumentpayment.ts +36 -0
- package/src/generated/schemas/index.ts +30 -5
- package/src/generated/schemas/invoice.ts +182 -183
- package/src/generated/schemas/item.ts +35 -3
- package/src/generated/schemas/legacymigrationauth.ts +18 -0
- package/src/generated/schemas/me.ts +4 -22
- package/src/generated/schemas/migrationjob.ts +20 -0
- package/src/generated/schemas/order.ts +6 -8
- package/src/generated/schemas/orderintegration.ts +12 -12
- package/src/generated/schemas/payment.ts +9 -8
- package/src/generated/schemas/ptatcudseries.ts +28 -0
- package/src/generated/schemas/queryentitystats.ts +15 -0
- package/src/generated/schemas/recurringinvoice.ts +4 -8
- package/src/generated/schemas/registerfursmovablepremise_body.ts +1 -3
- package/src/generated/schemas/registerfursrealestatepremise_body.ts +1 -3
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +42 -16
- package/src/generated/schemas/rendercreditnotepreview_body.ts +42 -16
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +19 -8
- package/src/generated/schemas/renderestimatepreview_body.ts +45 -8
- package/src/generated/schemas/renderinvoicepreview_body.ts +46 -18
- package/src/generated/schemas/reviewsloveniayearlynormiranireport.ts +15 -0
- package/src/generated/schemas/searcheinvoicingcustomer.ts +18 -0
- package/src/generated/schemas/senddocument_body.ts +2 -3
- package/src/generated/schemas/sendemail_body.ts +48 -42
- package/src/generated/schemas/sloveniataxprofile.ts +98 -24
- package/src/generated/schemas/starteslogexport_body.ts +34 -0
- package/src/generated/schemas/startpdfexport_body.ts +18 -81
- package/src/generated/schemas/stripeappconnect_body.ts +4 -3
- package/src/generated/schemas/stripeappcreateinvoice_body.ts +4 -6
- package/src/generated/schemas/stripeappmarketplaceauthorize.ts +15 -0
- package/src/generated/schemas/stripeappupdatesettings_body.ts +6 -6
- package/src/generated/schemas/supplier.ts +55 -0
- package/src/generated/schemas/syncshopifyorders_body.ts +21 -0
- package/src/generated/schemas/tax.ts +8 -8
- package/src/generated/schemas/uploadfile_body.ts +2 -3
- package/src/generated/schemas/uploadfurscertificate_body.ts +6 -6
- package/src/generated/schemas/userfinasettings.ts +1 -3
- package/src/generated/schemas/userfurssettings.ts +1 -3
- package/src/generated/schemas/userptsettings.ts +24 -0
- package/src/generated/schemas/voidinvoice_body.ts +25 -0
- package/src/generated/schemas/webhook.ts +6 -8
- package/src/generated/schemas/wlsubscriptionbillingemail.ts +17 -0
- package/src/hooks/create-resource-hooks.ts +22 -19
- package/src/hooks/use-duplicate-document.ts +71 -38
- 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/date-only.ts +58 -0
- package/src/lib/document-display.ts +18 -0
- 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 +97 -0
- package/src/lib/pt-document-input.ts +67 -0
- package/src/lib/schemas/shared.ts +12 -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 +149 -10
- package/src/generated/schemas/previewadvanceinvoice_body.ts +0 -354
- package/src/generated/schemas/previewestimate_body.ts +0 -309
- package/src/generated/schemas/registerfinamovablepremise_body.ts +0 -26
- package/src/generated/schemas/registerfinarealestatepremise_body.ts +0 -37
- package/src/generated/schemas/renderdocument_body.ts +0 -594
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
2
|
+
import { Badge } from "@/ui/components/ui/badge";
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/card";
|
|
4
|
+
import { formatDateOnlyForDisplay } from "@/ui/lib/date-only";
|
|
5
|
+
import { getDisplayDocumentNumber } from "@/ui/lib/document-display";
|
|
6
|
+
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
7
|
+
import { createTranslation } from "@/ui/lib/translation";
|
|
8
|
+
import { getDocumentConfig, type DocumentTypes } from "../types";
|
|
9
|
+
import { getDocumentPaymentStatus } from "../view/document-details-card";
|
|
10
|
+
import de from "../view/locales/de";
|
|
11
|
+
import es from "../view/locales/es";
|
|
12
|
+
import fr from "../view/locales/fr";
|
|
13
|
+
import hr from "../view/locales/hr";
|
|
14
|
+
import it from "../view/locales/it";
|
|
15
|
+
import nl from "../view/locales/nl";
|
|
16
|
+
import pl from "../view/locales/pl";
|
|
17
|
+
import pt from "../view/locales/pt";
|
|
18
|
+
import sl from "../view/locales/sl";
|
|
19
|
+
|
|
20
|
+
const translations = {
|
|
21
|
+
sl,
|
|
22
|
+
de,
|
|
23
|
+
it,
|
|
24
|
+
fr,
|
|
25
|
+
es,
|
|
26
|
+
pt,
|
|
27
|
+
nl,
|
|
28
|
+
pl,
|
|
29
|
+
hr,
|
|
30
|
+
sv: {
|
|
31
|
+
Type: "Typ",
|
|
32
|
+
Number: "Nummer",
|
|
33
|
+
Date: "Datum",
|
|
34
|
+
"Due date": "Förfallodatum",
|
|
35
|
+
"Service date": "Tjänstedatum",
|
|
36
|
+
"Service period": "Tjänsteperiod",
|
|
37
|
+
"Valid until": "Giltig till",
|
|
38
|
+
Customer: "Kund",
|
|
39
|
+
Status: "Status",
|
|
40
|
+
Total: "Totalt",
|
|
41
|
+
Paid: "Betalt",
|
|
42
|
+
Due: "Att betala",
|
|
43
|
+
"Paid in full": "Betald i sin helhet",
|
|
44
|
+
"Partially paid": "Delvis betald",
|
|
45
|
+
Unpaid: "Obetald",
|
|
46
|
+
Voided: "Makulerad",
|
|
47
|
+
Overdue: "Förfallen",
|
|
48
|
+
Invoice: "Faktura",
|
|
49
|
+
Estimate: "Offert",
|
|
50
|
+
"Credit Note": "Kreditnota",
|
|
51
|
+
"Advance Invoice": "Förskottsfaktura",
|
|
52
|
+
"Delivery Note": "Följesedel",
|
|
53
|
+
},
|
|
54
|
+
fi: {
|
|
55
|
+
Type: "Tyyppi",
|
|
56
|
+
Number: "Numero",
|
|
57
|
+
Date: "Päivämäärä",
|
|
58
|
+
"Due date": "Eräpäivä",
|
|
59
|
+
"Service date": "Palvelupäivä",
|
|
60
|
+
"Service period": "Palvelujakso",
|
|
61
|
+
"Valid until": "Voimassa asti",
|
|
62
|
+
Customer: "Asiakas",
|
|
63
|
+
Status: "Tila",
|
|
64
|
+
Total: "Yhteensä",
|
|
65
|
+
Paid: "Maksettu",
|
|
66
|
+
Due: "Maksamatta",
|
|
67
|
+
"Paid in full": "Maksettu kokonaan",
|
|
68
|
+
"Partially paid": "Osittain maksettu",
|
|
69
|
+
Unpaid: "Maksamatta",
|
|
70
|
+
Voided: "Mitätöity",
|
|
71
|
+
Overdue: "Erääntynyt",
|
|
72
|
+
Invoice: "Lasku",
|
|
73
|
+
Estimate: "Tarjous",
|
|
74
|
+
"Credit Note": "Hyvityslasku",
|
|
75
|
+
"Advance Invoice": "Ennakkolasku",
|
|
76
|
+
"Delivery Note": "Lähete",
|
|
77
|
+
},
|
|
78
|
+
et: {
|
|
79
|
+
Type: "Tüüp",
|
|
80
|
+
Number: "Number",
|
|
81
|
+
Date: "Kuupäev",
|
|
82
|
+
"Due date": "Tähtaeg",
|
|
83
|
+
"Service date": "Teenuse kuupäev",
|
|
84
|
+
"Service period": "Teenuse periood",
|
|
85
|
+
"Valid until": "Kehtiv kuni",
|
|
86
|
+
Customer: "Klient",
|
|
87
|
+
Status: "Olek",
|
|
88
|
+
Total: "Kokku",
|
|
89
|
+
Paid: "Makstud",
|
|
90
|
+
Due: "Tasumata",
|
|
91
|
+
"Paid in full": "Täielikult makstud",
|
|
92
|
+
"Partially paid": "Osaliselt makstud",
|
|
93
|
+
Unpaid: "Tasumata",
|
|
94
|
+
Voided: "Tühistatud",
|
|
95
|
+
Overdue: "Üle tähtaja",
|
|
96
|
+
Invoice: "Arve",
|
|
97
|
+
Estimate: "Hinnapakkumine",
|
|
98
|
+
"Credit Note": "Kreeditarve",
|
|
99
|
+
"Advance Invoice": "Ettemaksuarve",
|
|
100
|
+
"Delivery Note": "Saateleht",
|
|
101
|
+
},
|
|
102
|
+
bg: {
|
|
103
|
+
Type: "Вид",
|
|
104
|
+
Number: "Номер",
|
|
105
|
+
Date: "Дата",
|
|
106
|
+
"Due date": "Краен срок",
|
|
107
|
+
"Service date": "Дата на услугата",
|
|
108
|
+
"Service period": "Период на услугата",
|
|
109
|
+
"Valid until": "Валидно до",
|
|
110
|
+
Customer: "Клиент",
|
|
111
|
+
Status: "Статус",
|
|
112
|
+
Total: "Общо",
|
|
113
|
+
Paid: "Платено",
|
|
114
|
+
Due: "Дължимо",
|
|
115
|
+
"Paid in full": "Платено изцяло",
|
|
116
|
+
"Partially paid": "Частично платено",
|
|
117
|
+
Unpaid: "Неплатено",
|
|
118
|
+
Voided: "Анулирано",
|
|
119
|
+
Overdue: "Просрочено",
|
|
120
|
+
Invoice: "Фактура",
|
|
121
|
+
Estimate: "Оферта",
|
|
122
|
+
"Credit Note": "Кредитно известие",
|
|
123
|
+
"Advance Invoice": "Авансова фактура",
|
|
124
|
+
"Delivery Note": "Доставна бележка",
|
|
125
|
+
},
|
|
126
|
+
cs: {
|
|
127
|
+
Type: "Typ",
|
|
128
|
+
Number: "Číslo",
|
|
129
|
+
Date: "Datum",
|
|
130
|
+
"Due date": "Datum splatnosti",
|
|
131
|
+
"Service date": "Datum služby",
|
|
132
|
+
"Service period": "Období služby",
|
|
133
|
+
"Valid until": "Platné do",
|
|
134
|
+
Customer: "Zákazník",
|
|
135
|
+
Status: "Stav",
|
|
136
|
+
Total: "Celkem",
|
|
137
|
+
Paid: "Uhrazeno",
|
|
138
|
+
Due: "K úhradě",
|
|
139
|
+
"Paid in full": "Uhrazeno v plné výši",
|
|
140
|
+
"Partially paid": "Částečně uhrazeno",
|
|
141
|
+
Unpaid: "Neuhrazeno",
|
|
142
|
+
Voided: "Stornováno",
|
|
143
|
+
Overdue: "Po splatnosti",
|
|
144
|
+
Invoice: "Faktura",
|
|
145
|
+
Estimate: "Nabídka",
|
|
146
|
+
"Credit Note": "Dobropis",
|
|
147
|
+
"Advance Invoice": "Zálohová faktura",
|
|
148
|
+
"Delivery Note": "Dodací list",
|
|
149
|
+
},
|
|
150
|
+
sk: {
|
|
151
|
+
Type: "Typ",
|
|
152
|
+
Number: "Číslo",
|
|
153
|
+
Date: "Dátum",
|
|
154
|
+
"Due date": "Dátum splatnosti",
|
|
155
|
+
"Service date": "Dátum služby",
|
|
156
|
+
"Service period": "Obdobie služby",
|
|
157
|
+
"Valid until": "Platné do",
|
|
158
|
+
Customer: "Zákazník",
|
|
159
|
+
Status: "Stav",
|
|
160
|
+
Total: "Celkom",
|
|
161
|
+
Paid: "Uhradené",
|
|
162
|
+
Due: "Na úhradu",
|
|
163
|
+
"Paid in full": "Uhradené v plnej výške",
|
|
164
|
+
"Partially paid": "Čiastočne uhradené",
|
|
165
|
+
Unpaid: "Neuhradené",
|
|
166
|
+
Voided: "Stornované",
|
|
167
|
+
Overdue: "Po splatnosti",
|
|
168
|
+
Invoice: "Faktura",
|
|
169
|
+
Estimate: "Cenová ponuka",
|
|
170
|
+
"Credit Note": "Dobropis",
|
|
171
|
+
"Advance Invoice": "Zálohová faktúra",
|
|
172
|
+
"Delivery Note": "Dodací list",
|
|
173
|
+
},
|
|
174
|
+
nb: {
|
|
175
|
+
Type: "Type",
|
|
176
|
+
Number: "Nummer",
|
|
177
|
+
Date: "Dato",
|
|
178
|
+
"Due date": "Forfallsdato",
|
|
179
|
+
"Service date": "Tjenestedato",
|
|
180
|
+
"Service period": "Tjenesteperiode",
|
|
181
|
+
"Valid until": "Gyldig til",
|
|
182
|
+
Customer: "Kunde",
|
|
183
|
+
Status: "Status",
|
|
184
|
+
Total: "Totalt",
|
|
185
|
+
Paid: "Betalt",
|
|
186
|
+
Due: "Til betaling",
|
|
187
|
+
"Paid in full": "Fullt betalt",
|
|
188
|
+
"Partially paid": "Delvis betalt",
|
|
189
|
+
Unpaid: "Ubetalt",
|
|
190
|
+
Voided: "Annullert",
|
|
191
|
+
Overdue: "Forfalt",
|
|
192
|
+
Invoice: "Faktura",
|
|
193
|
+
Estimate: "Tilbud",
|
|
194
|
+
"Credit Note": "Kreditnota",
|
|
195
|
+
"Advance Invoice": "Forskuddsfaktura",
|
|
196
|
+
"Delivery Note": "Følgeseddel",
|
|
197
|
+
},
|
|
198
|
+
is: {
|
|
199
|
+
Type: "Tegund",
|
|
200
|
+
Number: "Númer",
|
|
201
|
+
Date: "Dagsetning",
|
|
202
|
+
"Due date": "Gjalddagi",
|
|
203
|
+
"Service date": "Þjónustudagsetning",
|
|
204
|
+
"Service period": "Þjónustutímabil",
|
|
205
|
+
"Valid until": "Gildir til",
|
|
206
|
+
Customer: "Viðskiptavinur",
|
|
207
|
+
Status: "Staða",
|
|
208
|
+
Total: "Samtals",
|
|
209
|
+
Paid: "Greitt",
|
|
210
|
+
Due: "Til greiðslu",
|
|
211
|
+
"Paid in full": "Greitt að fullu",
|
|
212
|
+
"Partially paid": "Greitt að hluta",
|
|
213
|
+
Unpaid: "Ógreitt",
|
|
214
|
+
Voided: "Ógilt",
|
|
215
|
+
Overdue: "Gjaldfallið",
|
|
216
|
+
Invoice: "Reikningur",
|
|
217
|
+
Estimate: "Tilboð",
|
|
218
|
+
"Credit Note": "Kreditreikningur",
|
|
219
|
+
"Advance Invoice": "Fyrirframreikningur",
|
|
220
|
+
"Delivery Note": "Afhendingarseðill",
|
|
221
|
+
},
|
|
222
|
+
} as const;
|
|
223
|
+
|
|
224
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
225
|
+
|
|
226
|
+
type PublicDocumentSummaryProps = ComponentTranslationProps & {
|
|
227
|
+
document: Document;
|
|
228
|
+
documentType: DocumentTypes;
|
|
229
|
+
locale?: string;
|
|
230
|
+
documentTypeLabel?: string;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
function formatCurrency(amount: number, currencyCode: string, locale: string): string {
|
|
234
|
+
return new Intl.NumberFormat(locale, {
|
|
235
|
+
style: "currency",
|
|
236
|
+
currency: currencyCode,
|
|
237
|
+
}).format(amount);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function PublicDocumentSummary({
|
|
241
|
+
document,
|
|
242
|
+
documentType,
|
|
243
|
+
locale = "en",
|
|
244
|
+
documentTypeLabel,
|
|
245
|
+
...i18nProps
|
|
246
|
+
}: PublicDocumentSummaryProps) {
|
|
247
|
+
const t = createTranslation({ translations, locale, ...i18nProps });
|
|
248
|
+
const currencyCode = document.currency_code;
|
|
249
|
+
const sign = documentType === "credit_note" ? -1 : 1;
|
|
250
|
+
const fmt = (amount: number) => formatCurrency(amount, currencyCode, locale);
|
|
251
|
+
const fmtDate = (date: Date | string | null | undefined) => formatDateOnlyForDisplay(date, locale);
|
|
252
|
+
const config = getDocumentConfig(documentType);
|
|
253
|
+
const resolvedDocumentTypeLabel = documentTypeLabel ?? t(config.singularName);
|
|
254
|
+
const displayNumber = getDisplayDocumentNumber(document, t);
|
|
255
|
+
const isInvoiceLike = documentType === "invoice" || documentType === "advance_invoice";
|
|
256
|
+
const isEstimate = documentType === "estimate";
|
|
257
|
+
const invoiceDoc = document as Invoice | AdvanceInvoice;
|
|
258
|
+
|
|
259
|
+
const statusBadge = (() => {
|
|
260
|
+
if (isInvoiceLike) {
|
|
261
|
+
return getDocumentPaymentStatus(invoiceDoc, t);
|
|
262
|
+
}
|
|
263
|
+
if (document.voided_at && new Date(document.voided_at).getTime() > 0) {
|
|
264
|
+
return { label: t("Voided"), variant: "secondary" as const };
|
|
265
|
+
}
|
|
266
|
+
return { label: resolvedDocumentTypeLabel, variant: "outline" as const };
|
|
267
|
+
})();
|
|
268
|
+
|
|
269
|
+
const rows: Array<{ label: string; value: string }> = [
|
|
270
|
+
{ label: t("Type"), value: resolvedDocumentTypeLabel },
|
|
271
|
+
{ label: t("Number"), value: displayNumber },
|
|
272
|
+
{ label: t("Date"), value: fmtDate(document.date) },
|
|
273
|
+
];
|
|
274
|
+
|
|
275
|
+
if (isInvoiceLike && invoiceDoc.date_due) {
|
|
276
|
+
rows.push({ label: t("Due date"), value: fmtDate(invoiceDoc.date_due) });
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (isEstimate) {
|
|
280
|
+
const estimateDoc = document as Estimate;
|
|
281
|
+
if (estimateDoc.date_valid_till) {
|
|
282
|
+
rows.push({ label: t("Valid until"), value: fmtDate(estimateDoc.date_valid_till) });
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (documentType === "invoice" || documentType === "credit_note") {
|
|
287
|
+
const serviceDoc = document as Invoice | CreditNote;
|
|
288
|
+
if (serviceDoc.date_service) {
|
|
289
|
+
rows.push({
|
|
290
|
+
label: serviceDoc.date_service_to ? t("Service period") : t("Service date"),
|
|
291
|
+
value: serviceDoc.date_service_to
|
|
292
|
+
? `${fmtDate(serviceDoc.date_service)} - ${fmtDate(serviceDoc.date_service_to)}`
|
|
293
|
+
: fmtDate(serviceDoc.date_service),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (document.customer?.name) {
|
|
299
|
+
rows.push({ label: t("Customer"), value: document.customer.name });
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (isInvoiceLike) {
|
|
303
|
+
rows.push({ label: t("Status"), value: statusBadge.label });
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
rows.push({ label: t("Total"), value: fmt(document.total_with_tax * sign) });
|
|
307
|
+
|
|
308
|
+
if (isInvoiceLike && invoiceDoc.total_paid > 0) {
|
|
309
|
+
rows.push({ label: t("Paid"), value: fmt(invoiceDoc.total_paid) });
|
|
310
|
+
rows.push({ label: t("Due"), value: fmt(invoiceDoc.total_due) });
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<Card size="sm" className="border-border/70 bg-background/95 shadow-sm">
|
|
315
|
+
<CardHeader className="pb-3">
|
|
316
|
+
<div className="flex items-start justify-between gap-3">
|
|
317
|
+
<div className="space-y-1">
|
|
318
|
+
<CardTitle>{resolvedDocumentTypeLabel}</CardTitle>
|
|
319
|
+
<p className="text-muted-foreground text-sm">{displayNumber}</p>
|
|
320
|
+
</div>
|
|
321
|
+
<Badge variant={statusBadge.variant}>{statusBadge.label}</Badge>
|
|
322
|
+
</div>
|
|
323
|
+
</CardHeader>
|
|
324
|
+
<CardContent>
|
|
325
|
+
<dl className="grid gap-3 sm:grid-cols-2">
|
|
326
|
+
{rows.map((row) => (
|
|
327
|
+
<div key={`${row.label}-${row.value}`} className="space-y-1 rounded-lg border border-border/60 bg-muted/20 p-3">
|
|
328
|
+
<dt className="text-muted-foreground text-xs uppercase tracking-[0.08em]">{row.label}</dt>
|
|
329
|
+
<dd className="font-medium text-sm">{row.value}</dd>
|
|
330
|
+
</div>
|
|
331
|
+
))}
|
|
332
|
+
</dl>
|
|
333
|
+
</CardContent>
|
|
334
|
+
</Card>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type AdvanceInvoice,
|
|
5
|
+
type CreditNote,
|
|
6
|
+
type DeliveryNote,
|
|
7
|
+
type Estimate,
|
|
8
|
+
type Invoice,
|
|
9
|
+
invoices,
|
|
10
|
+
} from "@spaceinvoices/js-sdk";
|
|
11
|
+
import { getClientHeaders } from "@spaceinvoices/js-sdk/client-headers";
|
|
4
12
|
import { useQuery } from "@tanstack/react-query";
|
|
5
13
|
import { AlertCircle, FileText } from "lucide-react";
|
|
6
14
|
import { useEffect, useMemo } from "react";
|
|
15
|
+
import { getEntityCountryCapabilities } from "@/ui/lib/country-capabilities";
|
|
7
16
|
import { cn } from "@/ui/lib/utils";
|
|
8
17
|
import { useEntitiesOptional } from "@/ui/providers/entities-context";
|
|
9
|
-
import {
|
|
18
|
+
import { useSpaceInvoicesRuntimeOptional } from "@/ui/providers/space-invoices-provider";
|
|
19
|
+
import { getDocumentConfigFromShareableId } from "../types";
|
|
10
20
|
import { DocumentPreviewSkeleton } from "./document-preview-skeleton";
|
|
11
21
|
import { ScaledDocumentPreview } from "./scaled-document-preview";
|
|
12
22
|
import { useA4Scaling } from "./use-a4-scaling";
|
|
@@ -21,21 +31,7 @@ function emitSavedPreviewDebug(detail: Record<string, unknown>) {
|
|
|
21
31
|
window.dispatchEvent(new CustomEvent(SAVED_PREVIEW_TIMING_EVENT, { detail }));
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get API path segment from shareable ID prefix
|
|
28
|
-
* Shareable IDs are prefixed with document type: inv_share_, est_share_, cre_share_, adv_share_
|
|
29
|
-
*/
|
|
30
|
-
function getDocTypePathFromShareableId(shareableId: string): string {
|
|
31
|
-
if (shareableId.startsWith("inv_share_")) return "invoices";
|
|
32
|
-
if (shareableId.startsWith("est_share_")) return "estimates";
|
|
33
|
-
if (shareableId.startsWith("cre_share_")) return "credit-notes";
|
|
34
|
-
if (shareableId.startsWith("adv_share_")) return "advance-invoices";
|
|
35
|
-
// Fallback to invoices for backwards compatibility
|
|
36
|
-
return "invoices";
|
|
37
|
-
}
|
|
38
|
-
|
|
34
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
39
35
|
export function getSavedDocumentPreviewQueryKey({
|
|
40
36
|
documentId,
|
|
41
37
|
documentUpdatedAt,
|
|
@@ -62,14 +58,18 @@ export function getSavedDocumentPreviewQueryKey({
|
|
|
62
58
|
] as const;
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
export function getSavedDocumentPreviewQueryPrefix(documentId: string) {
|
|
62
|
+
return [SAVED_DOCUMENT_PREVIEW_QUERY_KEY, documentId] as const;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
65
|
type DocumentPreviewDisplayProps = {
|
|
66
66
|
/** The document to display (invoice, estimate, credit note, or advance invoice) */
|
|
67
67
|
document: Document;
|
|
68
68
|
template?: "modern" | "classic" | "condensed" | "minimal" | "fashion";
|
|
69
69
|
className?: string;
|
|
70
70
|
apiBaseUrl?: string;
|
|
71
|
-
/**
|
|
72
|
-
|
|
71
|
+
/** Language for translated labels in public preview rendering. */
|
|
72
|
+
language?: string;
|
|
73
73
|
/** Whether this is a public view (no auth required) */
|
|
74
74
|
isPublicView?: boolean;
|
|
75
75
|
/** Shareable ID for public view (required when isPublicView is true) */
|
|
@@ -80,12 +80,16 @@ type DocumentPreviewDisplayProps = {
|
|
|
80
80
|
documentTypeLabel?: string;
|
|
81
81
|
/** Whether preview fetching is currently allowed */
|
|
82
82
|
fetchEnabled?: boolean;
|
|
83
|
+
/** When true, keep the preview card fixed and scroll only the PDF viewport inside it */
|
|
84
|
+
containedScroll?: boolean;
|
|
83
85
|
};
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Document Preview Display Component
|
|
87
89
|
*
|
|
88
90
|
* Fetches and displays the HTML preview of a saved document.
|
|
91
|
+
* Saved previews use backend/entity defaults for document output.
|
|
92
|
+
* Public previews may pass a language override while leaving formatting locale to the backend default.
|
|
89
93
|
* Works with any document type (invoice, estimate, credit note, advance invoice).
|
|
90
94
|
* Document type is auto-detected from the ID prefix.
|
|
91
95
|
*/
|
|
@@ -94,32 +98,39 @@ export function DocumentPreviewDisplay({
|
|
|
94
98
|
template,
|
|
95
99
|
className,
|
|
96
100
|
apiBaseUrl,
|
|
97
|
-
|
|
101
|
+
language,
|
|
98
102
|
isPublicView = false,
|
|
99
103
|
shareableId,
|
|
100
104
|
t: tProp,
|
|
101
105
|
documentTypeLabel,
|
|
102
106
|
fetchEnabled = true,
|
|
107
|
+
containedScroll = false,
|
|
103
108
|
}: DocumentPreviewDisplayProps) {
|
|
104
109
|
const t = tProp ?? ((key: string) => key);
|
|
105
110
|
const entitiesContext = useEntitiesOptional();
|
|
106
111
|
const activeEntity = entitiesContext?.activeEntity;
|
|
107
|
-
const
|
|
112
|
+
const runtime = useSpaceInvoicesRuntimeOptional();
|
|
113
|
+
const countryCapabilities = getEntityCountryCapabilities(activeEntity);
|
|
108
114
|
const documentId = document?.id;
|
|
109
115
|
const documentUpdatedAt = document?.updated_at ?? null;
|
|
116
|
+
const effectiveTemplate = countryCapabilities.allowPdfTemplateSelection
|
|
117
|
+
? template
|
|
118
|
+
: countryCapabilities.resolvedPdfTemplate;
|
|
110
119
|
|
|
111
120
|
const queryKey = useMemo(() => {
|
|
112
121
|
return getSavedDocumentPreviewQueryKey({
|
|
113
122
|
documentId: documentId ?? shareableId ?? "",
|
|
114
123
|
documentUpdatedAt,
|
|
115
124
|
entityId: activeEntity?.id,
|
|
116
|
-
template,
|
|
125
|
+
template: effectiveTemplate,
|
|
117
126
|
isPublicView,
|
|
118
127
|
shareableId,
|
|
119
128
|
});
|
|
120
|
-
}, [activeEntity?.id, documentId, documentUpdatedAt, isPublicView, shareableId
|
|
129
|
+
}, [activeEntity?.id, documentId, documentUpdatedAt, effectiveTemplate, isPublicView, shareableId]);
|
|
121
130
|
|
|
122
|
-
const prerequisitesReady = isPublicView
|
|
131
|
+
const prerequisitesReady = isPublicView
|
|
132
|
+
? !!shareableId && !!apiBaseUrl
|
|
133
|
+
: !!documentId && !!activeEntity?.id && !!runtime?.hasAccessToken;
|
|
123
134
|
|
|
124
135
|
const previewQuery = useQuery({
|
|
125
136
|
queryKey,
|
|
@@ -133,18 +144,21 @@ export function DocumentPreviewDisplay({
|
|
|
133
144
|
|
|
134
145
|
try {
|
|
135
146
|
if (isPublicView && shareableId && apiBaseUrl) {
|
|
136
|
-
const
|
|
137
|
-
const response = await fetch(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
const params = language ? `?${new URLSearchParams({ language }).toString()}` : "";
|
|
148
|
+
const response = await fetch(
|
|
149
|
+
`${apiBaseUrl}/${getDocumentConfigFromShareableId(shareableId).apiEndpoint}/shareable/${shareableId}/html${params}`,
|
|
150
|
+
{
|
|
151
|
+
headers: getClientHeaders("ui"),
|
|
152
|
+
signal: abortController.signal,
|
|
153
|
+
},
|
|
154
|
+
);
|
|
141
155
|
if (!response.ok) {
|
|
142
156
|
throw new Error("Failed to load preview");
|
|
143
157
|
}
|
|
144
158
|
return await response.text();
|
|
145
159
|
}
|
|
146
160
|
|
|
147
|
-
if (!documentId || !activeEntity?.id || !
|
|
161
|
+
if (!documentId || !activeEntity?.id || !runtime?.hasAccessToken) {
|
|
148
162
|
throw new Error("Preview context unavailable");
|
|
149
163
|
}
|
|
150
164
|
|
|
@@ -154,9 +168,9 @@ export function DocumentPreviewDisplay({
|
|
|
154
168
|
documentId,
|
|
155
169
|
});
|
|
156
170
|
|
|
157
|
-
const html = await
|
|
171
|
+
const html = await invoices.renderHtml(
|
|
158
172
|
documentId,
|
|
159
|
-
{ template },
|
|
173
|
+
{ template: effectiveTemplate },
|
|
160
174
|
{
|
|
161
175
|
entity_id: activeEntity.id,
|
|
162
176
|
signal: abortController.signal,
|
|
@@ -204,22 +218,33 @@ export function DocumentPreviewDisplay({
|
|
|
204
218
|
reason: "missing_context",
|
|
205
219
|
documentId,
|
|
206
220
|
hasEntityId: !!activeEntity?.id,
|
|
207
|
-
|
|
221
|
+
hasRuntimeToken: !!runtime?.hasAccessToken,
|
|
208
222
|
});
|
|
209
|
-
}, [activeEntity?.id, documentId, isPublicView, prerequisitesReady,
|
|
223
|
+
}, [activeEntity?.id, documentId, isPublicView, prerequisitesReady, runtime?.hasAccessToken]);
|
|
210
224
|
|
|
211
225
|
return (
|
|
212
|
-
<div
|
|
226
|
+
<div
|
|
227
|
+
ref={containerRef}
|
|
228
|
+
className={cn("relative", containedScroll ? "flex h-full min-h-0 flex-col" : "min-h-full", className)}
|
|
229
|
+
>
|
|
213
230
|
{/* Loading state */}
|
|
214
231
|
{isLoading && <DocumentPreviewSkeleton />}
|
|
215
232
|
|
|
216
233
|
{/* Error state */}
|
|
217
234
|
{error && !isLoading && (
|
|
218
|
-
<div
|
|
235
|
+
<div
|
|
236
|
+
className={cn(
|
|
237
|
+
"flex h-full items-center justify-center rounded-lg p-8",
|
|
238
|
+
isPublicView ? "border border-border/70 bg-muted/20" : "border border-destructive/50 bg-destructive/10",
|
|
239
|
+
)}
|
|
240
|
+
>
|
|
219
241
|
<div className="flex flex-col items-center gap-2 text-center">
|
|
220
|
-
<AlertCircle className="h-8 w-8 text-destructive" />
|
|
221
|
-
<p className="font-semibold text-
|
|
222
|
-
|
|
242
|
+
<AlertCircle className={cn("h-8 w-8", isPublicView ? "text-muted-foreground" : "text-destructive")} />
|
|
243
|
+
<p className={cn("font-semibold", isPublicView ? "text-foreground" : "text-destructive")}>
|
|
244
|
+
{t("Preview Error")}
|
|
245
|
+
</p>
|
|
246
|
+
<p className="text-muted-foreground text-sm">{isPublicView ? t("Preview unavailable") : error}</p>
|
|
247
|
+
{!isPublicView && <p className="text-muted-foreground text-sm">{error}</p>}
|
|
223
248
|
</div>
|
|
224
249
|
</div>
|
|
225
250
|
)}
|
|
@@ -248,6 +273,7 @@ export function DocumentPreviewDisplay({
|
|
|
248
273
|
A4_WIDTH_PX={A4_WIDTH_PX}
|
|
249
274
|
contentRef={contentRef}
|
|
250
275
|
entityUpdatedAt={activeEntity?.updated_at ? new Date(activeEntity.updated_at) : null}
|
|
276
|
+
containedScroll={containedScroll}
|
|
251
277
|
/>
|
|
252
278
|
)}
|
|
253
279
|
</div>
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
DocumentPreviewDisplay,
|
|
3
|
+
getSavedDocumentPreviewQueryKey,
|
|
4
|
+
getSavedDocumentPreviewQueryPrefix,
|
|
5
|
+
InvoicePreviewDisplay,
|
|
6
|
+
} from "./document-preview-display";
|
|
2
7
|
export { DocumentPreviewSkeleton } from "./document-preview-skeleton";
|
|
3
8
|
export { ScaledDocumentPreview } from "./scaled-document-preview";
|
|
4
9
|
export { useA4Scaling } from "./use-a4-scaling";
|
|
@@ -9,6 +9,7 @@ interface ScaledDocumentPreviewProps {
|
|
|
9
9
|
A4_WIDTH_PX: number;
|
|
10
10
|
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
11
11
|
entityUpdatedAt?: Date | null;
|
|
12
|
+
containedScroll?: boolean;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/** Extract @font-face rules from CSS so they can be hoisted to the document head */
|
|
@@ -53,7 +54,12 @@ function hoistFontFaces(html: string): string {
|
|
|
53
54
|
* Uses Shadow DOM to completely isolate template CSS from the parent page.
|
|
54
55
|
* @font-face rules are hoisted to document <head> for reliable font loading.
|
|
55
56
|
*/
|
|
56
|
-
export const ScaledDocumentPreview: FC<ScaledDocumentPreviewProps> = ({
|
|
57
|
+
export const ScaledDocumentPreview: FC<ScaledDocumentPreviewProps> = ({
|
|
58
|
+
htmlContent,
|
|
59
|
+
scale,
|
|
60
|
+
A4_WIDTH_PX,
|
|
61
|
+
containedScroll = false,
|
|
62
|
+
}) => {
|
|
57
63
|
const shadowHostRef = useRef<HTMLDivElement>(null);
|
|
58
64
|
const shadowRootRef = useRef<ShadowRoot | null>(null);
|
|
59
65
|
// A4 height in pixels at 96 DPI (297mm)
|
|
@@ -84,27 +90,35 @@ export const ScaledDocumentPreview: FC<ScaledDocumentPreviewProps> = ({ htmlCont
|
|
|
84
90
|
setTimeout(measureHeight, 100);
|
|
85
91
|
}, [htmlContent]);
|
|
86
92
|
|
|
87
|
-
|
|
88
|
-
<div
|
|
93
|
+
const scaledPage = (
|
|
94
|
+
<div
|
|
95
|
+
style={{
|
|
96
|
+
width: A4_WIDTH_PX * scale,
|
|
97
|
+
height: contentHeight * scale,
|
|
98
|
+
margin: "0 auto",
|
|
99
|
+
overflow: "hidden",
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
89
102
|
<div
|
|
103
|
+
ref={shadowHostRef}
|
|
90
104
|
style={{
|
|
91
|
-
width: A4_WIDTH_PX
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
width: A4_WIDTH_PX,
|
|
106
|
+
minHeight: contentHeight,
|
|
107
|
+
transform: `scale(${scale})`,
|
|
108
|
+
transformOrigin: "top left",
|
|
109
|
+
background: "white",
|
|
95
110
|
}}
|
|
96
|
-
|
|
97
|
-
<div
|
|
98
|
-
ref={shadowHostRef}
|
|
99
|
-
style={{
|
|
100
|
-
width: A4_WIDTH_PX,
|
|
101
|
-
minHeight: contentHeight,
|
|
102
|
-
transform: `scale(${scale})`,
|
|
103
|
-
transformOrigin: "top left",
|
|
104
|
-
background: "white",
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
111
|
+
/>
|
|
108
112
|
</div>
|
|
109
113
|
);
|
|
114
|
+
|
|
115
|
+
if (containedScroll) {
|
|
116
|
+
return (
|
|
117
|
+
<div className="flex h-full min-h-0 flex-col rounded-lg border bg-neutral-100 p-4">
|
|
118
|
+
<div className="min-h-0 flex-1 overflow-y-auto">{scaledPage}</div>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return <div className="rounded-lg border bg-neutral-100 p-4">{scaledPage}</div>;
|
|
110
124
|
};
|
|
@@ -68,3 +68,27 @@ export const DOCUMENT_CONFIGS: Record<DocumentTypes, DocumentConfig> = {
|
|
|
68
68
|
export function getDocumentConfig(type: DocumentTypes): DocumentConfig {
|
|
69
69
|
return DOCUMENT_CONFIGS[type];
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
export function getDocumentSingularName(type: DocumentTypes): string {
|
|
73
|
+
return DOCUMENT_CONFIGS[type].singularName;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function getDocumentPluralName(type: DocumentTypes): string {
|
|
77
|
+
return DOCUMENT_CONFIGS[type].pluralName;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Infer document type from shareable ID prefix.
|
|
82
|
+
* Falls back to invoices for backwards compatibility.
|
|
83
|
+
*/
|
|
84
|
+
export function getDocumentTypeFromShareableId(shareableId: string): DocumentTypes {
|
|
85
|
+
if (shareableId.startsWith("est_share_")) return "estimate";
|
|
86
|
+
if (shareableId.startsWith("cre_share_")) return "credit_note";
|
|
87
|
+
if (shareableId.startsWith("adv_share_")) return "advance_invoice";
|
|
88
|
+
if (shareableId.startsWith("del_share_")) return "delivery_note";
|
|
89
|
+
return "invoice";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getDocumentConfigFromShareableId(shareableId: string): DocumentConfig {
|
|
93
|
+
return getDocumentConfig(getDocumentTypeFromShareableId(shareableId));
|
|
94
|
+
}
|