@topconsultnpm/sdkui-react 6.20.0 → 6.21.0-dev1.3
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/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +8 -3
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/features/archive/TMArchive.d.ts +1 -1
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +42 -34
- package/lib/components/features/documents/TMDcmtForm.js +280 -639
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +27 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +160 -18
- package/lib/components/features/documents/TMRelationViewer.d.ts +6 -0
- package/lib/components/features/documents/TMRelationViewer.js +7 -5
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchResult.d.ts +27 -26
- package/lib/components/features/search/TMSearchResult.js +349 -486
- package/lib/components/features/tasks/TMTaskForm.d.ts +2 -1
- package/lib/components/features/tasks/TMTaskForm.js +2 -2
- package/lib/helper/checkinCheckoutManager.js +6 -2
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +2 -2
- package/lib/hooks/useDocumentOperations.d.ts +139 -0
- package/lib/hooks/useDocumentOperations.js +1309 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +55 -55
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -758
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
4
|
+
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { FormModes, SearchResultContext } from '../../../ts';
|
|
7
6
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
8
|
-
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
9
|
-
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
10
7
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
11
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys,
|
|
12
|
-
import { hasDetailRelations, hasMasterRelations
|
|
8
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconActivity, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, buildWorkItemsFromWFCtrl, IconLock, getDcmtFormToolbarVisibility, taskModalSizes } from '../../../helper';
|
|
9
|
+
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
|
13
10
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
14
|
-
import {
|
|
11
|
+
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
15
12
|
import ShowAlert from '../../base/TMAlert';
|
|
16
13
|
import TMButton from '../../base/TMButton';
|
|
17
14
|
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
|
@@ -23,12 +20,8 @@ import TMMetadataValues, { AdvancedMenuButtons } from '../../editors/TMMetadataV
|
|
|
23
20
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext, TMSaveFormButtonSave, TMSaveFormButtonUndo } from '../../forms/TMSaveForm';
|
|
24
21
|
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
|
25
22
|
import TMFileUploader from '../../features/documents/TMFileUploader';
|
|
26
|
-
import TMMasterDetailDcmts from './TMMasterDetailDcmts';
|
|
27
23
|
import TMDcmtBlog from './TMDcmtBlog';
|
|
28
|
-
import { useInputAttachmentsDialog } from '../../../hooks/useInputDialog';
|
|
29
24
|
import TMModal from '../../base/TMModal';
|
|
30
|
-
import TMChooserForm from '../../forms/TMChooserForm';
|
|
31
|
-
import TMSearchResult from '../search/TMSearchResult';
|
|
32
25
|
import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
33
26
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
34
27
|
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
@@ -40,13 +33,12 @@ import TMDcmtTasks from './TMDcmtTasks';
|
|
|
40
33
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
41
34
|
import { getTaskAssignedByMe, getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
42
35
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
43
|
-
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
44
|
-
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
45
|
-
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
46
36
|
import styled from 'styled-components';
|
|
47
37
|
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
48
38
|
import TMToppyDraggableHelpCenter from '../assistant/TMToppyDraggableHelpCenter';
|
|
49
39
|
import TMTaskForm from '../tasks/TMTaskForm';
|
|
40
|
+
import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
41
|
+
import TMDcmtFormActionButtons from './TMDcmtFormActionButtons';
|
|
50
42
|
//#region Interfaces, Types and Enums
|
|
51
43
|
/**
|
|
52
44
|
* Definisce il contesto da cui è stato invocato il TMDcmtForm.
|
|
@@ -65,8 +57,9 @@ export var InvocationContext;
|
|
|
65
57
|
let abortControllerLocal = new AbortController();
|
|
66
58
|
;
|
|
67
59
|
//#endregion
|
|
68
|
-
const TMDcmtForm = ({
|
|
69
|
-
const {
|
|
60
|
+
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, isModal = false, titleModal, widthModal = "100%", heightModal = "100%", allowNavigation = true, canNext, canPrev, count, itemIndex, onNext, onPrev, inputFile = null, inputMids = [], connectorFileSave = undefined, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowRelations = true, allowButtonsRefs = false, openS4TViewer = false, enableDragDropOverlay = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, datagridUtility }) => {
|
|
61
|
+
const { onRefreshSearchAsyncDatagrid, onRefreshBlogDatagrid, onRefreshPreviewDatagrid } = datagridUtility || {};
|
|
62
|
+
const floatingBarContainerRef = useRef(null);
|
|
70
63
|
const [id, setID] = useState('');
|
|
71
64
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
72
65
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -83,10 +76,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
83
76
|
const [formDataOrig, setFormDataOrig] = useState([]);
|
|
84
77
|
const [validationItems, setValidationItems] = useState([]);
|
|
85
78
|
const [fromDTD, setFromDTD] = useState();
|
|
86
|
-
const [showApprovePopup, setShowApprovePopup] = useState(false);
|
|
87
|
-
const [showRejectPopup, setShowRejectPopup] = useState(false);
|
|
88
|
-
const [showReAssignPopup, setShowReAssignPopup] = useState(false);
|
|
89
|
-
const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
|
|
90
79
|
const [showMoreInfoTaskPopup, setShowMoreInfoTaskPopup] = useState(false);
|
|
91
80
|
const [showMoreInfoTaskTask, setShowMoreInfoTaskTask] = useState(undefined);
|
|
92
81
|
const [layout, setLayout] = useState();
|
|
@@ -102,9 +91,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
102
91
|
const formDataRef = useRef([]);
|
|
103
92
|
const fromDTDRef = useRef();
|
|
104
93
|
const dcmtFileRef = useRef(null);
|
|
105
|
-
const [isOpenDetails, setIsOpenDetails] = useState(false);
|
|
106
|
-
const [isOpenMaster, setIsOpenMaster] = useState(false);
|
|
107
|
-
const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
|
|
108
94
|
const [isOpenDistinctValues, setIsOpenDistinctValues] = useState(false);
|
|
109
95
|
const [isOpenFormulaEditor, setIsOpenFormulaEditor] = useState(false);
|
|
110
96
|
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
|
@@ -124,72 +110,24 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
124
110
|
const [dcmtReferences, setDcmtReferences] = useState(undefined);
|
|
125
111
|
// Stato per triggerare il refresh del blog dall'esterno
|
|
126
112
|
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
113
|
+
// Stato per triggerare il refresh del blog dall'esterno
|
|
114
|
+
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
127
115
|
const [wfError, setWfError] = useState(null);
|
|
128
116
|
const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
|
|
117
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
118
|
+
const deviceType = useDeviceType();
|
|
119
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
120
|
+
const isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
121
|
+
const isApprView = useMemo(() => {
|
|
122
|
+
if (!fromDTD)
|
|
123
|
+
return false;
|
|
124
|
+
return isApprovalWorkflowView(fromDTD);
|
|
125
|
+
}, [fromDTD?.id]);
|
|
126
|
+
const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
|
|
129
127
|
const isReadOnlyOriginCallback = useCallback((fromTID) => {
|
|
130
128
|
return layoutMode !== LayoutModes.Ark && layoutMode !== LayoutModes.ArkFromBasket && layoutMode !== LayoutModes.ArkFromFile && layoutMode !== LayoutModes.ArkFromMail
|
|
131
129
|
&& fromTID?.toString() !== TID?.toString();
|
|
132
130
|
}, [layoutMode, TID]);
|
|
133
|
-
const triggerBlogRefresh = useCallback(async () => {
|
|
134
|
-
setRefreshBlogTrigger(prev => prev + 1);
|
|
135
|
-
}, []);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
const fetchAllUsers = async () => {
|
|
138
|
-
const users = await UserListCacheService.GetAllAsync();
|
|
139
|
-
setAllUsers(users ?? []);
|
|
140
|
-
};
|
|
141
|
-
fetchAllUsers();
|
|
142
|
-
}, []);
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
if (!allowButtonsRefs)
|
|
145
|
-
setDcmtReferences(undefined);
|
|
146
|
-
}, [allowButtonsRefs]);
|
|
147
|
-
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
148
|
-
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
|
|
149
|
-
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
150
|
-
const currentSearchResults = useMemo(() => {
|
|
151
|
-
if (!formData || formData.length === 0 || !TID || !DID)
|
|
152
|
-
return [];
|
|
153
|
-
const selectMIDs = [];
|
|
154
|
-
const rowValues = [];
|
|
155
|
-
formData.forEach(md => {
|
|
156
|
-
if (md.mid !== undefined) {
|
|
157
|
-
selectMIDs.push(md.mid);
|
|
158
|
-
rowValues.push(md.value);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const searchResult = {
|
|
162
|
-
fromTID: TID,
|
|
163
|
-
selectMIDs: selectMIDs,
|
|
164
|
-
dtdResult: {
|
|
165
|
-
rows: [rowValues],
|
|
166
|
-
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
167
|
-
},
|
|
168
|
-
dcmtsFound: 1,
|
|
169
|
-
dcmtsReturned: 1
|
|
170
|
-
};
|
|
171
|
-
return [searchResult];
|
|
172
|
-
}, [formData, TID, DID]);
|
|
173
|
-
const relatedDocuments = useRelatedDocuments({
|
|
174
|
-
selectedSearchResult: TID ? { fromTID: Number(TID) } : undefined,
|
|
175
|
-
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, rowIndex: 0 } : undefined,
|
|
176
|
-
currentSearchResults: currentSearchResults
|
|
177
|
-
});
|
|
178
|
-
const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showManyToManyChooser, manyToManyChooserDataSource, manyToManyRelations, isPairingManyToMany, showPairDcmtsModal, pairedSearchResults, pairFloatingActionConfig, hasManyToManyRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, archiveMasterDocuments, archiveDetailDocuments, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, archiveRelatedDcmtHandler, executeManyToManyPairing } = relatedDocuments;
|
|
179
|
-
const fetchErrorShownRef = useRef(false);
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
if (!TID)
|
|
182
|
-
return;
|
|
183
|
-
checkRelatedDcmtsArchiveCapability();
|
|
184
|
-
checkManyToManyCapability();
|
|
185
|
-
}, [TID, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
186
|
-
const deviceType = useDeviceType();
|
|
187
|
-
const getDcmts = useCallback(() => {
|
|
188
|
-
return [{ TID: currentDcmt?.tid, DID: currentDcmt?.did, FILEEXT: currentDcmt?.fileExt }];
|
|
189
|
-
}, [currentDcmt?.tid, currentDcmt?.did, currentDcmt?.fileExt]);
|
|
190
|
-
const handleReset = useCallback(() => {
|
|
191
|
-
setDcmtFile(null);
|
|
192
|
-
}, []);
|
|
193
131
|
const setMetadataList = useCallback(async (mdList, getMetadataResult = undefined, archived = false, currentDID) => {
|
|
194
132
|
try {
|
|
195
133
|
let did = currentDID ?? DID;
|
|
@@ -240,7 +178,64 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
240
178
|
TMSpinner.hide();
|
|
241
179
|
}
|
|
242
180
|
}, [TID, DID, layoutMode]);
|
|
243
|
-
|
|
181
|
+
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
182
|
+
const refreshMetadataAsync = useCallback(async () => {
|
|
183
|
+
let metadataResult = undefined;
|
|
184
|
+
let hasGetMetadataError = false;
|
|
185
|
+
try {
|
|
186
|
+
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
187
|
+
}
|
|
188
|
+
catch (metadataError) {
|
|
189
|
+
hasGetMetadataError = true;
|
|
190
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
191
|
+
let errorCode = undefined;
|
|
192
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
193
|
+
try {
|
|
194
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
195
|
+
errorCode = detailObj?.ErrorCode;
|
|
196
|
+
}
|
|
197
|
+
catch (parseError) {
|
|
198
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
202
|
+
if (errorCode === -5) {
|
|
203
|
+
TMMessageBoxManager.show({
|
|
204
|
+
message: SDKUI_Localizator.DcmtOutOfView,
|
|
205
|
+
buttons: [ButtonNames.OK],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
210
|
+
}
|
|
211
|
+
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
212
|
+
metadataResult = null;
|
|
213
|
+
}
|
|
214
|
+
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
215
|
+
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
216
|
+
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
217
|
+
}
|
|
218
|
+
return { success: !hasGetMetadataError, result: metadataResult };
|
|
219
|
+
}, [TID, DID, setMetadataList]);
|
|
220
|
+
const updateCurrentDcmt = useCallback(async () => {
|
|
221
|
+
try {
|
|
222
|
+
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
223
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
224
|
+
if (!success)
|
|
225
|
+
onClose?.();
|
|
226
|
+
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
TMSpinner.hide();
|
|
233
|
+
}
|
|
234
|
+
}, [refreshMetadataAsync, onClose]);
|
|
235
|
+
const handleReset = useCallback(() => {
|
|
236
|
+
setDcmtFile(null);
|
|
237
|
+
}, []);
|
|
238
|
+
const onRefreshSearchAsync = useCallback(async () => {
|
|
244
239
|
try {
|
|
245
240
|
setFetchError(false);
|
|
246
241
|
if (!TID)
|
|
@@ -305,6 +300,127 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
305
300
|
setIsNavigating(false);
|
|
306
301
|
}
|
|
307
302
|
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
303
|
+
const currentSearchResults = useMemo(() => {
|
|
304
|
+
if (!formData || formData.length === 0 || !TID || !DID)
|
|
305
|
+
return [];
|
|
306
|
+
const selectMIDs = [];
|
|
307
|
+
const rowValues = [];
|
|
308
|
+
formData.forEach(md => {
|
|
309
|
+
if (md.mid !== undefined) {
|
|
310
|
+
selectMIDs.push(md.mid);
|
|
311
|
+
rowValues.push(md.value);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
const searchResult = {
|
|
315
|
+
fromTID: TID,
|
|
316
|
+
selectMIDs: selectMIDs,
|
|
317
|
+
dtdResult: {
|
|
318
|
+
rows: [rowValues],
|
|
319
|
+
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
320
|
+
},
|
|
321
|
+
dcmtsFound: 1,
|
|
322
|
+
dcmtsReturned: 1
|
|
323
|
+
};
|
|
324
|
+
return [searchResult];
|
|
325
|
+
}, [formData, TID, DID]);
|
|
326
|
+
const triggerBlogRefresh = useCallback(async () => {
|
|
327
|
+
setRefreshBlogTrigger(prev => prev + 1);
|
|
328
|
+
}, []);
|
|
329
|
+
const triggerPreviewRefresh = useCallback(async () => {
|
|
330
|
+
setRefreshPreviewTrigger(prev => prev + 1);
|
|
331
|
+
}, []);
|
|
332
|
+
const openTaskFormHandler = (onTaskCreated) => {
|
|
333
|
+
if (!currentDcmt || !fromDTD)
|
|
334
|
+
return;
|
|
335
|
+
const item = { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt };
|
|
336
|
+
if (item.TID && item.DID) {
|
|
337
|
+
const name = `${fromDTD?.name ?? '-'} (DID: ${item.DID})`;
|
|
338
|
+
onTaskCreateRequest?.({ document: { tid: item.TID, did: item.DID, name } }, onTaskCreated);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const { operationItems, renderFloatingBar, renderDcmtOperations, features } = useDocumentOperations({
|
|
342
|
+
context: SearchResultContext.DCMT_FORM,
|
|
343
|
+
documentData: {
|
|
344
|
+
dtd: fromDTD,
|
|
345
|
+
selectedItems: currentDcmt ? [{ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 }] : [],
|
|
346
|
+
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 } : undefined,
|
|
347
|
+
searchResult: currentSearchResults ? currentSearchResults[0] : undefined,
|
|
348
|
+
currentSearchResults,
|
|
349
|
+
currentMetadataValues: formData,
|
|
350
|
+
allUsers,
|
|
351
|
+
datagridUtility: {
|
|
352
|
+
onRefreshBlogDatagrid,
|
|
353
|
+
onRefreshPreviewDatagrid,
|
|
354
|
+
},
|
|
355
|
+
dcmtUtility: {
|
|
356
|
+
approvalVID: workItems.length > 0 ? Number(workItems[0].tid) : -1,
|
|
357
|
+
dcmtDataRowForCicoStatus: formData,
|
|
358
|
+
selectedDcmtSearchResultRelations: TID ? { fromTID: Number(TID) } : undefined,
|
|
359
|
+
dcmtTIDHasDetailRelations: currentTIDHasDetailRelations,
|
|
360
|
+
dcmtTIDHasMasterRelations: currentTIDHasMasterRelations,
|
|
361
|
+
updateCurrentDcmt: updateCurrentDcmt,
|
|
362
|
+
onCloseDcmtForm: onClose,
|
|
363
|
+
onRefreshBlogForm: triggerBlogRefresh,
|
|
364
|
+
onRefreshPreviewForm: triggerPreviewRefresh,
|
|
365
|
+
taskFormDialogComponent,
|
|
366
|
+
s4TViewerDialogComponent,
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
uiConfig: {
|
|
370
|
+
floatingBarContainerRef,
|
|
371
|
+
customButtonsLayout,
|
|
372
|
+
openS4TViewer,
|
|
373
|
+
showDcmtFormSidebar,
|
|
374
|
+
allowFloatingBar: false,
|
|
375
|
+
enablePinIcons: false,
|
|
376
|
+
allowRelations,
|
|
377
|
+
inputDcmtFormLayoutMode: layoutMode,
|
|
378
|
+
},
|
|
379
|
+
tasks: {
|
|
380
|
+
allTasks: allTasks,
|
|
381
|
+
getAllTasks: getAllTasks,
|
|
382
|
+
deleteTaskByIdsCallback: deleteTaskByIdsCallback,
|
|
383
|
+
addTaskCallback: addTaskCallback,
|
|
384
|
+
editTaskCallback: editTaskCallback
|
|
385
|
+
},
|
|
386
|
+
callbacks: {
|
|
387
|
+
// Refresh operations (data consistency)
|
|
388
|
+
onRefreshSearchAsync,
|
|
389
|
+
onSavedAsyncCallback,
|
|
390
|
+
// Workflow operations
|
|
391
|
+
onWFOperationCompleted,
|
|
392
|
+
// Navigation
|
|
393
|
+
handleNavigateToWGs,
|
|
394
|
+
handleNavigateToDossiers,
|
|
395
|
+
onReferenceClick,
|
|
396
|
+
// Document forms/operations
|
|
397
|
+
onOpenS4TViewerRequest,
|
|
398
|
+
onOpenPdfEditorRequest,
|
|
399
|
+
// Task related
|
|
400
|
+
onTaskCreateRequest,
|
|
401
|
+
openTaskFormHandler,
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
const { handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
const fetchAllUsers = async () => {
|
|
407
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
408
|
+
setAllUsers(users ?? []);
|
|
409
|
+
};
|
|
410
|
+
fetchAllUsers();
|
|
411
|
+
}, []);
|
|
412
|
+
useEffect(() => {
|
|
413
|
+
if (!allowButtonsRefs)
|
|
414
|
+
setDcmtReferences(undefined);
|
|
415
|
+
}, [allowButtonsRefs]);
|
|
416
|
+
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
417
|
+
const fetchErrorShownRef = useRef(false);
|
|
418
|
+
useEffect(() => {
|
|
419
|
+
if (!TID)
|
|
420
|
+
return;
|
|
421
|
+
checkRelatedDcmtsArchiveCapability();
|
|
422
|
+
checkManyToManyCapability();
|
|
423
|
+
}, [TID, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
308
424
|
const createChange = useCallback((mid, metadataType, modifiedValue) => {
|
|
309
425
|
return { mid, metadataType, modifiedValue };
|
|
310
426
|
}, []);
|
|
@@ -351,12 +467,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
351
467
|
// Distinguish between initial load and navigation
|
|
352
468
|
if (isInitialLoading) {
|
|
353
469
|
// First load - keep isInitialLoading true
|
|
354
|
-
await
|
|
470
|
+
await onRefreshSearchAsync();
|
|
355
471
|
}
|
|
356
472
|
else {
|
|
357
473
|
// Navigation - use isNavigating instead
|
|
358
474
|
setIsNavigating(true);
|
|
359
|
-
await
|
|
475
|
+
await onRefreshSearchAsync();
|
|
360
476
|
}
|
|
361
477
|
}
|
|
362
478
|
catch (e) {
|
|
@@ -370,7 +486,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
370
486
|
}
|
|
371
487
|
};
|
|
372
488
|
run();
|
|
373
|
-
}, [TID, DID,
|
|
489
|
+
}, [TID, DID, onRefreshSearchAsync]);
|
|
374
490
|
useEffect(() => {
|
|
375
491
|
if (formData.length > 0) {
|
|
376
492
|
setValidationItems(validateMetadataList(formData));
|
|
@@ -451,21 +567,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
451
567
|
const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
|
|
452
568
|
// Valore derivato: true se formData ha elementi validi
|
|
453
569
|
const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
|
|
454
|
-
const handleCheckOutOperationCallback = async (checkout) => {
|
|
455
|
-
if (!currentDcmt)
|
|
456
|
-
return;
|
|
457
|
-
await handleCheckOutCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, updateCurrentDcmt);
|
|
458
|
-
};
|
|
459
|
-
const handleCheckInOperationCallback = async () => {
|
|
460
|
-
if (!currentDcmt)
|
|
461
|
-
return;
|
|
462
|
-
await handleCheckInCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, fileName: fromDTD?.name ?? SDKUI_Localizator.SearchResult }, updateCurrentDcmt, undefined);
|
|
463
|
-
};
|
|
464
|
-
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
465
|
-
if (!currentDcmt)
|
|
466
|
-
return;
|
|
467
|
-
copyCheckoutPathToClipboardCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
|
|
468
|
-
};
|
|
469
570
|
// useEffect per il caricamento dei dati del workflow
|
|
470
571
|
useEffect(() => {
|
|
471
572
|
// Funzione helper per caricare le informazioni del workflow
|
|
@@ -618,18 +719,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
618
719
|
};
|
|
619
720
|
buildWorkItemsForDiagram();
|
|
620
721
|
}, [workflows, workItems]);
|
|
621
|
-
const getSelectionDcmtInfo = useCallback(() => {
|
|
622
|
-
let dcmts = [];
|
|
623
|
-
dcmts.push({ TID: TID ?? 0, DID: DID ?? 0 });
|
|
624
|
-
return dcmts;
|
|
625
|
-
}, [TID, DID]);
|
|
626
|
-
const handleAddItem = useCallback((tid, did) => {
|
|
627
|
-
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
628
|
-
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
629
|
-
}, []);
|
|
630
|
-
const handleRemoveItem = useCallback((tid, did) => {
|
|
631
|
-
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
632
|
-
}, []);
|
|
633
722
|
const handlePassToSearch = useCallback(() => {
|
|
634
723
|
if (!passToSearch)
|
|
635
724
|
return;
|
|
@@ -645,8 +734,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
645
734
|
const isPreviewDisabled = useMemo(() => layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata, [layoutMode, fromDTD?.archiveConstraint]);
|
|
646
735
|
const isBoardDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fromDTD?.hasBlog !== 1, [layoutMode, fromDTD?.hasBlog]);
|
|
647
736
|
const isSysMetadataDisabled = useMemo(() => layoutMode !== LayoutModes.Update, [layoutMode]);
|
|
648
|
-
const
|
|
649
|
-
const isMasterDisabled = useMemo(() => layoutMode !== LayoutModes.Update || !DID, [layoutMode, DID]);
|
|
737
|
+
const isDcmtTasksDisabled = useMemo(() => layoutMode !== LayoutModes.Update, [layoutMode]);
|
|
650
738
|
const isWFDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fetchError || (workItems.length <= 0 && workItemsForDiagram.length <= 0), [layoutMode, fetchError, workItems.length, workItemsForDiagram.length]);
|
|
651
739
|
const showToppyForApprove = useMemo(() => layoutMode === LayoutModes.Update && !fetchError && workItems.length > 0 && !isOpenDetails && !isOpenMaster, [layoutMode, fetchError, workItems.length, isOpenDetails, isOpenMaster]);
|
|
652
740
|
const showToppyForCompleteMoreInfo = useMemo(() => {
|
|
@@ -664,314 +752,13 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
664
752
|
return dcmtReferences.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
665
753
|
}, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
|
|
666
754
|
const isToppyVisible = useMemo(() => Boolean((showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer), [showToppyForApprove, showToppyForCompleteMoreInfo, showToppyForReferences, openS4TViewer]);
|
|
667
|
-
const isMobile = useMemo(() => deviceType === DeviceType.MOBILE, [deviceType]);
|
|
668
|
-
const isApprView = useMemo(() => {
|
|
669
|
-
if (!fromDTD)
|
|
670
|
-
return false;
|
|
671
|
-
return isApprovalWorkflowView(fromDTD);
|
|
672
|
-
}, [fromDTD?.id]);
|
|
673
|
-
const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
|
|
674
|
-
const approvalVID = useMemo(() => workItems.length > 0 ? Number(workItems[0].tid) : -1, [workItems]);
|
|
675
|
-
//here
|
|
676
|
-
const commandsMenuItems = useMemo(() => {
|
|
677
|
-
const items = [];
|
|
678
|
-
const operationsItems = [];
|
|
679
|
-
operationsItems.push({
|
|
680
|
-
icon: _jsx(IconDownload, {}),
|
|
681
|
-
disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
|
|
682
|
-
name: SDKUI_Localizator.DownloadFile,
|
|
683
|
-
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download", undefined, undefined, true)
|
|
684
|
-
}, {
|
|
685
|
-
icon: _jsx(IconDownload, {}),
|
|
686
|
-
disabled: !isXMLFileExt(currentDcmt?.fileExt),
|
|
687
|
-
name: SDKUI_Localizator.DownloadXMLAttachments,
|
|
688
|
-
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
|
|
689
|
-
});
|
|
690
|
-
if (layoutMode === LayoutModes.Update && DID) {
|
|
691
|
-
operationsItems.push({
|
|
692
|
-
icon: _jsx(IconStar, {}),
|
|
693
|
-
name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
|
|
694
|
-
disabled: false,
|
|
695
|
-
onClick: async () => {
|
|
696
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
|
|
697
|
-
},
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
|
|
701
|
-
operationsItems.push({
|
|
702
|
-
icon: _jsx(IconActivity, {}),
|
|
703
|
-
name: SDKUI_Localizator.CreateContextualTask,
|
|
704
|
-
disabled: false,
|
|
705
|
-
onClick: () => {
|
|
706
|
-
const dcmt = getDcmts()[0];
|
|
707
|
-
const name = `${fromDTD?.name ?? '-'} (DID: ${dcmt.DID})`;
|
|
708
|
-
const taskContext = {
|
|
709
|
-
document: {
|
|
710
|
-
tid: dcmt.TID,
|
|
711
|
-
did: dcmt.DID,
|
|
712
|
-
name: name
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
onTaskCreateRequest(taskContext);
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
if (operationsItems.length > 0) {
|
|
720
|
-
items.push({
|
|
721
|
-
icon: _jsx(IconCheck, {}),
|
|
722
|
-
name: SDKUI_Localizator.DocumentOperations,
|
|
723
|
-
submenu: operationsItems
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
if (fromDTD?.id !== SystemTIDs.Drafts) {
|
|
727
|
-
// Check in/Check out menu
|
|
728
|
-
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
729
|
-
items.push({
|
|
730
|
-
icon: _jsx(IconFileDots, {}),
|
|
731
|
-
name: "Check in/Check out",
|
|
732
|
-
disabled: false,
|
|
733
|
-
submenu: [
|
|
734
|
-
{
|
|
735
|
-
name: 'Check out',
|
|
736
|
-
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
737
|
-
onClick: () => handleCheckOutOperationCallback(true),
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
name: 'Check in',
|
|
741
|
-
onClick: () => handleCheckInOperationCallback(),
|
|
742
|
-
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
name: SDKUI_Localizator.CancelCheckOut,
|
|
746
|
-
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
747
|
-
onClick: () => handleCheckOutOperationCallback(false),
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
name: SDKUI_Localizator.CheckoutInfo,
|
|
751
|
-
onClick: showCheckoutInformationFormCallback,
|
|
752
|
-
disabled: !checkoutStatus.isCheckedOut
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
name: SDKUI_Localizator.CopyCheckoutPath,
|
|
756
|
-
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
757
|
-
disabled: !checkoutStatus.isCheckedOut
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
name: SDKUI_Localizator.History,
|
|
761
|
-
disabled: !cicoEnabled,
|
|
762
|
-
onClick: showHistoryCallback,
|
|
763
|
-
},
|
|
764
|
-
]
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
768
|
-
const relationsItems = [
|
|
769
|
-
{
|
|
770
|
-
icon: _jsx(IconPair, {}),
|
|
771
|
-
name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
772
|
-
disabled: !hasManyToManyRelation,
|
|
773
|
-
onClick: async () => await pairManyToMany?.(true)
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
icon: _jsx(IconUnpair, {}),
|
|
777
|
-
name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
778
|
-
disabled: !hasManyToManyRelation,
|
|
779
|
-
onClick: async () => await pairManyToMany?.(false)
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
icon: _jsx(IconArchiveMaster, {}),
|
|
783
|
-
name: SDKUI_Localizator.ArchiveMasterDocument,
|
|
784
|
-
disabled: canArchiveMasterRelation !== true,
|
|
785
|
-
onClick: async () => { if (TID)
|
|
786
|
-
await archiveMasterDocuments?.(TID); }
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
icon: _jsx(IconArchiveDetail, {}),
|
|
790
|
-
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
791
|
-
disabled: canArchiveDetailRelation !== true,
|
|
792
|
-
onClick: async () => { if (TID)
|
|
793
|
-
await archiveDetailDocuments?.(TID); }
|
|
794
|
-
},
|
|
795
|
-
{
|
|
796
|
-
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
|
|
797
|
-
name: SDKUI_Localizator.DcmtsMaster,
|
|
798
|
-
disabled: !currentTIDHasMasterRelations || isMasterDisabled,
|
|
799
|
-
onClick: () => { if (!isMasterDisabled)
|
|
800
|
-
setIsOpenMaster(!isOpenMaster); }
|
|
801
|
-
},
|
|
802
|
-
{
|
|
803
|
-
icon: _jsx(IconDetailDcmts, {}),
|
|
804
|
-
name: SDKUI_Localizator.DcmtsDetail,
|
|
805
|
-
disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
|
|
806
|
-
onClick: () => { if (!isDetailsDisabled)
|
|
807
|
-
setIsOpenDetails(!isOpenDetails); }
|
|
808
|
-
}
|
|
809
|
-
];
|
|
810
|
-
items.push({
|
|
811
|
-
icon: _jsx(IconRelation, {}),
|
|
812
|
-
name: SDKUI_Localizator.Relations,
|
|
813
|
-
submenu: relationsItems
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
if (layoutMode === LayoutModes.Update && DID) {
|
|
817
|
-
const fullTextItems = [
|
|
818
|
-
{
|
|
819
|
-
icon: _jsx(IconInfo, {}),
|
|
820
|
-
name: SDKUI_Localizator.IndexingInformation,
|
|
821
|
-
disabled: false,
|
|
822
|
-
onClick: async () => {
|
|
823
|
-
try {
|
|
824
|
-
TMSpinner.show({ description: `${SDKUI_Localizator.Loading}...` });
|
|
825
|
-
const dcmts = getDcmts();
|
|
826
|
-
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(dcmts[0].TID, dcmts[0].DID);
|
|
827
|
-
TMMessageBoxManager.show({ buttons: [ButtonNames.OK], message: msg, title: SDKUI_Localizator.IndexingInformation });
|
|
828
|
-
}
|
|
829
|
-
catch (e) {
|
|
830
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
831
|
-
}
|
|
832
|
-
finally {
|
|
833
|
-
TMSpinner.hide();
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
},
|
|
837
|
-
{
|
|
838
|
-
icon: _jsx(IconArchiveDoc, {}),
|
|
839
|
-
name: SDKUI_Localizator.IndexOrReindex,
|
|
840
|
-
disabled: false,
|
|
841
|
-
onClick: async () => {
|
|
842
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
{
|
|
846
|
-
icon: _jsx(IconDelete, {}),
|
|
847
|
-
name: SDKUI_Localizator.IndexingDelete,
|
|
848
|
-
disabled: false,
|
|
849
|
-
onClick: async () => {
|
|
850
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
];
|
|
854
|
-
items.push({
|
|
855
|
-
icon: _jsx(IconSearch, {}),
|
|
856
|
-
name: SDKUI_Localizator.FullTextSearch,
|
|
857
|
-
submenu: fullTextItems
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
// Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
|
|
861
|
-
if (customButtonsLayout?.customButtons && Array.isArray(customButtonsLayout.customButtons) && customButtonsLayout.customButtons.length > 0) {
|
|
862
|
-
const customButtonsItems = customButtonsLayout.customButtons
|
|
863
|
-
.filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
|
|
864
|
-
.map((customButton) => ({
|
|
865
|
-
icon: TMImageLibrary({ imageID: customButton.glyphID }),
|
|
866
|
-
name: customButton.title || 'Bottone personalizzato',
|
|
867
|
-
onClick: () => setCustomButton(customButton)
|
|
868
|
-
}));
|
|
869
|
-
customButtonsItems && customButtonsItems.length > 0 && items.push({
|
|
870
|
-
icon: _jsx(IconCustom, {}),
|
|
871
|
-
name: SDKUI_Localizator.CustomButtons,
|
|
872
|
-
submenu: customButtonsItems
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
return items;
|
|
876
|
-
}, [
|
|
877
|
-
fromDTD?.id,
|
|
878
|
-
fromDTD?.perm?.canRetrieveFile,
|
|
879
|
-
fromDTD?.description,
|
|
880
|
-
currentDcmt?.fileExt,
|
|
881
|
-
allowRelations,
|
|
882
|
-
currentTIDHasMasterRelations,
|
|
883
|
-
isMasterDisabled,
|
|
884
|
-
currentTIDHasDetailRelations,
|
|
885
|
-
isDetailsDisabled,
|
|
886
|
-
customButtonsLayout,
|
|
887
|
-
layoutMode,
|
|
888
|
-
TID,
|
|
889
|
-
DID,
|
|
890
|
-
onTaskCreateRequest,
|
|
891
|
-
hasManyToManyRelation,
|
|
892
|
-
canArchiveMasterRelation,
|
|
893
|
-
canArchiveDetailRelation,
|
|
894
|
-
pairManyToMany,
|
|
895
|
-
archiveMasterDocuments,
|
|
896
|
-
archiveDetailDocuments,
|
|
897
|
-
getDcmts,
|
|
898
|
-
downloadDcmtsAsync,
|
|
899
|
-
runOperationAsync,
|
|
900
|
-
openConfirmAttachmentsDialog
|
|
901
|
-
]);
|
|
902
755
|
const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
|
|
903
756
|
const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update &&
|
|
904
|
-
_jsx(ContextMenu, { items:
|
|
905
|
-
_jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode,
|
|
757
|
+
_jsx(ContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
758
|
+
_jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode, operationItems, handlePassToSearch]);
|
|
906
759
|
const handleUndo = useCallback(() => {
|
|
907
760
|
setFormData(structuredClone(formDataOrig));
|
|
908
761
|
}, [formDataOrig]);
|
|
909
|
-
const handleConfirmAction = useCallback(async () => {
|
|
910
|
-
TMMessageBoxManager.show({
|
|
911
|
-
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
912
|
-
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
913
|
-
message: layoutMode === LayoutModes.Update ? SDKUI_Localizator.SaveQuestion : 'Sei sicuro di voler archiviare questo documento?',
|
|
914
|
-
onButtonClick(e) {
|
|
915
|
-
if (e !== ButtonNames.YES)
|
|
916
|
-
return;
|
|
917
|
-
layoutMode === LayoutModes.Update ? handleSave() : handleArchiveCompleted();
|
|
918
|
-
},
|
|
919
|
-
});
|
|
920
|
-
}, [isModal, id, layoutMode]);
|
|
921
|
-
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
922
|
-
const refreshMetadataAsync = useCallback(async () => {
|
|
923
|
-
let metadataResult = undefined;
|
|
924
|
-
let hasGetMetadataError = false;
|
|
925
|
-
try {
|
|
926
|
-
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
927
|
-
}
|
|
928
|
-
catch (metadataError) {
|
|
929
|
-
hasGetMetadataError = true;
|
|
930
|
-
// Estrai ErrorCode dal campo detail se disponibile
|
|
931
|
-
let errorCode = undefined;
|
|
932
|
-
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
933
|
-
try {
|
|
934
|
-
const detailObj = JSON.parse(metadataError.response.detail);
|
|
935
|
-
errorCode = detailObj?.ErrorCode;
|
|
936
|
-
}
|
|
937
|
-
catch (parseError) {
|
|
938
|
-
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
942
|
-
if (errorCode === -5) {
|
|
943
|
-
TMMessageBoxManager.show({
|
|
944
|
-
message: SDKUI_Localizator.DcmtOutOfView,
|
|
945
|
-
buttons: [ButtonNames.OK],
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
else {
|
|
949
|
-
TMExceptionBoxManager.show({ exception: metadataError });
|
|
950
|
-
}
|
|
951
|
-
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
952
|
-
metadataResult = null;
|
|
953
|
-
}
|
|
954
|
-
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
955
|
-
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
956
|
-
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
957
|
-
}
|
|
958
|
-
return { success: !hasGetMetadataError, result: metadataResult };
|
|
959
|
-
}, [TID, DID, setMetadataList]);
|
|
960
|
-
const updateCurrentDcmt = useCallback(async () => {
|
|
961
|
-
try {
|
|
962
|
-
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
963
|
-
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
964
|
-
if (!success)
|
|
965
|
-
onClose?.();
|
|
966
|
-
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
967
|
-
}
|
|
968
|
-
catch (e) {
|
|
969
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
970
|
-
}
|
|
971
|
-
finally {
|
|
972
|
-
TMSpinner.hide();
|
|
973
|
-
}
|
|
974
|
-
}, [refreshMetadataAsync, onClose]);
|
|
975
762
|
const handleSave = useCallback(async () => {
|
|
976
763
|
const ue = new UpdateEngineByID(SDK_Globals.tmSession);
|
|
977
764
|
ue.DID = DID;
|
|
@@ -1095,6 +882,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1095
882
|
const savedFormData = structuredClone(formDataRef.current);
|
|
1096
883
|
setFormDataOrig(savedFormData);
|
|
1097
884
|
formDataOrigRef.current = savedFormData;
|
|
885
|
+
await onRefreshSearchAsyncDatagrid?.();
|
|
1098
886
|
await onSavedAsyncCallback?.(ae.TID, newDID);
|
|
1099
887
|
// Usa fromDTDRef.current invece di fromDTD per evitare stale closure,
|
|
1100
888
|
// garantendo di avere il descrittore del tipo documento corrente.
|
|
@@ -1122,6 +910,18 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1122
910
|
setUseWaitPanelLocalState(false);
|
|
1123
911
|
}
|
|
1124
912
|
}, [TID, connectorFileSave, onSavedAsyncCallback, onSaveRecents, onClose, DID, setMetadataList, handleReset, layoutMode, isSharedDcmt]);
|
|
913
|
+
const handleConfirmAction = useCallback(async () => {
|
|
914
|
+
TMMessageBoxManager.show({
|
|
915
|
+
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
916
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
917
|
+
message: layoutMode === LayoutModes.Update ? SDKUI_Localizator.SaveQuestion : 'Sei sicuro di voler archiviare questo documento?',
|
|
918
|
+
onButtonClick(e) {
|
|
919
|
+
if (e !== ButtonNames.YES)
|
|
920
|
+
return;
|
|
921
|
+
layoutMode === LayoutModes.Update ? handleSave() : handleArchiveCompleted();
|
|
922
|
+
},
|
|
923
|
+
});
|
|
924
|
+
}, [isModal, id, layoutMode, handleSave, handleArchiveCompleted]);
|
|
1125
925
|
const handleClearForm = useCallback(() => {
|
|
1126
926
|
let data = structuredClone(formData);
|
|
1127
927
|
if (!data || data.length === 0)
|
|
@@ -1192,12 +992,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1192
992
|
fd.tid = TID;
|
|
1193
993
|
return fd;
|
|
1194
994
|
}, [focusedMetadataValue?.value, focusedMetadataValue?.mid, TID]);
|
|
1195
|
-
const handleWFOperationCompleted = useCallback(async () => {
|
|
1196
|
-
await onWFOperationCompleted?.();
|
|
1197
|
-
if (!showMoreInfoPopup) {
|
|
1198
|
-
onClose?.();
|
|
1199
|
-
}
|
|
1200
|
-
}, [onWFOperationCompleted, onClose, showMoreInfoPopup]);
|
|
1201
995
|
// Determina se showAll deve essere automaticamente true
|
|
1202
996
|
// Best practice: usa useMemo per calcolare valori derivati invece di useEffect con setState
|
|
1203
997
|
const shouldShowAll = useMemo(() => {
|
|
@@ -1217,9 +1011,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1217
1011
|
const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
|
|
1218
1012
|
const shouldRefresh = forceRefresh || (task && (task.state === Task_States.Completed || task.state === Task_States.Closed)) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
1219
1013
|
if (TID && DID && shouldRefresh) {
|
|
1014
|
+
// local refresh blog
|
|
1220
1015
|
await triggerBlogRefresh();
|
|
1016
|
+
// refresh blog datagrid
|
|
1017
|
+
await onRefreshBlogDatagrid?.();
|
|
1221
1018
|
}
|
|
1222
|
-
}, [TID, DID, triggerBlogRefresh]);
|
|
1019
|
+
}, [TID, DID, triggerBlogRefresh, onRefreshBlogDatagrid]);
|
|
1223
1020
|
const checkoutBadge = useMemo(() => {
|
|
1224
1021
|
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
1225
1022
|
if (!cicoEnabled || !checkoutStatus.isCheckedOut)
|
|
@@ -1247,7 +1044,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1247
1044
|
!isApprView &&
|
|
1248
1045
|
TID !== SystemTIDs.Drafts &&
|
|
1249
1046
|
!shouldShowAll &&
|
|
1250
|
-
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] })
|
|
1047
|
+
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] })] })] });
|
|
1251
1048
|
}, [
|
|
1252
1049
|
TID,
|
|
1253
1050
|
DID,
|
|
@@ -1277,9 +1074,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1277
1074
|
isReadOnlyOriginCallback,
|
|
1278
1075
|
metadataDcmtOrigin?.fromTID,
|
|
1279
1076
|
]);
|
|
1280
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID,
|
|
1077
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, fetchBlogDataTrigger: refreshBlogTrigger, onRefreshBlogDatagrid: onRefreshBlogDatagrid, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
|
|
1281
1078
|
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]);
|
|
1282
|
-
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType,
|
|
1079
|
+
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { refreshPreviewTrigger: refreshPreviewTrigger, fromDTD: fromDTD, currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, layoutMode: layoutMode, onFileUpload: (file) => { setDcmtFile(file); }, openFileUploaderPdfEditor: openFileUploaderPdfEditor, enableDragDropOverlay: enableDragDropOverlay, onScanRequest: onScanRequest }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile, onScanRequest, openFileUploaderPdfEditor, refreshPreviewTrigger]);
|
|
1283
1080
|
const tmWF = useMemo(() => {
|
|
1284
1081
|
if (isWFDataLoading) {
|
|
1285
1082
|
return (_jsx("div", { style: {
|
|
@@ -1581,18 +1378,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1581
1378
|
}, []);
|
|
1582
1379
|
const emptyParticipants = useMemo(() => [], []);
|
|
1583
1380
|
const emptyArchivedDocumentsFileItems = useMemo(() => [], []);
|
|
1584
|
-
const handleSignApprove = useCallback(() => {
|
|
1585
|
-
if (onOpenS4TViewerRequest && TID && DID) {
|
|
1586
|
-
onOpenS4TViewerRequest([{ TID, DID }], onClose ? async () => { onClose(); } : undefined);
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
ShowAlert({
|
|
1590
|
-
message: "TODO",
|
|
1591
|
-
mode: "info",
|
|
1592
|
-
duration: 3000,
|
|
1593
|
-
title: SDKUI_Localizator.SignatureAndApprove,
|
|
1594
|
-
});
|
|
1595
|
-
}, [onOpenS4TViewerRequest, TID, DID]);
|
|
1596
1381
|
const handleNavigateToReference = useCallback((ref) => {
|
|
1597
1382
|
if (onReferenceClick) {
|
|
1598
1383
|
try {
|
|
@@ -1626,83 +1411,37 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1626
1411
|
if (isInitialLoading) {
|
|
1627
1412
|
return _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: true });
|
|
1628
1413
|
}
|
|
1629
|
-
return (_jsxs("div", { style: {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
_jsx(StyledModalContainer, { children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenMaster &&
|
|
1657
|
-
_jsxs(StyledModalContainer, { children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
1658
|
-
return (_jsx(StyledModalContainer, { children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }, `${index}-${dcmt.DID}`));
|
|
1659
|
-
})] }), taskFormDialogComponent, s4TViewerDialogComponent] }));
|
|
1414
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: floatingBarContainerRef, style: {
|
|
1415
|
+
display: isOpenDetails || isOpenMaster ? 'none' : 'flex',
|
|
1416
|
+
flexDirection: deviceType === DeviceType.MOBILE ? 'column' : 'row',
|
|
1417
|
+
justifyContent: 'space-between',
|
|
1418
|
+
gap: Gutters.getGutters(),
|
|
1419
|
+
width: '100%',
|
|
1420
|
+
height: '100%',
|
|
1421
|
+
position: 'relative',
|
|
1422
|
+
overflow: 'hidden'
|
|
1423
|
+
}, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: [(groupId && groupId.length > 0)
|
|
1424
|
+
? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
|
|
1425
|
+
: _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1426
|
+
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onClosePanelCallback: () => setIsOpenDistinctValues(false), onSelectionChanged: (e) => {
|
|
1427
|
+
if (!e)
|
|
1428
|
+
return;
|
|
1429
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
|
|
1430
|
+
} }), isOpenFormulaEditor &&
|
|
1431
|
+
_jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
|
|
1432
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
|
1433
|
+
setFocusedMetadataValue(prevState => ({
|
|
1434
|
+
...prevState,
|
|
1435
|
+
isSelected: true,
|
|
1436
|
+
isEditable: true,
|
|
1437
|
+
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
1438
|
+
}));
|
|
1439
|
+
} }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), _jsx(TMToppyDraggableHelpCenter, { isVisible: isToppyVisible, content: _jsx(TMDcmtFormActionButtons, { showToppyForApprove: showToppyForApprove, workItems: workItems, deviceType: deviceType, isMobile: isMobile, handleSignApprove: handleSignApprove, updateShowApprovePopup: updateShowApprovePopup, updateShowRejectPopup: updateShowRejectPopup, updateShowReAssignPopup: updateShowReAssignPopup, updateShowMoreInfoPopup: updateShowMoreInfoPopup, fromDTD: fromDTD, showToppyForCompleteMoreInfo: showToppyForCompleteMoreInfo, moreInfoTasks: moreInfoTasks, setShowCommentForm: setShowCommentForm, showToppyForReferences: showToppyForReferences, dcmtReferences: dcmtReferences, referenceActionMap: referenceActionMap, handleNavigateToReference: handleNavigateToReference, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask }) })] }), (showCommentForm && TID && DID) &&
|
|
1440
|
+
_jsx(TMBlogCommentForm, { maxLength: 500, context: blogCommentFormContext, onClose: handleBlogCommentFormClose, onCustomSave: onBlogCommentFormCustomSave, participants: emptyParticipants, showAttachmentsSection: false, allArchivedDocumentsFileItems: emptyArchivedDocumentsFileItems })] }), renderDcmtOperations, renderFloatingBar] }));
|
|
1660
1441
|
};
|
|
1661
1442
|
return (_jsxs("div", { style: { width: '100%', height: '100%' }, children: [(isModal && onClose)
|
|
1662
1443
|
? _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px", position: 'relative' }, children: renderDcmtForm() }) })
|
|
1663
|
-
: renderDcmtForm(),
|
|
1664
|
-
try {
|
|
1665
|
-
setShowRelatedDcmtsChooser(false);
|
|
1666
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1667
|
-
const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
|
|
1668
|
-
if (!relation || !archiveType)
|
|
1669
|
-
return;
|
|
1670
|
-
await archiveRelatedDcmtHandler(relation, archiveType);
|
|
1671
|
-
}
|
|
1672
|
-
catch (error) {
|
|
1673
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
1674
|
-
}
|
|
1675
|
-
finally {
|
|
1676
|
-
TMSpinner.hide();
|
|
1677
|
-
}
|
|
1678
|
-
}, onClose: () => setShowRelatedDcmtsChooser(false), manageUseLocalizedName: false })), showManyToManyChooser && (_jsx(TMChooserForm, { dataSource: manyToManyChooserDataSource, onChoose: async (selectedRelation) => {
|
|
1679
|
-
try {
|
|
1680
|
-
setShowManyToManyChooser(false);
|
|
1681
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1682
|
-
const relation = manyToManyRelations?.find(r => r.id === selectedRelation[0]);
|
|
1683
|
-
if (!relation)
|
|
1684
|
-
return;
|
|
1685
|
-
await executeManyToManyPairing(relation, isPairingManyToMany);
|
|
1686
|
-
}
|
|
1687
|
-
catch (error) {
|
|
1688
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
1689
|
-
}
|
|
1690
|
-
finally {
|
|
1691
|
-
TMSpinner.hide();
|
|
1692
|
-
}
|
|
1693
|
-
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), (showHistory && fromDTD && currentDcmt) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: { TID: currentDcmt.tid, DID: currentDcmt.did }, onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showCheckoutInformationForm && fromDTD && currentDcmt) &&
|
|
1694
|
-
_jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, onClose: hideCheckoutInformationFormCallback }), (commentFormState.show && currentDcmt) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: currentDcmt.tid, did: currentDcmt.did } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment }), isOpenArchiveRelationForm && (_jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
|
|
1695
|
-
setIsOpenArchiveRelationForm(false);
|
|
1696
|
-
setArchiveType(undefined);
|
|
1697
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
1698
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
1699
|
-
}, onSavedAsyncCallback: async (tid, did) => {
|
|
1700
|
-
setIsOpenArchiveRelationForm(false);
|
|
1701
|
-
setArchiveType(undefined);
|
|
1702
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
1703
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
1704
|
-
await fetchData();
|
|
1705
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference })), showPairDcmtsModal && (_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshSearchAsync: async () => await fetchData(), onTaskCreateRequest: onTaskCreateRequest, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, toppyHelpCenterUsePortal: true }) })), (showMoreInfoTaskPopup && showMoreInfoTaskTask && showMoreInfoTaskTask.id && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx(TMTaskForm, { id: Number(showMoreInfoTaskTask.id), title: showMoreInfoTaskTask.name ?? 'N/A', formMode: FormModes.Update, onSaved: onSavedTaskFormCallback, editTaskCallback: editTaskCallback, onClose: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, onCancel: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, isModal: true, showBackButton: false, hasNavigation: false, width: taskModalSizes(deviceType, FormModes.Update).width, height: taskModalSizes(deviceType, FormModes.Update).height, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, visualizedTasks: [], currentTask: null, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback })] }));
|
|
1444
|
+
: renderDcmtForm(), (showMoreInfoTaskPopup && showMoreInfoTaskTask && showMoreInfoTaskTask.id && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx(TMTaskForm, { id: Number(showMoreInfoTaskTask.id), title: showMoreInfoTaskTask.name ?? 'N/A', formMode: FormModes.Update, onSaved: onSavedTaskFormCallback, editTaskCallback: editTaskCallback, onClose: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, onCancel: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, isModal: true, showBackButton: false, hasNavigation: false, width: taskModalSizes(deviceType, FormModes.Update).width, height: taskModalSizes(deviceType, FormModes.Update).height, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, visualizedTasks: [], currentTask: null, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback })] }));
|
|
1706
1445
|
};
|
|
1707
1446
|
export default TMDcmtForm;
|
|
1708
1447
|
/**
|
|
@@ -1772,21 +1511,37 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1772
1511
|
}
|
|
1773
1512
|
};
|
|
1774
1513
|
//#endregion Validation
|
|
1775
|
-
//
|
|
1776
|
-
|
|
1777
|
-
const
|
|
1778
|
-
const { setToolbarButtonDisabled } = useTMPanelManagerContext();
|
|
1514
|
+
// Synchronizes panel visibility and toolbar button disabled states when panels become disabled
|
|
1515
|
+
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled }) => {
|
|
1516
|
+
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1779
1517
|
useEffect(() => {
|
|
1518
|
+
// Aggiorna lo stato disabled del bottone toolbar
|
|
1519
|
+
setToolbarButtonDisabled('tmSysMetadata', isSysMetadataDisabled);
|
|
1520
|
+
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1780
1521
|
setToolbarButtonDisabled('tmWF', isWFDisabled);
|
|
1781
|
-
|
|
1782
|
-
|
|
1522
|
+
setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
|
|
1523
|
+
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1524
|
+
if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
|
|
1525
|
+
setPanelVisibilityById('tmSysMetadata', false);
|
|
1526
|
+
}
|
|
1527
|
+
if (isBoardDisabled && panelVisibility['tmBlog']) {
|
|
1528
|
+
setPanelVisibilityById('tmBlog', false);
|
|
1529
|
+
}
|
|
1530
|
+
if (isWFDisabled && panelVisibility['tmWF']) {
|
|
1531
|
+
setPanelVisibilityById('tmWF', false);
|
|
1532
|
+
}
|
|
1533
|
+
if (isDcmtTasksDisabled && panelVisibility['tmDcmtTasks']) {
|
|
1534
|
+
setPanelVisibilityById('tmDcmtTasks', false);
|
|
1535
|
+
}
|
|
1536
|
+
}, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1537
|
+
return null;
|
|
1783
1538
|
};
|
|
1784
|
-
const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode,
|
|
1539
|
+
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
|
|
1785
1540
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels, panelVisibility } = useTMPanelManagerContext();
|
|
1786
1541
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1787
1542
|
return (layoutMode === LayoutModes.Update ?
|
|
1788
|
-
_jsx(TMDcmtPreview, { isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined,
|
|
1789
|
-
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload, openPdfEditor:
|
|
1543
|
+
_jsx(TMDcmtPreview, { dcmtData: currentDcmt, isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, isResizingActive: isResizingActive }, refreshPreviewTrigger) :
|
|
1544
|
+
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload, openPdfEditor: openFileUploaderPdfEditor, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay, onScanRequest: onScanRequest }));
|
|
1790
1545
|
};
|
|
1791
1546
|
const Ribbon = styled.div `
|
|
1792
1547
|
font-size: 0.85rem;
|
|
@@ -1820,117 +1575,3 @@ const Ribbon = styled.div `
|
|
|
1820
1575
|
}
|
|
1821
1576
|
`}
|
|
1822
1577
|
`;
|
|
1823
|
-
const TaskLink = (props) => {
|
|
1824
|
-
const { messagePrefix, name, taskNameTrunc, description, currentTask, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
1825
|
-
const mouseMoved = useRef(false);
|
|
1826
|
-
const handleMouseDown = () => {
|
|
1827
|
-
mouseMoved.current = false;
|
|
1828
|
-
};
|
|
1829
|
-
const handleMouseMove = () => {
|
|
1830
|
-
mouseMoved.current = true;
|
|
1831
|
-
};
|
|
1832
|
-
return (_jsx(_Fragment, { children: _jsx("div", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' }, children: _jsxs("div", { onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, style: { display: 'inline' }, children: [messagePrefix, ' "', _jsx("span", { style: {
|
|
1833
|
-
cursor: 'pointer',
|
|
1834
|
-
fontWeight: 500,
|
|
1835
|
-
textDecoration: 'none',
|
|
1836
|
-
transition: 'text-decoration 0.2s',
|
|
1837
|
-
}, onClick: () => {
|
|
1838
|
-
setShowMoreInfoTaskPopup(true);
|
|
1839
|
-
setShowMoreInfoTaskTask(currentTask);
|
|
1840
|
-
}, onMouseEnter: e => e.currentTarget.style.textDecoration = 'underline', onMouseLeave: e => e.currentTarget.style.textDecoration = 'none', children: taskNameTrunc }), '" ', _jsx(TMTooltip, { parentStyle: { display: 'inline' }, childStyle: { display: 'inline' }, content: _jsxs("div", { style: { whiteSpace: 'pre-line', textAlign: 'left' }, children: [_jsxs("div", { children: [_jsx("b", { children: SDKUI_Localizator.Name }), ": ", name] }), _jsxs("div", { children: [_jsx("b", { children: SDKUI_Localizator.Description }), ": ", description] })] }), children: _jsx("i", { className: "dx-icon dx-icon-info", onClick: () => {
|
|
1841
|
-
setShowMoreInfoTaskPopup(true);
|
|
1842
|
-
setShowMoreInfoTaskTask(currentTask);
|
|
1843
|
-
}, style: { fontSize: '16px', lineHeight: 1, cursor: 'pointer' } }) })] }) }) }));
|
|
1844
|
-
};
|
|
1845
|
-
const TMDcmtFormActionButtons = (props) => {
|
|
1846
|
-
const { showToppyForApprove, workItems, deviceType, isMobile, handleSignApprove, setShowApprovePopup, setShowRejectPopup, setShowReAssignPopup, setShowMoreInfoPopup, fromDTD, showToppyForCompleteMoreInfo, moreInfoTasks, setShowCommentForm, showToppyForReferences, dcmtReferences, referenceActionMap, handleNavigateToReference, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
1847
|
-
const tasksNumber = useMemo(() => moreInfoTasks?.length ?? 0, [moreInfoTasks]);
|
|
1848
|
-
const currentTask = useMemo(() => {
|
|
1849
|
-
if (!moreInfoTasks || moreInfoTasks.length === 0)
|
|
1850
|
-
return null;
|
|
1851
|
-
if (moreInfoTasks.length === 1)
|
|
1852
|
-
return moreInfoTasks[0];
|
|
1853
|
-
// If there are multiple tasks, we cannot determine which one is relevant, so we return null
|
|
1854
|
-
return null;
|
|
1855
|
-
}, [moreInfoTasks]);
|
|
1856
|
-
const { hasMoreInfo, hasApprove, hasReferences } = useMemo(() => {
|
|
1857
|
-
const referencesExist = showToppyForReferences && dcmtReferences?.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
1858
|
-
return {
|
|
1859
|
-
hasMoreInfo: Boolean(showToppyForCompleteMoreInfo),
|
|
1860
|
-
hasApprove: Boolean(showToppyForApprove),
|
|
1861
|
-
hasReferences: Boolean(referencesExist)
|
|
1862
|
-
};
|
|
1863
|
-
}, [
|
|
1864
|
-
showToppyForCompleteMoreInfo,
|
|
1865
|
-
showToppyForApprove,
|
|
1866
|
-
showToppyForReferences,
|
|
1867
|
-
dcmtReferences
|
|
1868
|
-
]);
|
|
1869
|
-
const Divider = () => (_jsx("div", { style: { height: '1px', width: '100%', background: 'linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent)', margin: '3px 0', opacity: 0.8, } }));
|
|
1870
|
-
return _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && (tasksNumber === 1 ? (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center' }, children: _jsx("div", { style: {
|
|
1871
|
-
padding: '10px',
|
|
1872
|
-
color: '#FFFFFF',
|
|
1873
|
-
maxWidth: '240px',
|
|
1874
|
-
background: 'linear-gradient(135deg, #1E90FF 0%, #0077BE 60%, #00509E 100%)',
|
|
1875
|
-
border: '1px solid rgba(255,255,255,0.15)',
|
|
1876
|
-
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
1877
|
-
backdropFilter: 'blur(6px)',
|
|
1878
|
-
display: 'flex',
|
|
1879
|
-
flexDirection: 'column',
|
|
1880
|
-
alignItems: 'center',
|
|
1881
|
-
textAlign: 'center',
|
|
1882
|
-
gap: '10px',
|
|
1883
|
-
cursor: 'default',
|
|
1884
|
-
}, children: (() => {
|
|
1885
|
-
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
1886
|
-
const isSender = currentTask?.fromID !== undefined && currentTask.fromID === userID;
|
|
1887
|
-
const isRecipient = currentTask?.toID !== undefined && currentTask.toID === userID;
|
|
1888
|
-
const truncate = (str, maxLength) => str && str.length > maxLength ? str.substring(0, maxLength) + '...' : str;
|
|
1889
|
-
const senderNameTruncated = currentTask?.fromName ? truncate(currentTask.fromName, 30) : 'N/A';
|
|
1890
|
-
const recipientNameTruncated = currentTask?.toName ? truncate(currentTask.toName, 30) : 'N/A';
|
|
1891
|
-
const taskNameTrunc = currentTask?.name ? truncate(currentTask.name.replace(TASK_MORE_INFO_PREFIX_NAME ?? '', ''), 30) : 'N/A';
|
|
1892
|
-
return (_jsxs(_Fragment, { children: [(isSender && !isRecipient) && (_jsx(TaskLink, { messagePrefix: `Hai richiesto maggiori informazioni a "${recipientNameTruncated}" tramite l'attività`, name: currentTask.name ?? 'N/A', taskNameTrunc: taskNameTrunc ?? 'N/A', description: currentTask.description ?? 'N/A', currentTask: currentTask, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask })), (isRecipient && !isSender) && (_jsxs("div", { style: {
|
|
1893
|
-
display: 'flex',
|
|
1894
|
-
flexDirection: 'column',
|
|
1895
|
-
alignItems: 'center',
|
|
1896
|
-
gap: '10px'
|
|
1897
|
-
}, children: [_jsx(TaskLink, { messagePrefix: `"${senderNameTruncated}" ti ha richiesto maggiori informazioni tramite l'attività`, name: currentTask.name ?? 'N/A', taskNameTrunc: taskNameTrunc ?? 'N/A', description: currentTask.description ?? 'N/A', currentTask: currentTask, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx("span", { className: "dx-icon-chat" }), caption: SDKUI_Localizator.CommentAndComplete, width: "180px", disabled: false, onClick: () => setShowCommentForm(true), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.success, color: "success" })] }))] }));
|
|
1898
|
-
})() }) })) : (_jsx("div", { style: {
|
|
1899
|
-
padding: '10px',
|
|
1900
|
-
color: '#FFFFFF',
|
|
1901
|
-
maxWidth: '240px',
|
|
1902
|
-
background: 'linear-gradient(135deg, #1E90FF 0%, #0077BE 60%, #00509E 100%)',
|
|
1903
|
-
border: '1px solid rgba(255,255,255,0.15)',
|
|
1904
|
-
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
1905
|
-
backdropFilter: 'blur(6px)',
|
|
1906
|
-
display: 'flex',
|
|
1907
|
-
flexDirection: 'column',
|
|
1908
|
-
alignItems: 'center',
|
|
1909
|
-
textAlign: 'center',
|
|
1910
|
-
gap: '10px',
|
|
1911
|
-
cursor: 'default',
|
|
1912
|
-
}, children: `Ci sono ${moreInfoTasks?.length ?? 0} richieste di maggiori informazioni. ${SDKUI_Localizator.ManageFromTaskPanel}` }))), hasMoreInfo && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
1913
|
-
_jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true) })
|
|
1914
|
-
:
|
|
1915
|
-
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), (hasApprove && hasReferences) || (hasMoreInfo && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsx(ReferencesContainer, { children: dcmtReferences?.filter(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup)
|
|
1916
|
-
.map((ref, index) => {
|
|
1917
|
-
const mapEntry = referenceActionMap[String(ref.objClass)];
|
|
1918
|
-
const label = mapEntry?.label ?? 'Vai a riferimento';
|
|
1919
|
-
let backgroundColor;
|
|
1920
|
-
switch (ref.objClass) {
|
|
1921
|
-
case ObjectClasses.WorkingGroup:
|
|
1922
|
-
backgroundColor = PDGS_COLORS.WORKING_GROUP;
|
|
1923
|
-
break;
|
|
1924
|
-
case ObjectClasses.Dossier:
|
|
1925
|
-
backgroundColor = PDGS_COLORS.DOSSIER;
|
|
1926
|
-
break;
|
|
1927
|
-
case ObjectClasses.Document:
|
|
1928
|
-
backgroundColor = PDGS_COLORS.DOCUMENT;
|
|
1929
|
-
break;
|
|
1930
|
-
default:
|
|
1931
|
-
backgroundColor = "#C2388B";
|
|
1932
|
-
break;
|
|
1933
|
-
}
|
|
1934
|
-
return (_jsxs(StyledReferenceButton, { onClick: () => handleNavigateToReference(ref), onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, "$bgColor": backgroundColor, children: [_jsx("span", { children: label }), _jsx("span", { children: `"${ref.objName}"` })] }, `ref-${index}-${ref.objID}`));
|
|
1935
|
-
}) }))] });
|
|
1936
|
-
};
|