@powerhousedao/contributor-billing 0.0.98 → 0.1.0
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/billing-statement/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/general.js +8 -26
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/line-items.js +19 -29
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/tags.js +20 -25
- package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.js +29 -44
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +31 -56
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +63 -88
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +199 -229
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts +3 -2
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +12 -8
- package/dist/editors/billing-statement/components/objectSetTable.d.ts +3 -2
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +3 -1
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts +2 -2
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +8 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +18 -64
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +21 -7
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +8 -10
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +27 -24
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +6 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +8 -17
- package/dist/editors/contributor-billing/editor.d.ts +1 -10
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +2 -23
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +2 -1
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.js +1 -1
- package/dist/editors/hooks/useBillingStatementDocument.d.ts +4 -0
- package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useBillingStatementDocument.js +8 -0
- package/dist/editors/hooks/useIntegrationsDocument.d.ts +4 -0
- package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useIntegrationsDocument.js +8 -0
- package/dist/editors/hooks/useInvoiceDocument.d.ts +4 -0
- package/dist/editors/hooks/useInvoiceDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useInvoiceDocument.js +8 -0
- package/dist/editors/integrations/editor.d.ts +4 -1
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +7 -12
- package/dist/editors/invoice/components/lineItemCard.d.ts +21 -0
- package/dist/editors/invoice/components/lineItemCard.d.ts.map +1 -0
- package/dist/editors/invoice/components/lineItemCard.js +23 -0
- package/dist/editors/invoice/components/lineItemMobileModal.d.ts +33 -0
- package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -0
- package/dist/editors/invoice/components/lineItemMobileModal.js +73 -0
- package/dist/editors/invoice/components/lineItemsEmptyState.d.ts +6 -0
- package/dist/editors/invoice/components/lineItemsEmptyState.d.ts.map +1 -0
- package/dist/editors/invoice/components/lineItemsEmptyState.js +5 -0
- package/dist/editors/invoice/editor.d.ts +4 -1
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +41 -22
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.d.ts +3 -2
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +11 -11
- package/dist/editors/invoice/legalEntity/bankSection.d.ts +1 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/bankSection.js +36 -12
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.js +2 -2
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +25 -3
- package/dist/editors/invoice/lineItemTags/tagCard.d.ts +15 -0
- package/dist/editors/invoice/lineItemTags/tagCard.d.ts.map +1 -0
- package/dist/editors/invoice/lineItemTags/tagCard.js +13 -0
- package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts +18 -0
- package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -0
- package/dist/editors/invoice/lineItemTags/tagMobileModal.js +71 -0
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.js +76 -38
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +25 -9
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +3 -2
- package/dist/editors/invoice/validation/validationRules.d.ts +2 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +37 -7
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts +5 -0
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -0
- package/dist/scripts/contributor-billing/createExpenseReportCsv.js +122 -0
- package/dist/style.css +180 -12
- package/dist/tailwind.config.js +1 -0
- package/package.json +13 -12
- package/dist/reducers/general.d.ts +0 -8
- package/dist/reducers/general.d.ts.map +0 -1
- package/dist/reducers/general.js +0 -73
- package/dist/reducers/items.d.ts +0 -8
- package/dist/reducers/items.d.ts.map +0 -1
- package/dist/reducers/items.js +0 -195
- package/dist/reducers/parties.d.ts +0 -8
- package/dist/reducers/parties.d.ts.map +0 -1
- package/dist/reducers/parties.js +0 -266
- package/dist/reducers/transitions.d.ts +0 -8
- package/dist/reducers/transitions.d.ts.map +0 -1
- package/dist/reducers/transitions.js +0 -162
|
@@ -3,8 +3,8 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import { actions } from "../../document-models/invoice/index.js";
|
|
4
4
|
import { generateId } from "document-model";
|
|
5
5
|
let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
|
|
6
|
-
if (!window.document.baseURI.includes(
|
|
7
|
-
GRAPHQL_URL =
|
|
6
|
+
if (!window.document.baseURI.includes("localhost")) {
|
|
7
|
+
GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
|
|
8
8
|
}
|
|
9
9
|
const InvoiceToGnosis = ({ docState, dispatch, }) => {
|
|
10
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -13,15 +13,15 @@ const InvoiceToGnosis = ({ docState, dispatch, }) => {
|
|
|
13
13
|
const [safeTxHash, setsafeTxHash] = useState(null);
|
|
14
14
|
const [safeAddress, setSafeAddress] = useState(null);
|
|
15
15
|
const currency = docState.currency;
|
|
16
|
-
const chainName = docState.issuer
|
|
16
|
+
const chainName = docState.issuer?.paymentRouting?.wallet?.chainName || "";
|
|
17
17
|
const invoiceStatus = docState.status;
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
// set safeADdress from processorRef
|
|
20
20
|
if (docState.payments.length < 1)
|
|
21
21
|
return;
|
|
22
|
-
const
|
|
23
|
-
console.log(
|
|
24
|
-
const retrievedSafeAddress =
|
|
22
|
+
const lastPaymentRef = docState.payments[docState.payments.length - 1].processorRef || "";
|
|
23
|
+
console.log(lastPaymentRef);
|
|
24
|
+
const retrievedSafeAddress = lastPaymentRef.split(":");
|
|
25
25
|
if (retrievedSafeAddress[0]) {
|
|
26
26
|
setSafeAddress(retrievedSafeAddress[0]);
|
|
27
27
|
}
|
|
@@ -50,15 +50,15 @@ const InvoiceToGnosis = ({ docState, dispatch, }) => {
|
|
|
50
50
|
// Extract payment details from current-state.json
|
|
51
51
|
const paymentDetails = {
|
|
52
52
|
payeeWallet: {
|
|
53
|
-
address: docState.issuer
|
|
54
|
-
chainName: docState.issuer
|
|
55
|
-
chainId: docState.issuer
|
|
53
|
+
address: docState.issuer?.paymentRouting?.wallet?.address || "",
|
|
54
|
+
chainName: docState.issuer?.paymentRouting?.wallet?.chainName || "",
|
|
55
|
+
chainId: docState.issuer?.paymentRouting?.wallet?.chainId || "",
|
|
56
56
|
},
|
|
57
57
|
token: {
|
|
58
58
|
evmAddress: getTokenAddress(chainName, currency),
|
|
59
59
|
symbol: docState.currency,
|
|
60
|
-
chainName: docState.issuer
|
|
61
|
-
chainId: docState.issuer
|
|
60
|
+
chainName: docState.issuer?.paymentRouting?.wallet?.chainName || "",
|
|
61
|
+
chainId: docState.issuer?.paymentRouting?.wallet?.chainId || "",
|
|
62
62
|
},
|
|
63
63
|
amount: docState.totalPriceTaxIncl || 0.000015, // Make the amount small for testing
|
|
64
64
|
};
|
|
@@ -10,6 +10,7 @@ export type LegalEntityBankSectionProps = Omit<ComponentPropsWithRef<"div">, "ch
|
|
|
10
10
|
readonly bicvalidation?: ValidationResult | null;
|
|
11
11
|
readonly routingNumbervalidation?: ValidationResult | null;
|
|
12
12
|
readonly banknamevalidation?: ValidationResult | null;
|
|
13
|
+
readonly accountNumbervalidation?: ValidationResult | null;
|
|
13
14
|
readonly currency: string;
|
|
14
15
|
};
|
|
15
16
|
export declare const LegalEntityBankSection: import("react").ForwardRefExoticComponent<Omit<LegalEntityBankSectionProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bankSection.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/bankSection.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"bankSection.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/bankSection.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAOtB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAMtE,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,qBAAqB,CAAC,KAAK,CAAC,EAC5B,UAAU,CACX,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAmCF,eAAO,MAAM,sBAAsB,qIA6hBlC,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback, useState, useEffect, } from "react";
|
|
2
|
+
import { forwardRef, useCallback, useState, useEffect, useMemo, } from "react";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import { CountryForm } from "../components/countryForm.js";
|
|
5
5
|
import { InputField } from "../components/inputField.js";
|
|
6
6
|
import { Select } from "@powerhousedao/document-engineering";
|
|
7
|
-
|
|
7
|
+
import { isValidIBAN } from "../validation/validationRules.js";
|
|
8
8
|
const ACCOUNT_TYPES = ["CHECKING", "SAVINGS", "TRUST"];
|
|
9
|
-
const AccountTypeSelect = forwardRef(function AccountTypeSelect(props, ref) {
|
|
10
|
-
return (_jsxs("select", { ...props, className: twMerge("h-10 w-full rounded-md border border-gray-200 bg-white px-3 transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50 disabled:p-0", props.className), ref: ref, children: [_jsx("option", { value: "", children: "Select Account Type" }), ACCOUNT_TYPES.map((type) => (_jsx("option", { value: type, children: type }, type)))] }));
|
|
11
|
-
});
|
|
12
9
|
function flattenBankInput(value) {
|
|
13
10
|
return {
|
|
14
11
|
...value,
|
|
@@ -39,11 +36,22 @@ function flattenBankInput(value) {
|
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
38
|
export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection(props, ref) {
|
|
42
|
-
const { value, onChange, disabled, countryvalidation, ibanvalidation, bicvalidation, routingNumbervalidation, banknamevalidation, currency, ...divProps } = props;
|
|
39
|
+
const { value, onChange, disabled, countryvalidation, ibanvalidation, bicvalidation, routingNumbervalidation, banknamevalidation, accountNumbervalidation, currency, ...divProps } = props;
|
|
43
40
|
const [showIntermediary, setShowIntermediary] = useState(false);
|
|
44
41
|
const [localState, setLocalState] = useState(flattenBankInput(value));
|
|
45
42
|
useEffect(() => {
|
|
46
43
|
setLocalState(flattenBankInput(value));
|
|
44
|
+
// Check if there's any intermediary bank data
|
|
45
|
+
const hasIntermediaryData = !!(localState.accountNumIntermediary ||
|
|
46
|
+
localState.nameIntermediary ||
|
|
47
|
+
localState.beneficiaryIntermediary ||
|
|
48
|
+
localState.ABAIntermediary ||
|
|
49
|
+
localState.BICIntermediary ||
|
|
50
|
+
localState.SWIFTIntermediary ||
|
|
51
|
+
localState.streetAddressIntermediary ||
|
|
52
|
+
localState.cityIntermediary ||
|
|
53
|
+
localState.countryIntermediary);
|
|
54
|
+
setShowIntermediary(hasIntermediaryData);
|
|
47
55
|
}, [value]);
|
|
48
56
|
const handleInputChange = useCallback(function handleInputChange(field, event) {
|
|
49
57
|
setLocalState((prevState) => ({
|
|
@@ -58,7 +66,7 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
|
|
|
58
66
|
}, [onChange]);
|
|
59
67
|
const handleIntermediaryToggle = useCallback(function handleIntermediaryToggle(event) {
|
|
60
68
|
setShowIntermediary(event.target.checked);
|
|
61
|
-
}, []);
|
|
69
|
+
}, [showIntermediary]);
|
|
62
70
|
function createInputHandler(field) {
|
|
63
71
|
return function handleFieldChange(event) {
|
|
64
72
|
handleInputChange(field, event);
|
|
@@ -70,11 +78,25 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
|
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
const SEPA_SWIFT_CURRENCIES = ["EUR", "DKK", "GBP", "CHF", "JPY"];
|
|
81
|
+
const usdIbanPayment = useMemo(() => isValidIBAN(localState.accountNum ?? "") && currency === "USD", [localState.accountNum, currency]);
|
|
73
82
|
return (_jsxs("div", { ...divProps, className: twMerge("rounded-lg border border-gray-200 bg-white p-6", props.className), ref: ref, children: [_jsx("h3", { className: "mb-4 text-lg font-semibold text-gray-900", children: "Banking Information" }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField
|
|
74
83
|
// input={localState.accountNum ?? ""}
|
|
75
84
|
, {
|
|
76
85
|
// input={localState.accountNum ?? ""}
|
|
77
|
-
value: localState.accountNum ?? "", label: "Account Number", placeholder: "Account Number", onBlur: createBlurHandler("accountNum"), handleInputChange: createInputHandler("accountNum"), className: "h-10 w-full text-md mb-2", validation:
|
|
86
|
+
value: localState.accountNum ?? "", label: "Account Number", placeholder: "Account Number", onBlur: createBlurHandler("accountNum"), handleInputChange: createInputHandler("accountNum"), className: "h-10 w-full text-md mb-2", validation:
|
|
87
|
+
// Prefer the first failing validation between IBAN and generic account number
|
|
88
|
+
(() => {
|
|
89
|
+
const firstInvalid = (ibanvalidation &&
|
|
90
|
+
!ibanvalidation.isValid &&
|
|
91
|
+
ibanvalidation) ||
|
|
92
|
+
(accountNumbervalidation &&
|
|
93
|
+
!accountNumbervalidation.isValid &&
|
|
94
|
+
accountNumbervalidation);
|
|
95
|
+
return (firstInvalid ||
|
|
96
|
+
ibanvalidation ||
|
|
97
|
+
accountNumbervalidation ||
|
|
98
|
+
null);
|
|
99
|
+
})() }) }), _jsx("div", { className: "space-y-2", children: _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(Select, { className: "h-10 w-full text-md mb-2", label: "Account Type", options: ACCOUNT_TYPES.map((type) => ({
|
|
78
100
|
label: type,
|
|
79
101
|
value: type,
|
|
80
102
|
})), value: localState.accountType ?? "", onChange: (value) => {
|
|
@@ -87,7 +109,7 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
|
|
|
87
109
|
onChange({
|
|
88
110
|
accountType: value,
|
|
89
111
|
});
|
|
90
|
-
} }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BIC"), handleInputChange: createInputHandler("BIC"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABA ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABA"), handleInputChange: createInputHandler("ABA"), className: "h-10 w-full text-md mb-2", validation: routingNumbervalidation }), _jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFT"), handleInputChange: createInputHandler("SWIFT"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
|
|
112
|
+
} }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BIC"), handleInputChange: createInputHandler("BIC"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABA ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABA"), handleInputChange: createInputHandler("ABA"), className: "h-10 w-full text-md mb-2", validation: usdIbanPayment ? null : routingNumbervalidation }), _jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFT"), handleInputChange: createInputHandler("SWIFT"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
|
|
91
113
|
// input={localState.beneficiary ?? ""}
|
|
92
114
|
, {
|
|
93
115
|
// input={localState.beneficiary ?? ""}
|
|
@@ -136,9 +158,11 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
|
|
|
136
158
|
onChange({
|
|
137
159
|
accountType: value,
|
|
138
160
|
});
|
|
139
|
-
} }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.
|
|
140
|
-
localState.
|
|
141
|
-
"", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BICIntermediary"), handleInputChange: createInputHandler("BICIntermediary"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABAIntermediary ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABAIntermediary"), handleInputChange: createInputHandler("ABAIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField, { value: localState.SWIFTIntermediary
|
|
161
|
+
} }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.SWIFTIntermediary ||
|
|
162
|
+
localState.BICIntermediary) ??
|
|
163
|
+
"", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BICIntermediary"), handleInputChange: createInputHandler("BICIntermediary"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABAIntermediary ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABAIntermediary"), handleInputChange: createInputHandler("ABAIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField, { value: (localState.SWIFTIntermediary ||
|
|
164
|
+
localState.BICIntermediary) ??
|
|
165
|
+
"", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFTIntermediary"), handleInputChange: createInputHandler("SWIFTIntermediary"), className: "h-10 w-full text-md mb-2" })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
|
|
142
166
|
// input={localState.beneficiaryIntermediary ?? ""}
|
|
143
167
|
, {
|
|
144
168
|
// input={localState.beneficiaryIntermediary ?? ""}
|
|
@@ -37,7 +37,8 @@ type LegalEntityFormProps = {
|
|
|
37
37
|
readonly postalcodevalidation?: ValidationResult | null;
|
|
38
38
|
readonly payeremailvalidation?: ValidationResult | null;
|
|
39
39
|
readonly routingNumbervalidation?: ValidationResult | null;
|
|
40
|
+
readonly accountNumbervalidation?: ValidationResult | null;
|
|
40
41
|
};
|
|
41
|
-
export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, accountNumbervalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
|
|
42
43
|
export {};
|
|
43
44
|
//# sourceMappingURL=legalEntity.d.ts.map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AgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC5D,CAAC;AA+BF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,EAAE,oBAAoB,2CA4CtB"}
|
|
@@ -52,12 +52,12 @@ function flattenLegalEntityToEditInput(legalEntity) {
|
|
|
52
52
|
email: legalEntity.contactInfo?.email ?? "",
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, }) {
|
|
55
|
+
export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, accountNumbervalidation, }) {
|
|
56
56
|
// Handler for main info section
|
|
57
57
|
const handleChangeInfo = (update) => {
|
|
58
58
|
if (!onChangeInfo)
|
|
59
59
|
return;
|
|
60
60
|
onChangeInfo(update);
|
|
61
61
|
};
|
|
62
|
-
return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), mainCountryValidation: mainCountryValidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, currency: currency, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: bankCountryValidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, routingNumbervalidation: routingNumbervalidation, banknamevalidation: banknamevalidation }))] }));
|
|
62
|
+
return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), mainCountryValidation: mainCountryValidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, currency: currency, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: bankCountryValidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, routingNumbervalidation: routingNumbervalidation, banknamevalidation: banknamevalidation, accountNumbervalidation: accountNumbervalidation }))] }));
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKhF,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,2CAiQxB"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { X, Tag } from "lucide-react";
|
|
3
4
|
import { Button } from "@powerhousedao/design-system";
|
|
4
5
|
import { Select, DatePicker } from "@powerhousedao/document-engineering/ui";
|
|
5
6
|
import { expenseAccountOptions, paymentAccountOptions } from "./tagMapping.js";
|
|
6
7
|
import { actions } from "../../../document-models/invoice/index.js";
|
|
7
8
|
import { InputField } from "../components/inputField.js";
|
|
9
|
+
import { TagCard } from "./tagCard.js";
|
|
10
|
+
import { TagMobileModal } from "./tagMobileModal.js";
|
|
8
11
|
export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccounts, }) {
|
|
12
|
+
const [mobileEditItem, setMobileEditItem] = useState(null);
|
|
13
|
+
const [showMobileModal, setShowMobileModal] = useState(false);
|
|
9
14
|
const handleReset = () => {
|
|
10
15
|
// Resetting all tags to empty values
|
|
11
16
|
lineItems.forEach((item) => {
|
|
@@ -27,11 +32,19 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccount
|
|
|
27
32
|
}));
|
|
28
33
|
});
|
|
29
34
|
};
|
|
35
|
+
const handleMobileEdit = (item) => {
|
|
36
|
+
setMobileEditItem(item);
|
|
37
|
+
setShowMobileModal(true);
|
|
38
|
+
};
|
|
39
|
+
const handleCloseMobileModal = () => {
|
|
40
|
+
setShowMobileModal(false);
|
|
41
|
+
setMobileEditItem(null);
|
|
42
|
+
};
|
|
30
43
|
// Get the last payment account value from the paymentAccounts to display in the payment account select
|
|
31
44
|
const selectedPaymentAccountValue = paymentAccounts && paymentAccounts.length > 0
|
|
32
45
|
? (paymentAccounts[paymentAccounts.length - 1].value ?? "")
|
|
33
46
|
: "";
|
|
34
|
-
return (_jsxs("div", { className: "w-full", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-gray-200 p-6 bg-white z-10", children: [_jsxs("span", { className: "flex items-center gap-2", children: [_jsx("h2", { className: "text-2xl font-semibold text-gray-900", children: "Assign Tags " }), _jsx(Tag, { style: { width: 28, height: 28, color: "white", fill: "#475264" } })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { color: "light", size: "medium", onClick: handleReset, children: ["Reset", " "] }), _jsx("button", { onClick: onClose, className: "rounded-full p-2 hover:bg-gray-100", children: _jsx(X, { size: 24, className: "text-gray-500" }) })] })] }), _jsx("div", { className: "overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { className: "w-full border-collapse bg-white", children: [_jsx("thead", { className: "bg-gray-50 z-10", children: _jsxs("tr", { children: [_jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Item" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Period" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Xero Expense Account" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total" })] }) }), _jsx("tbody", { children: lineItems.map((item) => (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "border-b border-gray-200 p-3", children: _jsx(InputField, { value: item.item, handleInputChange: (e) => { }, onBlur: (e) => {
|
|
47
|
+
return (_jsxs("div", { className: "w-full", children: [showMobileModal && mobileEditItem && (_jsx(TagMobileModal, { item: mobileEditItem, onClose: handleCloseMobileModal, dispatch: dispatch })), _jsxs("div", { className: "flex items-center justify-between border-b border-gray-200 p-6 bg-white z-10", children: [_jsxs("span", { className: "flex items-center gap-2", children: [_jsx("h2", { className: "text-2xl font-semibold text-gray-900", children: "Assign Tags " }), _jsx(Tag, { style: { width: 28, height: 28, color: "white", fill: "#475264" } })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { color: "light", size: "medium", onClick: handleReset, children: ["Reset", " "] }), _jsx("button", { onClick: onClose, className: "rounded-full p-2 hover:bg-gray-100", children: _jsx(X, { size: 24, className: "text-gray-500" }) })] })] }), _jsx("div", { className: "hidden md:block overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { className: "w-full border-collapse bg-white", children: [_jsx("thead", { className: "bg-gray-50 z-10", children: _jsxs("tr", { children: [_jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Item" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Period" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Xero Expense Account" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total" })] }) }), _jsx("tbody", { children: lineItems.map((item) => (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "border-b border-gray-200 p-3", children: _jsx(InputField, { value: item.item, handleInputChange: (e) => { }, onBlur: (e) => {
|
|
35
48
|
dispatch(actions.editLineItem({
|
|
36
49
|
id: item.id,
|
|
37
50
|
description: e.target.value,
|
|
@@ -58,7 +71,16 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccount
|
|
|
58
71
|
value: value,
|
|
59
72
|
label: expenseAccountOptions.find((option) => option.value === value)?.label,
|
|
60
73
|
}));
|
|
61
|
-
} }) }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium", children: item.total })] }, item.id))) })] }) }), _jsx("div", { className: "border-t border-gray-200 p-6", children: _jsxs("div", { className: "flex items-center justify-end gap-4", children: [_jsx("label", { className: "text-lg font-medium text-gray-900", children: "Payment Account" }), _jsx(Select, { options: paymentAccountOptions, value: paymentAccountOptions.find((option) => option.value === selectedPaymentAccountValue)?.value ?? "", placeholder: "Select Payment Account", searchable: true, onChange: (value) => {
|
|
74
|
+
} }) }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium", children: item.total })] }, item.id))) })] }) }), _jsx("div", { className: "md:hidden p-4 space-y-3", children: lineItems.map((item) => (_jsx(TagCard, { item: item, onEdit: () => handleMobileEdit(item) }, item.id))) }), _jsx("div", { className: "hidden md:block border-t border-gray-200 p-6", children: _jsxs("div", { className: "flex items-center justify-end gap-4", children: [_jsx("label", { className: "text-lg font-medium text-gray-900", children: "Payment Account" }), _jsx(Select, { options: paymentAccountOptions, value: paymentAccountOptions.find((option) => option.value === selectedPaymentAccountValue)?.value ?? "", placeholder: "Select Payment Account", searchable: true, onChange: (value) => {
|
|
75
|
+
const selectedLabel = paymentAccountOptions.find((option) => option.value === value)
|
|
76
|
+
?.label || "";
|
|
77
|
+
const cleanLabel = selectedLabel.replace(/\s+\w+$/, "").trim();
|
|
78
|
+
dispatch(actions.setInvoiceTag({
|
|
79
|
+
dimension: "xero-payment-account",
|
|
80
|
+
value: value,
|
|
81
|
+
label: cleanLabel,
|
|
82
|
+
}));
|
|
83
|
+
}, style: { width: "230px" } })] }) }), _jsx("div", { className: "md:hidden p-4 border-t border-gray-200", children: _jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700", children: "Payment Account" }), _jsx(Select, { options: paymentAccountOptions, value: paymentAccountOptions.find((option) => option.value === selectedPaymentAccountValue)?.value ?? "", placeholder: "Select Payment Account", searchable: true, onChange: (value) => {
|
|
62
84
|
const selectedLabel = paymentAccountOptions.find((option) => option.value === value)
|
|
63
85
|
?.label || "";
|
|
64
86
|
const cleanLabel = selectedLabel.replace(/\s+\w+$/, "").trim();
|
|
@@ -67,5 +89,5 @@ export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccount
|
|
|
67
89
|
value: value,
|
|
68
90
|
label: cleanLabel,
|
|
69
91
|
}));
|
|
70
|
-
}
|
|
92
|
+
} })] }) })] }));
|
|
71
93
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type TagAssignmentRow = {
|
|
2
|
+
id: string;
|
|
3
|
+
item: string;
|
|
4
|
+
period: string;
|
|
5
|
+
expenseAccount: string;
|
|
6
|
+
total: string;
|
|
7
|
+
lineItemTag: any[];
|
|
8
|
+
};
|
|
9
|
+
type TagCardProps = {
|
|
10
|
+
item: TagAssignmentRow;
|
|
11
|
+
onEdit: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function TagCard({ item, onEdit }: TagCardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=tagCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagCard.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagCard.tsx"],"names":[],"mappings":"AAGA,KAAK,gBAAgB,GAAG;IACtB,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,GAAG,EAAE,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,YAAY,2CAoErD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MoreVertical, Edit } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
export function TagCard({ item, onEdit }) {
|
|
5
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
6
|
+
// Get tag values
|
|
7
|
+
const periodTag = item.lineItemTag.find((tag) => tag.dimension === "accounting-period");
|
|
8
|
+
const expenseTag = item.lineItemTag.find((tag) => tag.dimension === "xero-expense-account");
|
|
9
|
+
return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-lg mb-3 overflow-hidden", children: [_jsxs("div", { className: "p-4 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs("div", { className: "flex items-start justify-between mb-2", children: [_jsx("div", { className: "flex-1", children: _jsx("h5", { className: "font-medium text-gray-900 text-sm", children: item.item || "Untitled Item" }) }), _jsx("button", { className: "p-1 hover:bg-gray-100 rounded", onClick: (e) => {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
onEdit();
|
|
12
|
+
}, children: _jsx(MoreVertical, { className: "w-5 h-5 text-gray-500" }) })] }), _jsxs("div", { className: "flex items-center justify-between text-sm", children: [_jsx("div", { className: "text-gray-600", children: periodTag?.label || "No period set" }), _jsx("div", { className: "font-semibold text-gray-900", children: item.total })] }), isExpanded && (_jsx("div", { className: "mt-3 pt-3 border-t border-gray-100 space-y-2 text-sm", children: _jsxs("div", { className: "flex justify-between", children: [_jsx("span", { className: "text-gray-600", children: "Expense Account:" }), _jsx("span", { className: "text-gray-900 text-right max-w-[60%]", children: expenseTag?.label || "Not set" })] }) }))] }), _jsx("div", { className: "border-t border-gray-200 bg-gray-50", children: _jsxs("button", { className: "w-full flex items-center justify-center gap-3 px-4 py-3 text-sm hover:bg-gray-100 transition-colors", onClick: onEdit, children: [_jsx(Edit, { className: "w-4 h-4 text-blue-600" }), _jsx("span", { children: "Edit Tags" })] }) })] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { InvoiceTag } from "../../../document-models/invoice/index.js";
|
|
3
|
+
type TagAssignmentRow = {
|
|
4
|
+
id: string;
|
|
5
|
+
item: string;
|
|
6
|
+
period: string;
|
|
7
|
+
expenseAccount: string;
|
|
8
|
+
total: string;
|
|
9
|
+
lineItemTag: InvoiceTag[];
|
|
10
|
+
};
|
|
11
|
+
type TagMobileModalProps = {
|
|
12
|
+
item: TagAssignmentRow;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
dispatch: Dispatch<any>;
|
|
15
|
+
};
|
|
16
|
+
export declare function TagMobileModal({ item, onClose, dispatch, }: TagMobileModalProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=tagMobileModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagMobileModal.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/tagMobileModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOtD,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAEhF,KAAK,gBAAgB,GAAG;IACtB,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,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;CACzB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,OAAO,EACP,QAAQ,GACT,EAAE,mBAAmB,2CAkLrB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { InputField } from "../components/inputField.js";
|
|
5
|
+
import { Select, DatePicker } from "@powerhousedao/document-engineering/ui";
|
|
6
|
+
import { expenseAccountOptions, } from "./tagMapping.js";
|
|
7
|
+
import { actions } from "../../../document-models/invoice/index.js";
|
|
8
|
+
export function TagMobileModal({ item, onClose, dispatch, }) {
|
|
9
|
+
const [description, setDescription] = useState(item.item);
|
|
10
|
+
// Get current tag values
|
|
11
|
+
const periodTag = item.lineItemTag.find((tag) => tag.dimension === "accounting-period");
|
|
12
|
+
const expenseTag = item.lineItemTag.find((tag) => tag.dimension === "xero-expense-account");
|
|
13
|
+
const [periodValue, setPeriodValue] = useState(periodTag?.label || "");
|
|
14
|
+
const [periodStoredValue, setPeriodStoredValue] = useState(periodTag?.value || "");
|
|
15
|
+
const [expenseValue, setExpenseValue] = useState(expenseTag?.value || "");
|
|
16
|
+
const [expenseLabel, setExpenseLabel] = useState(expenseTag?.label || "");
|
|
17
|
+
// Prevent body scroll when modal is open
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
document.body.style.overflow = "hidden";
|
|
20
|
+
return () => {
|
|
21
|
+
document.body.style.overflow = "unset";
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
const handleSave = () => {
|
|
25
|
+
// Save description if changed
|
|
26
|
+
if (description !== item.item) {
|
|
27
|
+
dispatch(actions.editLineItem({
|
|
28
|
+
id: item.id,
|
|
29
|
+
description: description,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
// Save period if changed
|
|
33
|
+
if (periodStoredValue !== periodTag?.value) {
|
|
34
|
+
dispatch(actions.setLineItemTag({
|
|
35
|
+
lineItemId: item.id,
|
|
36
|
+
dimension: "accounting-period",
|
|
37
|
+
value: periodStoredValue,
|
|
38
|
+
label: periodValue,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
// Save expense account if changed
|
|
42
|
+
if (expenseValue !== expenseTag?.value) {
|
|
43
|
+
dispatch(actions.setLineItemTag({
|
|
44
|
+
lineItemId: item.id,
|
|
45
|
+
dimension: "xero-expense-account",
|
|
46
|
+
value: expenseValue,
|
|
47
|
+
label: expenseLabel,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
onClose();
|
|
51
|
+
};
|
|
52
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 bg-white flex flex-col", children: [_jsxs("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 bg-white", children: [_jsx("button", { onClick: onClose, className: "p-2 hover:bg-gray-100 rounded-full transition-colors", "aria-label": "Cancel", children: _jsx(X, { className: "w-5 h-5" }) }), _jsx("h2", { className: "text-lg font-semibold", children: "Edit Tags" }), _jsx("button", { onClick: handleSave, className: "px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium text-sm", children: "Save" })] }), _jsxs("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Item Description" }), _jsx(InputField, { value: description, handleInputChange: (e) => setDescription(e.target.value), onBlur: () => { }, placeholder: "Enter item description", className: "w-full" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Accounting Period" }), _jsx(DatePicker, { name: "period", dateFormat: "YYYY-MM", autoClose: true, placeholder: "Select Period", value: periodValue, onChange: (e) => {
|
|
53
|
+
const newValue = new Date(e.target.value)
|
|
54
|
+
.toLocaleDateString("en-US", {
|
|
55
|
+
year: "numeric",
|
|
56
|
+
month: "numeric",
|
|
57
|
+
})
|
|
58
|
+
.split("/")
|
|
59
|
+
.reverse()
|
|
60
|
+
.join("/");
|
|
61
|
+
const newLabel = new Date(e.target.value).toLocaleDateString("en-US", {
|
|
62
|
+
month: "long",
|
|
63
|
+
year: "numeric",
|
|
64
|
+
});
|
|
65
|
+
setPeriodValue(newLabel);
|
|
66
|
+
setPeriodStoredValue(newValue);
|
|
67
|
+
} })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Xero Expense Account" }), _jsx(Select, { options: expenseAccountOptions, value: expenseValue, placeholder: "Select Expense Account", searchable: true, onChange: (value) => {
|
|
68
|
+
setExpenseValue(value);
|
|
69
|
+
setExpenseLabel(expenseAccountOptions.find((option) => option.value === value)?.label || "");
|
|
70
|
+
} })] }), _jsx("div", { className: "bg-gray-50 rounded-lg p-4", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { className: "text-sm text-gray-600", children: "Total:" }), _jsx("span", { className: "text-lg font-bold text-gray-900", children: item.total })] }) })] }), _jsxs("div", { className: "border-t border-gray-200 p-4 bg-white flex gap-3", children: [_jsx("button", { onClick: onClose, className: "flex-1 px-4 py-3 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors font-medium text-gray-700", children: "Cancel" }), _jsx("button", { onClick: handleSave, className: "flex-1 px-4 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors font-medium", children: "Save Tags" })] })] }));
|
|
71
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItems.d.ts","sourceRoot":"","sources":["../../../editors/invoice/lineItems.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAKL,KAAK,QAAQ,EAEd,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"lineItems.d.ts","sourceRoot":"","sources":["../../../editors/invoice/lineItems.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAKL,KAAK,QAAQ,EAEd,MAAM,OAAO,CAAC;AAef,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,KAAK,QAAQ,GAAG;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAobF,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC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