@spaceinvoices/react-ui 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/dist/index.js +1 -1
- package/package.json +1 -1
- package/registry.json +287 -122
- package/src/components/activities/activity-timeline.tsx +8 -1
- package/src/components/activities/locales/es.ts +30 -0
- package/src/components/activities/locales/fr.ts +30 -0
- package/src/components/activities/locales/hr.ts +30 -0
- package/src/components/activities/locales/it.ts +30 -0
- package/src/components/activities/locales/nl.ts +30 -0
- package/src/components/activities/locales/pl.ts +30 -0
- package/src/components/activities/locales/pt.ts +30 -0
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +21 -7
- package/src/components/advance-invoices/create/locales/es.ts +29 -0
- package/src/components/advance-invoices/create/locales/fr.ts +28 -0
- package/src/components/advance-invoices/create/locales/hr.ts +27 -0
- package/src/components/advance-invoices/create/locales/it.ts +29 -0
- package/src/components/advance-invoices/create/locales/nl.ts +28 -0
- package/src/components/advance-invoices/create/locales/pl.ts +28 -0
- package/src/components/advance-invoices/create/locales/pt.ts +29 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +3 -3
- package/src/components/advance-invoices/list/list-table.tsx +20 -3
- package/src/components/advance-invoices/list/locales/de.ts +9 -0
- package/src/components/advance-invoices/list/locales/en.ts +8 -0
- package/src/components/advance-invoices/list/locales/es.ts +41 -0
- package/src/components/advance-invoices/list/locales/fr.ts +41 -0
- package/src/components/advance-invoices/list/locales/hr.ts +41 -0
- package/src/components/advance-invoices/list/locales/it.ts +41 -0
- package/src/components/advance-invoices/list/locales/nl.ts +41 -0
- package/src/components/advance-invoices/list/locales/pl.ts +41 -0
- package/src/components/advance-invoices/list/locales/pt.ts +41 -0
- package/src/components/advance-invoices/list/locales/sl.ts +9 -0
- package/src/components/credit-notes/create/create-credit-note-form.tsx +19 -5
- package/src/components/credit-notes/create/locales/es.ts +68 -0
- package/src/components/credit-notes/create/locales/fr.ts +69 -0
- package/src/components/credit-notes/create/locales/hr.ts +68 -0
- package/src/components/credit-notes/create/locales/it.ts +68 -0
- package/src/components/credit-notes/create/locales/nl.ts +69 -0
- package/src/components/credit-notes/create/locales/pl.ts +68 -0
- package/src/components/credit-notes/create/locales/pt.ts +68 -0
- package/src/components/credit-notes/list/list-table.tsx +25 -8
- package/src/components/credit-notes/list/locales/de.ts +10 -2
- package/src/components/credit-notes/list/locales/en.ts +8 -0
- package/src/components/credit-notes/list/locales/es.ts +41 -0
- package/src/components/credit-notes/list/locales/fr.ts +41 -0
- package/src/components/credit-notes/list/locales/hr.ts +41 -0
- package/src/components/credit-notes/list/locales/it.ts +41 -0
- package/src/components/credit-notes/list/locales/nl.ts +41 -0
- package/src/components/credit-notes/list/locales/pl.ts +41 -0
- package/src/components/credit-notes/list/locales/pt.ts +41 -0
- package/src/components/credit-notes/list/locales/sl.ts +10 -2
- package/src/components/customers/create-customer-form/create-customer-form.tsx +21 -3
- package/src/components/customers/create-customer-form/locales/de.ts +1 -0
- package/src/components/customers/create-customer-form/locales/es.ts +21 -0
- package/src/components/customers/create-customer-form/locales/fr.ts +21 -0
- package/src/components/customers/create-customer-form/locales/hr.ts +21 -0
- package/src/components/customers/create-customer-form/locales/it.ts +21 -0
- package/src/components/customers/create-customer-form/locales/nl.ts +21 -0
- package/src/components/customers/create-customer-form/locales/pl.ts +21 -0
- package/src/components/customers/create-customer-form/locales/pt.ts +21 -0
- package/src/components/customers/create-customer-form/locales/sl.ts +1 -0
- package/src/components/customers/customer-list-table/customer-list-row-actions.tsx +72 -16
- package/src/components/customers/customer-list-table/customer-list-table.tsx +35 -2
- package/src/components/customers/customer-list-table/locales/de.ts +9 -0
- package/src/components/customers/customer-list-table/locales/en.ts +10 -0
- package/src/components/customers/customer-list-table/locales/es.ts +25 -0
- package/src/components/customers/customer-list-table/locales/fr.ts +25 -0
- package/src/components/customers/customer-list-table/locales/hr.ts +25 -0
- package/src/components/customers/customer-list-table/locales/it.ts +25 -0
- package/src/components/customers/customer-list-table/locales/nl.ts +25 -0
- package/src/components/customers/customer-list-table/locales/pl.ts +25 -0
- package/src/components/customers/customer-list-table/locales/pt.ts +25 -0
- package/src/components/customers/customer-list-table/locales/sl.ts +9 -0
- package/src/components/customers/customers.hooks.test.ts +8 -8
- package/src/components/customers/customers.hooks.ts +6 -1
- package/src/components/customers/edit-customer-form/edit-customer-form.tsx +143 -0
- package/src/components/customers/edit-customer-form/locales/de.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/es.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/fr.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/hr.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/it.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/nl.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/pl.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/pt.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/sl.ts +13 -0
- package/src/components/customers/index.ts +1 -0
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +9 -1
- package/src/components/dashboard/collection-rate-card/locales/de.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/es.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/fr.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/hr.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/it.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/nl.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/pl.ts +3 -0
- package/src/components/dashboard/collection-rate-card/locales/pt.ts +3 -0
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +9 -1
- package/src/components/dashboard/invoice-status-chart/locales/de.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/es.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/fr.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/hr.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/it.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/nl.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/pl.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/locales/pt.ts +9 -0
- package/src/components/dashboard/payment-methods-chart/locales/de.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/es.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/fr.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/hr.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/it.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/nl.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/pl.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/pt.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +9 -1
- package/src/components/dashboard/payment-trend-chart/locales/de.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/es.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/fr.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/hr.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/it.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/nl.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/pl.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/locales/pt.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +10 -2
- package/src/components/dashboard/revenue-trend-chart/locales/de.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/es.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/fr.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/hr.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/it.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/nl.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pl.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/locales/pt.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +10 -2
- package/src/components/dashboard/top-customers-chart/locales/de.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/es.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/fr.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/hr.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/it.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/nl.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/pl.ts +5 -0
- package/src/components/dashboard/top-customers-chart/locales/pt.ts +5 -0
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +10 -2
- package/src/components/documents/create/document-add-item-form.tsx +1 -1
- package/src/components/documents/create/form-types.ts +1 -5
- package/src/components/documents/create/mark-as-paid-section.tsx +60 -23
- package/src/components/documents/create/prepare-document-submission.test.ts +2 -2
- package/src/components/documents/create/prepare-document-submission.ts +12 -7
- package/src/components/documents/create/prepare-preview-data.test.ts +1 -1
- package/src/components/documents/view/document-actions-bar.tsx +8 -1
- package/src/components/documents/view/document-details-card.tsx +8 -1
- package/src/components/documents/view/document-payments-list.tsx +8 -1
- package/src/components/documents/view/locales/es.ts +83 -0
- package/src/components/documents/view/locales/fr.ts +83 -0
- package/src/components/documents/view/locales/hr.ts +83 -0
- package/src/components/documents/view/locales/it.ts +83 -0
- package/src/components/documents/view/locales/nl.ts +84 -0
- package/src/components/documents/view/locales/pl.ts +83 -0
- package/src/components/documents/view/locales/pt.ts +83 -0
- package/src/components/entities/create-entity-form.tsx +12 -2
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +18 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +3 -1
- package/src/components/entities/entity-settings-form/locales/es.ts +197 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +196 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +189 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +195 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +192 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +193 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +194 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +2 -0
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +461 -0
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +215 -0
- package/src/components/entities/fina-settings-form/index.ts +3 -0
- package/src/components/entities/fina-settings-form/locales/de.ts +145 -0
- package/src/components/entities/fina-settings-form/locales/en.ts +142 -0
- package/src/components/entities/fina-settings-form/locales/es.ts +143 -0
- package/src/components/entities/fina-settings-form/locales/fr.ts +142 -0
- package/src/components/entities/fina-settings-form/locales/hr.ts +144 -0
- package/src/components/entities/fina-settings-form/locales/it.ts +144 -0
- package/src/components/entities/fina-settings-form/locales/nl.ts +144 -0
- package/src/components/entities/fina-settings-form/locales/pl.ts +142 -0
- package/src/components/entities/fina-settings-form/locales/pt.ts +144 -0
- package/src/components/entities/fina-settings-form/locales/sl.ts +144 -0
- package/src/components/entities/fina-settings-form/sections/certificate-settings-section.tsx +233 -0
- package/src/components/entities/fina-settings-form/sections/premises-management-section.tsx +363 -0
- package/src/components/entities/fina-settings-form/sections/register-premise-dialog.tsx +395 -0
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +9 -2
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +15 -11
- package/src/components/entities/furs-settings-form/locales/de.ts +52 -88
- package/src/components/entities/furs-settings-form/locales/en.ts +3 -0
- package/src/components/entities/furs-settings-form/locales/es.ts +196 -0
- package/src/components/entities/furs-settings-form/locales/fr.ts +196 -0
- package/src/components/entities/furs-settings-form/locales/hr.ts +195 -0
- package/src/components/entities/furs-settings-form/locales/it.ts +196 -0
- package/src/components/entities/furs-settings-form/locales/nl.ts +195 -0
- package/src/components/entities/furs-settings-form/locales/pl.ts +194 -0
- package/src/components/entities/furs-settings-form/locales/pt.ts +195 -0
- package/src/components/entities/furs-settings-form/locales/sl.ts +2 -0
- package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +19 -4
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +17 -66
- package/src/components/entities/keys.ts +1 -1
- package/src/components/entities/settings/company-settings-form.tsx +28 -0
- package/src/components/entities/settings/pdf-template-selector/locales/es.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/fr.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/hr.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/it.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/nl.ts +17 -0
- package/src/components/entities/settings/pdf-template-selector/locales/pl.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/pt.ts +18 -0
- package/src/components/estimates/create/create-estimate-form.tsx +14 -0
- package/src/components/estimates/create/locales/es.ts +57 -0
- package/src/components/estimates/create/locales/fr.ts +58 -0
- package/src/components/estimates/create/locales/hr.ts +57 -0
- package/src/components/estimates/create/locales/it.ts +57 -0
- package/src/components/estimates/create/locales/nl.ts +58 -0
- package/src/components/estimates/create/locales/pl.ts +57 -0
- package/src/components/estimates/create/locales/pt.ts +58 -0
- package/src/components/estimates/create/prepare-estimate-submission.ts +1 -1
- package/src/components/estimates/list/list-table.tsx +20 -3
- package/src/components/estimates/list/locales/de.ts +9 -0
- package/src/components/estimates/list/locales/en.ts +8 -0
- package/src/components/estimates/list/locales/es.ts +32 -0
- package/src/components/estimates/list/locales/fr.ts +32 -0
- package/src/components/estimates/list/locales/hr.ts +32 -0
- package/src/components/estimates/list/locales/it.ts +32 -0
- package/src/components/estimates/list/locales/nl.ts +32 -0
- package/src/components/estimates/list/locales/pl.ts +32 -0
- package/src/components/estimates/list/locales/pt.ts +32 -0
- package/src/components/estimates/list/locales/sl.ts +9 -0
- package/src/components/export/document-export-form.tsx +0 -2
- package/src/components/invoices/create/create-invoice-form.tsx +24 -10
- package/src/components/invoices/create/eslog-validation.test.ts +2 -0
- package/src/components/invoices/create/locales/es.ts +103 -0
- package/src/components/invoices/create/locales/fr.ts +105 -0
- package/src/components/invoices/create/locales/hr.ts +103 -0
- package/src/components/invoices/create/locales/it.ts +105 -0
- package/src/components/invoices/create/locales/nl.ts +104 -0
- package/src/components/invoices/create/locales/pl.ts +104 -0
- package/src/components/invoices/create/locales/pt.ts +105 -0
- package/src/components/invoices/create/prepare-invoice-submission.test.ts +54 -55
- package/src/components/invoices/create/prepare-invoice-submission.ts +3 -3
- package/src/components/invoices/list/list-table.tsx +20 -3
- package/src/components/invoices/list/locales/de.ts +9 -0
- package/src/components/invoices/list/locales/en.ts +8 -0
- package/src/components/invoices/list/locales/es.ts +42 -0
- package/src/components/invoices/list/locales/fr.ts +42 -0
- package/src/components/invoices/list/locales/hr.ts +42 -0
- package/src/components/invoices/list/locales/it.ts +42 -0
- package/src/components/invoices/list/locales/nl.ts +42 -0
- package/src/components/invoices/list/locales/pl.ts +42 -0
- package/src/components/invoices/list/locales/pt.ts +42 -0
- package/src/components/invoices/list/locales/sl.ts +9 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +17 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +18 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +20 -12
- package/src/components/invoices/shared/scaled-document-preview.tsx +1 -0
- package/src/components/invoices/view/eslog-info-display.tsx +1 -0
- package/src/components/invoices/view/fina-info-display.tsx +196 -0
- package/src/components/items/create-item-form/create-item-form.tsx +14 -0
- package/src/components/items/create-item-form/locales/en.ts +5 -0
- package/src/components/items/create-item-form/locales/es.ts +14 -0
- package/src/components/items/create-item-form/locales/fr.ts +14 -0
- package/src/components/items/create-item-form/locales/hr.ts +14 -0
- package/src/components/items/create-item-form/locales/it.ts +14 -0
- package/src/components/items/create-item-form/locales/nl.ts +14 -0
- package/src/components/items/create-item-form/locales/pl.ts +14 -0
- package/src/components/items/create-item-form/locales/pt.ts +14 -0
- package/src/components/items/edit-item-form/edit-item-form.tsx +170 -0
- package/src/components/items/edit-item-form/locales/de.ts +12 -0
- package/src/components/items/edit-item-form/locales/es.ts +12 -0
- package/src/components/items/edit-item-form/locales/fr.ts +12 -0
- package/src/components/items/edit-item-form/locales/hr.ts +12 -0
- package/src/components/items/edit-item-form/locales/it.ts +12 -0
- package/src/components/items/edit-item-form/locales/nl.ts +12 -0
- package/src/components/items/edit-item-form/locales/pl.ts +12 -0
- package/src/components/items/edit-item-form/locales/pt.ts +12 -0
- package/src/components/items/edit-item-form/locales/sl.ts +12 -0
- package/src/components/items/item-list-table/item-list-table.tsx +20 -13
- package/src/components/items/item-list-table/locales/de.ts +6 -0
- package/src/components/items/item-list-table/locales/en.ts +5 -0
- package/src/components/items/item-list-table/locales/es.ts +16 -0
- package/src/components/items/item-list-table/locales/fr.ts +16 -0
- package/src/components/items/item-list-table/locales/hr.ts +16 -0
- package/src/components/items/item-list-table/locales/it.ts +16 -0
- package/src/components/items/item-list-table/locales/nl.ts +16 -0
- package/src/components/items/item-list-table/locales/pl.ts +16 -0
- package/src/components/items/item-list-table/locales/pt.ts +16 -0
- package/src/components/items/item-list-table/locales/sl.ts +6 -0
- package/src/components/items/items.hooks.ts +7 -2
- package/src/components/payments/create-payment-form/create-payment-form.tsx +14 -0
- package/src/components/payments/create-payment-form/locales/es.ts +20 -0
- package/src/components/payments/create-payment-form/locales/fr.ts +20 -0
- package/src/components/payments/create-payment-form/locales/hr.ts +20 -0
- package/src/components/payments/create-payment-form/locales/it.ts +20 -0
- package/src/components/payments/create-payment-form/locales/nl.ts +20 -0
- package/src/components/payments/create-payment-form/locales/pl.ts +20 -0
- package/src/components/payments/create-payment-form/locales/pt.ts +20 -0
- package/src/components/payments/edit-payment-form/edit-payment-form.tsx +18 -2
- package/src/components/payments/edit-payment-form/locales/es.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/fr.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/hr.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/it.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/nl.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/pl.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/pt.ts +20 -0
- package/src/components/payments/list/list-row-actions.tsx +14 -0
- package/src/components/payments/list/list-table.tsx +21 -2
- package/src/components/payments/list/locales/de.ts +6 -0
- package/src/components/payments/list/locales/en.ts +7 -0
- package/src/components/payments/list/locales/es.ts +25 -0
- package/src/components/payments/list/locales/fr.ts +25 -0
- package/src/components/payments/list/locales/hr.ts +25 -0
- package/src/components/payments/list/locales/it.ts +25 -0
- package/src/components/payments/list/locales/nl.ts +25 -0
- package/src/components/payments/list/locales/pl.ts +25 -0
- package/src/components/payments/list/locales/pt.ts +25 -0
- package/src/components/payments/list/locales/sl.ts +6 -0
- package/src/components/payments/payments.hooks.ts +7 -2
- package/src/components/request-logs/index.ts +1 -1
- package/src/components/table/data-table.tsx +8 -3
- package/src/components/table/filter-panel.tsx +4 -4
- package/src/components/table/hooks/use-table-query.ts +3 -0
- package/src/components/table/table-empty-state.tsx +11 -4
- package/src/components/table/table-no-results.tsx +6 -4
- package/src/components/table/types.ts +2 -2
- package/src/components/tax-reports/kir-export-form.tsx +0 -1
- package/src/components/taxes/create-tax-form/create-tax-form.tsx +14 -0
- package/src/components/taxes/create-tax-form/locales/en.ts +1 -0
- package/src/components/taxes/create-tax-form/locales/es.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/fr.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/hr.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/it.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/nl.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/pl.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/pt.ts +8 -0
- package/src/components/taxes/edit-tax-form/edit-tax-form.tsx +119 -0
- package/src/components/taxes/edit-tax-form/locales/de.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/es.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/fr.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/hr.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/it.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/nl.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/pl.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/pt.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/sl.ts +6 -0
- package/src/components/taxes/tax-list-table/locales/de.ts +6 -0
- package/src/components/taxes/tax-list-table/locales/en.ts +6 -0
- package/src/components/taxes/tax-list-table/locales/es.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/fr.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/hr.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/it.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/nl.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/pl.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/pt.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/sl.ts +6 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +18 -0
- package/src/components/taxes/taxes.hooks.ts +12 -7
- package/src/components/ui/tooltip.tsx +2 -2
- package/src/components/wl-subscription/locked-feature.tsx +1 -0
- package/src/components/wl-subscription/upgrade-modal.tsx +1 -0
- package/src/generated/schemas/acceptentityinvitation_body.ts +17 -0
- package/src/generated/schemas/addentityuser_body.ts +18 -0
- package/src/generated/schemas/advanceinvoice.ts +184 -12
- package/src/generated/schemas/creditnote.ts +96 -127
- package/src/generated/schemas/customadvanceinvoice.ts +246 -0
- package/src/generated/schemas/customcreditnote.ts +237 -0
- package/src/generated/schemas/customer.ts +26 -0
- package/src/generated/schemas/customestimate.ts +181 -0
- package/src/generated/schemas/custominvoice.ts +237 -0
- package/src/generated/schemas/entity.ts +66 -7
- package/src/generated/schemas/entityuserrole.ts +19 -0
- package/src/generated/schemas/estimate.ts +149 -1
- package/src/generated/schemas/finasettings.ts +25 -0
- package/src/generated/schemas/furssettings.ts +1 -2
- package/src/generated/schemas/index.ts +24 -5
- package/src/generated/schemas/invoice.ts +224 -22
- package/src/generated/schemas/me.ts +22 -0
- package/src/generated/schemas/registerfinamovablepremise_body.ts +26 -0
- package/src/generated/schemas/registerfinarealestatepremise_body.ts +37 -0
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +342 -0
- package/src/generated/schemas/rendercreditnotepreview_body.ts +344 -0
- package/src/generated/schemas/renderestimatepreview_body.ts +284 -0
- package/src/generated/schemas/renderinvoicepreview_body.ts +344 -0
- package/src/generated/schemas/senddocument_body.ts +23 -0
- package/src/generated/schemas/sendemail_body.ts +8 -10
- package/src/generated/schemas/stripeappconnect_body.ts +18 -0
- package/src/generated/schemas/stripeappcreateinvoice_body.ts +20 -0
- package/src/generated/schemas/stripeappupdatesettings_body.ts +26 -0
- package/src/generated/schemas/webhook.ts +143 -0
- package/src/hooks/create-resource-hooks.ts +85 -1
- package/src/hooks/use-next-document-number.ts +1 -1
- package/src/hooks/use-resource-mutation.ts +4 -3
- package/src/lib/browser-cookies.ts +12 -1
- package/src/lib/cookies.ts +2 -2
- package/src/lib/translation.ts +1 -1
- package/src/providers/entities-provider.tsx +84 -39
- package/src/providers/sdk-provider.tsx +7 -3
- package/src/providers/white-label-provider.tsx +5 -2
- package/src/providers/wl-subscription-provider.tsx +1 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { AlertCircle, CheckCircle2, ShieldCheck, Upload, XCircle } from "lucide-react";
|
|
2
|
+
import { type FC, type ReactNode, useEffect, useState } from "react";
|
|
3
|
+
import { Alert, AlertDescription, AlertTitle } from "@/ui/components/ui/alert";
|
|
4
|
+
import { Button } from "@/ui/components/ui/button";
|
|
5
|
+
import { Input } from "@/ui/components/ui/input";
|
|
6
|
+
import { Label } from "@/ui/components/ui/label";
|
|
7
|
+
import { cn } from "@/ui/lib/utils";
|
|
8
|
+
import { useUploadFinaCertificate } from "../fina-settings.hooks";
|
|
9
|
+
import type { FinaSectionType } from "../fina-settings-form";
|
|
10
|
+
|
|
11
|
+
interface CertificateSettingsSectionProps {
|
|
12
|
+
entity: any;
|
|
13
|
+
finaSettings?: any;
|
|
14
|
+
t: (key: string) => string;
|
|
15
|
+
onSuccess?: () => void;
|
|
16
|
+
onError?: (error: unknown) => void;
|
|
17
|
+
wrapSection?: (section: FinaSectionType, content: ReactNode) => ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const CertificateSettingsSection: FC<CertificateSettingsSectionProps> = ({
|
|
21
|
+
entity,
|
|
22
|
+
finaSettings,
|
|
23
|
+
t,
|
|
24
|
+
onSuccess,
|
|
25
|
+
onError,
|
|
26
|
+
wrapSection,
|
|
27
|
+
}) => {
|
|
28
|
+
const wrap = (section: FinaSectionType, content: ReactNode) =>
|
|
29
|
+
wrapSection ? wrapSection(section, content) : content;
|
|
30
|
+
const [certificateFile, setCertificateFile] = useState<File | null>(null);
|
|
31
|
+
const [passphrase, setPassphrase] = useState("");
|
|
32
|
+
const [showUploadForm, setShowUploadForm] = useState(false);
|
|
33
|
+
|
|
34
|
+
const hasCertificate = finaSettings?.has_certificate || false;
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (finaSettings && hasCertificate) {
|
|
38
|
+
setShowUploadForm(false);
|
|
39
|
+
}
|
|
40
|
+
}, [finaSettings, hasCertificate]);
|
|
41
|
+
|
|
42
|
+
const { mutate: uploadCertificate, isPending } = useUploadFinaCertificate({
|
|
43
|
+
onSuccess: () => {
|
|
44
|
+
setCertificateFile(null);
|
|
45
|
+
setPassphrase("");
|
|
46
|
+
setShowUploadForm(false);
|
|
47
|
+
onSuccess?.();
|
|
48
|
+
},
|
|
49
|
+
onError: (error) => {
|
|
50
|
+
onError?.(error);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
55
|
+
const file = e.target.files?.[0];
|
|
56
|
+
if (file) {
|
|
57
|
+
const validExtensions = [".p12", ".pfx"];
|
|
58
|
+
const fileExtension = file.name.toLowerCase().substring(file.name.lastIndexOf("."));
|
|
59
|
+
|
|
60
|
+
if (!validExtensions.includes(fileExtension)) {
|
|
61
|
+
onError?.(new Error(t("Invalid file type. Please upload a .p12 or .pfx certificate file.")));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
setCertificateFile(file);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleUpload = () => {
|
|
70
|
+
if (!certificateFile || !passphrase) {
|
|
71
|
+
onError?.(new Error(t("Please select a certificate file and enter the passphrase")));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
uploadCertificate({
|
|
76
|
+
entityId: entity.id,
|
|
77
|
+
file: certificateFile,
|
|
78
|
+
passphrase: passphrase.trim(),
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const certificateStatus = finaSettings?.certificate_status || "missing";
|
|
83
|
+
const shouldShowUploadForm = !hasCertificate || showUploadForm;
|
|
84
|
+
|
|
85
|
+
const statusConfig = {
|
|
86
|
+
valid: {
|
|
87
|
+
icon: CheckCircle2,
|
|
88
|
+
variant: "default" as const,
|
|
89
|
+
iconColor: "text-green-600 dark:text-green-400",
|
|
90
|
+
label: t("Valid"),
|
|
91
|
+
},
|
|
92
|
+
expiring_soon: {
|
|
93
|
+
icon: AlertCircle,
|
|
94
|
+
variant: "default" as const,
|
|
95
|
+
iconColor: "text-yellow-600 dark:text-yellow-400",
|
|
96
|
+
label: t("Expiring Soon"),
|
|
97
|
+
},
|
|
98
|
+
expired: {
|
|
99
|
+
icon: XCircle,
|
|
100
|
+
variant: "destructive" as const,
|
|
101
|
+
iconColor: "text-red-600 dark:text-red-400",
|
|
102
|
+
label: t("Expired"),
|
|
103
|
+
},
|
|
104
|
+
missing: {
|
|
105
|
+
icon: AlertCircle,
|
|
106
|
+
variant: "default" as const,
|
|
107
|
+
iconColor: "text-muted-foreground",
|
|
108
|
+
label: t("Missing"),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const currentStatus = statusConfig[certificateStatus as keyof typeof statusConfig] || statusConfig.missing;
|
|
113
|
+
const StatusIcon = currentStatus.icon;
|
|
114
|
+
|
|
115
|
+
const certificateContent = (
|
|
116
|
+
<div className="space-y-4">
|
|
117
|
+
<div className="flex items-center gap-3">
|
|
118
|
+
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10">
|
|
119
|
+
<ShieldCheck className="h-5 w-5 text-primary" />
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<h3 className="font-semibold text-lg">{t("Digital Certificate")}</h3>
|
|
123
|
+
<p className="text-muted-foreground text-sm">{t("Upload your FINA digital certificate")}</p>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div className="space-y-6">
|
|
128
|
+
{hasCertificate && (
|
|
129
|
+
<div className="space-y-4">
|
|
130
|
+
<Alert variant={currentStatus.variant}>
|
|
131
|
+
<StatusIcon className={cn("h-4 w-4", currentStatus.iconColor)} />
|
|
132
|
+
<AlertTitle>Certificate Status: {currentStatus.label}</AlertTitle>
|
|
133
|
+
<AlertDescription className="space-y-2">
|
|
134
|
+
{finaSettings?.certificate_expiry && (
|
|
135
|
+
<div className="text-sm">
|
|
136
|
+
{t("Expires")}: {new Date(finaSettings.certificate_expiry).toLocaleDateString()}
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
{finaSettings?.certificate_issuer && (
|
|
140
|
+
<div className="text-muted-foreground text-sm">
|
|
141
|
+
{t("Issuer")}: {finaSettings.certificate_issuer}
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
{finaSettings?.certificate_subject && (
|
|
145
|
+
<div className="text-muted-foreground text-sm">
|
|
146
|
+
{t("Subject")}: {finaSettings.certificate_subject}
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
</AlertDescription>
|
|
150
|
+
</Alert>
|
|
151
|
+
|
|
152
|
+
{!showUploadForm && (
|
|
153
|
+
<Button
|
|
154
|
+
type="button"
|
|
155
|
+
variant="outline"
|
|
156
|
+
onClick={() => setShowUploadForm(true)}
|
|
157
|
+
className="w-full cursor-pointer"
|
|
158
|
+
>
|
|
159
|
+
<Upload className="mr-2 h-4 w-4" />
|
|
160
|
+
{t("Change Certificate")}
|
|
161
|
+
</Button>
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
164
|
+
)}
|
|
165
|
+
|
|
166
|
+
{shouldShowUploadForm && (
|
|
167
|
+
<div className="space-y-4">
|
|
168
|
+
<div className="space-y-2">
|
|
169
|
+
<Label htmlFor="certificate-file">{t("P12/PFX Certificate File")}</Label>
|
|
170
|
+
<div className="flex items-center gap-3">
|
|
171
|
+
<Input
|
|
172
|
+
id="certificate-file"
|
|
173
|
+
type="file"
|
|
174
|
+
accept=".p12,.pfx"
|
|
175
|
+
onChange={handleFileChange}
|
|
176
|
+
disabled={isPending}
|
|
177
|
+
className="flex-1"
|
|
178
|
+
/>
|
|
179
|
+
{certificateFile && <CheckCircle2 className="h-5 w-5 text-green-500" />}
|
|
180
|
+
</div>
|
|
181
|
+
{certificateFile && (
|
|
182
|
+
<p className="text-muted-foreground text-sm">
|
|
183
|
+
{t("Selected")}: {certificateFile.name}
|
|
184
|
+
</p>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div className="space-y-2">
|
|
189
|
+
<Label htmlFor="passphrase">{t("Certificate Passphrase")}</Label>
|
|
190
|
+
<Input
|
|
191
|
+
id="passphrase"
|
|
192
|
+
type="password"
|
|
193
|
+
value={passphrase}
|
|
194
|
+
onChange={(e) => setPassphrase(e.target.value)}
|
|
195
|
+
disabled={isPending}
|
|
196
|
+
placeholder={t("Enter certificate passphrase")}
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div className="flex gap-3">
|
|
201
|
+
{hasCertificate && showUploadForm && (
|
|
202
|
+
<Button
|
|
203
|
+
type="button"
|
|
204
|
+
variant="outline"
|
|
205
|
+
onClick={() => {
|
|
206
|
+
setShowUploadForm(false);
|
|
207
|
+
setCertificateFile(null);
|
|
208
|
+
setPassphrase("");
|
|
209
|
+
}}
|
|
210
|
+
disabled={isPending}
|
|
211
|
+
className="flex-1 cursor-pointer"
|
|
212
|
+
>
|
|
213
|
+
{t("Cancel")}
|
|
214
|
+
</Button>
|
|
215
|
+
)}
|
|
216
|
+
<Button
|
|
217
|
+
type="button"
|
|
218
|
+
onClick={handleUpload}
|
|
219
|
+
disabled={!certificateFile || !passphrase || isPending}
|
|
220
|
+
className={cn(hasCertificate && showUploadForm ? "flex-1" : "w-full", "cursor-pointer")}
|
|
221
|
+
>
|
|
222
|
+
<Upload className="mr-2 h-4 w-4" />
|
|
223
|
+
{isPending ? t("Loading...") : hasCertificate ? t("Upload New Certificate") : t("Upload Certificate")}
|
|
224
|
+
</Button>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
return <>{wrap("certificate-upload", certificateContent)}</>;
|
|
233
|
+
};
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { Building2, Cpu, MapPin, MoreVertical, Truck } from "lucide-react";
|
|
2
|
+
import { type FC, type ReactNode, useState } from "react";
|
|
3
|
+
import type { FinaSectionType } from "../fina-settings-form";
|
|
4
|
+
|
|
5
|
+
type FinaBusinessPremise = {
|
|
6
|
+
id: string;
|
|
7
|
+
entity_id: string;
|
|
8
|
+
premise_id: string;
|
|
9
|
+
type: string;
|
|
10
|
+
real_estate?: {
|
|
11
|
+
cadastral_municipality?: string;
|
|
12
|
+
land_registry_number?: string;
|
|
13
|
+
building_number?: string;
|
|
14
|
+
sub_building_number?: string;
|
|
15
|
+
street?: string;
|
|
16
|
+
house_number?: string;
|
|
17
|
+
house_number_additional?: string | null;
|
|
18
|
+
settlement?: string;
|
|
19
|
+
city?: string;
|
|
20
|
+
postal_code?: string;
|
|
21
|
+
};
|
|
22
|
+
movable_premise?: {
|
|
23
|
+
type?: string;
|
|
24
|
+
};
|
|
25
|
+
is_active: boolean;
|
|
26
|
+
registered_at: Date | string | null;
|
|
27
|
+
closed_at: Date | string | null;
|
|
28
|
+
created_at: Date | string;
|
|
29
|
+
Devices?: Array<{
|
|
30
|
+
id: string;
|
|
31
|
+
device_id?: string;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
import { Alert, AlertDescription } from "@/ui/components/ui/alert";
|
|
36
|
+
import { Badge } from "@/ui/components/ui/badge";
|
|
37
|
+
import { Button } from "@/ui/components/ui/button";
|
|
38
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/ui/components/ui/card";
|
|
39
|
+
import {
|
|
40
|
+
Dialog,
|
|
41
|
+
DialogContent,
|
|
42
|
+
DialogDescription,
|
|
43
|
+
DialogFooter,
|
|
44
|
+
DialogHeader,
|
|
45
|
+
DialogTitle,
|
|
46
|
+
} from "@/ui/components/ui/dialog";
|
|
47
|
+
import {
|
|
48
|
+
DropdownMenu,
|
|
49
|
+
DropdownMenuContent,
|
|
50
|
+
DropdownMenuItem,
|
|
51
|
+
DropdownMenuTrigger,
|
|
52
|
+
} from "@/ui/components/ui/dropdown-menu";
|
|
53
|
+
import { Input } from "@/ui/components/ui/input";
|
|
54
|
+
import { Label } from "@/ui/components/ui/label";
|
|
55
|
+
import { cn } from "@/ui/lib/utils";
|
|
56
|
+
import { useCloseFinaPremise, useRegisterFinaElectronicDevice } from "../fina-settings.hooks";
|
|
57
|
+
import { RegisterFinaPremiseDialog } from "./register-premise-dialog";
|
|
58
|
+
|
|
59
|
+
interface PremisesManagementSectionProps {
|
|
60
|
+
entity: any;
|
|
61
|
+
premises: FinaBusinessPremise[];
|
|
62
|
+
t: (key: string) => string;
|
|
63
|
+
onSuccess?: () => void;
|
|
64
|
+
onError?: (error: unknown) => void;
|
|
65
|
+
wrapSection?: (section: FinaSectionType, content: ReactNode) => ReactNode;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const PremisesManagementSection: FC<PremisesManagementSectionProps> = ({
|
|
69
|
+
entity,
|
|
70
|
+
premises,
|
|
71
|
+
t,
|
|
72
|
+
onSuccess,
|
|
73
|
+
onError,
|
|
74
|
+
wrapSection,
|
|
75
|
+
}) => {
|
|
76
|
+
const wrap = (section: FinaSectionType, content: ReactNode) =>
|
|
77
|
+
wrapSection ? wrapSection(section, content) : content;
|
|
78
|
+
const [registerDialogOpen, setRegisterDialogOpen] = useState(false);
|
|
79
|
+
const [registerType, setRegisterType] = useState<"real-estate" | "movable">("real-estate");
|
|
80
|
+
const [addDeviceDialogOpen, setAddDeviceDialogOpen] = useState(false);
|
|
81
|
+
const [selectedPremiseId, setSelectedPremiseId] = useState<string | null>(null);
|
|
82
|
+
const [deviceId, setDeviceId] = useState("");
|
|
83
|
+
|
|
84
|
+
const { mutate: closePremise } = useCloseFinaPremise({
|
|
85
|
+
onSuccess: () => {
|
|
86
|
+
onSuccess?.();
|
|
87
|
+
},
|
|
88
|
+
onError: (error) => {
|
|
89
|
+
onError?.(error);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const { mutate: registerDevice, isPending: isRegisteringDevice } = useRegisterFinaElectronicDevice({
|
|
94
|
+
onSuccess: () => {
|
|
95
|
+
setAddDeviceDialogOpen(false);
|
|
96
|
+
setDeviceId("");
|
|
97
|
+
setSelectedPremiseId(null);
|
|
98
|
+
onSuccess?.();
|
|
99
|
+
},
|
|
100
|
+
onError: (error) => {
|
|
101
|
+
onError?.(error);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const handleClosePremise = (premiseId: string) => {
|
|
106
|
+
if (confirm(t("Are you sure you want to close this premise? This action cannot be undone."))) {
|
|
107
|
+
closePremise({
|
|
108
|
+
entityId: entity.id,
|
|
109
|
+
premiseId,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handleAddPremise = (type: "real-estate" | "movable") => {
|
|
115
|
+
setRegisterType(type);
|
|
116
|
+
setRegisterDialogOpen(true);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleAddDevice = (premiseId: string) => {
|
|
120
|
+
setSelectedPremiseId(premiseId);
|
|
121
|
+
setDeviceId("");
|
|
122
|
+
setAddDeviceDialogOpen(true);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const handleRegisterDevice = () => {
|
|
126
|
+
if (!selectedPremiseId || !deviceId.trim()) return;
|
|
127
|
+
|
|
128
|
+
registerDevice({
|
|
129
|
+
entityId: entity.id,
|
|
130
|
+
premiseId: selectedPremiseId,
|
|
131
|
+
deviceId: deviceId.trim(),
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const premisesContent = (
|
|
136
|
+
<div className="space-y-4">
|
|
137
|
+
<div className="flex items-center gap-3">
|
|
138
|
+
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10">
|
|
139
|
+
<Building2 className="h-5 w-5 text-primary" />
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<h3 className="font-semibold text-lg">{t("Business Premises")}</h3>
|
|
143
|
+
<p className="text-muted-foreground text-sm">{t("Register your business premises for FINA")}</p>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div className="space-y-6">
|
|
148
|
+
{/* Add Premise Buttons */}
|
|
149
|
+
<div className="flex gap-3">
|
|
150
|
+
<Button onClick={() => handleAddPremise("real-estate")} variant="default" className="flex-1 cursor-pointer">
|
|
151
|
+
<Building2 className="mr-2 h-4 w-4" />
|
|
152
|
+
{t("Add Real Estate")}
|
|
153
|
+
</Button>
|
|
154
|
+
<Button onClick={() => handleAddPremise("movable")} variant="outline" className="flex-1 cursor-pointer">
|
|
155
|
+
<Truck className="mr-2 h-4 w-4" />
|
|
156
|
+
{t("Add Movable")}
|
|
157
|
+
</Button>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{/* Premises List */}
|
|
161
|
+
{premises.length === 0 ? (
|
|
162
|
+
<Alert>
|
|
163
|
+
<AlertDescription>
|
|
164
|
+
<div className="flex flex-col items-center justify-center py-8 text-center">
|
|
165
|
+
<Building2 className="mb-4 h-12 w-12 text-muted-foreground" />
|
|
166
|
+
<p className="text-muted-foreground text-sm">{t("No premises registered yet")}</p>
|
|
167
|
+
</div>
|
|
168
|
+
</AlertDescription>
|
|
169
|
+
</Alert>
|
|
170
|
+
) : (
|
|
171
|
+
<div className="grid gap-4">
|
|
172
|
+
{premises.map((premise) => (
|
|
173
|
+
<Card key={premise.id} className={cn(!premise.is_active && "opacity-60")}>
|
|
174
|
+
<CardHeader className="pb-3">
|
|
175
|
+
<div className="flex items-start justify-between">
|
|
176
|
+
<div className="space-y-1">
|
|
177
|
+
<div className="flex items-center gap-2">
|
|
178
|
+
<CardTitle className="text-base">{premise.premise_id}</CardTitle>
|
|
179
|
+
<Badge variant={premise.is_active ? "default" : "secondary"}>
|
|
180
|
+
{premise.is_active ? t("Active") : t("Closed")}
|
|
181
|
+
</Badge>
|
|
182
|
+
<Badge variant="outline">
|
|
183
|
+
{premise.type === "real_estate" ? t("Real Estate") : t("Movable")}
|
|
184
|
+
</Badge>
|
|
185
|
+
</div>
|
|
186
|
+
<CardDescription />
|
|
187
|
+
</div>
|
|
188
|
+
{premise.is_active && (
|
|
189
|
+
<DropdownMenu>
|
|
190
|
+
<DropdownMenuTrigger asChild>
|
|
191
|
+
<Button variant="ghost" size="icon" className="cursor-pointer">
|
|
192
|
+
<MoreVertical className="h-4 w-4" />
|
|
193
|
+
</Button>
|
|
194
|
+
</DropdownMenuTrigger>
|
|
195
|
+
<DropdownMenuContent align="end">
|
|
196
|
+
<DropdownMenuItem onClick={() => handleAddDevice(premise.id)} className="cursor-pointer">
|
|
197
|
+
<Cpu className="mr-2 h-4 w-4" />
|
|
198
|
+
{t("Add Electronic Device")}
|
|
199
|
+
</DropdownMenuItem>
|
|
200
|
+
<DropdownMenuItem
|
|
201
|
+
onClick={() => handleClosePremise(premise.id)}
|
|
202
|
+
className="cursor-pointer text-destructive"
|
|
203
|
+
>
|
|
204
|
+
{t("Close Premise")}
|
|
205
|
+
</DropdownMenuItem>
|
|
206
|
+
</DropdownMenuContent>
|
|
207
|
+
</DropdownMenu>
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
210
|
+
</CardHeader>
|
|
211
|
+
<CardContent>
|
|
212
|
+
<div className="space-y-3">
|
|
213
|
+
{/* Real Estate Info */}
|
|
214
|
+
{premise.real_estate && (
|
|
215
|
+
<div className="flex items-start gap-2 text-sm">
|
|
216
|
+
<MapPin className="mt-0.5 h-4 w-4 text-muted-foreground" />
|
|
217
|
+
<div>
|
|
218
|
+
<p className="font-medium">
|
|
219
|
+
{premise.real_estate.street} {premise.real_estate.house_number}
|
|
220
|
+
{premise.real_estate.house_number_additional &&
|
|
221
|
+
` ${premise.real_estate.house_number_additional}`}
|
|
222
|
+
</p>
|
|
223
|
+
<p className="text-muted-foreground">
|
|
224
|
+
{premise.real_estate.postal_code} {premise.real_estate.city}
|
|
225
|
+
</p>
|
|
226
|
+
{premise.real_estate.cadastral_municipality && (
|
|
227
|
+
<p className="text-muted-foreground text-xs">
|
|
228
|
+
{t("Cadastral Municipality")}: {premise.real_estate.cadastral_municipality}
|
|
229
|
+
{premise.real_estate.land_registry_number &&
|
|
230
|
+
` / ${t("Land Registry Number")}: ${premise.real_estate.land_registry_number}`}
|
|
231
|
+
{premise.real_estate.building_number &&
|
|
232
|
+
` / ${t("Building Number")}: ${premise.real_estate.building_number}`}
|
|
233
|
+
</p>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
{/* Movable Info */}
|
|
240
|
+
{premise.movable_premise && (
|
|
241
|
+
<div className="flex items-start gap-2 text-sm">
|
|
242
|
+
<Truck className="mt-0.5 h-4 w-4 text-muted-foreground" />
|
|
243
|
+
<div>
|
|
244
|
+
<p className="font-medium">
|
|
245
|
+
{premise.movable_premise.type === "vehicle" && t("Vehicle")}
|
|
246
|
+
{premise.movable_premise.type === "market_stall" && t("Market Stall")}
|
|
247
|
+
{premise.movable_premise.type === "other" && t("Other")}
|
|
248
|
+
</p>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
{/* Devices Count or Warning */}
|
|
254
|
+
{premise.Devices && premise.Devices.length > 0 ? (
|
|
255
|
+
<div className="flex items-center gap-2 text-muted-foreground text-sm">
|
|
256
|
+
<Badge variant="secondary" className="text-xs">
|
|
257
|
+
{premise.Devices.length} {premise.Devices.length === 1 ? t("Device") : t("Devices")}
|
|
258
|
+
</Badge>
|
|
259
|
+
<span className="text-xs">{premise.Devices.map((d) => d.device_id || "?").join(", ")}</span>
|
|
260
|
+
</div>
|
|
261
|
+
) : (
|
|
262
|
+
<Alert>
|
|
263
|
+
<AlertDescription className="flex items-center justify-between">
|
|
264
|
+
<span className="text-sm">
|
|
265
|
+
{t("No devices registered. Add at least one device to fiscalize invoices.")}
|
|
266
|
+
</span>
|
|
267
|
+
<Button
|
|
268
|
+
size="sm"
|
|
269
|
+
variant="outline"
|
|
270
|
+
onClick={() => handleAddDevice(premise.id)}
|
|
271
|
+
className="cursor-pointer"
|
|
272
|
+
>
|
|
273
|
+
<Cpu className="mr-2 h-4 w-4" />
|
|
274
|
+
{t("Add Electronic Device")}
|
|
275
|
+
</Button>
|
|
276
|
+
</AlertDescription>
|
|
277
|
+
</Alert>
|
|
278
|
+
)}
|
|
279
|
+
|
|
280
|
+
{/* Dates */}
|
|
281
|
+
<div className="flex gap-4 border-t pt-2 text-muted-foreground text-xs">
|
|
282
|
+
<span>
|
|
283
|
+
{t("Created")}: {new Date(premise.created_at).toLocaleDateString()}
|
|
284
|
+
</span>
|
|
285
|
+
{premise.closed_at && (
|
|
286
|
+
<span>
|
|
287
|
+
{t("Closed")}: {new Date(premise.closed_at).toLocaleDateString()}
|
|
288
|
+
</span>
|
|
289
|
+
)}
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</CardContent>
|
|
293
|
+
</Card>
|
|
294
|
+
))}
|
|
295
|
+
</div>
|
|
296
|
+
)}
|
|
297
|
+
|
|
298
|
+
{/* Register Premise Dialog */}
|
|
299
|
+
<RegisterFinaPremiseDialog
|
|
300
|
+
open={registerDialogOpen}
|
|
301
|
+
onOpenChange={setRegisterDialogOpen}
|
|
302
|
+
entity={entity}
|
|
303
|
+
type={registerType}
|
|
304
|
+
t={t}
|
|
305
|
+
onSuccess={() => {
|
|
306
|
+
setRegisterDialogOpen(false);
|
|
307
|
+
onSuccess?.();
|
|
308
|
+
}}
|
|
309
|
+
onError={onError}
|
|
310
|
+
/>
|
|
311
|
+
|
|
312
|
+
{/* Add Device Dialog */}
|
|
313
|
+
<Dialog open={addDeviceDialogOpen} onOpenChange={setAddDeviceDialogOpen}>
|
|
314
|
+
<DialogContent>
|
|
315
|
+
<DialogHeader>
|
|
316
|
+
<DialogTitle>{t("Add Electronic Device")}</DialogTitle>
|
|
317
|
+
<DialogDescription>{t("Register an electronic device for this business premise.")}</DialogDescription>
|
|
318
|
+
</DialogHeader>
|
|
319
|
+
<div className="space-y-4 py-4">
|
|
320
|
+
<div className="space-y-2">
|
|
321
|
+
<Label htmlFor="deviceId">{t("Device ID")}</Label>
|
|
322
|
+
<Input
|
|
323
|
+
id="deviceId"
|
|
324
|
+
placeholder={t("Enter a numeric device ID (e.g., 1, 2, 3)")}
|
|
325
|
+
value={deviceId}
|
|
326
|
+
onChange={(e) => {
|
|
327
|
+
const val = e.target.value.replace(/[^0-9]/g, "");
|
|
328
|
+
setDeviceId(val);
|
|
329
|
+
}}
|
|
330
|
+
onKeyDown={(e) => {
|
|
331
|
+
if (e.key === "Enter" && deviceId.trim()) {
|
|
332
|
+
handleRegisterDevice();
|
|
333
|
+
}
|
|
334
|
+
}}
|
|
335
|
+
/>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
<DialogFooter>
|
|
339
|
+
<Button
|
|
340
|
+
type="button"
|
|
341
|
+
variant="outline"
|
|
342
|
+
onClick={() => setAddDeviceDialogOpen(false)}
|
|
343
|
+
disabled={isRegisteringDevice}
|
|
344
|
+
className="cursor-pointer"
|
|
345
|
+
>
|
|
346
|
+
{t("Cancel")}
|
|
347
|
+
</Button>
|
|
348
|
+
<Button
|
|
349
|
+
onClick={handleRegisterDevice}
|
|
350
|
+
disabled={!deviceId.trim() || isRegisteringDevice}
|
|
351
|
+
className="cursor-pointer"
|
|
352
|
+
>
|
|
353
|
+
{isRegisteringDevice ? t("Registering...") : t("Register Device")}
|
|
354
|
+
</Button>
|
|
355
|
+
</DialogFooter>
|
|
356
|
+
</DialogContent>
|
|
357
|
+
</Dialog>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
return <>{wrap("premises-list", premisesContent)}</>;
|
|
363
|
+
};
|