@powerhousedao/network-admin 0.0.23 → 0.0.24
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/editors/hooks/useNetworkProfileDocument.d.ts +4 -0
- package/dist/editors/hooks/useNetworkProfileDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useNetworkProfileDocument.js +8 -0
- package/dist/editors/hooks/usePaymentTermsDocument.d.ts +4 -0
- package/dist/editors/hooks/usePaymentTermsDocument.d.ts.map +1 -0
- package/dist/editors/hooks/usePaymentTermsDocument.js +8 -0
- package/dist/editors/hooks/useRequestForProposalsDocument.d.ts +4 -0
- package/dist/editors/hooks/useRequestForProposalsDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useRequestForProposalsDocument.js +8 -0
- package/dist/editors/hooks/useWorkstreamDocument.d.ts +4 -0
- package/dist/editors/hooks/useWorkstreamDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useWorkstreamDocument.js +8 -0
- package/dist/editors/network-admin/components/DriveExplorer.d.ts +3 -1
- package/dist/editors/network-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/DriveExplorer.js +83 -114
- package/dist/editors/network-admin/editor.d.ts +3 -14
- package/dist/editors/network-admin/editor.d.ts.map +1 -1
- package/dist/editors/network-admin/editor.js +2 -24
- package/dist/editors/network-admin/index.d.ts +0 -1
- package/dist/editors/network-admin/index.d.ts.map +1 -1
- package/dist/editors/network-admin/index.js +1 -2
- package/dist/editors/network-profile/editor.d.ts +1 -1
- package/dist/editors/network-profile/editor.d.ts.map +1 -1
- package/dist/editors/network-profile/editor.js +4 -4
- package/dist/editors/payment-terms/basic-terms-tab.d.ts +5 -3
- package/dist/editors/payment-terms/basic-terms-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/basic-terms-tab.js +18 -14
- package/dist/editors/payment-terms/clauses-tab.d.ts +4 -2
- package/dist/editors/payment-terms/clauses-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/cost-materials-tab.d.ts +5 -3
- package/dist/editors/payment-terms/cost-materials-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/cost-materials-tab.js +24 -15
- package/dist/editors/payment-terms/editor.d.ts +1 -1
- package/dist/editors/payment-terms/editor.d.ts.map +1 -1
- package/dist/editors/payment-terms/editor.js +5 -5
- package/dist/editors/payment-terms/escrow-tab.d.ts +4 -2
- package/dist/editors/payment-terms/escrow-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/escrow-tab.js +4 -4
- package/dist/editors/payment-terms/evaluation-tab.d.ts +4 -2
- package/dist/editors/payment-terms/evaluation-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/index.d.ts.map +1 -1
- package/dist/editors/payment-terms/milestones-tab.d.ts +5 -4
- package/dist/editors/payment-terms/milestones-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/milestones-tab.js +31 -21
- package/dist/editors/payment-terms/retainer-tab.d.ts +4 -2
- package/dist/editors/payment-terms/retainer-tab.d.ts.map +1 -1
- package/dist/editors/payment-terms/retainer-tab.js +18 -10
- package/dist/editors/request-for-proposals/editor.d.ts +1 -1
- package/dist/editors/request-for-proposals/editor.d.ts.map +1 -1
- package/dist/editors/request-for-proposals/editor.js +3 -3
- package/dist/editors/workstream/editor.d.ts +1 -1
- package/dist/editors/workstream/editor.d.ts.map +1 -1
- package/dist/editors/workstream/editor.js +70 -76
- package/dist/style.css +0 -35
- package/package.json +2 -2
- package/dist/editors/network-admin/components/EditorContainer.d.ts +0 -13
- package/dist/editors/network-admin/components/EditorContainer.d.ts.map +0 -1
- package/dist/editors/network-admin/components/EditorContainer.js +0 -99
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import { toast, Button } from "@powerhousedao/design-system";
|
|
4
4
|
import { Select, TextInput } from "@powerhousedao/document-engineering";
|
|
5
|
-
export function BasicTermsTab({ state, dispatch, actions }) {
|
|
5
|
+
export function BasicTermsTab({ state, dispatch, actions, }) {
|
|
6
6
|
const [isEditing, setIsEditing] = useState(false);
|
|
7
7
|
const [formData, setFormData] = useState({
|
|
8
8
|
proposer: state.proposer || "",
|
|
@@ -11,7 +11,7 @@ export function BasicTermsTab({ state, dispatch, actions }) {
|
|
|
11
11
|
paymentModel: state.paymentModel || "MILESTONE",
|
|
12
12
|
totalAmount: state.totalAmount?.value?.toString() || "",
|
|
13
13
|
status: state.status || "DRAFT",
|
|
14
|
-
useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions)
|
|
14
|
+
useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions),
|
|
15
15
|
});
|
|
16
16
|
const handleSubmit = useCallback((e) => {
|
|
17
17
|
e.preventDefault();
|
|
@@ -20,10 +20,12 @@ export function BasicTermsTab({ state, dispatch, actions }) {
|
|
|
20
20
|
payer: formData.payer,
|
|
21
21
|
currency: formData.currency,
|
|
22
22
|
paymentModel: formData.paymentModel,
|
|
23
|
-
totalAmount: formData.totalAmount
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
totalAmount: formData.totalAmount
|
|
24
|
+
? {
|
|
25
|
+
value: parseFloat(formData.totalAmount),
|
|
26
|
+
unit: formData.currency,
|
|
27
|
+
}
|
|
28
|
+
: undefined,
|
|
27
29
|
}));
|
|
28
30
|
if (formData.status !== state.status) {
|
|
29
31
|
dispatch(actions.updateStatus({ status: formData.status }));
|
|
@@ -34,7 +36,7 @@ export function BasicTermsTab({ state, dispatch, actions }) {
|
|
|
34
36
|
amountHeld: { value: 0, unit: formData.currency },
|
|
35
37
|
releaseConditions: "Upon project completion",
|
|
36
38
|
escrowProvider: "",
|
|
37
|
-
proofOfFundsDocumentId: ""
|
|
39
|
+
proofOfFundsDocumentId: "",
|
|
38
40
|
}));
|
|
39
41
|
}
|
|
40
42
|
else if (!formData.useEscrow && state.escrowDetails) {
|
|
@@ -42,7 +44,7 @@ export function BasicTermsTab({ state, dispatch, actions }) {
|
|
|
42
44
|
amountHeld: { value: 0, unit: formData.currency },
|
|
43
45
|
releaseConditions: "",
|
|
44
46
|
escrowProvider: "",
|
|
45
|
-
proofOfFundsDocumentId: ""
|
|
47
|
+
proofOfFundsDocumentId: "",
|
|
46
48
|
}));
|
|
47
49
|
}
|
|
48
50
|
toast("Basic terms updated successfully", {
|
|
@@ -58,27 +60,29 @@ export function BasicTermsTab({ state, dispatch, actions }) {
|
|
|
58
60
|
paymentModel: state.paymentModel || "MILESTONE",
|
|
59
61
|
totalAmount: state.totalAmount?.value?.toString() || "",
|
|
60
62
|
status: state.status || "DRAFT",
|
|
61
|
-
useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions)
|
|
63
|
+
useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions),
|
|
62
64
|
});
|
|
63
65
|
setIsEditing(false);
|
|
64
66
|
}, [state]);
|
|
65
67
|
if (!isEditing) {
|
|
66
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "Basic Information" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Edit Terms" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Proposer" }), _jsx("p", { className: "text-lg", children: state.proposer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payer" }), _jsx("p", { className: "text-lg", children: state.payer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Currency" }), _jsx("p", { className: "text-lg", children: state.currency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payment Model" }), _jsx("p", { className: "text-lg", children: state.paymentModel.replace(/_/g,
|
|
68
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "Basic Information" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Edit Terms" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Proposer" }), _jsx("p", { className: "text-lg", children: state.proposer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payer" }), _jsx("p", { className: "text-lg", children: state.payer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Currency" }), _jsx("p", { className: "text-lg", children: state.currency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payment Model" }), _jsx("p", { className: "text-lg", children: state.paymentModel.replace(/_/g, " ") })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Total Amount" }), _jsx("p", { className: "text-lg", children: state.totalAmount
|
|
67
69
|
? `${state.totalAmount.value} ${state.totalAmount.unit}`
|
|
68
|
-
: "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Status" }), _jsx("p", { className: "text-lg", children: state.status })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Escrow" }), _jsx("p", { className: "text-lg", children: state.escrowDetails && state.escrowDetails.releaseConditions
|
|
70
|
+
: "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Status" }), _jsx("p", { className: "text-lg", children: state.status })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Escrow" }), _jsx("p", { className: "text-lg", children: state.escrowDetails && state.escrowDetails.releaseConditions
|
|
71
|
+
? "Enabled"
|
|
72
|
+
: "Disabled" })] })] })] }));
|
|
69
73
|
}
|
|
70
74
|
return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold", children: "Edit Basic Terms" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Proposer *" }), _jsx(TextInput, { value: formData.proposer, onChange: (e) => setFormData({ ...formData, proposer: e.target.value }), placeholder: "Enter proposer name", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payer *" }), _jsx(TextInput, { value: formData.payer, onChange: (e) => setFormData({ ...formData, payer: e.target.value }), placeholder: "Enter payer name", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Currency *" }), _jsx(Select, { value: formData.currency, onChange: (value) => setFormData({ ...formData, currency: value }), options: [
|
|
71
75
|
{ value: "USD", label: "USD" },
|
|
72
76
|
{ value: "EUR", label: "EUR" },
|
|
73
|
-
{ value: "GBP", label: "GBP" }
|
|
77
|
+
{ value: "GBP", label: "GBP" },
|
|
74
78
|
], placeholder: "Select currency", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payment Model *" }), _jsx(Select, { value: formData.paymentModel, onChange: (value) => setFormData({ ...formData, paymentModel: value }), options: [
|
|
75
79
|
{ value: "MILESTONE", label: "Milestone" },
|
|
76
80
|
{ value: "COST_AND_MATERIALS", label: "Cost & Materials" },
|
|
77
|
-
{ value: "RETAINER", label: "Retainer" }
|
|
81
|
+
{ value: "RETAINER", label: "Retainer" },
|
|
78
82
|
], placeholder: "Select payment model", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Total Amount" }), _jsx(TextInput, { value: formData.totalAmount, onChange: (e) => setFormData({ ...formData, totalAmount: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Status *" }), _jsx(Select, { value: formData.status, onChange: (value) => setFormData({ ...formData, status: value }), options: [
|
|
79
83
|
{ value: "DRAFT", label: "Draft" },
|
|
80
84
|
{ value: "SUBMITTED", label: "Submitted" },
|
|
81
85
|
{ value: "ACCEPTED", label: "Accepted" },
|
|
82
|
-
{ value: "CANCELLED", label: "Cancelled" }
|
|
86
|
+
{ value: "CANCELLED", label: "Cancelled" },
|
|
83
87
|
], placeholder: "Select status", required: true })] }), _jsx("div", { className: "col-span-2", children: _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "useEscrow", checked: formData.useEscrow, onChange: (e) => setFormData({ ...formData, useEscrow: e.target.checked }), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "useEscrow", className: "text-sm font-medium text-gray-700", children: "Use Escrow" })] }) })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Terms" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
|
|
84
88
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { BonusClause, PenaltyClause } from "../../document-models/payment-terms/gen/types.js";
|
|
2
|
+
import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
|
|
3
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
4
|
export interface ClausesTabProps {
|
|
3
5
|
bonusClauses: BonusClause[];
|
|
4
6
|
penaltyClauses: PenaltyClause[];
|
|
5
|
-
dispatch: (action:
|
|
6
|
-
actions:
|
|
7
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
8
|
+
actions: typeof paymentTermsActions;
|
|
7
9
|
currency: string;
|
|
8
10
|
}
|
|
9
11
|
export declare function ClausesTab({ bonusClauses, penaltyClauses, dispatch, actions, currency }: ClausesTabProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clauses-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/clauses-tab.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACd,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"clauses-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/clauses-tab.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAgB,EAAE,EAAE,eAAe,2CAoVhH"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PaymentTermsState } from "../../document-models/payment-terms/gen/schema/types.js";
|
|
2
|
+
import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
|
|
3
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
4
|
export interface CostMaterialsTabProps {
|
|
3
5
|
state: PaymentTermsState;
|
|
4
|
-
dispatch: (action:
|
|
5
|
-
actions:
|
|
6
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
+
actions: typeof paymentTermsActions;
|
|
6
8
|
}
|
|
7
|
-
export declare function CostMaterialsTab({ state, dispatch, actions }: CostMaterialsTabProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function CostMaterialsTab({ state, dispatch, actions, }: CostMaterialsTabProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
//# sourceMappingURL=cost-materials-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-materials-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/cost-materials-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"cost-materials-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/cost-materials-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,qBAAqB,2CA6NvB"}
|
|
@@ -2,27 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import { TextInput, Select } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { Button, toast } from "@powerhousedao/design-system";
|
|
5
|
-
export function CostMaterialsTab({ state, dispatch, actions }) {
|
|
5
|
+
export function CostMaterialsTab({ state, dispatch, actions, }) {
|
|
6
6
|
const [isEditing, setIsEditing] = useState(false);
|
|
7
7
|
const [formData, setFormData] = useState({
|
|
8
8
|
hourlyRate: state.costAndMaterials?.hourlyRate?.value?.toString() || "",
|
|
9
9
|
variableCap: state.costAndMaterials?.variableCap?.value?.toString() || "",
|
|
10
10
|
billingFrequency: state.costAndMaterials?.billingFrequency || "MONTHLY",
|
|
11
|
-
timesheetRequired: state.costAndMaterials?.timesheetRequired || false
|
|
11
|
+
timesheetRequired: state.costAndMaterials?.timesheetRequired || false,
|
|
12
12
|
});
|
|
13
13
|
const handleSubmit = useCallback((e) => {
|
|
14
14
|
e.preventDefault();
|
|
15
15
|
dispatch(actions.setCostAndMaterials({
|
|
16
|
-
hourlyRate: formData.hourlyRate
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
hourlyRate: formData.hourlyRate
|
|
17
|
+
? {
|
|
18
|
+
value: parseFloat(formData.hourlyRate),
|
|
19
|
+
unit: state.currency,
|
|
20
|
+
}
|
|
21
|
+
: undefined,
|
|
22
|
+
variableCap: formData.variableCap
|
|
23
|
+
? {
|
|
24
|
+
value: parseFloat(formData.variableCap),
|
|
25
|
+
unit: state.currency,
|
|
26
|
+
}
|
|
27
|
+
: undefined,
|
|
24
28
|
billingFrequency: formData.billingFrequency,
|
|
25
|
-
timesheetRequired: formData.timesheetRequired
|
|
29
|
+
timesheetRequired: formData.timesheetRequired,
|
|
26
30
|
}));
|
|
27
31
|
toast("Cost & Materials configuration saved", {
|
|
28
32
|
type: "success",
|
|
@@ -34,20 +38,25 @@ export function CostMaterialsTab({ state, dispatch, actions }) {
|
|
|
34
38
|
hourlyRate: state.costAndMaterials?.hourlyRate?.value?.toString() || "",
|
|
35
39
|
variableCap: state.costAndMaterials?.variableCap?.value?.toString() || "",
|
|
36
40
|
billingFrequency: state.costAndMaterials?.billingFrequency || "MONTHLY",
|
|
37
|
-
timesheetRequired: state.costAndMaterials?.timesheetRequired || false
|
|
41
|
+
timesheetRequired: state.costAndMaterials?.timesheetRequired || false,
|
|
38
42
|
});
|
|
39
43
|
setIsEditing(false);
|
|
40
44
|
}, [state.costAndMaterials]);
|
|
41
45
|
if (!isEditing) {
|
|
42
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Cost & Materials Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.costAndMaterials
|
|
46
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Cost & Materials Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.costAndMaterials
|
|
47
|
+
? "Edit Configuration"
|
|
48
|
+
: "Configure Cost & Materials" })] }), state.costAndMaterials ? (_jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Hourly Rate" }), _jsx("p", { className: "text-lg dark:text-white", children: state.costAndMaterials.hourlyRate
|
|
43
49
|
? `${state.costAndMaterials.hourlyRate.value} ${state.costAndMaterials.hourlyRate.unit}`
|
|
44
50
|
: "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Variable Cap" }), _jsx("p", { className: "text-lg dark:text-white", children: state.costAndMaterials.variableCap
|
|
45
51
|
? `${state.costAndMaterials.variableCap.value} ${state.costAndMaterials.variableCap.unit}`
|
|
46
52
|
: "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Billing Frequency" }), _jsx("p", { className: "text-lg dark:text-white", children: state.costAndMaterials.billingFrequency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Timesheet Required" }), _jsx("p", { className: "text-lg dark:text-white", children: state.costAndMaterials.timesheetRequired ? "Yes" : "No" })] })] })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [_jsx("p", { children: "No cost & materials configuration set up yet." }), _jsx("p", { className: "text-sm", children: "Click \"Configure Cost & Materials\" to get started." })] }))] }));
|
|
47
53
|
}
|
|
48
|
-
return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Configure Cost & Materials" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Hourly Rate" }), _jsx(TextInput, { value: formData.hourlyRate, onChange: (e) => setFormData({ ...formData, hourlyRate: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Variable Cap" }), _jsx(TextInput, { value: formData.variableCap, onChange: (e) => setFormData({ ...formData, variableCap: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Billing Frequency *" }), _jsx(Select, { value: formData.billingFrequency, onChange: (value) => setFormData({
|
|
54
|
+
return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Configure Cost & Materials" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Hourly Rate" }), _jsx(TextInput, { value: formData.hourlyRate, onChange: (e) => setFormData({ ...formData, hourlyRate: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Variable Cap" }), _jsx(TextInput, { value: formData.variableCap, onChange: (e) => setFormData({ ...formData, variableCap: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Billing Frequency *" }), _jsx(Select, { value: formData.billingFrequency, onChange: (value) => setFormData({
|
|
55
|
+
...formData,
|
|
56
|
+
billingFrequency: value,
|
|
57
|
+
}), options: [
|
|
49
58
|
{ value: "WEEKLY", label: "Weekly" },
|
|
50
59
|
{ value: "BIWEEKLY", label: "Biweekly" },
|
|
51
|
-
{ value: "MONTHLY", label: "Monthly" }
|
|
60
|
+
{ value: "MONTHLY", label: "Monthly" },
|
|
52
61
|
], placeholder: "Select billing frequency", required: true })] }), _jsxs("div", { className: "flex items-center pt-6", children: [_jsx("input", { type: "checkbox", id: "timesheetRequired", checked: formData.timesheetRequired, onChange: (e) => setFormData({ ...formData, timesheetRequired: e.target.checked }), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "timesheetRequired", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Timesheet Required" })] })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Configuration" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
|
|
53
62
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorProps } from "document-model";
|
|
2
2
|
export type IProps = EditorProps;
|
|
3
|
-
export default function Editor(
|
|
3
|
+
export default function Editor(): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/editor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/editor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAe1D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,4CAsW7B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useDocumentById } from "@powerhousedao/reactor-browser";
|
|
3
2
|
import { Icon, ToastContainer, } from "@powerhousedao/design-system";
|
|
4
3
|
import { actions, } from "../../document-models/payment-terms/index.js";
|
|
5
4
|
import { BasicTermsTab } from "./basic-terms-tab.js";
|
|
@@ -9,9 +8,10 @@ import { CostMaterialsTab } from "./cost-materials-tab.js";
|
|
|
9
8
|
import { RetainerTab } from "./retainer-tab.js";
|
|
10
9
|
import { EscrowTab } from "./escrow-tab.js";
|
|
11
10
|
import { EvaluationTab } from "./evaluation-tab.js";
|
|
12
|
-
|
|
11
|
+
import { useSelectedPaymentTermsDocument } from "../hooks/usePaymentTermsDocument.js";
|
|
12
|
+
export default function Editor() {
|
|
13
13
|
// Getting dispatch from props or selected document
|
|
14
|
-
const [doc, dispatch] =
|
|
14
|
+
const [doc, dispatch] = useSelectedPaymentTermsDocument();
|
|
15
15
|
const state = doc?.state.global;
|
|
16
16
|
const getStatusColor = (status) => {
|
|
17
17
|
switch (status) {
|
|
@@ -42,8 +42,8 @@ export default function Editor(props) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
const totalMilestones = state.milestoneSchedule?.length || 0;
|
|
45
|
-
const completedMilestones = state.milestoneSchedule?.filter((m) => m.payoutStatus === "PAID")
|
|
46
|
-
|
|
45
|
+
const completedMilestones = state.milestoneSchedule?.filter((m) => m.payoutStatus === "PAID").length ||
|
|
46
|
+
0;
|
|
47
47
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "min-h-screen bg-gray-50 dark:bg-gray-900", children: _jsxs("div", { className: "max-w-7xl mx-auto p-6", children: [_jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm p-6 mb-6", children: [_jsxs("div", { className: "flex justify-between items-start", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Icon, { name: "CalendarTime", size: 32, className: "text-blue-600 dark:text-blue-400" }), _jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900 dark:text-white mb-2", children: "Payment Terms Document" }), _jsx("p", { className: "text-gray-600 dark:text-gray-300", children: "Manage payment terms, milestones, and contract clauses" })] })] }), _jsxs("div", { className: `flex items-center gap-2 px-3 py-2 rounded-full font-medium ${getStatusColor(state.status)}`, children: [_jsx(Icon, { name: getStatusIcon(state.status), size: 16 }), state.status] })] }), _jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mt-6", children: [_jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-blue-600 dark:text-blue-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Payment Model" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.paymentModel.replace(/_/g, " ") })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-green-600 dark:text-green-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Currency" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.currency })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-yellow-600 dark:text-yellow-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Total Amount" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.totalAmount
|
|
48
48
|
? `${state.totalAmount.value} ${state.totalAmount.unit}`
|
|
49
49
|
: "Not set" })] }), _jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border border-gray-200 dark:border-gray-600", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Icon, { name: "BarChart", size: 16, className: "text-purple-600 dark:text-purple-400" }), _jsx("p", { className: "text-sm text-gray-600 dark:text-gray-300 font-medium", children: "Progress" })] }), _jsx("p", { className: "text-lg font-semibold dark:text-white", children: state.paymentModel === "MILESTONE"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PaymentTermsState } from "../../document-models/payment-terms/gen/schema/types.js";
|
|
2
|
+
import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
|
|
3
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
4
|
export interface EscrowTabProps {
|
|
3
5
|
state: PaymentTermsState;
|
|
4
|
-
dispatch: (action:
|
|
5
|
-
actions:
|
|
6
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
+
actions: typeof paymentTermsActions;
|
|
6
8
|
}
|
|
7
9
|
export declare function EscrowTab({ state, dispatch, actions }: EscrowTabProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
//# sourceMappingURL=escrow-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/escrow-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"escrow-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/escrow-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,cAAc,2CA4LrE"}
|
|
@@ -8,7 +8,7 @@ export function EscrowTab({ state, dispatch, actions }) {
|
|
|
8
8
|
amountHeld: state.escrowDetails?.amountHeld?.value?.toString() || "",
|
|
9
9
|
proofOfFundsDocumentId: state.escrowDetails?.proofOfFundsDocumentId || "",
|
|
10
10
|
releaseConditions: state.escrowDetails?.releaseConditions || "",
|
|
11
|
-
escrowProvider: state.escrowDetails?.escrowProvider || ""
|
|
11
|
+
escrowProvider: state.escrowDetails?.escrowProvider || "",
|
|
12
12
|
});
|
|
13
13
|
const handleSubmit = useCallback((e) => {
|
|
14
14
|
e.preventDefault();
|
|
@@ -27,11 +27,11 @@ export function EscrowTab({ state, dispatch, actions }) {
|
|
|
27
27
|
dispatch(actions.setEscrowDetails({
|
|
28
28
|
amountHeld: {
|
|
29
29
|
value: parseFloat(formData.amountHeld),
|
|
30
|
-
unit: state.currency
|
|
30
|
+
unit: state.currency,
|
|
31
31
|
},
|
|
32
32
|
proofOfFundsDocumentId: formData.proofOfFundsDocumentId || undefined,
|
|
33
33
|
releaseConditions: formData.releaseConditions,
|
|
34
|
-
escrowProvider: formData.escrowProvider || undefined
|
|
34
|
+
escrowProvider: formData.escrowProvider || undefined,
|
|
35
35
|
}));
|
|
36
36
|
toast("Escrow details saved", {
|
|
37
37
|
type: "success",
|
|
@@ -43,7 +43,7 @@ export function EscrowTab({ state, dispatch, actions }) {
|
|
|
43
43
|
amountHeld: state.escrowDetails?.amountHeld?.value?.toString() || "",
|
|
44
44
|
proofOfFundsDocumentId: state.escrowDetails?.proofOfFundsDocumentId || "",
|
|
45
45
|
releaseConditions: state.escrowDetails?.releaseConditions || "",
|
|
46
|
-
escrowProvider: state.escrowDetails?.escrowProvider || ""
|
|
46
|
+
escrowProvider: state.escrowDetails?.escrowProvider || "",
|
|
47
47
|
});
|
|
48
48
|
setIsEditing(false);
|
|
49
49
|
}, [state.escrowDetails]);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PaymentTermsState } from "../../document-models/payment-terms/gen/schema/types.js";
|
|
2
|
+
import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
|
|
3
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
4
|
export interface EvaluationTabProps {
|
|
3
5
|
state: PaymentTermsState;
|
|
4
|
-
dispatch: (action:
|
|
5
|
-
actions:
|
|
6
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
+
actions: typeof paymentTermsActions;
|
|
6
8
|
}
|
|
7
9
|
export declare function EvaluationTab({ state, dispatch, actions }: EvaluationTabProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
//# sourceMappingURL=evaluation-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/evaluation-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluation-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/evaluation-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,kBAAkB,2CA2N7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Milestone } from "../../document-models/payment-terms/gen/types.js";
|
|
1
|
+
import type { Milestone, PaymentTermsAction } from "../../document-models/payment-terms/gen/types.js";
|
|
2
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
3
|
export interface MilestonesTabProps {
|
|
3
4
|
milestones: Milestone[];
|
|
4
|
-
dispatch: (action:
|
|
5
|
-
actions:
|
|
5
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
6
|
+
actions: typeof paymentTermsActions;
|
|
6
7
|
currency: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function MilestonesTab({ milestones, dispatch, actions, currency }: MilestonesTabProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function MilestonesTab({ milestones, dispatch, actions, currency, }: MilestonesTabProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=milestones-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestones-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/milestones-tab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"milestones-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/milestones-tab.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EAET,kBAAkB,EACnB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAgB,GACjB,EAAE,kBAAkB,2CA+VpB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useMemo } from "react";
|
|
3
|
-
import { ObjectSetTable, TextInput, DatePicker } from "@powerhousedao/document-engineering";
|
|
3
|
+
import { ObjectSetTable, TextInput, DatePicker, } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { Button, Icon, toast } from "@powerhousedao/design-system";
|
|
5
5
|
import { generateId } from "document-model";
|
|
6
|
-
export function MilestonesTab({ milestones, dispatch, actions, currency = "USD" }) {
|
|
6
|
+
export function MilestonesTab({ milestones, dispatch, actions, currency = "USD", }) {
|
|
7
7
|
const [isAddingNew, setIsAddingNew] = useState(false);
|
|
8
8
|
const [newMilestone, setNewMilestone] = useState({
|
|
9
9
|
name: "",
|
|
10
10
|
amount: "",
|
|
11
11
|
expectedCompletionDate: "",
|
|
12
|
-
requiresApproval: true
|
|
12
|
+
requiresApproval: true,
|
|
13
13
|
});
|
|
14
14
|
const columns = useMemo(() => [
|
|
15
15
|
{
|
|
@@ -21,7 +21,7 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
21
21
|
if (newValue !== context.row.name) {
|
|
22
22
|
dispatch(actions.updateMilestone({
|
|
23
23
|
id: context.row.id,
|
|
24
|
-
name: newValue
|
|
24
|
+
name: newValue,
|
|
25
25
|
}));
|
|
26
26
|
toast("Milestone name updated", {
|
|
27
27
|
type: "success",
|
|
@@ -49,7 +49,7 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
49
49
|
}
|
|
50
50
|
dispatch(actions.updateMilestone({
|
|
51
51
|
id: context.row.id,
|
|
52
|
-
amount: { value: amount, unit: currency }
|
|
52
|
+
amount: { value: amount, unit: currency },
|
|
53
53
|
}));
|
|
54
54
|
toast("Milestone amount updated", {
|
|
55
55
|
type: "success",
|
|
@@ -69,7 +69,7 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
69
69
|
const dateValue = newValue;
|
|
70
70
|
dispatch(actions.updateMilestone({
|
|
71
71
|
id: context.row.id,
|
|
72
|
-
expectedCompletionDate: dateValue || undefined
|
|
72
|
+
expectedCompletionDate: dateValue || undefined,
|
|
73
73
|
}));
|
|
74
74
|
toast("Expected completion date updated", {
|
|
75
75
|
type: "success",
|
|
@@ -82,12 +82,12 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
82
82
|
title: "Requires Approval",
|
|
83
83
|
editable: true,
|
|
84
84
|
align: "center",
|
|
85
|
-
renderCell: (value) => value ? "Yes" : "No",
|
|
85
|
+
renderCell: (value) => (value ? "Yes" : "No"),
|
|
86
86
|
onSave: (newValue, context) => {
|
|
87
87
|
const approved = newValue === "true" || newValue === true;
|
|
88
88
|
dispatch(actions.updateMilestone({
|
|
89
89
|
id: context.row.id,
|
|
90
|
-
requiresApproval: approved
|
|
90
|
+
requiresApproval: approved,
|
|
91
91
|
}));
|
|
92
92
|
toast("Approval requirement updated", {
|
|
93
93
|
type: "success",
|
|
@@ -106,14 +106,14 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
106
106
|
READY_FOR_REVIEW: "Ready for Review",
|
|
107
107
|
APPROVED: "Approved",
|
|
108
108
|
PAID: "Paid",
|
|
109
|
-
REJECTED: "Rejected"
|
|
109
|
+
REJECTED: "Rejected",
|
|
110
110
|
};
|
|
111
111
|
return statusMap[value] || value;
|
|
112
112
|
},
|
|
113
113
|
onSave: (newValue, context) => {
|
|
114
|
-
dispatch(actions.
|
|
114
|
+
dispatch(actions.updateMilestoneStatus({
|
|
115
115
|
id: context.row.id,
|
|
116
|
-
payoutStatus: newValue
|
|
116
|
+
payoutStatus: newValue,
|
|
117
117
|
}));
|
|
118
118
|
toast("Milestone status updated", {
|
|
119
119
|
type: "success",
|
|
@@ -132,18 +132,18 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
132
132
|
type: "success",
|
|
133
133
|
});
|
|
134
134
|
}, size: "small", className: "text-red-600 hover:text-red-800", children: _jsx(Icon, { name: "Trash", size: 16 }) })),
|
|
135
|
-
}
|
|
135
|
+
},
|
|
136
136
|
], [actions, currency, dispatch]);
|
|
137
137
|
const handleAddMilestone = useCallback((e) => {
|
|
138
138
|
e.preventDefault();
|
|
139
139
|
if (!newMilestone.name.trim()) {
|
|
140
|
-
toast(
|
|
140
|
+
toast("Name is required", {
|
|
141
141
|
type: "error",
|
|
142
142
|
});
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (!newMilestone.amount || isNaN(parseFloat(newMilestone.amount))) {
|
|
146
|
-
toast(
|
|
146
|
+
toast("Valid amount is required", {
|
|
147
147
|
type: "error",
|
|
148
148
|
});
|
|
149
149
|
return;
|
|
@@ -153,9 +153,11 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
153
153
|
name: newMilestone.name,
|
|
154
154
|
amount: {
|
|
155
155
|
value: parseFloat(newMilestone.amount),
|
|
156
|
-
unit: currency
|
|
156
|
+
unit: currency,
|
|
157
157
|
},
|
|
158
|
-
requiresApproval: newMilestone.requiresApproval
|
|
158
|
+
requiresApproval: newMilestone.requiresApproval,
|
|
159
|
+
expectedCompletionDate: null,
|
|
160
|
+
payoutStatus: "PENDING",
|
|
159
161
|
};
|
|
160
162
|
if (newMilestone.expectedCompletionDate) {
|
|
161
163
|
milestoneData.expectedCompletionDate = new Date(newMilestone.expectedCompletionDate).toISOString();
|
|
@@ -169,20 +171,28 @@ export function MilestonesTab({ milestones, dispatch, actions, currency = "USD"
|
|
|
169
171
|
name: "",
|
|
170
172
|
amount: "",
|
|
171
173
|
expectedCompletionDate: "",
|
|
172
|
-
requiresApproval: true
|
|
174
|
+
requiresApproval: true,
|
|
173
175
|
});
|
|
174
176
|
setIsAddingNew(false);
|
|
175
177
|
}, [newMilestone, dispatch, actions, currency]);
|
|
176
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Milestones" }), _jsxs("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: [milestones.length, " milestone(s) defined"] })] }), _jsxs(Button, { onClick: () => setIsAddingNew(!isAddingNew), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: [_jsx(Icon, { name: "Plus", size: 16, className: "mr-2" }), "Add Milestone"] })] }), isAddingNew && (_jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border dark:border-gray-600", children: [_jsx("h3", { className: "text-lg font-medium mb-4 dark:text-white", children: "Add New Milestone" }), _jsxs("form", { onSubmit: handleAddMilestone, className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx(TextInput, { label: "Name *", value: newMilestone.name, onChange: (e) => setNewMilestone({ ...newMilestone, name: e.target.value }), className: "w-full", required: true }), _jsx(TextInput, { label: `Amount (${currency}) *`, type: "number", value: newMilestone.amount, onChange: (e) => setNewMilestone({ ...newMilestone, amount: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(DatePicker, { value: newMilestone.expectedCompletionDate
|
|
178
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-xl font-semibold dark:text-white", children: "Milestones" }), _jsxs("p", { className: "text-sm text-gray-600 dark:text-gray-300 mt-1", children: [milestones.length, " milestone(s) defined"] })] }), _jsxs(Button, { onClick: () => setIsAddingNew(!isAddingNew), color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: [_jsx(Icon, { name: "Plus", size: 16, className: "mr-2" }), "Add Milestone"] })] }), isAddingNew && (_jsxs("div", { className: "bg-gray-50 dark:bg-gray-700 p-4 rounded-lg border dark:border-gray-600", children: [_jsx("h3", { className: "text-lg font-medium mb-4 dark:text-white", children: "Add New Milestone" }), _jsxs("form", { onSubmit: handleAddMilestone, className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx(TextInput, { label: "Name *", value: newMilestone.name, onChange: (e) => setNewMilestone({ ...newMilestone, name: e.target.value }), className: "w-full", required: true }), _jsx(TextInput, { label: `Amount (${currency}) *`, type: "number", value: newMilestone.amount, onChange: (e) => setNewMilestone({ ...newMilestone, amount: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(DatePicker, { value: newMilestone.expectedCompletionDate
|
|
179
|
+
? new Date(newMilestone.expectedCompletionDate)
|
|
180
|
+
: undefined, onChange: (e) => {
|
|
177
181
|
const date = e.target.value ? new Date(e.target.value) : null;
|
|
178
|
-
setNewMilestone({
|
|
179
|
-
|
|
182
|
+
setNewMilestone({
|
|
183
|
+
...newMilestone,
|
|
184
|
+
expectedCompletionDate: date?.toISOString() || "",
|
|
185
|
+
});
|
|
186
|
+
}, name: "expected-completion-date", placeholder: "Select expected completion date" }), _jsxs("div", { className: "flex items-center pt-6", children: [_jsx("input", { type: "checkbox", id: "requiresApproval", checked: newMilestone.requiresApproval, onChange: (e) => setNewMilestone({
|
|
187
|
+
...newMilestone,
|
|
188
|
+
requiresApproval: e.target.checked,
|
|
189
|
+
}), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "requiresApproval", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Requires Approval" })] })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "small", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Add Milestone" }), _jsx(Button, { type: "button", onClick: () => {
|
|
180
190
|
setIsAddingNew(false);
|
|
181
191
|
setNewMilestone({
|
|
182
192
|
name: "",
|
|
183
193
|
amount: "",
|
|
184
194
|
expectedCompletionDate: "",
|
|
185
|
-
requiresApproval: true
|
|
195
|
+
requiresApproval: true,
|
|
186
196
|
});
|
|
187
197
|
}, color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] })] })), milestones.length > 0 ? (_jsx(ObjectSetTable, { data: milestones, columns: columns, onAdd: () => setIsAddingNew(true), onDelete: (row) => {
|
|
188
198
|
dispatch(actions.deleteMilestone({ id: row.id }));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PaymentTermsState } from "../../document-models/payment-terms/gen/schema/types.js";
|
|
2
|
+
import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
|
|
3
|
+
import { actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
2
4
|
export interface RetainerTabProps {
|
|
3
5
|
state: PaymentTermsState;
|
|
4
|
-
dispatch: (action:
|
|
5
|
-
actions:
|
|
6
|
+
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
+
actions: typeof paymentTermsActions;
|
|
6
8
|
}
|
|
7
9
|
export declare function RetainerTab({ state, dispatch, actions }: RetainerTabProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
//# sourceMappingURL=retainer-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retainer-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/retainer-tab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retainer-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/retainer-tab.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,gBAAgB,2CA+RzE"}
|