@powerhousedao/contributor-billing 0.0.33 → 0.0.35

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.
Files changed (101) hide show
  1. package/dist/document-models/invoice/gen/actions.d.ts +3 -1
  2. package/dist/document-models/invoice/gen/actions.d.ts.map +1 -1
  3. package/dist/document-models/invoice/gen/actions.js +1 -0
  4. package/dist/document-models/invoice/gen/creators.d.ts +1 -0
  5. package/dist/document-models/invoice/gen/creators.d.ts.map +1 -1
  6. package/dist/document-models/invoice/gen/creators.js +1 -0
  7. package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
  8. package/dist/document-models/invoice/gen/document-model.js +167 -50
  9. package/dist/document-models/invoice/gen/general/actions.d.ts +4 -6
  10. package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
  11. package/dist/document-models/invoice/gen/general/creators.d.ts +4 -6
  12. package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
  13. package/dist/document-models/invoice/gen/general/creators.js +2 -4
  14. package/dist/document-models/invoice/gen/general/object.d.ts +3 -5
  15. package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
  16. package/dist/document-models/invoice/gen/general/object.js +6 -12
  17. package/dist/document-models/invoice/gen/general/operations.d.ts +3 -5
  18. package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
  19. package/dist/document-models/invoice/gen/object.d.ts +3 -1
  20. package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
  21. package/dist/document-models/invoice/gen/object.js +8 -1
  22. package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
  23. package/dist/document-models/invoice/gen/reducer.js +56 -15
  24. package/dist/document-models/invoice/gen/schema/types.d.ts +89 -23
  25. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
  26. package/dist/document-models/invoice/gen/schema/zod.d.ts +21 -7
  27. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
  28. package/dist/document-models/invoice/gen/schema/zod.js +124 -28
  29. package/dist/document-models/invoice/gen/transitions/actions.d.ts +16 -0
  30. package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -0
  31. package/dist/document-models/invoice/gen/transitions/actions.js +1 -0
  32. package/dist/document-models/invoice/gen/transitions/creators.d.ts +15 -0
  33. package/dist/document-models/invoice/gen/transitions/creators.d.ts.map +1 -0
  34. package/dist/document-models/invoice/gen/transitions/creators.js +14 -0
  35. package/dist/document-models/invoice/gen/transitions/error.d.ts +2 -0
  36. package/dist/document-models/invoice/gen/transitions/error.d.ts.map +1 -0
  37. package/dist/document-models/invoice/gen/transitions/error.js +1 -0
  38. package/dist/document-models/invoice/gen/transitions/object.d.ts +18 -0
  39. package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -0
  40. package/dist/document-models/invoice/gen/transitions/object.js +40 -0
  41. package/dist/document-models/invoice/gen/transitions/operations.d.ts +18 -0
  42. package/dist/document-models/invoice/gen/transitions/operations.d.ts.map +1 -0
  43. package/dist/document-models/invoice/gen/transitions/operations.js +1 -0
  44. package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
  45. package/dist/document-models/invoice/gen/utils.js +10 -6
  46. package/dist/document-models/invoice/index.d.ts +14 -4
  47. package/dist/document-models/invoice/index.d.ts.map +1 -1
  48. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  49. package/dist/document-models/invoice/src/reducers/general.js +26 -42
  50. package/dist/document-models/invoice/src/reducers/transitions.d.ts +8 -0
  51. package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -0
  52. package/dist/document-models/invoice/src/reducers/transitions.js +162 -0
  53. package/dist/document-models/invoice/src/tests/general.test.js +10 -31
  54. package/dist/document-models/invoice/src/tests/transitions.test.d.ts +6 -0
  55. package/dist/document-models/invoice/src/tests/transitions.test.d.ts.map +1 -0
  56. package/dist/document-models/invoice/src/tests/transitions.test.js +506 -0
  57. package/dist/document-models/invoice/utils/statusTransitions.d.ts +13 -0
  58. package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -0
  59. package/dist/document-models/invoice/utils/statusTransitions.js +13 -0
  60. package/dist/editors/billing-statement/lineItemTags/tagMapping.js +64 -64
  61. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  62. package/dist/editors/contributor-billing/components/DriveExplorer.js +3 -2
  63. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +3 -2
  64. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  65. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +27 -3
  66. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -4
  67. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  68. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +91 -21
  69. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +1 -1
  70. package/dist/editors/invoice/components/confirmationModal.d.ts +14 -0
  71. package/dist/editors/invoice/components/confirmationModal.d.ts.map +1 -0
  72. package/dist/editors/invoice/components/confirmationModal.js +7 -0
  73. package/dist/editors/invoice/components/selectField.d.ts.map +1 -1
  74. package/dist/editors/invoice/components/selectField.js +109 -112
  75. package/dist/editors/invoice/components/statusModalComponents.d.ts +52 -0
  76. package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -0
  77. package/dist/editors/invoice/components/statusModalComponents.js +78 -0
  78. package/dist/editors/invoice/editor.d.ts +1 -1
  79. package/dist/editors/invoice/editor.d.ts.map +1 -1
  80. package/dist/editors/invoice/editor.js +153 -158
  81. package/dist/editors/invoice/ingestUBL.d.ts.map +1 -1
  82. package/dist/editors/invoice/ingestUBL.js +0 -3
  83. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  84. package/dist/editors/invoice/invoiceToGnosis.js +4 -3
  85. package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
  86. package/dist/editors/invoice/lineItemTags/tagMapping.js +65 -64
  87. package/dist/editors/invoice/requestFinance.d.ts +1 -0
  88. package/dist/editors/invoice/requestFinance.d.ts.map +1 -1
  89. package/dist/editors/invoice/requestFinance.js +9 -2
  90. package/dist/editors/invoice/validation/validationHandler.d.ts +4 -0
  91. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -0
  92. package/dist/editors/invoice/validation/validationHandler.js +117 -0
  93. package/dist/scripts/contributor-billing/createXeroCsv.d.ts +8 -0
  94. package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -0
  95. package/dist/scripts/contributor-billing/createXeroCsv.js +209 -0
  96. package/dist/style.css +164 -18
  97. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
  98. package/dist/subgraphs/invoice/resolvers.js +92 -22
  99. package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
  100. package/dist/subgraphs/invoice/schema.js +181 -57
  101. package/package.json +1 -1
