@powerhousedao/contributor-billing 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +2 -24
- package/dist/document-models/invoice/gen/general/actions.d.ts +2 -4
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.d.ts +2 -4
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.js +0 -2
- package/dist/document-models/invoice/gen/general/object.d.ts +1 -3
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.js +1 -7
- package/dist/document-models/invoice/gen/general/operations.d.ts +1 -3
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +0 -8
- package/dist/document-models/invoice/gen/schema/types.d.ts +0 -10
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +1 -3
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +0 -14
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +0 -3
- package/dist/document-models/invoice/index.d.ts +0 -2
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +0 -19
- package/dist/document-models/invoice/src/tests/general.test.js +0 -17
- package/dist/editors/billing-statement/editor.js +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +4 -5
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts +0 -2
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +26 -105
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +8 -5
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +1 -9
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +3 -128
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +1 -10
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +8 -7
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +1 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +2 -5
- package/dist/editors/invoice/editor.js +1 -1
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +2 -5
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMapping.js +1 -5
- package/dist/editors/invoice/requestFinance.js +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
- package/dist/style.css +8 -14
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +0 -14
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +0 -20
- package/package.json +2 -2
|
@@ -1,123 +1,44 @@
|
|
|
1
1
|
const billingTagMapping = [
|
|
2
|
-
{ fusion: "Budget", xero: "
|
|
3
|
-
{ fusion: "Current
|
|
4
|
-
{ fusion: "
|
|
5
|
-
{ fusion: "
|
|
6
|
-
{ fusion: "
|
|
7
|
-
{ fusion: "
|
|
8
|
-
{ fusion: "
|
|
9
|
-
{ fusion: "
|
|
10
|
-
{ fusion: "
|
|
11
|
-
{ fusion: "
|
|
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" },
|
|
2
|
+
{ fusion: "Budget", xero: "Revenue" },
|
|
3
|
+
{ fusion: "Current Liability", xero: "Current Liability" },
|
|
4
|
+
{ fusion: "Interest Income", xero: "Revenue" },
|
|
5
|
+
{ fusion: "Travel & Entertainment", xero: "Expense" },
|
|
6
|
+
{ fusion: "Cost of Goods Sold", xero: "Direct Costs" },
|
|
7
|
+
{ fusion: "Marketing Expense", xero: "Expense" },
|
|
8
|
+
{ fusion: "Professional Services", xero: "Expense" },
|
|
9
|
+
{ fusion: "Software Development Expense", xero: "Expense" },
|
|
10
|
+
{ fusion: "Compensation & Benefits", xero: "Expense" },
|
|
11
|
+
{ fusion: "Admin Expense", xero: "Expense" },
|
|
33
12
|
{ fusion: "Other Income Expense (Non-operating)", xero: "Bank Revaluations" },
|
|
34
|
-
{ fusion: "Other Income", xero: "
|
|
35
|
-
{ fusion: "Other Income", xero: "
|
|
36
|
-
{ fusion: "Income Tax Expense", xero: "
|
|
13
|
+
{ fusion: "Other Income", xero: "Unrealized Currency Gains" },
|
|
14
|
+
{ fusion: "Other Income", xero: "Realized Currency Gains" },
|
|
15
|
+
{ fusion: "Income Tax Expense", xero: "Expense" },
|
|
37
16
|
{ fusion: "Current Asset", xero: "Accounts Receivable" },
|
|
38
|
-
{ fusion: "Current Asset", xero: "
|
|
17
|
+
{ fusion: "Current Asset", xero: "Current Asset" },
|
|
39
18
|
{ fusion: "Current Asset", xero: "Inventory" },
|
|
40
|
-
{ fusion: "Software Expense", xero: "
|
|
41
|
-
{ fusion: "
|
|
42
|
-
{ fusion: "
|
|
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" },
|
|
19
|
+
{ fusion: "Software Expense", xero: "Expense" },
|
|
20
|
+
{ fusion: "Fixed Asset", xero: "Fixed Asset" },
|
|
21
|
+
{ fusion: "Non-Current Asset", xero: "Fixed Asset" },
|
|
46
22
|
{ fusion: "Current Liability", xero: "Accounts Payable" },
|
|
47
|
-
{ fusion: "
|
|
48
|
-
{ fusion: "Gas Expense", xero: "Gas Fees" },
|
|
49
|
-
{ fusion: "Other", xero: "Exchange Fees" },
|
|
23
|
+
{ fusion: "Gas Expense", xero: "Expense" },
|
|
50
24
|
{ fusion: "Current Liability", xero: "Unpaid Expense Claims" },
|
|
51
|
-
{ fusion: "Current Liability", xero: "Accrued Expenses" },
|
|
52
25
|
{ fusion: "Current Liability", xero: "Wages Payable" },
|
|
53
|
-
{ fusion: "Current Liability", xero: "
|
|
54
|
-
{ fusion: "Current Liability", xero: "Superannuation Payable" },
|
|
55
|
-
{ fusion: "Current Liability", xero: "Income Tax Payable" },
|
|
56
|
-
{ fusion: "Other", xero: "Sales Tax" },
|
|
26
|
+
{ fusion: "Current Liability", xero: "Sales Tax" },
|
|
57
27
|
{ fusion: "Adjustment A/C", xero: "Historical Adjustment" },
|
|
58
|
-
{ fusion: "Temporary Holding Account", xero: "
|
|
28
|
+
{ fusion: "Temporary Holding Account", xero: "Current Liability" },
|
|
59
29
|
{ fusion: "Other", xero: "Rounding" },
|
|
60
|
-
{ fusion: "Internal Transfers", xero: "Tracking
|
|
61
|
-
{ fusion: "Owner Equity", xero: "
|
|
62
|
-
{ fusion: "
|
|
63
|
-
{ fusion: "Non-current Liability", xero: "Loan" },
|
|
30
|
+
{ fusion: "Internal Transfers", xero: "Tracking" },
|
|
31
|
+
{ fusion: "Owner Equity", xero: "Current Liability" },
|
|
32
|
+
{ fusion: "Non-current Liability", xero: "Non-current Liability" },
|
|
64
33
|
{ fusion: "Equity", xero: "Retained Earnings" },
|
|
65
|
-
{ fusion: "Equity", xero: "
|
|
34
|
+
{ fusion: "Equity", xero: "Equity" }
|
|
66
35
|
];
|
|
67
|
-
// Mapping of labels to values
|
|
68
|
-
const fusionLabelToValue = {
|
|
69
|
-
"Budget": "budget",
|
|
70
|
-
"Current Liability": "liabilities/current",
|
|
71
|
-
"Interest Income": "income/interest",
|
|
72
|
-
"Travel & Entertainment": "expenses/headcount/travel-and-entertainment",
|
|
73
|
-
"Cost of Goods Sold": "expenses/non-headcount/direct-costs",
|
|
74
|
-
"Marketing Expense": "expenses/headcount/marketing",
|
|
75
|
-
"Professional Services": "expenses/headcount/professional-services",
|
|
76
|
-
"Software Development Expense": "expenses/non-headcount/software-development",
|
|
77
|
-
"Compensation & Benefits": "expenses/headcount/compensation-and-benefits",
|
|
78
|
-
"Admin Expense": "expenses/headcount/admin",
|
|
79
|
-
"Other Income Expense (Non-operating)": "income/non-operating",
|
|
80
|
-
"Other Income": "income/other",
|
|
81
|
-
"Income Tax Expense": "expenses/non-headcount/income-tax",
|
|
82
|
-
"Current Asset": "assets/current",
|
|
83
|
-
"Software Expense": "expenses/non-headcount/software",
|
|
84
|
-
"Fixed Asset": "assets/fixed",
|
|
85
|
-
"Non-Current Asset": "assets/non-current",
|
|
86
|
-
"Gas Expense": "expenses/non-headcount/gas",
|
|
87
|
-
"Adjustment A/C": "accounts/adjustment",
|
|
88
|
-
"Temporary Holding Account": "accounts/temporary",
|
|
89
|
-
"Other": "accounts/other",
|
|
90
|
-
"Internal Transfers": "accounts/internal-transfers",
|
|
91
|
-
"Owner Equity": "equity/owner",
|
|
92
|
-
"Non-current Liability": "liabilities/non-current",
|
|
93
|
-
"Equity": "equity/retained",
|
|
94
|
-
};
|
|
95
36
|
export const expenseAccountOptions = Array.from(new Set(billingTagMapping.map((tag) => tag.fusion))).map((tag) => {
|
|
96
37
|
return {
|
|
97
38
|
label: tag,
|
|
98
|
-
value:
|
|
39
|
+
value: tag
|
|
99
40
|
};
|
|
100
41
|
});
|
|
101
42
|
export const budgetOptions = [
|
|
102
|
-
{ label: "
|
|
103
|
-
{ label: "Jetstream", value: "JTS-001" },
|
|
43
|
+
{ label: "powerhouse", value: "PH-001" },
|
|
104
44
|
];
|
|
105
|
-
export const mapTags = (lineItemTags) => {
|
|
106
|
-
if (lineItemTags.length === 0)
|
|
107
|
-
return [];
|
|
108
|
-
const tags = lineItemTags.map((tag) => {
|
|
109
|
-
const mapping = billingTagMapping.find((mapping) => mapping.xero === tag.label);
|
|
110
|
-
const fusionLabel = fusionLabelToValue[mapping?.fusion || ""];
|
|
111
|
-
if (mapping && fusionLabel) {
|
|
112
|
-
return {
|
|
113
|
-
dimension: "expense-account",
|
|
114
|
-
value: fusionLabel,
|
|
115
|
-
label: mapping.fusion,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
if (tag.dimension === "accounting-period") {
|
|
119
|
-
return tag;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return tags;
|
|
123
|
-
};
|
|
@@ -12,6 +12,6 @@ interface DriveExplorerProps {
|
|
|
12
12
|
document: DocumentDriveDocument;
|
|
13
13
|
dispatch: EditorDispatch<DocumentDriveAction>;
|
|
14
14
|
}
|
|
15
|
-
export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch
|
|
15
|
+
export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=DriveExplorer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,mBAAmB,EAAY,KAAK,qBAAqB,EAAiB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AASxI,OAAO,KAAK,EAAsC,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGzF,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,CAAA;CAC9C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACT,EAAE,kBAAkB,2CA+OpB"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState, useRef, useEffect } from "react";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { FileItemsGrid } from "./FileItemsGrid.js";
|
|
5
|
+
import { FolderItemsGrid } from "./FolderItemsGrid.js";
|
|
4
6
|
import { useTransformedNodes } from "../hooks/useTransformedNodes.js";
|
|
5
7
|
import { useSelectedFolderChildren } from "../hooks/useSelectedFolderChildren.js";
|
|
6
8
|
import { useDispatchMap } from "../hooks/useDispatchMap.js";
|
|
7
9
|
import { DocumentDispatch } from "./DocumentDispatch.js";
|
|
8
10
|
import { EditorContainer } from "./EditorContainer.js";
|
|
9
11
|
import { CreateDocumentModal } from "@powerhousedao/design-system";
|
|
12
|
+
import { CreateDocument } from "./CreateDocument.js";
|
|
10
13
|
import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/reactor-browser";
|
|
11
14
|
import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
|
|
12
15
|
import { actions } from "../../../document-models/invoice/index.js";
|
|
13
16
|
import { useDrop } from "../hooks/useDrop.js";
|
|
14
|
-
export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch
|
|
17
|
+
export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }) {
|
|
15
18
|
const [selectedNodeId, setSelectedNodeId] = useState();
|
|
16
19
|
const [activeDocumentId, setActiveDocumentId] = useState();
|
|
17
20
|
const [openModal, setOpenModal] = useState(false);
|
|
@@ -26,18 +29,18 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
|
|
|
26
29
|
Object.entries(selected).forEach(([id, checked]) => {
|
|
27
30
|
console.log(action);
|
|
28
31
|
if (checked) {
|
|
29
|
-
if (action ===
|
|
32
|
+
if (action === 'approve' && dispatchMap[id]) {
|
|
30
33
|
dispatchMap[id](actions.editStatus({
|
|
31
34
|
status: "AWAITINGPAYMENT",
|
|
32
35
|
}));
|
|
33
36
|
}
|
|
34
|
-
else if (action ===
|
|
37
|
+
else if (action === 'reject' && dispatchMap[id]) {
|
|
35
38
|
dispatchMap[id](actions.editStatus({
|
|
36
39
|
status: "REJECTED",
|
|
37
40
|
}));
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
|
-
else if (action ===
|
|
43
|
+
else if (action === 'pay' && dispatchMap[id]) {
|
|
41
44
|
dispatchMap[id](actions.editStatus({
|
|
42
45
|
status: "PAYMENTRECEIVED",
|
|
43
46
|
}));
|
|
@@ -105,5 +108,5 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
|
|
|
105
108
|
const editorModule = activeDocument
|
|
106
109
|
? context.getEditor(activeDocument.documentType)
|
|
107
110
|
: null;
|
|
108
|
-
return (_jsxs("div", { className: "flex h-full", children: [nodes.map(
|
|
111
|
+
return (_jsxs("div", { className: "flex h-full", children: [nodes.map(node => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels[1], 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 })) : (_jsxs("div", { ...dropProps, className: twMerge('rounded-md border-2 border-transparent ', isDropTarget && 'border-dashed border-blue-100'), children: [_jsx(FolderItemsGrid, { folders: selectedFolderChildren.folders, onSelectNode: handleNodeSelect, onRenameNode: renameNode, onDuplicateNode: (uiNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, uiNode.parentFolder), onDeleteNode: onDeleteNode, onAddFile: dummyAddFile, onCopyNode: async (uiNode, targetNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, targetNode.id), onMoveNode: dummyMoveNode, isAllowedToCreateDocuments: true, onAddFolder: onAddFolder, parentFolderId: selectedNodeId }), _jsx(FileItemsGrid, { files: selectedFolderChildren.files, onSelectNode: handleFileSelect, onRenameNode: renameNode, onDuplicateNode: dummyDuplicateNode, onDeleteNode: onDeleteNode, isAllowedToCreateDocuments: true }), _jsx(CreateDocument, { createDocument: onSelectDocumentModel, documentModels: filteredDocumentModels }), _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction })] })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
|
|
109
112
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { type UiFileNode } from "@powerhousedao/design-system";
|
|
2
|
-
import { EditorDispatch } from "document-model";
|
|
3
|
-
import { DocumentModelModule } from "document-model";
|
|
4
|
-
import { DocumentDriveAction } from "document-drive";
|
|
5
2
|
interface InvoiceTableProps {
|
|
6
3
|
files: UiFileNode[];
|
|
7
4
|
state: Record<string, any>;
|
|
@@ -18,12 +15,7 @@ interface InvoiceTableProps {
|
|
|
18
15
|
[id: string]: boolean;
|
|
19
16
|
})) => void;
|
|
20
17
|
onBatchAction: (action: string) => void;
|
|
21
|
-
onDeleteNode: (nodeId: string) => void;
|
|
22
|
-
renameNode: (nodeId: string, name: string) => void;
|
|
23
|
-
filteredDocumentModels: DocumentModelModule[];
|
|
24
|
-
onSelectDocumentModel: (model: DocumentModelModule) => void;
|
|
25
|
-
dispatchMap: Record<string, EditorDispatch<DocumentDriveAction>>;
|
|
26
18
|
}
|
|
27
|
-
export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction,
|
|
19
|
+
export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
20
|
export {};
|
|
29
21
|
//# 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;
|
|
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;AA0B/D,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,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC9H,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,GAAI,2FAQ1B,iBAAiB,4CAqMnB,CAAC"}
|
|
@@ -3,25 +3,14 @@ import { useState } from "react";
|
|
|
3
3
|
import { HeaderControls } from "./HeaderControls.js";
|
|
4
4
|
import { InvoiceTableSection } from "./InvoiceTableSection.js";
|
|
5
5
|
import { InvoiceTableRow } from "./InvoiceTableRow.js";
|
|
6
|
-
import { useDriveContext, } from "@powerhousedao/reactor-browser";
|
|
7
|
-
import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
|
|
8
6
|
const statusOptions = [
|
|
9
|
-
{ label: "Draft", value: "DRAFT" },
|
|
10
7
|
{ label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
|
|
11
8
|
{ label: "Awaiting Payment", value: "AWAITINGPAYMENT" },
|
|
12
9
|
{ label: "Payment Received", value: "PAYMENTRECEIVED" },
|
|
13
10
|
{ label: "Rejected", value: "REJECTED" },
|
|
14
|
-
{ label: "Other", value: "OTHER" },
|
|
15
11
|
];
|
|
16
|
-
export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction,
|
|
12
|
+
export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }) => {
|
|
17
13
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
18
|
-
const { addDocument, addFile, documentModels, useDriveDocumentStates, selectedNode, } = useDriveContext();
|
|
19
|
-
const billingDocStates = Object.entries(state)
|
|
20
|
-
.filter(([_, doc]) => doc.documentType === "powerhouse/billing-statement")
|
|
21
|
-
.map(([id, doc]) => ({
|
|
22
|
-
id,
|
|
23
|
-
contributor: doc.global.contributor,
|
|
24
|
-
}));
|
|
25
14
|
const getMenuOptions = () => {
|
|
26
15
|
return [
|
|
27
16
|
{ label: "View Invoice", value: "view-invoice" },
|
|
@@ -41,130 +30,16 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
41
30
|
.map(([id, doc]) => ({
|
|
42
31
|
id,
|
|
43
32
|
issuer: doc.global.issuer?.name || "Unknown",
|
|
44
|
-
status: doc.global.status,
|
|
45
33
|
invoiceNo: doc.global.invoiceNo,
|
|
46
34
|
issueDate: doc.global.dateIssued,
|
|
47
35
|
dueDate: doc.global.dateDue,
|
|
48
36
|
currency: doc.global.currency,
|
|
49
37
|
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
50
|
-
exported: doc.global.exported,
|
|
51
38
|
}));
|
|
52
39
|
};
|
|
53
|
-
// console.log('filteredDocumentModels', filteredDocumentModels)
|
|
54
|
-
const getOtherInvoices = () => {
|
|
55
|
-
return Object.entries(state)
|
|
56
|
-
.filter(([_, doc]) => doc.documentType === "powerhouse/invoice" &&
|
|
57
|
-
doc.global.status !== "DRAFT" &&
|
|
58
|
-
doc.global.status !== "ISSUED" &&
|
|
59
|
-
doc.global.status !== "AWAITINGAPPROVAL" &&
|
|
60
|
-
doc.global.status !== "PAYMENTSCHEDULED" &&
|
|
61
|
-
doc.global.status !== "PAYMENTRECEIVED" &&
|
|
62
|
-
doc.global.status !== "REJECTED")
|
|
63
|
-
.map(([id, doc]) => ({
|
|
64
|
-
id,
|
|
65
|
-
issuer: doc.global.issuer?.name || "Unknown",
|
|
66
|
-
status: doc.global.status,
|
|
67
|
-
invoiceNo: doc.global.invoiceNo,
|
|
68
|
-
issueDate: doc.global.dateIssued,
|
|
69
|
-
dueDate: doc.global.dateDue,
|
|
70
|
-
currency: doc.global.currency,
|
|
71
|
-
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
72
|
-
documentType: doc.documentType,
|
|
73
|
-
exported: doc.global.exported,
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
const draft = getInvoicesByStatus("DRAFT");
|
|
77
40
|
const awaitingApproval = getInvoicesByStatus("ISSUED");
|
|
78
|
-
const awaitingPayment = getInvoicesByStatus("
|
|
41
|
+
const awaitingPayment = getInvoicesByStatus("AWAITINGPAYMENT");
|
|
79
42
|
const paid = getInvoicesByStatus("PAYMENTRECEIVED");
|
|
80
43
|
const rejected = getInvoicesByStatus("REJECTED");
|
|
81
|
-
|
|
82
|
-
const handleDelete = (id) => {
|
|
83
|
-
onDeleteNode(id);
|
|
84
|
-
// Clear selection for deleted item
|
|
85
|
-
};
|
|
86
|
-
const handleCreateBillingStatement = async (id) => {
|
|
87
|
-
const driveId = selectedNode?.id;
|
|
88
|
-
if (!driveId)
|
|
89
|
-
return;
|
|
90
|
-
const invoiceFile = files.find((file) => file.id === id);
|
|
91
|
-
const invoiceState = state[id];
|
|
92
|
-
const billingDoc = await addDocument(driveId, `bill-${invoiceFile?.name}`, "powerhouse/billing-statement", undefined, {
|
|
93
|
-
name: `bill-${invoiceFile?.name}`,
|
|
94
|
-
created: new Date().toISOString(),
|
|
95
|
-
lastModified: new Date().toISOString(),
|
|
96
|
-
documentType: "powerhouse/billing-statement",
|
|
97
|
-
state: {
|
|
98
|
-
global: {
|
|
99
|
-
contributor: id,
|
|
100
|
-
dateIssued: invoiceState.global.dateIssued,
|
|
101
|
-
dateDue: invoiceState.global.dateDue,
|
|
102
|
-
lineItems: invoiceState.global.lineItems.map((item) => {
|
|
103
|
-
return {
|
|
104
|
-
id: item.id,
|
|
105
|
-
description: item.description,
|
|
106
|
-
quantity: item.quantity,
|
|
107
|
-
unit: 'UNIT',
|
|
108
|
-
unitPricePwt: 0,
|
|
109
|
-
unitPriceCash: item.unitPriceTaxIncl,
|
|
110
|
-
totalPricePwt: 0,
|
|
111
|
-
totalPriceCash: item.totalPriceTaxIncl,
|
|
112
|
-
lineItemTag: mapTags(item.lineItemTag || []),
|
|
113
|
-
};
|
|
114
|
-
}),
|
|
115
|
-
status: invoiceState.global.status,
|
|
116
|
-
currency: invoiceState.global.currency,
|
|
117
|
-
totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
118
|
-
totalPowt: 0,
|
|
119
|
-
notes: invoiceState.global.notes,
|
|
120
|
-
},
|
|
121
|
-
local: {},
|
|
122
|
-
},
|
|
123
|
-
revision: {
|
|
124
|
-
global: 0,
|
|
125
|
-
local: 0,
|
|
126
|
-
},
|
|
127
|
-
operations: {
|
|
128
|
-
global: [],
|
|
129
|
-
local: [],
|
|
130
|
-
},
|
|
131
|
-
initialState: {
|
|
132
|
-
name: `bill-${invoiceFile?.name}`,
|
|
133
|
-
documentType: "powerhouse/billing-statement",
|
|
134
|
-
created: new Date().toISOString(),
|
|
135
|
-
lastModified: new Date().toISOString(),
|
|
136
|
-
revision: {
|
|
137
|
-
global: 0,
|
|
138
|
-
local: 0,
|
|
139
|
-
},
|
|
140
|
-
state: {
|
|
141
|
-
global: {},
|
|
142
|
-
local: {},
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
clipboard: [],
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
const handleCSVExport = () => {
|
|
149
|
-
console.log('exporting...', selected);
|
|
150
|
-
};
|
|
151
|
-
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) => ({
|
|
152
|
-
...prev,
|
|
153
|
-
[row.id]: checked,
|
|
154
|
-
})), 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) => ({
|
|
155
|
-
...prev,
|
|
156
|
-
[row.id]: checked,
|
|
157
|
-
})), 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) => ({
|
|
158
|
-
...prev,
|
|
159
|
-
[row.id]: checked,
|
|
160
|
-
})), 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) => ({
|
|
161
|
-
...prev,
|
|
162
|
-
[row.id]: checked,
|
|
163
|
-
})), 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) => ({
|
|
164
|
-
...prev,
|
|
165
|
-
[row.id]: checked,
|
|
166
|
-
})), 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) => ({
|
|
167
|
-
...prev,
|
|
168
|
-
[row.id]: checked,
|
|
169
|
-
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) }))] }, `${Object.keys(state).length}`));
|
|
44
|
+
return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md overflow-y-auto max-h-[500px] mt-4", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction }), 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-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: awaitingApproval.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, 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-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: awaitingPayment.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, 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-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: paid.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, 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-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, row.id))) })] }) }))] }));
|
|
170
45
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }: {
|
|
3
|
-
files?: UiFileNode[];
|
|
1
|
+
export declare const InvoiceTableRow: ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }: {
|
|
4
2
|
row: any;
|
|
5
3
|
isSelected: boolean;
|
|
6
4
|
onSelect: (checked: boolean) => void;
|
|
@@ -10,12 +8,5 @@ export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, menuO
|
|
|
10
8
|
}[];
|
|
11
9
|
onMenuAction: (action: string) => void;
|
|
12
10
|
setActiveDocumentId: (id: string) => void;
|
|
13
|
-
onDeleteNode: (nodeId: string) => void;
|
|
14
|
-
renameNode: (nodeId: string, name: string) => void;
|
|
15
|
-
onCreateBillingStatement?: (id: string) => void;
|
|
16
|
-
billingDocStates?: {
|
|
17
|
-
id: string;
|
|
18
|
-
contributor: string;
|
|
19
|
-
}[];
|
|
20
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
12
|
//# sourceMappingURL=InvoiceTableRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,GAAI,+EAO7B;IACD,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,4CAiDA,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef } from "react";
|
|
3
|
-
import {
|
|
4
|
-
export const InvoiceTableRow = ({
|
|
3
|
+
import { RowActionMenu } from "./RowActionMenu.js";
|
|
4
|
+
export const InvoiceTableRow = ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }) => {
|
|
5
5
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
6
6
|
const menuRef = useRef(null);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
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: "px-2 py-2", children: row.issuer }), _jsx("td", { className: "px-2 py-2", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2", children: row.issueDate }), _jsx("td", { className: "px-2 py-2", children: row.dueDate }), _jsx("td", { className: "px-2 py-2", children: row.currency }), _jsx("td", { className: "px-2 py-2", children: row.amount }), _jsx("td", { className: "px-2 py-2 text-right relative", ref: menuRef, children: _jsxs("div", { className: "relative inline-block", children: [_jsx("button", { className: "px-2 py-1 hover:bg-gray-200 rounded", onClick: () => setMenuOpen(v => !v), children: "\u2026" }), menuOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setMenuOpen(false) }), _jsx(RowActionMenu, { options: menuOptions, onAction: action => {
|
|
8
|
+
onMenuAction(action);
|
|
9
|
+
setMenuOpen(false);
|
|
10
|
+
setActiveDocumentId(row.id);
|
|
11
|
+
} })] }))] }) })] }));
|
|
11
12
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InvoiceTableSection: ({ title, count, children, color, onSelectDocumentModel, filteredDocumentModels, }: {
|
|
1
|
+
export declare const InvoiceTableSection: ({ title, count, children, color, }: {
|
|
3
2
|
title: string;
|
|
4
3
|
count: number;
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
color?: string;
|
|
7
|
-
onSelectDocumentModel?: (model: DocumentModelModule) => void;
|
|
8
|
-
filteredDocumentModels?: DocumentModelModule[];
|
|
9
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
7
|
//# sourceMappingURL=InvoiceTableSection.d.ts.map
|
package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.tsx"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,GAAI,oCAKjC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,4CA8BA,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
4
|
-
export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600",
|
|
4
|
+
export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600", }) => {
|
|
5
5
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
6
|
-
|
|
7
|
-
return (_jsxs("div", { className: "mb-2", children: [_jsxs("div", { className: "grid grid-cols-2", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center gap-2 hover:opacity-80 transition-opacity col-span-1", children: [_jsx("span", { className: "font-medium", children: title }), _jsx("span", { className: `inline-flex items-center justify-center rounded-full text-xs font-bold px-2 ${color}`, children: count }), isExpanded ? (_jsx(ChevronDown, { className: "w-4 h-4 text-gray-900" })) : (_jsx(ChevronRight, { className: "w-4 h-4 text-gray-900" }))] }), title === "Draft" && (_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: () => {
|
|
8
|
-
onSelectDocumentModel?.(invoiceDodModel);
|
|
9
|
-
}, children: "Create Invoice" }))] }), isExpanded && _jsx("div", { className: "mt-2", children: children })] }));
|
|
6
|
+
return (_jsxs("div", { className: "mb-2", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center gap-2 hover:opacity-80 transition-opacity", children: [_jsx("span", { className: "font-medium", children: title }), _jsx("span", { className: `inline-flex items-center justify-center rounded-full text-xs font-bold px-2 ${color}`, children: count }), isExpanded ? (_jsx(ChevronDown, { className: "w-4 h-4 text-gray-900" })) : (_jsx(ChevronRight, { className: "w-4 h-4 text-gray-900" }))] }), isExpanded && (_jsx("div", { className: "mt-2", children: children }))] }));
|
|
10
7
|
};
|
|
@@ -396,7 +396,7 @@ export default function Editor(props) {
|
|
|
396
396
|
dateDelivered: newValue,
|
|
397
397
|
}));
|
|
398
398
|
}
|
|
399
|
-
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className:
|
|
399
|
+
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0`, onChange: (e) => dispatch(actions.editInvoice({
|
|
400
400
|
dateDue: e.target.value.split("T")[0],
|
|
401
401
|
})), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
|
|
402
402
|
...item,
|
|
@@ -6,7 +6,7 @@ import { uploadPdfChunked } from "./uploadPdfChunked.js";
|
|
|
6
6
|
import { getCountryCodeFromName } from "./utils/utils.js";
|
|
7
7
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
8
8
|
if (window.document.baseURI !== 'http://localhost:3000/') {
|
|
9
|
-
GRAPHQL_URL = 'https://switchboard
|
|
9
|
+
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
|
|
10
10
|
}
|
|
11
11
|
export async function loadPDFFile({ file, dispatch, }) {
|
|
12
12
|
if (!file)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqLnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,10 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
|
|
4
4
|
if (window.document.baseURI !== "http://localhost:3000/") {
|
|
5
|
-
GRAPHQL_URL = "https://switchboard
|
|
6
|
-
}
|
|
7
|
-
if (window.document.baseURI !== "http://localhost:3001/") {
|
|
8
|
-
GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
|
|
5
|
+
GRAPHQL_URL = "https://switchboard.powerhouse.xyz/graphql/invoice";
|
|
9
6
|
}
|
|
10
7
|
const InvoiceToGnosis = ({ docState }) => {
|
|
11
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -127,6 +124,6 @@ const InvoiceToGnosis = ({ docState }) => {
|
|
|
127
124
|
}
|
|
128
125
|
};
|
|
129
126
|
const urlChainName = parseChainName(chainName);
|
|
130
|
-
return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=${urlChainName}:
|
|
127
|
+
return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=${urlChainName}:0xF130f741d4E3185b29412c65397363f8c23A0460`, target: "_blank", rel: "noopener noreferrer", className: "text-blue-500 hover:text-blue-600 underline block", children: "View Transaction" })] })), invoiceStatusResponse && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md", children: [_jsx("p", { className: "font-medium", children: "Payment Details:" }), _jsx("p", { className: "text-gray-700", children: invoiceStatusResponse })] }))] }));
|
|
131
128
|
};
|
|
132
129
|
export default InvoiceToGnosis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA6LxB"}
|