@powerhousedao/contributor-billing 0.0.32 → 0.0.34

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 (99) 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.js +1 -1
  62. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +3 -2
  63. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  64. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +26 -3
  65. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  66. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +11 -3
  67. package/dist/editors/invoice/components/confirmationModal.d.ts +14 -0
  68. package/dist/editors/invoice/components/confirmationModal.d.ts.map +1 -0
  69. package/dist/editors/invoice/components/confirmationModal.js +7 -0
  70. package/dist/editors/invoice/components/selectField.d.ts.map +1 -1
  71. package/dist/editors/invoice/components/selectField.js +109 -112
  72. package/dist/editors/invoice/components/statusModalComponents.d.ts +52 -0
  73. package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -0
  74. package/dist/editors/invoice/components/statusModalComponents.js +78 -0
  75. package/dist/editors/invoice/editor.d.ts +1 -1
  76. package/dist/editors/invoice/editor.d.ts.map +1 -1
  77. package/dist/editors/invoice/editor.js +153 -158
  78. package/dist/editors/invoice/ingestPDF.js +1 -1
  79. package/dist/editors/invoice/ingestUBL.d.ts.map +1 -1
  80. package/dist/editors/invoice/ingestUBL.js +0 -3
  81. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  82. package/dist/editors/invoice/invoiceToGnosis.js +6 -5
  83. package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
  84. package/dist/editors/invoice/lineItemTags/tagMapping.js +65 -64
  85. package/dist/editors/invoice/requestFinance.js +1 -1
  86. package/dist/editors/invoice/uploadPdfChunked.js +1 -1
  87. package/dist/editors/invoice/validation/validationHandler.d.ts +4 -0
  88. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -0
  89. package/dist/editors/invoice/validation/validationHandler.js +117 -0
  90. package/dist/scripts/contributor-billing/createXeroCsv.d.ts +8 -0
  91. package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -0
  92. package/dist/scripts/contributor-billing/createXeroCsv.js +206 -0
  93. package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
  94. package/dist/style.css +11081 -54
  95. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
  96. package/dist/subgraphs/invoice/resolvers.js +92 -22
  97. package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
  98. package/dist/subgraphs/invoice/schema.js +181 -57
  99. package/package.json +12 -12
@@ -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 = {
@@ -28,7 +28,7 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
28
28
  if (checked) {
29
29
  if (action === "approve" && dispatchMap[id]) {
30
30
  dispatchMap[id](actions.editStatus({
31
- status: "AWAITINGPAYMENT",
31
+ status: "ACCEPTED",
32
32
  }));
33
33
  }
34
34
  else if (action === "reject" && dispatchMap[id]) {
@@ -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,4CA2GA,CAAC"}
@@ -1,16 +1,39 @@
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
+ const currencyOptions = [
5
+ { label: "CHF", value: "CHF" },
6
+ { label: "USD", value: "USD" },
7
+ { label: "EUR", value: "EUR" },
8
+ { label: "GBP", value: "GBP" },
9
+ { label: "JPY", value: "JPY" },
10
+ ];
11
+ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses = [], }) => {
4
12
  const batchOptions = [
5
13
  { label: "$ Pay Selected", value: "pay" },
6
14
  { label: "Approve Selected", value: "approve" },
7
15
  { label: "Reject Selected", value: "reject" },
8
16
  ];
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: {
17
+ // Only enable if all selected statuses are in the allowed set
18
+ const allowedStatuses = [
19
+ "ACCEPTED",
20
+ "AWAITINGPAYMENT",
21
+ "PAYMENTSCHEDULED",
22
+ "PAYMENTSENT",
23
+ "PAYMENTRECEIVED",
24
+ ];
25
+ const canExport = selectedStatuses.length > 0 &&
26
+ selectedStatuses.every((status) => allowedStatuses.includes(status));
27
+ const [showCurrencyModal, setShowCurrencyModal] = useState(false);
28
+ const [selectedCurrency, setSelectedCurrency] = useState("CHF");
29
+ 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
30
  width: "180px",
11
31
  height: "30px",
12
32
  }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
13
33
  width: "200px",
14
34
  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) })] })] }));
35
+ }, 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) })] }), showCurrencyModal && (_jsx("div", { className: "fixed inset-0", children: _jsxs("div", { className: "absolute left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 bg-white rounded shadow-lg p-6 min-w-[300px] flex flex-col items-center", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Select Base Currency" }), _jsx("select", { className: "border border-gray-300 rounded px-2 py-1 mb-4", value: selectedCurrency, onChange: (e) => setSelectedCurrency(e.target.value), children: currencyOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { className: "bg-blue-600 text-white px-4 py-1 rounded hover:bg-blue-700", onClick: () => {
36
+ setShowCurrencyModal(false);
37
+ onExport?.(selectedCurrency);
38
+ }, children: "Export" }), _jsx("button", { className: "bg-gray-200 px-4 py-1 rounded hover:bg-gray-300", onClick: () => setShowCurrencyModal(false), children: "Cancel" })] })] }) }))] }));
16
39
  };
@@ -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":"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;AAuBrD,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,4CA+enB,CAAC"}
@@ -6,6 +6,7 @@ import { InvoiceTableRow } from "./InvoiceTableRow.js";
6
6
  import { useDriveContext, } from "@powerhousedao/reactor-browser";
7
7
  import { generateId } from "document-model";
8
8
  import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
9
+ import { exportInvoicesToXeroCSV } from "../../../../scripts/contributor-billing/createXeroCsv.js";
9
10
  const statusOptions = [
10
11
  { label: "Draft", value: "DRAFT" },
11
12
  { label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
@@ -180,10 +181,17 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
180
181
  clipboard: [],
181
182
  });
182
183
  };
183
- const handleCSVExport = () => {
184
- console.log('exporting...', selected);
184
+ const selectedInvoiceIds = Object.keys(selected).filter(id => selected[id]);
185
+ const selectedInvoices = selectedInvoiceIds.map(id => state[id]);
186
+ const selectedInvoiceStatuses = selectedInvoices.map(inv => inv?.global?.status || inv?.status);
187
+ const handleCSVExport = (baseCurrency) => {
188
+ console.log('Exporting selected invoices:', selectedInvoiceIds.map((id, idx) => ({
189
+ id,
190
+ state: selectedInvoices[idx],
191
+ })));
192
+ exportInvoicesToXeroCSV(selectedInvoices, baseCurrency);
185
193
  };
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) => ({
194
+ 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) => ({
187
195
  ...prev,
188
196
  [row.id]: checked,
189
197
  })), 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) => ({
@@ -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"}