@@ -1,68 +1,68 @@
1
1
  const billingTagMapping = [
2
- { fusion: "Budget", xero: "Grants from Maker DAO" },
3
- { fusion: "Current Asset", xero: "Clearing Account" },
4
- { fusion: "Current Liability", xero: "Request Finance IC account" },
5
- { fusion: "Interest Income", xero: "Interest Income" },
6
- { fusion: "Travel & Entertainment", xero: "Activities and Events" },
7
- { fusion: "Travel & Entertainment", xero: "Meals" },
8
- { fusion: "Travel & Entertainment", xero: "Airfare" },
9
- { fusion: "Travel & Entertainment", xero: "Hotels" },
10
- { fusion: "Travel & Entertainment", xero: "Transportation (Uber, Taxi etc)" },
11
- { fusion: "Travel & Entertainment", xero: "Other travel cost" },
12
- { fusion: "Cost of Goods Sold", xero: "Cost of Goods Sold" },
13
- { fusion: "Marketing Expense", xero: "Advertising" },
14
- { fusion: "Professional Services", xero: "Legal Fees Abroad" },
15
- { fusion: "Professional Services", xero: "Legal Fees Switzerland" },
16
- { fusion: "Professional Services", xero: "Finance Team Fees Abroad" },
17
- { fusion: "Professional Services", xero: "Fnance and Accounting Fees Switzerland" },
18
- { fusion: "Software Development Expense", xero: "Software Development Team Fees" },
19
- { fusion: "Professional Services", xero: "Research Team Fees" },
20
- { fusion: "Marketing Expense", xero: "Marketing Team Fees" },
21
- { fusion: "Compensation & Benefits", xero: "Health Care Fees" },
22
- { fusion: "Compensation & Benefits", xero: "Contractor Fees" },
23
- { fusion: "Compensation & Benefits", xero: "Insurance Fees Team" },
24
- { fusion: "Compensation & Benefits", xero: "HR Fees" },
25
- { fusion: "Compensation & Benefits", xero: "Team Bonus" },
26
- { fusion: "Compensation & Benefits", xero: "Refferal Fees" },
27
- { fusion: "Other", xero: "Depreciation" },
28
- { fusion: "Other", xero: "Freight & Courier" },
29
- { fusion: "Other", xero: "Interest Expense" },
30
- { fusion: "Admin Expense", xero: "Office Expenses" },
31
- { fusion: "Admin Expense", xero: "Rent" },
32
- { fusion: "Admin Expense", xero: "Subscriptions" },
33
- { fusion: "Other Income Expense (Non-operating)", xero: "Bank Revaluations" },
34
- { fusion: "Other Income", xero: "Unrealised Currency Gains" },
35
- { fusion: "Other Income", xero: "Realised Currency Gains" },
36
- { fusion: "Income Tax Expense", xero: "Income Tax Expense" },
37
- { fusion: "Current Asset", xero: "Accounts Receivable" },
38
- { fusion: "Current Asset", xero: "Prepayments" },
39
- { fusion: "Current Asset", xero: "Inventory" },
40
- { fusion: "Software Expense", xero: "Software/IT Subscriptions" },
41
- { fusion: "Software Expense", xero: "Telephone and Internet Charges" },
42
- { fusion: "Fixed Asset", xero: "Office Equipment" },
43
- { fusion: "Fixed Asset", xero: "Less Accumulated Depreciation on Office Equipment" },
44
- { fusion: "Non-Current Asset", xero: "Computer Equipment" },
45
- { fusion: "Non-Current Asset", xero: "Less Accumulated Depreciation on Computer Equipment" },
46
- { fusion: "Current Liability", xero: "Accounts Payable" },
47
- { fusion: "Other", xero: "Bank Fees" },
48
- { fusion: "Gas Expense", xero: "Gas Fees" },
49
- { fusion: "Other", xero: "Exchange Fees" },
50
- { fusion: "Current Liability", xero: "Unpaid Expense Claims" },
51
- { fusion: "Current Liability", xero: "Accrued Expenses" },
52
- { fusion: "Current Liability", xero: "Wages Payable" },
53
- { fusion: "Current Liability", xero: "Employee Tax Payable" },
54
- { fusion: "Current Liability", xero: "Superannuation Payable" },
55
- { fusion: "Current Liability", xero: "Income Tax Payable" },
56
- { fusion: "Other", xero: "Sales Tax" },
57
- { fusion: "Adjustment A/C", xero: "Historical Adjustment" },
58
- { fusion: "Temporary Holding Account", xero: "Suspense" },
59
- { fusion: "Other", xero: "Rounding" },
60
- { fusion: "Internal Transfers", xero: "Tracking Transfers" },
61
- { fusion: "Owner Equity", xero: "Owner A Drawings" },
62
- { fusion: "Owner Equity", xero: "Owner A Funds Introduced" },
63
- { fusion: "Non-current Liability", xero: "Loan" },
64
- { fusion: "Equity", xero: "Retained Earnings" },
65
- { fusion: "Equity", xero: "Owner A Share Capital" }
2
+ { fusion: "Budget", xero: "200 - Grants from Maker DAO" },
3
+ { fusion: "Current Asset", xero: "2001 - Clearing Account" },
4
+ { fusion: "Current Liability", xero: "2222 - Request Finance IC account" },
5
+ { fusion: "Interest Income", xero: "270 - Interest Income" },
6
+ { fusion: "Travel & Entertainment", xero: "3000 - Activities and Events" },
7
+ { fusion: "Travel & Entertainment", xero: "3001 - Meals" },
8
+ { fusion: "Travel & Entertainment", xero: "3002 - Airfare" },
9
+ { fusion: "Travel & Entertainment", xero: "3003 - Hotels" },
10
+ { fusion: "Travel & Entertainment", xero: "3004 - Transportation (Uber, Taxi etc)" },
11
+ { fusion: "Travel & Entertainment", xero: "3005 - Other travel cost" },
12
+ { fusion: "Cost of Goods Sold", xero: "310 - Cost of Goods Sold" },
13
+ { fusion: "Marketing Expense", xero: "400 - Advertising" },
14
+ { fusion: "Professional Services", xero: "4001 - Legal Fees Abroad" },
15
+ { fusion: "Professional Services", xero: "4002 - Legal Fees Switzerland" },
16
+ { fusion: "Professional Services", xero: "4003 - Finance Team Fees Abroad" },
17
+ { fusion: "Professional Services", xero: "4004 - Finance and Accounting Fees Switzerland" },
18
+ { fusion: "Software Development Expense", xero: "4005 - Software Development Team Fees" },
19
+ { fusion: "Professional Services", xero: "4006 - Research Team Fees" },
20
+ { fusion: "Marketing Expense", xero: "4007 - Marketing Team Fees" },
21
+ { fusion: "Compensation & Benefits", xero: "4008 - Health Care Fees" },
22
+ { fusion: "Compensation & Benefits", xero: "4009 - Contractor Fees" },
23
+ { fusion: "Compensation & Benefits", xero: "4010 - Insurance Fees Team" },
24
+ { fusion: "Compensation & Benefits", xero: "4011 - HR Fees" },
25
+ { fusion: "Compensation & Benefits", xero: "4012 - Team Bonus" },
26
+ { fusion: "Compensation & Benefits", xero: "4013 - Refferal Fees" },
27
+ { fusion: "Other", xero: "416 - Depreciation" },
28
+ { fusion: "Other", xero: "425 - Freight & Courier" },
29
+ { fusion: "Other", xero: "437 - Interest Expense" },
30
+ { fusion: "Admin Expense", xero: "453 - Office Expenses" },
31
+ { fusion: "Admin Expense", xero: "469 - Rent" },
32
+ { fusion: "Admin Expense", xero: "485 - Subscriptions" },
33
+ { fusion: "Other Income Expense (Non-operating)", xero: "497 - Bank Revaluations" },
34
+ { fusion: "Other Income", xero: "498 - Unrealised Currency Gains" },
35
+ { fusion: "Other Income", xero: "499 - Realised Currency Gains" },
36
+ { fusion: "Income Tax Expense", xero: "505 - Income Tax Expense" },
37
+ { fusion: "Current Asset", xero: "610 - Accounts Receivable" },
38
+ { fusion: "Current Asset", xero: "620 - Prepayments" },
39
+ { fusion: "Current Asset", xero: "630 - Inventory" },
40
+ { fusion: "Software Expense", xero: "701 - Software/IT Subscriptions" },
41
+ { fusion: "Software Expense", xero: "702 - Telephone and Internet Charges" },
42
+ { fusion: "Fixed Asset", xero: "710 - Office Equipment" },
43
+ { fusion: "Fixed Asset", xero: "711 - Less Accumulated Depreciation on Office Equipment" },
44
+ { fusion: "Non-Current Asset", xero: "720 - Computer Equipment" },
45
+ { fusion: "Non-Current Asset", xero: "721 - Less Accumulated Depreciation on Computer Equipment" },
46
+ { fusion: "Current Liability", xero: "800 - Accounts Payable" },
47
+ { fusion: "Other", xero: "8000 - Bank Fees" },
48
+ { fusion: "Gas Expense", xero: "8001 - Gas Fees" },
49
+ { fusion: "Other", xero: "8003 - Exchange Fees" },
50
+ { fusion: "Current Liability", xero: "801 - Unpaid Expense Claims" },
51
+ { fusion: "Current Liability", xero: "802 - Accrued Expenses" },
52
+ { fusion: "Current Liability", xero: "803 - Wages Payable" },
53
+ { fusion: "Current Liability", xero: "825 - Employee Tax Payable" },
54
+ { fusion: "Current Liability", xero: "826 - Superannuation Payable" },
55
+ { fusion: "Current Liability", xero: "830 - Income Tax Payable" },
56
+ { fusion: "Other", xero: "820 - Sales Tax" },
57
+ { fusion: "Adjustment A/C", xero: "840 - Historical Adjustment" },
58
+ { fusion: "Temporary Holding Account", xero: "850 - Suspense" },
59
+ { fusion: "Other", xero: "860 - Rounding" },
60
+ { fusion: "Internal Transfers", xero: "877 - Tracking Transfers" },
61
+ { fusion: "Owner Equity", xero: "880 - Owner A Drawings" },
62
+ { fusion: "Owner Equity", xero: "881 - Owner A Funds Introduced" },
63
+ { fusion: "Non-current Liability", xero: "900 - Loan" },
64
+ { fusion: "Equity", xero: "960 - Retained Earnings" },
65
+ { fusion: "Equity", xero: "970 - Owner A Share Capital" }
66
66
  ];
