@spaceinvoices/react-ui 0.4.10 → 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/README.md +24 -8
- package/cli/dist/index.js +89 -26
- package/package.json +6 -2
- package/registry.json +30 -31
- package/spaceinvoices.schema.json +6 -1
- 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 +131 -75
- 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 +18 -3
- package/src/components/entities/entity-settings-form/locales/en.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +18 -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 +18 -3
- package/src/components/entities/entity-settings-form/locales/hr.ts +26 -11
- package/src/components/entities/entity-settings-form/locales/is.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +18 -3
- package/src/components/entities/entity-settings-form/locales/nb.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +18 -3
- package/src/components/entities/entity-settings-form/locales/pl.ts +18 -3
- package/src/components/entities/entity-settings-form/locales/pt.ts +18 -3
- package/src/components/entities/entity-settings-form/locales/sk.ts +199 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +30 -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 +112 -9
- 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 +39 -0
- package/src/components/invoices/send-email-dialog/locales/en.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +39 -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 +39 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +39 -0
- package/src/components/invoices/send-email-dialog/locales/is.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +39 -0
- package/src/components/invoices/send-email-dialog/locales/nb.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +39 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +39 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +39 -0
- package/src/components/invoices/send-email-dialog/locales/sk.ts +58 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +39 -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/index.ts +1 -0
- 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/sidebar.tsx +3 -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 +17 -7
- package/src/generated/schemas/account_webhook.ts +43 -0
- package/src/generated/schemas/accountwebhook.ts +67 -0
- package/src/generated/schemas/entity.ts +343 -4
- package/src/generated/schemas/exportsloveniavodxml_body.ts +16 -0
- package/src/generated/schemas/exportsloveniayearlynormiranireport_body.ts +27 -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 +12 -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 +118 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdvanceInvoice, CreditNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
1
|
+
import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
2
2
|
import {
|
|
3
3
|
Ban,
|
|
4
4
|
Check,
|
|
@@ -26,8 +26,9 @@ import {
|
|
|
26
26
|
DropdownMenuSeparator,
|
|
27
27
|
DropdownMenuTrigger,
|
|
28
28
|
} from "@/ui/components/ui/dropdown-menu";
|
|
29
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "@/ui/components/ui/tooltip";
|
|
29
|
+
import { actionMenuTooltipProps, Tooltip, TooltipContent, TooltipTrigger } from "@/ui/components/ui/tooltip";
|
|
30
30
|
import { type DocumentType, getAllowedDuplicateTargets } from "@/ui/hooks/use-duplicate-document";
|
|
31
|
+
import { getDocumentCountryCapabilities } from "@/ui/lib/country-capabilities";
|
|
31
32
|
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
32
33
|
import { createTranslation } from "@/ui/lib/translation";
|
|
33
34
|
import type { Entity } from "@/ui/providers/entities-context";
|
|
@@ -44,9 +45,9 @@ import { useDocumentDownload } from "./use-document-download";
|
|
|
44
45
|
|
|
45
46
|
const translations = { sl, de, it, fr, es, pt, nl, pl, hr } as const;
|
|
46
47
|
|
|
47
|
-
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice;
|
|
48
|
+
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
48
49
|
|
|
49
|
-
/** Language options for PDF
|
|
50
|
+
/** Language options for explicit PDF output language override. */
|
|
50
51
|
const PDF_LANGUAGE_CODES = [
|
|
51
52
|
{ label: "English", code: "en-US" },
|
|
52
53
|
{ label: "German", code: "de-DE" },
|
|
@@ -71,6 +72,7 @@ const PDF_LANGUAGE_CODES = [
|
|
|
71
72
|
interface DocumentActionsBarProps extends ComponentTranslationProps {
|
|
72
73
|
document: Document;
|
|
73
74
|
documentType: DocumentType;
|
|
75
|
+
allowedDuplicateTargets?: DocumentType[];
|
|
74
76
|
entity: Entity;
|
|
75
77
|
currentLocale: string;
|
|
76
78
|
onAddPayment?: () => void;
|
|
@@ -89,12 +91,16 @@ interface DocumentActionsBarProps extends ComponentTranslationProps {
|
|
|
89
91
|
isUnsharing?: boolean;
|
|
90
92
|
/** Called when user wants to duplicate/convert document */
|
|
91
93
|
onDuplicate?: (targetType: DocumentType) => void;
|
|
94
|
+
/** Disable specific duplicate/convert targets while keeping the action visible */
|
|
95
|
+
duplicateTargetDisabledReasons?: Partial<Record<DocumentType, string>>;
|
|
92
96
|
/** Called when user wants to edit the document */
|
|
93
97
|
onEdit?: () => void;
|
|
94
98
|
/** Whether the document is editable (not voided, not fiscalized) */
|
|
95
99
|
isEditable?: boolean;
|
|
96
100
|
/** Reason why editing is disabled (shown as tooltip) */
|
|
97
101
|
editDisabledReason?: string;
|
|
102
|
+
/** Reason why adding payment is disabled (shown as tooltip) */
|
|
103
|
+
paymentDisabledReason?: string;
|
|
98
104
|
/** Called when user wants to finalize a draft document */
|
|
99
105
|
onFinalize?: () => void;
|
|
100
106
|
/** Whether finalization is in progress */
|
|
@@ -111,11 +117,16 @@ interface DocumentActionsBarProps extends ComponentTranslationProps {
|
|
|
111
117
|
onVoid?: () => void;
|
|
112
118
|
/** Whether voiding is in progress */
|
|
113
119
|
isVoiding?: boolean;
|
|
120
|
+
/** Reason why voiding is disabled (shown as tooltip) */
|
|
121
|
+
voidDisabledReason?: string;
|
|
122
|
+
/** Whether users can choose alternative PDF label languages */
|
|
123
|
+
allowPdfLanguageSelection?: boolean;
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
export function DocumentActionsBar({
|
|
117
127
|
document,
|
|
118
128
|
documentType,
|
|
129
|
+
allowedDuplicateTargets,
|
|
119
130
|
entity,
|
|
120
131
|
currentLocale,
|
|
121
132
|
onAddPayment,
|
|
@@ -129,9 +140,11 @@ export function DocumentActionsBar({
|
|
|
129
140
|
isSharing,
|
|
130
141
|
isUnsharing,
|
|
131
142
|
onDuplicate,
|
|
143
|
+
duplicateTargetDisabledReasons,
|
|
132
144
|
onEdit,
|
|
133
145
|
isEditable,
|
|
134
146
|
editDisabledReason,
|
|
147
|
+
paymentDisabledReason,
|
|
135
148
|
onFinalize,
|
|
136
149
|
isFinalizing,
|
|
137
150
|
onDeleteDraft,
|
|
@@ -140,16 +153,20 @@ export function DocumentActionsBar({
|
|
|
140
153
|
recurringLabel,
|
|
141
154
|
onVoid,
|
|
142
155
|
isVoiding,
|
|
156
|
+
voidDisabledReason,
|
|
157
|
+
allowPdfLanguageSelection = true,
|
|
143
158
|
...i18nProps
|
|
144
159
|
}: DocumentActionsBarProps) {
|
|
145
160
|
const t = createTranslation({ ...i18nProps, translations, locale: currentLocale });
|
|
146
161
|
const [linkCopied, setLinkCopied] = useState(false);
|
|
162
|
+
const duplicateTargets = allowedDuplicateTargets ?? getAllowedDuplicateTargets(documentType);
|
|
147
163
|
|
|
148
164
|
const { isDownloadingPdf, isDownloadingEslog, downloadPdf, downloadEslog } = useDocumentDownload({
|
|
149
165
|
onDownloadStart,
|
|
150
166
|
onDownloadSuccess,
|
|
151
167
|
onDownloadError,
|
|
152
168
|
});
|
|
169
|
+
const countryCapabilities = getDocumentCountryCapabilities(entity, documentType, document);
|
|
153
170
|
|
|
154
171
|
const supportsPayments =
|
|
155
172
|
documentType === "invoice" || documentType === "advance_invoice" || documentType === "credit_note";
|
|
@@ -158,12 +175,36 @@ export function DocumentActionsBar({
|
|
|
158
175
|
const eslogValid = (document as Invoice).eslog?.validation_status === "valid";
|
|
159
176
|
const showEslogDownload = eslogFeatureAvailable && eslogValid;
|
|
160
177
|
|
|
161
|
-
const shareableId = (document as Invoice).shareable_id;
|
|
162
|
-
const shareUrl = shareableId ? `${window.location.origin}/
|
|
178
|
+
const shareableId = (document as Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote).shareable_id;
|
|
179
|
+
const shareUrl = shareableId ? `${window.location.origin}/documents/shareable/${shareableId}` : null;
|
|
163
180
|
|
|
164
181
|
const handleDownloadPdf = (language?: string) => downloadPdf(document, documentType, language);
|
|
165
182
|
const handleDownloadEslog = () => downloadEslog(document, documentType);
|
|
166
183
|
|
|
184
|
+
const getDocumentTypeActionLabel = (type: DocumentType) => {
|
|
185
|
+
const translated = t(type);
|
|
186
|
+
if (translated !== type) return translated;
|
|
187
|
+
|
|
188
|
+
const englishFallbacks: Record<DocumentType, string> = {
|
|
189
|
+
invoice: "invoice",
|
|
190
|
+
estimate: "estimate",
|
|
191
|
+
credit_note: "credit note",
|
|
192
|
+
advance_invoice: "advance invoice",
|
|
193
|
+
delivery_note: "delivery note",
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return englishFallbacks[type];
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const getDuplicateActionLabel = (targetType: DocumentType) => {
|
|
200
|
+
const specificKey = targetType === documentType ? `Duplicate ${targetType}` : `Create ${targetType}`;
|
|
201
|
+
const translated = t(specificKey);
|
|
202
|
+
if (translated !== specificKey) return translated;
|
|
203
|
+
|
|
204
|
+
const typeLabel = getDocumentTypeActionLabel(targetType);
|
|
205
|
+
return targetType === documentType ? `Duplicate ${typeLabel}` : `Create ${typeLabel}`;
|
|
206
|
+
};
|
|
207
|
+
|
|
167
208
|
const handleCopyShareLink = async () => {
|
|
168
209
|
if (!shareUrl) return;
|
|
169
210
|
try {
|
|
@@ -179,7 +220,9 @@ export function DocumentActionsBar({
|
|
|
179
220
|
const isDraft = (document as any).is_draft === true;
|
|
180
221
|
|
|
181
222
|
// --- Primary actions (always visible) ---
|
|
182
|
-
const
|
|
223
|
+
const showPdfLanguageSelection = allowPdfLanguageSelection && countryCapabilities.allowPdfLanguageSelection;
|
|
224
|
+
|
|
225
|
+
const pdfButton = showPdfLanguageSelection ? (
|
|
183
226
|
<div className="flex">
|
|
184
227
|
<Button
|
|
185
228
|
variant="outline"
|
|
@@ -211,6 +254,17 @@ export function DocumentActionsBar({
|
|
|
211
254
|
</DropdownMenuContent>
|
|
212
255
|
</DropdownMenu>
|
|
213
256
|
</div>
|
|
257
|
+
) : (
|
|
258
|
+
<Button
|
|
259
|
+
variant="outline"
|
|
260
|
+
size="sm"
|
|
261
|
+
disabled={isDownloadingPdf}
|
|
262
|
+
onClick={() => handleDownloadPdf()}
|
|
263
|
+
className="cursor-pointer"
|
|
264
|
+
>
|
|
265
|
+
{isDownloadingPdf ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : <Download className="mr-2 h-4 w-4" />}
|
|
266
|
+
{t("PDF")}
|
|
267
|
+
</Button>
|
|
214
268
|
);
|
|
215
269
|
|
|
216
270
|
const eslogButton = showEslogDownload ? (
|
|
@@ -226,19 +280,45 @@ export function DocumentActionsBar({
|
|
|
226
280
|
</Button>
|
|
227
281
|
) : null;
|
|
228
282
|
|
|
229
|
-
const sendButton = (
|
|
230
|
-
<Button
|
|
283
|
+
const sendButton = onSendEmail ? (
|
|
284
|
+
<Button
|
|
285
|
+
variant="outline"
|
|
286
|
+
size="sm"
|
|
287
|
+
onClick={onSendEmail}
|
|
288
|
+
className="cursor-pointer"
|
|
289
|
+
data-demo="marketing-demo-send-email"
|
|
290
|
+
>
|
|
231
291
|
<Mail className="mr-2 h-4 w-4" />
|
|
232
292
|
{t("Send")}
|
|
233
293
|
</Button>
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
const paymentButton = supportsPayments ? (
|
|
237
|
-
<Button variant="outline" size="sm" onClick={onAddPayment} className="cursor-pointer">
|
|
238
|
-
<Plus className="mr-2 h-4 w-4" />
|
|
239
|
-
{t("Payment")}
|
|
240
|
-
</Button>
|
|
241
294
|
) : null;
|
|
295
|
+
const paymentAllowed = countryCapabilities.allowPaymentAction;
|
|
296
|
+
|
|
297
|
+
const paymentButton =
|
|
298
|
+
supportsPayments && paymentAllowed && (onAddPayment || paymentDisabledReason) ? (
|
|
299
|
+
paymentDisabledReason ? (
|
|
300
|
+
<Tooltip>
|
|
301
|
+
<TooltipTrigger asChild>
|
|
302
|
+
<Button
|
|
303
|
+
variant="outline"
|
|
304
|
+
size="sm"
|
|
305
|
+
aria-disabled="true"
|
|
306
|
+
className="pointer-events-auto opacity-50"
|
|
307
|
+
onClick={(e) => e.preventDefault()}
|
|
308
|
+
>
|
|
309
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
310
|
+
{t("Payment")}
|
|
311
|
+
</Button>
|
|
312
|
+
</TooltipTrigger>
|
|
313
|
+
<TooltipContent {...actionMenuTooltipProps}>{paymentDisabledReason}</TooltipContent>
|
|
314
|
+
</Tooltip>
|
|
315
|
+
) : (
|
|
316
|
+
<Button variant="outline" size="sm" onClick={onAddPayment} className="cursor-pointer">
|
|
317
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
318
|
+
{t("Payment")}
|
|
319
|
+
</Button>
|
|
320
|
+
)
|
|
321
|
+
) : null;
|
|
242
322
|
|
|
243
323
|
// --- Secondary actions (desktop: inline buttons, mobile: overflow menu) ---
|
|
244
324
|
const editButton = onEdit ? (
|
|
@@ -317,33 +397,78 @@ export function DocumentActionsBar({
|
|
|
317
397
|
</Button>
|
|
318
398
|
) : null;
|
|
319
399
|
|
|
320
|
-
const duplicateButton =
|
|
321
|
-
|
|
322
|
-
<
|
|
323
|
-
<
|
|
324
|
-
<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
400
|
+
const duplicateButton =
|
|
401
|
+
onDuplicate && duplicateTargets.length > 0 ? (
|
|
402
|
+
<DropdownMenu>
|
|
403
|
+
<DropdownMenuTrigger asChild>
|
|
404
|
+
<Button variant="outline" size="sm" className="cursor-pointer">
|
|
405
|
+
<Copy className="mr-2 h-4 w-4" />
|
|
406
|
+
{t("Duplicate")}
|
|
407
|
+
<ChevronDown className="ml-1 h-4 w-4" />
|
|
408
|
+
</Button>
|
|
409
|
+
</DropdownMenuTrigger>
|
|
410
|
+
<DropdownMenuContent align="end">
|
|
411
|
+
{duplicateTargets.map((targetType) => {
|
|
412
|
+
const disabledReason = duplicateTargetDisabledReasons?.[targetType];
|
|
413
|
+
const item = (
|
|
414
|
+
<DropdownMenuItem
|
|
415
|
+
key={targetType}
|
|
416
|
+
onClick={disabledReason ? undefined : () => onDuplicate(targetType)}
|
|
417
|
+
disabled={!!disabledReason}
|
|
418
|
+
className="cursor-pointer"
|
|
419
|
+
>
|
|
420
|
+
{getDuplicateActionLabel(targetType)}
|
|
421
|
+
</DropdownMenuItem>
|
|
422
|
+
);
|
|
338
423
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
424
|
+
if (!disabledReason) return item;
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<Tooltip key={targetType}>
|
|
428
|
+
<TooltipTrigger asChild>
|
|
429
|
+
<div>{item}</div>
|
|
430
|
+
</TooltipTrigger>
|
|
431
|
+
<TooltipContent {...actionMenuTooltipProps}>{disabledReason}</TooltipContent>
|
|
432
|
+
</Tooltip>
|
|
433
|
+
);
|
|
434
|
+
})}
|
|
435
|
+
</DropdownMenuContent>
|
|
436
|
+
</DropdownMenu>
|
|
345
437
|
) : null;
|
|
346
438
|
|
|
439
|
+
const isAlreadyVoided = !!(document as any)?.voided_at;
|
|
440
|
+
const effectiveVoidDisabledReason =
|
|
441
|
+
voidDisabledReason || (isAlreadyVoided ? t("This document is already voided.") : undefined);
|
|
442
|
+
|
|
443
|
+
const voidButton =
|
|
444
|
+
!isDraft && onVoid
|
|
445
|
+
? (() => {
|
|
446
|
+
const button = (
|
|
447
|
+
<Button
|
|
448
|
+
variant="destructive"
|
|
449
|
+
size="sm"
|
|
450
|
+
onClick={effectiveVoidDisabledReason ? undefined : onVoid}
|
|
451
|
+
disabled={isVoiding || !!effectiveVoidDisabledReason}
|
|
452
|
+
className="cursor-pointer"
|
|
453
|
+
>
|
|
454
|
+
{isVoiding ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : <Ban className="mr-2 h-4 w-4" />}
|
|
455
|
+
{isVoiding ? t("Voiding...") : t("Void")}
|
|
456
|
+
</Button>
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
if (!effectiveVoidDisabledReason) return button;
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<Tooltip>
|
|
463
|
+
<TooltipTrigger asChild>
|
|
464
|
+
<span>{button}</span>
|
|
465
|
+
</TooltipTrigger>
|
|
466
|
+
<TooltipContent {...actionMenuTooltipProps}>{effectiveVoidDisabledReason}</TooltipContent>
|
|
467
|
+
</Tooltip>
|
|
468
|
+
);
|
|
469
|
+
})()
|
|
470
|
+
: null;
|
|
471
|
+
|
|
347
472
|
const finalizeButton =
|
|
348
473
|
isDraft && onFinalize ? (
|
|
349
474
|
<Button variant="default" size="sm" onClick={onFinalize} disabled={isFinalizing} className="cursor-pointer">
|
|
@@ -378,14 +503,14 @@ export function DocumentActionsBar({
|
|
|
378
503
|
|
|
379
504
|
return (
|
|
380
505
|
<div className="flex flex-wrap items-center gap-2">
|
|
381
|
-
{/*
|
|
506
|
+
{/* Always-visible compact actions */}
|
|
382
507
|
{pdfButton}
|
|
383
|
-
{eslogButton}
|
|
384
508
|
{sendButton}
|
|
385
|
-
{paymentButton}
|
|
386
509
|
|
|
387
|
-
{/*
|
|
510
|
+
{/* Additional actions — visible on md+ screens as inline buttons */}
|
|
388
511
|
<div className="hidden flex-wrap items-center gap-2 md:flex">
|
|
512
|
+
{eslogButton}
|
|
513
|
+
{paymentButton}
|
|
389
514
|
{editButton}
|
|
390
515
|
{shareButton}
|
|
391
516
|
{recurringButton}
|
|
@@ -396,7 +521,7 @@ export function DocumentActionsBar({
|
|
|
396
521
|
</div>
|
|
397
522
|
|
|
398
523
|
{/* Mobile overflow — visible on small screens only */}
|
|
399
|
-
{hasSecondaryActions && (
|
|
524
|
+
{(eslogButton || paymentButton || hasSecondaryActions) && (
|
|
400
525
|
<DropdownMenu>
|
|
401
526
|
<DropdownMenuTrigger asChild>
|
|
402
527
|
<Button variant="outline" size="sm" className="cursor-pointer md:hidden">
|
|
@@ -404,6 +529,26 @@ export function DocumentActionsBar({
|
|
|
404
529
|
</Button>
|
|
405
530
|
</DropdownMenuTrigger>
|
|
406
531
|
<DropdownMenuContent align="end">
|
|
532
|
+
{eslogButton && (
|
|
533
|
+
<DropdownMenuItem onClick={handleDownloadEslog} disabled={isDownloadingEslog} className="cursor-pointer">
|
|
534
|
+
<FileCode2 className="mr-2 h-4 w-4" />
|
|
535
|
+
e-SLOG
|
|
536
|
+
</DropdownMenuItem>
|
|
537
|
+
)}
|
|
538
|
+
{supportsPayments && paymentAllowed && (onAddPayment || paymentDisabledReason) ? (
|
|
539
|
+
paymentDisabledReason ? (
|
|
540
|
+
<DropdownMenuItem disabled className="cursor-pointer">
|
|
541
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
542
|
+
{t("Payment")}
|
|
543
|
+
</DropdownMenuItem>
|
|
544
|
+
) : (
|
|
545
|
+
<DropdownMenuItem onClick={onAddPayment} className="cursor-pointer">
|
|
546
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
547
|
+
{t("Payment")}
|
|
548
|
+
</DropdownMenuItem>
|
|
549
|
+
)
|
|
550
|
+
) : null}
|
|
551
|
+
{(eslogButton || paymentButton) && hasSecondaryActions && <DropdownMenuSeparator />}
|
|
407
552
|
{onEdit && (
|
|
408
553
|
<DropdownMenuItem
|
|
409
554
|
onClick={isEditable ? onEdit : undefined}
|
|
@@ -431,15 +576,34 @@ export function DocumentActionsBar({
|
|
|
431
576
|
{recurringLabel || t("Recurring")}
|
|
432
577
|
</DropdownMenuItem>
|
|
433
578
|
)}
|
|
434
|
-
{onDuplicate && (
|
|
579
|
+
{onDuplicate && duplicateTargets.length > 0 && (
|
|
435
580
|
<>
|
|
436
581
|
<DropdownMenuSeparator />
|
|
437
|
-
{
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
582
|
+
{duplicateTargets.map((targetType) => {
|
|
583
|
+
const disabledReason = duplicateTargetDisabledReasons?.[targetType];
|
|
584
|
+
const item = (
|
|
585
|
+
<DropdownMenuItem
|
|
586
|
+
key={targetType}
|
|
587
|
+
onClick={disabledReason ? undefined : () => onDuplicate(targetType)}
|
|
588
|
+
disabled={!!disabledReason}
|
|
589
|
+
className="cursor-pointer"
|
|
590
|
+
>
|
|
591
|
+
<Copy className="mr-2 h-4 w-4" />
|
|
592
|
+
{getDuplicateActionLabel(targetType)}
|
|
593
|
+
</DropdownMenuItem>
|
|
594
|
+
);
|
|
595
|
+
|
|
596
|
+
if (!disabledReason) return item;
|
|
597
|
+
|
|
598
|
+
return (
|
|
599
|
+
<Tooltip key={targetType}>
|
|
600
|
+
<TooltipTrigger asChild>
|
|
601
|
+
<div>{item}</div>
|
|
602
|
+
</TooltipTrigger>
|
|
603
|
+
<TooltipContent {...actionMenuTooltipProps}>{disabledReason}</TooltipContent>
|
|
604
|
+
</Tooltip>
|
|
605
|
+
);
|
|
606
|
+
})}
|
|
443
607
|
</>
|
|
444
608
|
)}
|
|
445
609
|
{(voidButton || finalizeButton || deleteDraftButton) && <DropdownMenuSeparator />}
|
|
@@ -449,16 +613,31 @@ export function DocumentActionsBar({
|
|
|
449
613
|
{t("Finalize")}
|
|
450
614
|
</DropdownMenuItem>
|
|
451
615
|
)}
|
|
452
|
-
{!isDraft &&
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
616
|
+
{!isDraft &&
|
|
617
|
+
onVoid &&
|
|
618
|
+
(() => {
|
|
619
|
+
const item = (
|
|
620
|
+
<DropdownMenuItem
|
|
621
|
+
onClick={effectiveVoidDisabledReason ? undefined : onVoid}
|
|
622
|
+
disabled={isVoiding || !!effectiveVoidDisabledReason}
|
|
623
|
+
className="hover:!bg-destructive hover:!text-destructive-foreground focus:!bg-destructive focus:!text-destructive-foreground cursor-pointer text-destructive"
|
|
624
|
+
>
|
|
625
|
+
<Ban className="mr-2 h-4 w-4" />
|
|
626
|
+
{t("Void")}
|
|
627
|
+
</DropdownMenuItem>
|
|
628
|
+
);
|
|
629
|
+
|
|
630
|
+
if (!effectiveVoidDisabledReason) return item;
|
|
631
|
+
|
|
632
|
+
return (
|
|
633
|
+
<Tooltip>
|
|
634
|
+
<TooltipTrigger asChild>
|
|
635
|
+
<div>{item}</div>
|
|
636
|
+
</TooltipTrigger>
|
|
637
|
+
<TooltipContent {...actionMenuTooltipProps}>{effectiveVoidDisabledReason}</TooltipContent>
|
|
638
|
+
</Tooltip>
|
|
639
|
+
);
|
|
640
|
+
})()}
|
|
462
641
|
{isDraft && onDeleteDraft && (
|
|
463
642
|
<DropdownMenuItem
|
|
464
643
|
onClick={onDeleteDraft}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GetActivities200DataItem } from "@spaceinvoices/js-sdk";
|
|
2
|
+
import { activities as activitiesApi } from "@spaceinvoices/js-sdk";
|
|
2
3
|
import { useQuery } from "@tanstack/react-query";
|
|
3
4
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
5
|
import { useState } from "react";
|
|
@@ -7,7 +8,6 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/ui/components/ui/car
|
|
|
7
8
|
import { Skeleton } from "@/ui/components/ui/skeleton";
|
|
8
9
|
import type { ComponentTranslationProps } from "@/ui/lib/translation";
|
|
9
10
|
import { createTranslation } from "@/ui/lib/translation";
|
|
10
|
-
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
11
11
|
import de from "./locales/de";
|
|
12
12
|
import es from "./locales/es";
|
|
13
13
|
import fr from "./locales/fr";
|
|
@@ -52,8 +52,24 @@ function getActionLabel(action: string, t: (key: string) => string): string {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function getActorLabel(activity: GetActivities200DataItem, t: (key: string) => string, currentUserId?: string): string {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const meLabel = (() => {
|
|
56
|
+
const translated = t("Me");
|
|
57
|
+
if (translated !== "Me") return translated;
|
|
58
|
+
const fallback = t("me");
|
|
59
|
+
if (fallback === "me") return "Me";
|
|
60
|
+
return `${fallback.charAt(0).toUpperCase()}${fallback.slice(1)}`;
|
|
61
|
+
})();
|
|
62
|
+
|
|
63
|
+
if (currentUserId && activity.actor_id === currentUserId) return meLabel;
|
|
64
|
+
if (activity.actor_label) {
|
|
65
|
+
const actorLabelMap: Record<string, string> = {
|
|
66
|
+
User: t("User"),
|
|
67
|
+
user: t("User"),
|
|
68
|
+
Me: meLabel,
|
|
69
|
+
me: meLabel,
|
|
70
|
+
};
|
|
71
|
+
return actorLabelMap[activity.actor_label] || activity.actor_label;
|
|
72
|
+
}
|
|
57
73
|
const typeLabels: Record<string, string> = {
|
|
58
74
|
system: t("System"),
|
|
59
75
|
api_key: "API",
|
|
@@ -72,25 +88,21 @@ export function DocumentActivitiesList({
|
|
|
72
88
|
...i18nProps
|
|
73
89
|
}: DocumentActivitiesListProps) {
|
|
74
90
|
const t = createTranslation({ translations, locale, ...i18nProps });
|
|
75
|
-
const { sdk } = useSDK();
|
|
76
91
|
|
|
77
92
|
const [cursors, setCursors] = useState<string[]>([]);
|
|
78
93
|
const currentCursor = cursors.length > 0 ? cursors[cursors.length - 1] : undefined;
|
|
79
94
|
|
|
80
95
|
const { data: activitiesData, isLoading } = useQuery({
|
|
81
96
|
queryKey: ["activities", documentId, entityId, currentCursor],
|
|
82
|
-
queryFn: async () =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return sdk.activities.list({
|
|
97
|
+
queryFn: async () =>
|
|
98
|
+
activitiesApi.list({
|
|
86
99
|
entity_id: entityId,
|
|
87
100
|
resource_id: documentId,
|
|
88
101
|
order_by: "-created_at",
|
|
89
102
|
limit: PAGE_SIZE,
|
|
90
103
|
next_cursor: currentCursor,
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
enabled: !!sdk && !!entityId && !!documentId,
|
|
104
|
+
}),
|
|
105
|
+
enabled: !!entityId && !!documentId,
|
|
94
106
|
staleTime: 15_000,
|
|
95
107
|
gcTime: 300_000,
|
|
96
108
|
refetchOnWindowFocus: false,
|
|
@@ -16,21 +16,16 @@ import sl from "./locales/sl";
|
|
|
16
16
|
|
|
17
17
|
const translations = { sl, de, it, fr, es, pt, nl, pl, hr } as const;
|
|
18
18
|
|
|
19
|
-
// Document type union
|
|
20
19
|
type Document = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
21
20
|
type DocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
22
21
|
|
|
23
22
|
interface DocumentDetailsCardProps extends ComponentTranslationProps {
|
|
24
23
|
document: Document;
|
|
25
24
|
documentType: DocumentType;
|
|
26
|
-
/** Locale for date formatting */
|
|
27
25
|
locale?: string;
|
|
28
26
|
variant?: "card" | "inline";
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
/**
|
|
32
|
-
* Format currency value
|
|
33
|
-
*/
|
|
34
29
|
function formatCurrency(amount: number, currencyCode: string, locale: string): string {
|
|
35
30
|
return new Intl.NumberFormat(locale, {
|
|
36
31
|
style: "currency",
|
|
@@ -38,9 +33,6 @@ function formatCurrency(amount: number, currencyCode: string, locale: string): s
|
|
|
38
33
|
}).format(amount);
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
/**
|
|
42
|
-
* Format date
|
|
43
|
-
*/
|
|
44
36
|
function formatDate(date: Date | string | null | undefined, locale: string): string {
|
|
45
37
|
if (!date) return "-";
|
|
46
38
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
@@ -54,11 +46,10 @@ function formatDate(date: Date | string | null | undefined, locale: string): str
|
|
|
54
46
|
/**
|
|
55
47
|
* Get payment status for invoice/advance invoice
|
|
56
48
|
*/
|
|
57
|
-
function
|
|
49
|
+
export function getDocumentPaymentStatus(
|
|
58
50
|
document: Invoice | AdvanceInvoice,
|
|
59
51
|
t: (key: string) => string,
|
|
60
52
|
): { label: string; variant: "default" | "secondary" | "destructive" | "outline" } {
|
|
61
|
-
// Check voided_at - ensure it's a valid date, not just truthy
|
|
62
53
|
if (document.voided_at && new Date(document.voided_at).getTime() > 0) {
|
|
63
54
|
return { label: t("Voided"), variant: "secondary" };
|
|
64
55
|
}
|
|
@@ -71,15 +62,6 @@ function getPaymentStatus(
|
|
|
71
62
|
return { label: t("Unpaid"), variant: "destructive" };
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
/**
|
|
75
|
-
* Document Details Card Component
|
|
76
|
-
*
|
|
77
|
-
* Displays document metadata including:
|
|
78
|
-
* - Document number and dates
|
|
79
|
-
* - Customer information
|
|
80
|
-
* - Totals breakdown
|
|
81
|
-
* - Payment status (for invoices/advance invoices)
|
|
82
|
-
*/
|
|
83
65
|
export function DocumentDetailsCard({
|
|
84
66
|
document,
|
|
85
67
|
documentType,
|
|
@@ -94,18 +76,14 @@ export function DocumentDetailsCard({
|
|
|
94
76
|
const fmt = (amount: number) => formatCurrency(amount, currencyCode, locale);
|
|
95
77
|
const fmtDate = (date: Date | string | null | undefined) => formatDate(date, locale);
|
|
96
78
|
|
|
97
|
-
// Type guards for document-specific fields
|
|
98
79
|
const isInvoiceOrAdvance = documentType === "invoice" || documentType === "advance_invoice";
|
|
99
80
|
const isEstimate = documentType === "estimate";
|
|
100
81
|
const invoiceDoc = document as Invoice | AdvanceInvoice;
|
|
101
82
|
const estimateDoc = document as Estimate;
|
|
102
|
-
|
|
103
|
-
// Get customer name
|
|
104
83
|
const customerName = document.customer?.name || "-";
|
|
105
84
|
|
|
106
85
|
const bodyContent = (
|
|
107
86
|
<>
|
|
108
|
-
{/* Document info */}
|
|
109
87
|
<div className="grid grid-cols-2 gap-x-4 gap-y-2 text-sm">
|
|
110
88
|
<div className="text-muted-foreground">{t("Number")}</div>
|
|
111
89
|
<div className="text-right font-medium">{document.number}</div>
|
|
@@ -146,7 +124,6 @@ export function DocumentDetailsCard({
|
|
|
146
124
|
|
|
147
125
|
<Separator />
|
|
148
126
|
|
|
149
|
-
{/* Totals */}
|
|
150
127
|
<div className="space-y-2 text-sm">
|
|
151
128
|
{document.total_discount != null && document.total_discount !== 0 && (
|
|
152
129
|
<div className="flex justify-between">
|
|
@@ -186,7 +163,6 @@ export function DocumentDetailsCard({
|
|
|
186
163
|
<span>{fmt(document.total_with_tax * sign)}</span>
|
|
187
164
|
</div>
|
|
188
165
|
|
|
189
|
-
{/* Payment info for invoices/advance invoices */}
|
|
190
166
|
{isInvoiceOrAdvance && invoiceDoc.total_paid > 0 && (
|
|
191
167
|
<>
|
|
192
168
|
<Separator />
|
|
@@ -210,7 +186,9 @@ export function DocumentDetailsCard({
|
|
|
210
186
|
<div className="flex items-center justify-between font-medium text-sm">
|
|
211
187
|
{t("Details")}
|
|
212
188
|
{isInvoiceOrAdvance && (
|
|
213
|
-
<Badge variant={
|
|
189
|
+
<Badge variant={getDocumentPaymentStatus(invoiceDoc, t).variant}>
|
|
190
|
+
{getDocumentPaymentStatus(invoiceDoc, t).label}
|
|
191
|
+
</Badge>
|
|
214
192
|
)}
|
|
215
193
|
</div>
|
|
216
194
|
<div className="space-y-4">{bodyContent}</div>
|
|
@@ -224,7 +202,9 @@ export function DocumentDetailsCard({
|
|
|
224
202
|
<CardTitle className="flex items-center justify-between text-lg">
|
|
225
203
|
{t("Details")}
|
|
226
204
|
{isInvoiceOrAdvance && (
|
|
227
|
-
<Badge variant={
|
|
205
|
+
<Badge variant={getDocumentPaymentStatus(invoiceDoc, t).variant}>
|
|
206
|
+
{getDocumentPaymentStatus(invoiceDoc, t).label}
|
|
207
|
+
</Badge>
|
|
228
208
|
)}
|
|
229
209
|
</CardTitle>
|
|
230
210
|
</CardHeader>
|