@hub-kit/core 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/README.md +125 -0
- package/cli/hub-kit.mjs +112 -0
- package/dist/adapters/bank-reconciliation.d.ts +100 -0
- package/dist/adapters/bank-reconciliation.js +1 -0
- package/dist/adapters/bank-sync-log.d.ts +46 -0
- package/dist/adapters/bank-sync-log.js +1 -0
- package/dist/adapters/category-rules.d.ts +94 -0
- package/dist/adapters/category-rules.js +1 -0
- package/dist/adapters/companies.d.ts +85 -0
- package/dist/adapters/companies.js +3 -0
- package/dist/adapters/customers.d.ts +71 -0
- package/dist/adapters/customers.js +1 -0
- package/dist/adapters/exclusion-rules.d.ts +34 -0
- package/dist/adapters/exclusion-rules.js +15 -0
- package/dist/adapters/file-naming.d.ts +36 -0
- package/dist/adapters/file-naming.js +1 -0
- package/dist/adapters/index.d.ts +24 -0
- package/dist/adapters/index.js +1 -0
- package/dist/adapters/invoice-detail.d.ts +126 -0
- package/dist/adapters/invoice-detail.js +1 -0
- package/dist/adapters/invoice-list.d.ts +63 -0
- package/dist/adapters/invoice-list.js +1 -0
- package/dist/adapters/invoice-upload.d.ts +26 -0
- package/dist/adapters/invoice-upload.js +1 -0
- package/dist/adapters/manual-bookings.d.ts +56 -0
- package/dist/adapters/manual-bookings.js +1 -0
- package/dist/adapters/notifications.d.ts +31 -0
- package/dist/adapters/notifications.js +1 -0
- package/dist/adapters/open-items.d.ts +42 -0
- package/dist/adapters/open-items.js +1 -0
- package/dist/adapters/opos-whitelist.d.ts +38 -0
- package/dist/adapters/opos-whitelist.js +1 -0
- package/dist/adapters/outgoing-invoices.d.ts +32 -0
- package/dist/adapters/outgoing-invoices.js +1 -0
- package/dist/adapters/overview.d.ts +68 -0
- package/dist/adapters/overview.js +1 -0
- package/dist/adapters/processing-log.d.ts +48 -0
- package/dist/adapters/processing-log.js +1 -0
- package/dist/adapters/properties.d.ts +87 -0
- package/dist/adapters/properties.js +1 -0
- package/dist/adapters/supplier-detail.d.ts +64 -0
- package/dist/adapters/supplier-detail.js +1 -0
- package/dist/adapters/supplier-list.d.ts +21 -0
- package/dist/adapters/supplier-list.js +1 -0
- package/dist/adapters/team.d.ts +79 -0
- package/dist/adapters/team.js +1 -0
- package/dist/adapters/trash.d.ts +26 -0
- package/dist/adapters/trash.js +1 -0
- package/dist/adapters/vat-rules.d.ts +83 -0
- package/dist/adapters/vat-rules.js +1 -0
- package/dist/components/access/index.d.ts +3 -0
- package/dist/components/access/index.js +3 -0
- package/dist/components/access/permission-checklist.d.ts +13 -0
- package/dist/components/access/permission-checklist.js +19 -0
- package/dist/components/access/permission-matrix.d.ts +12 -0
- package/dist/components/access/permission-matrix.js +18 -0
- package/dist/components/access/types.d.ts +15 -0
- package/dist/components/access/types.js +1 -0
- package/dist/components/dashboard/date-range-calendar.d.ts +19 -0
- package/dist/components/dashboard/date-range-calendar.js +97 -0
- package/dist/components/dashboard/index.d.ts +23 -0
- package/dist/components/dashboard/index.js +14 -0
- package/dist/components/dashboard/kpi-card.d.ts +13 -0
- package/dist/components/dashboard/kpi-card.js +7 -0
- package/dist/components/dashboard/money-cards-row.d.ts +29 -0
- package/dist/components/dashboard/money-cards-row.js +28 -0
- package/dist/components/dashboard/money-trend-chart.d.ts +13 -0
- package/dist/components/dashboard/money-trend-chart.js +16 -0
- package/dist/components/dashboard/panel.d.ts +9 -0
- package/dist/components/dashboard/panel.js +5 -0
- package/dist/components/dashboard/period-picker.d.ts +25 -0
- package/dist/components/dashboard/period-picker.js +82 -0
- package/dist/components/dashboard/periods.d.ts +13 -0
- package/dist/components/dashboard/periods.js +63 -0
- package/dist/components/dashboard/pipeline-stages-panel.d.ts +14 -0
- package/dist/components/dashboard/pipeline-stages-panel.js +12 -0
- package/dist/components/dashboard/processing-summary-panel.d.ts +34 -0
- package/dist/components/dashboard/processing-summary-panel.js +11 -0
- package/dist/components/dashboard/ranked-bars.d.ts +15 -0
- package/dist/components/dashboard/ranked-bars.js +16 -0
- package/dist/components/dashboard/ranked-list-panel.d.ts +14 -0
- package/dist/components/dashboard/ranked-list-panel.js +9 -0
- package/dist/components/dashboard/stage-tiles.d.ts +15 -0
- package/dist/components/dashboard/stage-tiles.js +6 -0
- package/dist/components/dashboard/stat-rows-panel.d.ts +25 -0
- package/dist/components/dashboard/stat-rows-panel.js +7 -0
- package/dist/components/dashboard/stat-tile.d.ts +20 -0
- package/dist/components/dashboard/stat-tile.js +9 -0
- package/dist/components/feedback/index.d.ts +4 -0
- package/dist/components/feedback/index.js +2 -0
- package/dist/components/feedback/query-states.d.ts +27 -0
- package/dist/components/feedback/query-states.js +38 -0
- package/dist/components/feedback/table-pagination.d.ts +20 -0
- package/dist/components/feedback/table-pagination.js +15 -0
- package/dist/components/invoice-queue/index.d.ts +5 -0
- package/dist/components/invoice-queue/index.js +3 -0
- package/dist/components/invoice-queue/next-action-cell.d.ts +5 -0
- package/dist/components/invoice-queue/next-action-cell.js +9 -0
- package/dist/components/invoice-queue/queue-kpi-card.d.ts +19 -0
- package/dist/components/invoice-queue/queue-kpi-card.js +31 -0
- package/dist/components/invoice-queue/queue-kpi-row.d.ts +22 -0
- package/dist/components/invoice-queue/queue-kpi-row.js +12 -0
- package/dist/components/notifications/alerts.d.ts +25 -0
- package/dist/components/notifications/alerts.js +66 -0
- package/dist/components/notifications/bell.d.ts +14 -0
- package/dist/components/notifications/bell.js +17 -0
- package/dist/components/notifications/highlight.d.ts +4 -0
- package/dist/components/notifications/highlight.js +7 -0
- package/dist/components/notifications/index.d.ts +7 -0
- package/dist/components/notifications/index.js +6 -0
- package/dist/components/notifications/reminder-dialog.d.ts +24 -0
- package/dist/components/notifications/reminder-dialog.js +54 -0
- package/dist/components/notifications/types.d.ts +27 -0
- package/dist/components/notifications/types.js +1 -0
- package/dist/components/notifications/use-notification-acks.d.ts +7 -0
- package/dist/components/notifications/use-notification-acks.js +37 -0
- package/dist/components/shell/breadcrumbs.d.ts +7 -0
- package/dist/components/shell/breadcrumbs.js +38 -0
- package/dist/components/shell/index.d.ts +3 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/components/shell/shell.d.ts +30 -0
- package/dist/components/shell/shell.js +110 -0
- package/dist/components/shell/types.d.ts +23 -0
- package/dist/components/shell/types.js +3 -0
- package/dist/components/tour/find-target.d.ts +1 -0
- package/dist/components/tour/find-target.js +3 -0
- package/dist/components/tour/index.d.ts +14 -0
- package/dist/components/tour/index.js +8 -0
- package/dist/components/tour/labels.d.ts +10 -0
- package/dist/components/tour/labels.js +9 -0
- package/dist/components/tour/seen-store.d.ts +3 -0
- package/dist/components/tour/seen-store.js +34 -0
- package/dist/components/tour/tour-blocks.d.ts +4 -0
- package/dist/components/tour/tour-blocks.js +27 -0
- package/dist/components/tour/tour-button.d.ts +4 -0
- package/dist/components/tour/tour-button.js +12 -0
- package/dist/components/tour/tour-card.d.ts +11 -0
- package/dist/components/tour/tour-card.js +7 -0
- package/dist/components/tour/tour-context.d.ts +16 -0
- package/dist/components/tour/tour-context.js +2 -0
- package/dist/components/tour/tour-overlay.d.ts +1 -0
- package/dist/components/tour/tour-overlay.js +165 -0
- package/dist/components/tour/tour-provider.d.ts +9 -0
- package/dist/components/tour/tour-provider.js +80 -0
- package/dist/components/tour/types.d.ts +44 -0
- package/dist/components/tour/types.js +1 -0
- package/dist/components/tour/use-tour.d.ts +3 -0
- package/dist/components/tour/use-tour.js +9 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/i18n/index.d.ts +15 -0
- package/dist/i18n/index.js +15 -0
- package/dist/lib/bank-import/classify.d.ts +8 -0
- package/dist/lib/bank-import/classify.js +89 -0
- package/dist/lib/bank-import/column-guess.d.ts +2 -0
- package/dist/lib/bank-import/column-guess.js +40 -0
- package/dist/lib/bank-import/csv.d.ts +3 -0
- package/dist/lib/bank-import/csv.js +20 -0
- package/dist/lib/bank-import/duplicates.d.ts +2 -0
- package/dist/lib/bank-import/duplicates.js +21 -0
- package/dist/lib/bank-import/index.d.ts +12 -0
- package/dist/lib/bank-import/index.js +9 -0
- package/dist/lib/bank-import/mapping-storage.d.ts +3 -0
- package/dist/lib/bank-import/mapping-storage.js +29 -0
- package/dist/lib/bank-import/normalize.d.ts +4 -0
- package/dist/lib/bank-import/normalize.js +82 -0
- package/dist/lib/bank-import/parse-file.d.ts +7 -0
- package/dist/lib/bank-import/parse-file.js +23 -0
- package/dist/lib/bank-import/types.d.ts +31 -0
- package/dist/lib/bank-import/types.js +1 -0
- package/dist/lib/bank-import/xlsx.d.ts +2 -0
- package/dist/lib/bank-import/xlsx.js +25 -0
- package/dist/lib/class-names.d.ts +2 -0
- package/dist/lib/class-names.js +5 -0
- package/dist/lib/download.d.ts +2 -0
- package/dist/lib/download.js +14 -0
- package/dist/lib/formatters.d.ts +6 -0
- package/dist/lib/formatters.js +24 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/opos-whitelist/index.d.ts +2 -0
- package/dist/lib/opos-whitelist/index.js +1 -0
- package/dist/lib/opos-whitelist/opos.d.ts +14 -0
- package/dist/lib/opos-whitelist/opos.js +49 -0
- package/dist/lib/query-result.d.ts +12 -0
- package/dist/lib/query-result.js +1 -0
- package/dist/lib/tour-placeholders/index.d.ts +2 -0
- package/dist/lib/tour-placeholders/index.js +1 -0
- package/dist/lib/tour-placeholders/overview.d.ts +12 -0
- package/dist/lib/tour-placeholders/overview.js +139 -0
- package/dist/pages/bank-accounts/BankAccountsPage.d.ts +7 -0
- package/dist/pages/bank-accounts/BankAccountsPage.js +21 -0
- package/dist/pages/bank-accounts/index.d.ts +4 -0
- package/dist/pages/bank-accounts/index.js +2 -0
- package/dist/pages/bank-accounts/labels.d.ts +15 -0
- package/dist/pages/bank-accounts/labels.js +14 -0
- package/dist/pages/bank-import/BankImportWizard.d.ts +9 -0
- package/dist/pages/bank-import/BankImportWizard.js +158 -0
- package/dist/pages/bank-import/index.d.ts +4 -0
- package/dist/pages/bank-import/index.js +2 -0
- package/dist/pages/bank-import/labels.d.ts +44 -0
- package/dist/pages/bank-import/labels.js +43 -0
- package/dist/pages/bank-sync-log/BankSyncLogPage.d.ts +7 -0
- package/dist/pages/bank-sync-log/BankSyncLogPage.js +77 -0
- package/dist/pages/bank-sync-log/index.d.ts +4 -0
- package/dist/pages/bank-sync-log/index.js +2 -0
- package/dist/pages/bank-sync-log/labels.d.ts +21 -0
- package/dist/pages/bank-sync-log/labels.js +20 -0
- package/dist/pages/bank-transactions/BankMatchPanel.d.ts +8 -0
- package/dist/pages/bank-transactions/BankMatchPanel.js +75 -0
- package/dist/pages/bank-transactions/BankTransactionsPage.d.ts +7 -0
- package/dist/pages/bank-transactions/BankTransactionsPage.js +59 -0
- package/dist/pages/bank-transactions/badges.d.ts +8 -0
- package/dist/pages/bank-transactions/badges.js +24 -0
- package/dist/pages/bank-transactions/index.d.ts +6 -0
- package/dist/pages/bank-transactions/index.js +4 -0
- package/dist/pages/bank-transactions/labels.d.ts +41 -0
- package/dist/pages/bank-transactions/labels.js +40 -0
- package/dist/pages/bank-transactions/sort-control.d.ts +17 -0
- package/dist/pages/bank-transactions/sort-control.js +8 -0
- package/dist/pages/bank-transactions/use-table-view.d.ts +23 -0
- package/dist/pages/bank-transactions/use-table-view.js +54 -0
- package/dist/pages/category-rules/CategoryRulesPage.d.ts +7 -0
- package/dist/pages/category-rules/CategoryRulesPage.js +160 -0
- package/dist/pages/category-rules/index.d.ts +4 -0
- package/dist/pages/category-rules/index.js +2 -0
- package/dist/pages/category-rules/labels.d.ts +66 -0
- package/dist/pages/category-rules/labels.js +72 -0
- package/dist/pages/companies/company-detail-page.d.ts +10 -0
- package/dist/pages/companies/company-detail-page.js +184 -0
- package/dist/pages/companies/company-form.d.ts +20 -0
- package/dist/pages/companies/company-form.js +23 -0
- package/dist/pages/companies/company-list-page.d.ts +9 -0
- package/dist/pages/companies/company-list-page.js +109 -0
- package/dist/pages/companies/known-spellings-card.d.ts +8 -0
- package/dist/pages/companies/known-spellings-card.js +65 -0
- package/dist/pages/companies/labels.d.ts +105 -0
- package/dist/pages/companies/labels.js +104 -0
- package/dist/pages/companies/sort-control.d.ts +17 -0
- package/dist/pages/companies/sort-control.js +8 -0
- package/dist/pages/companies/use-infinite-rows.d.ts +6 -0
- package/dist/pages/companies/use-infinite-rows.js +24 -0
- package/dist/pages/companies/use-table-view.d.ts +23 -0
- package/dist/pages/companies/use-table-view.js +56 -0
- package/dist/pages/customers/company-chip.d.ts +6 -0
- package/dist/pages/customers/company-chip.js +9 -0
- package/dist/pages/customers/copy-button.d.ts +6 -0
- package/dist/pages/customers/copy-button.js +31 -0
- package/dist/pages/customers/customer-detail-page.d.ts +10 -0
- package/dist/pages/customers/customer-detail-page.js +83 -0
- package/dist/pages/customers/customer-list-page.d.ts +9 -0
- package/dist/pages/customers/customer-list-page.js +65 -0
- package/dist/pages/customers/edit-customer-dialog.d.ts +9 -0
- package/dist/pages/customers/edit-customer-dialog.js +72 -0
- package/dist/pages/customers/form-hints.d.ts +6 -0
- package/dist/pages/customers/form-hints.js +9 -0
- package/dist/pages/customers/invoice-status-badge.d.ts +10 -0
- package/dist/pages/customers/invoice-status-badge.js +22 -0
- package/dist/pages/customers/labels.d.ts +116 -0
- package/dist/pages/customers/labels.js +117 -0
- package/dist/pages/customers/new-customer-dialog.d.ts +6 -0
- package/dist/pages/customers/new-customer-dialog.js +93 -0
- package/dist/pages/customers/sort-control.d.ts +14 -0
- package/dist/pages/customers/sort-control.js +9 -0
- package/dist/pages/customers/use-table-view.d.ts +23 -0
- package/dist/pages/customers/use-table-view.js +56 -0
- package/dist/pages/exclusion-rules/exclusion-rules-page.d.ts +7 -0
- package/dist/pages/exclusion-rules/exclusion-rules-page.js +114 -0
- package/dist/pages/exclusion-rules/labels.d.ts +53 -0
- package/dist/pages/exclusion-rules/labels.js +61 -0
- package/dist/pages/file-naming/build-filename.d.ts +3 -0
- package/dist/pages/file-naming/build-filename.js +82 -0
- package/dist/pages/file-naming/file-naming-page.d.ts +10 -0
- package/dist/pages/file-naming/file-naming-page.js +120 -0
- package/dist/pages/file-naming/labels.d.ts +44 -0
- package/dist/pages/file-naming/labels.js +44 -0
- package/dist/pages/index.d.ts +63 -0
- package/dist/pages/index.js +48 -0
- package/dist/pages/invoice-detail/InvoiceDetailPage.d.ts +11 -0
- package/dist/pages/invoice-detail/InvoiceDetailPage.js +292 -0
- package/dist/pages/invoice-detail/OutgoingInvoiceFlag.d.ts +26 -0
- package/dist/pages/invoice-detail/OutgoingInvoiceFlag.js +16 -0
- package/dist/pages/invoice-detail/ReviewBadge.d.ts +15 -0
- package/dist/pages/invoice-detail/ReviewBadge.js +23 -0
- package/dist/pages/invoice-detail/ReviewCard.d.ts +17 -0
- package/dist/pages/invoice-detail/ReviewCard.js +12 -0
- package/dist/pages/invoice-detail/SideBySide.d.ts +5 -0
- package/dist/pages/invoice-detail/SideBySide.js +5 -0
- package/dist/pages/invoice-detail/WorkflowHistoryList.d.ts +23 -0
- package/dist/pages/invoice-detail/WorkflowHistoryList.js +32 -0
- package/dist/pages/invoice-detail/WorkflowLadder.d.ts +20 -0
- package/dist/pages/invoice-detail/WorkflowLadder.js +16 -0
- package/dist/pages/invoice-detail/history.d.ts +23 -0
- package/dist/pages/invoice-detail/history.js +76 -0
- package/dist/pages/invoice-detail/index.d.ts +21 -0
- package/dist/pages/invoice-detail/index.js +11 -0
- package/dist/pages/invoice-detail/labels.d.ts +79 -0
- package/dist/pages/invoice-detail/labels.js +139 -0
- package/dist/pages/invoice-detail/pipeline-types.d.ts +58 -0
- package/dist/pages/invoice-detail/pipeline-types.js +1 -0
- package/dist/pages/invoice-detail/review-recheck.d.ts +8 -0
- package/dist/pages/invoice-detail/review-recheck.js +103 -0
- package/dist/pages/invoice-detail/review.d.ts +91 -0
- package/dist/pages/invoice-detail/review.js +310 -0
- package/dist/pages/invoice-list/badges.d.ts +23 -0
- package/dist/pages/invoice-list/badges.js +26 -0
- package/dist/pages/invoice-list/index.d.ts +5 -0
- package/dist/pages/invoice-list/index.js +3 -0
- package/dist/pages/invoice-list/invoice-list-page.d.ts +13 -0
- package/dist/pages/invoice-list/invoice-list-page.js +114 -0
- package/dist/pages/invoice-list/labels.d.ts +36 -0
- package/dist/pages/invoice-list/labels.js +29 -0
- package/dist/pages/invoice-list/sort-control.d.ts +17 -0
- package/dist/pages/invoice-list/sort-control.js +8 -0
- package/dist/pages/invoice-list/use-table-view.d.ts +23 -0
- package/dist/pages/invoice-list/use-table-view.js +54 -0
- package/dist/pages/invoice-upload/InvoiceUploadPage.d.ts +7 -0
- package/dist/pages/invoice-upload/InvoiceUploadPage.js +115 -0
- package/dist/pages/invoice-upload/index.d.ts +4 -0
- package/dist/pages/invoice-upload/index.js +2 -0
- package/dist/pages/invoice-upload/labels.d.ts +29 -0
- package/dist/pages/invoice-upload/labels.js +28 -0
- package/dist/pages/manual-bookings/ManualBookingsPage.d.ts +7 -0
- package/dist/pages/manual-bookings/ManualBookingsPage.js +161 -0
- package/dist/pages/manual-bookings/index.d.ts +4 -0
- package/dist/pages/manual-bookings/index.js +2 -0
- package/dist/pages/manual-bookings/labels.d.ts +53 -0
- package/dist/pages/manual-bookings/labels.js +52 -0
- package/dist/pages/notifications/labels.d.ts +22 -0
- package/dist/pages/notifications/labels.js +21 -0
- package/dist/pages/notifications/notifications-page.d.ts +14 -0
- package/dist/pages/notifications/notifications-page.js +81 -0
- package/dist/pages/open-items/OpenItemsPage.d.ts +11 -0
- package/dist/pages/open-items/OpenItemsPage.js +110 -0
- package/dist/pages/open-items/index.d.ts +6 -0
- package/dist/pages/open-items/index.js +3 -0
- package/dist/pages/open-items/labels.d.ts +37 -0
- package/dist/pages/open-items/labels.js +36 -0
- package/dist/pages/open-items/urgency.d.ts +8 -0
- package/dist/pages/open-items/urgency.js +27 -0
- package/dist/pages/opos-whitelist/OposWhitelistPage.d.ts +7 -0
- package/dist/pages/opos-whitelist/OposWhitelistPage.js +165 -0
- package/dist/pages/opos-whitelist/index.d.ts +4 -0
- package/dist/pages/opos-whitelist/index.js +2 -0
- package/dist/pages/opos-whitelist/labels.d.ts +56 -0
- package/dist/pages/opos-whitelist/labels.js +70 -0
- package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.d.ts +7 -0
- package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.js +169 -0
- package/dist/pages/outgoing-invoices/index.d.ts +4 -0
- package/dist/pages/outgoing-invoices/index.js +2 -0
- package/dist/pages/outgoing-invoices/labels.d.ts +43 -0
- package/dist/pages/outgoing-invoices/labels.js +42 -0
- package/dist/pages/outgoing-invoices/sort-control.d.ts +17 -0
- package/dist/pages/outgoing-invoices/sort-control.js +8 -0
- package/dist/pages/outgoing-invoices/use-table-view.d.ts +23 -0
- package/dist/pages/outgoing-invoices/use-table-view.js +54 -0
- package/dist/pages/overview/labels.d.ts +35 -0
- package/dist/pages/overview/labels.js +34 -0
- package/dist/pages/overview/overview-page.d.ts +22 -0
- package/dist/pages/overview/overview-page.js +127 -0
- package/dist/pages/processing-log/labels.d.ts +54 -0
- package/dist/pages/processing-log/labels.js +53 -0
- package/dist/pages/processing-log/mail-parsing.d.ts +21 -0
- package/dist/pages/processing-log/mail-parsing.js +52 -0
- package/dist/pages/processing-log/processing-log-page.d.ts +9 -0
- package/dist/pages/processing-log/processing-log-page.js +206 -0
- package/dist/pages/properties/badges.d.ts +20 -0
- package/dist/pages/properties/badges.js +45 -0
- package/dist/pages/properties/company-assignment-field.d.ts +11 -0
- package/dist/pages/properties/company-assignment-field.js +13 -0
- package/dist/pages/properties/form-field.d.ts +6 -0
- package/dist/pages/properties/form-field.js +9 -0
- package/dist/pages/properties/labels.d.ts +124 -0
- package/dist/pages/properties/labels.js +128 -0
- package/dist/pages/properties/name-variants-card.d.ts +7 -0
- package/dist/pages/properties/name-variants-card.js +60 -0
- package/dist/pages/properties/property-detail-page.d.ts +10 -0
- package/dist/pages/properties/property-detail-page.js +150 -0
- package/dist/pages/properties/property-list-page.d.ts +13 -0
- package/dist/pages/properties/property-list-page.js +201 -0
- package/dist/pages/properties/sort-control.d.ts +14 -0
- package/dist/pages/properties/sort-control.js +9 -0
- package/dist/pages/properties/use-infinite-rows.d.ts +6 -0
- package/dist/pages/properties/use-infinite-rows.js +26 -0
- package/dist/pages/properties/use-table-view.d.ts +23 -0
- package/dist/pages/properties/use-table-view.js +56 -0
- package/dist/pages/supplier-detail/SupplierDetailPage.d.ts +10 -0
- package/dist/pages/supplier-detail/SupplierDetailPage.js +157 -0
- package/dist/pages/supplier-detail/index.d.ts +4 -0
- package/dist/pages/supplier-detail/index.js +2 -0
- package/dist/pages/supplier-detail/labels.d.ts +46 -0
- package/dist/pages/supplier-detail/labels.js +45 -0
- package/dist/pages/supplier-list/SupplierListPage.d.ts +9 -0
- package/dist/pages/supplier-list/SupplierListPage.js +102 -0
- package/dist/pages/supplier-list/index.d.ts +4 -0
- package/dist/pages/supplier-list/index.js +2 -0
- package/dist/pages/supplier-list/labels.d.ts +33 -0
- package/dist/pages/supplier-list/labels.js +32 -0
- package/dist/pages/supplier-list/sort-control.d.ts +17 -0
- package/dist/pages/supplier-list/sort-control.js +8 -0
- package/dist/pages/supplier-list/use-table-view.d.ts +23 -0
- package/dist/pages/supplier-list/use-table-view.js +54 -0
- package/dist/pages/team/account-dialogs.d.ts +12 -0
- package/dist/pages/team/account-dialogs.js +49 -0
- package/dist/pages/team/employee-editor.d.ts +19 -0
- package/dist/pages/team/employee-editor.js +124 -0
- package/dist/pages/team/labels.d.ts +99 -0
- package/dist/pages/team/labels.js +98 -0
- package/dist/pages/team/new-employee.d.ts +8 -0
- package/dist/pages/team/new-employee.js +103 -0
- package/dist/pages/team/roles-tab.d.ts +6 -0
- package/dist/pages/team/roles-tab.js +46 -0
- package/dist/pages/team/team-page.d.ts +7 -0
- package/dist/pages/team/team-page.js +81 -0
- package/dist/pages/team/temp-password-dialog.d.ts +11 -0
- package/dist/pages/team/temp-password-dialog.js +23 -0
- package/dist/pages/trash/labels.d.ts +68 -0
- package/dist/pages/trash/labels.js +69 -0
- package/dist/pages/trash/trash-page.d.ts +9 -0
- package/dist/pages/trash/trash-page.js +259 -0
- package/dist/pages/vat-rules/labels.d.ts +110 -0
- package/dist/pages/vat-rules/labels.js +109 -0
- package/dist/pages/vat-rules/new-rule-dialog.d.ts +7 -0
- package/dist/pages/vat-rules/new-rule-dialog.js +134 -0
- package/dist/pages/vat-rules/rule-row.d.ts +20 -0
- package/dist/pages/vat-rules/rule-row.js +120 -0
- package/dist/pages/vat-rules/vat-rules-page.d.ts +9 -0
- package/dist/pages/vat-rules/vat-rules-page.js +61 -0
- package/dist/ui/alert-dialog.d.ts +20 -0
- package/dist/ui/alert-dialog.js +41 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/badge.js +20 -0
- package/dist/ui/breadcrumb.d.ts +19 -0
- package/dist/ui/breadcrumb.js +23 -0
- package/dist/ui/button.d.ts +11 -0
- package/dist/ui/button.js +33 -0
- package/dist/ui/calendar.d.ts +8 -0
- package/dist/ui/calendar.js +75 -0
- package/dist/ui/card.d.ts +8 -0
- package/dist/ui/card.js +16 -0
- package/dist/ui/chart.d.ts +62 -0
- package/dist/ui/chart.js +118 -0
- package/dist/ui/checkbox.d.ts +4 -0
- package/dist/ui/checkbox.js +11 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/collapsible.js +5 -0
- package/dist/ui/combobox.d.ts +24 -0
- package/dist/ui/combobox.js +55 -0
- package/dist/ui/command.d.ts +80 -0
- package/dist/ui/command.js +29 -0
- package/dist/ui/dialog.d.ts +19 -0
- package/dist/ui/dialog.js +58 -0
- package/dist/ui/dropdown-menu.d.ts +27 -0
- package/dist/ui/dropdown-menu.js +33 -0
- package/dist/ui/field-context.d.ts +4 -0
- package/dist/ui/field-context.js +6 -0
- package/dist/ui/field.d.ts +3 -0
- package/dist/ui/field.js +8 -0
- package/dist/ui/icon-action.d.ts +3 -0
- package/dist/ui/icon-action.js +8 -0
- package/dist/ui/index.d.ts +32 -0
- package/dist/ui/index.js +32 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +11 -0
- package/dist/ui/label.d.ts +5 -0
- package/dist/ui/label.js +15 -0
- package/dist/ui/multi-combobox.d.ts +18 -0
- package/dist/ui/multi-combobox.js +40 -0
- package/dist/ui/popover.d.ts +9 -0
- package/dist/ui/popover.js +12 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/scroll-area.js +9 -0
- package/dist/ui/scroll-shadow.d.ts +8 -0
- package/dist/ui/scroll-shadow.js +57 -0
- package/dist/ui/select.d.ts +13 -0
- package/dist/ui/select.js +31 -0
- package/dist/ui/separator.d.ts +4 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/sheet.d.ts +25 -0
- package/dist/ui/sheet.js +40 -0
- package/dist/ui/sidebar.d.ts +65 -0
- package/dist/ui/sidebar.js +207 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/sonner.d.ts +5 -0
- package/dist/ui/sonner.js +13 -0
- package/dist/ui/switch.d.ts +4 -0
- package/dist/ui/switch.js +7 -0
- package/dist/ui/table.d.ts +12 -0
- package/dist/ui/table.js +24 -0
- package/dist/ui/tabs.d.ts +7 -0
- package/dist/ui/tabs.js +12 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +11 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +11 -0
- package/package.json +80 -0
- package/themes/TOKENS.md +57 -0
- package/themes/default.css +60 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { ArrowDown, ArrowUp, Pencil, Plus, Trash2 } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { Button } from "../../ui/button.js";
|
|
6
|
+
import { Input } from "../../ui/input.js";
|
|
7
|
+
import { Label } from "../../ui/label.js";
|
|
8
|
+
import { Textarea } from "../../ui/textarea.js";
|
|
9
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
10
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../ui/tabs.js";
|
|
11
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from "../../ui/dialog.js";
|
|
12
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../ui/alert-dialog.js";
|
|
13
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table.js";
|
|
14
|
+
import { ErrorState, TableSkeleton, readableErrorMessage } from "../../components/feedback/query-states.js";
|
|
15
|
+
import { cn } from "../../lib/class-names.js";
|
|
16
|
+
import { englishCategoryRulesLabels } from "./labels.js";
|
|
17
|
+
const NONE = "__none";
|
|
18
|
+
const BWA_BLOCKS = ["revenue", "cost_of_goods", "costs", "neutral", "taxes", "special_case"];
|
|
19
|
+
export function CategoryRulesPage({ adapter, labels = englishCategoryRulesLabels }) {
|
|
20
|
+
const [tab, setTab] = useState("categories");
|
|
21
|
+
return (_jsxs("div", { children: [_jsx("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: labels.title }), _jsx("p", { className: "mt-1 max-w-2xl text-sm text-muted-foreground", children: labels.subtitle }), _jsxs(Tabs, { value: tab, onValueChange: setTab, className: "mt-6", children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "categories", children: labels.tabCategories }), _jsx(TabsTrigger, { value: "rules", children: labels.tabRules })] }), _jsx(TabsContent, { value: "categories", className: "mt-4", children: _jsx(CategoriesTab, { adapter: adapter, labels: labels }) }), _jsx(TabsContent, { value: "rules", className: "mt-4", children: _jsx(RulesTab, { adapter: adapter, labels: labels }) })] })] }));
|
|
22
|
+
}
|
|
23
|
+
function CategoriesTab({ adapter, labels }) {
|
|
24
|
+
const categoriesQuery = adapter.useCategories();
|
|
25
|
+
const [dialogState, setDialogState] = useState(null);
|
|
26
|
+
const sorted = useMemo(() => [...categoriesQuery.data].sort((a, b) => a.sortOrder - b.sortOrder), [categoriesQuery.data]);
|
|
27
|
+
const byId = useMemo(() => new Map(sorted.map((c) => [c.id, c])), [sorted]);
|
|
28
|
+
async function archive(category) {
|
|
29
|
+
try {
|
|
30
|
+
await adapter.archiveCategory(category.id);
|
|
31
|
+
toast.success(labels.archivedToast);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
toast.error(readableErrorMessage(error, ""));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function move(category, direction) {
|
|
38
|
+
try {
|
|
39
|
+
await adapter.moveCategory(category.id, direction);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
toast.error(readableErrorMessage(error, ""));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return (_jsxs("div", { children: [_jsx("div", { className: "flex justify-end", children: _jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setDialogState("new"), children: [_jsx(Plus, { className: "size-4" }), " ", labels.newCategoryButton] }) }), categoriesQuery.error ? (_jsx("div", { className: "mt-4", children: _jsx(ErrorState, { error: categoriesQuery.error, onRetry: () => { } }) })) : categoriesQuery.loading ? (_jsx("div", { className: "mt-4", children: _jsx(TableSkeleton, { rows: 8, columns: 5 }) })) : (_jsx("div", { className: "mt-4 overflow-hidden overflow-x-auto rounded-xl border border-border bg-card", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { className: "bg-muted/40", children: [_jsx(TableHead, { children: labels.columnCode }), _jsx(TableHead, { children: labels.columnName }), _jsx(TableHead, { children: labels.columnBlock }), _jsx(TableHead, { children: labels.columnDirection }), _jsx(TableHead, { className: "w-[140px]" })] }) }), _jsxs(TableBody, { children: [sorted.map((category) => {
|
|
46
|
+
const parent = category.parentId ? byId.get(category.parentId) : null;
|
|
47
|
+
return (_jsxs(TableRow, { className: cn(!category.isActive && "opacity-60"), children: [_jsx(TableCell, { className: "font-mono text-sm text-muted-foreground", children: category.code }), _jsxs(TableCell, { className: "font-medium text-foreground", children: [parent && _jsxs("span", { className: "text-muted-foreground", children: [parent.name, " \u203A "] }), category.name, _jsxs("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [category.isCatchall && _jsx(Badge, { tone: "muted", children: labels.catchallBadge }), category.isExcludedFromPnl && _jsx(Badge, { tone: "muted", children: labels.excludedBadge }), !category.isActive && _jsx(Badge, { tone: "muted", children: labels.inactiveBadge })] })] }), _jsx(TableCell, { className: "text-sm text-muted-foreground", children: labels.block[category.bwaBlock] }), _jsx(TableCell, { className: "text-sm text-muted-foreground", children: category.direction === "incoming" ? labels.directionIncoming : labels.directionOutgoing }), _jsx(TableCell, { children: _jsxs("div", { className: "flex justify-end gap-1", children: [_jsx("button", { type: "button", title: labels.moveUp, className: "flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground", onClick: () => move(category, "up"), children: _jsx(ArrowUp, { className: "size-3.5" }) }), _jsx("button", { type: "button", title: labels.moveDown, className: "flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground", onClick: () => move(category, "down"), children: _jsx(ArrowDown, { className: "size-3.5" }) }), _jsx("button", { type: "button", title: labels.editButton, className: "flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground", onClick: () => setDialogState(category), children: _jsx(Pencil, { className: "size-3.5" }) }), _jsx("button", { type: "button", title: labels.archiveButton, className: "flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive", onClick: () => archive(category), children: _jsx(Trash2, { className: "size-3.5" }) })] }) })] }, category.id));
|
|
48
|
+
}), sorted.length === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-12 text-center text-muted-foreground", children: labels.emptyCategories }) }))] })] }) })), dialogState && (_jsx(CategoryDialog, { category: dialogState === "new" ? null : dialogState, categories: sorted, adapter: adapter, labels: labels, onClose: () => setDialogState(null) }))] }));
|
|
49
|
+
}
|
|
50
|
+
function Badge({ tone, children }) {
|
|
51
|
+
void tone;
|
|
52
|
+
return _jsx("span", { className: "inline-flex items-center rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground", children: children });
|
|
53
|
+
}
|
|
54
|
+
function CategoryDialog({ category, categories, adapter, labels, onClose, }) {
|
|
55
|
+
const [code, setCode] = useState(category?.code ?? "");
|
|
56
|
+
const [name, setName] = useState(category?.name ?? "");
|
|
57
|
+
const [parentId, setParentId] = useState(category?.parentId ?? NONE);
|
|
58
|
+
const [bwaBlock, setBwaBlock] = useState(category?.bwaBlock ?? "costs");
|
|
59
|
+
const [bwaLine, setBwaLine] = useState(category?.bwaLine ?? "");
|
|
60
|
+
const [direction, setDirection] = useState(category?.direction ?? "incoming");
|
|
61
|
+
const [note, setNote] = useState(category?.note ?? "");
|
|
62
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
63
|
+
async function save() {
|
|
64
|
+
if (!code.trim() || !name.trim() || !bwaLine.trim())
|
|
65
|
+
return;
|
|
66
|
+
const input = {
|
|
67
|
+
code: code.trim(),
|
|
68
|
+
name: name.trim(),
|
|
69
|
+
parentId: parentId === NONE ? null : parentId,
|
|
70
|
+
bwaBlock,
|
|
71
|
+
bwaLine: bwaLine.trim(),
|
|
72
|
+
direction,
|
|
73
|
+
note: note.trim() || null,
|
|
74
|
+
};
|
|
75
|
+
setIsSaving(true);
|
|
76
|
+
try {
|
|
77
|
+
if (category)
|
|
78
|
+
await adapter.updateCategory(category.id, input);
|
|
79
|
+
else
|
|
80
|
+
await adapter.createCategory(input);
|
|
81
|
+
toast.success(labels.savedToast);
|
|
82
|
+
onClose();
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
toast.error(labels.saveFailed(readableErrorMessage(e, "")));
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
setIsSaving(false);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: category ? labels.editCategoryTitle : labels.newCategoryTitle }) }), _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldCode }), _jsx(Input, { value: code, onChange: (event) => setCode(event.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldName }), _jsx(Input, { value: name, onChange: (event) => setName(event.target.value) })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldParent }), _jsx(Combobox, { value: parentId, onValueChange: setParentId, options: [{ value: NONE, label: labels.parentNone }, ...categories.filter((c) => c.id !== category?.id).map((c) => ({ value: c.id, label: c.name }))] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldBlock }), _jsx(Combobox, { value: bwaBlock, onValueChange: (v) => setBwaBlock(v), options: BWA_BLOCKS.map((b) => ({ value: b, label: labels.block[b] })) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldDirection }), _jsx(Combobox, { value: direction, onValueChange: (v) => setDirection(v), options: [
|
|
92
|
+
{ value: "incoming", label: labels.directionIncoming },
|
|
93
|
+
{ value: "outgoing", label: labels.directionOutgoing },
|
|
94
|
+
] })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldLine }), _jsx(Input, { value: bwaLine, onChange: (event) => setBwaLine(event.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldNote }), _jsx(Textarea, { value: note, onChange: (event) => setNote(event.target.value), rows: 2 })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onClose, children: labels.cancel }), _jsx(Button, { onClick: save, disabled: isSaving || !code.trim() || !name.trim() || !bwaLine.trim(), children: isSaving ? labels.saving : labels.save })] })] }) }));
|
|
95
|
+
}
|
|
96
|
+
function RulesTab({ adapter, labels }) {
|
|
97
|
+
const rulesQuery = adapter.useRules();
|
|
98
|
+
const [newRuleOpen, setNewRuleOpen] = useState(false);
|
|
99
|
+
return (_jsxs("div", { children: [_jsx("div", { className: "flex flex-wrap items-end justify-end gap-4", children: _jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setNewRuleOpen(true), children: [_jsx(Plus, { className: "size-4" }), " ", labels.newRuleButton] }) }), _jsx("p", { className: "mt-4 max-w-3xl rounded-lg border border-border bg-muted/40 p-3 text-xs text-muted-foreground", children: labels.rulesHint }), rulesQuery.error ? (_jsx("div", { className: "mt-6", children: _jsx(ErrorState, { error: rulesQuery.error, onRetry: () => { } }) })) : rulesQuery.loading ? (_jsx("div", { className: "mt-6", children: _jsx(TableSkeleton, { rows: 6, columns: 4 }) })) : rulesQuery.data.length === 0 ? (_jsxs("div", { className: "mt-6 rounded-xl border border-border bg-card px-4 py-12 text-center", children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: labels.emptyRules }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: labels.emptyRulesHint })] })) : (_jsx("div", { className: "mt-6 overflow-hidden overflow-x-auto rounded-xl border border-border bg-card", children: _jsx(Table, { children: _jsx(TableBody, { children: rulesQuery.data.map((rule) => (_jsx(RuleRow, { rule: rule, adapter: adapter, labels: labels }, rule.id))) }) }) })), newRuleOpen && _jsx(RuleDialog, { adapter: adapter, labels: labels, onClose: () => setNewRuleOpen(false) })] }));
|
|
100
|
+
}
|
|
101
|
+
function RuleRow({ rule, adapter, labels }) {
|
|
102
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
103
|
+
async function toggleActive(active) {
|
|
104
|
+
try {
|
|
105
|
+
await adapter.setRuleActive(rule.id, active);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
toast.error(readableErrorMessage(error, ""));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function confirmDelete() {
|
|
112
|
+
try {
|
|
113
|
+
await adapter.deleteRule(rule.id);
|
|
114
|
+
toast.success(labels.deletedToast);
|
|
115
|
+
setDeleteOpen(false);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
toast.error(readableErrorMessage(error, ""));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return (_jsxs(TableRow, { className: cn(!rule.isActive && "opacity-60"), children: [_jsx(TableCell, { className: "font-medium text-foreground", children: rule.categoryLabel }), _jsx(TableCell, { children: _jsx("div", { className: "flex flex-wrap gap-1.5", children: rule.scopeChips.map((chip, i) => (_jsxs("span", { className: "inline-flex items-center rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground", children: [chip.label, ": ", chip.value] }, i))) }) }), _jsx(TableCell, { className: "max-w-[200px] truncate text-sm text-muted-foreground", children: rule.note ?? "—" }), _jsx(TableCell, { children: _jsxs("div", { className: "flex items-center justify-end gap-3", children: [_jsx("button", { type: "button", onClick: () => toggleActive(!rule.isActive), className: "text-xs font-medium text-muted-foreground hover:text-foreground", children: rule.isActive ? labels.deactivateButton : labels.activateButton }), _jsxs(AlertDialog, { open: deleteOpen, onOpenChange: setDeleteOpen, children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx("button", { type: "button", title: labels.deleteButton, className: "flex size-7 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive", children: _jsx(Trash2, { className: "size-3.5" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: labels.deleteDialogTitle }), _jsx(AlertDialogDescription, { children: labels.deleteDialogDescription })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: labels.deleteCancel }), _jsx(AlertDialogAction, { onClick: confirmDelete, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: labels.deleteConfirm })] })] })] })] }) })] }));
|
|
122
|
+
}
|
|
123
|
+
function RuleDialog({ adapter, labels, onClose }) {
|
|
124
|
+
const categoryOptionsQuery = adapter.useCategoryOptions();
|
|
125
|
+
const supplierOptionsQuery = adapter.useSupplierOptions();
|
|
126
|
+
const propertyOptionsQuery = adapter.usePropertyOptions();
|
|
127
|
+
const companyOptionsQuery = adapter.useCompanyOptions();
|
|
128
|
+
const [categoryId, setCategoryId] = useState("");
|
|
129
|
+
const [supplierId, setSupplierId] = useState(NONE);
|
|
130
|
+
const [propertyId, setPropertyId] = useState(NONE);
|
|
131
|
+
const [companyId, setCompanyId] = useState(NONE);
|
|
132
|
+
const [referencePattern, setReferencePattern] = useState("");
|
|
133
|
+
const [note, setNote] = useState("");
|
|
134
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
135
|
+
async function save() {
|
|
136
|
+
if (!categoryId)
|
|
137
|
+
return;
|
|
138
|
+
const input = {
|
|
139
|
+
categoryId,
|
|
140
|
+
supplierId: supplierId === NONE ? null : supplierId,
|
|
141
|
+
propertyId: propertyId === NONE ? null : propertyId,
|
|
142
|
+
companyId: companyId === NONE ? null : companyId,
|
|
143
|
+
referencePattern: referencePattern.trim() || null,
|
|
144
|
+
note: note.trim() || null,
|
|
145
|
+
};
|
|
146
|
+
setIsSaving(true);
|
|
147
|
+
try {
|
|
148
|
+
await adapter.createRule(input);
|
|
149
|
+
toast.success(labels.ruleCreated);
|
|
150
|
+
onClose();
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
toast.error(labels.saveFailed(readableErrorMessage(e, "")));
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
setIsSaving(false);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: labels.newRuleTitle }) }), _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldCategory }), _jsx(Combobox, { value: categoryId, onValueChange: setCategoryId, options: categoryOptionsQuery.data.map((c) => ({ value: c.id, label: c.label })) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldSupplier }), _jsx(Combobox, { value: supplierId, onValueChange: setSupplierId, options: [{ value: NONE, label: labels.supplierAny }, ...supplierOptionsQuery.data.map((s) => ({ value: s.id, label: s.name }))] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldProperty }), _jsx(Combobox, { value: propertyId, onValueChange: setPropertyId, options: [{ value: NONE, label: labels.propertyAny }, ...propertyOptionsQuery.data.map((p) => ({ value: p.id, label: p.name ? `${p.code} · ${p.name}` : p.code }))] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldCompany }), _jsx(Combobox, { value: companyId, onValueChange: setCompanyId, options: [{ value: NONE, label: labels.companyAny }, ...companyOptionsQuery.data.map((c) => ({ value: c.id, label: `${c.code} · ${c.name}` }))] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldReferencePattern }), _jsx(Input, { value: referencePattern, onChange: (event) => setReferencePattern(event.target.value), placeholder: labels.fieldReferencePatternPlaceholder })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.fieldNote }), _jsx(Textarea, { value: note, onChange: (event) => setNote(event.target.value), rows: 2 })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onClose, children: labels.cancel }), _jsx(Button, { onClick: save, disabled: isSaving || !categoryId, children: isSaving ? labels.saving : labels.save })] })] }) }));
|
|
160
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface CategoryRulesLabels {
|
|
2
|
+
title: string;
|
|
3
|
+
subtitle: string;
|
|
4
|
+
tabCategories: string;
|
|
5
|
+
tabRules: string;
|
|
6
|
+
newCategoryButton: string;
|
|
7
|
+
columnCode: string;
|
|
8
|
+
columnName: string;
|
|
9
|
+
columnBlock: string;
|
|
10
|
+
columnDirection: string;
|
|
11
|
+
catchallBadge: string;
|
|
12
|
+
excludedBadge: string;
|
|
13
|
+
inactiveBadge: string;
|
|
14
|
+
emptyCategories: string;
|
|
15
|
+
editButton: string;
|
|
16
|
+
archiveButton: string;
|
|
17
|
+
moveUp: string;
|
|
18
|
+
moveDown: string;
|
|
19
|
+
newCategoryTitle: string;
|
|
20
|
+
editCategoryTitle: string;
|
|
21
|
+
fieldCode: string;
|
|
22
|
+
fieldName: string;
|
|
23
|
+
fieldParent: string;
|
|
24
|
+
parentNone: string;
|
|
25
|
+
fieldBlock: string;
|
|
26
|
+
fieldLine: string;
|
|
27
|
+
fieldDirection: string;
|
|
28
|
+
directionIncoming: string;
|
|
29
|
+
directionOutgoing: string;
|
|
30
|
+
block: Record<string, string>;
|
|
31
|
+
fieldNote: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
save: string;
|
|
34
|
+
saving: string;
|
|
35
|
+
saveFailed: (error: string) => string;
|
|
36
|
+
savedToast: string;
|
|
37
|
+
archivedToast: string;
|
|
38
|
+
rulesHint: string;
|
|
39
|
+
newRuleButton: string;
|
|
40
|
+
newRuleTitle: string;
|
|
41
|
+
fieldCategory: string;
|
|
42
|
+
fieldSupplier: string;
|
|
43
|
+
supplierAny: string;
|
|
44
|
+
fieldProperty: string;
|
|
45
|
+
propertyAny: string;
|
|
46
|
+
fieldCompany: string;
|
|
47
|
+
companyAny: string;
|
|
48
|
+
fieldReferencePattern: string;
|
|
49
|
+
fieldReferencePatternPlaceholder: string;
|
|
50
|
+
emptyRules: string;
|
|
51
|
+
emptyRulesHint: string;
|
|
52
|
+
deleteButton: string;
|
|
53
|
+
deleteDialogTitle: string;
|
|
54
|
+
deleteDialogDescription: string;
|
|
55
|
+
deleteCancel: string;
|
|
56
|
+
deleteConfirm: string;
|
|
57
|
+
deletedToast: string;
|
|
58
|
+
scopeSupplier: string;
|
|
59
|
+
scopeProperty: string;
|
|
60
|
+
scopeCompany: string;
|
|
61
|
+
scopeReference: string;
|
|
62
|
+
ruleCreated: string;
|
|
63
|
+
activateButton: string;
|
|
64
|
+
deactivateButton: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const englishCategoryRulesLabels: CategoryRulesLabels;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const englishCategoryRulesLabels = {
|
|
2
|
+
title: "Categories & rules",
|
|
3
|
+
subtitle: "The cost taxonomy the evaluation is built on, and the rules that assign invoices to it.",
|
|
4
|
+
tabCategories: "Categories",
|
|
5
|
+
tabRules: "Rules",
|
|
6
|
+
newCategoryButton: "New category",
|
|
7
|
+
columnCode: "Code",
|
|
8
|
+
columnName: "Name",
|
|
9
|
+
columnBlock: "Block",
|
|
10
|
+
columnDirection: "Direction",
|
|
11
|
+
catchallBadge: "Catch-all",
|
|
12
|
+
excludedBadge: "Excluded from P&L",
|
|
13
|
+
inactiveBadge: "Inactive",
|
|
14
|
+
emptyCategories: "No categories yet.",
|
|
15
|
+
editButton: "Edit",
|
|
16
|
+
archiveButton: "Archive",
|
|
17
|
+
moveUp: "Move up",
|
|
18
|
+
moveDown: "Move down",
|
|
19
|
+
newCategoryTitle: "New category",
|
|
20
|
+
editCategoryTitle: "Edit category",
|
|
21
|
+
fieldCode: "Code",
|
|
22
|
+
fieldName: "Name",
|
|
23
|
+
fieldParent: "Parent category",
|
|
24
|
+
parentNone: "Top-level",
|
|
25
|
+
fieldBlock: "P&L block",
|
|
26
|
+
fieldLine: "P&L line",
|
|
27
|
+
fieldDirection: "Direction",
|
|
28
|
+
directionIncoming: "Incoming",
|
|
29
|
+
directionOutgoing: "Outgoing",
|
|
30
|
+
block: {
|
|
31
|
+
revenue: "Revenue",
|
|
32
|
+
cost_of_goods: "Cost of goods",
|
|
33
|
+
costs: "Costs",
|
|
34
|
+
neutral: "Neutral",
|
|
35
|
+
taxes: "Taxes",
|
|
36
|
+
special_case: "Special case",
|
|
37
|
+
},
|
|
38
|
+
fieldNote: "Note",
|
|
39
|
+
cancel: "Cancel",
|
|
40
|
+
save: "Save",
|
|
41
|
+
saving: "Saving…",
|
|
42
|
+
saveFailed: (error) => `Could not save: ${error}`,
|
|
43
|
+
savedToast: "Category saved.",
|
|
44
|
+
archivedToast: "Category archived.",
|
|
45
|
+
rulesHint: "A rule assigns a category automatically to any invoice matching its scope. The most specific rule wins.",
|
|
46
|
+
newRuleButton: "New rule",
|
|
47
|
+
newRuleTitle: "New assignment rule",
|
|
48
|
+
fieldCategory: "Category",
|
|
49
|
+
fieldSupplier: "Supplier",
|
|
50
|
+
supplierAny: "Any supplier",
|
|
51
|
+
fieldProperty: "Property",
|
|
52
|
+
propertyAny: "Any property",
|
|
53
|
+
fieldCompany: "Company",
|
|
54
|
+
companyAny: "Any company",
|
|
55
|
+
fieldReferencePattern: "Reference contains",
|
|
56
|
+
fieldReferencePatternPlaceholder: "Optional text match",
|
|
57
|
+
emptyRules: "No rules yet.",
|
|
58
|
+
emptyRulesHint: "Rules created here apply automatically to new invoices.",
|
|
59
|
+
deleteButton: "Delete",
|
|
60
|
+
deleteDialogTitle: "Delete this rule?",
|
|
61
|
+
deleteDialogDescription: "Invoices it already assigned keep their category; only future matching stops.",
|
|
62
|
+
deleteCancel: "Cancel",
|
|
63
|
+
deleteConfirm: "Delete",
|
|
64
|
+
deletedToast: "Rule deleted.",
|
|
65
|
+
scopeSupplier: "Supplier",
|
|
66
|
+
scopeProperty: "Property",
|
|
67
|
+
scopeCompany: "Company",
|
|
68
|
+
scopeReference: "Reference",
|
|
69
|
+
ruleCreated: "Rule created.",
|
|
70
|
+
activateButton: "Activate",
|
|
71
|
+
deactivateButton: "Deactivate",
|
|
72
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Formatters } from "../../lib/formatters";
|
|
2
|
+
import type { CompaniesAdapter } from "../../adapters/companies";
|
|
3
|
+
import { type CompaniesLabels } from "./labels";
|
|
4
|
+
export interface CompanyDetailPageProps {
|
|
5
|
+
companyId: string;
|
|
6
|
+
adapter: CompaniesAdapter;
|
|
7
|
+
labels?: CompaniesLabels;
|
|
8
|
+
formatters?: Formatters;
|
|
9
|
+
}
|
|
10
|
+
export declare function CompanyDetailPage({ companyId, adapter, labels, formatters, }: CompanyDetailPageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Archive, ArrowLeft, Pencil, RotateCcw, TriangleAlert } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { Badge } from "../../ui/badge.js";
|
|
6
|
+
import { Button } from "../../ui/button.js";
|
|
7
|
+
import { Input } from "../../ui/input.js";
|
|
8
|
+
import { Label } from "../../ui/label.js";
|
|
9
|
+
import { Skeleton } from "../../ui/skeleton.js";
|
|
10
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../ui/alert-dialog.js";
|
|
11
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../ui/dialog.js";
|
|
12
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../ui/select.js";
|
|
13
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../ui/table.js";
|
|
14
|
+
import { ErrorState, readableErrorMessage } from "../../components/feedback/query-states.js";
|
|
15
|
+
import { cn } from "../../lib/class-names.js";
|
|
16
|
+
import { englishFormatters } from "../../lib/formatters.js";
|
|
17
|
+
import { FieldErrorText, RequiredMark, validateCompanyForm } from "./company-form.js";
|
|
18
|
+
import { KnownSpellingsCard } from "./known-spellings-card.js";
|
|
19
|
+
import { useInfiniteRows } from "./use-infinite-rows.js";
|
|
20
|
+
import { englishCompaniesLabels } from "./labels.js";
|
|
21
|
+
const NO_AREA = "__none";
|
|
22
|
+
const STATUS_TONE_STYLE = {
|
|
23
|
+
brand: "bg-brand-tint text-brand-dark",
|
|
24
|
+
success: "bg-success-soft text-success",
|
|
25
|
+
warning: "bg-warning-soft text-warning",
|
|
26
|
+
danger: "bg-danger-soft text-danger",
|
|
27
|
+
neutral: "bg-muted text-muted-foreground",
|
|
28
|
+
};
|
|
29
|
+
function editFormFrom(company) {
|
|
30
|
+
return {
|
|
31
|
+
code: company.code ?? "",
|
|
32
|
+
name: company.name ?? "",
|
|
33
|
+
area: company.area ?? NO_AREA,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function CompanyDetailPage({ companyId, adapter, labels = englishCompaniesLabels, formatters = englishFormatters, }) {
|
|
37
|
+
const companyQuery = adapter.useCompany(companyId);
|
|
38
|
+
const invoicesQuery = adapter.useInvoicesForCompany(companyId, companyQuery.data?.code);
|
|
39
|
+
const propertiesQuery = adapter.useProperties();
|
|
40
|
+
const propertyLinksQuery = adapter.usePropertyCompanyLinks();
|
|
41
|
+
const allCompaniesQuery = adapter.useCompanies({ includeArchived: false });
|
|
42
|
+
const [archiveReason, setArchiveReason] = useState("");
|
|
43
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
44
|
+
const [form, setForm] = useState(null);
|
|
45
|
+
const [errors, setErrors] = useState({});
|
|
46
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
47
|
+
const [isArchiving, setIsArchiving] = useState(false);
|
|
48
|
+
const [isRestoring, setIsRestoring] = useState(false);
|
|
49
|
+
const company = companyQuery.data ?? null;
|
|
50
|
+
// The adapter already applies the matching rule; only the presentational sort happens here.
|
|
51
|
+
const invoices = useMemo(() => [...(invoicesQuery.data ?? [])].sort((first, second) => (second.documentDate ?? "").localeCompare(first.documentDate ?? "")), [invoicesQuery.data]);
|
|
52
|
+
const totalAmount = invoices.reduce((sum, invoice) => sum + (invoice.amountGross ?? 0), 0);
|
|
53
|
+
// Tracked separately so the empty state is only shown once it is actually known to be true.
|
|
54
|
+
const invoicesReady = invoicesQuery.data !== undefined;
|
|
55
|
+
// Properties belonging to this company; a property may belong to several companies at once.
|
|
56
|
+
const ownProperties = useMemo(() => {
|
|
57
|
+
const ownPropertyIds = new Set((propertyLinksQuery.data ?? [])
|
|
58
|
+
.filter((link) => link.companyId === companyId)
|
|
59
|
+
.map((link) => link.propertyId));
|
|
60
|
+
return (propertiesQuery.data ?? []).filter((property) => ownPropertyIds.has(property.id));
|
|
61
|
+
}, [propertiesQuery.data, propertyLinksQuery.data, companyId]);
|
|
62
|
+
const visibleInvoices = useInfiniteRows(invoices, 25);
|
|
63
|
+
// id -> code, so the mismatch hint can name the owning company instead of a bare id.
|
|
64
|
+
const companyCodeById = useMemo(() => new Map((allCompaniesQuery.data ?? []).map((entry) => [entry.id, entry.code])), [allCompaniesQuery.data]);
|
|
65
|
+
// Property codes booked against THIS company that belong to a different one.
|
|
66
|
+
// A property with no ownership row at all is deliberately not flagged: that is "owner not
|
|
67
|
+
// recorded yet", not a mismatch.
|
|
68
|
+
const foreignProperties = useMemo(() => {
|
|
69
|
+
const ownersByPropertyId = new Map();
|
|
70
|
+
for (const link of propertyLinksQuery.data ?? []) {
|
|
71
|
+
const owners = ownersByPropertyId.get(link.propertyId) ?? new Set();
|
|
72
|
+
owners.add(link.companyId);
|
|
73
|
+
ownersByPropertyId.set(link.propertyId, owners);
|
|
74
|
+
}
|
|
75
|
+
const ownersByPropertyCode = new Map();
|
|
76
|
+
for (const property of propertiesQuery.data ?? []) {
|
|
77
|
+
const owners = ownersByPropertyId.get(property.id);
|
|
78
|
+
if (!owners || owners.size === 0 || owners.has(companyId))
|
|
79
|
+
continue;
|
|
80
|
+
ownersByPropertyCode.set(property.code, [...owners]);
|
|
81
|
+
}
|
|
82
|
+
return ownersByPropertyCode;
|
|
83
|
+
}, [propertyLinksQuery.data, propertiesQuery.data, companyId]);
|
|
84
|
+
const foreignInvoices = useMemo(() => invoices.filter((invoice) => invoice.propertyCode && foreignProperties.has(invoice.propertyCode)), [invoices, foreignProperties]);
|
|
85
|
+
const foreignTotal = foreignInvoices.reduce((sum, invoice) => sum + (invoice.amountGross ?? 0), 0);
|
|
86
|
+
if (companyQuery.isLoading) {
|
|
87
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsx(Skeleton, { className: "h-8 w-64" }), _jsx(Skeleton, { className: "h-64 w-full rounded-xl" })] }));
|
|
88
|
+
}
|
|
89
|
+
if (companyQuery.isError) {
|
|
90
|
+
return _jsx(ErrorState, { error: companyQuery.error, onRetry: () => companyQuery.refetch() });
|
|
91
|
+
}
|
|
92
|
+
if (!company) {
|
|
93
|
+
return (_jsxs("div", { className: "mx-auto max-w-md py-20 text-center", children: [_jsx("h1", { className: "text-xl font-semibold tracking-tight text-foreground", children: labels.detail.notFoundTitle }), _jsx(Button, { className: "mt-6", onClick: () => adapter.openCompanyList(), children: labels.detail.goToList })] }));
|
|
94
|
+
}
|
|
95
|
+
const editForm = form ?? editFormFrom(company);
|
|
96
|
+
const setField = (field, value) => {
|
|
97
|
+
setForm((previous) => ({ ...(previous ?? editFormFrom(company)), [field]: value }));
|
|
98
|
+
// Clear a field's error as soon as it is touched, not only on the next submit.
|
|
99
|
+
setErrors((previous) => (previous[field] ? { ...previous, [field]: "" } : previous));
|
|
100
|
+
};
|
|
101
|
+
function startEditing() {
|
|
102
|
+
setForm(editFormFrom(company));
|
|
103
|
+
setErrors({});
|
|
104
|
+
setIsEditing(true);
|
|
105
|
+
}
|
|
106
|
+
function cancelEditing() {
|
|
107
|
+
setForm(null);
|
|
108
|
+
setIsEditing(false);
|
|
109
|
+
}
|
|
110
|
+
async function save() {
|
|
111
|
+
const current = company;
|
|
112
|
+
const changes = {};
|
|
113
|
+
if (editForm.code.trim() && editForm.code.trim() !== current.code) {
|
|
114
|
+
changes.code = editForm.code.trim();
|
|
115
|
+
}
|
|
116
|
+
if (editForm.name.trim() && editForm.name.trim() !== current.name) {
|
|
117
|
+
changes.name = editForm.name.trim();
|
|
118
|
+
}
|
|
119
|
+
const areaValue = editForm.area === NO_AREA ? null : editForm.area;
|
|
120
|
+
if (areaValue !== current.area)
|
|
121
|
+
changes.area = areaValue;
|
|
122
|
+
const validated = validateCompanyForm({ code: editForm.code, name: editForm.name }, labels.validation);
|
|
123
|
+
if (Object.keys(validated.errors).length > 0) {
|
|
124
|
+
setErrors(validated.errors);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setErrors({});
|
|
128
|
+
if (Object.keys(changes).length === 0) {
|
|
129
|
+
toast.info(labels.detail.noChangesToast);
|
|
130
|
+
setIsEditing(false);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setIsSaving(true);
|
|
134
|
+
try {
|
|
135
|
+
await adapter.updateCompany({ companyId, changes });
|
|
136
|
+
toast.success(labels.detail.savedToast);
|
|
137
|
+
setForm(null);
|
|
138
|
+
setIsEditing(false);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
toast.error(labels.detail.saveFailedToast(readableErrorMessage(error, "")));
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
setIsSaving(false);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async function archive() {
|
|
148
|
+
setIsArchiving(true);
|
|
149
|
+
try {
|
|
150
|
+
await adapter.archiveCompany({ companyId, reason: archiveReason.trim() });
|
|
151
|
+
toast.success(labels.detail.archivedToast);
|
|
152
|
+
setArchiveReason("");
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
toast.error(labels.detail.archiveFailedToast(readableErrorMessage(error, "")));
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
setIsArchiving(false);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function restore() {
|
|
162
|
+
setIsRestoring(true);
|
|
163
|
+
try {
|
|
164
|
+
await adapter.restoreCompany({ companyId });
|
|
165
|
+
toast.success(labels.detail.restoredToast);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
toast.error(labels.detail.restoreFailedToast(readableErrorMessage(error, "")));
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
setIsRestoring(false);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return (_jsxs("div", { children: [_jsxs("button", { type: "button", onClick: () => adapter.openCompanyList(), className: "inline-flex cursor-pointer items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground", children: [_jsx(ArrowLeft, { className: "size-4" }), " ", labels.detail.backToList] }), _jsxs("div", { className: "mt-2 flex flex-wrap items-end justify-between gap-4", children: [_jsxs("h1", { className: "text-2xl font-semibold tracking-tight text-foreground", children: [_jsx("span", { className: "font-mono", children: company.code }), " \u00B7 ", company.name] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { onClick: startEditing, className: "gap-2", children: [_jsx(Pencil, { className: "size-4" }), " ", labels.detail.edit] }), company.archivedAt ? (_jsxs(Button, { variant: "outline", className: "gap-2", disabled: isRestoring, onClick: restore, children: [_jsx(RotateCcw, { className: "size-4" }), " ", labels.detail.restore] })) : (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "gap-2 text-destructive hover:bg-destructive/10 hover:text-destructive", children: [_jsx(Archive, { className: "size-4" }), " ", labels.detail.archive] }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: labels.detail.archiveDialogTitle }), _jsxs(AlertDialogDescription, { children: [labels.detail.archiveDialogDescription, invoicesReady && invoices.length > 0
|
|
175
|
+
? " " + labels.detail.archiveDialogInvoiceNote(invoices.length)
|
|
176
|
+
: ""] })] }), _jsx(Input, { value: archiveReason, onChange: (event) => setArchiveReason(event.target.value), placeholder: labels.detail.archiveReasonPlaceholder }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: labels.detail.archiveCancel }), _jsx(AlertDialogAction, { disabled: !archiveReason.trim() || isArchiving, onClick: archive, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: labels.detail.archiveConfirm })] })] })] }))] })] }), company.archivedAt && (_jsxs("div", { className: "mt-4 flex items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2.5 text-sm text-muted-foreground", children: [_jsx(Archive, { className: "size-4 shrink-0" }), labels.detail.archivedBanner(formatters.formatDate(company.archivedAt), company.archiveReason?.trim() || labels.detail.archivedWithoutReason)] })), _jsxs("div", { className: "mt-6 grid gap-6 lg:grid-cols-[1fr_1.1fr]", children: [_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "rounded-xl border border-border bg-card p-5", children: [_jsx("h2", { className: "mb-4 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: labels.detail.masterDataSection }), _jsxs("dl", { className: "space-y-3", children: [_jsxs("div", { className: "border-b border-border/60 pb-3", children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: labels.detail.codeField }), _jsx("dd", { className: "font-mono text-sm text-foreground", children: company.code })] }), _jsxs("div", { children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: labels.detail.nameField }), _jsx("dd", { className: "text-sm text-foreground", children: company.name })] }), _jsxs("div", { children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: labels.detail.areaField }), _jsx("dd", { className: "text-sm text-foreground", children: company.area ? labels.detail.areaLabel(company.area) : "—" })] })] }), ownProperties.length > 0 && (_jsxs("div", { className: "mt-6", children: [_jsx("h3", { className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: labels.detail.propertiesHeading }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: ownProperties.map((property) => (_jsxs("button", { type: "button", onClick: () => adapter.openProperty(property.code), className: "inline-flex cursor-pointer items-center rounded-md border border-border bg-muted/40 px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-muted", children: [_jsx("span", { className: "font-mono", children: property.code }), property.name ? (_jsxs("span", { className: "ml-1 text-muted-foreground", children: ["\u00B7 ", property.name] })) : null] }, property.id))) })] }))] }), _jsx(KnownSpellingsCard, { adapter: adapter, companyCode: company.code ?? "", labels: labels.aliases })] }), _jsx("div", { className: "space-y-6", children: _jsxs("section", { className: "rounded-xl border border-border bg-card p-5", children: [_jsx("h2", { className: "mb-4 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: labels.detail.bookedSection }), _jsx("div", { className: "mb-4 rounded-lg bg-muted/40 px-3 py-2", children: invoicesReady ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-xs text-muted-foreground", children: labels.detail.invoiceTotalCaption(invoices.length) }), _jsx("div", { className: "text-lg font-semibold tabular-nums text-foreground", children: formatters.formatMoney(totalAmount) })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "h-4 w-28" }), _jsx(Skeleton, { className: "mt-1.5 h-6 w-32" })] })) }), invoicesReady && foreignInvoices.length > 0 && (_jsxs("div", { className: "mb-4 flex items-start gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-foreground", children: [_jsx(TriangleAlert, { className: "mt-0.5 size-4 shrink-0 text-warning" }), _jsx("p", { className: "text-xs", children: labels.detail.foreignPropertiesWarning(foreignInvoices.length, formatters.formatMoney(foreignTotal)) })] })), _jsx("div", { className: "overflow-hidden rounded-lg border border-border", children: _jsx("div", { className: "max-h-[26rem] overflow-y-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { className: "bg-muted/40 [&>th]:sticky [&>th]:top-0 [&>th]:z-10 [&>th]:bg-muted", children: [_jsx(TableHead, { children: labels.detail.columnInvoice }), _jsx(TableHead, { children: labels.detail.columnProperty }), _jsx(TableHead, { children: labels.detail.columnDate }), _jsx(TableHead, { className: "text-right", children: labels.detail.columnAmount }), _jsx(TableHead, { children: labels.detail.columnStatus })] }) }), _jsxs(TableBody, { children: [visibleInvoices.visible.map((invoice) => (_jsxs(TableRow, { className: "cursor-pointer", onClick: () => adapter.openInvoice(invoice.id), children: [_jsx(TableCell, { className: "font-medium text-foreground", children: invoice.invoiceNumber ?? labels.detail.withoutInvoiceNumber }), _jsx(TableCell, { className: "text-sm text-muted-foreground", children: invoice.propertyCode ? (foreignProperties.has(invoice.propertyCode) ? (_jsxs("span", { className: "inline-flex items-center gap-1 font-medium text-warning", title: labels.detail.foreignPropertyHint(invoice.propertyCode, (foreignProperties.get(invoice.propertyCode) ?? [])
|
|
177
|
+
.map((ownerId) => companyCodeById.get(ownerId) ?? ownerId)
|
|
178
|
+
.join(", ")), children: [_jsx(TriangleAlert, { className: "size-3.5 shrink-0" }), invoice.propertyCode] })) : (invoice.propertyCode)) : ("—") }), _jsx(TableCell, { className: "text-sm text-muted-foreground tabular-nums", children: formatters.formatDate(invoice.documentDate) }), _jsx(TableCell, { className: "text-right font-medium tabular-nums", children: formatters.formatMoney(invoice.amountGross) }), _jsx(TableCell, { children: _jsx(InvoiceStatusBadge, { status: invoice.status, adapter: adapter, labels: labels }) })] }, invoice.id))), !invoicesReady &&
|
|
179
|
+
[0, 1, 2].map((index) => (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-3", children: _jsx(Skeleton, { className: "h-4 w-full" }) }) }, `invoice-skeleton-${index}`))), invoicesReady && invoices.length === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-8 text-center text-muted-foreground", children: labels.detail.invoicesEmpty }) })), visibleInvoices.hasMore && (_jsx(TableRow, { ref: visibleInvoices.sentinelRef, children: _jsx(TableCell, { colSpan: 99, className: "py-3 text-center text-xs text-muted-foreground", children: labels.detail.loadMoreRemaining(visibleInvoices.total - visibleInvoices.visible.length) }) }))] })] }) }) })] }) })] }), _jsx(Dialog, { open: isEditing, onOpenChange: (open) => (open ? undefined : cancelEditing()), children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: labels.detail.editDialogTitle }), _jsx(DialogDescription, { children: labels.detail.editDialogDescription })] }), _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.detail.codeField, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: editForm.code, onChange: (event) => setField("code", event.target.value), "aria-invalid": !!errors.code }), _jsx(FieldErrorText, { text: errors.code })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.detail.nameField, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: editForm.name, onChange: (event) => setField("name", event.target.value), "aria-invalid": !!errors.name }), _jsx(FieldErrorText, { text: errors.name })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: labels.detail.areaField }), _jsxs(Select, { value: editForm.area, onValueChange: (value) => setField("area", value), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: NO_AREA, children: labels.detail.areaNone }), adapter.areaOptions.map((area) => (_jsx(SelectItem, { value: area, children: labels.detail.areaLabel(area) }, area)))] })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: cancelEditing, children: labels.detail.cancel }), _jsx(Button, { onClick: save, disabled: isSaving, children: isSaving ? labels.detail.saving : labels.detail.save })] })] }) })] }));
|
|
180
|
+
}
|
|
181
|
+
function InvoiceStatusBadge({ status, adapter, labels, }) {
|
|
182
|
+
const tone = status ? adapter.invoiceStatusTone[status] : undefined;
|
|
183
|
+
return (_jsx(Badge, { variant: "outline", className: cn("border-transparent font-medium", STATUS_TONE_STYLE[tone ?? "neutral"]), children: status ? labels.detail.invoiceStatusLabel(status) : "—" }));
|
|
184
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function RequiredMark({ title }: {
|
|
2
|
+
title: string;
|
|
3
|
+
}): import("react").JSX.Element;
|
|
4
|
+
export declare function FieldErrorText({ text }: {
|
|
5
|
+
text?: string;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
7
|
+
export interface CompanyFormValidation {
|
|
8
|
+
code: string;
|
|
9
|
+
name: string;
|
|
10
|
+
errors: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export declare function validateCompanyForm(input: {
|
|
13
|
+
code: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}, labels: {
|
|
16
|
+
codeRequired: string;
|
|
17
|
+
codeTooLong: string;
|
|
18
|
+
codeInvalidCharacters: string;
|
|
19
|
+
nameRequired: string;
|
|
20
|
+
}): CompanyFormValidation;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function RequiredMark({ title }) {
|
|
3
|
+
return (_jsx("span", { className: "text-destructive", title: title, "aria-hidden": true, children: "*" }));
|
|
4
|
+
}
|
|
5
|
+
export function FieldErrorText({ text }) {
|
|
6
|
+
if (!text)
|
|
7
|
+
return null;
|
|
8
|
+
return _jsx("p", { className: "text-xs text-destructive", children: text });
|
|
9
|
+
}
|
|
10
|
+
export function validateCompanyForm(input, labels) {
|
|
11
|
+
const code = input.code.trim();
|
|
12
|
+
const name = input.name.trim();
|
|
13
|
+
const errors = {};
|
|
14
|
+
if (!code)
|
|
15
|
+
errors.code = labels.codeRequired;
|
|
16
|
+
else if (code.length > 16)
|
|
17
|
+
errors.code = labels.codeTooLong;
|
|
18
|
+
else if (!/^[A-Za-z0-9]+$/.test(code))
|
|
19
|
+
errors.code = labels.codeInvalidCharacters;
|
|
20
|
+
if (!name)
|
|
21
|
+
errors.name = labels.nameRequired;
|
|
22
|
+
return { code, name, errors };
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Formatters } from "../../lib/formatters";
|
|
2
|
+
import type { CompaniesAdapter } from "../../adapters/companies";
|
|
3
|
+
import { type CompaniesLabels } from "./labels";
|
|
4
|
+
export interface CompanyListPageProps {
|
|
5
|
+
adapter: CompaniesAdapter;
|
|
6
|
+
labels?: CompaniesLabels;
|
|
7
|
+
formatters?: Formatters;
|
|
8
|
+
}
|
|
9
|
+
export declare function CompanyListPage({ adapter, labels, formatters, }: CompanyListPageProps): import("react").JSX.Element;
|