67
67
  // Mapping of labels to values
68
68
  const fusionLabelToValue = {
@@ -1 +1 @@
1
- {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGL,mBAAmB,EAEnB,KAAK,qBAAqB,EAE1B,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAKxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,2CAyQpB"}
1
+ {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGL,mBAAmB,EAEnB,KAAK,qBAAqB,EAE1B,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAMxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,2CAsRpB"}
@@ -11,6 +11,7 @@ import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/rea
11
11
  import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
12
12
  import { actions } from "../../../document-models/invoice/index.js";
13
13
  import { useDrop } from "../hooks/useDrop.js";
14
+ import { ToastContainer } from '@powerhousedao/design-system';
14
15
  export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch, }) {
15
16
  const [selectedNodeId, setSelectedNodeId] = useState();
16
17
  const [activeDocumentId, setActiveDocumentId] = useState();
@@ -28,7 +29,7 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
28
29
  if (checked) {
29
30
  if (action === "approve" && dispatchMap[id]) {
30
31
  dispatchMap[id](actions.editStatus({
31
- status: "AWAITINGPAYMENT",
32
+ status: "ACCEPTED",
32
33
  }));
33
34
  }
34
35
  else if (action === "reject" && dispatchMap[id]) {
@@ -105,5 +106,5 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
105
106
  const editorModule = activeDocument
106
107
  ? context.getEditor(activeDocument.documentType)
107
108
  : null;
108
- return (_jsxs("div", { className: "flex h-full", children: [nodes.map((node) => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels, context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsx("div", { ...dropProps, className: twMerge("editor-container rounded-md border-2 border-transparent ", isDropTarget && "border-dashed border-blue-100"), children: _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction, onDeleteNode: onDeleteNode, renameNode: renameNode, filteredDocumentModels: filteredDocumentModels, onSelectDocumentModel: onSelectDocumentModel, dispatchMap: dispatchMap }) })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
109
+ return (_jsxs("div", { className: "flex h-full", children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), nodes.map((node) => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels, context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsx("div", { ...dropProps, className: twMerge("editor-container rounded-md border-2 border-transparent ", isDropTarget && "border-dashed border-blue-100"), children: _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction, onDeleteNode: onDeleteNode, renameNode: renameNode, filteredDocumentModels: filteredDocumentModels, onSelectDocumentModel: onSelectDocumentModel, dispatchMap: dispatchMap, driveId: driveId }) })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
109
110
  }
@@ -1,4 +1,4 @@
1
- export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, }: {
1
+ export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses, }: {
2
2
  contributorOptions?: {
3
3
  label: string;
4
4
  value: string;
@@ -10,7 +10,8 @@ export declare const HeaderControls: ({ contributorOptions, statusOptions, onCon
10
10
  onContributorChange?: (value: string | string[]) => void;
11
11
  onStatusChange?: (value: string | string[]) => void;
12
12
  onSearchChange?: (value: string) => void;
13
- onExport?: () => void;
13
+ onExport?: (baseCurrency: string) => void;
14
14
  onBatchAction?: (action: string) => void;
15
+ selectedStatuses?: string[];
15
16
  }) => import("react/jsx-runtime").JSX.Element;
16
17
  //# sourceMappingURL=HeaderControls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,sHAQ5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,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,MAAM,IAAI,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,4CAwDA,CAAC"}
1
+ {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,GAAI,wIAS5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,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,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,4CAyFA,CAAC"}
@@ -1,16 +1,40 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
2
3
  import { Select } from "@powerhousedao/document-engineering";
3
- export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, }) => {
4
+ import ConfirmationModal from "../../../invoice/components/confirmationModal.js";
5
+ const currencyOptions = [
6
+ { label: "CHF", value: "CHF" },
7
+ { label: "USD", value: "USD" },
8
+ { label: "EUR", value: "EUR" },
9
+ { label: "GBP", value: "GBP" },
10
+ { label: "JPY", value: "JPY" },
11
+ ];
12
+ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses = [], }) => {
4
13
  const batchOptions = [
5
14
  { label: "$ Pay Selected", value: "pay" },
6
15
  { label: "Approve Selected", value: "approve" },
7
16
  { label: "Reject Selected", value: "reject" },
8
17
  ];
9
- return (_jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h3", { className: "text-lg font-bold", children: "Powerhouse OH Admin Drive" }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100", onClick: onExport, children: "Export to CSV" }), _jsx(Select, { style: {
18
+ // Only enable if all selected statuses are in the allowed set
19
+ const allowedStatuses = [
20
+ "ACCEPTED",
21
+ "AWAITINGPAYMENT",
22
+ "PAYMENTSCHEDULED",
23
+ "PAYMENTSENT",
24
+ "PAYMENTRECEIVED",
25
+ ];
26
+ const canExport = selectedStatuses.length > 0 &&
27
+ selectedStatuses.every((status) => allowedStatuses.includes(status));
28
+ const [showCurrencyModal, setShowCurrencyModal] = useState(false);
29
+ const [selectedCurrency, setSelectedCurrency] = useState("CHF");
30
+ return (_jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h3", { className: "text-lg font-bold", children: "Powerhouse OH Admin Drive" }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: `bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 ${!canExport ? "opacity-50 cursor-not-allowed" : ""}`, onClick: () => setShowCurrencyModal(true), disabled: !canExport, children: "Export to CSV" }), _jsx(Select, { style: {
10
31
  width: "180px",
11
32
  height: "30px",
12
33
  }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
13
34
  width: "200px",
14
35
  height: "30px",
15
- }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] })] }));
36
+ }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), _jsx(ConfirmationModal, { open: showCurrencyModal, onCancel: () => setShowCurrencyModal(false), onContinue: () => {
37
+ setShowCurrencyModal(false);
38
+ onExport?.(selectedCurrency);
39
+ }, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" }) })] }));
16
40
  };
@@ -1,7 +1,6 @@
1
1
  import { type UiFileNode } from "@powerhousedao/design-system";
2
- import { EditorDispatch } from "document-model";
3
2
  import { DocumentModelModule } from "document-model";
4
- import { DocumentDriveAction } from "document-drive";
3
+ import { type InvoiceAction } from "../../../../document-models/invoice/index.js";
5
4
  interface InvoiceTableProps {
6
5
  files: UiFileNode[];
7
6
  state: Record<string, any>;
@@ -22,8 +21,9 @@ interface InvoiceTableProps {
22
21
  renameNode: (nodeId: string, name: string) => void;
23
22
  filteredDocumentModels: DocumentModelModule[];
24
23
  onSelectDocumentModel: (model: DocumentModelModule) => void;
25
- dispatchMap: Record<string, EditorDispatch<DocumentDriveAction>>;
24
+ dispatchMap: Record<string, (action: InvoiceAction) => void>;
25
+ driveId: string;
26
26
  }
27
- export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, driveId, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
28
28
  export {};
29
29
  //# sourceMappingURL=InvoiceTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,EAAE,cAAc,EAA0B,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAsBrD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,YAAY,GAAI,iLAa1B,iBAAiB,4CA8dnB,CAAC"}
1
+ {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAU/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8CAA8C,CAAC;AAwBtD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,0LAc1B,iBAAiB,4CA4rBnB,CAAC"}
@@ -1,22 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { useState, useMemo } from "react";
3
4
  import { HeaderControls } from "./HeaderControls.js";
4
5
  import { InvoiceTableSection } from "./InvoiceTableSection.js";
5
6
  import { InvoiceTableRow } from "./InvoiceTableRow.js";
6
7
  import { useDriveContext, } from "@powerhousedao/reactor-browser";
7
8
  import { generateId } from "document-model";
8
9
  import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
10
+ import { exportInvoicesToXeroCSV } from "../../../../scripts/contributor-billing/createXeroCsv.js";
11
+ import { toast } from "@powerhousedao/design-system";
9
12
  const statusOptions = [
10
13
  { label: "Draft", value: "DRAFT" },
11
- { label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
12
- { label: "Awaiting Payment", value: "AWAITINGPAYMENT" },
13
- { label: "Payment Received", value: "PAYMENTRECEIVED" },
14
+ { label: "Issued", value: "ISSUED" },
15
+ { label: "Accepted", value: "ACCEPTED" },
16
+ { label: "Payment Scheduled", value: "PAYMENTSCHEDULED" },
17
+ { label: "Payment Sent", value: "PAYMENTSENT" },
18
+ { label: "Payment Issue", value: "PAYMENTISSUE" },
19
+ { label: "Payment Closed", value: "PAYMENTCLOSED" },
14
20
  { label: "Rejected", value: "REJECTED" },
15
21
  { label: "Other", value: "OTHER" },
16
22
  ];
17
- export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }) => {
23
+ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, driveId, }) => {
18
24
  const [selectedStatuses, setSelectedStatuses] = useState([]);
19
- const { addDocument, addFile, documentModels, useDriveDocumentStates, selectedNode, } = useDriveContext();
25
+ const { addDocument, addFile, documentModels, useDriveDocumentStates, selectedNode, useDocumentEditorProps, } = useDriveContext();
20
26
  const billingDocStates = Object.entries(state)
21
27
  .filter(([_, doc]) => doc.documentType === "powerhouse/billing-statement")
22
28
  .map(([id, doc]) => ({
@@ -57,9 +63,11 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
57
63
  .filter(([_, doc]) => doc.documentType === "powerhouse/invoice" &&
58
64
  doc.global.status !== "DRAFT" &&
59
65
  doc.global.status !== "ISSUED" &&
60
- doc.global.status !== "AWAITINGAPPROVAL" &&
66
+ doc.global.status !== "ACCEPTED" &&
61
67
  doc.global.status !== "PAYMENTSCHEDULED" &&
62
- doc.global.status !== "PAYMENTRECEIVED" &&
68
+ doc.global.status !== "PAYMENTSENT" &&
69
+ doc.global.status !== "PAYMENTISSUE" &&
70
+ doc.global.status !== "PAYMENTCLOSED" &&
63
71
  doc.global.status !== "REJECTED")
64
72
  .map(([id, doc]) => ({
65
73
  id,
@@ -75,9 +83,12 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
75
83
  }));
76
84
  };
77
85
  const draft = getInvoicesByStatus("DRAFT");
78
- const awaitingApproval = getInvoicesByStatus("ISSUED");
79
- const awaitingPayment = getInvoicesByStatus("PAYMENTSCHEDULED");
80
- const paid = getInvoicesByStatus("PAYMENTRECEIVED");
86
+ const issued = getInvoicesByStatus("ISSUED");
87
+ const accepted = getInvoicesByStatus("ACCEPTED");
88
+ const paymentScheduled = getInvoicesByStatus("PAYMENTSCHEDULED");
89
+ const paymentSent = getInvoicesByStatus("PAYMENTSENT");
90
+ const paymentIssue = getInvoicesByStatus("PAYMENTISSUE");
91
+ const paymentClosed = getInvoicesByStatus("PAYMENTCLOSED");
81
92
  const rejected = getInvoicesByStatus("REJECTED");
82
93
  const otherInvoices = getOtherInvoices();
83
94
  const handleDelete = (id) => {
@@ -115,7 +126,7 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
115
126
  id: item.id,
116
127
  description: item.description,
117
128
  quantity: item.quantity,
118
- unit: 'UNIT',
129
+ unit: "UNIT",
119
130
  unitPricePwt: 0,
120
131
  unitPriceCash: item.unitPriceTaxIncl,
121
132
  totalPricePwt: 0,
@@ -160,7 +171,7 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
160
171
  id: item.id,
161
172
  description: item.description,
162
173
  quantity: item.quantity,
163
- unit: 'UNIT',
174
+ unit: "UNIT",
164
175
  unitPricePwt: 0,
165
176
  unitPriceCash: item.unitPriceTaxIncl,
166
177
  totalPricePwt: 0,
@@ -180,22 +191,81 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
180
191
  clipboard: [],
181
192
  });
182
193
  };
183
- const handleCSVExport = () => {
184
- console.log('exporting...', selected);
194
+ const selectedInvoiceIds = Object.keys(selected).filter((id) => selected[id]);
195
+ const selectedInvoices = selectedInvoiceIds.map((id) => ({
196
+ ...state[id],
197
+ id,
198
+ }));
199
+ const selectedInvoiceStatuses = selectedInvoices.map((inv) => inv?.global?.status || inv?.status);
200
+ // Create dispatch map for selected invoices using the existing dispatchMap prop
201
+ const selectedInvoiceDispatchMap = useMemo(() => {
202
+ const map = {};
203
+ selectedInvoiceIds.forEach((invoiceId) => {
204
+ if (dispatchMap[invoiceId]) {
205
+ map[invoiceId] = dispatchMap[invoiceId];
206
+ }
207
+ });
208
+ return map;
209
+ }, [selectedInvoiceIds, dispatchMap]);
210
+ const handleCSVExport = async (baseCurrency) => {
211
+ console.log("Exporting selected invoices:", selectedInvoiceIds.map((id, idx) => ({
212
+ id,
213
+ state: selectedInvoices[idx],
214
+ })));
215
+ try {
216
+ const exportedInvoices = await exportInvoicesToXeroCSV(selectedInvoices, baseCurrency);
217
+ // Object.entries(exportedInvoices).forEach(
218
+ // ([invoiceId, invoiceData]: [string, any]) => {
219
+ // const dispatch = selectedInvoiceDispatchMap[invoiceId];
220
+ // if (dispatch) {
221
+ // dispatch(
222
+ // actions.setExportedData({
223
+ // timestamp: invoiceData.exportTimestamp as string,
224
+ // exportedLineItems: invoiceData.exportedLines as string[][],
225
+ // })
226
+ // );
227
+ // } else {
228
+ // console.warn(`No dispatch function found for invoice ${invoiceId}`);
229
+ // }
230
+ // }
231
+ // );
232
+ toast("Invoices exported successfully", {
233
+ type: "success",
234
+ });
235
+ }
236
+ catch (error) {
237
+ console.error("Error exporting invoices:", error);
238
+ const missingExpenseTagInvoices = error.missingExpenseTagInvoices || [];
239
+ const missingExpenseTagInvoicesList = missingExpenseTagInvoices.map((invoiceId) => {
240
+ const invoice = files.find((file) => file.id === invoiceId);
241
+ return invoice?.name || invoiceId;
242
+ });
243
+ console.log("missingExpenseTagInvoicesList", missingExpenseTagInvoicesList);
244
+ toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingExpenseTagInvoicesList.map((name, idx) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
245
+ }
185
246
  };
186
- return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
247
+ return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport, selectedStatuses: selectedInvoiceStatuses }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
248
+ ...prev,
249
+ [row.id]: checked,
250
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("ISSUED") && (_jsx(InvoiceTableSection, { title: "Issued", count: issued.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _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" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: issued.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
251
+ ...prev,
252
+ [row.id]: checked,
253
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("ACCEPTED") && (_jsx(InvoiceTableSection, { title: "Accepted", count: accepted.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: accepted.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
254
+ ...prev,
255
+ [row.id]: checked,
256
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSCHEDULED") && (_jsx(InvoiceTableSection, { title: "Payment Scheduled", count: paymentScheduled.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentScheduled.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
187
257
  ...prev,
188
258
  [row.id]: checked,
189
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("AWAITINGAPPROVAL") && (_jsx(InvoiceTableSection, { title: "Awaiting Approval", count: awaitingApproval.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _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" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingApproval.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
259
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSENT") && (_jsx(InvoiceTableSection, { title: "Payment Sent", count: paymentSent.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentSent.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
190
260
  ...prev,
191
261
  [row.id]: checked,
192
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("AWAITINGPAYMENT") && (_jsx(InvoiceTableSection, { title: "Awaiting Payment", count: awaitingPayment.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _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" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingPayment.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
262
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTISSUE") && (_jsx(InvoiceTableSection, { title: "Payment Issue", count: paymentIssue.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentIssue.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
193
263
  ...prev,
194
264
  [row.id]: checked,
195
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTRECEIVED") && (_jsx(InvoiceTableSection, { title: "Payment Received", count: paid.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _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" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: paid.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
265
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTCLOSED") && (_jsx(InvoiceTableSection, { title: "Payment Closed", count: paymentClosed.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentClosed.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
196
266
  ...prev,
197
267
  [row.id]: checked,
198
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
268
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", 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" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
199
269
  ...prev,
200
270
  [row.id]: checked,
201
271
  })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("OTHER") && (_jsx(InvoiceTableSection, { title: "Other", count: otherInvoices.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _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" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: otherInvoices.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
@@ -7,5 +7,5 @@ export const InvoiceTableRow = ({ files, row, isSelected, onSelect, menuOptions,
7
7
  const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
8
8
  const billingFile = files?.find((file) => file.id === billingDoc?.id);
9
9
  const file = files?.find((file) => file.id === row.id);
10
- return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: row.exported ? _jsx("span", { className: "text-green-500", children: "Yes" }) : _jsx("span", { className: "text-red-500", children: "No" }) })] }));
10
+ return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: row.exported.timestamp ? _jsx("span", { className: "text-green-500", children: "Yes" }) : _jsx("span", { className: "text-red-500", children: "No" }) })] }));
11
11
  };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ interface ConfirmationModalProps {
3
+ open: boolean;
4
+ header: React.ReactNode;
5
+ onCancel: () => void;
6
+ onContinue: () => void;
7
+ cancelLabel?: string;
8
+ continueLabel?: string;
9
+ children?: React.ReactNode;
10
+ continueDisabled?: boolean;
11
+ }
12
+ declare const ConfirmationModal: React.FC<ConfirmationModalProps>;
13
+ export default ConfirmationModal;
14
+ //# sourceMappingURL=confirmationModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmationModal.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/confirmationModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsCvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const ConfirmationModal = ({ open, header, onCancel, onContinue, cancelLabel = "Cancel", continueLabel = "Continue", children, continueDisabled = false, }) => {
3
+ if (!open)
4
+ return null;
5
+ return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/10 backdrop-blur-sm", children: _jsxs("div", { className: "bg-white rounded-3xl shadow-xl w-full max-w-md p-6", children: [_jsx("div", { className: "border-b border-slate-100 pb-2 text-2xl font-bold text-gray-800", children: header }), _jsx("div", { className: "my-6 rounded-md bg-slate-50 p-4 text-center flex flex-col items-center justify-center min-h-[64px]", children: children }), _jsxs("div", { className: "mt-8 flex justify-between gap-3", children: [_jsx("button", { onClick: onCancel, className: "flex-1 min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all bg-slate-50 text-slate-800", children: cancelLabel }), _jsx("button", { onClick: onContinue, disabled: continueDisabled, className: `flex-1 min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all bg-gray-800 text-gray-50 ${continueDisabled ? 'opacity-50 cursor-not-allowed' : ''}`, children: continueLabel })] })] }) }));
6
+ };
7
+ export default ConfirmationModal;
@@ -1 +1 @@
1
- {"version":3,"file":"selectField.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/selectField.tsx"],"names":[],"mappings":"AAMA,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAoFD,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAgPlD,CAAC"}
1
+ {"version":3,"file":"selectField.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/selectField.tsx"],"names":[],"mappings":"AAMA,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAsGD,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAqOlD,CAAC"}