@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,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { RefreshCw } from "lucide-react";
|
|
4
|
+
import { Button } from "../../ui/button.js";
|
|
5
|
+
import { Input } from "../../ui/input.js";
|
|
6
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
7
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table.js";
|
|
8
|
+
import { ErrorState, TableSkeleton } from "../../components/feedback/query-states.js";
|
|
9
|
+
import { TablePagination } from "../../components/feedback/table-pagination.js";
|
|
10
|
+
import { cn } from "../../lib/class-names.js";
|
|
11
|
+
import { englishBankSyncLogLabels } from "./labels.js";
|
|
12
|
+
const ALL = "__all";
|
|
13
|
+
const REFRESH_OPTIONS = ["0", "60000", "300000", "900000"];
|
|
14
|
+
function formatCountdown(ms) {
|
|
15
|
+
const total = Math.ceil(ms / 1000);
|
|
16
|
+
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
17
|
+
}
|
|
18
|
+
function countsSummary(counts, countLabel) {
|
|
19
|
+
if (!counts)
|
|
20
|
+
return "—";
|
|
21
|
+
const parts = Object.entries(counts)
|
|
22
|
+
.filter(([, v]) => typeof v === "number" && Number.isFinite(v))
|
|
23
|
+
.map(([k, v]) => `${v} ${countLabel(k)}`);
|
|
24
|
+
return parts.length > 0 ? parts.join(" · ") : "—";
|
|
25
|
+
}
|
|
26
|
+
export function BankSyncLogPage({ adapter, labels = englishBankSyncLogLabels }) {
|
|
27
|
+
const [event, setEvent] = useState(ALL);
|
|
28
|
+
const [level, setLevel] = useState(ALL);
|
|
29
|
+
const [connectionId, setConnectionId] = useState(ALL);
|
|
30
|
+
const [from, setFrom] = useState("");
|
|
31
|
+
const [to, setTo] = useState("");
|
|
32
|
+
const [refresh, setRefresh] = useState("60000");
|
|
33
|
+
const [page, setPage] = useState(1);
|
|
34
|
+
const [pageSize] = useState(25);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setPage(1);
|
|
37
|
+
}, [event, level, connectionId, from, to]);
|
|
38
|
+
const refreshMs = Number(refresh) || 0;
|
|
39
|
+
const facetsQuery = adapter.useFacets();
|
|
40
|
+
const connectionsQuery = adapter.useConnections();
|
|
41
|
+
const logsQuery = adapter.useLogsPage({
|
|
42
|
+
event: event === ALL ? undefined : event,
|
|
43
|
+
level: level === ALL ? undefined : level,
|
|
44
|
+
connectionId: connectionId === ALL ? undefined : connectionId,
|
|
45
|
+
from: from || undefined,
|
|
46
|
+
to: to || undefined,
|
|
47
|
+
page,
|
|
48
|
+
pageSize,
|
|
49
|
+
refreshMs,
|
|
50
|
+
});
|
|
51
|
+
const rows = logsQuery.data?.rows ?? [];
|
|
52
|
+
const total = logsQuery.data?.total ?? 0;
|
|
53
|
+
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
54
|
+
const rowFrom = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
55
|
+
const rowTo = Math.min(page * pageSize, total);
|
|
56
|
+
const [now, setNow] = useState(() => Date.now());
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!refreshMs)
|
|
59
|
+
return;
|
|
60
|
+
const id = window.setInterval(() => setNow(Date.now()), 1000);
|
|
61
|
+
return () => window.clearInterval(id);
|
|
62
|
+
}, [refreshMs]);
|
|
63
|
+
const nextIn = refreshMs && logsQuery.dataUpdatedAt ? Math.max(0, refreshMs - (now - logsQuery.dataUpdatedAt)) : null;
|
|
64
|
+
const connectionLabel = useMemo(() => new Map(connectionsQuery.data.map((c) => [c.id, c.label])), [connectionsQuery.data]);
|
|
65
|
+
const eventOptions = [{ value: ALL, label: labels.allEvents }, ...(facetsQuery.data?.events ?? []).map((e) => ({ value: e, label: adapter.eventLabel(e) }))];
|
|
66
|
+
const levelOptions = [{ value: ALL, label: labels.allLevels }, ...(facetsQuery.data?.levels ?? []).map((l) => ({ value: l, label: l }))];
|
|
67
|
+
const connectionOptions = [{ value: ALL, label: labels.allConnections }, ...connectionsQuery.data.map((c) => ({ value: c.id, label: c.label }))];
|
|
68
|
+
const refreshOptions = REFRESH_OPTIONS.map((v) => ({ value: v, label: v === "0" ? labels.refreshOff : labels.refreshEvery(Number(v) / 60000) }));
|
|
69
|
+
const hasActiveFilter = event !== ALL || level !== ALL || connectionId !== ALL || !!from || !!to;
|
|
70
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [_jsx("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: labels.title }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [nextIn !== null && (_jsx("span", { className: "text-xs text-muted-foreground tabular-nums", children: logsQuery.isFetching ? labels.refreshing : labels.nextRefreshIn(formatCountdown(nextIn)) })), _jsx(Combobox, { value: refresh, onValueChange: setRefresh, options: [...refreshOptions], className: "h-8 w-full sm:w-[150px]" }), _jsxs(Button, { variant: "outline", size: "sm", className: "gap-2", disabled: logsQuery.isFetching, onClick: () => logsQuery.refetch(), children: [_jsx(RefreshCw, { className: cn("size-4", logsQuery.isFetching && "animate-spin") }), labels.refreshNow] })] })] }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [_jsx(Combobox, { value: event, onValueChange: setEvent, options: eventOptions, className: "h-9 w-full sm:w-[210px]" }), _jsx(Combobox, { value: level, onValueChange: setLevel, options: levelOptions, className: "h-9 w-full sm:w-[150px]" }), _jsx(Combobox, { value: connectionId, onValueChange: setConnectionId, options: connectionOptions, className: "h-9 w-full sm:w-[220px]" }), _jsx(Input, { type: "date", value: from, max: to || undefined, onChange: (e) => setFrom(e.target.value), "aria-label": labels.fromLabel, className: "h-9 w-full sm:w-[150px]" }), _jsx(Input, { type: "date", value: to, min: from || undefined, onChange: (e) => setTo(e.target.value), "aria-label": labels.toLabel, className: "h-9 w-full sm:w-[150px]" }), hasActiveFilter && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
71
|
+
setEvent(ALL);
|
|
72
|
+
setLevel(ALL);
|
|
73
|
+
setConnectionId(ALL);
|
|
74
|
+
setFrom("");
|
|
75
|
+
setTo("");
|
|
76
|
+
}, children: labels.resetFilters }))] }), logsQuery.error ? (_jsx("div", { className: "mt-3", children: _jsx(ErrorState, { error: logsQuery.error, onRetry: () => logsQuery.refetch() }) })) : !logsQuery.data ? (_jsx("div", { className: "mt-3", children: _jsx(TableSkeleton, { rows: 8, columns: 5 }) })) : (_jsx("div", { className: "mt-3 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.columnTime }), _jsx(TableHead, { children: labels.columnEvent }), _jsx(TableHead, { children: labels.columnLevel }), _jsx(TableHead, { children: labels.columnConnection }), _jsx(TableHead, { children: labels.columnDetails })] }) }), _jsxs(TableBody, { children: [rows.map((row) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: adapter.formatDateTime(row.createdAt) }), _jsx(TableCell, { className: "text-sm text-foreground", children: adapter.eventLabel(row.event) }), _jsx(TableCell, { children: _jsx("span", { className: cn("inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium", row.level === "error" ? "bg-red-100 text-red-800" : row.level === "warn" ? "bg-amber-100 text-amber-800" : "bg-muted text-muted-foreground"), children: row.level }) }), _jsx(TableCell, { className: "text-sm text-muted-foreground", children: row.connectionId ? (connectionLabel.get(row.connectionId) ?? row.connectionId.slice(0, 8)) : "—" }), _jsx(TableCell, { className: "max-w-[360px] truncate text-sm text-muted-foreground", children: row.counts ? countsSummary(row.counts, adapter.countLabel) : (row.message ?? "—") })] }, row.id))), rows.length === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-12 text-center text-muted-foreground", children: labels.empty }) }))] })] }) })), logsQuery.data && total > 0 && (_jsx(TablePagination, { page: page, totalPages: totalPages, pageSize: pageSize, total: total, from: rowFrom, to: rowTo, onPage: setPage, onPageSize: () => { } }))] }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface BankSyncLogLabels {
|
|
2
|
+
title: string;
|
|
3
|
+
allEvents: string;
|
|
4
|
+
allLevels: string;
|
|
5
|
+
allConnections: string;
|
|
6
|
+
fromLabel: string;
|
|
7
|
+
toLabel: string;
|
|
8
|
+
resetFilters: string;
|
|
9
|
+
refreshOff: string;
|
|
10
|
+
refreshEvery: (minutes: number) => string;
|
|
11
|
+
refreshNow: string;
|
|
12
|
+
refreshing: string;
|
|
13
|
+
nextRefreshIn: (time: string) => string;
|
|
14
|
+
columnTime: string;
|
|
15
|
+
columnEvent: string;
|
|
16
|
+
columnLevel: string;
|
|
17
|
+
columnConnection: string;
|
|
18
|
+
columnDetails: string;
|
|
19
|
+
empty: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const englishBankSyncLogLabels: BankSyncLogLabels;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const englishBankSyncLogLabels = {
|
|
2
|
+
title: "Bank sync log",
|
|
3
|
+
allEvents: "All events",
|
|
4
|
+
allLevels: "All levels",
|
|
5
|
+
allConnections: "All connections",
|
|
6
|
+
fromLabel: "From",
|
|
7
|
+
toLabel: "To",
|
|
8
|
+
resetFilters: "Reset filters",
|
|
9
|
+
refreshOff: "No auto-refresh",
|
|
10
|
+
refreshEvery: (minutes) => `Every ${minutes} min`,
|
|
11
|
+
refreshNow: "Refresh now",
|
|
12
|
+
refreshing: "Refreshing…",
|
|
13
|
+
nextRefreshIn: (time) => `Next refresh in ${time}`,
|
|
14
|
+
columnTime: "Time",
|
|
15
|
+
columnEvent: "Event",
|
|
16
|
+
columnLevel: "Level",
|
|
17
|
+
columnConnection: "Connection",
|
|
18
|
+
columnDetails: "Details",
|
|
19
|
+
empty: "No log entries in this range.",
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BankReconciliationAdapter, BankTransactionRecord } from "../../adapters/bank-reconciliation";
|
|
2
|
+
import type { BankTransactionsLabels } from "./labels";
|
|
3
|
+
export declare function BankMatchPanel({ transaction, onClose, adapter, labels, }: {
|
|
4
|
+
transaction: BankTransactionRecord | null;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
adapter: BankReconciliationAdapter;
|
|
7
|
+
labels: BankTransactionsLabels;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Search } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { Button } from "../../ui/button.js";
|
|
6
|
+
import { Input } from "../../ui/input.js";
|
|
7
|
+
import { Textarea } from "../../ui/textarea.js";
|
|
8
|
+
import { Skeleton } from "../../ui/skeleton.js";
|
|
9
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "../../ui/sheet.js";
|
|
10
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from "../../ui/dialog.js";
|
|
11
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
12
|
+
import { readableErrorMessage } from "../../components/feedback/query-states.js";
|
|
13
|
+
import { cn } from "../../lib/class-names.js";
|
|
14
|
+
export function BankMatchPanel({ transaction, onClose, adapter, labels, }) {
|
|
15
|
+
const [manualOpen, setManualOpen] = useState(false);
|
|
16
|
+
const [query, setQuery] = useState("");
|
|
17
|
+
const [results, setResults] = useState([]);
|
|
18
|
+
const [searching, setSearching] = useState(false);
|
|
19
|
+
const [noReceiptOpen, setNoReceiptOpen] = useState(false);
|
|
20
|
+
const [noReceiptReason, setNoReceiptReason] = useState("");
|
|
21
|
+
const candidatesQuery = adapter.useCandidates(transaction?.id ?? "");
|
|
22
|
+
const open = transaction != null;
|
|
23
|
+
async function confirm(invoiceId) {
|
|
24
|
+
if (!transaction)
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
await adapter.confirmMatch(transaction.id, invoiceId);
|
|
28
|
+
toast.success(labels.matchConfirmed);
|
|
29
|
+
onClose();
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
toast.error(readableErrorMessage(error, ""));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function reject(invoiceId) {
|
|
36
|
+
if (!transaction)
|
|
37
|
+
return;
|
|
38
|
+
try {
|
|
39
|
+
await adapter.rejectMatch(transaction.id, invoiceId);
|
|
40
|
+
toast.success(labels.matchRejected);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
toast.error(readableErrorMessage(error, ""));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function runSearch(value) {
|
|
47
|
+
setQuery(value);
|
|
48
|
+
if (!adapter.manualSearch || value.trim().length < 2) {
|
|
49
|
+
setResults([]);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setSearching(true);
|
|
53
|
+
try {
|
|
54
|
+
setResults(await adapter.manualSearch.search(value.trim()));
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
setSearching(false);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function confirmNoReceipt() {
|
|
61
|
+
if (!transaction || !adapter.noReceipt)
|
|
62
|
+
return;
|
|
63
|
+
try {
|
|
64
|
+
await adapter.noReceipt.mark(transaction.id, noReceiptReason);
|
|
65
|
+
toast.success(labels.noReceiptMarked);
|
|
66
|
+
setNoReceiptOpen(false);
|
|
67
|
+
setNoReceiptReason("");
|
|
68
|
+
onClose();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
toast.error(readableErrorMessage(error, ""));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsx(Sheet, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-md", children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: labels.panelTitle }), transaction && (_jsxs(SheetDescription, { children: [adapter.formatMoney(transaction.amount), " \u00B7 ", transaction.counterparty_holder ?? "—", " \u00B7", " ", adapter.formatDate(transaction.booking_date)] }))] }), _jsxs("div", { className: "mt-4 space-y-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: labels.candidatesTitle }), candidatesQuery.loading ? (_jsxs("div", { className: "mt-2 space-y-2", children: [_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }), _jsx(Skeleton, { className: "h-20 w-full rounded-lg" })] })) : candidatesQuery.data.length === 0 ? (_jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: labels.candidatesEmpty })) : (_jsx("ul", { className: "mt-2 space-y-2", children: candidatesQuery.data.map((candidate) => (_jsxs("li", { className: "rounded-lg border border-border bg-card p-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-medium text-foreground", children: candidate.issuer ?? "—" }), _jsxs("div", { className: "mt-0.5 text-xs text-muted-foreground", children: [adapter.formatMoney(candidate.amount), " \u00B7 ", adapter.formatDate(candidate.documentDate), candidate.invoiceNumber ? ` · #${candidate.invoiceNumber}` : ""] })] }), candidate.score != null && (_jsx("span", { className: "shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground", children: labels.scoreLabel(Math.round(candidate.score)) }))] }), _jsxs("div", { className: "mt-2 flex justify-end gap-3", children: [_jsx("button", { type: "button", className: "text-xs font-medium text-muted-foreground hover:text-destructive", onClick: () => reject(candidate.invoiceId), children: labels.candidateReject }), _jsx("button", { type: "button", className: "text-xs font-medium text-brand-dark hover:underline", onClick: () => confirm(candidate.invoiceId), children: labels.candidateConfirm })] })] }, candidate.invoiceId))) }))] }), adapter.manualSearch && (_jsxs("div", { children: [_jsxs("button", { type: "button", className: "flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground", onClick: () => setManualOpen((v) => !v), children: [_jsx(Search, { className: "size-3.5" }), labels.manualSearchToggle] }), manualOpen && (_jsxs("div", { className: "mt-2 space-y-2", children: [_jsx(Input, { value: query, onChange: (event) => runSearch(event.target.value), placeholder: labels.manualSearchPlaceholder }), searching ? (_jsx(Skeleton, { className: "h-16 w-full rounded-lg" })) : results.length === 0 && query.trim().length >= 2 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: labels.manualSearchEmpty })) : (_jsx("ul", { className: "space-y-2", children: results.map((result) => (_jsxs("li", { className: "flex items-center justify-between rounded-lg border border-border p-2 text-sm", children: [_jsx("span", { className: "truncate", children: result.issuer ?? "—" }), _jsx("button", { type: "button", className: "shrink-0 text-xs font-medium text-brand-dark hover:underline", onClick: () => confirm(result.id), children: labels.candidateConfirm })] }, result.id))) }))] }))] })), adapter.noReceipt && (_jsx("div", { className: cn("border-t border-border pt-4"), children: transaction?.no_receipt_reason ? (_jsx(Button, { variant: "outline", size: "sm", onClick: () => transaction && adapter.noReceipt.clear(transaction.id), children: labels.noReceiptClear })) : (_jsx(Button, { variant: "outline", size: "sm", onClick: () => setNoReceiptOpen(true), children: labels.noReceiptButton })) }))] })] }) }), _jsx(Dialog, { open: noReceiptOpen, onOpenChange: setNoReceiptOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: labels.noReceiptDialogTitle }) }), adapter.noReceipt && adapter.noReceipt.reasons.length > 0 ? (_jsx(Combobox, { value: noReceiptReason, onValueChange: setNoReceiptReason, options: adapter.noReceipt.reasons })) : (_jsx(Textarea, { value: noReceiptReason, onChange: (event) => setNoReceiptReason(event.target.value), placeholder: labels.noReceiptReasonPlaceholder, rows: 2 })), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setNoReceiptOpen(false), children: labels.close }), _jsx(Button, { onClick: confirmNoReceipt, disabled: !noReceiptReason.trim(), children: labels.noReceiptConfirm })] })] }) })] }));
|
|
75
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BankReconciliationAdapter } from "../../adapters/bank-reconciliation";
|
|
2
|
+
import { type BankTransactionsLabels } from "./labels";
|
|
3
|
+
export interface BankTransactionsPageProps {
|
|
4
|
+
adapter: BankReconciliationAdapter;
|
|
5
|
+
labels?: BankTransactionsLabels;
|
|
6
|
+
}
|
|
7
|
+
export declare function BankTransactionsPage({ adapter, labels }: BankTransactionsPageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Search } from "lucide-react";
|
|
4
|
+
import { Input } from "../../ui/input.js";
|
|
5
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
6
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table.js";
|
|
7
|
+
import { ErrorState, TableSkeleton } from "../../components/feedback/query-states.js";
|
|
8
|
+
import { TablePagination } from "../../components/feedback/table-pagination.js";
|
|
9
|
+
import { MatchStatusBadge, DirectionBadge } from "./badges.js";
|
|
10
|
+
import { BankMatchPanel } from "./BankMatchPanel.js";
|
|
11
|
+
import { SortControl } from "./sort-control.js";
|
|
12
|
+
import { useTableView } from "./use-table-view.js";
|
|
13
|
+
import { englishBankTransactionsLabels } from "./labels.js";
|
|
14
|
+
export function BankTransactionsPage({ adapter, labels = englishBankTransactionsLabels }) {
|
|
15
|
+
const transactionsQuery = adapter.useTransactions();
|
|
16
|
+
const accountsQuery = adapter.useAccounts();
|
|
17
|
+
const [search, setSearch] = useState("");
|
|
18
|
+
const [accountId, setAccountId] = useState("");
|
|
19
|
+
const [status, setStatus] = useState("");
|
|
20
|
+
const [openTransaction, setOpenTransaction] = useState(null);
|
|
21
|
+
const accountById = useMemo(() => new Map(accountsQuery.data.map((a) => [a.id, a])), [accountsQuery.data]);
|
|
22
|
+
const statusOptions = useMemo(() => {
|
|
23
|
+
const set = new Set(transactionsQuery.data.map((t) => t.matching_status).filter(Boolean));
|
|
24
|
+
return Array.from(set);
|
|
25
|
+
}, [transactionsQuery.data]);
|
|
26
|
+
const filteredRows = useMemo(() => {
|
|
27
|
+
const term = search.trim().toLowerCase();
|
|
28
|
+
return transactionsQuery.data.filter((row) => {
|
|
29
|
+
if (accountId && row.account_id !== accountId)
|
|
30
|
+
return false;
|
|
31
|
+
if (status && row.matching_status !== status)
|
|
32
|
+
return false;
|
|
33
|
+
if (!term)
|
|
34
|
+
return true;
|
|
35
|
+
return `${row.counterparty_holder ?? ""} ${row.payment_reference ?? ""} ${row.booking_text ?? ""}`.toLowerCase().includes(term);
|
|
36
|
+
});
|
|
37
|
+
}, [transactionsQuery.data, search, accountId, status]);
|
|
38
|
+
const view = useTableView(filteredRows, {
|
|
39
|
+
initialSort: "bookingDate",
|
|
40
|
+
initialDirection: "desc",
|
|
41
|
+
resetKey: `${search}|${accountId}|${status}`,
|
|
42
|
+
sortValue: (row, key) => {
|
|
43
|
+
switch (key) {
|
|
44
|
+
case "amount":
|
|
45
|
+
return row.amount;
|
|
46
|
+
case "counterparty":
|
|
47
|
+
return row.counterparty_holder ?? "";
|
|
48
|
+
default:
|
|
49
|
+
return row.booking_date ?? "";
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const sortColumns = [
|
|
54
|
+
{ value: "bookingDate", label: labels.columnDate },
|
|
55
|
+
{ value: "amount", label: labels.columnAmount },
|
|
56
|
+
{ value: "counterparty", label: labels.columnCounterparty },
|
|
57
|
+
];
|
|
58
|
+
return (_jsxs("div", { children: [_jsxs("div", { children: [_jsx("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: labels.title }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: labels.subtitle })] }), _jsxs("div", { className: "mt-6 flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "relative w-full max-w-sm", children: [_jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { value: search, onChange: (event) => setSearch(event.target.value), placeholder: labels.searchPlaceholder, className: "pl-9" })] }), _jsx(Combobox, { value: accountId, onValueChange: setAccountId, className: "w-full sm:w-48", options: [{ value: "", label: labels.accountAll }, ...accountsQuery.data.map((a) => ({ value: a.id, label: a.account_name ?? a.iban ?? a.id }))] }), _jsx(Combobox, { value: status, onValueChange: setStatus, className: "w-full sm:w-40", options: [{ value: "", label: labels.statusAll }, ...statusOptions.map((s) => ({ value: s, label: labels.matchingStatus(s) }))] }), _jsx(SortControl, { columns: sortColumns, sort: view.sort, direction: view.direction, onSort: view.setSort, onDirection: view.setDirection, labels: labels })] }), transactionsQuery.error ? (_jsx("div", { className: "mt-4", children: _jsx(ErrorState, { error: transactionsQuery.error, onRetry: () => { } }) })) : transactionsQuery.loading ? (_jsx("div", { className: "mt-4", children: _jsx(TableSkeleton, { rows: 8, columns: 7 }) })) : (_jsx("div", { className: "mt-4 hidden overflow-hidden overflow-x-auto rounded-xl border border-border bg-card sm:block", children: _jsxs(Table, { className: "min-w-[1000px]", children: [_jsx(TableHeader, { children: _jsxs(TableRow, { className: "bg-muted/40", children: [_jsx(TableHead, { children: labels.columnDate }), _jsx(TableHead, { children: labels.columnCounterparty }), _jsx(TableHead, { children: labels.columnReference }), _jsx(TableHead, { children: labels.columnAccount }), _jsx(TableHead, { className: "text-right", children: labels.columnAmount }), _jsx(TableHead, { children: labels.columnDirection }), _jsx(TableHead, { children: labels.columnStatus })] }) }), _jsxs(TableBody, { children: [view.pageRows.map((row) => (_jsxs(TableRow, { className: "cursor-pointer", onClick: () => setOpenTransaction(row), children: [_jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: adapter.formatDate(row.booking_date) }), _jsx(TableCell, { className: "max-w-[220px] truncate font-medium text-foreground", children: row.counterparty_holder ?? "—" }), _jsx(TableCell, { className: "max-w-[260px] truncate text-sm text-muted-foreground", children: row.payment_reference ?? row.booking_text ?? "—" }), _jsx(TableCell, { className: "text-sm text-muted-foreground", children: accountById.get(row.account_id)?.account_name ?? "—" }), _jsx(TableCell, { className: "text-right font-medium tabular-nums", children: adapter.formatMoney(row.amount) }), _jsx(TableCell, { children: _jsx(DirectionBadge, { direction: row.direction }) }), _jsx(TableCell, { children: _jsx(MatchStatusBadge, { status: row.matching_status, label: labels.matchingStatus }) })] }, row.id))), view.total === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 7, className: "py-12 text-center text-muted-foreground", children: labels.empty }) }))] })] }) })), !transactionsQuery.error && !transactionsQuery.loading && view.total > 0 && (_jsx(TablePagination, { page: view.page, totalPages: view.totalPages, pageSize: view.pageSize, total: view.total, from: view.from, to: view.to, onPage: view.setPage, onPageSize: view.setPageSize })), _jsx(BankMatchPanel, { transaction: openTransaction, onClose: () => setOpenTransaction(null), adapter: adapter, labels: labels })] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function MatchStatusBadge({ status, label }: {
|
|
2
|
+
status: string | null;
|
|
3
|
+
label: (status: string) => string;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
export declare function DirectionBadge({ direction, className }: {
|
|
6
|
+
direction: string | null;
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/class-names.js";
|
|
3
|
+
const STATUS_TONE = {
|
|
4
|
+
matched: "bg-emerald-100 text-emerald-800",
|
|
5
|
+
bestaetigt: "bg-emerald-100 text-emerald-800",
|
|
6
|
+
suggested: "bg-amber-100 text-amber-800",
|
|
7
|
+
vorschlag: "bg-amber-100 text-amber-800",
|
|
8
|
+
multiple: "bg-amber-100 text-amber-800",
|
|
9
|
+
ignored: "bg-muted text-muted-foreground",
|
|
10
|
+
ignoriert: "bg-muted text-muted-foreground",
|
|
11
|
+
unmatched: "bg-red-100 text-red-800",
|
|
12
|
+
offen: "bg-red-100 text-red-800",
|
|
13
|
+
};
|
|
14
|
+
export function MatchStatusBadge({ status, label }) {
|
|
15
|
+
if (!status)
|
|
16
|
+
return _jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" });
|
|
17
|
+
return (_jsx("span", { className: cn("inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium", STATUS_TONE[status] ?? "bg-muted text-muted-foreground"), children: label(status) }));
|
|
18
|
+
}
|
|
19
|
+
export function DirectionBadge({ direction, className }) {
|
|
20
|
+
if (!direction)
|
|
21
|
+
return null;
|
|
22
|
+
const outgoing = direction === "ausgehend" || direction === "outgoing";
|
|
23
|
+
return (_jsx("span", { className: cn("inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium", outgoing ? "bg-rose-100 text-rose-800" : "bg-teal-100 text-teal-800", className), children: outgoing ? "−" : "+" }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BankTransactionsPage } from "./BankTransactionsPage";
|
|
2
|
+
export type { BankTransactionsPageProps } from "./BankTransactionsPage";
|
|
3
|
+
export { BankMatchPanel } from "./BankMatchPanel";
|
|
4
|
+
export { englishBankTransactionsLabels } from "./labels";
|
|
5
|
+
export type { BankTransactionsLabels } from "./labels";
|
|
6
|
+
export { MatchStatusBadge, DirectionBadge } from "./badges";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface BankTransactionsLabels {
|
|
2
|
+
title: string;
|
|
3
|
+
subtitle: string;
|
|
4
|
+
searchPlaceholder: string;
|
|
5
|
+
accountAll: string;
|
|
6
|
+
statusAll: string;
|
|
7
|
+
columnDate: string;
|
|
8
|
+
columnCounterparty: string;
|
|
9
|
+
columnReference: string;
|
|
10
|
+
columnAccount: string;
|
|
11
|
+
columnAmount: string;
|
|
12
|
+
columnType: string;
|
|
13
|
+
columnDirection: string;
|
|
14
|
+
columnStatus: string;
|
|
15
|
+
empty: string;
|
|
16
|
+
sortLabel: string;
|
|
17
|
+
sortAscending: string;
|
|
18
|
+
sortDescending: string;
|
|
19
|
+
matchingStatus: (status: string) => string;
|
|
20
|
+
panelTitle: string;
|
|
21
|
+
panelSubtitle: (account: string) => string;
|
|
22
|
+
candidatesTitle: string;
|
|
23
|
+
candidatesEmpty: string;
|
|
24
|
+
candidateConfirm: string;
|
|
25
|
+
candidateReject: string;
|
|
26
|
+
matchConfirmed: string;
|
|
27
|
+
matchRejected: string;
|
|
28
|
+
scoreLabel: (score: number) => string;
|
|
29
|
+
manualSearchToggle: string;
|
|
30
|
+
manualSearchPlaceholder: string;
|
|
31
|
+
manualSearchEmpty: string;
|
|
32
|
+
noReceiptButton: string;
|
|
33
|
+
noReceiptDialogTitle: string;
|
|
34
|
+
noReceiptReasonPlaceholder: string;
|
|
35
|
+
noReceiptConfirm: string;
|
|
36
|
+
noReceiptMarked: string;
|
|
37
|
+
noReceiptClear: string;
|
|
38
|
+
noReceiptCleared: string;
|
|
39
|
+
close: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const englishBankTransactionsLabels: BankTransactionsLabels;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const englishBankTransactionsLabels = {
|
|
2
|
+
title: "Bank reconciliation",
|
|
3
|
+
subtitle: "Match incoming bank movements to invoices.",
|
|
4
|
+
searchPlaceholder: "Search counterparty or reference",
|
|
5
|
+
accountAll: "All accounts",
|
|
6
|
+
statusAll: "All statuses",
|
|
7
|
+
columnDate: "Date",
|
|
8
|
+
columnCounterparty: "Counterparty",
|
|
9
|
+
columnReference: "Reference",
|
|
10
|
+
columnAccount: "Account",
|
|
11
|
+
columnAmount: "Amount",
|
|
12
|
+
columnType: "Type",
|
|
13
|
+
columnDirection: "Direction",
|
|
14
|
+
columnStatus: "Status",
|
|
15
|
+
empty: "No transactions found.",
|
|
16
|
+
sortLabel: "Sort by",
|
|
17
|
+
sortAscending: "Ascending",
|
|
18
|
+
sortDescending: "Descending",
|
|
19
|
+
matchingStatus: (status) => status,
|
|
20
|
+
panelTitle: "Match this transaction",
|
|
21
|
+
panelSubtitle: (account) => `Account: ${account}`,
|
|
22
|
+
candidatesTitle: "Suggested matches",
|
|
23
|
+
candidatesEmpty: "No suggested matches.",
|
|
24
|
+
candidateConfirm: "Confirm match",
|
|
25
|
+
candidateReject: "Not a match",
|
|
26
|
+
matchConfirmed: "Match confirmed.",
|
|
27
|
+
matchRejected: "Match rejected.",
|
|
28
|
+
scoreLabel: (score) => `${score}% match`,
|
|
29
|
+
manualSearchToggle: "Search manually",
|
|
30
|
+
manualSearchPlaceholder: "Search invoices…",
|
|
31
|
+
manualSearchEmpty: "No invoices found.",
|
|
32
|
+
noReceiptButton: "No receipt expected",
|
|
33
|
+
noReceiptDialogTitle: "Mark as no receipt expected",
|
|
34
|
+
noReceiptReasonPlaceholder: "Reason",
|
|
35
|
+
noReceiptConfirm: "Confirm",
|
|
36
|
+
noReceiptMarked: "Marked as no receipt expected.",
|
|
37
|
+
noReceiptClear: "Undo",
|
|
38
|
+
noReceiptCleared: "Cleared.",
|
|
39
|
+
close: "Close",
|
|
40
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SortDirection } from "./use-table-view";
|
|
2
|
+
export interface SortColumn {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function SortControl({ columns, sort, direction, onSort, onDirection, labels, }: {
|
|
7
|
+
columns: SortColumn[];
|
|
8
|
+
sort: string;
|
|
9
|
+
direction: SortDirection;
|
|
10
|
+
onSort: (key: string) => void;
|
|
11
|
+
onDirection: (direction: SortDirection) => void;
|
|
12
|
+
labels: {
|
|
13
|
+
sortLabel: string;
|
|
14
|
+
sortAscending: string;
|
|
15
|
+
sortDescending: string;
|
|
16
|
+
};
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
3
|
+
export function SortControl({ columns, sort, direction, onSort, onDirection, labels, }) {
|
|
4
|
+
return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [_jsx("span", { className: "hidden shrink-0 text-sm text-muted-foreground sm:inline", children: labels.sortLabel }), _jsx(Combobox, { value: sort, onValueChange: onSort, className: "w-full sm:w-48", options: columns }), _jsx(Combobox, { value: direction, onValueChange: (value) => onDirection(value), className: "w-full sm:w-40", options: [
|
|
5
|
+
{ value: "asc", label: labels.sortAscending },
|
|
6
|
+
{ value: "desc", label: labels.sortDescending },
|
|
7
|
+
] })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SortDirection = "asc" | "desc";
|
|
2
|
+
export interface TableView<Row> {
|
|
3
|
+
pageRows: Row[];
|
|
4
|
+
sort: string;
|
|
5
|
+
direction: SortDirection;
|
|
6
|
+
setSort: (key: string) => void;
|
|
7
|
+
setDirection: (direction: SortDirection) => void;
|
|
8
|
+
page: number;
|
|
9
|
+
setPage: (page: number) => void;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
setPageSize: (size: number) => void;
|
|
12
|
+
total: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function useTableView<Row>(rows: Row[], options: {
|
|
18
|
+
sortValue: (row: Row, key: string) => string | number;
|
|
19
|
+
initialSort: string;
|
|
20
|
+
initialDirection?: SortDirection;
|
|
21
|
+
initialPageSize?: number;
|
|
22
|
+
resetKey?: string;
|
|
23
|
+
}): TableView<Row>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
export function useTableView(rows, options) {
|
|
3
|
+
const { sortValue, initialSort, initialDirection = "asc", initialPageSize = 25, resetKey, } = options;
|
|
4
|
+
const [sort, setSortState] = useState(initialSort);
|
|
5
|
+
const [direction, setDirectionState] = useState(initialDirection);
|
|
6
|
+
const [page, setPage] = useState(1);
|
|
7
|
+
const [pageSize, setPageSize] = useState(initialPageSize);
|
|
8
|
+
const [seenResetKey, setSeenResetKey] = useState(resetKey);
|
|
9
|
+
if (resetKey !== seenResetKey) {
|
|
10
|
+
setSeenResetKey(resetKey);
|
|
11
|
+
setPage(1);
|
|
12
|
+
}
|
|
13
|
+
const sortedRows = useMemo(() => {
|
|
14
|
+
const copy = [...rows];
|
|
15
|
+
copy.sort((first, second) => {
|
|
16
|
+
const firstValue = sortValue(first, sort);
|
|
17
|
+
const secondValue = sortValue(second, sort);
|
|
18
|
+
const comparison = typeof firstValue === "number" && typeof secondValue === "number"
|
|
19
|
+
? firstValue - secondValue
|
|
20
|
+
: String(firstValue).localeCompare(String(secondValue));
|
|
21
|
+
return direction === "asc" ? comparison : -comparison;
|
|
22
|
+
});
|
|
23
|
+
return copy;
|
|
24
|
+
}, [rows, sort, direction, sortValue]);
|
|
25
|
+
const total = sortedRows.length;
|
|
26
|
+
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
27
|
+
const safePage = Math.min(page, totalPages);
|
|
28
|
+
const from = total === 0 ? 0 : (safePage - 1) * pageSize + 1;
|
|
29
|
+
const to = Math.min(safePage * pageSize, total);
|
|
30
|
+
const pageRows = sortedRows.slice((safePage - 1) * pageSize, safePage * pageSize);
|
|
31
|
+
function setSort(key) {
|
|
32
|
+
setSortState(key);
|
|
33
|
+
setPage(1);
|
|
34
|
+
}
|
|
35
|
+
function setDirection(next) {
|
|
36
|
+
setDirectionState(next);
|
|
37
|
+
setPage(1);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
pageRows,
|
|
41
|
+
sort,
|
|
42
|
+
direction,
|
|
43
|
+
setSort,
|
|
44
|
+
setDirection,
|
|
45
|
+
page: safePage,
|
|
46
|
+
setPage,
|
|
47
|
+
pageSize,
|
|
48
|
+
setPageSize,
|
|
49
|
+
total,
|
|
50
|
+
totalPages,
|
|
51
|
+
from,
|
|
52
|
+
to,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CategoryRulesAdapter } from "../../adapters/category-rules";
|
|
2
|
+
import { type CategoryRulesLabels } from "./labels";
|
|
3
|
+
export interface CategoryRulesPageProps {
|
|
4
|
+
adapter: CategoryRulesAdapter;
|
|
5
|
+
labels?: CategoryRulesLabels;
|
|
6
|
+
}
|
|
7
|
+
export declare function CategoryRulesPage({ adapter, labels }: CategoryRulesPageProps): import("react").JSX.Element;
|