@powerhousedao/network-admin 0.0.20 → 0.0.21
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/network-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/DriveExplorer.js +21 -21
- package/dist/editors/network-admin/index.d.ts.map +1 -1
- package/dist/editors/network-admin/index.js +2 -0
- package/dist/editors/workstream/editor.d.ts.map +1 -1
- package/dist/editors/workstream/editor.js +198 -56
- package/dist/style.css +30 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAuCA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"AAuCA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,2CAykBvC"}
|
|
@@ -104,9 +104,15 @@ export function DriveExplorer(props) {
|
|
|
104
104
|
const sowDoc = allDocuments?.find((doc) => doc.header.id === sow);
|
|
105
105
|
const rfpDoc = allDocuments?.find((doc) => doc.header.id === rfp);
|
|
106
106
|
const pmtDoc = allDocuments?.find((doc) => doc.header.id === paymentTerms);
|
|
107
|
+
// get alternative proposals
|
|
108
|
+
let alternativeProposals = null;
|
|
109
|
+
if (doc.state?.global?.alternativeProposals) {
|
|
110
|
+
alternativeProposals = doc.state?.global
|
|
111
|
+
?.alternativeProposals;
|
|
112
|
+
}
|
|
107
113
|
// Only include documents that actually exist
|
|
108
114
|
const wstrChildDocs = [sowDoc, rfpDoc, pmtDoc].filter((doc) => doc !== undefined && doc !== null);
|
|
109
|
-
|
|
115
|
+
const returnableChildren = {
|
|
110
116
|
id: `editor-${doc.header.id}`,
|
|
111
117
|
title: `${doc.state?.global?.code ? doc.state?.global?.code + " - " : ""}${doc.state?.global?.title || doc.header.name}`,
|
|
112
118
|
children: wstrChildDocs.map((childDoc) => ({
|
|
@@ -114,30 +120,24 @@ export function DriveExplorer(props) {
|
|
|
114
120
|
title: `${childDoc.state?.global?.code ? childDoc.state?.global?.code + " - " : ""}${childDoc.state?.global?.title || childDoc.header.name}`,
|
|
115
121
|
})),
|
|
116
122
|
};
|
|
123
|
+
if (alternativeProposals.length > 0) {
|
|
124
|
+
const altSowDoc = allDocuments?.find((doc) => doc.header.id === alternativeProposals[0].sow);
|
|
125
|
+
const altPaymentTermsDoc = allDocuments?.find((doc) => doc.header.id === alternativeProposals[0].paymentTerms);
|
|
126
|
+
const altChildDocs = [altSowDoc, altPaymentTermsDoc].filter((doc) => doc !== undefined && doc !== null);
|
|
127
|
+
returnableChildren.children.push({
|
|
128
|
+
id: "alternative-proposals",
|
|
129
|
+
title: "Alternative Proposals",
|
|
130
|
+
children: altChildDocs.map((childDoc) => ({
|
|
131
|
+
id: `editor-${childDoc.header.id}`,
|
|
132
|
+
title: `${childDoc.state?.global?.code ? childDoc.state?.global?.code + " - " : ""}${childDoc.state?.global?.title || childDoc.header.name}`,
|
|
133
|
+
})),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return returnableChildren;
|
|
117
137
|
}),
|
|
118
138
|
],
|
|
119
139
|
};
|
|
120
140
|
}),
|
|
121
|
-
// // Add workstream documents
|
|
122
|
-
// ...workstreamDocs.map((doc) => ({
|
|
123
|
-
// id: `editor-${doc.header.id}`,
|
|
124
|
-
// title: `${(doc.state as any)?.global?.code || ""} - ${(doc.state as any)?.global?.title || doc.header.name}`,
|
|
125
|
-
// })),
|
|
126
|
-
// // Add scope of work documents
|
|
127
|
-
// ...scopeOfWorkDocs.map((doc) => ({
|
|
128
|
-
// id: `editor-${doc.header.id}`,
|
|
129
|
-
// title: `${(doc.state as any)?.global?.title || doc.header.name}`,
|
|
130
|
-
// })),
|
|
131
|
-
// // Add RFP documents
|
|
132
|
-
// ...rfpDocs.map((doc) => ({
|
|
133
|
-
// id: `editor-${doc.header.id}`,
|
|
134
|
-
// title: `${(doc.state as any)?.global?.code || ""} - ${(doc.state as any)?.global?.title || doc.header.name}`,
|
|
135
|
-
// })),
|
|
136
|
-
// // Add payment terms documents
|
|
137
|
-
// ...paymentTermsDocs.map((doc) => ({
|
|
138
|
-
// id: `editor-${doc.header.id}`,
|
|
139
|
-
// title: `${(doc.state as any)?.global?.code || ""} - ${(doc.state as any)?.global?.title || doc.header.name}`,
|
|
140
|
-
// })),
|
|
141
141
|
],
|
|
142
142
|
};
|
|
143
143
|
const networkInfoNode = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/network-admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/network-admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAO,MAAM,MAAM,EAAE,iBAmBpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -11,6 +11,8 @@ export const module = {
|
|
|
11
11
|
// List all document types that can be dropped
|
|
12
12
|
"powerhouse/network-profile",
|
|
13
13
|
"powerhouse/workstream",
|
|
14
|
+
"powerhouse/scopeofwork",
|
|
15
|
+
"payment-terms",
|
|
14
16
|
],
|
|
15
17
|
dragAndDrop: {
|
|
16
18
|
enabled: true, // Enable drag-and-drop functionality
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAiCtE,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAsBjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CAyiCxC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, toast, ToastContainer } from "@powerhousedao/design-system";
|
|
3
|
-
import { TextInput, Select,
|
|
3
|
+
import { TextInput, Select, OIDInput, Icon, ObjectSetTable, buildEnumCellEditor, } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { actions, } from "../../document-models/workstream/index.js";
|
|
5
5
|
import { actions as rfpActions, } from "../../document-models/request-for-proposals/index.js";
|
|
6
6
|
import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
|
|
@@ -19,6 +19,12 @@ const statusOptions = [
|
|
|
19
19
|
{ value: "IN_PROGRESS", label: "In Progress" },
|
|
20
20
|
{ value: "FINISHED", label: "Finished" },
|
|
21
21
|
];
|
|
22
|
+
const statusStyles = {
|
|
23
|
+
DRAFT: "bg-[#fcdfbd] text-[#ffa033] rounded px-2 py-1 font-semibold",
|
|
24
|
+
SUBMITTED: "bg-[#bfdffd] text-[#339cff] rounded px-2 py-1 font-semibold",
|
|
25
|
+
ACCEPTED: "bg-[#c8ecd1] text-[#4fc86f] rounded px-2 py-1 font-semibold",
|
|
26
|
+
REJECTED: "bg-[#ffaea8] text-[#de3333] rounded px-2 py-1 font-semibold",
|
|
27
|
+
};
|
|
22
28
|
export default function Editor(props) {
|
|
23
29
|
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
24
30
|
// Try to get dispatch from context or props
|
|
@@ -62,21 +68,17 @@ export default function Editor(props) {
|
|
|
62
68
|
// Local state to track newly created RFP document ID
|
|
63
69
|
const [newlyCreatedRfpId, setNewlyCreatedRfpId] = useState(null);
|
|
64
70
|
// Local state to track manual input values
|
|
65
|
-
const [manualSowInput, setManualSowInput] = useState("");
|
|
66
|
-
const [manualPaymentTermsInput, setManualPaymentTermsInput] = useState("");
|
|
67
71
|
const [manualAuthorInput, setManualAuthorInput] = useState("");
|
|
68
72
|
// Effect to clear local state when global state is updated
|
|
69
73
|
useEffect(() => {
|
|
70
74
|
if (state.initialProposal?.sow && newlyCreatedSowId) {
|
|
71
75
|
setNewlyCreatedSowId(null);
|
|
72
|
-
setManualSowInput("");
|
|
73
76
|
}
|
|
74
77
|
}, [state.initialProposal?.sow, newlyCreatedSowId]);
|
|
75
78
|
// Effect to clear local state when global state is updated
|
|
76
79
|
useEffect(() => {
|
|
77
80
|
if (state.initialProposal?.paymentTerms && newlyCreatedPaymentTermsId) {
|
|
78
81
|
setNewlyCreatedPaymentTermsId(null);
|
|
79
|
-
setManualPaymentTermsInput("");
|
|
80
82
|
}
|
|
81
83
|
}, [state.initialProposal?.paymentTerms, newlyCreatedPaymentTermsId]);
|
|
82
84
|
// Effect to clear local state when global state is updated
|
|
@@ -93,6 +95,22 @@ export default function Editor(props) {
|
|
|
93
95
|
doc.header.id === state.rfp?.id);
|
|
94
96
|
});
|
|
95
97
|
}
|
|
98
|
+
// Find SOW document node
|
|
99
|
+
let sowDocumentNode = undefined;
|
|
100
|
+
if (state.initialProposal?.sow) {
|
|
101
|
+
sowDocumentNode = allDocuments?.find((doc) => {
|
|
102
|
+
return (doc.header.documentType === "powerhouse/scopeofwork" &&
|
|
103
|
+
doc.header.id === state.initialProposal?.sow);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Find Payment Terms document node
|
|
107
|
+
let paymentTermsDocumentNode = undefined;
|
|
108
|
+
if (state.initialProposal?.paymentTerms) {
|
|
109
|
+
paymentTermsDocumentNode = allDocuments?.find((doc) => {
|
|
110
|
+
return (doc.header.documentType === "payment-terms" &&
|
|
111
|
+
doc.header.id === state.initialProposal?.paymentTerms);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
96
114
|
// Get RFP document data using useDocumentById hook - always call with stable ID
|
|
97
115
|
const rfpDocumentId = rfpDocumentNode?.header.id || "";
|
|
98
116
|
const rfpDocumentData = useDocumentById(rfpDocumentId);
|
|
@@ -130,15 +148,42 @@ export default function Editor(props) {
|
|
|
130
148
|
}
|
|
131
149
|
}, [rfpDocumentNode, rfpDocumentDataState]);
|
|
132
150
|
const searchRfpDocuments = (userInput) => {
|
|
133
|
-
const results = allDocuments?.filter((node) =>
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
const results = allDocuments?.filter((node) => node.header.documentType === "powerhouse/rfp" &&
|
|
152
|
+
(!userInput ||
|
|
153
|
+
node.header.name.toLowerCase().includes(userInput.toLowerCase()) ||
|
|
154
|
+
node.header.id.toLowerCase().includes(userInput.toLowerCase())));
|
|
136
155
|
return results?.map((doc) => ({
|
|
137
156
|
value: doc.header.id,
|
|
138
157
|
title: doc.header.name,
|
|
139
158
|
path: "",
|
|
140
159
|
}));
|
|
141
160
|
};
|
|
161
|
+
const searchSowDocuments = (userInput) => {
|
|
162
|
+
const results = allDocuments?.filter((node) => node.header.documentType === "powerhouse/scopeofwork" &&
|
|
163
|
+
(!userInput ||
|
|
164
|
+
node.header.name.toLowerCase().includes(userInput.toLowerCase()) ||
|
|
165
|
+
node.header.id.toLowerCase().includes(userInput.toLowerCase()) ||
|
|
166
|
+
(node.state?.global?.title
|
|
167
|
+
?.toLowerCase()
|
|
168
|
+
.includes(userInput.toLowerCase()) ??
|
|
169
|
+
false)));
|
|
170
|
+
return results?.map((doc) => ({
|
|
171
|
+
value: doc.header.id,
|
|
172
|
+
title: doc.state?.global?.title || doc.header.name,
|
|
173
|
+
path: "",
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
const searchPaymentTermsDocuments = (userInput) => {
|
|
177
|
+
const results = allDocuments?.filter((node) => node.header.documentType === "payment-terms" &&
|
|
178
|
+
(!userInput ||
|
|
179
|
+
node.header.name.toLowerCase().includes(userInput.toLowerCase()) ||
|
|
180
|
+
node.header.id.toLowerCase().includes(userInput.toLowerCase())));
|
|
181
|
+
return results?.map((doc) => ({
|
|
182
|
+
value: doc.header.id,
|
|
183
|
+
title: doc.state?.global?.title || doc.header.name,
|
|
184
|
+
path: "",
|
|
185
|
+
}));
|
|
186
|
+
};
|
|
142
187
|
// Handle workstream field changes
|
|
143
188
|
const handleWorkstreamChange = (field, value) => {
|
|
144
189
|
if (!dispatch) {
|
|
@@ -227,8 +272,8 @@ export default function Editor(props) {
|
|
|
227
272
|
return false;
|
|
228
273
|
},
|
|
229
274
|
renderCell: (value, context) => {
|
|
230
|
-
if (value ===
|
|
231
|
-
return (_jsx("div", { className: "font-light italic text-left text-gray-500", children: "+ Double-click to add new author" }));
|
|
275
|
+
if (value === undefined) {
|
|
276
|
+
return (_jsx("div", { className: "font-light italic text-left text-gray-500 text-xs", children: "+ Double-click to add new author" }));
|
|
232
277
|
}
|
|
233
278
|
return _jsx("div", { className: "text-left", children: value });
|
|
234
279
|
},
|
|
@@ -236,6 +281,7 @@ export default function Editor(props) {
|
|
|
236
281
|
{
|
|
237
282
|
field: "sow",
|
|
238
283
|
title: "SOW",
|
|
284
|
+
type: "oid",
|
|
239
285
|
editable: true,
|
|
240
286
|
align: "center",
|
|
241
287
|
onSave: (newValue, context) => {
|
|
@@ -252,6 +298,7 @@ export default function Editor(props) {
|
|
|
252
298
|
{
|
|
253
299
|
field: "paymentTerms",
|
|
254
300
|
title: "Payment Terms",
|
|
301
|
+
type: "oid",
|
|
255
302
|
editable: true,
|
|
256
303
|
align: "center",
|
|
257
304
|
onSave: (newValue, context) => {
|
|
@@ -268,25 +315,33 @@ export default function Editor(props) {
|
|
|
268
315
|
{
|
|
269
316
|
field: "status",
|
|
270
317
|
title: "Status",
|
|
271
|
-
editable:
|
|
318
|
+
editable: true,
|
|
272
319
|
align: "center",
|
|
273
|
-
|
|
274
|
-
|
|
320
|
+
type: "enum",
|
|
321
|
+
valueGetter: (row) => row.status,
|
|
322
|
+
onSave: (newValue, context) => {
|
|
323
|
+
if (newValue !== context.row.status) {
|
|
324
|
+
dispatch(actions.editAlternativeProposal({
|
|
325
|
+
id: context.row.id,
|
|
326
|
+
status: newValue,
|
|
327
|
+
}));
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
},
|
|
332
|
+
renderCellEditor: buildEnumCellEditor({
|
|
333
|
+
className: "w-[130px]",
|
|
334
|
+
options: [
|
|
335
|
+
{ value: "DRAFT", label: "Draft" },
|
|
336
|
+
{ value: "SUBMITTED", label: "Submitted" },
|
|
337
|
+
{ value: "ACCEPTED", label: "Accepted" },
|
|
338
|
+
{ value: "REJECTED", label: "Rejected" },
|
|
339
|
+
],
|
|
340
|
+
}),
|
|
341
|
+
renderCell: (value) => {
|
|
275
342
|
if (!value)
|
|
276
343
|
return null;
|
|
277
|
-
return (_jsx(
|
|
278
|
-
{ value: "DRAFT", label: "Draft" },
|
|
279
|
-
{ value: "SUBMITTED", label: "Submitted" },
|
|
280
|
-
{ value: "ACCEPTED", label: "Accepted" },
|
|
281
|
-
{ value: "REJECTED", label: "Rejected" },
|
|
282
|
-
], value: value || "DRAFT", onChange: (value) => {
|
|
283
|
-
if (value !== value) {
|
|
284
|
-
dispatch(actions.editAlternativeProposal({
|
|
285
|
-
id: context.row.id,
|
|
286
|
-
status: value,
|
|
287
|
-
}));
|
|
288
|
-
}
|
|
289
|
-
} }));
|
|
344
|
+
return (_jsx("div", { className: `text-center ${statusStyles[value]}`, children: value }));
|
|
290
345
|
},
|
|
291
346
|
},
|
|
292
347
|
], []);
|
|
@@ -310,7 +365,7 @@ export default function Editor(props) {
|
|
|
310
365
|
if (e.target.value !== state.client?.icon) {
|
|
311
366
|
handleClientChange("icon", e.target.value);
|
|
312
367
|
}
|
|
313
|
-
}, placeholder: "Enter client icon URL" })] })] })] })] }), rfpDocument ? (_jsxs("div", { className: "bg-white rounded-lg p-6 mt-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Request for Proposal" }), _jsxs("div", { className: "w-full flex flex-row items-center gap-8", children: [_jsx("div", { className: "w-[350px]", children: _jsx(
|
|
368
|
+
}, placeholder: "Enter client icon URL" })] })] })] })] }), rfpDocument ? (_jsxs("div", { className: "bg-white rounded-lg p-6 mt-6 mb-6 shadow-sm", children: [_jsx("h1", { className: "text-2xl text-gray-900 mb-4", children: "Request for Proposal" }), _jsxs("div", { className: "w-full flex flex-row items-center gap-8", children: [_jsx("div", { className: "w-[350px]", children: _jsx(OIDInput, { name: "Request for Proposal", label: "RFP Document", placeholder: "Search for RFP Document", variant: "withValueTitleAndDescription", value: newlyCreatedRfpId || state.rfp?.id || "", onBlur: (e) => {
|
|
314
369
|
if (e.target.value !== state.rfp?.id) {
|
|
315
370
|
dispatch(actions.setRequestForProposal({
|
|
316
371
|
rfpId: e.target.value,
|
|
@@ -320,7 +375,7 @@ export default function Editor(props) {
|
|
|
320
375
|
},
|
|
321
376
|
// search options as the user types
|
|
322
377
|
fetchOptionsCallback: async (userInput) => {
|
|
323
|
-
const results = searchRfpDocuments(userInput) || [];
|
|
378
|
+
const results = searchRfpDocuments(userInput || "") || [];
|
|
324
379
|
if (results?.length === 0) {
|
|
325
380
|
return Promise.reject(new Error("No RFP documents found"));
|
|
326
381
|
}
|
|
@@ -390,20 +445,74 @@ export default function Editor(props) {
|
|
|
390
445
|
},
|
|
391
446
|
}));
|
|
392
447
|
}
|
|
393
|
-
} }) }),
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
448
|
+
} }) }), _jsx("div", { className: "flex-1", children: _jsx(Select, { label: "Status", options: [
|
|
449
|
+
{ value: "DRAFT", label: "Draft" },
|
|
450
|
+
{ value: "SUBMITTED", label: "Submitted" },
|
|
451
|
+
{ value: "ACCEPTED", label: "Accepted" },
|
|
452
|
+
{ value: "REJECTED", label: "Rejected" },
|
|
453
|
+
], value: state.initialProposal.status || "DRAFT", onChange: (value) => {
|
|
454
|
+
if (value !== state.initialProposal.status) {
|
|
455
|
+
dispatch(actions.editInitialProposal({
|
|
456
|
+
id: state.initialProposal.id,
|
|
457
|
+
status: value,
|
|
458
|
+
}));
|
|
459
|
+
}
|
|
460
|
+
} }) })] }), _jsxs("div", { className: "flex flex-row gap-4 mb-6", children: [_jsxs("div", { className: "flex-1", children: [_jsx(OIDInput, { name: "Scope of Work", label: "Scope Of Work", placeholder: "Search for SOW Document", variant: "withValueTitleAndDescription", value: newlyCreatedSowId || state.initialProposal?.sow || "", onBlur: (e) => {
|
|
400
461
|
if (e.target.value !== state.initialProposal?.sow) {
|
|
401
462
|
dispatch(actions.editInitialProposal({
|
|
402
463
|
id: state.initialProposal?.id || "",
|
|
403
464
|
sowId: e.target.value,
|
|
404
465
|
}));
|
|
405
466
|
}
|
|
406
|
-
}
|
|
467
|
+
},
|
|
468
|
+
// search options as the user types
|
|
469
|
+
fetchOptionsCallback: async (userInput) => {
|
|
470
|
+
const results = searchSowDocuments(userInput || "") || [];
|
|
471
|
+
if (results?.length === 0) {
|
|
472
|
+
return Promise.reject(new Error("No SOW documents found"));
|
|
473
|
+
}
|
|
474
|
+
return results?.map((doc) => ({
|
|
475
|
+
value: doc.value, // unique document ID
|
|
476
|
+
title: doc.title, // document title or name
|
|
477
|
+
path: {
|
|
478
|
+
text: doc.path,
|
|
479
|
+
url: doc.value,
|
|
480
|
+
}, // document path or location
|
|
481
|
+
description: "", // document description or summary
|
|
482
|
+
icon: "File", // document icon
|
|
483
|
+
}));
|
|
484
|
+
},
|
|
485
|
+
// get details of a specific option by its ID/value
|
|
486
|
+
fetchSelectedOptionCallback: async (documentId) => {
|
|
487
|
+
const doc = searchSowDocuments(documentId)?.[0];
|
|
488
|
+
if (!doc) {
|
|
489
|
+
return Promise.reject(new Error("SOW document not found"));
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
value: doc.value,
|
|
493
|
+
title: doc.title,
|
|
494
|
+
path: {
|
|
495
|
+
text: doc.path,
|
|
496
|
+
url: doc.title,
|
|
497
|
+
},
|
|
498
|
+
description: "",
|
|
499
|
+
icon: "File",
|
|
500
|
+
};
|
|
501
|
+
}, initialOptions: sowDocumentNode
|
|
502
|
+
? [
|
|
503
|
+
{
|
|
504
|
+
value: sowDocumentNode.header.id,
|
|
505
|
+
title: sowDocumentNode.state?.global
|
|
506
|
+
?.title || sowDocumentNode.header.name,
|
|
507
|
+
path: {
|
|
508
|
+
text: sowDocumentNode.header.name,
|
|
509
|
+
url: sowDocumentNode.header.id,
|
|
510
|
+
},
|
|
511
|
+
description: "",
|
|
512
|
+
icon: "File",
|
|
513
|
+
},
|
|
514
|
+
]
|
|
515
|
+
: undefined }), _jsx("button", { className: "text-sm bg-gray-100 rounded-md mt-1 p-1 hover:bg-gray-200", onClick: async () => {
|
|
407
516
|
console.log("Creating sow");
|
|
408
517
|
const createdNode = await createSowDocument();
|
|
409
518
|
if (createdNode) {
|
|
@@ -414,20 +523,65 @@ export default function Editor(props) {
|
|
|
414
523
|
sowId: createdNode.id,
|
|
415
524
|
}));
|
|
416
525
|
}
|
|
417
|
-
}, children: "Create sow" })] }), _jsxs("div", { className: "flex-1", children: [_jsx(
|
|
418
|
-
manualPaymentTermsInput ||
|
|
526
|
+
}, children: "Create sow" })] }), _jsxs("div", { className: "flex-1", children: [_jsx(OIDInput, { name: "Payment Terms", label: "Payment Terms", placeholder: "Search for Payment Terms Document", variant: "withValueTitleAndDescription", value: newlyCreatedPaymentTermsId ||
|
|
419
527
|
state.initialProposal?.paymentTerms ||
|
|
420
|
-
"",
|
|
421
|
-
setManualPaymentTermsInput(e.target.value);
|
|
422
|
-
setNewlyCreatedPaymentTermsId(null); // Clear newly created ID when user starts typing
|
|
423
|
-
}, onBlur: (e) => {
|
|
528
|
+
"", onBlur: (e) => {
|
|
424
529
|
if (e.target.value !== state.initialProposal?.paymentTerms) {
|
|
425
530
|
dispatch(actions.editInitialProposal({
|
|
426
531
|
id: state.initialProposal?.id || "",
|
|
427
532
|
paymentTermsId: e.target.value,
|
|
428
533
|
}));
|
|
429
534
|
}
|
|
430
|
-
}
|
|
535
|
+
},
|
|
536
|
+
// search options as the user types
|
|
537
|
+
fetchOptionsCallback: async (userInput) => {
|
|
538
|
+
const results = searchPaymentTermsDocuments(userInput || "") || [];
|
|
539
|
+
if (results?.length === 0) {
|
|
540
|
+
return Promise.reject(new Error("No Payment Terms documents found"));
|
|
541
|
+
}
|
|
542
|
+
return results?.map((doc) => ({
|
|
543
|
+
value: doc.value, // unique document ID
|
|
544
|
+
title: doc.title, // document title or name
|
|
545
|
+
path: {
|
|
546
|
+
text: doc.path,
|
|
547
|
+
url: doc.value,
|
|
548
|
+
}, // document path or location
|
|
549
|
+
description: "", // document description or summary
|
|
550
|
+
icon: "File", // document icon
|
|
551
|
+
}));
|
|
552
|
+
},
|
|
553
|
+
// get details of a specific option by its ID/value
|
|
554
|
+
fetchSelectedOptionCallback: async (documentId) => {
|
|
555
|
+
const doc = searchPaymentTermsDocuments(documentId)?.[0];
|
|
556
|
+
if (!doc) {
|
|
557
|
+
return Promise.reject(new Error("Payment Terms document not found"));
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
value: doc.value,
|
|
561
|
+
title: doc.title,
|
|
562
|
+
path: {
|
|
563
|
+
text: doc.path,
|
|
564
|
+
url: doc.title,
|
|
565
|
+
},
|
|
566
|
+
description: "",
|
|
567
|
+
icon: "File",
|
|
568
|
+
};
|
|
569
|
+
}, initialOptions: paymentTermsDocumentNode
|
|
570
|
+
? [
|
|
571
|
+
{
|
|
572
|
+
value: paymentTermsDocumentNode.header.id,
|
|
573
|
+
title: paymentTermsDocumentNode.state
|
|
574
|
+
?.global?.title ||
|
|
575
|
+
paymentTermsDocumentNode.header.name,
|
|
576
|
+
path: {
|
|
577
|
+
text: paymentTermsDocumentNode.header.name,
|
|
578
|
+
url: paymentTermsDocumentNode.header.id,
|
|
579
|
+
},
|
|
580
|
+
description: "",
|
|
581
|
+
icon: "File",
|
|
582
|
+
},
|
|
583
|
+
]
|
|
584
|
+
: undefined }), _jsx("button", { className: "text-sm bg-gray-100 rounded-md mt-1 p-1 hover:bg-gray-200", onClick: async () => {
|
|
431
585
|
console.log("Creating payment terms");
|
|
432
586
|
const createdNode = await createPaymentTermsDocument();
|
|
433
587
|
if (createdNode) {
|
|
@@ -438,19 +592,7 @@ export default function Editor(props) {
|
|
|
438
592
|
paymentTermsId: createdNode.id,
|
|
439
593
|
}));
|
|
440
594
|
}
|
|
441
|
-
}, children: "Create Payment Terms" })] }),
|
|
442
|
-
{ value: "DRAFT", label: "Draft" },
|
|
443
|
-
{ value: "SUBMITTED", label: "Submitted" },
|
|
444
|
-
{ value: "ACCEPTED", label: "Accepted" },
|
|
445
|
-
{ value: "REJECTED", label: "Rejected" },
|
|
446
|
-
], value: state.initialProposal.status || "DRAFT", onChange: (value) => {
|
|
447
|
-
if (value !== state.initialProposal.status) {
|
|
448
|
-
dispatch(actions.editInitialProposal({
|
|
449
|
-
id: state.initialProposal.id,
|
|
450
|
-
status: value,
|
|
451
|
-
}));
|
|
452
|
-
}
|
|
453
|
-
} }) })] }), _jsxs("div", { children: [_jsx("h2", { className: "text-lg font-medium text-gray-900 mb-4", children: "Alternative Proposals" }), _jsx(ObjectSetTable, { columns: alternativeProposalsColumns, data: alternativeProposalsData, allowRowSelection: true, onDelete: (data) => {
|
|
595
|
+
}, children: "Create Payment Terms" })] })] }), _jsxs("div", { children: [_jsx("h2", { className: "text-lg font-medium text-gray-900 mb-4", children: "Alternative Proposals" }), _jsx(ObjectSetTable, { columns: alternativeProposalsColumns, data: alternativeProposalsData, allowRowSelection: true, onDelete: (data) => {
|
|
454
596
|
if (data.length > 0) {
|
|
455
597
|
data.forEach((d) => {
|
|
456
598
|
dispatch(actions.removeAlternativeProposal({
|
package/dist/style.css
CHANGED
|
@@ -456,6 +456,9 @@
|
|
|
456
456
|
.w-12 {
|
|
457
457
|
width: calc(var(--spacing) * 12);
|
|
458
458
|
}
|
|
459
|
+
.w-\[130px\] {
|
|
460
|
+
width: 130px;
|
|
461
|
+
}
|
|
459
462
|
.w-\[150px\] {
|
|
460
463
|
width: 150px;
|
|
461
464
|
}
|
|
@@ -671,6 +674,18 @@
|
|
|
671
674
|
.border-red-700 {
|
|
672
675
|
border-color: var(--color-red-700);
|
|
673
676
|
}
|
|
677
|
+
.bg-\[\#bfdffd\] {
|
|
678
|
+
background-color: #bfdffd;
|
|
679
|
+
}
|
|
680
|
+
.bg-\[\#c8ecd1\] {
|
|
681
|
+
background-color: #c8ecd1;
|
|
682
|
+
}
|
|
683
|
+
.bg-\[\#fcdfbd\] {
|
|
684
|
+
background-color: #fcdfbd;
|
|
685
|
+
}
|
|
686
|
+
.bg-\[\#ffaea8\] {
|
|
687
|
+
background-color: #ffaea8;
|
|
688
|
+
}
|
|
674
689
|
.bg-blue-50 {
|
|
675
690
|
background-color: var(--color-blue-50);
|
|
676
691
|
}
|
|
@@ -749,6 +764,9 @@
|
|
|
749
764
|
.px-6 {
|
|
750
765
|
padding-inline: calc(var(--spacing) * 6);
|
|
751
766
|
}
|
|
767
|
+
.py-1 {
|
|
768
|
+
padding-block: calc(var(--spacing) * 1);
|
|
769
|
+
}
|
|
752
770
|
.py-1\.5 {
|
|
753
771
|
padding-block: calc(var(--spacing) * 1.5);
|
|
754
772
|
}
|
|
@@ -827,6 +845,18 @@
|
|
|
827
845
|
.whitespace-nowrap {
|
|
828
846
|
white-space: nowrap;
|
|
829
847
|
}
|
|
848
|
+
.text-\[\#4fc86f\] {
|
|
849
|
+
color: #4fc86f;
|
|
850
|
+
}
|
|
851
|
+
.text-\[\#339cff\] {
|
|
852
|
+
color: #339cff;
|
|
853
|
+
}
|
|
854
|
+
.text-\[\#de3333\] {
|
|
855
|
+
color: #de3333;
|
|
856
|
+
}
|
|
857
|
+
.text-\[\#ffa033\] {
|
|
858
|
+
color: #ffa033;
|
|
859
|
+
}
|
|
830
860
|
.text-blue-600 {
|
|
831
861
|
color: var(--color-blue-600);
|
|
832
862
|
}
|