@powerhousedao/contributor-billing 0.0.10 → 0.0.11
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/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +2 -0
- package/dist/editors/invoice/components/numberForm.d.ts +2 -1
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/numberForm.js +3 -2
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +34 -4
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts +1 -2
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +44 -29
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/lineItems.js +6 -12
- package/dist/style.css +40 -35
- package/dist/tailwind.config.js +0 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,wBAoFrB,CAAC"}
|
|
@@ -72,6 +72,8 @@ export const reducer = {
|
|
|
72
72
|
throw new Error("No input.paymentAccount");
|
|
73
73
|
if (!state.paymentAccounts)
|
|
74
74
|
state.paymentAccounts = [];
|
|
75
|
+
if (state.paymentAccounts.includes(action.input.paymentAccount))
|
|
76
|
+
throw new Error("Payment account already exists");
|
|
75
77
|
state.paymentAccounts.push(action.input.paymentAccount);
|
|
76
78
|
}
|
|
77
79
|
catch (e) {
|
|
@@ -5,7 +5,8 @@ interface NumberFormProps {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
7
|
placeholder?: string;
|
|
8
|
+
className?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const NumberForm: ({ number, precision, min, max, handleInputChange, placeholder, }: NumberFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const NumberForm: ({ number, precision, min, max, handleInputChange, placeholder, className, }: NumberFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=numberForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/numberForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numberForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/numberForm.tsx"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,6EAQxB,eAAe,4CAqBjB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Form, NumberField } from "@powerhousedao/document-engineering/scalars";
|
|
3
|
-
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
export const NumberForm = ({ number, precision, min, max, handleInputChange, placeholder, className, }) => {
|
|
4
5
|
return (_jsx(Form, { defaultValues: { number }, onSubmit: () => { }, resetOnSuccessfulSubmit: true, children: _jsx(NumberField, { name: "number", onChange: (e) => {
|
|
5
6
|
handleInputChange(e);
|
|
6
|
-
}, precision: precision, min: min, max: max, value: Number(number), placeholder: placeholder }) }));
|
|
7
|
+
}, precision: precision, min: min, max: max, value: Number(number), placeholder: placeholder, className: twMerge(className) }) }));
|
|
7
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA2BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAowB3C"}
|
|
@@ -45,6 +45,35 @@ export default function Editor(props) {
|
|
|
45
45
|
const [payerEmailValidation, setPayerEmailValidation] = useState(null);
|
|
46
46
|
const [lineItemValidation, setLineItemValidation] = useState(null);
|
|
47
47
|
const prevStatus = useRef(state.status);
|
|
48
|
+
const invoiceRootStyle = {
|
|
49
|
+
width: '100vw',
|
|
50
|
+
minHeight: '100vh',
|
|
51
|
+
margin: 0,
|
|
52
|
+
padding: 0,
|
|
53
|
+
boxSizing: 'border-box',
|
|
54
|
+
transform: 'scale(0.9)',
|
|
55
|
+
transformOrigin: 'top left',
|
|
56
|
+
};
|
|
57
|
+
const [responsiveStyle, setResponsiveStyle] = useState(invoiceRootStyle);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
function handleResize() {
|
|
60
|
+
if (window.innerWidth >= 1024) {
|
|
61
|
+
setResponsiveStyle({
|
|
62
|
+
...invoiceRootStyle,
|
|
63
|
+
maxWidth: '1280px',
|
|
64
|
+
marginLeft: 'auto',
|
|
65
|
+
marginRight: 'auto',
|
|
66
|
+
padding: '1rem',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
setResponsiveStyle(invoiceRootStyle);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
handleResize();
|
|
74
|
+
window.addEventListener('resize', handleResize);
|
|
75
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
76
|
+
}, []);
|
|
48
77
|
useEffect(() => {
|
|
49
78
|
setFiatMode(isFiatCurrency(state.currency));
|
|
50
79
|
}, [state.currency, state]);
|
|
@@ -316,7 +345,8 @@ export default function Editor(props) {
|
|
|
316
345
|
dispatch(actions.editStatus({ status: newStatus }));
|
|
317
346
|
};
|
|
318
347
|
const handleCurrencyChange = (currency) => {
|
|
319
|
-
if ((prevStatus.current === "PAYMENTSCHEDULED" ||
|
|
348
|
+
if ((prevStatus.current === "PAYMENTSCHEDULED" ||
|
|
349
|
+
prevStatus.current === "DRAFT") &&
|
|
320
350
|
!isFiatCurrency(currency) &&
|
|
321
351
|
state.issuer.paymentRouting?.wallet?.chainName === "") {
|
|
322
352
|
dispatch(actions.editStatus({ status: "DRAFT" }));
|
|
@@ -326,7 +356,7 @@ export default function Editor(props) {
|
|
|
326
356
|
}
|
|
327
357
|
dispatch(actions.editInvoice({ currency }));
|
|
328
358
|
};
|
|
329
|
-
return (_jsxs("div", {
|
|
359
|
+
return (_jsxs("div", { style: responsiveStyle, children: [_jsx(ToastContainer, { position: "bottom-right", autoClose: 5000, hideProgressBar: false, newestOnTop: false, closeOnClick: false, rtl: false, pauseOnFocusLoss: true, draggable: true, pauseOnHover: true, theme: "light" }), _jsxs("div", { className: "flex items-center justify-between gap-4 mb-6", children: [_jsxs("div", { className: "flex items-center gap-4 flex-nowrap", children: [_jsx("h1", { className: "text-3xl font-bold whitespace-nowrap", children: "Invoice" }), _jsx(InputField, { placeholder: "Add invoice number", value: invoiceNoInput, handleInputChange: (e) => setInvoiceNoInput(e.target.value), onBlur: (e) => {
|
|
330
360
|
const newValue = e.target.value;
|
|
331
361
|
if (newValue !== state.invoiceNo) {
|
|
332
362
|
dispatch(actions.editInvoice({ invoiceNo: newValue }));
|
|
@@ -342,7 +372,7 @@ export default function Editor(props) {
|
|
|
342
372
|
setExportDropdownOpen(false);
|
|
343
373
|
}, className: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 cursor-pointer", children: "Export PDF" })] }) }))] })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsx(CurrencyForm, { currency: state.currency, handleInputChange: (e) => {
|
|
344
374
|
handleCurrencyChange(e.target.value);
|
|
345
|
-
}, validation: currencyValidation }) }), _jsx(SelectField, { options: STATUS_OPTIONS, value: state.status, onChange: (value) => handleStatusChange(value) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-
|
|
375
|
+
}, validation: currencyValidation }) }), _jsx(SelectField, { options: STATUS_OPTIONS, value: state.status, onChange: (value) => handleStatusChange(value) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Issuer" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Issue Date:" }), _jsx(DatePicker, { name: "issueDate", className: "w-full", onChange: (e) => {
|
|
346
376
|
const newDate = e.target.value.split("T")[0];
|
|
347
377
|
dispatch(actions.editInvoice({
|
|
348
378
|
dateIssued: newDate,
|
|
@@ -356,7 +386,7 @@ export default function Editor(props) {
|
|
|
356
386
|
}
|
|
357
387
|
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, countryvalidation: countryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-6", 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-full", onChange: (e) => dispatch(actions.editInvoice({
|
|
358
388
|
dateDue: e.target.value.split("T")[0],
|
|
359
|
-
})), 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 => ({
|
|
389
|
+
})), 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) => ({
|
|
360
390
|
...item,
|
|
361
391
|
lineItemTag: item.lineItemTag ?? [],
|
|
362
392
|
})), onAddItem: (item) => dispatch(actions.addLineItem(item)), onDeleteItem: (input) => dispatch(actions.deleteLineItem(input)), onUpdateCurrency: (input) => {
|
|
@@ -10,11 +10,10 @@ interface TagAssignmentRow {
|
|
|
10
10
|
}
|
|
11
11
|
interface LineItemTagsTableProps {
|
|
12
12
|
lineItems: TagAssignmentRow[];
|
|
13
|
-
onSave: (updatedLineItems: TagAssignmentRow[], paymentAccount: string) => void;
|
|
14
13
|
onClose: () => void;
|
|
15
14
|
dispatch: Dispatch<any>;
|
|
16
15
|
paymentAccounts: string[];
|
|
17
16
|
}
|
|
18
|
-
export declare function LineItemTagsTable({ lineItems,
|
|
17
|
+
export declare function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccounts, }: LineItemTagsTableProps): import("react/jsx-runtime").JSX.Element;
|
|
19
18
|
export {};
|
|
20
19
|
//# sourceMappingURL=lineItemTags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,
|
|
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,EAEL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAGnD,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,kBAAkB,EAAE,CAAC;CACnC;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,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA4KxB"}
|
|
@@ -1,35 +1,50 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
2
|
import { X, Tag } from "lucide-react";
|
|
4
3
|
import { Button } from "@powerhousedao/design-system";
|
|
5
|
-
import { Select } from "@powerhousedao/document-engineering/ui";
|
|
4
|
+
import { Select, DatePicker } from "@powerhousedao/document-engineering/ui";
|
|
6
5
|
import { expenseAccountOptions } from "./tagMapping.js";
|
|
7
|
-
import { actions } from "../../../document-models/invoice/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
import { actions, } from "../../../document-models/invoice/index.js";
|
|
7
|
+
import { InputField } from "../components/inputField.js";
|
|
8
|
+
export function LineItemTagsTable({ lineItems, onClose, dispatch, paymentAccounts, }) {
|
|
9
|
+
const handleReset = () => {
|
|
10
|
+
// Resetting all tags to empty values
|
|
11
|
+
lineItems.forEach((item) => {
|
|
12
|
+
item.lineItemTag.forEach((tag) => {
|
|
13
|
+
dispatch(actions.setLineItemTag({
|
|
14
|
+
lineItemId: item.id,
|
|
15
|
+
dimension: tag.dimension,
|
|
16
|
+
value: "",
|
|
17
|
+
label: "",
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
// Resetting payment accounts to empty array
|
|
22
|
+
paymentAccounts.forEach((paymentAccount) => {
|
|
23
|
+
dispatch(actions.deletePaymentAccount({ paymentAccount: paymentAccount }));
|
|
24
|
+
});
|
|
22
25
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
:
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
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) => {
|
|
27
|
+
}, onBlur: (e) => {
|
|
28
|
+
dispatch(actions.editLineItem({
|
|
29
|
+
id: item.id,
|
|
30
|
+
description: e.target.value,
|
|
31
|
+
}));
|
|
32
|
+
}, className: "w-full" }) }), _jsx("td", { className: "border-b border-gray-200 p-3", style: { width: "100px" }, 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({
|
|
33
|
+
lineItemId: item.id,
|
|
34
|
+
dimension: "accounting-period",
|
|
35
|
+
value: new Date(e.target.value)
|
|
36
|
+
.toLocaleDateString("en-US", {
|
|
37
|
+
year: "numeric",
|
|
38
|
+
month: "numeric",
|
|
39
|
+
})
|
|
40
|
+
.split("/")
|
|
41
|
+
.reverse()
|
|
42
|
+
.join("/"),
|
|
43
|
+
label: new Date(e.target.value).toLocaleDateString("en-US", {
|
|
44
|
+
month: "long",
|
|
45
|
+
year: "numeric",
|
|
46
|
+
}),
|
|
47
|
+
})) }) }), _jsx("td", { className: "border-b border-gray-200 p-3", children: _jsx(Select, { options: expenseAccountOptions, value: item.lineItemTag.find((tag) => tag.dimension === "xero-expense-account")?.value || "", placeholder: "Select Expense Account", searchable: true, onChange: (value) => {
|
|
33
48
|
dispatch(actions.setLineItemTag({
|
|
34
49
|
lineItemId: item.id,
|
|
35
50
|
dimension: "xero-expense-account",
|
|
@@ -40,8 +55,8 @@ export function LineItemTagsTable({ lineItems, onSave, onClose, dispatch, paymen
|
|
|
40
55
|
{ label: "Powerhouse USD", value: "Powerhouse USD" },
|
|
41
56
|
{ label: "Powerhouse EUR", value: "Powerhouse EUR" },
|
|
42
57
|
], value: paymentAccounts && paymentAccounts.length > 0
|
|
43
|
-
? paymentAccounts[
|
|
58
|
+
? paymentAccounts[paymentAccounts.length - 1]
|
|
44
59
|
: "", placeholder: "Select Payment Account", searchable: true, onChange: (value) => {
|
|
45
60
|
dispatch(actions.addPaymentAccount({ paymentAccount: value }));
|
|
46
|
-
}
|
|
61
|
+
}, style: { width: "200px" } })] }) })] }));
|
|
47
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItems.d.ts","sourceRoot":"","sources":["../../../editors/invoice/lineItems.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACnH,OAAO,EAA0D,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqBzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAsBlD;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,kBAAkB,EAAE,CAAC;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"lineItems.d.ts","sourceRoot":"","sources":["../../../editors/invoice/lineItems.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACnH,OAAO,EAA0D,QAAQ,EAAE,MAAM,OAAO,CAAC;AAqBzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAsBlD;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,kBAAkB,EAAE,CAAC;CACnC,CAAC;AAuNF,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,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;CACpC,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,eAAe,EAChB,EAAE,mBAAmB,2CA+IrB"}
|
|
@@ -139,9 +139,9 @@ const EditableLineItem = forwardRef(function EditableLineItem(props, ref) {
|
|
|
139
139
|
};
|
|
140
140
|
onSave(completeItem);
|
|
141
141
|
}
|
|
142
|
-
return (_jsxs("tr", { ref: ref, className: "hover:bg-gray-50", children: [_jsx("td", { className: "border border-gray-200 p-3",
|
|
142
|
+
return (_jsxs("tr", { ref: ref, className: "hover:bg-gray-50 table-row", children: [_jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(InputField, { onBlur: () => { }, handleInputChange: (e) => {
|
|
143
143
|
setEditedItem((prev) => ({ ...prev, description: e.target.value }));
|
|
144
|
-
}, value: editedItem.description ?? "", placeholder: "Description" }) }), _jsx("td", { className: "border border-gray-200 p-3",
|
|
144
|
+
}, value: editedItem.description ?? "", placeholder: "Description", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.quantity ?? "", precision: 0, handleInputChange: handleInputChange("quantity"), placeholder: "Quantity", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.unitPriceTaxExcl ?? "", precision: getCurrencyPrecision(currency), handleInputChange: handleInputChange("unitPriceTaxExcl"), placeholder: "Unit Price (excl. tax)", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsx(NumberForm, { number: editedItem.taxPercent ?? "", precision: 0, min: 0, max: 100, handleInputChange: handleInputChange("taxPercent"), placeholder: "Tax %", className: "" }) }), _jsx("td", { className: "border border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(calculatedValues.totalPriceTaxExcl) }), _jsx("td", { className: "border border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(calculatedValues.totalPriceTaxIncl) }), _jsx("td", { className: "border border-gray-200 p-3 table-cell", children: _jsxs("div", { className: "flex space-x-2", children: [_jsx("button", { className: "rounded bg-blue-500 px-3 py-1 text-white hover:bg-blue-700", onClick: handleSave, children: "Save" }), _jsx("button", { className: "rounded bg-gray-500 px-3 py-1 text-white hover:bg-gray-600", onClick: onCancel, children: "Cancel" })] }) })] }));
|
|
145
145
|
});
|
|
146
146
|
export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, onDeleteItem, onUpdateCurrency, dispatch, paymentAccounts }) {
|
|
147
147
|
const [editingId, setEditingId] = useState(null);
|
|
@@ -165,22 +165,16 @@ export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, o
|
|
|
165
165
|
const tagAssignmentRows = lineItems.map(item => ({
|
|
166
166
|
id: item.id,
|
|
167
167
|
item: item.description,
|
|
168
|
-
period: '
|
|
168
|
+
period: '', // Default value
|
|
169
169
|
expenseAccount: '', // Default value
|
|
170
170
|
total: `$${formatNumber(item.totalPriceTaxIncl)}`,
|
|
171
171
|
lineItemTag: item.lineItemTag,
|
|
172
172
|
}));
|
|
173
|
-
const handleTagsSave = (updatedTaggedItems, paymentAccount) => {
|
|
174
|
-
// Handle the saved tags here if needed
|
|
175
|
-
setShowTagTable(false);
|
|
176
|
-
};
|
|
177
173
|
if (showTagTable) {
|
|
178
|
-
return (_jsx(LineItemTagsTable, { lineItems: tagAssignmentRows,
|
|
174
|
+
return (_jsx(LineItemTagsTable, { lineItems: tagAssignmentRows, onClose: () => setShowTagTable(false), dispatch: dispatch, paymentAccounts: paymentAccounts }));
|
|
179
175
|
}
|
|
180
|
-
return (_jsx("div", { ref: containerRef, className: "relative w-full", children: _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("div", { className: "flex items-center gap-4", children: _jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }) }), _jsx(RWAButton, { className: "mb-2", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] }), _jsx("div", { ref: tableContainerRef, className: "overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { ref: tableRef, className: "w-full table-fixed border-collapse bg-white", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "border-b border-gray-200 p-3 text-left",
|
|
176
|
+
return (_jsx("div", { ref: containerRef, className: "relative w-full", children: _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("div", { className: "flex items-center gap-4", children: _jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }) }), _jsx(RWAButton, { className: "mb-2", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] }), _jsx("div", { ref: tableContainerRef, className: "overflow-x-auto rounded-lg border border-gray-200", children: _jsxs("table", { ref: tableRef, className: "w-full table-fixed border-collapse bg-white", children: [_jsxs("colgroup", { children: [_jsx("col", { style: { width: '30%' } }), _jsx("col", { style: { width: '10%' } }), _jsx("col", { style: { width: '12%' } }), _jsx("col", { style: { width: '8%' } }), _jsx("col", {}), _jsx("col", {}), _jsx("col", {})] }), _jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "border-b border-gray-200 p-3 text-left", children: "Description" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Quantity" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Unit Price (excl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Tax %" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total (excl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-right", children: "Total (incl. tax)" }), _jsx("th", { className: "border-b border-gray-200 p-3 text-center", children: _jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx("span", { className: "text-sm", children: "Actions" }), _jsx(Tag, { onClick: () => setShowTagTable(true), style: { cursor: "pointer", width: 28, height: 28, color: "white", fill: "#475264" } })] }) })] }) }), _jsxs("tbody", { children: [lineItems.map((item) => editingId === item.id ? (_jsx(EditableLineItem, { currency: currency, item: item, onCancel: () => setEditingId(null), onSave: (updatedItem) => {
|
|
181
177
|
onUpdateItem(updatedItem);
|
|
182
178
|
setEditingId(null);
|
|
183
|
-
} }, item.id)) : (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "border-b border-gray-200 p-3", children: item.description }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right", children: item.quantity }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right", children: formatNumber(item.unitPriceTaxExcl) }), _jsxs("td", { className: "border-b border-gray-200 p-3 text-right", children: [typeof item.taxPercent === "number"
|
|
184
|
-
? Math.round(item.taxPercent)
|
|
185
|
-
: 0, "%"] }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium", children: formatNumber(item.totalPriceTaxExcl) }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium", children: formatNumber(item.totalPriceTaxIncl) }), _jsx("td", { className: "border-b border-gray-200 p-3", children: _jsxs("div", { className: "flex justify-center space-x-2", children: [_jsx("button", { style: { backgroundColor: "lightblue" }, className: "rounded bg-blue-600 px-3 py-1 text-white hover:bg-blue-700", onClick: () => setEditingId(item.id), children: "Edit" }), _jsx("button", { className: "rounded bg-red-600 px-3 py-1 text-white hover:bg-red-700", onClick: () => onDeleteItem({ id: item.id }), children: "Delete" })] }) })] }, item.id))), isAddingNew ? (_jsx(EditableLineItem, { currency: currency, item: {}, onCancel: handleCancelNewItem, onSave: handleSaveNewItem })) : null] })] }) })] }) }));
|
|
179
|
+
} }, item.id)) : (_jsxs("tr", { className: "hover:bg-gray-50 table-row", children: [_jsx("td", { className: "border-b border-gray-200 p-3 table-cell", children: item.description }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: item.quantity }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: formatNumber(item.unitPriceTaxExcl) }), _jsxs("td", { className: "border-b border-gray-200 p-3 text-right table-cell", children: [typeof item.taxPercent === "number" ? Math.round(item.taxPercent) : 0, "%"] }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(item.totalPriceTaxExcl) }), _jsx("td", { className: "border-b border-gray-200 p-3 text-right font-medium table-cell", children: formatNumber(item.totalPriceTaxIncl) }), _jsx("td", { className: "border-b border-gray-200 p-3 table-cell", children: _jsxs("div", { className: "flex justify-center space-x-2", children: [_jsx("button", { style: { backgroundColor: "lightblue" }, className: "rounded bg-blue-600 px-3 py-1 text-white hover:bg-blue-700", onClick: () => setEditingId(item.id), children: "Edit" }), _jsx("button", { className: "rounded bg-red-600 px-3 py-1 text-white hover:bg-red-700", onClick: () => onDeleteItem({ id: item.id }), children: "Delete" })] }) })] }, item.id))), isAddingNew ? (_jsx(EditableLineItem, { currency: currency, item: {}, onCancel: handleCancelNewItem, onSave: handleSaveNewItem })) : null] })] }) })] }) }));
|
|
186
180
|
}
|
package/dist/style.css
CHANGED
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
--container-xs: 20rem;
|
|
64
64
|
--container-md: 28rem;
|
|
65
65
|
--container-4xl: 56rem;
|
|
66
|
-
--container-7xl: 80rem;
|
|
67
66
|
--text-xs: 0.75rem;
|
|
68
67
|
--text-xs--line-height: calc(1 / 0.75);
|
|
69
68
|
--text-sm: 0.875rem;
|
|
@@ -300,9 +299,6 @@
|
|
|
300
299
|
max-width: 96rem;
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
|
-
.mx-auto {
|
|
304
|
-
margin-inline: auto;
|
|
305
|
-
}
|
|
306
302
|
.mt-1 {
|
|
307
303
|
margin-top: calc(var(--spacing) * 1);
|
|
308
304
|
}
|
|
@@ -354,6 +350,9 @@
|
|
|
354
350
|
.hidden {
|
|
355
351
|
display: none;
|
|
356
352
|
}
|
|
353
|
+
.inline {
|
|
354
|
+
display: inline;
|
|
355
|
+
}
|
|
357
356
|
.inline-block {
|
|
358
357
|
display: inline-block;
|
|
359
358
|
}
|
|
@@ -363,6 +362,12 @@
|
|
|
363
362
|
.table {
|
|
364
363
|
display: table;
|
|
365
364
|
}
|
|
365
|
+
.table-cell {
|
|
366
|
+
display: table-cell;
|
|
367
|
+
}
|
|
368
|
+
.table-row {
|
|
369
|
+
display: table-row;
|
|
370
|
+
}
|
|
366
371
|
.size-4 {
|
|
367
372
|
width: calc(var(--spacing) * 4);
|
|
368
373
|
height: calc(var(--spacing) * 4);
|
|
@@ -400,9 +405,6 @@
|
|
|
400
405
|
.w-full {
|
|
401
406
|
width: 100%;
|
|
402
407
|
}
|
|
403
|
-
.max-w-7xl {
|
|
404
|
-
max-width: var(--container-7xl);
|
|
405
|
-
}
|
|
406
408
|
.flex-1 {
|
|
407
409
|
flex: 1;
|
|
408
410
|
}
|
|
@@ -424,9 +426,15 @@
|
|
|
424
426
|
--tw-translate-y: calc(calc(1/2 * 100%) * -1);
|
|
425
427
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
426
428
|
}
|
|
429
|
+
.transform {
|
|
430
|
+
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
431
|
+
}
|
|
427
432
|
.cursor-pointer {
|
|
428
433
|
cursor: pointer;
|
|
429
434
|
}
|
|
435
|
+
.resize {
|
|
436
|
+
resize: both;
|
|
437
|
+
}
|
|
430
438
|
.grid-cols-1 {
|
|
431
439
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
432
440
|
}
|
|
@@ -463,9 +471,6 @@
|
|
|
463
471
|
.gap-6 {
|
|
464
472
|
gap: calc(var(--spacing) * 6);
|
|
465
473
|
}
|
|
466
|
-
.gap-8 {
|
|
467
|
-
gap: calc(var(--spacing) * 8);
|
|
468
|
-
}
|
|
469
474
|
.space-y-1 {
|
|
470
475
|
:where(& > :not(:last-child)) {
|
|
471
476
|
--tw-space-y-reverse: 0;
|
|
@@ -6040,26 +6045,6 @@ input[type="number"] {
|
|
|
6040
6045
|
inherits: false;
|
|
6041
6046
|
initial-value: 1;
|
|
6042
6047
|
}
|
|
6043
|
-
@property --tw-rotate-x {
|
|
6044
|
-
syntax: "*";
|
|
6045
|
-
inherits: false;
|
|
6046
|
-
}
|
|
6047
|
-
@property --tw-rotate-y {
|
|
6048
|
-
syntax: "*";
|
|
6049
|
-
inherits: false;
|
|
6050
|
-
}
|
|
6051
|
-
@property --tw-rotate-z {
|
|
6052
|
-
syntax: "*";
|
|
6053
|
-
inherits: false;
|
|
6054
|
-
}
|
|
6055
|
-
@property --tw-skew-x {
|
|
6056
|
-
syntax: "*";
|
|
6057
|
-
inherits: false;
|
|
6058
|
-
}
|
|
6059
|
-
@property --tw-skew-y {
|
|
6060
|
-
syntax: "*";
|
|
6061
|
-
inherits: false;
|
|
6062
|
-
}
|
|
6063
6048
|
@property --tw-divide-y-reverse {
|
|
6064
6049
|
syntax: "*";
|
|
6065
6050
|
inherits: false;
|
|
@@ -6298,6 +6283,26 @@ input[type="number"] {
|
|
|
6298
6283
|
inherits: false;
|
|
6299
6284
|
initial-value: 0;
|
|
6300
6285
|
}
|
|
6286
|
+
@property --tw-rotate-x {
|
|
6287
|
+
syntax: "*";
|
|
6288
|
+
inherits: false;
|
|
6289
|
+
}
|
|
6290
|
+
@property --tw-rotate-y {
|
|
6291
|
+
syntax: "*";
|
|
6292
|
+
inherits: false;
|
|
6293
|
+
}
|
|
6294
|
+
@property --tw-rotate-z {
|
|
6295
|
+
syntax: "*";
|
|
6296
|
+
inherits: false;
|
|
6297
|
+
}
|
|
6298
|
+
@property --tw-skew-x {
|
|
6299
|
+
syntax: "*";
|
|
6300
|
+
inherits: false;
|
|
6301
|
+
}
|
|
6302
|
+
@property --tw-skew-y {
|
|
6303
|
+
syntax: "*";
|
|
6304
|
+
inherits: false;
|
|
6305
|
+
}
|
|
6301
6306
|
@property --tw-space-y-reverse {
|
|
6302
6307
|
syntax: "*";
|
|
6303
6308
|
inherits: false;
|
|
@@ -6420,6 +6425,11 @@ input[type="number"] {
|
|
|
6420
6425
|
--tw-translate-x: 0;
|
|
6421
6426
|
--tw-translate-y: 0;
|
|
6422
6427
|
--tw-translate-z: 0;
|
|
6428
|
+
--tw-rotate-x: initial;
|
|
6429
|
+
--tw-rotate-y: initial;
|
|
6430
|
+
--tw-rotate-z: initial;
|
|
6431
|
+
--tw-skew-x: initial;
|
|
6432
|
+
--tw-skew-y: initial;
|
|
6423
6433
|
--tw-space-y-reverse: 0;
|
|
6424
6434
|
--tw-space-x-reverse: 0;
|
|
6425
6435
|
--tw-border-style: solid;
|
|
@@ -6446,11 +6456,6 @@ input[type="number"] {
|
|
|
6446
6456
|
--tw-scale-x: 1;
|
|
6447
6457
|
--tw-scale-y: 1;
|
|
6448
6458
|
--tw-scale-z: 1;
|
|
6449
|
-
--tw-rotate-x: initial;
|
|
6450
|
-
--tw-rotate-y: initial;
|
|
6451
|
-
--tw-rotate-z: initial;
|
|
6452
|
-
--tw-skew-x: initial;
|
|
6453
|
-
--tw-skew-y: initial;
|
|
6454
6459
|
--tw-divide-y-reverse: 0;
|
|
6455
6460
|
--tw-leading: initial;
|
|
6456
6461
|
--tw-tracking: initial;
|
package/dist/tailwind.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/contributor-billing",
|
|
3
3
|
"description": "Document models that help contributors of open organisations get paid anonymously for their work on a monthly basis.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|