@powerhousedao/contributor-billing 0.0.22 → 0.0.23
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 +24 -2
- package/dist/document-models/invoice/gen/general/actions.d.ts +4 -2
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.d.ts +4 -2
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.js +2 -0
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -1
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.js +7 -1
- package/dist/document-models/invoice/gen/general/operations.d.ts +3 -1
- 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 +8 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts +10 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +3 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +14 -0
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +3 -0
- package/dist/document-models/invoice/index.d.ts +2 -0
- 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 +19 -0
- package/dist/document-models/invoice/src/tests/general.test.js +17 -10
- package/dist/document-models/invoice/src/tests/items.test.js +0 -6
- package/dist/document-models/invoice/src/tests/parties.test.js +0 -12
- package/dist/editors/billing-statement/editor.js +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +5 -4
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts +2 -0
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +105 -26
- 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 +5 -8
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/EditorContainer.js +6 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +9 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +163 -3
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +10 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +7 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +4 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +5 -2
- package/dist/editors/contributor-billing/editor.js +1 -1
- package/dist/editors/invoice/editor.js +2 -2
- package/dist/editors/invoice/ingestPDF.js +2 -2
- package/dist/editors/invoice/invoiceToGnosis.d.ts +1 -0
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +10 -4
- 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 +5 -1
- 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 +139 -976
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +5 -7
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +19 -7
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +20 -0
- package/package.json +15 -14
- package/dist/editors/billing-statement/components/lineItems.d.ts +0 -3
- package/dist/editors/billing-statement/components/lineItems.d.ts.map +0 -1
- package/dist/editors/billing-statement/components/lineItems.js +0 -24
|
@@ -3,14 +3,26 @@ 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 { generateId } from "document-model";
|
|
8
|
+
import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
|
|
6
9
|
const statusOptions = [
|
|
10
|
+
{ label: "Draft", value: "DRAFT" },
|
|
7
11
|
{ label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
|
|
8
12
|
{ label: "Awaiting Payment", value: "AWAITINGPAYMENT" },
|
|
9
13
|
{ label: "Payment Received", value: "PAYMENTRECEIVED" },
|
|
10
14
|
{ label: "Rejected", value: "REJECTED" },
|
|
15
|
+
{ label: "Other", value: "OTHER" },
|
|
11
16
|
];
|
|
12
|
-
export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }) => {
|
|
17
|
+
export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }) => {
|
|
13
18
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
19
|
+
const { addDocument, addFile, documentModels, useDriveDocumentStates, selectedNode, } = useDriveContext();
|
|
20
|
+
const billingDocStates = Object.entries(state)
|
|
21
|
+
.filter(([_, doc]) => doc.documentType === "powerhouse/billing-statement")
|
|
22
|
+
.map(([id, doc]) => ({
|
|
23
|
+
id,
|
|
24
|
+
contributor: doc.global.contributor,
|
|
25
|
+
}));
|
|
14
26
|
const getMenuOptions = () => {
|
|
15
27
|
return [
|
|
16
28
|
{ label: "View Invoice", value: "view-invoice" },
|
|
@@ -30,16 +42,164 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
|
|
|
30
42
|
.map(([id, doc]) => ({
|
|
31
43
|
id,
|
|
32
44
|
issuer: doc.global.issuer?.name || "Unknown",
|
|
45
|
+
status: doc.global.status,
|
|
33
46
|
invoiceNo: doc.global.invoiceNo,
|
|
34
47
|
issueDate: doc.global.dateIssued,
|
|
35
48
|
dueDate: doc.global.dateDue,
|
|
36
49
|
currency: doc.global.currency,
|
|
37
50
|
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
51
|
+
exported: doc.global.exported,
|
|
38
52
|
}));
|
|
39
53
|
};
|
|
54
|
+
// console.log('filteredDocumentModels', filteredDocumentModels)
|
|
55
|
+
const getOtherInvoices = () => {
|
|
56
|
+
return Object.entries(state)
|
|
57
|
+
.filter(([_, doc]) => doc.documentType === "powerhouse/invoice" &&
|
|
58
|
+
doc.global.status !== "DRAFT" &&
|
|
59
|
+
doc.global.status !== "ISSUED" &&
|
|
60
|
+
doc.global.status !== "AWAITINGAPPROVAL" &&
|
|
61
|
+
doc.global.status !== "PAYMENTSCHEDULED" &&
|
|
62
|
+
doc.global.status !== "PAYMENTRECEIVED" &&
|
|
63
|
+
doc.global.status !== "REJECTED")
|
|
64
|
+
.map(([id, doc]) => ({
|
|
65
|
+
id,
|
|
66
|
+
issuer: doc.global.issuer?.name || "Unknown",
|
|
67
|
+
status: doc.global.status,
|
|
68
|
+
invoiceNo: doc.global.invoiceNo,
|
|
69
|
+
issueDate: doc.global.dateIssued,
|
|
70
|
+
dueDate: doc.global.dateDue,
|
|
71
|
+
currency: doc.global.currency,
|
|
72
|
+
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
73
|
+
documentType: doc.documentType,
|
|
74
|
+
exported: doc.global.exported,
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
const draft = getInvoicesByStatus("DRAFT");
|
|
40
78
|
const awaitingApproval = getInvoicesByStatus("ISSUED");
|
|
41
|
-
const awaitingPayment = getInvoicesByStatus("
|
|
79
|
+
const awaitingPayment = getInvoicesByStatus("PAYMENTSCHEDULED");
|
|
42
80
|
const paid = getInvoicesByStatus("PAYMENTRECEIVED");
|
|
43
81
|
const rejected = getInvoicesByStatus("REJECTED");
|
|
44
|
-
|
|
82
|
+
const otherInvoices = getOtherInvoices();
|
|
83
|
+
const handleDelete = (id) => {
|
|
84
|
+
onDeleteNode(id);
|
|
85
|
+
// Clear selection for deleted item
|
|
86
|
+
};
|
|
87
|
+
const cleanName = (name) => {
|
|
88
|
+
const dotIndex = name.lastIndexOf(".");
|
|
89
|
+
if (dotIndex > 0) {
|
|
90
|
+
return name.substring(0, dotIndex);
|
|
91
|
+
}
|
|
92
|
+
return name;
|
|
93
|
+
};
|
|
94
|
+
const handleCreateBillingStatement = async (id) => {
|
|
95
|
+
const driveId = selectedNode?.id;
|
|
96
|
+
if (!driveId)
|
|
97
|
+
return;
|
|
98
|
+
const invoiceFile = files.find((file) => file.id === id);
|
|
99
|
+
const invoiceState = state[id];
|
|
100
|
+
const newDocumentId = generateId();
|
|
101
|
+
await addDocument(driveId, `bill-${invoiceFile?.name}`, "powerhouse/billing-statement", undefined, {
|
|
102
|
+
id: newDocumentId,
|
|
103
|
+
slug: `bill-${cleanName(invoiceFile?.name || "")}`,
|
|
104
|
+
name: `bill-${cleanName(invoiceFile?.name || "")}`,
|
|
105
|
+
created: new Date().toISOString(),
|
|
106
|
+
lastModified: new Date().toISOString(),
|
|
107
|
+
documentType: "powerhouse/billing-statement",
|
|
108
|
+
state: {
|
|
109
|
+
global: {
|
|
110
|
+
contributor: id,
|
|
111
|
+
dateIssued: invoiceState.global.dateIssued,
|
|
112
|
+
dateDue: invoiceState.global.dateDue,
|
|
113
|
+
lineItems: invoiceState.global.lineItems.map((item) => {
|
|
114
|
+
return {
|
|
115
|
+
id: item.id,
|
|
116
|
+
description: item.description,
|
|
117
|
+
quantity: item.quantity,
|
|
118
|
+
unit: 'UNIT',
|
|
119
|
+
unitPricePwt: 0,
|
|
120
|
+
unitPriceCash: item.unitPriceTaxIncl,
|
|
121
|
+
totalPricePwt: 0,
|
|
122
|
+
totalPriceCash: item.totalPriceTaxIncl,
|
|
123
|
+
lineItemTag: mapTags(item.lineItemTag || []),
|
|
124
|
+
};
|
|
125
|
+
}),
|
|
126
|
+
status: invoiceState.global.status,
|
|
127
|
+
currency: invoiceState.global.currency,
|
|
128
|
+
totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
129
|
+
totalPowt: 0,
|
|
130
|
+
notes: invoiceState.global.notes,
|
|
131
|
+
},
|
|
132
|
+
local: {},
|
|
133
|
+
},
|
|
134
|
+
revision: {
|
|
135
|
+
global: 0,
|
|
136
|
+
local: 0,
|
|
137
|
+
},
|
|
138
|
+
operations: {
|
|
139
|
+
global: [],
|
|
140
|
+
local: [],
|
|
141
|
+
},
|
|
142
|
+
initialState: {
|
|
143
|
+
id: newDocumentId,
|
|
144
|
+
slug: `bill-${cleanName(invoiceFile?.name || "")}`,
|
|
145
|
+
name: `bill-${cleanName(invoiceFile?.name || "")}`,
|
|
146
|
+
documentType: "powerhouse/billing-statement",
|
|
147
|
+
created: new Date().toISOString(),
|
|
148
|
+
lastModified: new Date().toISOString(),
|
|
149
|
+
revision: {
|
|
150
|
+
global: 0,
|
|
151
|
+
local: 0,
|
|
152
|
+
},
|
|
153
|
+
state: {
|
|
154
|
+
global: {
|
|
155
|
+
contributor: id,
|
|
156
|
+
dateIssued: invoiceState.global.dateIssued,
|
|
157
|
+
dateDue: invoiceState.global.dateDue,
|
|
158
|
+
lineItems: invoiceState.global.lineItems.map((item) => {
|
|
159
|
+
return {
|
|
160
|
+
id: item.id,
|
|
161
|
+
description: item.description,
|
|
162
|
+
quantity: item.quantity,
|
|
163
|
+
unit: 'UNIT',
|
|
164
|
+
unitPricePwt: 0,
|
|
165
|
+
unitPriceCash: item.unitPriceTaxIncl,
|
|
166
|
+
totalPricePwt: 0,
|
|
167
|
+
totalPriceCash: item.totalPriceTaxIncl,
|
|
168
|
+
lineItemTag: mapTags(item.lineItemTag || []),
|
|
169
|
+
};
|
|
170
|
+
}),
|
|
171
|
+
status: invoiceState.global.status,
|
|
172
|
+
currency: invoiceState.global.currency,
|
|
173
|
+
totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
|
|
174
|
+
totalPowt: 0,
|
|
175
|
+
notes: invoiceState.global.notes,
|
|
176
|
+
},
|
|
177
|
+
local: {},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
clipboard: [],
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
const handleCSVExport = () => {
|
|
184
|
+
console.log('exporting...', selected);
|
|
185
|
+
};
|
|
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) => ({
|
|
187
|
+
...prev,
|
|
188
|
+
[row.id]: checked,
|
|
189
|
+
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("AWAITINGAPPROVAL") && (_jsx(InvoiceTableSection, { title: "Awaiting Approval", count: awaitingApproval.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingApproval.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
|
|
190
|
+
...prev,
|
|
191
|
+
[row.id]: checked,
|
|
192
|
+
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("AWAITINGPAYMENT") && (_jsx(InvoiceTableSection, { title: "Awaiting Payment", count: awaitingPayment.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingPayment.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
|
|
193
|
+
...prev,
|
|
194
|
+
[row.id]: checked,
|
|
195
|
+
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTRECEIVED") && (_jsx(InvoiceTableSection, { title: "Payment Received", count: paid.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: paid.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
|
|
196
|
+
...prev,
|
|
197
|
+
[row.id]: checked,
|
|
198
|
+
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
|
|
199
|
+
...prev,
|
|
200
|
+
[row.id]: checked,
|
|
201
|
+
})), 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) => ({
|
|
202
|
+
...prev,
|
|
203
|
+
[row.id]: checked,
|
|
204
|
+
})), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) }))] }, `${Object.keys(state).length}`));
|
|
45
205
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type UiFileNode } from "@powerhousedao/design-system";
|
|
2
|
+
export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }: {
|
|
3
|
+
files?: UiFileNode[];
|
|
2
4
|
row: any;
|
|
3
5
|
isSelected: boolean;
|
|
4
6
|
onSelect: (checked: boolean) => void;
|
|
@@ -8,5 +10,12 @@ export declare const InvoiceTableRow: ({ row, isSelected, onSelect, menuOptions,
|
|
|
8
10
|
}[];
|
|
9
11
|
onMenuAction: (action: string) => void;
|
|
10
12
|
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
|
+
}[];
|
|
11
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
21
|
//# 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":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,eAAe,GAAI,6JAY7B;IACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,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;IAC1C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D,4CA8FA,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef } from "react";
|
|
3
|
-
import {
|
|
4
|
-
export const InvoiceTableRow = ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }) => {
|
|
3
|
+
import { FileItem, } from "@powerhousedao/design-system";
|
|
4
|
+
export const InvoiceTableRow = ({ files, row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }) => {
|
|
5
5
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
6
6
|
const menuRef = useRef(null);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} })] }))] }) })] }));
|
|
7
|
+
const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
|
|
8
|
+
const billingFile = files?.find((file) => file.id === billingDoc?.id);
|
|
9
|
+
const file = files?.find((file) => file.id === row.id);
|
|
10
|
+
return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: row.exported ? _jsx("span", { className: "text-green-500", children: "Yes" }) : _jsx("span", { className: "text-red-500", children: "No" }) })] }));
|
|
12
11
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { DocumentModelModule } from "document-model";
|
|
2
|
+
export declare const InvoiceTableSection: ({ title, count, children, color, onSelectDocumentModel, filteredDocumentModels, }: {
|
|
2
3
|
title: string;
|
|
3
4
|
count: number;
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
color?: string;
|
|
7
|
+
onSelectDocumentModel?: (model: DocumentModelModule) => void;
|
|
8
|
+
filteredDocumentModels?: DocumentModelModule[];
|
|
6
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
//# 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,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,mBAAmB,GAAI,mFAOjC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7D,sBAAsB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAChD,4CAsCA,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
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", onSelectDocumentModel, filteredDocumentModels, }) => {
|
|
5
5
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
6
|
-
|
|
6
|
+
const invoiceDodModel = filteredDocumentModels?.find(model => model.documentModel.id === "powerhouse/invoice");
|
|
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 })] }));
|
|
7
10
|
};
|
|
@@ -41,7 +41,7 @@ export function BaseEditor(props) {
|
|
|
41
41
|
dispatch(copyNodeAction);
|
|
42
42
|
}
|
|
43
43
|
}, [dispatch, props.document.state.global.nodes]);
|
|
44
|
-
return (_jsx("div", { className: "new-drive-explorer", children: _jsx(DriveExplorer, { driveId: props.document.
|
|
44
|
+
return (_jsx("div", { className: "new-drive-explorer", children: _jsx(DriveExplorer, { driveId: props.document.id, nodes: nodes, onAddFolder: onAddFolder, onDeleteNode: onDeleteNode, renameNode: renameNode, onCopyNode: onCopyNode, context: context, document: props.document, dispatch: dispatch }, nodes.length) }));
|
|
45
45
|
}
|
|
46
46
|
export default function Editor(props) {
|
|
47
47
|
return (_jsx(DriveContextProvider, { value: props.context, children: _jsx(WagmiContext, { children: _jsx(BaseEditor, { ...props }) }) }));
|
|
@@ -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: 'w-64', 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,
|
|
@@ -411,5 +411,5 @@ export default function Editor(props) {
|
|
|
411
411
|
}
|
|
412
412
|
}, onChange: (e) => {
|
|
413
413
|
setNotes(e.target.value);
|
|
414
|
-
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state })) : (_jsx(RequestFinance, { docState: state })) }))] }));
|
|
414
|
+
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state, dispatch: dispatch })) : (_jsx(RequestFinance, { docState: state })) }))] }));
|
|
415
415
|
}
|
|
@@ -5,8 +5,8 @@ import { toast } from "@powerhousedao/design-system";
|
|
|
5
5
|
import { uploadPdfChunked } from "./uploadPdfChunked.js";
|
|
6
6
|
import { getCountryCodeFromName } from "./utils/utils.js";
|
|
7
7
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
8
|
-
if (window.document.baseURI
|
|
9
|
-
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
|
|
8
|
+
if (!window.document.baseURI.includes('localhost')) {
|
|
9
|
+
GRAPHQL_URL = 'https://switchboard-dev.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;AAWxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA2LnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { actions, } from "../../document-models/invoice/index.js";
|
|
3
4
|
let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
|
|
4
|
-
if (window.document.baseURI
|
|
5
|
-
GRAPHQL_URL =
|
|
5
|
+
if (!window.document.baseURI.includes('localhost')) {
|
|
6
|
+
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
6
7
|
}
|
|
7
|
-
const InvoiceToGnosis = ({ docState }) => {
|
|
8
|
+
const InvoiceToGnosis = ({ docState, dispatch }) => {
|
|
8
9
|
const [isLoading, setIsLoading] = useState(false);
|
|
9
10
|
const [error, setError] = useState(null);
|
|
10
11
|
const [responseData, setResponseData] = useState(null);
|
|
@@ -90,6 +91,11 @@ const InvoiceToGnosis = ({ docState }) => {
|
|
|
90
91
|
if (data.success) {
|
|
91
92
|
const dataObj = typeof data.data === "string" ? JSON.parse(data.data) : data.data;
|
|
92
93
|
setsafeTxHash(dataObj.txHash);
|
|
94
|
+
// add gnosis tx hash to invoice
|
|
95
|
+
dispatch(actions.editPaymentData({
|
|
96
|
+
txnHash: dataObj.txHash,
|
|
97
|
+
paymentDate: new Date().toISOString(),
|
|
98
|
+
}));
|
|
93
99
|
if (dataObj.paymentDetails) {
|
|
94
100
|
// Format the payment details for better readability
|
|
95
101
|
const formattedDetails = {
|
|
@@ -124,6 +130,6 @@ const InvoiceToGnosis = ({ docState }) => {
|
|
|
124
130
|
}
|
|
125
131
|
};
|
|
126
132
|
const urlChainName = parseChainName(chainName);
|
|
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}:
|
|
133
|
+
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}:0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e`, 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 })] }))] }));
|
|
128
134
|
};
|
|
129
135
|
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,2CA2LxB"}
|
|
@@ -36,7 +36,7 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccount
|
|
|
36
36
|
id: item.id,
|
|
37
37
|
description: e.target.value,
|
|
38
38
|
}));
|
|
39
|
-
}
|
|
39
|
+
} }) }), _jsx("td", { className: "border-b border-gray-200 w-48", children: _jsx(DatePicker, { name: "period", dateFormat: "YYYY-MM-DD", autoClose: true, placeholder: "Select Period", value: item.lineItemTag.find((tag) => tag.dimension === "accounting-period")?.label || "", onChange: (e) => dispatch(actions.setLineItemTag({
|
|
40
40
|
lineItemId: item.id,
|
|
41
41
|
dimension: "accounting-period",
|
|
42
42
|
value: new Date(e.target.value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAiE/C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAc/C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const expenseAccountOptions = [
|
|
2
2
|
{ label: "Grants from Maker DAO", value: "200" },
|
|
3
|
+
{ label: "Clearing Account", value: "2001" },
|
|
3
4
|
{ label: "Request Finance IC account", value: "2222" },
|
|
4
5
|
{ label: "Interest Income", value: "270" },
|
|
5
6
|
{ label: "Activities and Events", value: "3000" },
|
|
@@ -7,12 +8,13 @@ export const expenseAccountOptions = [
|
|
|
7
8
|
{ label: "Airfare", value: "3002" },
|
|
8
9
|
{ label: "Hotels", value: "3003" },
|
|
9
10
|
{ label: "Transportation (Uber, Taxi etc)", value: "3004" },
|
|
11
|
+
{ label: "Other travel cost", value: "3005" },
|
|
10
12
|
{ label: "Cost of Goods Sold", value: "310" },
|
|
11
13
|
{ label: "Advertising", value: "400" },
|
|
12
14
|
{ label: "Legal Fees Abroad", value: "4001" },
|
|
13
15
|
{ label: "Legal Fees Switzerland", value: "4002" },
|
|
14
16
|
{ label: "Finance Team Fees Abroad", value: "4003" },
|
|
15
|
-
{ label: "
|
|
17
|
+
{ label: "Finance and Accounting Fees Switzerland", value: "4004" },
|
|
16
18
|
{ label: "Software Development Team Fees", value: "4005" },
|
|
17
19
|
{ label: "Research Team Fees", value: "4006" },
|
|
18
20
|
{ label: "Marketing Team Fees", value: "4007" },
|
|
@@ -36,6 +38,7 @@ export const expenseAccountOptions = [
|
|
|
36
38
|
{ label: "Prepayments", value: "620" },
|
|
37
39
|
{ label: "Inventory", value: "630" },
|
|
38
40
|
{ label: "Software/IT Subscriptions", value: "701" },
|
|
41
|
+
{ label: "Telephone and Internet Charges", value: "702" },
|
|
39
42
|
{ label: "Office Equipment", value: "710" },
|
|
40
43
|
{ label: "Less Accumulated Depreciation on Office Equipment", value: "711" },
|
|
41
44
|
{ label: "Computer Equipment", value: "720" },
|
|
@@ -45,6 +48,7 @@ export const expenseAccountOptions = [
|
|
|
45
48
|
{ label: "Gas Fees", value: "8001" },
|
|
46
49
|
{ label: "Exchange Fees", value: "8003" },
|
|
47
50
|
{ label: "Unpaid Expense Claims", value: "801" },
|
|
51
|
+
{ label: "Accrued Expenses", value: "802" },
|
|
48
52
|
{ label: "Wages Payable", value: "803" },
|
|
49
53
|
{ label: "Sales Tax", value: "820" },
|
|
50
54
|
{ label: "Employee Tax Payable", value: "825" },
|
|
@@ -2,7 +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.powerhouse.xyz/graphql/invoice';
|
|
5
|
+
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
6
6
|
}
|
|
7
7
|
const RequestFinance = ({ docState }) => {
|
|
8
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
9
9
|
if (window.document.baseURI !== 'http://localhost:3000/') {
|
|
10
|
-
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
|
|
10
|
+
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
11
11
|
}
|
|
12
12
|
export async function uploadPdfChunked(pdfData, endpoint = GRAPHQL_URL, chunkSize = 500 * 1024, // 500KB chunks
|
|
13
13
|
onProgress) {
|
|
@@ -4,7 +4,7 @@ import { OperationType } from '@safe-global/types-kit';
|
|
|
4
4
|
import { ethers, AbiCoder } from 'ethers';
|
|
5
5
|
import dotenv from 'dotenv';
|
|
6
6
|
dotenv.config();
|
|
7
|
-
const safeAddress = process.env.
|
|
7
|
+
const safeAddress = process.env.DEV_STAGING_SAFE_ADDRESS;
|
|
8
8
|
if (!safeAddress) {
|
|
9
9
|
throw new Error('Missing SAFE_ADDRESS in .env');
|
|
10
10
|
}
|