@voyant-travel/finance-react 0.119.5
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/LICENSE +201 -0
- package/README.md +75 -0
- package/dist/admin/booking-invoices-widget.d.ts +19 -0
- package/dist/admin/booking-invoices-widget.d.ts.map +1 -0
- package/dist/admin/booking-invoices-widget.js +204 -0
- package/dist/admin/booking-payment-policy-widget.d.ts +21 -0
- package/dist/admin/booking-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/booking-payment-policy-widget.js +128 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts +24 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts.map +1 -0
- package/dist/admin/booking-pending-payment-sessions-widget.js +139 -0
- package/dist/admin/credit-note-dialog.d.ts +9 -0
- package/dist/admin/credit-note-dialog.d.ts.map +1 -0
- package/dist/admin/credit-note-dialog.js +70 -0
- package/dist/admin/finance-shared.d.ts +7 -0
- package/dist/admin/finance-shared.d.ts.map +1 -0
- package/dist/admin/finance-shared.js +30 -0
- package/dist/admin/index.d.ts +99 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +286 -0
- package/dist/admin/invoice-detail-host.d.ts +19 -0
- package/dist/admin/invoice-detail-host.d.ts.map +1 -0
- package/dist/admin/invoice-detail-host.js +147 -0
- package/dist/admin/invoice-detail-sections.d.ts +31 -0
- package/dist/admin/invoice-detail-sections.d.ts.map +1 -0
- package/dist/admin/invoice-detail-sections.js +109 -0
- package/dist/admin/invoice-detail-skeleton.d.ts +11 -0
- package/dist/admin/invoice-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/invoice-detail-skeleton.js +33 -0
- package/dist/admin/line-item-dialog.d.ts +10 -0
- package/dist/admin/line-item-dialog.d.ts.map +1 -0
- package/dist/admin/line-item-dialog.js +91 -0
- package/dist/admin/pages/invoice-detail.d.ts +8 -0
- package/dist/admin/pages/invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/invoice-detail.js +11 -0
- package/dist/admin/pages/invoices-index.d.ts +8 -0
- package/dist/admin/pages/invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/invoices-index.js +14 -0
- package/dist/admin/pages/payment-detail.d.ts +8 -0
- package/dist/admin/pages/payment-detail.d.ts.map +1 -0
- package/dist/admin/pages/payment-detail.js +11 -0
- package/dist/admin/pages/payments-index.d.ts +9 -0
- package/dist/admin/pages/payments-index.d.ts.map +1 -0
- package/dist/admin/pages/payments-index.js +21 -0
- package/dist/admin/pages/profitability.d.ts +10 -0
- package/dist/admin/pages/profitability.d.ts.map +1 -0
- package/dist/admin/pages/profitability.js +32 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts +20 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoice-detail.js +102 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts +9 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoices-index.js +16 -0
- package/dist/admin/payment-detail-host.d.ts +12 -0
- package/dist/admin/payment-detail-host.d.ts.map +1 -0
- package/dist/admin/payment-detail-host.js +108 -0
- package/dist/admin/payment-detail-skeleton.d.ts +8 -0
- package/dist/admin/payment-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/payment-detail-skeleton.js +15 -0
- package/dist/admin/payment-dialog.d.ts +9 -0
- package/dist/admin/payment-dialog.d.ts.map +1 -0
- package/dist/admin/payment-dialog.js +99 -0
- package/dist/admin/record-payment-dialog.d.ts +16 -0
- package/dist/admin/record-payment-dialog.d.ts.map +1 -0
- package/dist/admin/record-payment-dialog.js +219 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts +18 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/supplier-payment-policy-widget.js +31 -0
- package/dist/admin/use-supplier-picker.d.ts +19 -0
- package/dist/admin/use-supplier-picker.d.ts.map +1 -0
- package/dist/admin/use-supplier-picker.js +30 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts +45 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts.map +1 -0
- package/dist/checkout-components/collect-payment-dialog.js +121 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts +76 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts.map +1 -0
- package/dist/checkout-components/payment-link-landing-page.js +173 -0
- package/dist/checkout-components/payment-step.d.ts +42 -0
- package/dist/checkout-components/payment-step.d.ts.map +1 -0
- package/dist/checkout-components/payment-step.js +113 -0
- package/dist/checkout-hooks/index.d.ts +5 -0
- package/dist/checkout-hooks/index.d.ts.map +1 -0
- package/dist/checkout-hooks/index.js +4 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts +20 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts.map +1 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.js +26 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts +227 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts.map +1 -0
- package/dist/checkout-hooks/use-collect-payment.js +80 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts +308 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.js +35 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts +65 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.js +27 -0
- package/dist/checkout-i18n/en.d.ts +3 -0
- package/dist/checkout-i18n/en.d.ts.map +1 -0
- package/dist/checkout-i18n/en.js +127 -0
- package/dist/checkout-i18n/index.d.ts +5 -0
- package/dist/checkout-i18n/index.d.ts.map +1 -0
- package/dist/checkout-i18n/index.js +3 -0
- package/dist/checkout-i18n/messages.d.ts +121 -0
- package/dist/checkout-i18n/messages.d.ts.map +1 -0
- package/dist/checkout-i18n/messages.js +1 -0
- package/dist/checkout-i18n/provider.d.ts +26 -0
- package/dist/checkout-i18n/provider.d.ts.map +1 -0
- package/dist/checkout-i18n/provider.js +41 -0
- package/dist/checkout-i18n/ro.d.ts +3 -0
- package/dist/checkout-i18n/ro.d.ts.map +1 -0
- package/dist/checkout-i18n/ro.js +127 -0
- package/dist/checkout-types.d.ts +53 -0
- package/dist/checkout-types.d.ts.map +1 -0
- package/dist/checkout-types.js +1 -0
- package/dist/checkout-ui.d.ts +7 -0
- package/dist/checkout-ui.d.ts.map +1 -0
- package/dist/checkout-ui.js +4 -0
- package/dist/checkout.d.ts +5 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +3 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +79 -0
- package/dist/components/accountant-portal/body.d.ts +8 -0
- package/dist/components/accountant-portal/body.d.ts.map +1 -0
- package/dist/components/accountant-portal/body.js +114 -0
- package/dist/components/accountant-portal/widgets.d.ts +13 -0
- package/dist/components/accountant-portal/widgets.d.ts.map +1 -0
- package/dist/components/accountant-portal/widgets.js +27 -0
- package/dist/components/accountant-portal.d.ts +10 -0
- package/dist/components/accountant-portal.d.ts.map +1 -0
- package/dist/components/accountant-portal.js +22 -0
- package/dist/components/accountant-share-dialog.d.ts +6 -0
- package/dist/components/accountant-share-dialog.d.ts.map +1 -0
- package/dist/components/accountant-share-dialog.js +53 -0
- package/dist/components/async-combobox.d.ts +33 -0
- package/dist/components/async-combobox.d.ts.map +1 -0
- package/dist/components/async-combobox.js +100 -0
- package/dist/components/booking-invoice-dialog.d.ts +63 -0
- package/dist/components/booking-invoice-dialog.d.ts.map +1 -0
- package/dist/components/booking-invoice-dialog.js +383 -0
- package/dist/components/cost-categories-page.d.ts +5 -0
- package/dist/components/cost-categories-page.d.ts.map +1 -0
- package/dist/components/cost-categories-page.js +30 -0
- package/dist/components/invoice-action-ledger-card.d.ts +15 -0
- package/dist/components/invoice-action-ledger-card.d.ts.map +1 -0
- package/dist/components/invoice-action-ledger-card.js +76 -0
- package/dist/components/invoice-bulk-actions.d.ts +10 -0
- package/dist/components/invoice-bulk-actions.d.ts.map +1 -0
- package/dist/components/invoice-bulk-actions.js +19 -0
- package/dist/components/invoice-detail-page/cards.d.ts +44 -0
- package/dist/components/invoice-detail-page/cards.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/cards.js +43 -0
- package/dist/components/invoice-detail-page/header.d.ts +15 -0
- package/dist/components/invoice-detail-page/header.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/header.js +30 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts +28 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/notes-dialogs.js +104 -0
- package/dist/components/invoice-detail-page/primitives.d.ts +47 -0
- package/dist/components/invoice-detail-page/primitives.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/primitives.js +76 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts +7 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts.map +1 -0
- package/dist/components/invoice-detail-page-with-action-ledger.js +11 -0
- package/dist/components/invoice-detail-page.d.ts +46 -0
- package/dist/components/invoice-detail-page.d.ts.map +1 -0
- package/dist/components/invoice-detail-page.js +134 -0
- package/dist/components/invoice-dialog.d.ts +9 -0
- package/dist/components/invoice-dialog.d.ts.map +1 -0
- package/dist/components/invoice-dialog.js +145 -0
- package/dist/components/invoice-number-series-dialog.d.ts +9 -0
- package/dist/components/invoice-number-series-dialog.d.ts.map +1 -0
- package/dist/components/invoice-number-series-dialog.js +134 -0
- package/dist/components/invoice-number-series-format.d.ts +3 -0
- package/dist/components/invoice-number-series-format.d.ts.map +1 -0
- package/dist/components/invoice-number-series-format.js +4 -0
- package/dist/components/invoice-number-series-page.d.ts +5 -0
- package/dist/components/invoice-number-series-page.d.ts.map +1 -0
- package/dist/components/invoice-number-series-page.js +55 -0
- package/dist/components/invoice-table-parts.d.ts +25 -0
- package/dist/components/invoice-table-parts.d.ts.map +1 -0
- package/dist/components/invoice-table-parts.js +32 -0
- package/dist/components/invoices-page-skeleton.d.ts +5 -0
- package/dist/components/invoices-page-skeleton.d.ts.map +1 -0
- package/dist/components/invoices-page-skeleton.js +13 -0
- package/dist/components/invoices-page.d.ts +6 -0
- package/dist/components/invoices-page.d.ts.map +1 -0
- package/dist/components/invoices-page.js +145 -0
- package/dist/components/payment-detail-page.d.ts +47 -0
- package/dist/components/payment-detail-page.d.ts.map +1 -0
- package/dist/components/payment-detail-page.js +90 -0
- package/dist/components/payment-policy-form.d.ts +49 -0
- package/dist/components/payment-policy-form.d.ts.map +1 -0
- package/dist/components/payment-policy-form.js +82 -0
- package/dist/components/payments-page/controls.d.ts +23 -0
- package/dist/components/payments-page/controls.d.ts.map +1 -0
- package/dist/components/payments-page/controls.js +20 -0
- package/dist/components/payments-page-skeleton.d.ts +5 -0
- package/dist/components/payments-page-skeleton.d.ts.map +1 -0
- package/dist/components/payments-page-skeleton.js +13 -0
- package/dist/components/payments-page.d.ts +20 -0
- package/dist/components/payments-page.d.ts.map +1 -0
- package/dist/components/payments-page.js +143 -0
- package/dist/components/profitability-page/sections.d.ts +24 -0
- package/dist/components/profitability-page/sections.d.ts.map +1 -0
- package/dist/components/profitability-page/sections.js +43 -0
- package/dist/components/profitability-page.d.ts +13 -0
- package/dist/components/profitability-page.d.ts.map +1 -0
- package/dist/components/profitability-page.js +175 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts +54 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog/shared.js +47 -0
- package/dist/components/record-booking-payment-dialog.d.ts +4 -0
- package/dist/components/record-booking-payment-dialog.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog.js +256 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts +34 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.js +119 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts +64 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/shared.js +70 -0
- package/dist/components/supplier-invoice-detail-page.d.ts +4 -0
- package/dist/components/supplier-invoice-detail-page.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page.js +101 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts +45 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts.map +1 -0
- package/dist/components/supplier-invoice-form-dialog.js +102 -0
- package/dist/components/supplier-invoices-page.d.ts +14 -0
- package/dist/components/supplier-invoices-page.d.ts.map +1 -0
- package/dist/components/supplier-invoices-page.js +69 -0
- package/dist/components/supplier-payment-dialog.d.ts +7 -0
- package/dist/components/supplier-payment-dialog.d.ts.map +1 -0
- package/dist/components/supplier-payment-dialog.js +103 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts +8 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-profile-sheet.js +52 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts +10 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-rule-sheet.js +137 -0
- package/dist/components/taxes-page/shared.d.ts +128 -0
- package/dist/components/taxes-page/shared.d.ts.map +1 -0
- package/dist/components/taxes-page/shared.js +288 -0
- package/dist/components/taxes-page/sheets.d.ts +4 -0
- package/dist/components/taxes-page/sheets.d.ts.map +1 -0
- package/dist/components/taxes-page/sheets.js +3 -0
- package/dist/components/taxes-page/tax-sheet.d.ts +9 -0
- package/dist/components/taxes-page/tax-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/tax-sheet.js +108 -0
- package/dist/components/taxes-page.d.ts +4 -0
- package/dist/components/taxes-page.d.ts.map +1 -0
- package/dist/components/taxes-page.js +165 -0
- package/dist/hooks/index.d.ts +53 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +52 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts +20 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts.map +1 -0
- package/dist/hooks/use-accountant-share-mutation.js +27 -0
- package/dist/hooks/use-accountant-shares.d.ts +13 -0
- package/dist/hooks/use-accountant-shares.d.ts.map +1 -0
- package/dist/hooks/use-accountant-shares.js +8 -0
- package/dist/hooks/use-admin-booking-payments.d.ts +30 -0
- package/dist/hooks/use-admin-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-admin-booking-payments.js +18 -0
- package/dist/hooks/use-all-payments.d.ts +35 -0
- package/dist/hooks/use-all-payments.d.ts.map +1 -0
- package/dist/hooks/use-all-payments.js +12 -0
- package/dist/hooks/use-booking-guarantees.d.ts +82 -0
- package/dist/hooks/use-booking-guarantees.d.ts.map +1 -0
- package/dist/hooks/use-booking-guarantees.js +46 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts +44 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.js +27 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts +63 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedules.js +47 -0
- package/dist/hooks/use-cost-categories.d.ts +14 -0
- package/dist/hooks/use-cost-categories.d.ts.map +1 -0
- package/dist/hooks/use-cost-categories.js +9 -0
- package/dist/hooks/use-cost-category-mutation.d.ts +31 -0
- package/dist/hooks/use-cost-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-cost-category-mutation.js +27 -0
- package/dist/hooks/use-departure-profitability.d.ts +56 -0
- package/dist/hooks/use-departure-profitability.d.ts.map +1 -0
- package/dist/hooks/use-departure-profitability.js +12 -0
- package/dist/hooks/use-finance-action-ledger.d.ts +94 -0
- package/dist/hooks/use-finance-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-finance-action-ledger.js +20 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts +43 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachment-mutation.js +39 -0
- package/dist/hooks/use-invoice-attachments.d.ts +18 -0
- package/dist/hooks/use-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachments.js +12 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts +51 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.js +66 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts +38 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-note-mutation.js +35 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts +17 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-notes.js +12 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts +19 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts.map +1 -0
- package/dist/hooks/use-invoice-fx-rate.js +13 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts +40 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-item-mutation.js +42 -0
- package/dist/hooks/use-invoice-line-items.d.ts +17 -0
- package/dist/hooks/use-invoice-line-items.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-items.js +12 -0
- package/dist/hooks/use-invoice-mutation.d.ts +225 -0
- package/dist/hooks/use-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-mutation.js +121 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts +11 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-note-mutation.js +23 -0
- package/dist/hooks/use-invoice-notes.d.ts +13 -0
- package/dist/hooks/use-invoice-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-notes.js +12 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts +62 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series-mutation.js +39 -0
- package/dist/hooks/use-invoice-number-series.d.ts +28 -0
- package/dist/hooks/use-invoice-number-series.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series.js +12 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts +29 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payment-mutation.js +35 -0
- package/dist/hooks/use-invoice-payments.d.ts +21 -0
- package/dist/hooks/use-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payments.js +12 -0
- package/dist/hooks/use-invoice.d.ts +32 -0
- package/dist/hooks/use-invoice.d.ts.map +1 -0
- package/dist/hooks/use-invoice.js +12 -0
- package/dist/hooks/use-invoices.d.ts +36 -0
- package/dist/hooks/use-invoices.d.ts.map +1 -0
- package/dist/hooks/use-invoices.js +12 -0
- package/dist/hooks/use-payment-mutation.d.ts +57 -0
- package/dist/hooks/use-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-mutation.js +59 -0
- package/dist/hooks/use-payment-session-mutation.d.ts +205 -0
- package/dist/hooks/use-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-session-mutation.js +38 -0
- package/dist/hooks/use-payment-sessions.d.ts +97 -0
- package/dist/hooks/use-payment-sessions.d.ts.map +1 -0
- package/dist/hooks/use-payment-sessions.js +17 -0
- package/dist/hooks/use-payment.d.ts +31 -0
- package/dist/hooks/use-payment.d.ts.map +1 -0
- package/dist/hooks/use-payment.js +12 -0
- package/dist/hooks/use-product-profitability.d.ts +52 -0
- package/dist/hooks/use-product-profitability.d.ts.map +1 -0
- package/dist/hooks/use-product-profitability.js +12 -0
- package/dist/hooks/use-public-booking-documents.d.ts +29 -0
- package/dist/hooks/use-public-booking-documents.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-documents.js +12 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts +47 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payment-options.js +12 -0
- package/dist/hooks/use-public-booking-payments.d.ts +24 -0
- package/dist/hooks/use-public-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payments.js +12 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts +27 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts.map +1 -0
- package/dist/hooks/use-public-finance-document-by-reference.js +12 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts +82 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session-mutation.js +33 -0
- package/dist/hooks/use-public-payment-session.d.ts +73 -0
- package/dist/hooks/use-public-payment-session.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session.js +12 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts +23 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-voucher-validation-mutation.js +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-attachments.js +12 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts +353 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-mutation.js +81 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts +26 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-payments.js +12 -0
- package/dist/hooks/use-supplier-invoice.d.ts +65 -0
- package/dist/hooks/use-supplier-invoice.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice.js +12 -0
- package/dist/hooks/use-supplier-invoices.d.ts +36 -0
- package/dist/hooks/use-supplier-invoices.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoices.js +12 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts +55 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payment-mutation.js +35 -0
- package/dist/hooks/use-supplier-payments.d.ts +27 -0
- package/dist/hooks/use-supplier-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payments.js +12 -0
- package/dist/hooks/use-traveler-profitability.d.ts +24 -0
- package/dist/hooks/use-traveler-profitability.d.ts.map +1 -0
- package/dist/hooks/use-traveler-profitability.js +11 -0
- package/dist/hooks/use-voucher-mutation.d.ts +105 -0
- package/dist/hooks/use-voucher-mutation.d.ts.map +1 -0
- package/dist/hooks/use-voucher-mutation.js +50 -0
- package/dist/hooks/use-voucher.d.ts +38 -0
- package/dist/hooks/use-voucher.d.ts.map +1 -0
- package/dist/hooks/use-voucher.js +17 -0
- package/dist/hooks/use-vouchers.d.ts +34 -0
- package/dist/hooks/use-vouchers.d.ts.map +1 -0
- package/dist/hooks/use-vouchers.js +18 -0
- package/dist/i18n/en/invoices.d.ts +278 -0
- package/dist/i18n/en/invoices.d.ts.map +1 -0
- package/dist/i18n/en/invoices.js +277 -0
- package/dist/i18n/en/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/en/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/en/numberingAndPayments.js +386 -0
- package/dist/i18n/en/profitability.d.ts +147 -0
- package/dist/i18n/en/profitability.d.ts.map +1 -0
- package/dist/i18n/en/profitability.js +146 -0
- package/dist/i18n/en/suppliers.d.ts +187 -0
- package/dist/i18n/en/suppliers.d.ts.map +1 -0
- package/dist/i18n/en/suppliers.js +186 -0
- package/dist/i18n/en.d.ts +998 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +22 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages/core.d.ts +18 -0
- package/dist/i18n/messages/core.d.ts.map +1 -0
- package/dist/i18n/messages/core.js +30 -0
- package/dist/i18n/messages/invoices.d.ts +252 -0
- package/dist/i18n/messages/invoices.d.ts.map +1 -0
- package/dist/i18n/messages/invoices.js +1 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts +277 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/messages/numberingAndPayments.js +1 -0
- package/dist/i18n/messages/profitability.d.ts +151 -0
- package/dist/i18n/messages/profitability.d.ts.map +1 -0
- package/dist/i18n/messages/profitability.js +1 -0
- package/dist/i18n/messages/suppliers.d.ts +167 -0
- package/dist/i18n/messages/suppliers.d.ts.map +1 -0
- package/dist/i18n/messages/suppliers.js +1 -0
- package/dist/i18n/messages.d.ts +29 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +2018 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro/invoices.d.ts +278 -0
- package/dist/i18n/ro/invoices.d.ts.map +1 -0
- package/dist/i18n/ro/invoices.js +277 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/ro/numberingAndPayments.js +386 -0
- package/dist/i18n/ro/profitability.d.ts +147 -0
- package/dist/i18n/ro/profitability.d.ts.map +1 -0
- package/dist/i18n/ro/profitability.js +146 -0
- package/dist/i18n/ro/suppliers.d.ts +187 -0
- package/dist/i18n/ro/suppliers.d.ts.map +1 -0
- package/dist/i18n/ro/suppliers.js +186 -0
- package/dist/i18n/ro.d.ts +998 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +22 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/operations.d.ts +484 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +52 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +195 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +49 -0
- package/dist/query-options/public-reporting.d.ts +2129 -0
- package/dist/query-options/public-reporting.d.ts.map +1 -0
- package/dist/query-options/public-reporting.js +193 -0
- package/dist/query-options-action-ledger.d.ts +382 -0
- package/dist/query-options-action-ledger.d.ts.map +1 -0
- package/dist/query-options-action-ledger.js +36 -0
- package/dist/query-options.d.ts +2057 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +328 -0
- package/dist/schemas/accountant.d.ts +168 -0
- package/dist/schemas/accountant.d.ts.map +1 -0
- package/dist/schemas/accountant.js +53 -0
- package/dist/schemas/action-ledger.d.ts +206 -0
- package/dist/schemas/action-ledger.d.ts.map +1 -0
- package/dist/schemas/action-ledger.js +83 -0
- package/dist/schemas/common.d.ts +17 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +10 -0
- package/dist/schemas/invoice.d.ts +1451 -0
- package/dist/schemas/invoice.d.ts.map +1 -0
- package/dist/schemas/invoice.js +438 -0
- package/dist/schemas/profitability.d.ts +333 -0
- package/dist/schemas/profitability.d.ts.map +1 -0
- package/dist/schemas/profitability.js +84 -0
- package/dist/schemas/public.d.ts +481 -0
- package/dist/schemas/public.d.ts.map +1 -0
- package/dist/schemas/public.js +9 -0
- package/dist/schemas/responses.d.ts +632 -0
- package/dist/schemas/responses.d.ts.map +1 -0
- package/dist/schemas/responses.js +27 -0
- package/dist/schemas/supplier.d.ts +226 -0
- package/dist/schemas/supplier.d.ts.map +1 -0
- package/dist/schemas/supplier.js +103 -0
- package/dist/schemas/vouchers.d.ts +283 -0
- package/dist/schemas/vouchers.d.ts.map +1 -0
- package/dist/schemas/vouchers.js +49 -0
- package/dist/schemas.d.ts +10 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +9 -0
- package/dist/ui.d.ts +27 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +26 -0
- package/package.json +181 -0
- package/src/styles.css +12 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
3
|
+
import { Badge, Button, Card, CardContent, CardHeader, CardTitle, } from "@voyant-travel/ui/components";
|
|
4
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@voyant-travel/ui/components/alert-dialog";
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
6
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
7
|
+
import { Download, Pencil, Plus, Trash2 } from "lucide-react";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { useFinanceUiMessagesOrDefault } from "../i18n/index.js";
|
|
10
|
+
import { useCostCategories, useSupplierInvoice, useSupplierInvoiceAttachments, useSupplierInvoiceMutation, useSupplierInvoicePayments, } from "../index.js";
|
|
11
|
+
import { formatInvoiceAmount } from "./invoice-table-parts.js";
|
|
12
|
+
import { AllocationDialog, LineDialog, PaymentDialog, } from "./supplier-invoice-detail-page/dialogs.js";
|
|
13
|
+
import { allocationToInput, Field, formatFileSize, lineToInput, STATUS_VARIANT, } from "./supplier-invoice-detail-page/shared.js";
|
|
14
|
+
import { SupplierInvoiceFormDialog } from "./supplier-invoice-form-dialog.js";
|
|
15
|
+
export function SupplierInvoiceDetailPage({ id, className, onBack, onDownloadDocument, uploadFile, onDownloadAttachment, searchTargets, listDeparturesForProduct, extractFromFile, searchSuppliers, createSupplier, }) {
|
|
16
|
+
const messages = useFinanceUiMessagesOrDefault();
|
|
17
|
+
const t = messages.supplierInvoiceDetail;
|
|
18
|
+
const statusLabels = messages.supplierInvoicesPage.statusLabels;
|
|
19
|
+
const { data, isPending, isError } = useSupplierInvoice(id);
|
|
20
|
+
const paymentsQuery = useSupplierInvoicePayments(id);
|
|
21
|
+
const attachmentsQuery = useSupplierInvoiceAttachments(id);
|
|
22
|
+
const costCategories = useCostCategories().data?.data ?? [];
|
|
23
|
+
const categoryNameById = new Map(costCategories.map((c) => [c.id, c.name]));
|
|
24
|
+
const { setAllocations, setLines, recordPayment, remove, addAttachment, removeAttachment } = useSupplierInvoiceMutation();
|
|
25
|
+
const [uploading, setUploading] = useState(false);
|
|
26
|
+
const invoice = data?.data ?? null;
|
|
27
|
+
const currency = invoice?.currency ?? "";
|
|
28
|
+
const [editOpen, setEditOpen] = useState(false);
|
|
29
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
30
|
+
const [lineDialog, setLineDialog] = useState(null);
|
|
31
|
+
const [allocationDialog, setAllocationDialog] = useState(null);
|
|
32
|
+
const [paymentOpen, setPaymentOpen] = useState(false);
|
|
33
|
+
if (isPending)
|
|
34
|
+
return _jsx("div", { className: "p-6 text-muted-foreground", children: t.loading });
|
|
35
|
+
if (isError || !invoice)
|
|
36
|
+
return _jsx("div", { className: "p-6 text-destructive", children: t.notFound });
|
|
37
|
+
// Whole-invoice allocations (per-line allocation is a future mode).
|
|
38
|
+
const allocationList = invoice.allocations.filter((a) => a.supplierInvoiceLineId == null);
|
|
39
|
+
const allocatedCents = allocationList.reduce((sum, a) => sum + a.amountCents, 0);
|
|
40
|
+
const remainderCents = invoice.totalCents - allocatedCents;
|
|
41
|
+
const overAllocated = remainderCents < 0;
|
|
42
|
+
// Lines + allocations are edited via the full-replace mutations.
|
|
43
|
+
const persistLines = (lines) => setLines.mutate({ id, lines });
|
|
44
|
+
const removeLine = (lineId) => persistLines(invoice.lines.filter((l) => l.id !== lineId).map(lineToInput));
|
|
45
|
+
const persistAllocations = (allocations) => setAllocations.mutate({ id, allocations });
|
|
46
|
+
const removeAllocation = (allocationId) => persistAllocations(allocationList.filter((a) => a.id !== allocationId).map(allocationToInput));
|
|
47
|
+
const allocationTargetId = (a) => a.departureId ?? a.productId ?? a.bookingId ?? a.travelerId ?? "";
|
|
48
|
+
const methodLabel = (method) => t.payments.methodLabels[method] ?? method;
|
|
49
|
+
const payments = paymentsQuery.data?.data ?? [];
|
|
50
|
+
const attachments = attachmentsQuery.data?.data ?? [];
|
|
51
|
+
const handleUpload = async (files) => {
|
|
52
|
+
if (!uploadFile || !files || files.length === 0)
|
|
53
|
+
return;
|
|
54
|
+
setUploading(true);
|
|
55
|
+
try {
|
|
56
|
+
for (const file of Array.from(files)) {
|
|
57
|
+
const uploaded = await uploadFile(file);
|
|
58
|
+
await addAttachment.mutateAsync({
|
|
59
|
+
id,
|
|
60
|
+
input: {
|
|
61
|
+
name: file.name,
|
|
62
|
+
mimeType: uploaded.mimeType ?? file.type ?? null,
|
|
63
|
+
fileSize: uploaded.fileSize ?? file.size,
|
|
64
|
+
storageKey: uploaded.storageKey,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
setUploading(false);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "size-4" }), t.actions.edit] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setDeleteOpen(true), children: [_jsx(Trash2, { className: "size-4" }), t.actions.delete] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-2", children: [_jsxs("div", { children: [_jsx(CardTitle, { className: "text-lg", children: invoice.supplierInvoiceNo }), _jsx("p", { className: "text-sm text-muted-foreground", children: invoice.supplierId })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { variant: STATUS_VARIANT[invoice.status], children: statusLabels[invoice.status] }), invoice.storageKey ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: onDownloadDocument, children: [_jsx(Download, { className: "size-4" }), t.document] })) : null] })] }), _jsxs(CardContent, { className: "grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5", children: [_jsx(Field, { label: t.summary.subtotal, value: formatInvoiceAmount(invoice.subtotalCents, currency) }), _jsx(Field, { label: t.summary.tax, value: formatInvoiceAmount(invoice.taxCents, currency) }), _jsx(Field, { label: t.summary.total, value: formatInvoiceAmount(invoice.totalCents, currency) }), _jsx(Field, { label: t.summary.paid, value: formatInvoiceAmount(invoice.paidCents, currency) }), _jsx(Field, { label: t.summary.balanceDue, value: formatInvoiceAmount(invoice.balanceDueCents, currency) }), _jsx(Field, { label: t.summary.issueDate, value: invoice.issueDate }), _jsx(Field, { label: t.summary.dueDate, value: invoice.dueDate ?? t.summary.noValue })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.lines.title }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setLineDialog({ line: null }), children: [_jsx(Plus, { className: "size-4" }), t.lines.add] })] }), _jsx(CardContent, { children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.lines.description }), _jsx(TableHead, { children: t.lines.service }), _jsx(TableHead, { className: "text-right", children: t.lines.qty }), _jsx(TableHead, { className: "text-right", children: t.lines.unit }), _jsx(TableHead, { className: "text-right", children: t.lines.tax }), _jsx(TableHead, { className: "text-right", children: t.lines.total }), _jsx(TableHead, { className: "w-20" })] }) }), _jsx(TableBody, { children: invoice.lines.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 7, className: "text-center text-muted-foreground", children: t.lines.empty }) })) : (invoice.lines.map((line) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: line.description }), _jsx(TableCell, { className: "text-muted-foreground", children: (line.costCategoryId && categoryNameById.get(line.costCategoryId)) ??
|
|
74
|
+
t.lineForm.serviceTypeLabels[line.serviceType] }), _jsx(TableCell, { className: "text-right tabular-nums", children: line.quantity }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(line.unitAmountCents, currency) }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(line.taxAmountCents, currency) }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(line.totalAmountCents, currency) }), _jsxs(TableCell, { className: "text-right", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => setLineDialog({ line }), "aria-label": t.lines.edit, children: _jsx(Pencil, { className: "size-4" }) }), _jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeLine(line.id), "aria-label": t.lines.remove, children: _jsx(Trash2, { className: "size-4" }) })] })] }, line.id)))) })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.allocation.title }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setAllocationDialog({ allocation: null }), children: [_jsx(Plus, { className: "size-4" }), t.allocation.add] })] }), _jsxs(CardContent, { className: "flex flex-col gap-3", children: [_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.allocation.target }), _jsx(TableHead, { children: t.allocation.reference }), _jsx(TableHead, { className: "text-right", children: t.payments.amount }), _jsx(TableHead, { className: "w-20" })] }) }), _jsx(TableBody, { children: allocationList.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 4, className: "text-center text-muted-foreground", children: t.allocation.none }) })) : (allocationList.map((allocation) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: t.allocation.targetTypeLabels[allocation.targetType] }), _jsx(TableCell, { className: "text-muted-foreground", children: allocation.targetLabel ?? allocationTargetId(allocation) ?? "—" }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(allocation.amountCents, currency) }), _jsxs(TableCell, { className: "text-right", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => setAllocationDialog({ allocation }), "aria-label": t.actions.edit, children: _jsx(Pencil, { className: "size-4" }) }), _jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeAllocation(allocation.id), "aria-label": t.lines.remove, children: _jsx(Trash2, { className: "size-4" }) })] })] }, allocation.id)))) })] }), _jsx("div", { className: "border-t pt-3 text-sm", children: _jsx("span", { className: cn("text-muted-foreground", overAllocated && "text-destructive"), children: overAllocated
|
|
75
|
+
? formatMessage(t.allocation.overAllocated, {
|
|
76
|
+
amount: formatInvoiceAmount(-remainderCents, currency),
|
|
77
|
+
})
|
|
78
|
+
: formatMessage(t.allocation.remainder, {
|
|
79
|
+
amount: formatInvoiceAmount(remainderCents, currency),
|
|
80
|
+
}) }) })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.payments.title }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setPaymentOpen(true), children: [_jsx(Plus, { className: "size-4" }), t.payments.record] })] }), _jsx(CardContent, { children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.payments.date }), _jsx(TableHead, { children: t.payments.method }), _jsx(TableHead, { children: t.payments.status }), _jsx(TableHead, { className: "text-right", children: t.payments.amount })] }) }), _jsx(TableBody, { children: payments.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 4, className: "text-center text-muted-foreground", children: t.payments.empty }) })) : (payments.map((payment) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: payment.paymentDate }), _jsx(TableCell, { className: "text-muted-foreground", children: methodLabel(payment.paymentMethod) }), _jsx(TableCell, { children: payment.status }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(payment.amountCents, payment.currency) })] }, payment.id)))) })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.attachments.title }), uploadFile ? (_jsxs("label", { className: "cursor-pointer", children: [_jsxs("span", { className: "inline-flex h-8 items-center gap-2 rounded-md border px-3 text-sm font-medium hover:bg-muted", children: [_jsx(Plus, { className: "size-4" }), uploading ? t.attachments.uploading : t.attachments.upload] }), _jsx("input", { type: "file", multiple: true, className: "sr-only", disabled: uploading, onChange: (e) => {
|
|
81
|
+
void handleUpload(e.target.files);
|
|
82
|
+
e.target.value = "";
|
|
83
|
+
} })] })) : null] }), _jsx(CardContent, { children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.attachments.name }), _jsx(TableHead, { className: "text-right", children: t.attachments.size }), _jsx(TableHead, { className: "w-28" })] }) }), _jsx(TableBody, { children: attachments.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 3, className: "text-center text-muted-foreground", children: t.attachments.empty }) })) : (attachments.map((attachment) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: attachment.name }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatFileSize(attachment.fileSize) }), _jsxs(TableCell, { className: "text-right", children: [onDownloadAttachment && attachment.storageKey ? (_jsx(Button, { variant: "ghost", size: "icon", onClick: () => onDownloadAttachment(attachment.id), "aria-label": t.attachments.download, children: _jsx(Download, { className: "size-4" }) })) : null, _jsx(Button, { variant: "ghost", size: "icon", onClick: () => removeAttachment.mutate({ id, attachmentId: attachment.id }), "aria-label": t.attachments.remove, children: _jsx(Trash2, { className: "size-4" }) })] })] }, attachment.id)))) })] }) })] }), _jsx(SupplierInvoiceFormDialog, { open: editOpen, onOpenChange: setEditOpen, invoice: invoice, extractFromFile: extractFromFile, searchSuppliers: searchSuppliers, createSupplier: createSupplier }), _jsx(LineDialog, { open: lineDialog != null, line: lineDialog?.line ?? null, currency: currency, pending: setLines.isPending, onOpenChange: (open) => setLineDialog(open ? (lineDialog ?? { line: null }) : null), onSubmit: (input) => {
|
|
84
|
+
const existing = invoice.lines.map(lineToInput);
|
|
85
|
+
const editing = lineDialog?.line;
|
|
86
|
+
const next = editing
|
|
87
|
+
? invoice.lines.map((l) => (l.id === editing.id ? input : lineToInput(l)))
|
|
88
|
+
: [...existing, input];
|
|
89
|
+
persistLines(next);
|
|
90
|
+
setLineDialog(null);
|
|
91
|
+
} }), _jsx(AllocationDialog, { open: allocationDialog != null, allocation: allocationDialog?.allocation ?? null, currency: currency, pending: setAllocations.isPending, searchTargets: searchTargets, listDeparturesForProduct: listDeparturesForProduct, onOpenChange: (open) => setAllocationDialog(open ? (allocationDialog ?? { allocation: null }) : null), onSubmit: (input) => {
|
|
92
|
+
const editing = allocationDialog?.allocation;
|
|
93
|
+
const next = editing
|
|
94
|
+
? allocationList.map((a) => (a.id === editing.id ? input : allocationToInput(a)))
|
|
95
|
+
: [...allocationList.map(allocationToInput), input];
|
|
96
|
+
persistAllocations(next);
|
|
97
|
+
setAllocationDialog(null);
|
|
98
|
+
} }), _jsx(PaymentDialog, { open: paymentOpen, currency: currency, pending: recordPayment.isPending, onOpenChange: setPaymentOpen, onSubmit: (input) => {
|
|
99
|
+
recordPayment.mutate({ id, input: { ...input, currency } }, { onSuccess: () => setPaymentOpen(false) });
|
|
100
|
+
} }), _jsx(AlertDialog, { open: deleteOpen, onOpenChange: setDeleteOpen, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: t.deleteDialog.title }), _jsx(AlertDialogDescription, { children: t.deleteDialog.body })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: t.deleteDialog.cancel }), _jsx(AlertDialogAction, { onClick: () => remove.mutate(id, { onSuccess: () => onBack?.() }), disabled: remove.isPending, children: t.deleteDialog.confirm })] })] }) })] }));
|
|
101
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type SupplierInvoiceRecord, type SupplierInvoiceStatus } from "../index.js";
|
|
2
|
+
import { type AsyncComboboxOption } from "./async-combobox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Header fields an extractor may return to prefill the form. All optional —
|
|
5
|
+
* the operator only overrides the fields it could resolve; the user confirms
|
|
6
|
+
* before saving.
|
|
7
|
+
*/
|
|
8
|
+
export interface SupplierInvoiceExtraction {
|
|
9
|
+
supplierInvoiceNo?: string | null;
|
|
10
|
+
supplierId?: string | null;
|
|
11
|
+
status?: SupplierInvoiceStatus | null;
|
|
12
|
+
currency?: string | null;
|
|
13
|
+
issueDate?: string | null;
|
|
14
|
+
dueDate?: string | null;
|
|
15
|
+
internalRef?: string | null;
|
|
16
|
+
notes?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface SupplierInvoiceFormDialogProps {
|
|
19
|
+
open: boolean;
|
|
20
|
+
onOpenChange: (open: boolean) => void;
|
|
21
|
+
/** Present → edit mode; absent → create mode. */
|
|
22
|
+
invoice?: SupplierInvoiceRecord;
|
|
23
|
+
onSaved?: (id: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Extension point: extract header fields from an uploaded invoice file
|
|
26
|
+
* (AI/OCR/whatever the deployment wires). When provided, an upload control
|
|
27
|
+
* appears that prefills the form for the user to confirm. Omit it (the
|
|
28
|
+
* default) and no extraction UI is shown.
|
|
29
|
+
*/
|
|
30
|
+
extractFromFile?: (file: File) => Promise<SupplierInvoiceExtraction>;
|
|
31
|
+
/**
|
|
32
|
+
* Search the suppliers module for the supplier picker. The selected option's
|
|
33
|
+
* value is stored as the invoice's `supplierId` (a loose text reference — no
|
|
34
|
+
* cross-module FK). When omitted, a plain text input is shown instead.
|
|
35
|
+
*/
|
|
36
|
+
searchSuppliers?: (query: string) => Promise<AsyncComboboxOption[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a supplier inline from the picker. Receives the typed name, returns
|
|
39
|
+
* the new option (whose value becomes the stored `supplierId`). Only offered
|
|
40
|
+
* when both this and `searchSuppliers` are provided.
|
|
41
|
+
*/
|
|
42
|
+
createSupplier?: (name: string) => Promise<AsyncComboboxOption | null>;
|
|
43
|
+
}
|
|
44
|
+
export declare function SupplierInvoiceFormDialog({ open, onOpenChange, invoice, onSaved, extractFromFile, searchSuppliers, createSupplier, }: SupplierInvoiceFormDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
//# sourceMappingURL=supplier-invoice-form-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supplier-invoice-form-dialog.d.ts","sourceRoot":"","sources":["../../src/components/supplier-invoice-form-dialog.tsx"],"names":[],"mappings":"AAwBA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAY7E;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,iDAAiD;IACjD,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAC/B,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACpE;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACnE;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;CACvE;AA0BD,wBAAgB,yBAAyB,CAAC,EACxC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,eAAe,EACf,eAAe,EACf,cAAc,GACf,EAAE,8BAA8B,2CA4KhC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
3
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyant-travel/ui/components";
|
|
4
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
5
|
+
import { DatePicker } from "@voyant-travel/ui/components/date-picker";
|
|
6
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
7
|
+
import { Upload } from "lucide-react";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
import { useFinanceUiMessagesOrDefault } from "../i18n/index.js";
|
|
10
|
+
import { useSupplierInvoiceMutation, } from "../index.js";
|
|
11
|
+
import { AsyncCombobox } from "./async-combobox.js";
|
|
12
|
+
const STATUS_ORDER = [
|
|
13
|
+
"draft",
|
|
14
|
+
"received",
|
|
15
|
+
"approved",
|
|
16
|
+
"partially_paid",
|
|
17
|
+
"paid",
|
|
18
|
+
"disputed",
|
|
19
|
+
"void",
|
|
20
|
+
];
|
|
21
|
+
function seed(invoice) {
|
|
22
|
+
return {
|
|
23
|
+
supplierInvoiceNo: invoice?.supplierInvoiceNo ?? "",
|
|
24
|
+
supplierId: invoice?.supplierId ?? "",
|
|
25
|
+
status: invoice?.status ?? "received",
|
|
26
|
+
currency: invoice?.currency ?? "EUR",
|
|
27
|
+
issueDate: invoice?.issueDate ?? "",
|
|
28
|
+
dueDate: invoice?.dueDate ?? "",
|
|
29
|
+
internalRef: invoice?.internalRef ?? "",
|
|
30
|
+
notes: invoice?.notes ?? "",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function SupplierInvoiceFormDialog({ open, onOpenChange, invoice, onSaved, extractFromFile, searchSuppliers, createSupplier, }) {
|
|
34
|
+
const messages = useFinanceUiMessagesOrDefault();
|
|
35
|
+
const t = messages.supplierInvoiceDetail.form;
|
|
36
|
+
const statusLabels = messages.supplierInvoicesPage.statusLabels;
|
|
37
|
+
const { create, update } = useSupplierInvoiceMutation();
|
|
38
|
+
const isEdit = Boolean(invoice);
|
|
39
|
+
const pending = create.isPending || update.isPending;
|
|
40
|
+
const [form, setForm] = useState(() => seed(invoice));
|
|
41
|
+
const [extracting, setExtracting] = useState(false);
|
|
42
|
+
const handleExtract = async (file) => {
|
|
43
|
+
if (!file || !extractFromFile)
|
|
44
|
+
return;
|
|
45
|
+
setExtracting(true);
|
|
46
|
+
try {
|
|
47
|
+
const x = await extractFromFile(file);
|
|
48
|
+
setForm((prev) => ({
|
|
49
|
+
supplierInvoiceNo: x.supplierInvoiceNo ?? prev.supplierInvoiceNo,
|
|
50
|
+
supplierId: x.supplierId ?? prev.supplierId,
|
|
51
|
+
status: x.status ?? prev.status,
|
|
52
|
+
currency: x.currency ?? prev.currency,
|
|
53
|
+
issueDate: x.issueDate ?? prev.issueDate,
|
|
54
|
+
dueDate: x.dueDate ?? prev.dueDate,
|
|
55
|
+
internalRef: x.internalRef ?? prev.internalRef,
|
|
56
|
+
notes: x.notes ?? prev.notes,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
setExtracting(false);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// Re-seed when the dialog opens or the target invoice changes.
|
|
64
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: re-seed on open/target change only -- owner: finance-react; existing suppression is intentional pending typed cleanup.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (open)
|
|
67
|
+
setForm(seed(invoice));
|
|
68
|
+
}, [open, invoice?.id]);
|
|
69
|
+
const set = (patch) => setForm((prev) => ({ ...prev, ...patch }));
|
|
70
|
+
const canSave = form.supplierInvoiceNo.trim() && form.supplierId.trim() && form.issueDate;
|
|
71
|
+
const submit = () => {
|
|
72
|
+
if (!canSave)
|
|
73
|
+
return;
|
|
74
|
+
const payload = {
|
|
75
|
+
supplierId: form.supplierId.trim(),
|
|
76
|
+
supplierInvoiceNo: form.supplierInvoiceNo.trim(),
|
|
77
|
+
status: form.status,
|
|
78
|
+
currency: form.currency.trim().toUpperCase(),
|
|
79
|
+
issueDate: form.issueDate,
|
|
80
|
+
dueDate: form.dueDate || null,
|
|
81
|
+
internalRef: form.internalRef.trim() || null,
|
|
82
|
+
notes: form.notes.trim() || null,
|
|
83
|
+
};
|
|
84
|
+
const onDone = (id) => {
|
|
85
|
+
onOpenChange(false);
|
|
86
|
+
onSaved?.(id);
|
|
87
|
+
};
|
|
88
|
+
if (invoice) {
|
|
89
|
+
update.mutate({ id: invoice.id, input: payload }, { onSuccess: (row) => onDone(row?.id ?? invoice.id) });
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
create.mutate(payload, { onSuccess: (row) => row && onDone(row.id) });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEdit ? t.editTitle : messages.supplierInvoicesPage.recordInvoice }) }), _jsxs(DialogBody, { className: "grid grid-cols-2 gap-3", children: [extractFromFile ? (_jsxs("label", { className: "col-span-2 cursor-pointer", children: [_jsxs("span", { className: "inline-flex h-9 items-center gap-2 rounded-md border border-dashed px-3 text-sm font-medium hover:bg-muted", children: [_jsx(Upload, { className: "size-4" }), extracting ? t.extracting : t.extractUpload] }), _jsx("input", { type: "file", className: "sr-only", disabled: extracting, onChange: (e) => {
|
|
96
|
+
void handleExtract(e.target.files?.[0]);
|
|
97
|
+
e.target.value = "";
|
|
98
|
+
} })] })) : null, _jsx(Field, { label: t.supplierInvoiceNo, children: _jsx(Input, { value: form.supplierInvoiceNo, onChange: (e) => set({ supplierInvoiceNo: e.target.value }) }) }), _jsx(Field, { label: t.supplierId, children: searchSuppliers ? (_jsx(AsyncCombobox, { value: form.supplierId || null, onChange: (v) => set({ supplierId: v ?? "" }), search: searchSuppliers, onCreate: createSupplier, createLabel: (name) => formatMessage(t.supplierCreate, { name }), placeholder: t.supplierSearchPlaceholder })) : (_jsx(Input, { value: form.supplierId, onChange: (e) => set({ supplierId: e.target.value }) })) }), _jsx(Field, { label: t.status, children: _jsxs(Select, { value: form.status, onValueChange: (v) => set({ status: v ?? "received" }), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: STATUS_ORDER.map((s) => (_jsx(SelectItem, { value: s, children: statusLabels[s] }, s))) })] }) }), _jsx(Field, { label: t.currency, children: _jsx(CurrencyCombobox, { value: form.currency || null, onChange: (v) => set({ currency: v ?? "" }), className: "w-full" }) }), _jsx(Field, { label: t.issueDate, children: _jsx(DatePicker, { value: form.issueDate || null, onChange: (v) => set({ issueDate: v ?? "" }), className: "w-full" }) }), _jsx(Field, { label: t.dueDate, children: _jsx(DatePicker, { value: form.dueDate || null, onChange: (v) => set({ dueDate: v ?? "" }), className: "w-full" }) }), _jsx(Field, { label: t.internalRef, className: "col-span-2", children: _jsx(Input, { value: form.internalRef, onChange: (e) => set({ internalRef: e.target.value }) }) }), _jsx(Field, { label: t.notes, className: "col-span-2", children: _jsx(Textarea, { value: form.notes, onChange: (e) => set({ notes: e.target.value }) }) })] }), _jsx(DialogFooter, { children: _jsx(Button, { type: "button", disabled: !canSave || pending, onClick: submit, children: pending ? t.saving : t.save }) })] }) }));
|
|
99
|
+
}
|
|
100
|
+
function Field({ label, className, children, }) {
|
|
101
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-2", className), children: [_jsx(Label, { children: label }), children] }));
|
|
102
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AsyncComboboxOption } from "./async-combobox.js";
|
|
2
|
+
import { type SupplierInvoiceExtraction } from "./supplier-invoice-form-dialog.js";
|
|
3
|
+
export interface SupplierInvoicesPageProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
onOpenSupplierInvoice?: (id: string) => void;
|
|
6
|
+
/** Optional invoice-extraction extension point for the create dialog. */
|
|
7
|
+
extractFromFile?: (file: File) => Promise<SupplierInvoiceExtraction>;
|
|
8
|
+
/** Search suppliers for the create dialog's supplier picker. */
|
|
9
|
+
searchSuppliers?: (query: string) => Promise<AsyncComboboxOption[]>;
|
|
10
|
+
/** Create a supplier inline from the create dialog's supplier picker. */
|
|
11
|
+
createSupplier?: (name: string) => Promise<AsyncComboboxOption | null>;
|
|
12
|
+
}
|
|
13
|
+
export declare function SupplierInvoicesPage({ className, onOpenSupplierInvoice, extractFromFile, searchSuppliers, createSupplier, }?: SupplierInvoicesPageProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=supplier-invoices-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supplier-invoices-page.d.ts","sourceRoot":"","sources":["../../src/components/supplier-invoices-page.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAO9D,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,mCAAmC,CAAA;AA4B1C,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,yEAAyE;IACzE,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACpE,gEAAgE;IAChE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACnE,yEAAyE;IACzE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;CACvE;AAID,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,GACf,GAAE,yBAA8B,2CAwLhC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge, Button, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components";
|
|
3
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
4
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
5
|
+
import { Plus, Search } from "lucide-react";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { useFinanceUiMessagesOrDefault } from "../i18n/index.js";
|
|
8
|
+
import { useSupplierInvoices, } from "../index.js";
|
|
9
|
+
import { formatInvoiceAmount, InvoiceRowSkeleton, PaginationBar, SortHeader, } from "./invoice-table-parts.js";
|
|
10
|
+
import { SupplierInvoiceFormDialog, } from "./supplier-invoice-form-dialog.js";
|
|
11
|
+
const PAGE_SIZE = 25;
|
|
12
|
+
const STATUS_ALL = "__all__";
|
|
13
|
+
const STATUS_ORDER = [
|
|
14
|
+
"draft",
|
|
15
|
+
"received",
|
|
16
|
+
"approved",
|
|
17
|
+
"partially_paid",
|
|
18
|
+
"paid",
|
|
19
|
+
"disputed",
|
|
20
|
+
"void",
|
|
21
|
+
];
|
|
22
|
+
const STATUS_VARIANT = {
|
|
23
|
+
draft: "outline",
|
|
24
|
+
received: "secondary",
|
|
25
|
+
approved: "secondary",
|
|
26
|
+
partially_paid: "default",
|
|
27
|
+
paid: "default",
|
|
28
|
+
disputed: "destructive",
|
|
29
|
+
void: "outline",
|
|
30
|
+
};
|
|
31
|
+
export function SupplierInvoicesPage({ className, onOpenSupplierInvoice, extractFromFile, searchSuppliers, createSupplier, } = {}) {
|
|
32
|
+
const t = useFinanceUiMessagesOrDefault().supplierInvoicesPage;
|
|
33
|
+
const [createOpen, setCreateOpen] = useState(false);
|
|
34
|
+
const [search, setSearch] = useState("");
|
|
35
|
+
const [status, setStatus] = useState(STATUS_ALL);
|
|
36
|
+
const [sortBy, setSortBy] = useState("createdAt");
|
|
37
|
+
const [sortDir, setSortDir] = useState("desc");
|
|
38
|
+
const [pageIndex, setPageIndex] = useState(0);
|
|
39
|
+
const { data, isPending, isFetching, isError } = useSupplierInvoices({
|
|
40
|
+
search: search || undefined,
|
|
41
|
+
status: status === STATUS_ALL ? undefined : status,
|
|
42
|
+
sortBy,
|
|
43
|
+
sortDir,
|
|
44
|
+
limit: PAGE_SIZE,
|
|
45
|
+
offset: pageIndex * PAGE_SIZE,
|
|
46
|
+
});
|
|
47
|
+
const invoices = data?.data ?? [];
|
|
48
|
+
const total = data?.total ?? 0;
|
|
49
|
+
const page = pageIndex + 1;
|
|
50
|
+
const pageCount = Math.max(1, Math.ceil(total / PAGE_SIZE));
|
|
51
|
+
const showSkeleton = isPending || (isFetching && invoices.length === 0);
|
|
52
|
+
const onSort = (field) => {
|
|
53
|
+
if (sortBy === field) {
|
|
54
|
+
setSortDir((dir) => (dir === "asc" ? "desc" : "asc"));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
setSortBy(field);
|
|
58
|
+
setSortDir("desc");
|
|
59
|
+
}
|
|
60
|
+
setPageIndex(0);
|
|
61
|
+
};
|
|
62
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t.title }), _jsx("p", { className: "text-sm text-muted-foreground", children: t.description })] }), _jsxs(Button, { onClick: () => setCreateOpen(true), children: [_jsx(Plus, { className: "size-4" }), t.recordInvoice] })] }), _jsx(SupplierInvoiceFormDialog, { open: createOpen, onOpenChange: setCreateOpen, onSaved: (id) => onOpenSupplierInvoice?.(id), extractFromFile: extractFromFile, searchSuppliers: searchSuppliers, createSupplier: createSupplier }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative max-w-sm flex-1", children: [_jsx(Search, { className: "absolute left-2 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { className: "pl-8", placeholder: t.searchPlaceholder, value: search, onChange: (event) => {
|
|
63
|
+
setSearch(event.target.value);
|
|
64
|
+
setPageIndex(0);
|
|
65
|
+
} })] }), _jsxs(Select, { value: status, onValueChange: (value) => {
|
|
66
|
+
setStatus(value ?? STATUS_ALL);
|
|
67
|
+
setPageIndex(0);
|
|
68
|
+
}, children: [_jsx(SelectTrigger, { className: "w-48", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: STATUS_ALL, children: t.statusAll }), STATUS_ORDER.map((value) => (_jsx(SelectItem, { value: value, children: t.statusLabels[value] }, value)))] })] })] }), _jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.columns.invoiceNo }), _jsx(TableHead, { children: t.columns.supplier }), _jsx(TableHead, { children: t.columns.status }), _jsx(TableHead, { className: "text-right", children: _jsx(SortHeader, { label: t.columns.total, field: "totalCents", sortBy: sortBy, sortDir: sortDir, onSort: onSort }) }), _jsx(TableHead, { className: "text-right", children: _jsx(SortHeader, { label: t.columns.balanceDue, field: "balanceDueCents", sortBy: sortBy, sortDir: sortDir, onSort: onSort }) }), _jsx(TableHead, { children: _jsx(SortHeader, { label: t.columns.dueDate, field: "dueDate", sortBy: sortBy, sortDir: sortDir, onSort: onSort }) })] }) }), _jsx(TableBody, { children: showSkeleton ? (_jsx(InvoiceRowSkeleton, { rows: 6 })) : isError ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 6, className: "text-center text-destructive", children: t.loadFailed }) })) : invoices.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 6, className: "text-center text-muted-foreground", children: t.empty }) })) : (invoices.map((invoice) => (_jsxs(TableRow, { className: onOpenSupplierInvoice ? "cursor-pointer" : undefined, onClick: onOpenSupplierInvoice ? () => onOpenSupplierInvoice(invoice.id) : undefined, children: [_jsx(TableCell, { className: "font-medium", children: invoice.supplierInvoiceNo }), _jsx(TableCell, { className: "text-muted-foreground", children: invoice.supplierId }), _jsx(TableCell, { children: _jsx(Badge, { variant: STATUS_VARIANT[invoice.status], children: t.statusLabels[invoice.status] }) }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(invoice.totalCents, invoice.currency) }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(invoice.balanceDueCents, invoice.currency) }), _jsx(TableCell, { children: invoice.dueDate ?? t.noDueDate })] }, invoice.id)))) })] }) }), _jsx(PaginationBar, { shown: invoices.length, total: total, page: page, pageCount: pageCount, onPrevious: () => setPageIndex((index) => Math.max(0, index - 1)), onNext: () => setPageIndex((index) => Math.min(pageCount - 1, index + 1)), canGoBack: page > 1, canGoForward: page < pageCount })] }));
|
|
69
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface SupplierPaymentDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function SupplierPaymentDialog({ open, onOpenChange, onSuccess, }: SupplierPaymentDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=supplier-payment-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supplier-payment-dialog.d.ts","sourceRoot":"","sources":["../../src/components/supplier-payment-dialog.tsx"],"names":[],"mappings":"AAsDA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,YAAY,EACZ,SAAS,GACV,EAAE,0BAA0B,2CA0O5B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BookingCombobox } from "@voyant-travel/bookings-react/ui";
|
|
3
|
+
import { SupplierCombobox } from "@voyant-travel/distribution-react/suppliers/ui";
|
|
4
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
6
|
+
import { CurrencyInput } from "@voyant-travel/ui/components/currency-input";
|
|
7
|
+
import { DatePicker } from "@voyant-travel/ui/components/date-picker";
|
|
8
|
+
import { zodResolver } from "@voyant-travel/ui/lib/zod-resolver";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
import { useForm } from "react-hook-form";
|
|
12
|
+
import { z } from "zod/v4";
|
|
13
|
+
import { useFinanceUiMessagesOrDefault } from "../i18n/index.js";
|
|
14
|
+
import { supplierPaymentMethods, supplierPaymentStatuses } from "../i18n/messages.js";
|
|
15
|
+
import { useSupplierPaymentMutation } from "../index.js";
|
|
16
|
+
function createSupplierPaymentFormSchema(messages) {
|
|
17
|
+
return z.object({
|
|
18
|
+
bookingId: z.string().min(1, messages.supplierPaymentDialog.validation.bookingIdRequired),
|
|
19
|
+
supplierId: z.string().optional().nullable(),
|
|
20
|
+
amountCents: z.coerce
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.min(1, messages.supplierPaymentDialog.validation.amountMinimum),
|
|
24
|
+
currency: z.string().min(3).max(3),
|
|
25
|
+
paymentMethod: z.enum(supplierPaymentMethods),
|
|
26
|
+
status: z.enum(supplierPaymentStatuses),
|
|
27
|
+
referenceNumber: z.string().optional().nullable(),
|
|
28
|
+
paymentDate: z.string().min(1, messages.supplierPaymentDialog.validation.paymentDateRequired),
|
|
29
|
+
notes: z.string().optional().nullable(),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function SupplierPaymentDialog({ open, onOpenChange, onSuccess, }) {
|
|
33
|
+
const { create } = useSupplierPaymentMutation();
|
|
34
|
+
const messages = useFinanceUiMessagesOrDefault();
|
|
35
|
+
const supplierPaymentFormSchema = createSupplierPaymentFormSchema(messages);
|
|
36
|
+
const form = useForm({
|
|
37
|
+
resolver: zodResolver(supplierPaymentFormSchema),
|
|
38
|
+
defaultValues: {
|
|
39
|
+
bookingId: "",
|
|
40
|
+
supplierId: "",
|
|
41
|
+
amountCents: 0,
|
|
42
|
+
currency: "EUR", // i18n-literal-ok domain default currency
|
|
43
|
+
paymentMethod: "bank_transfer",
|
|
44
|
+
status: "completed",
|
|
45
|
+
referenceNumber: "",
|
|
46
|
+
paymentDate: "",
|
|
47
|
+
notes: "",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (open) {
|
|
52
|
+
const today = new Date().toISOString().split("T")[0];
|
|
53
|
+
form.reset({
|
|
54
|
+
bookingId: "",
|
|
55
|
+
supplierId: "",
|
|
56
|
+
amountCents: 0,
|
|
57
|
+
currency: "EUR", // i18n-literal-ok domain default currency
|
|
58
|
+
paymentMethod: "bank_transfer",
|
|
59
|
+
status: "completed",
|
|
60
|
+
referenceNumber: "",
|
|
61
|
+
paymentDate: today,
|
|
62
|
+
notes: "",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [open, form]);
|
|
66
|
+
const onSubmit = async (values) => {
|
|
67
|
+
await create.mutateAsync({
|
|
68
|
+
bookingId: values.bookingId,
|
|
69
|
+
supplierId: values.supplierId || null,
|
|
70
|
+
amountCents: values.amountCents,
|
|
71
|
+
currency: values.currency,
|
|
72
|
+
paymentMethod: values.paymentMethod,
|
|
73
|
+
status: values.status,
|
|
74
|
+
referenceNumber: values.referenceNumber || null,
|
|
75
|
+
paymentDate: values.paymentDate,
|
|
76
|
+
notes: values.notes || null,
|
|
77
|
+
});
|
|
78
|
+
onOpenChange(false);
|
|
79
|
+
onSuccess?.();
|
|
80
|
+
};
|
|
81
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: messages.supplierPaymentDialog.title }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.bookingId }), _jsx(BookingCombobox, { value: form.watch("bookingId") || null, onChange: (next) => form.setValue("bookingId", next ?? "", {
|
|
82
|
+
shouldDirty: true,
|
|
83
|
+
shouldValidate: true,
|
|
84
|
+
}), placeholder: messages.supplierPaymentDialog.placeholders.bookingId }), form.formState.errors.bookingId ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.bookingId.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.supplierId }), _jsx(SupplierCombobox, { value: form.watch("supplierId") || null, onChange: (next) => form.setValue("supplierId", next ?? "", {
|
|
85
|
+
shouldDirty: true,
|
|
86
|
+
shouldValidate: true,
|
|
87
|
+
}), placeholder: messages.supplierPaymentDialog.placeholders.supplierId })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.amountCents }), _jsx(CurrencyInput, { value: form.watch("amountCents"), onChange: (next) => form.setValue("amountCents", next ?? 0, {
|
|
88
|
+
shouldDirty: true,
|
|
89
|
+
shouldValidate: true,
|
|
90
|
+
}), currency: form.watch("currency") }), form.formState.errors.amountCents ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.amountCents.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.currency }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR" /* i18n-literal-ok domain default currency */, {
|
|
91
|
+
shouldValidate: true,
|
|
92
|
+
shouldDirty: true,
|
|
93
|
+
}) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.paymentDate }), _jsx(DatePicker, { value: form.watch("paymentDate") || null, onChange: (next) => form.setValue("paymentDate", next ?? "", {
|
|
94
|
+
shouldValidate: true,
|
|
95
|
+
shouldDirty: true,
|
|
96
|
+
}), placeholder: messages.supplierPaymentDialog.placeholders.paymentDate, className: "w-full" }), form.formState.errors.paymentDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.paymentDate.message })) : null] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.paymentMethod }), _jsxs(Select, { items: supplierPaymentMethods.map((value) => ({
|
|
97
|
+
label: messages.common.supplierPaymentMethodLabels[value],
|
|
98
|
+
value,
|
|
99
|
+
})), value: form.watch("paymentMethod"), onValueChange: (value) => form.setValue("paymentMethod", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: supplierPaymentMethods.map((method) => (_jsx(SelectItem, { value: method, children: messages.common.supplierPaymentMethodLabels[method] }, method))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.status }), _jsxs(Select, { items: supplierPaymentStatuses.map((value) => ({
|
|
100
|
+
label: messages.common.supplierPaymentStatusLabels[value],
|
|
101
|
+
value,
|
|
102
|
+
})), value: form.watch("status"), onValueChange: (value) => form.setValue("status", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: supplierPaymentStatuses.map((status) => (_jsx(SelectItem, { value: status, children: messages.common.supplierPaymentStatusLabels[status] }, status))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.referenceNumber }), _jsx(Input, { ...form.register("referenceNumber"), placeholder: messages.supplierPaymentDialog.placeholders.referenceNumber })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.notes }), _jsx(Textarea, { ...form.register("notes"), placeholder: messages.supplierPaymentDialog.placeholders.notes })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: create.isPending, children: [create.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, messages.supplierPaymentDialog.actions.create] })] })] })] }) }));
|
|
103
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TaxPolicyProfileRecord } from "./shared.js";
|
|
2
|
+
export declare function PolicyProfileSheet({ open, onOpenChange, profile, onSuccess, }: {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
profile?: TaxPolicyProfileRecord;
|
|
6
|
+
onSuccess: () => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=policy-profile-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-profile-sheet.d.ts","sourceRoot":"","sources":["../../../src/components/taxes-page/policy-profile-sheet.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA0B,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGjF,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAgHA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4
|
+
import { Button, Input, Label, Sheet, SheetBody, SheetContent, SheetFooter, SheetHeader, SheetTitle, Switch, Textarea, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { Loader2 } from "lucide-react";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { useFinanceUiMessagesOrDefault } from "../../i18n/index.js";
|
|
8
|
+
import { initialPolicyProfileForm, toSlug, useTaxesPageApi } from "./shared.js";
|
|
9
|
+
export function PolicyProfileSheet({ open, onOpenChange, profile, onSuccess, }) {
|
|
10
|
+
const messages = useFinanceUiMessagesOrDefault();
|
|
11
|
+
const taxMessages = messages.taxesPage;
|
|
12
|
+
const api = useTaxesPageApi();
|
|
13
|
+
const [form, setForm] = useState(() => initialPolicyProfileForm(profile));
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const isEditing = !!profile;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setForm(initialPolicyProfileForm(profile));
|
|
18
|
+
setError(null);
|
|
19
|
+
}, [profile]);
|
|
20
|
+
const mutation = useMutation({
|
|
21
|
+
mutationFn: async () => {
|
|
22
|
+
if (!form.name.trim())
|
|
23
|
+
throw new Error(taxMessages.validationPolicyProfileNameRequired);
|
|
24
|
+
const input = {
|
|
25
|
+
name: form.name.trim(),
|
|
26
|
+
code: form.code.trim() || toSlug(form.name),
|
|
27
|
+
jurisdiction: form.jurisdiction.trim() || null,
|
|
28
|
+
description: form.description.trim() || null,
|
|
29
|
+
active: form.active,
|
|
30
|
+
};
|
|
31
|
+
if (profile) {
|
|
32
|
+
await api.patch(`/v1/admin/finance/tax-policy-profiles/${profile.id}`, input);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
await api.post("/v1/admin/finance/tax-policy-profiles", input);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onSuccess,
|
|
39
|
+
onError: (err) => setError(err instanceof Error ? err.message : taxMessages.savePolicyProfileFailed),
|
|
40
|
+
});
|
|
41
|
+
const setField = (key) => (value) => setForm((current) => ({ ...current, [key]: value }));
|
|
42
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", size: "lg", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: isEditing
|
|
43
|
+
? taxMessages.editPolicyProfileSheetTitle
|
|
44
|
+
: taxMessages.newPolicyProfileSheetTitle }) }), _jsx(SheetBody, { children: _jsxs("form", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: taxMessages.policyProfileNameLabel }), _jsx(Input, { value: form.name, onChange: (event) => {
|
|
45
|
+
const next = event.target.value;
|
|
46
|
+
setForm((current) => ({
|
|
47
|
+
...current,
|
|
48
|
+
name: next,
|
|
49
|
+
code: current.code || toSlug(next),
|
|
50
|
+
}));
|
|
51
|
+
}, placeholder: taxMessages.policyProfileNamePlaceholder })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: taxMessages.policyProfileCodeLabel }), _jsx(Input, { value: form.code, onChange: (event) => setField("code")(event.target.value), placeholder: taxMessages.policyProfileCodePlaceholder })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: taxMessages.jurisdictionLabel }), _jsx(Input, { value: form.jurisdiction, onChange: (event) => setField("jurisdiction")(event.target.value.toUpperCase()), placeholder: "RO" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: taxMessages.policyProfileDescriptionLabel }), _jsx(Textarea, { value: form.description, onChange: (event) => setField("description")(event.target.value), placeholder: taxMessages.policyProfileDescriptionPlaceholder })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: form.active, onCheckedChange: setField("active") }), _jsx(Label, { children: taxMessages.activeLabel })] }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null] }) }), _jsxs(SheetFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: taxMessages.cancel }), _jsxs(Button, { onClick: () => mutation.mutate(), disabled: mutation.isPending, children: [mutation.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, isEditing ? taxMessages.saveChanges : taxMessages.createPolicyProfile] })] })] }) }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TaxPolicyRuleRecord, TaxRegimeRecord } from "./shared.js";
|
|
2
|
+
export declare function PolicyRuleSheet({ open, onOpenChange, rule, profileId, taxRegimes, onSuccess, }: {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
rule?: TaxPolicyRuleRecord;
|
|
6
|
+
profileId: string;
|
|
7
|
+
taxRegimes: TaxRegimeRecord[];
|
|
8
|
+
onSuccess: () => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=policy-rule-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-rule-sheet.d.ts","sourceRoot":"","sources":["../../../src/components/taxes-page/policy-rule-sheet.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAMV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,aAAa,CAAA;AAapB,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,GACV,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAwYA"}
|