@powerhousedao/network-admin 0.0.52 → 0.0.53
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/style.css +27 -0
- package/dist/subgraphs/workstreams/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/workstreams/resolvers.js +21 -5
- package/dist/subgraphs/workstreams/schema.d.ts.map +1 -1
- package/dist/subgraphs/workstreams/schema.js +1 -0
- package/package.json +2 -2
- package/dist/editors/payment-terms/basic-terms-tab.d.ts +0 -10
- package/dist/editors/payment-terms/basic-terms-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/basic-terms-tab.js +0 -89
- package/dist/editors/payment-terms/clauses-tab.d.ts +0 -12
- package/dist/editors/payment-terms/clauses-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/clauses-tab.js +0 -214
- package/dist/editors/payment-terms/components/EditName.d.ts +0 -3
- package/dist/editors/payment-terms/components/EditName.d.ts.map +0 -1
- package/dist/editors/payment-terms/components/EditName.js +0 -31
- package/dist/editors/payment-terms/components/styles.d.ts +0 -2
- package/dist/editors/payment-terms/components/styles.d.ts.map +0 -1
- package/dist/editors/payment-terms/components/styles.js +0 -741
- package/dist/editors/payment-terms/cost-materials-tab.d.ts +0 -10
- package/dist/editors/payment-terms/cost-materials-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/cost-materials-tab.js +0 -63
- package/dist/editors/payment-terms/escrow-tab.d.ts +0 -10
- package/dist/editors/payment-terms/escrow-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/escrow-tab.js +0 -57
- package/dist/editors/payment-terms/evaluation-tab.d.ts +0 -10
- package/dist/editors/payment-terms/evaluation-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/evaluation-tab.js +0 -72
- package/dist/editors/payment-terms/milestones-tab.d.ts +0 -10
- package/dist/editors/payment-terms/milestones-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/milestones-tab.js +0 -214
- package/dist/editors/payment-terms/retainer-tab.d.ts +0 -10
- package/dist/editors/payment-terms/retainer-tab.d.ts.map +0 -1
- package/dist/editors/payment-terms/retainer-tab.js +0 -69
|
@@ -1,10 +0,0 @@
|
|
|
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 { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
4
|
-
export interface CostMaterialsTabProps {
|
|
5
|
-
state: PaymentTermsState;
|
|
6
|
-
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
-
actions: typeof paymentTermsActions;
|
|
8
|
-
}
|
|
9
|
-
export declare function CostMaterialsTab({ state, dispatch, actions, }: CostMaterialsTabProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=cost-materials-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,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"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
3
|
-
import { TextInput, Select, Button } from "@powerhousedao/document-engineering";
|
|
4
|
-
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import {} from "../../document-models/payment-terms/index.js";
|
|
6
|
-
export function CostMaterialsTab({ state, dispatch, actions, }) {
|
|
7
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
8
|
-
const [formData, setFormData] = useState({
|
|
9
|
-
hourlyRate: state.timeAndMaterials?.hourlyRate?.value?.toString() || "",
|
|
10
|
-
variableCap: state.timeAndMaterials?.variableCap?.value?.toString() || "",
|
|
11
|
-
billingFrequency: state.timeAndMaterials?.billingFrequency || "MONTHLY",
|
|
12
|
-
timesheetRequired: state.timeAndMaterials?.timesheetRequired || false,
|
|
13
|
-
});
|
|
14
|
-
const handleSubmit = useCallback((e) => {
|
|
15
|
-
e.preventDefault();
|
|
16
|
-
dispatch(actions.setTimeAndMaterials({
|
|
17
|
-
hourlyRate: formData.hourlyRate
|
|
18
|
-
? {
|
|
19
|
-
value: parseFloat(formData.hourlyRate),
|
|
20
|
-
unit: state.currency,
|
|
21
|
-
}
|
|
22
|
-
: undefined,
|
|
23
|
-
variableCap: formData.variableCap
|
|
24
|
-
? {
|
|
25
|
-
value: parseFloat(formData.variableCap),
|
|
26
|
-
unit: state.currency,
|
|
27
|
-
}
|
|
28
|
-
: undefined,
|
|
29
|
-
billingFrequency: formData.billingFrequency,
|
|
30
|
-
timesheetRequired: formData.timesheetRequired,
|
|
31
|
-
}));
|
|
32
|
-
toast("Cost & Materials configuration saved", {
|
|
33
|
-
type: "success",
|
|
34
|
-
});
|
|
35
|
-
setIsEditing(false);
|
|
36
|
-
}, [formData, dispatch, actions, state.currency]);
|
|
37
|
-
const handleCancel = useCallback(() => {
|
|
38
|
-
setFormData({
|
|
39
|
-
hourlyRate: state.timeAndMaterials?.hourlyRate?.value?.toString() || "",
|
|
40
|
-
variableCap: state.timeAndMaterials?.variableCap?.value?.toString() || "",
|
|
41
|
-
billingFrequency: state.timeAndMaterials?.billingFrequency || "MONTHLY",
|
|
42
|
-
timesheetRequired: state.timeAndMaterials?.timesheetRequired || false,
|
|
43
|
-
});
|
|
44
|
-
setIsEditing(false);
|
|
45
|
-
}, [state.timeAndMaterials]);
|
|
46
|
-
if (!isEditing) {
|
|
47
|
-
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: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.timeAndMaterials
|
|
48
|
-
? "Edit Configuration"
|
|
49
|
-
: "Configure Cost & Materials" })] }), state.timeAndMaterials ? (_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.timeAndMaterials.hourlyRate
|
|
50
|
-
? `${state.timeAndMaterials.hourlyRate.value} ${state.timeAndMaterials.hourlyRate.unit}`
|
|
51
|
-
: "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.timeAndMaterials.variableCap
|
|
52
|
-
? `${state.timeAndMaterials.variableCap.value} ${state.timeAndMaterials.variableCap.unit}`
|
|
53
|
-
: "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.timeAndMaterials.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.timeAndMaterials.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." })] }))] }));
|
|
54
|
-
}
|
|
55
|
-
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({
|
|
56
|
-
...formData,
|
|
57
|
-
billingFrequency: value,
|
|
58
|
-
}), options: [
|
|
59
|
-
{ value: "WEEKLY", label: "Weekly" },
|
|
60
|
-
{ value: "BIWEEKLY", label: "Biweekly" },
|
|
61
|
-
{ value: "MONTHLY", label: "Monthly" },
|
|
62
|
-
], 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: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Configuration" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "sm", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
|
|
63
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
4
|
-
export interface EscrowTabProps {
|
|
5
|
-
state: PaymentTermsState;
|
|
6
|
-
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
-
actions: typeof paymentTermsActions;
|
|
8
|
-
}
|
|
9
|
-
export declare function EscrowTab({ state, dispatch, actions }: EscrowTabProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=escrow-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"escrow-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/escrow-tab.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,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"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
3
|
-
import { TextInput, Textarea, Button, } from "@powerhousedao/document-engineering";
|
|
4
|
-
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import {} from "../../document-models/payment-terms/index.js";
|
|
6
|
-
export function EscrowTab({ state, dispatch, actions }) {
|
|
7
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
8
|
-
const [formData, setFormData] = useState({
|
|
9
|
-
amountHeld: state.escrowDetails?.amountHeld?.value?.toString() || "",
|
|
10
|
-
proofOfFundsDocumentId: state.escrowDetails?.proofOfFundsDocumentId || "",
|
|
11
|
-
releaseConditions: state.escrowDetails?.releaseConditions || "",
|
|
12
|
-
escrowProvider: state.escrowDetails?.escrowProvider || "",
|
|
13
|
-
});
|
|
14
|
-
const handleSubmit = useCallback((e) => {
|
|
15
|
-
e.preventDefault();
|
|
16
|
-
if (!formData.amountHeld || isNaN(parseFloat(formData.amountHeld))) {
|
|
17
|
-
toast("Please enter a valid amount to be held in escrow", {
|
|
18
|
-
type: "error",
|
|
19
|
-
});
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!formData.releaseConditions.trim()) {
|
|
23
|
-
toast("Release conditions are required", {
|
|
24
|
-
type: "error",
|
|
25
|
-
});
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
dispatch(actions.setEscrowDetails({
|
|
29
|
-
amountHeld: {
|
|
30
|
-
value: parseFloat(formData.amountHeld),
|
|
31
|
-
unit: state.currency,
|
|
32
|
-
},
|
|
33
|
-
proofOfFundsDocumentId: formData.proofOfFundsDocumentId || undefined,
|
|
34
|
-
releaseConditions: formData.releaseConditions,
|
|
35
|
-
escrowProvider: formData.escrowProvider || undefined,
|
|
36
|
-
}));
|
|
37
|
-
toast("Escrow details saved", {
|
|
38
|
-
type: "success",
|
|
39
|
-
});
|
|
40
|
-
setIsEditing(false);
|
|
41
|
-
}, [formData, dispatch, actions, state.currency]);
|
|
42
|
-
const handleCancel = useCallback(() => {
|
|
43
|
-
setFormData({
|
|
44
|
-
amountHeld: state.escrowDetails?.amountHeld?.value?.toString() || "",
|
|
45
|
-
proofOfFundsDocumentId: state.escrowDetails?.proofOfFundsDocumentId || "",
|
|
46
|
-
releaseConditions: state.escrowDetails?.releaseConditions || "",
|
|
47
|
-
escrowProvider: state.escrowDetails?.escrowProvider || "",
|
|
48
|
-
});
|
|
49
|
-
setIsEditing(false);
|
|
50
|
-
}, [state.escrowDetails]);
|
|
51
|
-
if (!isEditing) {
|
|
52
|
-
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: "Escrow Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.escrowDetails ? "Edit Escrow" : "Configure Escrow" })] }), state.escrowDetails && state.escrowDetails.releaseConditions ? (_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: "Amount Held" }), _jsx("p", { className: "text-lg dark:text-white", children: state.escrowDetails.amountHeld
|
|
53
|
-
? `${state.escrowDetails.amountHeld.value} ${state.escrowDetails.amountHeld.unit}`
|
|
54
|
-
: "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Escrow Provider" }), _jsx("p", { className: "text-lg dark:text-white", children: state.escrowDetails.escrowProvider || "Not specified" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Proof of Funds Document ID" }), _jsx("p", { className: "text-lg font-mono text-sm dark:text-white", children: state.escrowDetails.proofOfFundsDocumentId || "Not provided" })] }), _jsxs("div", { className: "col-span-1", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Release Conditions" }), _jsx("div", { className: "bg-gray-50 dark:bg-gray-700 p-3 rounded border dark:border-gray-600", children: _jsx("p", { className: "text-sm dark:text-white", children: state.escrowDetails.releaseConditions }) })] })] })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [_jsx("p", { children: "No escrow configuration set up yet." }), _jsx("p", { className: "text-sm", children: "Click \"Configure Escrow\" to get started." })] }))] }));
|
|
55
|
-
}
|
|
56
|
-
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 Escrow" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsx(TextInput, { label: `Amount Held (${state.currency}) *`, type: "number", value: formData.amountHeld, onChange: (e) => setFormData({ ...formData, amountHeld: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(TextInput, { label: "Escrow Provider", value: formData.escrowProvider, onChange: (e) => setFormData({ ...formData, escrowProvider: e.target.value }), className: "w-full", placeholder: "e.g., Escrow.com" }), _jsx(TextInput, { label: "Proof of Funds Document ID", value: formData.proofOfFundsDocumentId, onChange: (e) => setFormData({ ...formData, proofOfFundsDocumentId: e.target.value }), className: "w-full", placeholder: "Document reference ID" }), _jsx("div", { className: "col-span-1", children: _jsx(Textarea, { label: "Release Conditions *", value: formData.releaseConditions, onChange: (e) => setFormData({ ...formData, releaseConditions: e.target.value }), className: "w-full", rows: 4, placeholder: "Describe the conditions for releasing escrow funds...", required: true }) })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", children: "Save Escrow Details" }), _jsx(Button, { type: "button", onClick: handleCancel, children: "Cancel" })] })] }));
|
|
57
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
4
|
-
export interface EvaluationTabProps {
|
|
5
|
-
state: PaymentTermsState;
|
|
6
|
-
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
-
actions: typeof paymentTermsActions;
|
|
8
|
-
}
|
|
9
|
-
export declare function EvaluationTab({ state, dispatch, actions, }: EvaluationTabProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=evaluation-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/evaluation-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,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,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,EAC5B,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,kBAAkB,2CAgSpB"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useMemo } from "react";
|
|
3
|
-
import { TextInput, Select, Textarea, Button, } from "@powerhousedao/document-engineering";
|
|
4
|
-
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import {} from "../../document-models/payment-terms/index.js";
|
|
6
|
-
export function EvaluationTab({ state, dispatch, actions, }) {
|
|
7
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
8
|
-
const [formData, setFormData] = useState({
|
|
9
|
-
evaluationFrequency: state.evaluation?.evaluationFrequency || "MONTHLY",
|
|
10
|
-
evaluatorTeam: state.evaluation?.evaluatorTeam || "",
|
|
11
|
-
criteria: state.evaluation?.criteria?.join("\n") || "",
|
|
12
|
-
impactsPayout: state.evaluation?.impactsPayout || false,
|
|
13
|
-
impactsReputation: state.evaluation?.impactsReputation || false,
|
|
14
|
-
commentsVisibleToClient: state.evaluation?.commentsVisibleToClient || false,
|
|
15
|
-
});
|
|
16
|
-
const evaluationFrequencyOptions = useMemo(() => [
|
|
17
|
-
{ label: "Weekly", value: "WEEKLY" },
|
|
18
|
-
{ label: "Monthly", value: "MONTHLY" },
|
|
19
|
-
{ label: "Per Milestone", value: "PER_MILESTONE" },
|
|
20
|
-
], []);
|
|
21
|
-
const handleSubmit = useCallback((e) => {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
if (!formData.evaluatorTeam.trim()) {
|
|
24
|
-
toast("Evaluator team is required", {
|
|
25
|
-
type: "error",
|
|
26
|
-
});
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!formData.criteria.trim()) {
|
|
30
|
-
toast("Evaluation criteria are required", {
|
|
31
|
-
type: "error",
|
|
32
|
-
});
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
dispatch(actions.setEvaluationTerms({
|
|
36
|
-
evaluationFrequency: formData.evaluationFrequency,
|
|
37
|
-
evaluatorTeam: formData.evaluatorTeam,
|
|
38
|
-
criteria: formData.criteria.split("\n").filter((c) => c.trim()),
|
|
39
|
-
impactsPayout: formData.impactsPayout,
|
|
40
|
-
impactsReputation: formData.impactsReputation,
|
|
41
|
-
commentsVisibleToClient: formData.commentsVisibleToClient,
|
|
42
|
-
}));
|
|
43
|
-
toast("Evaluation terms saved", {
|
|
44
|
-
type: "success",
|
|
45
|
-
});
|
|
46
|
-
setIsEditing(false);
|
|
47
|
-
}, [formData, dispatch, actions]);
|
|
48
|
-
const handleCancel = useCallback(() => {
|
|
49
|
-
setFormData({
|
|
50
|
-
evaluationFrequency: state.evaluation?.evaluationFrequency || "MONTHLY",
|
|
51
|
-
evaluatorTeam: state.evaluation?.evaluatorTeam || "",
|
|
52
|
-
criteria: state.evaluation?.criteria?.join("\n") || "",
|
|
53
|
-
impactsPayout: state.evaluation?.impactsPayout || false,
|
|
54
|
-
impactsReputation: state.evaluation?.impactsReputation || false,
|
|
55
|
-
commentsVisibleToClient: state.evaluation?.commentsVisibleToClient || false,
|
|
56
|
-
});
|
|
57
|
-
setIsEditing(false);
|
|
58
|
-
}, [state.evaluation]);
|
|
59
|
-
if (!isEditing) {
|
|
60
|
-
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: "Evaluation Terms" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.evaluation ? "Edit Terms" : "Configure Evaluation" })] }), state.evaluation ? (_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: "Evaluation Frequency" }), _jsx("p", { className: "text-lg dark:text-white", children: state.evaluation.evaluationFrequency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Evaluator Team" }), _jsx("p", { className: "text-lg dark:text-white", children: state.evaluation.evaluatorTeam })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Impacts Payout" }), _jsx("p", { className: "text-lg dark:text-white", children: state.evaluation.impactsPayout ? "Yes" : "No" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Impacts Reputation" }), _jsx("p", { className: "text-lg dark:text-white", children: state.evaluation.impactsReputation ? "Yes" : "No" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Comments Visible to Client" }), _jsx("p", { className: "text-lg dark:text-white", children: state.evaluation.commentsVisibleToClient ? "Yes" : "No" })] }), _jsxs("div", { className: "col-span-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Evaluation Criteria" }), _jsx("div", { className: "bg-gray-50 dark:bg-gray-700 p-3 rounded border dark:border-gray-600", children: _jsx("ul", { className: "list-disc list-inside text-sm space-y-1", children: state.evaluation.criteria.map((criterion, index) => (_jsx("li", { children: criterion }, index))) }) })] })] })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [_jsx("p", { children: "No evaluation terms configured yet." }), _jsx("p", { className: "text-sm", children: "Click \"Configure Evaluation\" to get started." })] }))] }));
|
|
61
|
-
}
|
|
62
|
-
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 Evaluation Terms" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsx(Select, { label: "Evaluation Frequency *", options: evaluationFrequencyOptions, value: formData.evaluationFrequency, onChange: (value) => setFormData({
|
|
63
|
-
...formData,
|
|
64
|
-
evaluationFrequency: value,
|
|
65
|
-
}) }), _jsx(TextInput, { label: "Evaluator Team *", value: formData.evaluatorTeam, onChange: (e) => setFormData({ ...formData, evaluatorTeam: e.target.value }), className: "w-full", placeholder: "e.g., Product Team", required: true }), _jsx("div", { className: "col-span-2", children: _jsx(Textarea, { label: "Evaluation Criteria * (one per line)", value: formData.criteria, onChange: (e) => setFormData({ ...formData, criteria: e.target.value }), className: "w-full", rows: 6, placeholder: "Enter each evaluation criterion on a separate line...", required: true }) }), _jsxs("div", { className: "col-span-2 space-y-4", children: [_jsx("h3", { className: "text-lg font-medium dark:text-white", children: "Impact Settings" }), _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "impactsPayout", checked: formData.impactsPayout, onChange: (e) => setFormData({ ...formData, impactsPayout: e.target.checked }), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "impactsPayout", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Evaluation results impact payout" })] }), _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "impactsReputation", checked: formData.impactsReputation, onChange: (e) => setFormData({
|
|
66
|
-
...formData,
|
|
67
|
-
impactsReputation: e.target.checked,
|
|
68
|
-
}), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "impactsReputation", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Evaluation results impact reputation" })] }), _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "commentsVisibleToClient", checked: formData.commentsVisibleToClient, onChange: (e) => setFormData({
|
|
69
|
-
...formData,
|
|
70
|
-
commentsVisibleToClient: e.target.checked,
|
|
71
|
-
}), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "commentsVisibleToClient", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Evaluation comments visible to client" })] })] })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Evaluation Terms" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "sm", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
|
|
72
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Milestone, PaymentTermsAction } from "../../document-models/payment-terms/gen/types.js";
|
|
2
|
-
import { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
3
|
-
export interface MilestonesTabProps {
|
|
4
|
-
milestones: Milestone[];
|
|
5
|
-
dispatch: (action: PaymentTermsAction) => void;
|
|
6
|
-
actions: typeof paymentTermsActions;
|
|
7
|
-
currency: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function MilestonesTab({ milestones, dispatch, actions, currency, }: MilestonesTabProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=milestones-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"milestones-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/milestones-tab.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,SAAS,EAET,kBAAkB,EACnB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,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,2CAuWpB"}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useMemo } from "react";
|
|
3
|
-
import { ObjectSetTable, TextInput, DatePicker, } from "@powerhousedao/document-engineering";
|
|
4
|
-
import { Button, } from "@powerhousedao/document-engineering";
|
|
5
|
-
import { Icon } from "@powerhousedao/document-engineering";
|
|
6
|
-
import { toast } from "@powerhousedao/design-system/connect";
|
|
7
|
-
import { generateId } from "document-model/core";
|
|
8
|
-
import {} from "../../document-models/payment-terms/index.js";
|
|
9
|
-
export function MilestonesTab({ milestones, dispatch, actions, currency = "USD", }) {
|
|
10
|
-
const [isAddingNew, setIsAddingNew] = useState(false);
|
|
11
|
-
const [newMilestone, setNewMilestone] = useState({
|
|
12
|
-
name: "",
|
|
13
|
-
amount: "",
|
|
14
|
-
expectedCompletionDate: "",
|
|
15
|
-
requiresApproval: true,
|
|
16
|
-
});
|
|
17
|
-
const columns = useMemo(() => [
|
|
18
|
-
{
|
|
19
|
-
field: "name",
|
|
20
|
-
title: "Name",
|
|
21
|
-
editable: true,
|
|
22
|
-
align: "left",
|
|
23
|
-
onSave: (newValue, context) => {
|
|
24
|
-
if (newValue !== context.row.name) {
|
|
25
|
-
dispatch(actions.updateMilestone({
|
|
26
|
-
id: context.row.id,
|
|
27
|
-
name: newValue,
|
|
28
|
-
}));
|
|
29
|
-
toast("Milestone name updated", {
|
|
30
|
-
type: "success",
|
|
31
|
-
});
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
field: "amount",
|
|
39
|
-
title: `Amount (${currency})`,
|
|
40
|
-
editable: true,
|
|
41
|
-
align: "right",
|
|
42
|
-
renderCell: (value) => {
|
|
43
|
-
return value ? `${value.value} ${value.unit}` : "";
|
|
44
|
-
},
|
|
45
|
-
onSave: (newValue, context) => {
|
|
46
|
-
const amount = parseFloat(newValue);
|
|
47
|
-
if (isNaN(amount)) {
|
|
48
|
-
toast("Please enter a valid amount", {
|
|
49
|
-
type: "error",
|
|
50
|
-
});
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
dispatch(actions.updateMilestone({
|
|
54
|
-
id: context.row.id,
|
|
55
|
-
amount: { value: amount, unit: currency },
|
|
56
|
-
}));
|
|
57
|
-
toast("Milestone amount updated", {
|
|
58
|
-
type: "success",
|
|
59
|
-
});
|
|
60
|
-
return true;
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
field: "expectedCompletionDate",
|
|
65
|
-
title: "Expected Completion",
|
|
66
|
-
editable: true,
|
|
67
|
-
align: "center",
|
|
68
|
-
renderCell: (value) => {
|
|
69
|
-
if (value === undefined)
|
|
70
|
-
return "";
|
|
71
|
-
return value ? new Date(value).toLocaleDateString() : "Not set";
|
|
72
|
-
},
|
|
73
|
-
onSave: (newValue, context) => {
|
|
74
|
-
const dateValue = newValue;
|
|
75
|
-
dispatch(actions.updateMilestone({
|
|
76
|
-
id: context.row.id,
|
|
77
|
-
expectedCompletionDate: dateValue || undefined,
|
|
78
|
-
}));
|
|
79
|
-
toast("Expected completion date updated", {
|
|
80
|
-
type: "success",
|
|
81
|
-
});
|
|
82
|
-
return true;
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
field: "requiresApproval",
|
|
87
|
-
title: "Requires Approval",
|
|
88
|
-
editable: true,
|
|
89
|
-
align: "center",
|
|
90
|
-
renderCell: (value) => {
|
|
91
|
-
if (value === undefined)
|
|
92
|
-
return "";
|
|
93
|
-
return value ? "Yes" : "No";
|
|
94
|
-
},
|
|
95
|
-
onSave: (newValue, context) => {
|
|
96
|
-
const approved = newValue === "true" || newValue === true;
|
|
97
|
-
dispatch(actions.updateMilestone({
|
|
98
|
-
id: context.row.id,
|
|
99
|
-
requiresApproval: approved,
|
|
100
|
-
}));
|
|
101
|
-
toast("Approval requirement updated", {
|
|
102
|
-
type: "success",
|
|
103
|
-
});
|
|
104
|
-
return true;
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
field: "payoutStatus",
|
|
109
|
-
title: "Status",
|
|
110
|
-
editable: true,
|
|
111
|
-
align: "center",
|
|
112
|
-
renderCell: (value) => {
|
|
113
|
-
if (!value)
|
|
114
|
-
return "";
|
|
115
|
-
const statusMap = {
|
|
116
|
-
PENDING: "Pending",
|
|
117
|
-
READY_FOR_REVIEW: "Ready for Review",
|
|
118
|
-
APPROVED: "Approved",
|
|
119
|
-
PAID: "Paid",
|
|
120
|
-
REJECTED: "Rejected",
|
|
121
|
-
};
|
|
122
|
-
return statusMap[value] || value;
|
|
123
|
-
},
|
|
124
|
-
onSave: (newValue, context) => {
|
|
125
|
-
dispatch(actions.updateMilestoneStatus({
|
|
126
|
-
id: context.row.id,
|
|
127
|
-
payoutStatus: newValue,
|
|
128
|
-
}));
|
|
129
|
-
toast("Milestone status updated", {
|
|
130
|
-
type: "success",
|
|
131
|
-
});
|
|
132
|
-
return true;
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
field: "actions",
|
|
137
|
-
title: "Actions",
|
|
138
|
-
editable: false,
|
|
139
|
-
align: "center",
|
|
140
|
-
renderCell: (_, context) => (_jsx(Button, { onClick: () => {
|
|
141
|
-
dispatch(actions.deleteMilestone({ id: context.row.id }));
|
|
142
|
-
toast("Milestone deleted", {
|
|
143
|
-
type: "success",
|
|
144
|
-
});
|
|
145
|
-
}, size: "sm", className: "text-red-600 hover:text-red-800", children: _jsx(Icon, { name: "Trash", size: 16 }) })),
|
|
146
|
-
},
|
|
147
|
-
], [actions, currency, dispatch]);
|
|
148
|
-
const handleAddMilestone = useCallback((e) => {
|
|
149
|
-
e.preventDefault();
|
|
150
|
-
if (!newMilestone.name.trim()) {
|
|
151
|
-
toast("Name is required", {
|
|
152
|
-
type: "error",
|
|
153
|
-
});
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (!newMilestone.amount || isNaN(parseFloat(newMilestone.amount))) {
|
|
157
|
-
toast("Valid amount is required", {
|
|
158
|
-
type: "error",
|
|
159
|
-
});
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const milestoneData = {
|
|
163
|
-
id: generateId(),
|
|
164
|
-
name: newMilestone.name,
|
|
165
|
-
amount: {
|
|
166
|
-
value: parseFloat(newMilestone.amount),
|
|
167
|
-
unit: currency,
|
|
168
|
-
},
|
|
169
|
-
requiresApproval: newMilestone.requiresApproval,
|
|
170
|
-
expectedCompletionDate: null,
|
|
171
|
-
payoutStatus: "PENDING",
|
|
172
|
-
};
|
|
173
|
-
if (newMilestone.expectedCompletionDate) {
|
|
174
|
-
milestoneData.expectedCompletionDate = new Date(newMilestone.expectedCompletionDate).toISOString();
|
|
175
|
-
}
|
|
176
|
-
dispatch(actions.addMilestone(milestoneData));
|
|
177
|
-
toast("Milestone added successfully", {
|
|
178
|
-
type: "success",
|
|
179
|
-
});
|
|
180
|
-
// Reset form and close edit section
|
|
181
|
-
setNewMilestone({
|
|
182
|
-
name: "",
|
|
183
|
-
amount: "",
|
|
184
|
-
expectedCompletionDate: "",
|
|
185
|
-
requiresApproval: true,
|
|
186
|
-
});
|
|
187
|
-
setIsAddingNew(false);
|
|
188
|
-
}, [newMilestone, dispatch, actions, currency]);
|
|
189
|
-
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: "sm", 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, { className: "bg-white", value: newMilestone.expectedCompletionDate
|
|
190
|
-
? new Date(newMilestone.expectedCompletionDate)
|
|
191
|
-
: undefined, onChange: (e) => {
|
|
192
|
-
const date = e.target.value ? new Date(e.target.value) : null;
|
|
193
|
-
setNewMilestone({
|
|
194
|
-
...newMilestone,
|
|
195
|
-
expectedCompletionDate: date?.toISOString() || "",
|
|
196
|
-
});
|
|
197
|
-
}, 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({
|
|
198
|
-
...newMilestone,
|
|
199
|
-
requiresApproval: e.target.checked,
|
|
200
|
-
}), 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: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Add Milestone" }), _jsx(Button, { type: "button", onClick: () => {
|
|
201
|
-
setIsAddingNew(false);
|
|
202
|
-
setNewMilestone({
|
|
203
|
-
name: "",
|
|
204
|
-
amount: "",
|
|
205
|
-
expectedCompletionDate: "",
|
|
206
|
-
requiresApproval: true,
|
|
207
|
-
});
|
|
208
|
-
}, color: "light", size: "sm", 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) => {
|
|
209
|
-
dispatch(actions.deleteMilestone({ id: row.id }));
|
|
210
|
-
toast("Milestone deleted", {
|
|
211
|
-
type: "success",
|
|
212
|
-
});
|
|
213
|
-
} })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg", children: [_jsx(Icon, { name: "Calendar", size: 48, className: "mx-auto mb-4 text-gray-400" }), _jsx("p", { className: "text-lg font-medium", children: "No milestones defined yet" }), _jsx("p", { className: "text-sm", children: "Add your first milestone to get started" })] }))] }));
|
|
214
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
|
|
4
|
-
export interface RetainerTabProps {
|
|
5
|
-
state: PaymentTermsState;
|
|
6
|
-
dispatch: (action: PaymentTermsAction) => void;
|
|
7
|
-
actions: typeof paymentTermsActions;
|
|
8
|
-
}
|
|
9
|
-
export declare function RetainerTab({ state, dispatch, actions }: RetainerTabProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=retainer-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retainer-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/retainer-tab.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,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,2CAyQzE"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useMemo } from "react";
|
|
3
|
-
import { TextInput, Select, Textarea, DatePicker, Button, } from "@powerhousedao/document-engineering";
|
|
4
|
-
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import {} from "../../document-models/payment-terms/index.js";
|
|
6
|
-
export function RetainerTab({ state, dispatch, actions }) {
|
|
7
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
8
|
-
const [formData, setFormData] = useState({
|
|
9
|
-
retainerAmount: state.timeAndMaterials?.retainerAmount?.value?.toString() || "",
|
|
10
|
-
billingFrequency: state.timeAndMaterials?.billingFrequency || "MONTHLY",
|
|
11
|
-
timesheetRequired: state.timeAndMaterials?.timesheetRequired || false,
|
|
12
|
-
});
|
|
13
|
-
const billingFrequencyOptions = useMemo(() => [
|
|
14
|
-
{ label: "Weekly", value: "WEEKLY" },
|
|
15
|
-
{ label: "Biweekly", value: "BIWEEKLY" },
|
|
16
|
-
{ label: "Monthly", value: "MONTHLY" },
|
|
17
|
-
], []);
|
|
18
|
-
const handleSubmit = useCallback((e) => {
|
|
19
|
-
e.preventDefault();
|
|
20
|
-
if (!formData.retainerAmount ||
|
|
21
|
-
isNaN(parseFloat(formData.retainerAmount))) {
|
|
22
|
-
toast("Please enter a valid retainer amount", {
|
|
23
|
-
type: "error",
|
|
24
|
-
});
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (!formData.timesheetRequired) {
|
|
28
|
-
toast("Start date is required", {
|
|
29
|
-
type: "error",
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
dispatch(actions.setTimeAndMaterials({
|
|
34
|
-
retainerAmount: {
|
|
35
|
-
value: parseFloat(formData.retainerAmount),
|
|
36
|
-
unit: state.currency,
|
|
37
|
-
},
|
|
38
|
-
billingFrequency: formData.billingFrequency,
|
|
39
|
-
timesheetRequired: formData.timesheetRequired,
|
|
40
|
-
}));
|
|
41
|
-
toast("Retainer configuration saved", {
|
|
42
|
-
type: "success",
|
|
43
|
-
});
|
|
44
|
-
setIsEditing(false);
|
|
45
|
-
}, [formData, dispatch, actions, state.currency]);
|
|
46
|
-
const handleCancel = useCallback(() => {
|
|
47
|
-
setFormData({
|
|
48
|
-
retainerAmount: state.timeAndMaterials?.retainerAmount?.value?.toString() || "",
|
|
49
|
-
billingFrequency: state.timeAndMaterials?.billingFrequency || "MONTHLY",
|
|
50
|
-
timesheetRequired: state.timeAndMaterials?.timesheetRequired || false,
|
|
51
|
-
});
|
|
52
|
-
setIsEditing(false);
|
|
53
|
-
}, [state.timeAndMaterials]);
|
|
54
|
-
if (!isEditing) {
|
|
55
|
-
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: "Retainer Configuration" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: state.timeAndMaterials
|
|
56
|
-
? "Edit Configuration"
|
|
57
|
-
: "Configure Retainer" })] }), state.timeAndMaterials ? (_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: "Retainer Amount" }), _jsx("p", { className: "text-lg dark:text-white", children: state.timeAndMaterials.retainerAmount
|
|
58
|
-
? `${state.timeAndMaterials.retainerAmount.value} ${state.timeAndMaterials.retainerAmount.unit}`
|
|
59
|
-
: "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.timeAndMaterials.billingFrequency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Start Date" }), _jsx("p", { className: "text-lg dark:text-white", children: state.timeAndMaterials.timesheetRequired ? "Yes" : "No" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "End Date" }), _jsx("p", { className: "text-lg dark:text-white", children: state.timeAndMaterials.timesheetRequired ? "Yes" : "No" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Auto Renew" }), _jsx("p", { className: "text-lg dark:text-white", children: state.timeAndMaterials.timesheetRequired ? "Yes" : "No" })] }), _jsxs("div", { className: "col-span-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Services Included" }), _jsx("div", { className: "bg-gray-50 dark:bg-gray-700 p-3 rounded border dark:border-gray-600", children: _jsx("p", { className: "text-sm dark:text-white", children: state.timeAndMaterials.timesheetRequired ? "Yes" : "No" }) })] })] })) : (_jsxs("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [_jsx("p", { children: "No retainer configuration set up yet." }), _jsx("p", { className: "text-sm", children: "Click \"Configure Retainer\" to get started." })] }))] }));
|
|
60
|
-
}
|
|
61
|
-
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 Retainer" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsx(TextInput, { label: "Retainer Amount *", type: "number", value: formData.retainerAmount, onChange: (e) => setFormData({ ...formData, retainerAmount: e.target.value }), className: "w-full", placeholder: "0.00", step: "0.01", required: true }), _jsx(Select, { label: "Billing Frequency *", options: billingFrequencyOptions, value: formData.billingFrequency, onChange: (value) => setFormData({
|
|
62
|
-
...formData,
|
|
63
|
-
billingFrequency: value,
|
|
64
|
-
}) }), _jsx(DatePicker, { className: "bg-white", value: formData.timesheetRequired ? new Date() : undefined, onChange: () => {
|
|
65
|
-
setFormData({ ...formData, timesheetRequired: true });
|
|
66
|
-
}, name: "start-date", placeholder: "Select start date", required: true }), _jsx(DatePicker, { className: "bg-white", value: formData.timesheetRequired ? new Date() : undefined, onChange: () => {
|
|
67
|
-
setFormData({ ...formData, timesheetRequired: true });
|
|
68
|
-
}, name: "end-date", placeholder: "Select end date (optional)" }), _jsx("div", { className: "col-span-2", children: _jsx(Textarea, { label: "Services Included *", value: formData.timesheetRequired ? "Yes" : "No", onChange: () => setFormData({ ...formData, timesheetRequired: true }), className: "w-full", rows: 4, placeholder: "Describe the services included in the retainer...", required: true }) }), _jsx("div", { className: "col-span-2", children: _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "autoRenew", checked: formData.timesheetRequired, onChange: () => setFormData({ ...formData, timesheetRequired: true }), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "autoRenew", className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Auto-Renew Retainer" })] }) })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Configuration" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "sm", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
|
|
69
|
-
}
|