@powerhousedao/network-admin 0.0.19 → 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 +1 -1
- package/dist/editors/network-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/DriveExplorer.js +87 -28
- package/dist/editors/network-admin/components/EditorContainer.d.ts +1 -0
- package/dist/editors/network-admin/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/network-admin/components/EditorContainer.js +2 -2
- package/dist/editors/network-admin/index.d.ts.map +1 -1
- package/dist/editors/network-admin/index.js +0 -1
- package/dist/editors/workstream/editor.d.ts.map +1 -1
- package/dist/editors/workstream/editor.js +272 -102
- package/dist/editors/workstream/index.d.ts.map +1 -1
- package/dist/style.css +31 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/DriveExplorer.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, CreateDocumentModal
|
|
2
|
+
import { Button, CreateDocumentModal } from "@powerhousedao/design-system";
|
|
3
3
|
import { Sidebar, SidebarProvider, } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { addDocument, setSelectedNode, useAllFolderNodes, useFileChildNodes, useSelectedDrive, useSelectedFolder, dispatchActions, useSelectedDocument, useSelectedDriveDocuments, showDeleteNodeModal, useSelectedDriveId, useNodeActions, } from "@powerhousedao/reactor-browser";
|
|
5
5
|
import { useCallback, useRef, useState, useMemo, useEffect } from "react";
|
|
6
6
|
import { EditorContainer } from "./EditorContainer.js";
|
|
7
7
|
import { editWorkstream } from "../../../document-models/workstream/gen/creators.js";
|
|
8
|
-
|
|
8
|
+
const WorkstreamStatusEnums = [
|
|
9
|
+
"RFP_DRAFT",
|
|
10
|
+
"PREWORK_RFC",
|
|
11
|
+
"RFP_CANCELLED",
|
|
12
|
+
"OPEN_FOR_PROPOSALS",
|
|
13
|
+
"PROPOSAL_SUBMITTED",
|
|
14
|
+
"NOT_AWARDED",
|
|
15
|
+
"AWARDED",
|
|
16
|
+
"IN_PROGRESS",
|
|
17
|
+
"FINISHED",
|
|
18
|
+
];
|
|
19
|
+
/**1
|
|
9
20
|
* Main drive explorer component with sidebar navigation and content area.
|
|
10
21
|
* Layout: Left sidebar (folder tree) + Right content area (files/folders + document editor)
|
|
11
22
|
*/
|
|
@@ -13,6 +24,7 @@ export function DriveExplorer(props) {
|
|
|
13
24
|
// === DOCUMENT EDITOR STATE ===
|
|
14
25
|
// Customize document opening/closing behavior here
|
|
15
26
|
const [activeDocumentId, setActiveDocumentId] = useState();
|
|
27
|
+
const [activeSidebarNodeId, setActiveSidebarNodeId] = useState("workstreams");
|
|
16
28
|
const [openModal, setOpenModal] = useState(false);
|
|
17
29
|
const [selectedRootNode, setSelectedRootNode] = useState("workstreams");
|
|
18
30
|
const [modalDocumentType, setModalDocumentType] = useState("powerhouse/workstream");
|
|
@@ -39,6 +51,8 @@ export function DriveExplorer(props) {
|
|
|
39
51
|
useEffect(() => {
|
|
40
52
|
if (globalSelectedDocument?.header?.id) {
|
|
41
53
|
setActiveDocumentId(globalSelectedDocument.header.id);
|
|
54
|
+
// Also update the sidebar node ID to match
|
|
55
|
+
setActiveSidebarNodeId(`editor-${globalSelectedDocument.header.id}`);
|
|
42
56
|
}
|
|
43
57
|
}, [globalSelectedDocument]);
|
|
44
58
|
// Check if current active document is a Scope of Work (should show in full view)
|
|
@@ -60,26 +74,70 @@ export function DriveExplorer(props) {
|
|
|
60
74
|
id: "workstreams",
|
|
61
75
|
title: "Workstreams",
|
|
62
76
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
...WorkstreamStatusEnums.map((status) => {
|
|
78
|
+
const statusTitle = status
|
|
79
|
+
.toLowerCase()
|
|
80
|
+
.split("_")
|
|
81
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
82
|
+
.join(" ");
|
|
83
|
+
return {
|
|
84
|
+
id: `workstream-status-${status}`,
|
|
85
|
+
title: statusTitle +
|
|
86
|
+
(workstreamDocs.filter((doc) => doc.state?.global?.status === status).length > 0
|
|
87
|
+
? ` (${workstreamDocs.filter((doc) => doc.state?.global?.status === status).length})`
|
|
88
|
+
: ""),
|
|
89
|
+
children: [
|
|
90
|
+
...workstreamDocs
|
|
91
|
+
.filter((doc) => doc.state?.global?.status === status)
|
|
92
|
+
.map((doc) => {
|
|
93
|
+
let sow = null;
|
|
94
|
+
let paymentTerms = null;
|
|
95
|
+
let rfp = null;
|
|
96
|
+
if (doc.state?.global?.initialProposal) {
|
|
97
|
+
sow = doc.state?.global?.initialProposal.sow;
|
|
98
|
+
paymentTerms = doc.state?.global?.initialProposal
|
|
99
|
+
.paymentTerms;
|
|
100
|
+
}
|
|
101
|
+
if (doc.state?.global?.rfp) {
|
|
102
|
+
rfp = doc.state?.global?.rfp?.id;
|
|
103
|
+
}
|
|
104
|
+
const sowDoc = allDocuments?.find((doc) => doc.header.id === sow);
|
|
105
|
+
const rfpDoc = allDocuments?.find((doc) => doc.header.id === rfp);
|
|
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
|
+
}
|
|
113
|
+
// Only include documents that actually exist
|
|
114
|
+
const wstrChildDocs = [sowDoc, rfpDoc, pmtDoc].filter((doc) => doc !== undefined && doc !== null);
|
|
115
|
+
const returnableChildren = {
|
|
116
|
+
id: `editor-${doc.header.id}`,
|
|
117
|
+
title: `${doc.state?.global?.code ? doc.state?.global?.code + " - " : ""}${doc.state?.global?.title || doc.header.name}`,
|
|
118
|
+
children: wstrChildDocs.map((childDoc) => ({
|
|
119
|
+
id: `editor-${childDoc.header.id}`,
|
|
120
|
+
title: `${childDoc.state?.global?.code ? childDoc.state?.global?.code + " - " : ""}${childDoc.state?.global?.title || childDoc.header.name}`,
|
|
121
|
+
})),
|
|
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;
|
|
137
|
+
}),
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}),
|
|
83
141
|
],
|
|
84
142
|
};
|
|
85
143
|
const networkInfoNode = {
|
|
@@ -115,6 +173,8 @@ export function DriveExplorer(props) {
|
|
|
115
173
|
const newNode = findNodeById(sidebarNodes, nodeId);
|
|
116
174
|
if (!newNode)
|
|
117
175
|
return;
|
|
176
|
+
// Always update the active sidebar node ID
|
|
177
|
+
setActiveSidebarNodeId(newNode.id);
|
|
118
178
|
if (newNode.id === "workstreams") {
|
|
119
179
|
setActiveDocumentId(undefined);
|
|
120
180
|
setSelectedRootNode("workstreams");
|
|
@@ -173,7 +233,7 @@ export function DriveExplorer(props) {
|
|
|
173
233
|
, size: "medium", className: "cursor-pointer hover:bg-gray-600 hover:text-white", title: "Create Workstream Document", "aria-description": "Create Workstream Document", onClick: () => {
|
|
174
234
|
setModalDocumentType("powerhouse/workstream");
|
|
175
235
|
setOpenModal(true);
|
|
176
|
-
},
|
|
236
|
+
}, children: _jsx("span", { children: "Create Workstream Document" }) }), _jsx(Button, { color: "dark" // Customize button appearance
|
|
177
237
|
, size: "medium", className: "cursor-pointer hover:bg-gray-600 hover:text-white", title: "Create Network Profile Document", "aria-description": "Create Network Profile Document", onClick: () => {
|
|
178
238
|
setModalDocumentType("powerhouse/network-profile");
|
|
179
239
|
setOpenModal(true);
|
|
@@ -255,12 +315,11 @@ export function DriveExplorer(props) {
|
|
|
255
315
|
return (_jsx(SidebarProvider, { nodes: sidebarNodes, children: isScopeOfWorkFullView && activeDocumentId ? (_jsx("div", { className: "h-full w-full", children: _jsx(EditorContainer, { handleClose: () => {
|
|
256
316
|
setActiveDocumentId(undefined);
|
|
257
317
|
setSelectedNode(undefined); // Clear global selection
|
|
258
|
-
}, hideToolbar: false, activeDocumentId: activeDocumentId, setActiveDocumentId: setActiveDocumentId }) })) : (
|
|
318
|
+
}, hideToolbar: false, activeDocumentId: activeDocumentId, setActiveDocumentId: setActiveDocumentId, setActiveSidebarNodeId: setActiveSidebarNodeId }) })) : (
|
|
259
319
|
/* === NORMAL VIEW WITH SIDEBAR === */
|
|
260
|
-
_jsxs("div", { className: "flex h-full", children: [_jsx(Sidebar, {
|
|
261
|
-
[&_.sidebar\\_\\_item--active]:bg-yellow-500
|
|
262
|
-
`, nodes: sidebarNodes, activeNodeId: selectedFolder?.id || activeDocumentId, onActiveNodeChange: (node) => handleActiveNodeChange(node.id), sidebarTitle: "Network Admin", showSearchBar: true, allowPinning: true, resizable: true, initialWidth: 300, maxWidth: 500, enableMacros: 2, handleOnTitleClick: () => {
|
|
320
|
+
_jsxs("div", { className: "flex h-full", children: [_jsx(Sidebar, { nodes: sidebarNodes, activeNodeId: activeSidebarNodeId, onActiveNodeChange: (node) => handleActiveNodeChange(node.id), sidebarTitle: "Network Admin", showSearchBar: true, allowPinning: true, resizable: true, initialWidth: 300, maxWidth: 500, enableMacros: 4, handleOnTitleClick: () => {
|
|
263
321
|
setActiveDocumentId(undefined);
|
|
322
|
+
setActiveSidebarNodeId("workstreams");
|
|
264
323
|
setSelectedRootNode("workstreams");
|
|
265
|
-
} }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx("div", { className: "h-full", children: activeDocumentId ? (_jsx(EditorContainer, { handleClose: () => setActiveDocumentId(undefined), hideToolbar: false, activeDocumentId: activeDocumentId, setActiveDocumentId: setActiveDocumentId })) : (displayActiveNode(selectedFolder?.id || selectedRootNode)) }) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] })) }));
|
|
324
|
+
} }), _jsx("div", { className: "flex-1 overflow-y-auto", children: _jsx("div", { className: "h-full", children: activeDocumentId ? (_jsx(EditorContainer, { handleClose: () => setActiveDocumentId(undefined), hideToolbar: false, activeDocumentId: activeDocumentId, setActiveDocumentId: setActiveDocumentId, setActiveSidebarNodeId: setActiveSidebarNodeId })) : (displayActiveNode(selectedFolder?.id || selectedRootNode)) }) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] })) }));
|
|
266
325
|
}
|
|
@@ -8,5 +8,6 @@ export declare const EditorContainer: (props: {
|
|
|
8
8
|
hideToolbar?: boolean;
|
|
9
9
|
activeDocumentId: string;
|
|
10
10
|
setActiveDocumentId: (id: string) => void;
|
|
11
|
+
setActiveSidebarNodeId: (id: string) => void;
|
|
11
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=EditorContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/EditorContainer.tsx"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/network-admin/components/EditorContainer.tsx"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,4CAkMA,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
|
|
|
11
11
|
* Customize toolbar actions and editor context here.
|
|
12
12
|
*/
|
|
13
13
|
export const EditorContainer = (props) => {
|
|
14
|
-
const { handleClose, hideToolbar = false, activeDocumentId, setActiveDocumentId, } = props;
|
|
14
|
+
const { handleClose, hideToolbar = false, activeDocumentId, setActiveDocumentId, setActiveSidebarNodeId, } = props;
|
|
15
15
|
// UI state for revision history and timeline
|
|
16
16
|
const [selectedTimelineItem, setSelectedTimelineItem] = useState(null);
|
|
17
17
|
const [showRevisionHistory, setShowRevisionHistory] = useState(false);
|
|
@@ -95,5 +95,5 @@ export const EditorContainer = (props) => {
|
|
|
95
95
|
_jsxs(Suspense, { fallback: loadingContent, children: [!hideToolbar && (_jsx(DocumentToolbar, { onClose: handleClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: selectedDocument.header.name, timelineButtonVisible: editorModule.config.timelineEnabled, timelineItems: timelineItems.data, onTimelineItemClick: setSelectedTimelineItem })), _jsx(EditorComponent, { context: {
|
|
96
96
|
readMode: !!selectedTimelineItem,
|
|
97
97
|
selectedTimelineRevision: getRevisionFromDate(selectedTimelineItem?.startDate, selectedTimelineItem?.endDate, selectedDocument.operations.global),
|
|
98
|
-
}, dispatch: dispatch, document: selectedDocument, error: console.error,
|
|
98
|
+
}, dispatch: dispatch, document: selectedDocument, error: console.error, setActiveSidebarNodeId: setActiveSidebarNodeId, setActiveDocumentId: setActiveDocumentId, createSow: createSowDocument, createPaymentTerms: createPaymentTermsDocument, documentId: selectedDocument.header.id }, selectedDocument.header.id)] })) }));
|
|
99
99
|
};
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/workstream/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,WAAW,
|
|
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,9 +1,11 @@
|
|
|
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
|
+
import { actions as rfpActions, } from "../../document-models/request-for-proposals/index.js";
|
|
6
|
+
import { ScopeOfWork } from "@powerhousedao/project-management/document-models";
|
|
5
7
|
import { generateId } from "document-model";
|
|
6
|
-
import {
|
|
8
|
+
import { useDocumentById, useSelectedDrive, addDocument, useSelectedDriveDocuments, dispatchActions, } from "@powerhousedao/reactor-browser";
|
|
7
9
|
import { useEffect, useMemo, useState } from "react";
|
|
8
10
|
// Status options for the dropdown
|
|
9
11
|
const statusOptions = [
|
|
@@ -17,14 +19,48 @@ const statusOptions = [
|
|
|
17
19
|
{ value: "IN_PROGRESS", label: "In Progress" },
|
|
18
20
|
{ value: "FINISHED", label: "Finished" },
|
|
19
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
|
+
};
|
|
20
28
|
export default function Editor(props) {
|
|
21
29
|
const [doc, dispatch] = useDocumentById(props.documentId);
|
|
22
30
|
// Try to get dispatch from context or props
|
|
23
|
-
const state = doc.state.global;
|
|
24
|
-
|
|
31
|
+
const [state, setState] = useState(doc.state.global);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setState(doc.state.global);
|
|
34
|
+
}, [doc.state.global]);
|
|
25
35
|
const setActiveDocumentId = props.setActiveDocumentId;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
36
|
+
const setActiveSidebarNodeId = props.setActiveSidebarNodeId;
|
|
37
|
+
const [selectedDrive] = useSelectedDrive();
|
|
38
|
+
const createRfpDocument = async () => {
|
|
39
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", `RFP-${state.title || ""}`, "powerhouse/rfp", undefined, undefined, undefined, "request-for-proposals-editor");
|
|
40
|
+
console.log("Created RFP document", createdNode);
|
|
41
|
+
if (createdNode) {
|
|
42
|
+
await dispatchActions(rfpActions.editRfp({
|
|
43
|
+
title: `RFP-${state.title || ""}`,
|
|
44
|
+
}), createdNode.id);
|
|
45
|
+
}
|
|
46
|
+
return createdNode;
|
|
47
|
+
};
|
|
48
|
+
const createSowDocument = async () => {
|
|
49
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", `SOW-${state.title || ""}`, "powerhouse/scopeofwork", undefined, undefined, undefined, "scope-of-work-editor");
|
|
50
|
+
console.log("Created SOW document", createdNode);
|
|
51
|
+
if (createdNode) {
|
|
52
|
+
await dispatchActions(ScopeOfWork.actions.editScopeOfWork({
|
|
53
|
+
title: `SOW-${state.title || ""}`,
|
|
54
|
+
}), createdNode.id);
|
|
55
|
+
}
|
|
56
|
+
return createdNode;
|
|
57
|
+
};
|
|
58
|
+
const createPaymentTermsDocument = async () => {
|
|
59
|
+
const createdNode = await addDocument(selectedDrive?.header.id || "", `Payment Terms-${state.title || ""}`, "payment-terms", undefined, undefined, undefined, "payment-terms-editor");
|
|
60
|
+
console.log("Created Payment Terms document", createdNode);
|
|
61
|
+
// Note: Payment Terms might not have actions to initialize, so we just create it
|
|
62
|
+
return createdNode;
|
|
63
|
+
};
|
|
28
64
|
// Local state to track newly created SOW document ID
|
|
29
65
|
const [newlyCreatedSowId, setNewlyCreatedSowId] = useState(null);
|
|
30
66
|
// Local state to track newly created Payment Terms document ID
|
|
@@ -32,21 +68,17 @@ export default function Editor(props) {
|
|
|
32
68
|
// Local state to track newly created RFP document ID
|
|
33
69
|
const [newlyCreatedRfpId, setNewlyCreatedRfpId] = useState(null);
|
|
34
70
|
// Local state to track manual input values
|
|
35
|
-
const [manualSowInput, setManualSowInput] = useState("");
|
|
36
|
-
const [manualPaymentTermsInput, setManualPaymentTermsInput] = useState("");
|
|
37
71
|
const [manualAuthorInput, setManualAuthorInput] = useState("");
|
|
38
72
|
// Effect to clear local state when global state is updated
|
|
39
73
|
useEffect(() => {
|
|
40
74
|
if (state.initialProposal?.sow && newlyCreatedSowId) {
|
|
41
75
|
setNewlyCreatedSowId(null);
|
|
42
|
-
setManualSowInput("");
|
|
43
76
|
}
|
|
44
77
|
}, [state.initialProposal?.sow, newlyCreatedSowId]);
|
|
45
78
|
// Effect to clear local state when global state is updated
|
|
46
79
|
useEffect(() => {
|
|
47
80
|
if (state.initialProposal?.paymentTerms && newlyCreatedPaymentTermsId) {
|
|
48
81
|
setNewlyCreatedPaymentTermsId(null);
|
|
49
|
-
setManualPaymentTermsInput("");
|
|
50
82
|
}
|
|
51
83
|
}, [state.initialProposal?.paymentTerms, newlyCreatedPaymentTermsId]);
|
|
52
84
|
// Effect to clear local state when global state is updated
|
|
@@ -55,30 +87,32 @@ export default function Editor(props) {
|
|
|
55
87
|
setNewlyCreatedRfpId(null);
|
|
56
88
|
}
|
|
57
89
|
}, [state.rfp?.id, newlyCreatedRfpId]);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
const allDocuments = useSelectedDriveDocuments();
|
|
91
|
+
let rfpDocumentNode = undefined;
|
|
92
|
+
if (state.rfp?.id) {
|
|
93
|
+
rfpDocumentNode = allDocuments?.find((doc) => {
|
|
94
|
+
return (doc.header.documentType === "powerhouse/rfp" &&
|
|
95
|
+
doc.header.id === state.rfp?.id);
|
|
96
|
+
});
|
|
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
|
+
}
|
|
80
114
|
// Get RFP document data using useDocumentById hook - always call with stable ID
|
|
81
|
-
const rfpDocumentId = rfpDocumentNode?.id || "";
|
|
115
|
+
const rfpDocumentId = rfpDocumentNode?.header.id || "";
|
|
82
116
|
const rfpDocumentData = useDocumentById(rfpDocumentId);
|
|
83
117
|
const [rfpDocumentDataState] = rfpDocumentData || [];
|
|
84
118
|
// State to track RFP document
|
|
@@ -86,30 +120,68 @@ export default function Editor(props) {
|
|
|
86
120
|
// Effect to update RFP document when nodes or document data changes
|
|
87
121
|
useEffect(() => {
|
|
88
122
|
if (rfpDocumentNode &&
|
|
89
|
-
rfpDocumentNode.id &&
|
|
90
|
-
rfpDocumentNode.id !== "" &&
|
|
123
|
+
rfpDocumentNode.header.id &&
|
|
124
|
+
rfpDocumentNode.header.id !== "" &&
|
|
91
125
|
rfpDocumentDataState?.state?.global) {
|
|
92
|
-
|
|
126
|
+
const newRfpDocument = {
|
|
93
127
|
...rfpDocumentNode,
|
|
94
128
|
document: (rfpDocumentDataState?.state)
|
|
95
129
|
.global,
|
|
130
|
+
};
|
|
131
|
+
// Only update if the ID changed or if we don't have a document yet
|
|
132
|
+
setRfpDocument((prev) => {
|
|
133
|
+
if (!prev || prev.header.id !== newRfpDocument.header.id) {
|
|
134
|
+
return newRfpDocument;
|
|
135
|
+
}
|
|
136
|
+
// Update if the document content changed
|
|
137
|
+
if (JSON.stringify(prev.document) !==
|
|
138
|
+
JSON.stringify(newRfpDocument.document)) {
|
|
139
|
+
return newRfpDocument;
|
|
140
|
+
}
|
|
141
|
+
return prev;
|
|
96
142
|
});
|
|
97
143
|
}
|
|
98
144
|
else if (!rfpDocumentNode ||
|
|
99
|
-
!rfpDocumentNode.id ||
|
|
100
|
-
rfpDocumentNode.id === "") {
|
|
101
|
-
setRfpDocument(undefined);
|
|
145
|
+
!rfpDocumentNode.header.id ||
|
|
146
|
+
rfpDocumentNode.header.id === "") {
|
|
147
|
+
setRfpDocument((prev) => (prev === undefined ? prev : undefined));
|
|
102
148
|
}
|
|
103
|
-
}, [rfpDocumentNode, rfpDocumentDataState
|
|
149
|
+
}, [rfpDocumentNode, rfpDocumentDataState]);
|
|
104
150
|
const searchRfpDocuments = (userInput) => {
|
|
105
|
-
const results =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return results
|
|
110
|
-
value: doc.id,
|
|
111
|
-
title: doc.name,
|
|
112
|
-
path:
|
|
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())));
|
|
155
|
+
return results?.map((doc) => ({
|
|
156
|
+
value: doc.header.id,
|
|
157
|
+
title: doc.header.name,
|
|
158
|
+
path: "",
|
|
159
|
+
}));
|
|
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: "",
|
|
113
185
|
}));
|
|
114
186
|
};
|
|
115
187
|
// Handle workstream field changes
|
|
@@ -200,8 +272,8 @@ export default function Editor(props) {
|
|
|
200
272
|
return false;
|
|
201
273
|
},
|
|
202
274
|
renderCell: (value, context) => {
|
|
203
|
-
if (value ===
|
|
204
|
-
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" }));
|
|
205
277
|
}
|
|
206
278
|
return _jsx("div", { className: "text-left", children: value });
|
|
207
279
|
},
|
|
@@ -209,6 +281,7 @@ export default function Editor(props) {
|
|
|
209
281
|
{
|
|
210
282
|
field: "sow",
|
|
211
283
|
title: "SOW",
|
|
284
|
+
type: "oid",
|
|
212
285
|
editable: true,
|
|
213
286
|
align: "center",
|
|
214
287
|
onSave: (newValue, context) => {
|
|
@@ -225,6 +298,7 @@ export default function Editor(props) {
|
|
|
225
298
|
{
|
|
226
299
|
field: "paymentTerms",
|
|
227
300
|
title: "Payment Terms",
|
|
301
|
+
type: "oid",
|
|
228
302
|
editable: true,
|
|
229
303
|
align: "center",
|
|
230
304
|
onSave: (newValue, context) => {
|
|
@@ -241,25 +315,33 @@ export default function Editor(props) {
|
|
|
241
315
|
{
|
|
242
316
|
field: "status",
|
|
243
317
|
title: "Status",
|
|
244
|
-
editable:
|
|
318
|
+
editable: true,
|
|
245
319
|
align: "center",
|
|
246
|
-
|
|
247
|
-
|
|
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) => {
|
|
248
342
|
if (!value)
|
|
249
343
|
return null;
|
|
250
|
-
return (_jsx(
|
|
251
|
-
{ value: "DRAFT", label: "Draft" },
|
|
252
|
-
{ value: "SUBMITTED", label: "Submitted" },
|
|
253
|
-
{ value: "ACCEPTED", label: "Accepted" },
|
|
254
|
-
{ value: "REJECTED", label: "Rejected" },
|
|
255
|
-
], value: value || "DRAFT", onChange: (value) => {
|
|
256
|
-
if (value !== value) {
|
|
257
|
-
dispatch(actions.editAlternativeProposal({
|
|
258
|
-
id: context.row.id,
|
|
259
|
-
status: value,
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
|
-
} }));
|
|
344
|
+
return (_jsx("div", { className: `text-center ${statusStyles[value]}`, children: value }));
|
|
263
345
|
},
|
|
264
346
|
},
|
|
265
347
|
], []);
|
|
@@ -283,7 +365,7 @@ export default function Editor(props) {
|
|
|
283
365
|
if (e.target.value !== state.client?.icon) {
|
|
284
366
|
handleClientChange("icon", e.target.value);
|
|
285
367
|
}
|
|
286
|
-
}, 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) => {
|
|
287
369
|
if (e.target.value !== state.rfp?.id) {
|
|
288
370
|
dispatch(actions.setRequestForProposal({
|
|
289
371
|
rfpId: e.target.value,
|
|
@@ -293,11 +375,11 @@ export default function Editor(props) {
|
|
|
293
375
|
},
|
|
294
376
|
// search options as the user types
|
|
295
377
|
fetchOptionsCallback: async (userInput) => {
|
|
296
|
-
const results = searchRfpDocuments(userInput);
|
|
297
|
-
if (results
|
|
378
|
+
const results = searchRfpDocuments(userInput || "") || [];
|
|
379
|
+
if (results?.length === 0) {
|
|
298
380
|
return Promise.reject(new Error("No RFP documents found"));
|
|
299
381
|
}
|
|
300
|
-
return results
|
|
382
|
+
return results?.map((doc) => ({
|
|
301
383
|
value: doc.value, // unique document ID
|
|
302
384
|
title: doc.title, // document title or name
|
|
303
385
|
path: {
|
|
@@ -311,7 +393,7 @@ export default function Editor(props) {
|
|
|
311
393
|
// get details of a specific option by its ID/value
|
|
312
394
|
fetchSelectedOptionCallback: async (documentId) => {
|
|
313
395
|
console.log("fetching selected option", documentId);
|
|
314
|
-
const
|
|
396
|
+
const doc = searchRfpDocuments(documentId)?.[0];
|
|
315
397
|
if (!doc) {
|
|
316
398
|
return Promise.reject(new Error("RFP document not found"));
|
|
317
399
|
}
|
|
@@ -327,17 +409,18 @@ export default function Editor(props) {
|
|
|
327
409
|
};
|
|
328
410
|
}, initialOptions: [
|
|
329
411
|
{
|
|
330
|
-
value: rfpDocument.id,
|
|
412
|
+
value: rfpDocument.header.id,
|
|
331
413
|
title: rfpDocument.document.title,
|
|
332
414
|
path: {
|
|
333
415
|
text: rfpDocument.document.title,
|
|
334
|
-
url: rfpDocument.id,
|
|
416
|
+
url: rfpDocument.header.id,
|
|
335
417
|
},
|
|
336
418
|
description: "",
|
|
337
419
|
icon: "File",
|
|
338
420
|
},
|
|
339
421
|
] }) }), _jsx("div", { className: "flex items-center", children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(Icon, { className: "hover:cursor-pointer hover:bg-gray-500", name: "Moved", size: 18, onClick: () => {
|
|
340
|
-
setActiveDocumentId(
|
|
422
|
+
setActiveDocumentId(rfpDocument?.header.id);
|
|
423
|
+
setActiveSidebarNodeId(`editor-${rfpDocument?.header.id}`);
|
|
341
424
|
} }), _jsx("span", { children: "RFP Editor" })] }) })] })] })) : (_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" }), _jsx("div", { className: "mt-4", children: _jsx(Button, { color: "light", size: "small", className: "cursor-pointer hover:bg-gray-600 hover:text-white", title: "Save Workstream", "aria-description": "Save Workstream", onClick: async () => {
|
|
342
425
|
const createdNode = await createRfpDocument();
|
|
343
426
|
if (createdNode) {
|
|
@@ -362,20 +445,74 @@ export default function Editor(props) {
|
|
|
362
445
|
},
|
|
363
446
|
}));
|
|
364
447
|
}
|
|
365
|
-
} }) }),
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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) => {
|
|
372
461
|
if (e.target.value !== state.initialProposal?.sow) {
|
|
373
462
|
dispatch(actions.editInitialProposal({
|
|
374
463
|
id: state.initialProposal?.id || "",
|
|
375
464
|
sowId: e.target.value,
|
|
376
465
|
}));
|
|
377
466
|
}
|
|
378
|
-
}
|
|
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 () => {
|
|
379
516
|
console.log("Creating sow");
|
|
380
517
|
const createdNode = await createSowDocument();
|
|
381
518
|
if (createdNode) {
|
|
@@ -386,20 +523,65 @@ export default function Editor(props) {
|
|
|
386
523
|
sowId: createdNode.id,
|
|
387
524
|
}));
|
|
388
525
|
}
|
|
389
|
-
}, children: "Create sow" })] }), _jsxs("div", { className: "flex-1", children: [_jsx(
|
|
390
|
-
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 ||
|
|
391
527
|
state.initialProposal?.paymentTerms ||
|
|
392
|
-
"",
|
|
393
|
-
setManualPaymentTermsInput(e.target.value);
|
|
394
|
-
setNewlyCreatedPaymentTermsId(null); // Clear newly created ID when user starts typing
|
|
395
|
-
}, onBlur: (e) => {
|
|
528
|
+
"", onBlur: (e) => {
|
|
396
529
|
if (e.target.value !== state.initialProposal?.paymentTerms) {
|
|
397
530
|
dispatch(actions.editInitialProposal({
|
|
398
531
|
id: state.initialProposal?.id || "",
|
|
399
532
|
paymentTermsId: e.target.value,
|
|
400
533
|
}));
|
|
401
534
|
}
|
|
402
|
-
}
|
|
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 () => {
|
|
403
585
|
console.log("Creating payment terms");
|
|
404
586
|
const createdNode = await createPaymentTermsDocument();
|
|
405
587
|
if (createdNode) {
|
|
@@ -410,19 +592,7 @@ export default function Editor(props) {
|
|
|
410
592
|
paymentTermsId: createdNode.id,
|
|
411
593
|
}));
|
|
412
594
|
}
|
|
413
|
-
}, children: "Create Payment Terms" })] }),
|
|
414
|
-
{ value: "DRAFT", label: "Draft" },
|
|
415
|
-
{ value: "SUBMITTED", label: "Submitted" },
|
|
416
|
-
{ value: "ACCEPTED", label: "Accepted" },
|
|
417
|
-
{ value: "REJECTED", label: "Rejected" },
|
|
418
|
-
], value: state.initialProposal.status || "DRAFT", onChange: (value) => {
|
|
419
|
-
if (value !== state.initialProposal.status) {
|
|
420
|
-
dispatch(actions.editInitialProposal({
|
|
421
|
-
id: state.initialProposal.id,
|
|
422
|
-
status: value,
|
|
423
|
-
}));
|
|
424
|
-
}
|
|
425
|
-
} }) })] }), _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) => {
|
|
426
596
|
if (data.length > 0) {
|
|
427
597
|
data.forEach((d) => {
|
|
428
598
|
dispatch(actions.removeAlternativeProposal({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/workstream/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/workstream/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/style.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.1.
|
|
1
|
+
/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -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
|
}
|
|
@@ -1182,11 +1212,6 @@
|
|
|
1182
1212
|
}
|
|
1183
1213
|
}
|
|
1184
1214
|
}
|
|
1185
|
-
.\[\&_\.sidebar\\\\_\\\\_item--active\]\:bg-yellow-500 {
|
|
1186
|
-
& .sidebar\_\_item--active {
|
|
1187
|
-
background-color: var(--color-yellow-500);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
1215
|
}
|
|
1191
1216
|
/*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
|
|
1192
1217
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|