@topconsultnpm/sdkui-react 6.19.0-dev1.59 → 6.19.0-dev1.60
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/lib/components/features/documents/TMDcmtBlog.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtBlog.js +3 -24
- package/lib/components/features/documents/TMDcmtForm.js +28 -2
- package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/search/TMSearchResult.js +21 -1
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +2 -1
- package/lib/components/features/tasks/TMTasksPanelContent.js +2 -2
- package/lib/components/features/tasks/TMTasksView.d.ts +2 -1
- package/lib/components/features/tasks/TMTasksView.js +7 -1
- package/package.json +1 -1
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
interface ITMDcmtBlogProps {
|
|
4
|
+
blogsDatasource: HomeBlogPost[];
|
|
5
|
+
setBlogsDatasource: (posts: HomeBlogPost[]) => void;
|
|
6
|
+
hasLoadedDataOnce: boolean;
|
|
7
|
+
setHasLoadedDataOnce: (loaded: boolean) => void;
|
|
8
|
+
lastLoadedDid: number | undefined;
|
|
9
|
+
setLastLoadedDid: (did: number | undefined) => void;
|
|
4
10
|
tid: number | undefined;
|
|
5
11
|
did: number | undefined;
|
|
12
|
+
fetchBlogDataAsync: (tid: number | undefined, did: number | undefined) => Promise<void>;
|
|
6
13
|
isVisible?: boolean;
|
|
7
14
|
allTasks?: Array<TaskDescriptor>;
|
|
8
15
|
getAllTasks?: () => Promise<void>;
|
|
@@ -2,38 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
|
-
import TMSpinner from '../../base/TMSpinner';
|
|
7
5
|
import { TMNothingToShow } from './TMDcmtPreview';
|
|
8
6
|
import { IconBoard, SDKUI_Localizator } from '../../../helper';
|
|
9
7
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
10
8
|
import TMBlogsPost from '../../grids/TMBlogsPost';
|
|
11
|
-
const TMDcmtBlog = ({ tid, did, isVisible, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
12
|
-
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
13
|
-
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
14
|
-
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
9
|
+
const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, setHasLoadedDataOnce, lastLoadedDid, setLastLoadedDid, tid, did, fetchBlogDataAsync, isVisible, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
15
10
|
// State to manage show comment form selected file
|
|
16
11
|
const [showCommentForm, setShowCommentForm] = useState(false);
|
|
17
12
|
const [externalBlogPost, setExternalBlogPost] = useState(undefined);
|
|
18
13
|
const showCommentFormCallback = useCallback(() => {
|
|
19
14
|
setShowCommentForm(true);
|
|
20
15
|
}, []);
|
|
21
|
-
const fetchDataAsync = async (tid, did) => {
|
|
22
|
-
try {
|
|
23
|
-
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
24
|
-
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
25
|
-
setBlogsDatasource(res ?? []);
|
|
26
|
-
setHasLoadedDataOnce(true);
|
|
27
|
-
setLastLoadedDid(did);
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
let err = e;
|
|
31
|
-
TMExceptionBoxManager.show({ exception: err });
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
TMSpinner.hide();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
16
|
useEffect(() => {
|
|
38
17
|
if (!tid || !did) {
|
|
39
18
|
setBlogsDatasource([]);
|
|
@@ -47,11 +26,11 @@ const TMDcmtBlog = ({ tid, did, isVisible, allTasks = [], getAllTasks, deleteTas
|
|
|
47
26
|
// Esegui la chiamata API solo se il pannello è visibile E i dati non sono già stati caricati
|
|
48
27
|
// O, se vuoi ricaricare ogni volta che diventa visibile (ma è meno efficiente per "pesante")
|
|
49
28
|
if (shouldFetch) {
|
|
50
|
-
|
|
29
|
+
fetchBlogDataAsync(tid, did);
|
|
51
30
|
}
|
|
52
31
|
}, [tid, did, isVisible, hasLoadedDataOnce, lastLoadedDid]);
|
|
53
32
|
const refreshCallback = async () => {
|
|
54
|
-
await
|
|
33
|
+
await fetchBlogDataAsync(tid, did);
|
|
55
34
|
};
|
|
56
35
|
const resetExternalBlogPost = useCallback(() => {
|
|
57
36
|
setExternalBlogPost(undefined);
|
|
@@ -93,6 +93,10 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
93
93
|
const [isInitialLoading, setIsInitialLoading] = useState(true);
|
|
94
94
|
const [isNavigating, setIsNavigating] = useState(false);
|
|
95
95
|
const [dcmtReferences, setDcmtReferences] = useState(undefined);
|
|
96
|
+
// Dcmt Blog states
|
|
97
|
+
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
98
|
+
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
99
|
+
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
96
100
|
useEffect(() => {
|
|
97
101
|
if (!allowButtonsRefs)
|
|
98
102
|
setDcmtReferences(undefined);
|
|
@@ -778,6 +782,28 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
778
782
|
setShowAll(true);
|
|
779
783
|
}
|
|
780
784
|
}, [shouldShowAll, showAll]);
|
|
785
|
+
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
786
|
+
try {
|
|
787
|
+
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
788
|
+
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
789
|
+
setBlogsDatasource(res ?? []);
|
|
790
|
+
setHasLoadedDataOnce(true);
|
|
791
|
+
setLastLoadedDid(did);
|
|
792
|
+
}
|
|
793
|
+
catch (e) {
|
|
794
|
+
let err = e;
|
|
795
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
796
|
+
}
|
|
797
|
+
finally {
|
|
798
|
+
TMSpinner.hide();
|
|
799
|
+
}
|
|
800
|
+
}, []);
|
|
801
|
+
const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
|
|
802
|
+
const shouldRefresh = forceRefresh || (task && task.state === Task_States.Completed) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
803
|
+
if (TID && DID && shouldRefresh) {
|
|
804
|
+
await fetchBlogDataAsync(TID, DID);
|
|
805
|
+
}
|
|
806
|
+
}, [TID, DID]);
|
|
781
807
|
const tmDcmtForm = useMemo(() => {
|
|
782
808
|
return _jsx(_Fragment, { children: metadataValuesSource.length > 0 &&
|
|
783
809
|
_jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
@@ -827,7 +853,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
827
853
|
handleUndo,
|
|
828
854
|
handleClearForm
|
|
829
855
|
]);
|
|
830
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks]);
|
|
856
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { blogsDatasource: blogsDatasource, hasLoadedDataOnce: hasLoadedDataOnce, lastLoadedDid: lastLoadedDid, setBlogsDatasource: setBlogsDatasource, setHasLoadedDataOnce: setHasLoadedDataOnce, setLastLoadedDid: setLastLoadedDid, fetchBlogDataAsync: fetchBlogDataAsync, tid: TID, did: DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [blogsDatasource, hasLoadedDataOnce, lastLoadedDid, TID, DID, allTasks]);
|
|
831
857
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
832
858
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
|
|
833
859
|
setDcmtFile(file);
|
|
@@ -882,7 +908,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
882
908
|
did: Number(DID),
|
|
883
909
|
name: fromDTD?.nameLoc ?? SDKUI_Localizator.Widget_Activities,
|
|
884
910
|
},
|
|
885
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback }));
|
|
911
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, afterTaskSaved: afterTaskSaved }));
|
|
886
912
|
}, [allTasks, TID, DID, fromDTD]);
|
|
887
913
|
const normalizedTID = TID !== undefined ? Number(TID) : undefined;
|
|
888
914
|
const defaultPanelDimensions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskContext } from "../../../ts";
|
|
1
|
+
import { FormModes, TaskContext } from "../../../ts";
|
|
2
2
|
import { TaskDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
interface TMDcmtTasksProps {
|
|
4
4
|
taskContext: TaskContext;
|
|
@@ -7,6 +7,7 @@ interface TMDcmtTasksProps {
|
|
|
7
7
|
deleteTaskByIdsCallback: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
8
8
|
addTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
9
9
|
editTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
afterTaskSaved: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
|
|
10
11
|
}
|
|
11
12
|
declare const TMDcmtTasks: (props: TMDcmtTasksProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default TMDcmtTasks;
|
|
@@ -6,7 +6,7 @@ import { useTMPanelManagerContext } from "../../layout/panelManager/TMPanelManag
|
|
|
6
6
|
import TMPanel from "../../base/TMPanel";
|
|
7
7
|
import TMTasksPanelContent from "../tasks/TMTasksPanelContent";
|
|
8
8
|
const TMDcmtTasks = (props) => {
|
|
9
|
-
const { taskContext, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback } = props;
|
|
9
|
+
const { taskContext, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, afterTaskSaved } = props;
|
|
10
10
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
11
11
|
const deviceType = useDeviceType();
|
|
12
12
|
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
@@ -19,6 +19,6 @@ const TMDcmtTasks = (props) => {
|
|
|
19
19
|
text: SDKUI_Localizator.Refresh,
|
|
20
20
|
},
|
|
21
21
|
] })] }), []);
|
|
22
|
-
return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: () => { return Promise.resolve(); }, handleNavigateToDossiers: () => { return Promise.resolve(); } }) }) });
|
|
22
|
+
return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: () => { return Promise.resolve(); }, handleNavigateToDossiers: () => { return Promise.resolve(); }, afterTaskSaved: afterTaskSaved }) }) });
|
|
23
23
|
};
|
|
24
24
|
export default TMDcmtTasks;
|
|
@@ -101,6 +101,10 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
101
101
|
const disableSignApproveDisable = selectedDocs.length !== 1 || (selectedDocs.length === 1 && selectedDocs[0].FILEEXT === null);
|
|
102
102
|
const dcmtsReturned = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsReturned : searchResults[0]?.dcmtsReturned ?? 0);
|
|
103
103
|
const dcmtsFound = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsFound : searchResults[0]?.dcmtsFound ?? 0);
|
|
104
|
+
// Dcmt Blog states
|
|
105
|
+
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
106
|
+
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
107
|
+
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
104
108
|
useEffect(() => { setID(genUniqueId()); }, []);
|
|
105
109
|
useEffect(() => {
|
|
106
110
|
setSelectedItems([]);
|
|
@@ -471,6 +475,22 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
471
475
|
const handleRemoveItem = (tid, did) => {
|
|
472
476
|
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
473
477
|
};
|
|
478
|
+
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
479
|
+
try {
|
|
480
|
+
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
481
|
+
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
482
|
+
setBlogsDatasource(res ?? []);
|
|
483
|
+
setHasLoadedDataOnce(true);
|
|
484
|
+
setLastLoadedDid(did);
|
|
485
|
+
}
|
|
486
|
+
catch (e) {
|
|
487
|
+
let err = e;
|
|
488
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
TMSpinner.hide();
|
|
492
|
+
}
|
|
493
|
+
}, []);
|
|
474
494
|
const showToppyForApprove = (isVisible && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isOpenDcmtForm && !isOpenDetails && !isOpenMaster);
|
|
475
495
|
const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
|
|
476
496
|
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
@@ -591,7 +611,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
591
611
|
sharedDcmtFile,
|
|
592
612
|
onRefreshSearchAsync
|
|
593
613
|
]);
|
|
594
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks]);
|
|
614
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { blogsDatasource: blogsDatasource, hasLoadedDataOnce: hasLoadedDataOnce, lastLoadedDid: lastLoadedDid, setBlogsDatasource: setBlogsDatasource, setHasLoadedDataOnce: setHasLoadedDataOnce, setLastLoadedDid: setLastLoadedDid, fetchBlogDataAsync: fetchBlogDataAsync, tid: focusedItem?.TID, did: focusedItem?.DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks]);
|
|
595
615
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
|
|
596
616
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }), [currentDcmt]);
|
|
597
617
|
const allInitialPanelVisibility = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HomeBlogPost, TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
-
import { DcmtInfo, TaskContext } from "../../../ts";
|
|
3
|
+
import { DcmtInfo, FormModes, TaskContext } from "../../../ts";
|
|
4
4
|
interface TMTasksPanelContentProps {
|
|
5
5
|
id: string;
|
|
6
6
|
allTasks: Array<TaskDescriptor>;
|
|
@@ -14,6 +14,7 @@ interface TMTasksPanelContentProps {
|
|
|
14
14
|
usersList?: Array<UserDescriptor>;
|
|
15
15
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
|
|
16
16
|
s4TViewerDialogComponent?: React.ReactNode;
|
|
17
|
+
afterTaskSaved?: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
declare const TMTasksPanelContent: (props: TMTasksPanelContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export default TMTasksPanelContent;
|
|
@@ -7,7 +7,7 @@ import TMTasksView from "./TMTasksView";
|
|
|
7
7
|
import TMTasksHeader from "./TMTasksHeader";
|
|
8
8
|
const TMTasksPanelContent = (props) => {
|
|
9
9
|
// Destructure the common props
|
|
10
|
-
const { id, handleNavigateToWGs, handleNavigateToDossiers, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent } = props;
|
|
10
|
+
const { id, handleNavigateToWGs, handleNavigateToDossiers, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, afterTaskSaved } = props;
|
|
11
11
|
// activeComponent holds the current task view type, which is determined based on the `layout` prop
|
|
12
12
|
const [activeComponent, setActiveComponent] = useState(TaskView.LIST_TASK);
|
|
13
13
|
// State to store clicked task to process for editing
|
|
@@ -60,6 +60,6 @@ const TMTasksPanelContent = (props) => {
|
|
|
60
60
|
const updateActiveComponent = useCallback((newComponent) => {
|
|
61
61
|
setActiveComponent(newComponent);
|
|
62
62
|
}, []);
|
|
63
|
-
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx(TMTasksHeader, { height: "55px", activeComponent: activeComponent, updateActiveComponent: updateActiveComponent, allTasks: contextualTasks, appliedGlobalFilters: appliedGlobalFilters, setAppliedGlobalFilters: setAppliedGlobalFilters }), _jsx("div", { style: { width: "100%", height: "calc(100% - 55px)" }, children: _jsx(TMTasksView, { id: id, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, currentTask: currentTask, setCurrentTask: setCurrentTask, visualizedTasks: visualizedTasks, activeComponent: activeComponent, activeTabIndex: activeTabIndex, setActiveTabIndex: setActiveTabIndex, assignedToMeCount: assignedToMeCount, assignedByMeCount: assignedByMeCount, allTasksFilteredCount: allTasksFilteredCount, showId: showId, setShowId: setShowId, showSearch: showSearch, setShowSearch: setShowSearch, showContextualWG: showContextualWG, setShowContextualWG: setShowContextualWG, showContextualDossier: showContextualDossier, setShowContextualDossier: setShowContextualDossier, showContextualDocument: showContextualDocument, setShowContextualDocument: setShowContextualDocument, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, taskContext: taskContext, usersList: usersList, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent }) })] });
|
|
63
|
+
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx(TMTasksHeader, { height: "55px", activeComponent: activeComponent, updateActiveComponent: updateActiveComponent, allTasks: contextualTasks, appliedGlobalFilters: appliedGlobalFilters, setAppliedGlobalFilters: setAppliedGlobalFilters }), _jsx("div", { style: { width: "100%", height: "calc(100% - 55px)" }, children: _jsx(TMTasksView, { id: id, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, currentTask: currentTask, setCurrentTask: setCurrentTask, visualizedTasks: visualizedTasks, activeComponent: activeComponent, activeTabIndex: activeTabIndex, setActiveTabIndex: setActiveTabIndex, assignedToMeCount: assignedToMeCount, assignedByMeCount: assignedByMeCount, allTasksFilteredCount: allTasksFilteredCount, showId: showId, setShowId: setShowId, showSearch: showSearch, setShowSearch: setShowSearch, showContextualWG: showContextualWG, setShowContextualWG: setShowContextualWG, showContextualDossier: showContextualDossier, setShowContextualDossier: setShowContextualDossier, showContextualDocument: showContextualDocument, setShowContextualDocument: setShowContextualDocument, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, taskContext: taskContext, usersList: usersList, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, afterTaskSaved: afterTaskSaved }) })] });
|
|
64
64
|
};
|
|
65
65
|
export default TMTasksPanelContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AssignedTab, TaskViewType } from "./TMTasksUtils";
|
|
3
3
|
import { HomeBlogPost, TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { DcmtInfo, TaskContext } from "../../../ts";
|
|
4
|
+
import { DcmtInfo, FormModes, TaskContext } from "../../../ts";
|
|
5
5
|
interface TMTasksViewProps {
|
|
6
6
|
id: string;
|
|
7
7
|
allTasks: Array<TaskDescriptor>;
|
|
@@ -34,6 +34,7 @@ interface TMTasksViewProps {
|
|
|
34
34
|
usersList?: Array<UserDescriptor>;
|
|
35
35
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
|
|
36
36
|
s4TViewerDialogComponent?: React.ReactNode;
|
|
37
|
+
afterTaskSaved?: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
|
|
37
38
|
}
|
|
38
39
|
declare const TMTasksView: (props: TMTasksViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
40
|
export default TMTasksView;
|
|
@@ -19,7 +19,7 @@ import TMTasksAgenda from "./TMTasksAgenda";
|
|
|
19
19
|
import TMTaskForm from "./TMTaskForm";
|
|
20
20
|
let abortController = new AbortController();
|
|
21
21
|
const TMTasksView = (props) => {
|
|
22
|
-
const { id, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, visualizedTasks, activeComponent, activeTabIndex, setActiveTabIndex, currentTask, setCurrentTask, assignedToMeCount, assignedByMeCount, allTasksFilteredCount, showId, setShowId, showSearch, setShowSearch, showContextualWG, setShowContextualWG, showContextualDossier, setShowContextualDossier, showContextualDocument, setShowContextualDocument, handleNavigateToWGs, handleNavigateToDossiers, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent } = props;
|
|
22
|
+
const { id, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, visualizedTasks, activeComponent, activeTabIndex, setActiveTabIndex, currentTask, setCurrentTask, assignedToMeCount, assignedByMeCount, allTasksFilteredCount, showId, setShowId, showSearch, setShowSearch, showContextualWG, setShowContextualWG, showContextualDossier, setShowContextualDossier, showContextualDocument, setShowContextualDocument, handleNavigateToWGs, handleNavigateToDossiers, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, afterTaskSaved, } = props;
|
|
23
23
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
24
24
|
const deviceType = useDeviceType();
|
|
25
25
|
// State to manage show comment form selected file
|
|
@@ -259,6 +259,9 @@ const TMTasksView = (props) => {
|
|
|
259
259
|
setWaitPanelValuePrimary(0);
|
|
260
260
|
setShowWaitPanel(false);
|
|
261
261
|
TMResultManager.show(result, SDKUI_Localizator.MarkAs, "ID", undefined);
|
|
262
|
+
if (afterTaskSaved) {
|
|
263
|
+
afterTaskSaved(undefined, undefined, true);
|
|
264
|
+
}
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
267
|
});
|
|
@@ -287,6 +290,9 @@ const TMTasksView = (props) => {
|
|
|
287
290
|
else {
|
|
288
291
|
await editTaskCallback(task);
|
|
289
292
|
}
|
|
293
|
+
if (afterTaskSaved) {
|
|
294
|
+
await afterTaskSaved(task, formMode);
|
|
295
|
+
}
|
|
290
296
|
setShowTaskForm(false);
|
|
291
297
|
};
|
|
292
298
|
const handleNavigateToDossiersWrapper = useCallback(async (dossierId) => {
|