@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
|
@@ -13,8 +13,6 @@ describe("Parties Operations", () => {
|
|
|
13
13
|
document = utils.createDocument();
|
|
14
14
|
});
|
|
15
15
|
it("should handle editIssuer operation", () => {
|
|
16
|
-
// generate a random id
|
|
17
|
-
// const id = documentModelUtils.hashKey();
|
|
18
16
|
const input = generateMock(z.EditIssuerInputSchema());
|
|
19
17
|
const updatedDocument = reducer(document, creators.editIssuer(input));
|
|
20
18
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -23,8 +21,6 @@ describe("Parties Operations", () => {
|
|
|
23
21
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
22
|
});
|
|
25
23
|
it("should handle editIssuerBank operation", () => {
|
|
26
|
-
// generate a random id
|
|
27
|
-
// const id = documentModelUtils.hashKey();
|
|
28
24
|
const input = generateMock(z.EditIssuerBankInputSchema());
|
|
29
25
|
const updatedDocument = reducer(document, creators.editIssuerBank(input));
|
|
30
26
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -33,8 +29,6 @@ describe("Parties Operations", () => {
|
|
|
33
29
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
30
|
});
|
|
35
31
|
it("should handle editIssuerWallet operation", () => {
|
|
36
|
-
// generate a random id
|
|
37
|
-
// const id = documentModelUtils.hashKey();
|
|
38
32
|
const input = generateMock(z.EditIssuerWalletInputSchema());
|
|
39
33
|
const updatedDocument = reducer(document, creators.editIssuerWallet(input));
|
|
40
34
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -43,8 +37,6 @@ describe("Parties Operations", () => {
|
|
|
43
37
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
38
|
});
|
|
45
39
|
it("should handle editPayer operation", () => {
|
|
46
|
-
// generate a random id
|
|
47
|
-
// const id = documentModelUtils.hashKey();
|
|
48
40
|
const input = generateMock(z.EditPayerInputSchema());
|
|
49
41
|
const updatedDocument = reducer(document, creators.editPayer(input));
|
|
50
42
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -53,8 +45,6 @@ describe("Parties Operations", () => {
|
|
|
53
45
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
54
46
|
});
|
|
55
47
|
it("should handle editPayerBank operation", () => {
|
|
56
|
-
// generate a random id
|
|
57
|
-
// const id = documentModelUtils.hashKey();
|
|
58
48
|
const input = generateMock(z.EditPayerBankInputSchema());
|
|
59
49
|
const updatedDocument = reducer(document, creators.editPayerBank(input));
|
|
60
50
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -63,8 +53,6 @@ describe("Parties Operations", () => {
|
|
|
63
53
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
64
54
|
});
|
|
65
55
|
it("should handle editPayerWallet operation", () => {
|
|
66
|
-
// generate a random id
|
|
67
|
-
// const id = documentModelUtils.hashKey();
|
|
68
56
|
const input = generateMock(z.EditPayerWalletInputSchema());
|
|
69
57
|
const updatedDocument = reducer(document, creators.editPayerWallet(input));
|
|
70
58
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
@@ -12,12 +12,12 @@ export default function Editor(props) {
|
|
|
12
12
|
const [notes, setNotes] = useState(state.notes ?? "");
|
|
13
13
|
return (_jsxs("div", { className: "editor-container", children: [_jsxs("div", { className: "grid grid-cols-2 gap-2 border border-gray-500 p-2 rounded-md bg-gray-1001", children: [_jsx("div", { className: "col-span-1 flex items-center", children: _jsx("h1", { className: "text-xl md:text-2xl font-bold", children: "Billing Statement" }) }), _jsxs("div", { className: "grid col-span-1 grid-rows-2 gap-2 justify-end ", children: [_jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Submitter" }), _jsx("span", { children: state.contributor })] }), _jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Status" }), _jsx("span", { children: state.status })] })] })] }), _jsx("div", { className: "mt-6 p-2", children: _jsxs("div", { className: "flex justify-end", children: [_jsx("span", { className: "mr-2 pt-2", children: "Currency: " }), _jsx(CurrencyForm, { currency: props.document.state.global.currency, handleInputChange: (e) => {
|
|
14
14
|
dispatch(actions.editBillingStatement({ currency: e.target.value }));
|
|
15
|
-
} })] }) }), _jsx("div", { className: "", children: _jsx(LineItemsTable, { state: state, dispatch: dispatch }) }), _jsxs("div", { className: "grid sm:grid-cols-2
|
|
15
|
+
} })] }) }), _jsx("div", { className: "", children: _jsx(LineItemsTable, { state: state, dispatch: dispatch }) }), _jsxs("div", { className: "grid sm:grid-cols-2", children: [_jsx("div", { className: "mt-6 p-2 two-column-grid:mt-2", children: _jsx(Textarea, { label: "Notes", placeholder: "Add notes", autoExpand: false, rows: 4, multiline: true, value: notes, onBlur: (e) => {
|
|
16
16
|
const newValue = e.target.value;
|
|
17
17
|
if (newValue !== state.notes) {
|
|
18
18
|
dispatch(actions.editBillingStatement({ notes: newValue }));
|
|
19
19
|
}
|
|
20
20
|
}, onChange: (e) => {
|
|
21
21
|
setNotes(e.target.value);
|
|
22
|
-
}, className: "p-2 mb-4" }) }), _jsx("div", { className: "
|
|
22
|
+
}, className: "p-2 mb-4" }) }), _jsx("div", { className: "p-2 flex justify-center items-center sm:mt-6", children: _jsxs("table", { className: "border border-gray-300", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-100", children: [_jsx("th", { className: "border px-4 py-2", children: "Total Fiat" }), _jsx("th", { className: "border px-4 py-2", children: "Total POWT" })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { className: "border px-4 py-2 text-center", children: formatNumber(state.totalCash) }), _jsx("td", { className: "border px-4 py-2 text-center", children: formatNumber(state.totalPowt) })] }) })] }) })] })] }));
|
|
23
23
|
}
|
|
@@ -24,7 +24,7 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, }) {
|
|
|
24
24
|
id: item.id,
|
|
25
25
|
description: e.target.value,
|
|
26
26
|
}));
|
|
27
|
-
}, className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2
|
|
27
|
+
}, className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2 w-50", 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.editLineItemTag({
|
|
28
28
|
lineItemId: item.id,
|
|
29
29
|
dimension: "accounting-period",
|
|
30
30
|
value: new Date(e.target.value)
|
|
@@ -39,12 +39,13 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, }) {
|
|
|
39
39
|
month: "long",
|
|
40
40
|
year: "numeric",
|
|
41
41
|
}),
|
|
42
|
-
})), className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2", children: _jsx(Select, { options: expenseAccountOptions, value: item.lineItemTag.find((tag) => tag.dimension === "expense-account")?.
|
|
42
|
+
})), className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2", children: _jsx(Select, { options: expenseAccountOptions, value: item.lineItemTag.find((tag) => tag.dimension === "expense-account")?.value || "", placeholder: "Select Expense Account", searchable: true, onChange: (value) => {
|
|
43
|
+
const selectedOption = expenseAccountOptions.find((option) => option.value === value);
|
|
43
44
|
dispatch(actions.editLineItemTag({
|
|
44
45
|
lineItemId: item.id,
|
|
45
46
|
dimension: "expense-account",
|
|
46
|
-
value: "
|
|
47
|
-
label:
|
|
47
|
+
value: selectedOption?.value || "",
|
|
48
|
+
label: selectedOption?.label
|
|
48
49
|
}));
|
|
49
50
|
}, className: "w-full text-xs" }) }), _jsx("td", { className: "border-b border-gray-200 p-2", children: _jsx(Select, { options: budgetOptions, value: item.lineItemTag.find((tag) => tag.dimension === "budget")
|
|
50
51
|
?.value || "", placeholder: "Select Budget", onChange: (value) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SelectOption } from "@powerhousedao/document-engineering/ui";
|
|
2
|
+
import { InvoiceTag } from "../../../document-models/invoice/gen/types.js";
|
|
2
3
|
export declare const expenseAccountOptions: SelectOption[];
|
|
3
4
|
export declare const budgetOptions: SelectOption[];
|
|
5
|
+
export declare const mapTags: (lineItemTags: InvoiceTag[]) => (InvoiceTag | undefined)[];
|
|
4
6
|
//# sourceMappingURL=tagMapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"tagMapping.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/lineItemTags/tagMapping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAkG3E,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAO9C,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,YAAY,EAGvC,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,cAAc,UAAU,EAAE,+BAmBjD,CAAC"}
|
|
@@ -1,44 +1,123 @@
|
|
|
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: "
|
|
2
|
+
{ fusion: "Budget", xero: "Grants from Maker DAO" },
|
|
3
|
+
{ fusion: "Current Asset", xero: "Clearing Account" },
|
|
4
|
+
{ fusion: "Current Liability", xero: "Request Finance IC account" },
|
|
5
|
+
{ fusion: "Interest Income", xero: "Interest Income" },
|
|
6
|
+
{ fusion: "Travel & Entertainment", xero: "Activities and Events" },
|
|
7
|
+
{ fusion: "Travel & Entertainment", xero: "Meals" },
|
|
8
|
+
{ fusion: "Travel & Entertainment", xero: "Airfare" },
|
|
9
|
+
{ fusion: "Travel & Entertainment", xero: "Hotels" },
|
|
10
|
+
{ fusion: "Travel & Entertainment", xero: "Transportation (Uber, Taxi etc)" },
|
|
11
|
+
{ fusion: "Travel & Entertainment", xero: "Other travel cost" },
|
|
12
|
+
{ fusion: "Cost of Goods Sold", xero: "Cost of Goods Sold" },
|
|
13
|
+
{ fusion: "Marketing Expense", xero: "Advertising" },
|
|
14
|
+
{ fusion: "Professional Services", xero: "Legal Fees Abroad" },
|
|
15
|
+
{ fusion: "Professional Services", xero: "Legal Fees Switzerland" },
|
|
16
|
+
{ fusion: "Professional Services", xero: "Finance Team Fees Abroad" },
|
|
17
|
+
{ fusion: "Professional Services", xero: "Fnance and Accounting Fees Switzerland" },
|
|
18
|
+
{ fusion: "Software Development Expense", xero: "Software Development Team Fees" },
|
|
19
|
+
{ fusion: "Professional Services", xero: "Research Team Fees" },
|
|
20
|
+
{ fusion: "Marketing Expense", xero: "Marketing Team Fees" },
|
|
21
|
+
{ fusion: "Compensation & Benefits", xero: "Health Care Fees" },
|
|
22
|
+
{ fusion: "Compensation & Benefits", xero: "Contractor Fees" },
|
|
23
|
+
{ fusion: "Compensation & Benefits", xero: "Insurance Fees Team" },
|
|
24
|
+
{ fusion: "Compensation & Benefits", xero: "HR Fees" },
|
|
25
|
+
{ fusion: "Compensation & Benefits", xero: "Team Bonus" },
|
|
26
|
+
{ fusion: "Compensation & Benefits", xero: "Refferal Fees" },
|
|
27
|
+
{ fusion: "Other", xero: "Depreciation" },
|
|
28
|
+
{ fusion: "Other", xero: "Freight & Courier" },
|
|
29
|
+
{ fusion: "Other", xero: "Interest Expense" },
|
|
30
|
+
{ fusion: "Admin Expense", xero: "Office Expenses" },
|
|
31
|
+
{ fusion: "Admin Expense", xero: "Rent" },
|
|
32
|
+
{ fusion: "Admin Expense", xero: "Subscriptions" },
|
|
12
33
|
{ fusion: "Other Income Expense (Non-operating)", xero: "Bank Revaluations" },
|
|
13
|
-
{ fusion: "Other Income", xero: "
|
|
14
|
-
{ fusion: "Other Income", xero: "
|
|
15
|
-
{ fusion: "Income Tax Expense", xero: "Expense" },
|
|
34
|
+
{ fusion: "Other Income", xero: "Unrealised Currency Gains" },
|
|
35
|
+
{ fusion: "Other Income", xero: "Realised Currency Gains" },
|
|
36
|
+
{ fusion: "Income Tax Expense", xero: "Income Tax Expense" },
|
|
16
37
|
{ fusion: "Current Asset", xero: "Accounts Receivable" },
|
|
17
|
-
{ fusion: "Current Asset", xero: "
|
|
38
|
+
{ fusion: "Current Asset", xero: "Prepayments" },
|
|
18
39
|
{ fusion: "Current Asset", xero: "Inventory" },
|
|
19
|
-
{ fusion: "Software Expense", xero: "
|
|
20
|
-
{ fusion: "
|
|
21
|
-
{ fusion: "
|
|
40
|
+
{ fusion: "Software Expense", xero: "Software/IT Subscriptions" },
|
|
41
|
+
{ fusion: "Software Expense", xero: "Telephone and Internet Charges" },
|
|
42
|
+
{ fusion: "Fixed Asset", xero: "Office Equipment" },
|
|
43
|
+
{ fusion: "Fixed Asset", xero: "Less Accumulated Depreciation on Office Equipment" },
|
|
44
|
+
{ fusion: "Non-Current Asset", xero: "Computer Equipment" },
|
|
45
|
+
{ fusion: "Non-Current Asset", xero: "Less Accumulated Depreciation on Computer Equipment" },
|
|
22
46
|
{ fusion: "Current Liability", xero: "Accounts Payable" },
|
|
23
|
-
{ fusion: "
|
|
47
|
+
{ fusion: "Other", xero: "Bank Fees" },
|
|
48
|
+
{ fusion: "Gas Expense", xero: "Gas Fees" },
|
|
49
|
+
{ fusion: "Other", xero: "Exchange Fees" },
|
|
24
50
|
{ fusion: "Current Liability", xero: "Unpaid Expense Claims" },
|
|
51
|
+
{ fusion: "Current Liability", xero: "Accrued Expenses" },
|
|
25
52
|
{ fusion: "Current Liability", xero: "Wages Payable" },
|
|
26
|
-
{ fusion: "Current Liability", xero: "
|
|
53
|
+
{ fusion: "Current Liability", xero: "Employee Tax Payable" },
|
|
54
|
+
{ fusion: "Current Liability", xero: "Superannuation Payable" },
|
|
55
|
+
{ fusion: "Current Liability", xero: "Income Tax Payable" },
|
|
56
|
+
{ fusion: "Other", xero: "Sales Tax" },
|
|
27
57
|
{ fusion: "Adjustment A/C", xero: "Historical Adjustment" },
|
|
28
|
-
{ fusion: "Temporary Holding Account", xero: "
|
|
58
|
+
{ fusion: "Temporary Holding Account", xero: "Suspense" },
|
|
29
59
|
{ fusion: "Other", xero: "Rounding" },
|
|
30
|
-
{ fusion: "Internal Transfers", xero: "Tracking" },
|
|
31
|
-
{ fusion: "Owner Equity", xero: "
|
|
32
|
-
{ fusion: "
|
|
60
|
+
{ fusion: "Internal Transfers", xero: "Tracking Transfers" },
|
|
61
|
+
{ fusion: "Owner Equity", xero: "Owner A Drawings" },
|
|
62
|
+
{ fusion: "Owner Equity", xero: "Owner A Funds Introduced" },
|
|
63
|
+
{ fusion: "Non-current Liability", xero: "Loan" },
|
|
33
64
|
{ fusion: "Equity", xero: "Retained Earnings" },
|
|
34
|
-
{ fusion: "Equity", xero: "
|
|
65
|
+
{ fusion: "Equity", xero: "Owner A Share Capital" }
|
|
35
66
|
];
|
|
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
|
+
};
|
|
36
95
|
export const expenseAccountOptions = Array.from(new Set(billingTagMapping.map((tag) => tag.fusion))).map((tag) => {
|
|
37
96
|
return {
|
|
38
97
|
label: tag,
|
|
39
|
-
value: tag
|
|
98
|
+
value: fusionLabelToValue[tag] || tag, // Fallback to tag name if no code mapping exists
|
|
40
99
|
};
|
|
41
100
|
});
|
|
42
101
|
export const budgetOptions = [
|
|
43
|
-
{ label: "
|
|
102
|
+
{ label: "Powerhouse", value: "PH-001" },
|
|
103
|
+
{ label: "Jetstream", value: "JTS-001" },
|
|
44
104
|
];
|
|
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 }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
|
|
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,EAGL,mBAAmB,EAEnB,KAAK,qBAAqB,EAE1B,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAKxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,2CAyQpB"}
|
|
@@ -1,20 +1,17 @@
|
|
|
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";
|
|
6
4
|
import { useTransformedNodes } from "../hooks/useTransformedNodes.js";
|
|
7
5
|
import { useSelectedFolderChildren } from "../hooks/useSelectedFolderChildren.js";
|
|
8
6
|
import { useDispatchMap } from "../hooks/useDispatchMap.js";
|
|
9
7
|
import { DocumentDispatch } from "./DocumentDispatch.js";
|
|
10
8
|
import { EditorContainer } from "./EditorContainer.js";
|
|
11
9
|
import { CreateDocumentModal } from "@powerhousedao/design-system";
|
|
12
|
-
import { CreateDocument } from "./CreateDocument.js";
|
|
13
10
|
import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/reactor-browser";
|
|
14
11
|
import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
|
|
15
12
|
import { actions } from "../../../document-models/invoice/index.js";
|
|
16
13
|
import { useDrop } from "../hooks/useDrop.js";
|
|
17
|
-
export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }) {
|
|
14
|
+
export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch, }) {
|
|
18
15
|
const [selectedNodeId, setSelectedNodeId] = useState();
|
|
19
16
|
const [activeDocumentId, setActiveDocumentId] = useState();
|
|
20
17
|
const [openModal, setOpenModal] = useState(false);
|
|
@@ -29,18 +26,18 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
|
|
|
29
26
|
Object.entries(selected).forEach(([id, checked]) => {
|
|
30
27
|
console.log(action);
|
|
31
28
|
if (checked) {
|
|
32
|
-
if (action ===
|
|
29
|
+
if (action === "approve" && dispatchMap[id]) {
|
|
33
30
|
dispatchMap[id](actions.editStatus({
|
|
34
31
|
status: "AWAITINGPAYMENT",
|
|
35
32
|
}));
|
|
36
33
|
}
|
|
37
|
-
else if (action ===
|
|
34
|
+
else if (action === "reject" && dispatchMap[id]) {
|
|
38
35
|
dispatchMap[id](actions.editStatus({
|
|
39
36
|
status: "REJECTED",
|
|
40
37
|
}));
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
|
-
else if (action ===
|
|
40
|
+
else if (action === "pay" && dispatchMap[id]) {
|
|
44
41
|
dispatchMap[id](actions.editStatus({
|
|
45
42
|
status: "PAYMENTRECEIVED",
|
|
46
43
|
}));
|
|
@@ -108,5 +105,5 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
|
|
|
108
105
|
const editorModule = activeDocument
|
|
109
106
|
? context.getEditor(activeDocument.documentType)
|
|
110
107
|
: null;
|
|
111
|
-
return (_jsxs("div", { className: "flex h-full", children: [nodes.map(node => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels
|
|
108
|
+
return (_jsxs("div", { className: "flex h-full", children: [nodes.map((node) => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels, context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsx("div", { ...dropProps, className: twMerge("editor-container rounded-md border-2 border-transparent ", isDropTarget && "border-dashed border-blue-100"), children: _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction, onDeleteNode: onDeleteNode, renameNode: renameNode, filteredDocumentModels: filteredDocumentModels, onSelectDocumentModel: onSelectDocumentModel, dispatchMap: dispatchMap }) })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
|
|
112
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/EditorContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAQxB,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,kBAAkB,CAAC;IAC5B,mBAAmB,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACrD,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/EditorContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAQxB,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,kBAAkB,CAAC;IAC5B,mBAAmB,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACrD,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwE1D,CAAC"}
|
|
@@ -24,5 +24,10 @@ export const EditorContainer = (props) => {
|
|
|
24
24
|
if (!document)
|
|
25
25
|
return loadingContent;
|
|
26
26
|
const EditorComponent = editorModule.Component;
|
|
27
|
-
return showRevisionHistory ? (_jsx(RevisionHistory, { documentId: documentId, documentTitle: title, globalOperations: document.operations.global, localOperations: document.operations.local, onClose: () => setShowRevisionHistory(false) }, documentId)) : (_jsxs(Suspense, { fallback: loadingContent, children: [_jsx(DocumentToolbar, { onClose: onClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: title }), _jsx(EditorComponent, { context:
|
|
27
|
+
return showRevisionHistory ? (_jsx(RevisionHistory, { documentId: documentId, documentTitle: title, globalOperations: document.operations.global, localOperations: document.operations.local, onClose: () => setShowRevisionHistory(false) }, documentId)) : (_jsxs(Suspense, { fallback: loadingContent, children: [_jsx(DocumentToolbar, { onClose: onClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: title }), _jsx(EditorComponent, { context: {
|
|
28
|
+
...context,
|
|
29
|
+
getDocumentRevision: context.getDocumentRevision
|
|
30
|
+
? (options) => context.getDocumentRevision(documentId, options)
|
|
31
|
+
: undefined,
|
|
32
|
+
}, dispatch: dispatch, document: document, error: error })] }));
|
|
28
33
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
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";
|
|
2
5
|
interface InvoiceTableProps {
|
|
3
6
|
files: UiFileNode[];
|
|
4
7
|
state: Record<string, any>;
|
|
@@ -15,7 +18,12 @@ interface InvoiceTableProps {
|
|
|
15
18
|
[id: string]: boolean;
|
|
16
19
|
})) => void;
|
|
17
20
|
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>>;
|
|
18
26
|
}
|
|
19
|
-
export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
28
|
export {};
|
|
21
29
|
//# sourceMappingURL=InvoiceTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,EAAE,cAAc,EAA0B,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAsBrD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,YAAY,GAAI,iLAa1B,iBAAiB,4CA8dnB,CAAC"}
|