@powerhousedao/contributor-billing 0.1.29 → 0.1.31
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 +165 -8
- package/dist/document-models/billing-statement/actions.d.ts +1 -0
- package/dist/document-models/billing-statement/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.js +58 -47
- package/dist/document-models/billing-statement/gen/document-schema.d.ts +38 -38
- package/dist/document-models/billing-statement/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +6 -2
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts +3 -2
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.js +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/ph-factories.js +1 -1
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +5 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.js +5 -0
- package/dist/document-models/billing-statement/gen/utils.js +2 -2
- package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/general.js +5 -4
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/line-items.js +7 -2
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/tags.js +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.js +94 -7
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts +2 -1
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/general.test.js +33 -88
- package/dist/document-models/billing-statement/src/tests/line-items.test.js +22 -125
- package/dist/document-models/billing-statement/src/tests/tags.test.js +13 -47
- package/dist/document-models/document-models.js +2 -2
- package/dist/document-models/expense-report/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/expense-report/gen/document-model.js +48 -48
- package/dist/document-models/expense-report/gen/document-schema.d.ts +6 -6
- package/dist/document-models/expense-report/gen/utils.js +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.js +94 -8
- package/dist/document-models/expense-report/src/tests/wallet.test.js +145 -10
- package/dist/document-models/index.d.ts +2 -6
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +2 -6
- package/dist/document-models/integrations/gen/document-model.js +33 -33
- package/dist/document-models/integrations/gen/document-schema.d.ts +6 -6
- package/dist/document-models/integrations/gen/utils.js +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.js +9 -32
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/integrations/src/tests/document-model.test.js +91 -5
- package/dist/document-models/integrations/src/tests/integrations.test.js +21 -46
- package/dist/document-models/invoice/gen/document-model.js +147 -147
- package/dist/document-models/invoice/gen/document-schema.d.ts +127 -127
- package/dist/document-models/invoice/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.js +16 -122
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +4 -4
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +17 -123
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +34 -10
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +7 -7
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +96 -50
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/transitions.js +69 -53
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/invoice/src/tests/document-model.test.js +91 -4
- package/dist/document-models/invoice/src/tests/general.test.js +24 -26
- package/dist/document-models/invoice/src/tests/items.test.js +37 -17
- package/dist/document-models/invoice/src/tests/parties.test.js +32 -26
- package/dist/document-models/invoice/src/tests/transitions.test.js +52 -500
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -1
- package/dist/document-models/invoice/utils/statusTransitions.js +10 -10
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +32 -23
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/objectSetTable.js +1 -2
- package/dist/editors/billing-statement/editor.d.ts +4 -0
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +34 -16
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +36 -37
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +28 -10
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.js +18 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveContents.js +10 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts +7 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.js +16 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/EmptyState.js +10 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Files.js +12 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/FolderTree.js +65 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Folders.js +12 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/clean-new-editor/config.d.ts +4 -0
- package/dist/editors/clean-new-editor/config.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/config.js +5 -0
- package/dist/editors/clean-new-editor/editor.d.ts +4 -0
- package/dist/editors/clean-new-editor/editor.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/editor.js +11 -0
- package/dist/editors/clean-new-editor/module.d.ts +3 -0
- package/dist/editors/clean-new-editor/module.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/module.js +10 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts +14 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.js +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts +3 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DriveContents.js +10 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +3 -3
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +13 -180
- package/dist/editors/contributor-billing/components/EmptyState.d.ts +3 -0
- package/dist/editors/contributor-billing/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/EmptyState.js +10 -0
- package/dist/editors/contributor-billing/components/Files.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Files.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Files.js +12 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +6 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderTree.js +65 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Folders.js +12 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts +38 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/HeaderControls.js +124 -0
- package/dist/editors/contributor-billing/components/HeaderStats.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.js → HeaderStats.js} +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts +22 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.js +399 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts +6 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.js +111 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts +32 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.js +55 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts +13 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.js +16 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/contributor-billing/config.d.ts +1 -0
- package/dist/editors/contributor-billing/config.d.ts.map +1 -1
- package/dist/editors/contributor-billing/config.js +4 -1
- package/dist/editors/contributor-billing/editor.d.ts +1 -0
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +4 -1
- package/dist/editors/contributor-billing/module.d.ts +1 -1
- package/dist/editors/contributor-billing/module.d.ts.map +1 -1
- package/dist/editors/contributor-billing/module.js +3 -2
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts +15 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts.map +1 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.js +122 -0
- package/dist/editors/editors.js +2 -2
- package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts.map +1 -1
- package/dist/editors/expense-report/editor.js +8 -8
- package/dist/editors/index.d.ts +2 -2
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/editors/integrations/components/EditName.d.ts +3 -0
- package/dist/editors/integrations/components/EditName.d.ts.map +1 -0
- package/dist/editors/integrations/components/EditName.js +31 -0
- package/dist/editors/integrations/editor.d.ts +2 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +5 -132
- package/dist/editors/integrations/module.d.ts +1 -0
- package/dist/editors/integrations/module.d.ts.map +1 -1
- package/dist/editors/integrations/module.js +3 -2
- package/dist/editors/invoice/components/confirmationModal.js +1 -1
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/countryForm.js +1 -1
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/currencyForm.js +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -1
- package/dist/editors/invoice/components/datePicker.js +1 -1
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -1
- package/dist/editors/invoice/components/inputField.js +3 -2
- package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/components/lineItemMobileModal.js +1 -1
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/selectField.js +7 -7
- package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -1
- package/dist/editors/invoice/components/statusModalComponents.js +27 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +102 -40
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
- package/dist/editors/invoice/exportUBL.js +35 -18
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +15 -9
- package/dist/editors/invoice/invoiceToGnosis.js +2 -2
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.js +3 -3
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.js +4 -3
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/module.d.ts +1 -0
- package/dist/editors/invoice/module.d.ts.map +1 -1
- package/dist/editors/invoice/module.js +2 -1
- package/dist/editors/invoice/requestFinance.js +3 -3
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +4 -3
- package/dist/editors/invoice/utils/utils.d.ts.map +1 -1
- package/dist/editors/invoice/utils/utils.js +5 -4
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +11 -5
- package/dist/editors/invoice/validation/validationManager.d.ts +2 -2
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +5 -5
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +178 -178
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts +7 -0
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/DriveExplorer.js +184 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts +2 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.js +73 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.js +1 -1
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/RowActionMenu.d.ts +1 -1
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
- package/dist/old-contributor-billing/config.d.ts +3 -0
- package/dist/old-contributor-billing/config.d.ts.map +1 -0
- package/dist/old-contributor-billing/config.js +4 -0
- package/dist/old-contributor-billing/editor.d.ts +3 -0
- package/dist/old-contributor-billing/editor.d.ts.map +1 -0
- package/dist/old-contributor-billing/editor.js +8 -0
- package/dist/old-contributor-billing/module.d.ts +3 -0
- package/dist/old-contributor-billing/module.d.ts.map +1 -0
- package/dist/old-contributor-billing/module.js +9 -0
- package/dist/old-contributor-billing/util.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/util.js +11 -9
- package/dist/powerhouse.manifest.json +6 -41
- package/dist/processors/index.d.ts +1 -6
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -18
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createExpenseReportCsv.js +24 -24
- package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createXeroCsv.js +52 -46
- package/dist/scripts/invoice/autoTagging.d.ts +1 -1
- package/dist/scripts/invoice/autoTagging.d.ts.map +1 -1
- package/dist/scripts/invoice/autoTagging.js +168 -138
- package/dist/scripts/invoice/exampleBatchTxn.js +16 -16
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +32 -25
- package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
- package/dist/scripts/invoice/pdfToClaudeAI.js +36 -30
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
- package/dist/scripts/invoice/requestFinance.js +13 -13
- package/dist/style.css +407 -13659
- package/dist/subgraphs/billing-statement/resolvers.d.ts +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +16 -5
- package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/schema.js +12 -67
- package/dist/subgraphs/expense-report/resolvers.d.ts +1 -1
- package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/resolvers.js +4 -5
- package/dist/subgraphs/expense-report/schema.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/schema.js +5 -48
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/integrations/resolvers.d.ts +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +4 -5
- package/dist/subgraphs/integrations/schema.d.ts.map +1 -1
- package/dist/subgraphs/integrations/schema.js +3 -43
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/index.js +1 -20
- package/dist/subgraphs/invoice/resolvers.d.ts +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +4 -9
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +14 -232
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.d.ts +1 -1
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -0
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.js +38 -34
- package/dist/subgraphs/invoice-addon/index.d.ts +11 -0
- package/dist/subgraphs/invoice-addon/index.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/index.js +11 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/resolvers.js +12 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/schema.js +52 -0
- package/package.json +9 -21
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +0 -8
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/actions.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +0 -4
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.js +0 -3
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts +0 -2
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/error.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +0 -7
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.js +0 -3
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +0 -6
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +0 -1
- package/dist/document-models/expense-report/src/tests/expense-report.test.js +0 -24
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +0 -2
- package/dist/editors/contributor-billing/util.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.d.ts +0 -4
- package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.js +0 -8
- package/dist/editors/hooks/useExpenseReportDocument.d.ts +0 -4
- package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useExpenseReportDocument.js +0 -8
- package/dist/editors/hooks/useIntegrationsDocument.d.ts +0 -4
- package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useIntegrationsDocument.js +0 -8
- package/dist/editors/hooks/useInvoiceDocument.d.ts +0 -4
- package/dist/editors/hooks/useInvoiceDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useInvoiceDocument.js +0 -8
- package/dist/editors/integrations/config.d.ts +0 -3
- package/dist/editors/integrations/config.d.ts.map +0 -1
- package/dist/editors/integrations/config.js +0 -3
- package/dist/editors/invoice/exportSAFTPT.d.ts +0 -184
- package/dist/editors/invoice/exportSAFTPT.d.ts.map +0 -1
- package/dist/editors/invoice/exportSAFTPT.js +0 -548
- package/dist/processors/line-item-processor/index.d.ts +0 -11
- package/dist/processors/line-item-processor/index.d.ts.map +0 -1
- package/dist/processors/line-item-processor/index.js +0 -36
- package/dist/subgraphs/invoice/customResolvers.d.ts.map +0 -1
- package/editors/invoice/assets/custom.d.ts +0 -4
- package/editors/invoice/assets/powerhouseLogo.png +0 -0
- /package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.d.ts → HeaderStats.d.ts} +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/util.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FileNode } from "document-drive";
|
|
2
|
+
export interface StatusOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export type { FileNode };
|
|
7
|
+
interface HeaderControlsProps {
|
|
8
|
+
statusOptions?: StatusOption[];
|
|
9
|
+
selectedStatuses?: string[];
|
|
10
|
+
onStatusChange?: (value: string | string[]) => void;
|
|
11
|
+
onSearchChange?: (value: string) => void;
|
|
12
|
+
onExport?: (baseCurrency: string) => void;
|
|
13
|
+
onExpenseReportExport?: (baseCurrency: string) => void;
|
|
14
|
+
createIntegrationsDocument?: () => void;
|
|
15
|
+
integrationsDoc?: FileNode;
|
|
16
|
+
canExport?: boolean;
|
|
17
|
+
hasBillingStatements?: boolean;
|
|
18
|
+
expenseReportDoc?: FileNode;
|
|
19
|
+
onCreateOrOpenExpenseReport?: () => void;
|
|
20
|
+
selected?: Record<string, boolean>;
|
|
21
|
+
handleCreateBillingStatement: (id: string) => Promise<void>;
|
|
22
|
+
setSelected: (selected: Record<string, boolean>) => void;
|
|
23
|
+
invoices?: Array<{
|
|
24
|
+
header: {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
billingStatements?: Array<{
|
|
30
|
+
header: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
canExportSelectedRows: () => boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare const HeaderControls: ({ statusOptions, selectedStatuses, onStatusChange, onSearchChange, onExport, onExpenseReportExport, createIntegrationsDocument, integrationsDoc, hasBillingStatements, expenseReportDoc, onCreateOrOpenExpenseReport, selected, handleCreateBillingStatement, setSelected, invoices, billingStatements, canExportSelectedRows, }: HeaderControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=HeaderControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/HeaderControls.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW/C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,UAAU,mBAAmB;IAC3B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,QAAQ,CAAC;IAC5B,2BAA2B,CAAC,EAAE,MAAM,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,4BAA4B,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;IAC3D,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;IACpE,qBAAqB,EAAE,MAAM,OAAO,CAAC;CACtC;AAED,eAAO,MAAM,cAAc,GAAI,kUAkB5B,mBAAmB,4CAuPrB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Select } from "@powerhousedao/document-engineering/ui";
|
|
4
|
+
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
+
import { ConfirmationModal } from "./ConfirmationModal.js";
|
|
6
|
+
const currencyOptions = [
|
|
7
|
+
{ label: "CHF", value: "CHF" },
|
|
8
|
+
{ label: "USD", value: "USD" },
|
|
9
|
+
{ label: "EUR", value: "EUR" },
|
|
10
|
+
{ label: "GBP", value: "GBP" },
|
|
11
|
+
{ label: "JPY", value: "JPY" },
|
|
12
|
+
];
|
|
13
|
+
export const HeaderControls = ({ statusOptions = [], selectedStatuses = [], onStatusChange, onSearchChange, onExport, onExpenseReportExport, createIntegrationsDocument, integrationsDoc, hasBillingStatements = false, expenseReportDoc, onCreateOrOpenExpenseReport, selected = {}, handleCreateBillingStatement, setSelected, invoices = [], billingStatements = [], canExportSelectedRows, }) => {
|
|
14
|
+
const batchOptions = [
|
|
15
|
+
{ label: "Generate Bill Statements", value: "generate-bills" },
|
|
16
|
+
{
|
|
17
|
+
label: "Export CSV Expense Report",
|
|
18
|
+
value: "export-csv-expense-report",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
const [showCurrencyModal, setShowCurrencyModal] = useState(false);
|
|
22
|
+
const [selectedCurrency, setSelectedCurrency] = useState("CHF");
|
|
23
|
+
const [showExpenseReportCurrencyModal, setShowExpenseReportCurrencyModal] = useState(false);
|
|
24
|
+
const [selectedExpenseReportCurrency, setSelectedExpenseReportCurrency] = useState("CHF");
|
|
25
|
+
const [selectedBatchAction, setSelectedBatchAction] = useState(undefined);
|
|
26
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
27
|
+
// Simple batch action handler - matches working old code pattern
|
|
28
|
+
const handleBatchAction = async (action) => {
|
|
29
|
+
if (action === "export-csv-expense-report") {
|
|
30
|
+
setShowExpenseReportCurrencyModal(true);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (action === "generate-bills") {
|
|
34
|
+
const selectedIds = Object.keys(selected).filter((id) => selected[id]);
|
|
35
|
+
if (selectedIds.length === 0) {
|
|
36
|
+
toast("No invoices selected", { type: "warning" });
|
|
37
|
+
setTimeout(() => setSelectedBatchAction(undefined), 0);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Check for existing billing statements
|
|
41
|
+
const existingBills = [];
|
|
42
|
+
const invoicesToProcess = [];
|
|
43
|
+
selectedIds.forEach((id) => {
|
|
44
|
+
const invoice = invoices.find((doc) => doc.header.id === id);
|
|
45
|
+
if (invoice) {
|
|
46
|
+
const invoiceName = invoice.header.name || "";
|
|
47
|
+
const expectedBillName = `bill-${invoiceName}`;
|
|
48
|
+
const existingBill = billingStatements.find((bill) => bill.header.name === expectedBillName);
|
|
49
|
+
if (existingBill) {
|
|
50
|
+
existingBills.push(invoiceName);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
invoicesToProcess.push(id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// Notify user if bills already exist
|
|
58
|
+
if (existingBills.length > 0) {
|
|
59
|
+
const updatedSelected = { ...selected };
|
|
60
|
+
selectedIds.forEach((id) => {
|
|
61
|
+
updatedSelected[id] = false;
|
|
62
|
+
});
|
|
63
|
+
setSelected(updatedSelected);
|
|
64
|
+
const billNames = existingBills.join(", ");
|
|
65
|
+
toast(`Billing statements already exist for: ${billNames}`, {
|
|
66
|
+
type: "warning",
|
|
67
|
+
});
|
|
68
|
+
setTimeout(() => setSelectedBatchAction(undefined), 0);
|
|
69
|
+
}
|
|
70
|
+
if (selectedIds.length > 0 &&
|
|
71
|
+
invoicesToProcess.length === 0 &&
|
|
72
|
+
existingBills.length === 0) {
|
|
73
|
+
const updatedSelected = { ...selected };
|
|
74
|
+
selectedIds.forEach((id) => {
|
|
75
|
+
updatedSelected[id] = false;
|
|
76
|
+
});
|
|
77
|
+
setSelected(updatedSelected);
|
|
78
|
+
toast("Invoice not ready, change status to ISSUED", {
|
|
79
|
+
type: "warning",
|
|
80
|
+
});
|
|
81
|
+
setTimeout(() => setSelectedBatchAction(undefined), 0);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// Process invoices sequentially
|
|
85
|
+
if (invoicesToProcess.length > 0) {
|
|
86
|
+
setIsProcessing(true);
|
|
87
|
+
for (const id of invoicesToProcess) {
|
|
88
|
+
await handleCreateBillingStatement(id);
|
|
89
|
+
}
|
|
90
|
+
setIsProcessing(false);
|
|
91
|
+
}
|
|
92
|
+
// Update selection
|
|
93
|
+
const updatedSelected = { ...selected };
|
|
94
|
+
invoicesToProcess.forEach((id) => {
|
|
95
|
+
updatedSelected[id] = false;
|
|
96
|
+
});
|
|
97
|
+
setSelected(updatedSelected);
|
|
98
|
+
setTimeout(() => setSelectedBatchAction(undefined), 100);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
// Use the function to determine if export should be enabled based on selected rows
|
|
102
|
+
const canExport = canExportSelectedRows ? canExportSelectedRows() : false;
|
|
103
|
+
// const handleSettingsClick = () => {
|
|
104
|
+
// if (!integrationsDoc) {
|
|
105
|
+
// createIntegrationsDocument?.();
|
|
106
|
+
// } else {
|
|
107
|
+
// setSelectedNode(integrationsDoc.id);
|
|
108
|
+
// }
|
|
109
|
+
// };
|
|
110
|
+
return (_jsxs("div", { className: "contributor-billing-controls flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center flex-wrap gap-2", children: [_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("div", { className: "w-[180px]", children: _jsx(Select, { options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true, value: selectedStatuses }) }), _jsx("input", { type: "text", className: "border border-gray-300 rounded px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { type: "button", className: `bg-white border border-gray-300 rounded px-3 py-1.5 text-sm font-medium transition-colors ${hasBillingStatements
|
|
111
|
+
? "hover:bg-gray-50"
|
|
112
|
+
: "opacity-50 cursor-not-allowed"}`, onClick: onCreateOrOpenExpenseReport, disabled: !hasBillingStatements, children: expenseReportDoc ? "Expense Report" : "Create Expense Report" }), _jsx("button", { type: "button", className: `bg-white border border-gray-300 rounded px-3 py-1.5 text-sm font-medium transition-colors ${canExport ? "hover:bg-gray-50" : "opacity-50 cursor-not-allowed"}`, onClick: () => {
|
|
113
|
+
setShowCurrencyModal(true);
|
|
114
|
+
}, disabled: !canExport, children: "Export to CSV" }), _jsx("div", { className: "w-[180px]", children: _jsx(Select, { contentClassName: "w-[240px]", options: batchOptions, value: selectedBatchAction, onChange: (value) => {
|
|
115
|
+
setSelectedBatchAction(value);
|
|
116
|
+
void handleBatchAction(value);
|
|
117
|
+
}, placeholder: "Batch Action", disabled: isProcessing }) })] })] }), _jsxs(ConfirmationModal, { open: showCurrencyModal, onCancel: () => setShowCurrencyModal(false), onContinue: () => {
|
|
118
|
+
setShowCurrencyModal(false);
|
|
119
|
+
onExport?.(selectedCurrency);
|
|
120
|
+
}, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { className: "text-red-600 text-sm mb-3 font-medium", children: "Warning: the chosen currency should match the base currency of the accounting system." }), _jsx("div", { className: "w-[200px]", children: _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency", value: selectedCurrency }) })] }), _jsxs(ConfirmationModal, { open: showExpenseReportCurrencyModal, onCancel: () => setShowExpenseReportCurrencyModal(false), onContinue: () => {
|
|
121
|
+
setShowExpenseReportCurrencyModal(false);
|
|
122
|
+
onExpenseReportExport?.(selectedExpenseReportCurrency);
|
|
123
|
+
}, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { className: "text-red-600 text-sm mb-3 font-medium", children: "Warning: the chosen currency should match the base currency of the accounting system." }), _jsx("div", { className: "w-[200px]", children: _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedExpenseReportCurrency(value), placeholder: "Select Base Currency", value: selectedExpenseReportCurrency }) })] })] }));
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderStats.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/HeaderStats.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,WAAW,+CAoHvB,CAAC"}
|
package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.js → HeaderStats.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Select } from "@powerhousedao/document-engineering/ui";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { useDocumentsInSelectedDrive } from "@powerhousedao/reactor-browser";
|
|
5
|
-
import { getExchangeRate } from "
|
|
5
|
+
import { getExchangeRate } from "../utils/exchangeRate.js";
|
|
6
6
|
import { Tooltip, TooltipProvider } from "@powerhousedao/design-system/ui";
|
|
7
7
|
const currencyList = [
|
|
8
8
|
{ ticker: "USDS", crypto: true },
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type VetraDocumentModelModule } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import type { PHDocument } from "document-model";
|
|
3
|
+
import type { FileNode } from "document-drive";
|
|
4
|
+
export declare const statusOptions: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
interface InvoiceTableProps {
|
|
9
|
+
files: FileNode[];
|
|
10
|
+
selected: Record<string, boolean>;
|
|
11
|
+
setSelected: (selected: Record<string, boolean> | ((prev: Record<string, boolean>) => Record<string, boolean>)) => void;
|
|
12
|
+
filteredDocumentModels: VetraDocumentModelModule[];
|
|
13
|
+
onSelectDocumentModel: (model: VetraDocumentModelModule) => void;
|
|
14
|
+
getDocDispatcher: (id: string) => [PHDocument, (action: unknown) => Promise<void>] | null;
|
|
15
|
+
selectedStatuses: string[];
|
|
16
|
+
onStatusChange: (value: string | string[]) => void;
|
|
17
|
+
onRowSelection: (rowId: string, checked: boolean, rowStatus: string) => void;
|
|
18
|
+
canExportSelectedRows: () => boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const InvoiceTable: ({ files, selected, setSelected, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, selectedStatuses, onStatusChange, onRowSelection, canExportSelectedRows, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=InvoiceTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/InvoiceTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,wBAAwB,EAC9B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA6D/C,eAAO,MAAM,aAAa;;;GAUzB,CAAC;AAeF,UAAU,iBAAiB;IACzB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,WAAW,EAAE,CACX,QAAQ,EACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC7D,IAAI,CAAC;IACV,sBAAsB,EAAE,wBAAwB,EAAE,CAAC;IACnD,qBAAqB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,CAChB,EAAE,EAAE,MAAM,KACP,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7D,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,qBAAqB,EAAE,MAAM,OAAO,CAAC;CACtC;AA6BD,eAAO,MAAM,YAAY,GAAI,6KAW1B,iBAAiB,4CAijBnB,CAAC"}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo, useState, useEffect } from "react";
|
|
3
|
+
import { addDocument, dispatchActions, setSelectedNode, useSelectedDrive, useDocumentsInSelectedDrive, } from "@powerhousedao/reactor-browser";
|
|
4
|
+
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
+
import { actions as invoiceActions } from "../../../document-models/invoice/index.js";
|
|
6
|
+
import { actions as billingStatementActions } from "../../../document-models/billing-statement/index.js";
|
|
7
|
+
import { mapTags } from "../../billing-statement/lineItemTags/tagMapping.js";
|
|
8
|
+
import { exportInvoicesToXeroCSV } from "../../../scripts/contributor-billing/createXeroCsv.js";
|
|
9
|
+
import { exportExpenseReportCSV } from "../../../scripts/contributor-billing/createExpenseReportCsv.js";
|
|
10
|
+
import { HeaderControls } from "./HeaderControls.js";
|
|
11
|
+
import { InvoiceTableSection } from "./InvoiceTableSection.js";
|
|
12
|
+
import { InvoiceTableRow } from "./InvoiceTableRow.js";
|
|
13
|
+
// Helper to convert partial tags to InvoiceTag array
|
|
14
|
+
const toInvoiceTags = (tags) => {
|
|
15
|
+
if (!tags)
|
|
16
|
+
return [];
|
|
17
|
+
return tags
|
|
18
|
+
.filter((tag) => typeof tag.dimension === "string" && typeof tag.value === "string")
|
|
19
|
+
.map((tag) => ({
|
|
20
|
+
dimension: tag.dimension,
|
|
21
|
+
value: tag.value,
|
|
22
|
+
label: tag.label ?? null,
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
// Status options for filter
|
|
26
|
+
export const statusOptions = [
|
|
27
|
+
{ label: "Draft", value: "DRAFT" },
|
|
28
|
+
{ label: "Issued", value: "ISSUED" },
|
|
29
|
+
{ label: "Accepted", value: "ACCEPTED" },
|
|
30
|
+
{ label: "Payment Scheduled", value: "PAYMENTSCHEDULED" },
|
|
31
|
+
{ label: "Payment Sent", value: "PAYMENTSENT" },
|
|
32
|
+
{ label: "Payment Issue", value: "PAYMENTISSUE" },
|
|
33
|
+
{ label: "Payment Closed", value: "PAYMENTCLOSED" },
|
|
34
|
+
{ label: "Rejected", value: "REJECTED" },
|
|
35
|
+
{ label: "Other", value: "OTHER" },
|
|
36
|
+
];
|
|
37
|
+
// Status color mappings
|
|
38
|
+
const statusColors = {
|
|
39
|
+
DRAFT: "bg-blue-100 text-blue-600",
|
|
40
|
+
ISSUED: "bg-blue-100 text-blue-600",
|
|
41
|
+
ACCEPTED: "bg-green-100 text-green-600",
|
|
42
|
+
PAYMENTSCHEDULED: "bg-green-100 text-green-600",
|
|
43
|
+
PAYMENTSENT: "bg-green-100 text-green-600",
|
|
44
|
+
PAYMENTISSUE: "bg-yellow-100 text-yellow-600",
|
|
45
|
+
PAYMENTCLOSED: "bg-red-100 text-red-600",
|
|
46
|
+
REJECTED: "bg-red-100 text-red-600",
|
|
47
|
+
OTHER: "bg-blue-100 text-blue-600",
|
|
48
|
+
};
|
|
49
|
+
// Table header component
|
|
50
|
+
const TableHeader = ({ showIssuer = true, showBillingStatement = false, }) => (_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50 font-medium text-gray-500 text-xs", children: [_jsx("th", { className: "px-2 py-2 w-8 rounded-tl-sm" }), _jsx("th", { className: "px-2 py-2 text-center", children: showIssuer ? "Issuer" : "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), showBillingStatement && (_jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" })), _jsx("th", { className: "px-2 py-2 rounded-tr-sm text-center", children: "Exported" })] }) }));
|
|
51
|
+
export const InvoiceTable = ({ files, selected, setSelected, filteredDocumentModels, onSelectDocumentModel, getDocDispatcher, selectedStatuses, onStatusChange, onRowSelection, canExportSelectedRows, }) => {
|
|
52
|
+
const [selectedDrive] = useSelectedDrive();
|
|
53
|
+
// State to track when export actions complete, triggering page refresh
|
|
54
|
+
const [actionsCompleted, setActionsCompleted] = useState(0);
|
|
55
|
+
// Get documents directly from the hook - this will automatically update when documents change
|
|
56
|
+
const allDocuments = useDocumentsInSelectedDrive() || [];
|
|
57
|
+
// Refresh page when actions complete to ensure state is updated
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (actionsCompleted > 0) {
|
|
60
|
+
window.location.reload();
|
|
61
|
+
}
|
|
62
|
+
}, [actionsCompleted]);
|
|
63
|
+
// Helper function to map invoice document to InvoiceRowData
|
|
64
|
+
const mapInvoiceToRowData = (doc) => {
|
|
65
|
+
const state = doc.state;
|
|
66
|
+
return {
|
|
67
|
+
id: doc.header.id,
|
|
68
|
+
issuer: state.global?.issuer?.name || "Unknown",
|
|
69
|
+
status: state.global?.status || "",
|
|
70
|
+
invoiceNo: state.global?.invoiceNo || "",
|
|
71
|
+
issueDate: state.global?.dateIssued || "",
|
|
72
|
+
dueDate: state.global?.dateDue || "",
|
|
73
|
+
currency: state.global?.currency || "",
|
|
74
|
+
amount: state.global?.totalPriceTaxIncl?.toString() || "",
|
|
75
|
+
exported: state.global?.exported,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
// Memoize billing doc states - updates automatically when allDocuments changes
|
|
79
|
+
const billingDocStates = useMemo(() => {
|
|
80
|
+
return allDocuments
|
|
81
|
+
.filter((doc) => doc.header.documentType === "powerhouse/billing-statement")
|
|
82
|
+
.map((doc) => {
|
|
83
|
+
const state = doc.state;
|
|
84
|
+
return {
|
|
85
|
+
id: doc.header.id,
|
|
86
|
+
contributor: state.global?.contributor || "",
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}, [allDocuments]);
|
|
90
|
+
// Memoize filtered invoice lists - they'll automatically update when allDocuments changes
|
|
91
|
+
const draft = useMemo(() => {
|
|
92
|
+
return allDocuments
|
|
93
|
+
.filter((doc) => {
|
|
94
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
95
|
+
return false;
|
|
96
|
+
const state = doc.state;
|
|
97
|
+
return state.global?.status === "DRAFT";
|
|
98
|
+
})
|
|
99
|
+
.map(mapInvoiceToRowData);
|
|
100
|
+
}, [allDocuments]);
|
|
101
|
+
const issued = useMemo(() => {
|
|
102
|
+
return allDocuments
|
|
103
|
+
.filter((doc) => {
|
|
104
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
105
|
+
return false;
|
|
106
|
+
const state = doc.state;
|
|
107
|
+
return state.global?.status === "ISSUED";
|
|
108
|
+
})
|
|
109
|
+
.map(mapInvoiceToRowData);
|
|
110
|
+
}, [allDocuments]);
|
|
111
|
+
const accepted = useMemo(() => {
|
|
112
|
+
return allDocuments
|
|
113
|
+
.filter((doc) => {
|
|
114
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
115
|
+
return false;
|
|
116
|
+
const state = doc.state;
|
|
117
|
+
return state.global?.status === "ACCEPTED";
|
|
118
|
+
})
|
|
119
|
+
.map(mapInvoiceToRowData);
|
|
120
|
+
}, [allDocuments]);
|
|
121
|
+
const paymentScheduled = useMemo(() => {
|
|
122
|
+
return allDocuments
|
|
123
|
+
.filter((doc) => {
|
|
124
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
125
|
+
return false;
|
|
126
|
+
const state = doc.state;
|
|
127
|
+
return state.global?.status === "PAYMENTSCHEDULED";
|
|
128
|
+
})
|
|
129
|
+
.map(mapInvoiceToRowData);
|
|
130
|
+
}, [allDocuments]);
|
|
131
|
+
const paymentSent = useMemo(() => {
|
|
132
|
+
return allDocuments
|
|
133
|
+
.filter((doc) => {
|
|
134
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
135
|
+
return false;
|
|
136
|
+
const state = doc.state;
|
|
137
|
+
return state.global?.status === "PAYMENTSENT";
|
|
138
|
+
})
|
|
139
|
+
.map(mapInvoiceToRowData);
|
|
140
|
+
}, [allDocuments]);
|
|
141
|
+
const paymentIssue = useMemo(() => {
|
|
142
|
+
return allDocuments
|
|
143
|
+
.filter((doc) => {
|
|
144
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
145
|
+
return false;
|
|
146
|
+
const state = doc.state;
|
|
147
|
+
return state.global?.status === "PAYMENTISSUE";
|
|
148
|
+
})
|
|
149
|
+
.map(mapInvoiceToRowData);
|
|
150
|
+
}, [allDocuments]);
|
|
151
|
+
const paymentClosed = useMemo(() => {
|
|
152
|
+
return allDocuments
|
|
153
|
+
.filter((doc) => {
|
|
154
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
155
|
+
return false;
|
|
156
|
+
const state = doc.state;
|
|
157
|
+
return state.global?.status === "PAYMENTCLOSED";
|
|
158
|
+
})
|
|
159
|
+
.map(mapInvoiceToRowData);
|
|
160
|
+
}, [allDocuments]);
|
|
161
|
+
const rejected = useMemo(() => {
|
|
162
|
+
return allDocuments
|
|
163
|
+
.filter((doc) => {
|
|
164
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
165
|
+
return false;
|
|
166
|
+
const state = doc.state;
|
|
167
|
+
return state.global?.status === "REJECTED";
|
|
168
|
+
})
|
|
169
|
+
.map(mapInvoiceToRowData);
|
|
170
|
+
}, [allDocuments]);
|
|
171
|
+
const otherInvoices = useMemo(() => {
|
|
172
|
+
const knownStatuses = [
|
|
173
|
+
"DRAFT",
|
|
174
|
+
"ISSUED",
|
|
175
|
+
"ACCEPTED",
|
|
176
|
+
"PAYMENTSCHEDULED",
|
|
177
|
+
"PAYMENTSENT",
|
|
178
|
+
"PAYMENTISSUE",
|
|
179
|
+
"PAYMENTCLOSED",
|
|
180
|
+
"REJECTED",
|
|
181
|
+
];
|
|
182
|
+
return allDocuments
|
|
183
|
+
.filter((doc) => {
|
|
184
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
185
|
+
return false;
|
|
186
|
+
const state = doc.state;
|
|
187
|
+
return !knownStatuses.includes(state.global?.status || "");
|
|
188
|
+
})
|
|
189
|
+
.map((doc) => {
|
|
190
|
+
const state = doc.state;
|
|
191
|
+
return {
|
|
192
|
+
id: doc.header.id,
|
|
193
|
+
issuer: state.global?.issuer?.name || "Unknown",
|
|
194
|
+
status: state.global?.status || "OTHER",
|
|
195
|
+
invoiceNo: state.global?.invoiceNo || "",
|
|
196
|
+
issueDate: state.global?.dateIssued || "",
|
|
197
|
+
dueDate: state.global?.dateDue || "",
|
|
198
|
+
currency: state.global?.currency || "",
|
|
199
|
+
amount: state.global?.totalPriceTaxIncl?.toString() || "",
|
|
200
|
+
exported: state.global?.exported,
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}, [allDocuments]);
|
|
204
|
+
// Check if section should be shown based on filter
|
|
205
|
+
const shouldShowSection = (status) => selectedStatuses.length === 0 || selectedStatuses.includes(status);
|
|
206
|
+
// Create billing statement from invoice - simple async function like old code
|
|
207
|
+
const handleCreateBillingStatement = async (id) => {
|
|
208
|
+
const invoiceFile = files.find((file) => file.id === id);
|
|
209
|
+
const invoiceDoc = allDocuments.find((doc) => doc.header.id === id);
|
|
210
|
+
if (!invoiceDoc) {
|
|
211
|
+
toast("Invoice not found", { type: "error" });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const invoiceState = invoiceDoc.state.global;
|
|
215
|
+
try {
|
|
216
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", `bill-${invoiceFile?.name || id}`, "powerhouse/billing-statement", undefined, undefined, undefined, "powerhouse-billing-statement-editor");
|
|
217
|
+
if (!createdNode?.id) {
|
|
218
|
+
toast("Failed to create billing statement", { type: "error" });
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
// Prepare billing statement data
|
|
222
|
+
const billingStatementData = {
|
|
223
|
+
dateIssued: invoiceState.dateIssued?.trim()
|
|
224
|
+
? new Date(invoiceState.dateIssued).toISOString()
|
|
225
|
+
: null,
|
|
226
|
+
dateDue: invoiceState.dateDue?.trim()
|
|
227
|
+
? new Date(invoiceState.dateDue).toISOString()
|
|
228
|
+
: null,
|
|
229
|
+
currency: invoiceState.currency || "",
|
|
230
|
+
notes: invoiceState.notes || "",
|
|
231
|
+
};
|
|
232
|
+
// Dispatch initial setup actions
|
|
233
|
+
await dispatchActions([
|
|
234
|
+
billingStatementActions.editContributor({ contributor: id }),
|
|
235
|
+
billingStatementActions.editBillingStatement(billingStatementData),
|
|
236
|
+
], createdNode.id);
|
|
237
|
+
// Add line items
|
|
238
|
+
const lineItems = invoiceState.lineItems || [];
|
|
239
|
+
const lineItemActions = lineItems.map((lineItem) => billingStatementActions.addLineItem({
|
|
240
|
+
id: lineItem.id,
|
|
241
|
+
description: lineItem.description || "",
|
|
242
|
+
quantity: lineItem.quantity ?? 1,
|
|
243
|
+
totalPriceCash: lineItem.totalPriceTaxIncl || 0,
|
|
244
|
+
totalPricePwt: 0,
|
|
245
|
+
unit: "UNIT",
|
|
246
|
+
unitPriceCash: lineItem.unitPriceTaxIncl || 0,
|
|
247
|
+
unitPricePwt: 0,
|
|
248
|
+
}));
|
|
249
|
+
if (lineItemActions.length > 0) {
|
|
250
|
+
await dispatchActions(lineItemActions, createdNode.id);
|
|
251
|
+
}
|
|
252
|
+
const tagActions = [];
|
|
253
|
+
for (const lineItem of lineItems) {
|
|
254
|
+
const invoiceTags = toInvoiceTags(lineItem.lineItemTag);
|
|
255
|
+
const lineItemTags = mapTags(invoiceTags);
|
|
256
|
+
for (const tag of lineItemTags) {
|
|
257
|
+
if (tag) {
|
|
258
|
+
tagActions.push(billingStatementActions.editLineItemTag({
|
|
259
|
+
lineItemId: lineItem.id,
|
|
260
|
+
dimension: tag.dimension,
|
|
261
|
+
value: tag.value,
|
|
262
|
+
label: tag.label,
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (tagActions.length > 0) {
|
|
268
|
+
await dispatchActions(tagActions, createdNode.id);
|
|
269
|
+
window.location.reload();
|
|
270
|
+
}
|
|
271
|
+
toast("Billing statement created successfully", { type: "success" });
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
console.error("Error creating billing statement:", error);
|
|
275
|
+
toast("Failed to create billing statement", { type: "error" });
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// Get selected invoices for export - memoized to update when selected or allDocuments changes
|
|
279
|
+
const selectedInvoiceIds = Object.keys(selected).filter((id) => selected[id]);
|
|
280
|
+
const selectedInvoices = useMemo(() => {
|
|
281
|
+
return selectedInvoiceIds
|
|
282
|
+
.map((id) => allDocuments.find((doc) => doc.header.id === id))
|
|
283
|
+
.filter((inv) => inv !== undefined);
|
|
284
|
+
}, [selectedInvoiceIds, allDocuments]);
|
|
285
|
+
// CSV Export handler - simple async function
|
|
286
|
+
const handleCSVExport = async (baseCurrency) => {
|
|
287
|
+
try {
|
|
288
|
+
const exportedData = await exportInvoicesToXeroCSV(selectedInvoices, baseCurrency);
|
|
289
|
+
toast("Invoices exported successfully", { type: "success" });
|
|
290
|
+
// Update exported status on invoices
|
|
291
|
+
for (const invoice of selectedInvoices) {
|
|
292
|
+
const exportedInvoiceData = exportedData[invoice.header.id];
|
|
293
|
+
await dispatchActions([
|
|
294
|
+
invoiceActions.setExportedData({
|
|
295
|
+
timestamp: exportedInvoiceData.timestamp,
|
|
296
|
+
exportedLineItems: exportedInvoiceData.exportedLineItems,
|
|
297
|
+
}),
|
|
298
|
+
], invoice.header.id);
|
|
299
|
+
}
|
|
300
|
+
setSelected({});
|
|
301
|
+
// Trigger page refresh after all actions complete
|
|
302
|
+
setActionsCompleted((prev) => prev + 1);
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
console.error("Error exporting invoices:", error);
|
|
306
|
+
const err = error;
|
|
307
|
+
const missingExpenseTagInvoices = err.missingExpenseTagInvoices || [];
|
|
308
|
+
const missingList = missingExpenseTagInvoices.map((invoiceId) => files.find((file) => file.id === invoiceId)?.name || invoiceId);
|
|
309
|
+
toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingList.map((name) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
// Expense Report Export handler - simple async function
|
|
313
|
+
const handleExpenseReportExport = async (baseCurrency) => {
|
|
314
|
+
console.log("selectedInvoices", selectedInvoices);
|
|
315
|
+
try {
|
|
316
|
+
await exportExpenseReportCSV(selectedInvoices, baseCurrency);
|
|
317
|
+
toast("Expense report exported successfully", { type: "success" });
|
|
318
|
+
// Clear selection
|
|
319
|
+
const updatedSelected = { ...selected };
|
|
320
|
+
Object.keys(updatedSelected).forEach((id) => {
|
|
321
|
+
updatedSelected[id] = false;
|
|
322
|
+
});
|
|
323
|
+
setSelected(updatedSelected);
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
console.error("Error exporting expense report:", error);
|
|
327
|
+
const err = error;
|
|
328
|
+
const missingTagInvoices = err.missingTagInvoices || [];
|
|
329
|
+
const missingList = missingTagInvoices.map((invoiceId) => files.find((file) => file.id === invoiceId)?.name || invoiceId);
|
|
330
|
+
toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingList.map((name) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
// Check for integrations document - simple computed value
|
|
334
|
+
const integrationsDoc = files.find((file) => file.documentType === "powerhouse/integrations");
|
|
335
|
+
// Create integrations document - simple async function
|
|
336
|
+
const createIntegrationsDocument = async () => {
|
|
337
|
+
const integrationsModel = filteredDocumentModels.find((model) => model.id === "powerhouse/integrations");
|
|
338
|
+
if (integrationsModel) {
|
|
339
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", "integration-settings", "powerhouse/integrations", undefined, undefined, undefined, "integrations-editor");
|
|
340
|
+
if (createdNode?.id) {
|
|
341
|
+
setSelectedNode(createdNode.id);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
// Check for expense report document - simple computed value
|
|
346
|
+
const expenseReportDoc = files.find((file) => file.documentType === "powerhouse/expense-report");
|
|
347
|
+
// Check if billing statements exist - memoized to update when allDocuments changes
|
|
348
|
+
const hasBillingStatements = useMemo(() => {
|
|
349
|
+
return allDocuments.some((doc) => doc.header.documentType === "powerhouse/billing-statement");
|
|
350
|
+
}, [allDocuments]);
|
|
351
|
+
// Create or open expense report - simple async function
|
|
352
|
+
const handleCreateOrOpenExpenseReport = async () => {
|
|
353
|
+
if (expenseReportDoc) {
|
|
354
|
+
setSelectedNode(expenseReportDoc.id);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
const expenseReportModel = filteredDocumentModels.find((model) => model.id === "powerhouse/expense-report");
|
|
358
|
+
if (expenseReportModel) {
|
|
359
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", "expense-report", "powerhouse/expense-report", undefined, undefined, undefined, "powerhouse-expense-report-editor");
|
|
360
|
+
if (createdNode?.id) {
|
|
361
|
+
setSelectedNode(createdNode.id);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
// Get invoices and billing statements for batch actions - memoized to update when allDocuments changes
|
|
367
|
+
const invoicesDocs = useMemo(() => {
|
|
368
|
+
return allDocuments.filter((doc) => {
|
|
369
|
+
if (doc.header.documentType !== "powerhouse/invoice")
|
|
370
|
+
return false;
|
|
371
|
+
const state = doc.state;
|
|
372
|
+
return state.global?.status !== "DRAFT";
|
|
373
|
+
});
|
|
374
|
+
}, [allDocuments]);
|
|
375
|
+
const billingStatementDocs = useMemo(() => {
|
|
376
|
+
return allDocuments.filter((doc) => doc.header.documentType === "powerhouse/billing-statement");
|
|
377
|
+
}, [allDocuments]);
|
|
378
|
+
// Render section with table
|
|
379
|
+
const renderSection = (status, title, data, options) => {
|
|
380
|
+
if (!shouldShowSection(status))
|
|
381
|
+
return null;
|
|
382
|
+
const { showIssuer = true, showBillingStatement = false, showCreateButton = false, } = options || {};
|
|
383
|
+
return (_jsx(InvoiceTableSection, { title: title, count: data.length, color: statusColors[status] || statusColors.OTHER, onSelectDocumentModel: showCreateButton ? onSelectDocumentModel : undefined, filteredDocumentModels: showCreateButton ? filteredDocumentModels : undefined, children: _jsxs("table", { className: "w-full text-sm rounded-sm border-separate border-spacing-0 border border-gray-300 overflow-hidden", children: [_jsx(TableHeader, { showIssuer: showIssuer, showBillingStatement: showBillingStatement }), _jsx("tbody", { children: data.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => onRowSelection(row.id, checked, row.status), onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates, showIssuerColumn: showIssuer, showBillingStatementColumn: showBillingStatement }, row.id))) })] }) }));
|
|
384
|
+
};
|
|
385
|
+
return (_jsxs("div", { className: "contributor-billing-table w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-sm mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, selectedStatuses: selectedStatuses, onStatusChange: onStatusChange, onExport: handleCSVExport, onExpenseReportExport: handleExpenseReportExport, createIntegrationsDocument: createIntegrationsDocument, integrationsDoc: integrationsDoc, hasBillingStatements: hasBillingStatements, expenseReportDoc: expenseReportDoc, onCreateOrOpenExpenseReport: handleCreateOrOpenExpenseReport, selected: selected, handleCreateBillingStatement: handleCreateBillingStatement, setSelected: setSelected, invoices: invoicesDocs, billingStatements: billingStatementDocs, canExportSelectedRows: canExportSelectedRows }), renderSection("DRAFT", "Draft", draft, {
|
|
386
|
+
showIssuer: false,
|
|
387
|
+
showCreateButton: true,
|
|
388
|
+
}), renderSection("ISSUED", "Issued", issued, {
|
|
389
|
+
showBillingStatement: true,
|
|
390
|
+
}), renderSection("ACCEPTED", "Accepted", accepted, {
|
|
391
|
+
showBillingStatement: true,
|
|
392
|
+
}), renderSection("PAYMENTSCHEDULED", "Payment Scheduled", paymentScheduled, {
|
|
393
|
+
showBillingStatement: true,
|
|
394
|
+
}), renderSection("PAYMENTSENT", "Payment Sent", paymentSent, {
|
|
395
|
+
showBillingStatement: true,
|
|
396
|
+
}), renderSection("PAYMENTISSUE", "Payment Issue", paymentIssue, {
|
|
397
|
+
showBillingStatement: true,
|
|
398
|
+
}), renderSection("PAYMENTCLOSED", "Payment Closed", paymentClosed), renderSection("REJECTED", "Rejected", rejected), renderSection("OTHER", "Other", otherInvoices)] }));
|
|
399
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container that renders the InvoiceTable.
|
|
3
|
+
* Uses useNodesInSelectedDriveOrFolder pattern to avoid freeze issues.
|
|
4
|
+
*/
|
|
5
|
+
export declare function InvoiceTableContainer(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=InvoiceTableContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTableContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/InvoiceTableContainer.tsx"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,qBAAqB,4CA+JpC"}
|