@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
|
@@ -0,0 +1,1309 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { AccessLevels, AccessLevelsEx, AppModules, DcmtOpers, DcmtTypeListCacheService, FileFormats, GeneralRetrieveFormats, LayoutModes, RetrieveFileOptions, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { DcmtOperationTypes, DownloadTypes, SearchResultContext } from "../ts";
|
|
5
|
+
import { ButtonNames, ShowAlert, StyledModalContainer, StyledMultiViewPanel, TMBlogCommentForm, TMChooserForm, TMExceptionBoxManager, TMMessageBoxManager, TMModal, TMSpinner, WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowReAssignPopUp } from "../components";
|
|
6
|
+
import { useDeviceType, DeviceType } from '../components/base/TMDeviceProvider';
|
|
7
|
+
import TMCustomButton from "../components/base/TMCustomButton";
|
|
8
|
+
import TMDataGridExportForm from "../components/base/TMDataGridExportForm";
|
|
9
|
+
import TMArchive from "../components/features/archive/TMArchive";
|
|
10
|
+
import TMBatchUpdateForm from "../components/features/documents/TMBatchUpdateForm";
|
|
11
|
+
import TMDcmtForm from "../components/features/documents/TMDcmtForm";
|
|
12
|
+
import TMMasterDetailDcmts from "../components/features/documents/TMMasterDetailDcmts";
|
|
13
|
+
import TMDcmtCheckoutInfoForm from "../components/features/search/TMDcmtCheckoutInfoForm";
|
|
14
|
+
import TMSearch from "../components/features/search/TMSearch";
|
|
15
|
+
import TMSearchResult from "../components/features/search/TMSearchResult";
|
|
16
|
+
import TMSignatureInfoContent from "../components/features/search/TMSignatureInfoContent";
|
|
17
|
+
import TMViewHistoryDcmt from "../components/features/search/TMViewHistoryDcmt";
|
|
18
|
+
import TMFloatingMenuBar from "../components/NewComponents/FloatingMenuBar";
|
|
19
|
+
import { useCheckInOutOperations } from "./useCheckInOutOperations";
|
|
20
|
+
import { useDcmtOperations } from "./useDcmtOperations";
|
|
21
|
+
import useFloatingBarPinnedItems from "./useFloatingBarPinnedItems";
|
|
22
|
+
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from "./useInputDialog";
|
|
23
|
+
import { useRelatedDocuments } from "./useRelatedDocuments";
|
|
24
|
+
import { convertSearchResultDescriptorToFileItems, dcmtsFileCachePreview, getDcmtCicoStatus, getMoreInfoTasksForDocument, IconActivity, IconArchiveDetail, IconArchiveDoc, IconArchiveMaster, IconBatchUpdate, IconCheck, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconCopy, IconCustom, IconDelete, IconDetailDcmts, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconMoveToFolder, IconPair, IconPin, IconPlatform, IconPreview, IconRelation, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignaturePencil, IconStar, IconSubstFile, IconUndo, IconUnpair, IconUserGroupOutline, isPdfEditorAvailable, SDKUI_Localizator, searchResultToMetadataValues, TMImageLibrary } from '../helper';
|
|
25
|
+
import { isXMLFileExt } from "../helper/dcmtsHelper";
|
|
26
|
+
export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
|
|
27
|
+
if (selectedItems.length <= 0 && !focusedItem)
|
|
28
|
+
return [];
|
|
29
|
+
if (selectedItems.length > 0) {
|
|
30
|
+
// Filtra solo gli item che hanno TID e DID validi
|
|
31
|
+
return selectedItems
|
|
32
|
+
.filter((item) => item.TID !== undefined && item.DID !== undefined)
|
|
33
|
+
.map((item) => { return { TID: item.TID, DID: item.DID, FILEEXT: item.FILEEXT, ISSIGNED: Number(item.ISSIGNED ?? 0), fileFormat: fileFormat, rowIndex: item.rowIndex }; });
|
|
34
|
+
}
|
|
35
|
+
else if (focusedItem !== undefined && focusedItem.TID !== undefined && focusedItem.DID !== undefined) {
|
|
36
|
+
return [{ TID: focusedItem.TID, DID: focusedItem.DID, FILEEXT: focusedItem.FILEEXT, ISSIGNED: Number(focusedItem.ISSIGNED ?? 0), fileFormat: fileFormat, rowIndex: focusedItem.rowIndex }];
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
};
|
|
40
|
+
export const getAllFieldSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
|
|
41
|
+
if (selectedItems.length <= 0 && !focusedItem)
|
|
42
|
+
return [];
|
|
43
|
+
if (selectedItems.length > 0) {
|
|
44
|
+
return selectedItems;
|
|
45
|
+
}
|
|
46
|
+
else if (focusedItem !== undefined) {
|
|
47
|
+
return [focusedItem];
|
|
48
|
+
}
|
|
49
|
+
return [];
|
|
50
|
+
};
|
|
51
|
+
export const useDocumentOperations = (props) => {
|
|
52
|
+
const { context, documentData, exportData, uiConfig, tasks, callbacks, } = props;
|
|
53
|
+
const { dtd, selectedItems, focusedItem, searchResult, currentSearchResults, currentMetadataValues, allUsers = [], datagridUtility, dcmtUtility, } = documentData;
|
|
54
|
+
/** State for managing the document(s) to process */
|
|
55
|
+
const [selectedDcmtInfos, setSelectedDcmtInfos] = useState([]);
|
|
56
|
+
const [selectedItemsFull, setSelectedItemsFull] = useState([]);
|
|
57
|
+
// Refs per evitare loop causati da nuove reference di array
|
|
58
|
+
const prevSelectedItemsRef = useRef([]);
|
|
59
|
+
const prevFocusedItemRef = useRef(undefined);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// Confronto basato su TID/DID per evitare loop causati da nuove reference
|
|
62
|
+
const areItemsEqual = (a, b) => {
|
|
63
|
+
if (a.length !== b.length)
|
|
64
|
+
return false;
|
|
65
|
+
return a.every((item, index) => {
|
|
66
|
+
const other = b[index];
|
|
67
|
+
return item?.TID === other?.TID && item?.DID === other?.DID;
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const selectedChanged = !areItemsEqual(selectedItems, prevSelectedItemsRef.current);
|
|
71
|
+
const focusedChanged = focusedItem?.TID !== prevFocusedItemRef.current?.TID || focusedItem?.DID !== prevFocusedItemRef.current?.DID;
|
|
72
|
+
if (selectedChanged || focusedChanged) {
|
|
73
|
+
prevSelectedItemsRef.current = selectedItems;
|
|
74
|
+
prevFocusedItemRef.current = focusedItem;
|
|
75
|
+
setSelectedDcmtInfos(getSelectedDcmtsOrFocused(selectedItems, focusedItem));
|
|
76
|
+
setSelectedItemsFull(getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem));
|
|
77
|
+
}
|
|
78
|
+
}, [selectedItems, focusedItem]);
|
|
79
|
+
const onRefreshPreviewCallback = async () => {
|
|
80
|
+
await onRefreshPreviewForm?.();
|
|
81
|
+
await onRefreshPreviewDatagrid?.();
|
|
82
|
+
};
|
|
83
|
+
const { dataColumns, dataSource, selectedRowKeys, } = exportData ?? {};
|
|
84
|
+
const { visibleItems = [], onRefreshSearchAsyncDatagrid, onRefreshDataRowsAsync, refreshFocusedDataRowAsync, onRefreshBlogDatagrid, onRefreshPreviewDatagrid, refreshOperationsTrigger = 0, onRefreshOperationsDatagrid, } = datagridUtility ?? {};
|
|
85
|
+
const { approvalVID, dcmtDataRowForCicoStatus, selectedDcmtSearchResultRelations, dcmtTIDHasDetailRelations = false, dcmtTIDHasMasterRelations = false, updateCurrentDcmt, onCloseDcmtForm, onRefreshBlogForm, onRefreshPreviewForm, taskFormDialogComponent, s4TViewerDialogComponent } = dcmtUtility ?? {};
|
|
86
|
+
const { floatingBarContainerRef, customButtonsLayout, workingGroupContext, openS4TViewer = false, openDcmtFormAsModal = false, showDcmtFormSidebar = true, allowFloatingBar = true, enablePinIcons = true, allowRelations = true, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, editPdfForm = false, inputDcmtFormLayoutMode = LayoutModes.Update, } = uiConfig;
|
|
87
|
+
const { allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback } = tasks;
|
|
88
|
+
const {
|
|
89
|
+
// Refresh operations (data consistency)
|
|
90
|
+
onSavedAsyncCallback, onRefreshAfterAddDcmtToFavs,
|
|
91
|
+
// Workflow operations
|
|
92
|
+
onWFOperationCompleted,
|
|
93
|
+
// Navigation
|
|
94
|
+
canNavigateHandler, onNavigateHandler, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick,
|
|
95
|
+
// Document forms/operations
|
|
96
|
+
openAddDocumentForm, openCommentFormCallback, onFileOpened, passToArchiveCallback, openWGsCopyMoveForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest,
|
|
97
|
+
// Task related
|
|
98
|
+
onTaskCreateRequest, openTaskFormHandler, } = callbacks;
|
|
99
|
+
// Force recalculation of selectedDcmtInfos when refreshOperationsTrigger changes (e.g., after file substitution where FILEEXT may change)
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (refreshOperationsTrigger > 0) {
|
|
102
|
+
setSelectedDcmtInfos(getSelectedDcmtsOrFocused(selectedItems, focusedItem));
|
|
103
|
+
setSelectedItemsFull(getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem));
|
|
104
|
+
}
|
|
105
|
+
}, [refreshOperationsTrigger]);
|
|
106
|
+
// Context helpers
|
|
107
|
+
const isDcmtFormContext = context === SearchResultContext.DCMT_FORM;
|
|
108
|
+
const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations({
|
|
109
|
+
onRefreshPreview: onRefreshPreviewCallback
|
|
110
|
+
});
|
|
111
|
+
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache } = useDcmtOperations();
|
|
112
|
+
const {
|
|
113
|
+
// Data
|
|
114
|
+
relatedDcmts, pairedSearchResults, manyToManyRelations, selectedManyToManyRelation, manyToManyChooserDataSource, relatedDcmtsChooserDataSource,
|
|
115
|
+
// Flags / State booleans
|
|
116
|
+
showRelatedDcmtsChooser, isOpenDetails, isOpenMaster, isOpenArchiveRelationForm, isPairingManyToMany, showManyToManyChooser, showPairSearchModal, currentTIDHasDetailRelations, currentTIDHasMasterRelations, canArchiveMasterRelation, canArchiveDetailRelation, hasManyToManyRelation, showPairDcmtsModal,
|
|
117
|
+
// Pair search modal state
|
|
118
|
+
pairSearchModalTargetTID, pairSearchModalParentTID, pairSearchModalParentDID, pairSearchModalRelation, pairSearchModalInputMids,
|
|
119
|
+
// Config
|
|
120
|
+
pairFloatingActionConfig, pairSearchModalFloatingActionConfig,
|
|
121
|
+
// Archive state
|
|
122
|
+
archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, archiveType,
|
|
123
|
+
// Setters
|
|
124
|
+
setIsOpenDetails, setIsOpenMaster, setShowRelatedDcmtsChooser, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, setShowManyToManyChooser, setShowPairDcmtsModal, setShowPairSearchModal,
|
|
125
|
+
// Logic / Helpers
|
|
126
|
+
checkRelatedDcmtsArchiveCapability, checkManyToManyCapability,
|
|
127
|
+
// Actions
|
|
128
|
+
pairManyToMany, executeManyToManyPairing, archiveDetailDocuments, archiveMasterDocuments, archiveRelatedDcmtHandler } = useRelatedDocuments({
|
|
129
|
+
selectedSearchResult: isDcmtFormContext ? selectedDcmtSearchResultRelations : searchResult,
|
|
130
|
+
focusedItem: focusedItem,
|
|
131
|
+
currentSearchResults
|
|
132
|
+
});
|
|
133
|
+
// Context-aware configuration for relations and other context-dependent logic
|
|
134
|
+
const contextConfig = {
|
|
135
|
+
hasMasterRelations: isDcmtFormContext ? dcmtTIDHasMasterRelations : currentTIDHasMasterRelations,
|
|
136
|
+
hasDetailRelations: isDcmtFormContext ? dcmtTIDHasDetailRelations : currentTIDHasDetailRelations,
|
|
137
|
+
canShowRelations: !isDcmtFormContext || inputDcmtFormLayoutMode === LayoutModes.Update,
|
|
138
|
+
approvalTID: isDcmtFormContext ? (approvalVID ?? focusedItem?.TID) : focusedItem?.TID,
|
|
139
|
+
};
|
|
140
|
+
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
141
|
+
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
142
|
+
const MAX_DCMTS_FOR_SELECTION_REFRESH = 100;
|
|
143
|
+
const { pinnedItemIds, togglePin, setPinnedItemIds } = useFloatingBarPinnedItems();
|
|
144
|
+
const deviceType = useDeviceType();
|
|
145
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
|
146
|
+
const [showFloatingBar, setShowFloatingBar] = useState(allowFloatingBar);
|
|
147
|
+
const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
|
|
148
|
+
const [dcmtFormLayoutMode, setDcmtFormLayoutMode] = useState(LayoutModes.Update);
|
|
149
|
+
const [currentCustomButton, setCurrentCustomButton] = useState();
|
|
150
|
+
// State to control the visibility of the details form
|
|
151
|
+
const [showSearchTMDatagrid, setShowSearchTMDatagrid] = useState(false);
|
|
152
|
+
const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
|
|
153
|
+
const [isOpenSharedArchive, setIsOpenSharedArchive] = useState(false);
|
|
154
|
+
const [sharedDcmtFile, setSharedDcmtFile] = useState(undefined);
|
|
155
|
+
// State to control the shared document search results
|
|
156
|
+
const [sharedDcmtSearchResults, setSharedDcmtSearchResults] = useState([]);
|
|
157
|
+
/** Toppy Operations */
|
|
158
|
+
const [showApprovePopup, setShowApprovePopup] = useState(false);
|
|
159
|
+
const [showRejectPopup, setShowRejectPopup] = useState(false);
|
|
160
|
+
const [showReAssignPopup, setShowReAssignPopup] = useState(false);
|
|
161
|
+
const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
|
|
162
|
+
const [isOpenBatchUpdate, setIsOpenBatchUpdate] = useState(false);
|
|
163
|
+
const [isModifiedBatchUpdate, setIsModifiedBatchUpdate] = useState(false);
|
|
164
|
+
const openDetailDcmtsFormHandler = (value) => { setIsOpenDetails(value); };
|
|
165
|
+
const openMasterDcmtsFormHandler = (value) => { setIsOpenMaster(value); };
|
|
166
|
+
// State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
|
|
167
|
+
const [showExportForm, setShowExportForm] = useState(false);
|
|
168
|
+
const updateShowApprovePopup = (value) => {
|
|
169
|
+
setShowApprovePopup(value);
|
|
170
|
+
};
|
|
171
|
+
const updateShowRejectPopup = (value) => {
|
|
172
|
+
setShowRejectPopup(value);
|
|
173
|
+
};
|
|
174
|
+
const updateShowReAssignPopup = (value) => {
|
|
175
|
+
setShowReAssignPopup(value);
|
|
176
|
+
};
|
|
177
|
+
const updateShowMoreInfoPopup = (value) => {
|
|
178
|
+
setShowMoreInfoPopup(value);
|
|
179
|
+
};
|
|
180
|
+
const onDcmtFormOpenChange = (isOpen, layoutMode) => {
|
|
181
|
+
setIsOpenDcmtForm(isOpen);
|
|
182
|
+
setDcmtFormLayoutMode(layoutMode);
|
|
183
|
+
};
|
|
184
|
+
const handleAddItem = (tid, did) => {
|
|
185
|
+
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
186
|
+
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
187
|
+
};
|
|
188
|
+
const handleRemoveItem = (tid, did) => {
|
|
189
|
+
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
190
|
+
};
|
|
191
|
+
const updateBatchUpdateForm = (value) => { setIsOpenBatchUpdate(value); };
|
|
192
|
+
// Disabilita se ci sono più documenti da processare o se non c'è un documento valido
|
|
193
|
+
const isDisabledForSingleRow = () => {
|
|
194
|
+
return selectedDcmtInfos.length !== 1 || selectedDcmtInfos[0]?.TID === undefined || selectedDcmtInfos[0]?.DID === undefined;
|
|
195
|
+
};
|
|
196
|
+
// Disabilita se non ci sono documenti validi da processare
|
|
197
|
+
const isDisabledForMultiRow = () => {
|
|
198
|
+
return selectedDcmtInfos.length === 0 || selectedDcmtInfos.every(d => d.TID === undefined || d.DID === undefined);
|
|
199
|
+
};
|
|
200
|
+
const onRefreshBlog = async () => {
|
|
201
|
+
await onRefreshBlogForm?.();
|
|
202
|
+
await onRefreshBlogDatagrid?.();
|
|
203
|
+
};
|
|
204
|
+
const signatureInformationCallback = async (isMobile, inputDcmts) => {
|
|
205
|
+
try {
|
|
206
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
207
|
+
if (!inputDcmts || inputDcmts.length === 0) {
|
|
208
|
+
ShowAlert({
|
|
209
|
+
message: SDKUI_Localizator.NoDcmtSelected,
|
|
210
|
+
mode: 'warning',
|
|
211
|
+
title: SDKUI_Localizator.SignatureInformation,
|
|
212
|
+
duration: 3000
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (inputDcmts.length > 1) {
|
|
217
|
+
ShowAlert({
|
|
218
|
+
message: "Selezionare un solo documento per visualizzare le informazioni di firma",
|
|
219
|
+
mode: 'warning',
|
|
220
|
+
title: SDKUI_Localizator.SignatureInformation,
|
|
221
|
+
duration: 3000
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
TMMessageBoxManager.show({
|
|
226
|
+
title: SDKUI_Localizator.SignatureInformation,
|
|
227
|
+
buttons: [ButtonNames.OK],
|
|
228
|
+
showToppy: false,
|
|
229
|
+
resizable: true,
|
|
230
|
+
initialWidth: !isMobile ? '700px' : undefined,
|
|
231
|
+
message: _jsx(TMSignatureInfoContent, { inputDcmt: inputDcmts[0] })
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
console.error(error);
|
|
236
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
TMSpinner.hide();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const openFormHandler = (layoutMode) => {
|
|
243
|
+
const currentDcmt = selectedDcmtInfos?.[0];
|
|
244
|
+
// Verifica che ci sia un documento selezionato con TID e DID validi
|
|
245
|
+
if (!currentDcmt || currentDcmt.TID === undefined || currentDcmt.DID === undefined) {
|
|
246
|
+
ShowAlert({
|
|
247
|
+
message: SDKUI_Localizator.InvalidDcmt,
|
|
248
|
+
mode: "warning",
|
|
249
|
+
title: layoutMode === LayoutModes.Ark ? SDKUI_Localizator.Archive : SDKUI_Localizator.OpenTheDocument,
|
|
250
|
+
duration: 3000
|
|
251
|
+
});
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
onDcmtFormOpenChange(true, layoutMode);
|
|
255
|
+
};
|
|
256
|
+
const openSharedArchiveHandler = async () => {
|
|
257
|
+
if (selectedDcmtInfos.length === 0) {
|
|
258
|
+
ShowAlert({ message: "Nessun documento selezionato", mode: "warning", title: 'Archiviazione Condivisa', duration: 3000 });
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed) {
|
|
262
|
+
ShowAlert({
|
|
263
|
+
message: "Non hai i permessi per archiviare documenti di questo tipo.",
|
|
264
|
+
mode: 'warning',
|
|
265
|
+
title: 'Archivio Condivisa',
|
|
266
|
+
duration: 5000
|
|
267
|
+
});
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
const rfo = new RetrieveFileOptions();
|
|
272
|
+
rfo.retrieveReason = DcmtOpers.None;
|
|
273
|
+
rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
|
|
274
|
+
const dcmt = selectedDcmtInfos[0];
|
|
275
|
+
let dcmtFile = await getDcmtFileAsync({ TID: dcmt?.TID, DID: dcmt?.DID }, rfo, 'Archiviazione Condivisa', false, true);
|
|
276
|
+
if (dcmtFile) {
|
|
277
|
+
setSharedDcmtFile(dcmtFile?.file);
|
|
278
|
+
}
|
|
279
|
+
setIsOpenSharedArchive(true);
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const showSharedDcmtsHandler = async () => {
|
|
286
|
+
try {
|
|
287
|
+
if (selectedDcmtInfos.length === 0) {
|
|
288
|
+
ShowAlert({ message: "Nessun documento selezionato", mode: "warning", title: 'Documenti Condivisi', duration: 3000 });
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const dcmt = selectedDcmtInfos[0];
|
|
292
|
+
TMSpinner.show({ description: "Caricamento documenti condivisi..." });
|
|
293
|
+
const se = SDK_Globals.tmSession?.NewSearchEngine();
|
|
294
|
+
const sharedDcmts = await se?.GetSharedDcmtsAsync(dcmt.TID, dcmt.DID);
|
|
295
|
+
if (sharedDcmts && sharedDcmts.length > 0) {
|
|
296
|
+
setSharedDcmtSearchResults(sharedDcmts);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
ShowAlert({ message: "Nessun documento condiviso trovato.", mode: "info", title: 'Documenti Condivisi', duration: 5000 });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
304
|
+
}
|
|
305
|
+
finally {
|
|
306
|
+
TMSpinner.hide();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const addPinIconToItems = (items) => {
|
|
310
|
+
if (isMobile || !enablePinIcons)
|
|
311
|
+
return items;
|
|
312
|
+
return items.map(item => {
|
|
313
|
+
const newItem = { ...item };
|
|
314
|
+
if (item.id && item.onClick && !item.submenu) {
|
|
315
|
+
newItem.rightIconProps = {
|
|
316
|
+
icon: _jsx(IconPin, {}),
|
|
317
|
+
activeColor: 'red',
|
|
318
|
+
inactiveColor: 'black',
|
|
319
|
+
isActive: pinnedItemIds?.includes(item.id) ?? false,
|
|
320
|
+
onClick: () => togglePin(item.id),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
if (item.submenu && item.submenu.length > 0) {
|
|
324
|
+
newItem.submenu = addPinIconToItems(item.submenu);
|
|
325
|
+
}
|
|
326
|
+
return newItem;
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
const addToFavoriteOperation = () => {
|
|
330
|
+
return {
|
|
331
|
+
id: 'fav',
|
|
332
|
+
icon: _jsx(IconStar, {}),
|
|
333
|
+
name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
|
|
334
|
+
operationType: 'multiRow',
|
|
335
|
+
disabled: context === SearchResultContext.FAVORITES_AND_RECENTS || isDisabledForMultiRow(),
|
|
336
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.AddToFavs); onRefreshAfterAddDcmtToFavs?.(); },
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
const addReplaceFileOperation = () => {
|
|
340
|
+
return {
|
|
341
|
+
id: 'repl',
|
|
342
|
+
icon: _jsx(IconSubstFile, {}),
|
|
343
|
+
name: SDKUI_Localizator.AddOrSubstFile,
|
|
344
|
+
operationType: 'singleRow',
|
|
345
|
+
disabled: dtd?.perm?.canSubstFile !== AccessLevels.Yes ? true : isDisabledForSingleRow(),
|
|
346
|
+
onClick: async () => {
|
|
347
|
+
const currentDcmt = selectedDcmtInfos?.[0];
|
|
348
|
+
if (!currentDcmt || currentDcmt.TID === undefined || currentDcmt.DID === undefined) {
|
|
349
|
+
ShowAlert({
|
|
350
|
+
message: SDKUI_Localizator.InvalidDcmt,
|
|
351
|
+
mode: "warning",
|
|
352
|
+
});
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.SubstituteFile, async () => {
|
|
356
|
+
await refreshDocumentPreview();
|
|
357
|
+
await onRefreshOperationsDatagrid?.();
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
const openFormOperation = () => {
|
|
363
|
+
return {
|
|
364
|
+
id: 'open-form',
|
|
365
|
+
icon: _jsx(IconPreview, {}),
|
|
366
|
+
name: SDKUI_Localizator.OpenForm,
|
|
367
|
+
operationType: 'singleRow',
|
|
368
|
+
disabled: isDisabledForSingleRow(),
|
|
369
|
+
onClick: () => openFormHandler(LayoutModes.Update)
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
const deletetionMenuItem = () => {
|
|
373
|
+
return {
|
|
374
|
+
id: 'del',
|
|
375
|
+
icon: _jsx(IconDelete, {}),
|
|
376
|
+
name: SDKUI_Localizator.Deletion,
|
|
377
|
+
operationType: 'multiRow',
|
|
378
|
+
disabled: isDisabledForMultiRow(),
|
|
379
|
+
submenu: [
|
|
380
|
+
{
|
|
381
|
+
id: 'del-log',
|
|
382
|
+
icon: _jsx(IconDelete, {}),
|
|
383
|
+
name: SDKUI_Localizator.LogDelete,
|
|
384
|
+
operationType: 'multiRow',
|
|
385
|
+
disabled: dtd?.perm?.canLogicalDelete !== AccessLevels.Yes ? true : isDisabledForMultiRow(),
|
|
386
|
+
onClick: async () => {
|
|
387
|
+
await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.LogDelete, selectedDcmtInfos.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsyncDatagrid);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: 'del-rest',
|
|
392
|
+
icon: _jsx(IconUndo, {}),
|
|
393
|
+
name: SDKUI_Localizator.Restore,
|
|
394
|
+
operationType: 'multiRow',
|
|
395
|
+
disabled: dtd?.perm?.canLogicalDelete !== AccessLevels.Yes ? true : isDisabledForMultiRow(),
|
|
396
|
+
onClick: async () => {
|
|
397
|
+
await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.Undelete, selectedDcmtInfos.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsyncDatagrid);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
id: 'del-phys',
|
|
402
|
+
icon: _jsx(IconCloseCircle, {}),
|
|
403
|
+
name: SDKUI_Localizator.PhysDelete,
|
|
404
|
+
operationType: 'multiRow',
|
|
405
|
+
disabled: dtd?.perm?.canPhysicalDelete !== AccessLevels.Yes ? true : isDisabledForMultiRow(),
|
|
406
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.PhysDelete, onRefreshSearchAsyncDatagrid); }
|
|
407
|
+
},
|
|
408
|
+
]
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
const fileCheckMenuItem = () => {
|
|
412
|
+
return {
|
|
413
|
+
id: 'chk',
|
|
414
|
+
icon: _jsx(IconCheckFile, {}),
|
|
415
|
+
name: SDKUI_Localizator.FileCheck,
|
|
416
|
+
operationType: 'multiRow',
|
|
417
|
+
disabled: isDisabledForMultiRow(),
|
|
418
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.CheckFile); }
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
const fileConversionsMenuItem = () => {
|
|
422
|
+
return {
|
|
423
|
+
id: 'conv',
|
|
424
|
+
icon: _jsx(IconConvertFilePdf, {}),
|
|
425
|
+
name: SDKUI_Localizator.FileConversion,
|
|
426
|
+
operationType: 'multiRow',
|
|
427
|
+
disabled: isDisabledForMultiRow(),
|
|
428
|
+
onClick: async () => {
|
|
429
|
+
let format = await confirmFormat();
|
|
430
|
+
if (format === FileFormats.None)
|
|
431
|
+
return;
|
|
432
|
+
const dcmts = selectedDcmtInfos.map(dcmt => {
|
|
433
|
+
const cacheKey = `${dcmt.TID}-${dcmt.DID}`;
|
|
434
|
+
if (dcmtsFileCachePreview.has(cacheKey)) {
|
|
435
|
+
removeDcmtsFileCache(cacheKey);
|
|
436
|
+
}
|
|
437
|
+
return { ...dcmt, fileFormat: format };
|
|
438
|
+
});
|
|
439
|
+
const refreshFn = async () => {
|
|
440
|
+
const baseRefreshFn = dcmts.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsyncDatagrid;
|
|
441
|
+
await onRefreshPreviewCallback();
|
|
442
|
+
await baseRefreshFn?.();
|
|
443
|
+
await onRefreshOperationsDatagrid?.();
|
|
444
|
+
};
|
|
445
|
+
await runOperationAsync(dcmts, DcmtOperationTypes.ConvertFile, refreshFn);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
const createContextualTaskMenuItem = () => {
|
|
450
|
+
return {
|
|
451
|
+
id: 'task',
|
|
452
|
+
icon: _jsx(IconActivity, {}),
|
|
453
|
+
name: SDKUI_Localizator.CreateContextualTask,
|
|
454
|
+
operationType: 'singleRow',
|
|
455
|
+
disabled: isDisabledForSingleRow(),
|
|
456
|
+
onClick: () => { openTaskFormHandler?.(); }
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
const downloadFileMenuItem = () => {
|
|
460
|
+
return {
|
|
461
|
+
id: 'dl',
|
|
462
|
+
icon: _jsx(IconDownload, {}),
|
|
463
|
+
operationType: 'multiRow',
|
|
464
|
+
disabled: dtd?.perm?.canRetrieveFile !== AccessLevels.Yes ? true : isDisabledForMultiRow(),
|
|
465
|
+
name: SDKUI_Localizator.DownloadFile, onClick: () => downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Dcmt, "download", undefined, undefined, true)
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
const downloadXMLAttachmentsMenuItem = () => {
|
|
469
|
+
return {
|
|
470
|
+
id: 'dl-xml',
|
|
471
|
+
icon: _jsx(IconDownload, {}),
|
|
472
|
+
operationType: 'singleRow',
|
|
473
|
+
disabled: !isXMLFileExt(selectedDcmtInfos?.[0]?.FILEEXT) ? true : isDisabledForSingleRow(),
|
|
474
|
+
name: SDKUI_Localizator.DownloadXMLAttachments, onClick: () => downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
const duplicateDocumentMenuItem = () => {
|
|
478
|
+
return {
|
|
479
|
+
id: 'dup',
|
|
480
|
+
icon: _jsx(IconArchiveDoc, {}),
|
|
481
|
+
name: SDKUI_Localizator.DuplicateDocument,
|
|
482
|
+
operationType: 'singleRow',
|
|
483
|
+
disabled: dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed ? true : isDisabledForSingleRow(),
|
|
484
|
+
onClick: () => { openFormHandler(LayoutModes.Ark); }
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
const batchUpdateMenuItem = () => {
|
|
488
|
+
return {
|
|
489
|
+
id: 'batch',
|
|
490
|
+
icon: _jsx(IconBatchUpdate, {}),
|
|
491
|
+
name: SDKUI_Localizator.BatchUpdate,
|
|
492
|
+
operationType: 'multiRow',
|
|
493
|
+
disabled: dtd?.perm?.canUpdate !== AccessLevelsEx.Yes && dtd?.perm?.canUpdate !== AccessLevelsEx.Mixed ? true : isDisabledForMultiRow(),
|
|
494
|
+
onClick: () => updateBatchUpdateForm(true)
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
const passToArchive = () => {
|
|
498
|
+
return {
|
|
499
|
+
id: 'p2a',
|
|
500
|
+
icon: _jsx(IconMenuCAArchive, { fontSize: 16, viewBox: '11 11.5 26 27', strokeWidth: 2 }),
|
|
501
|
+
name: SDKUI_Localizator.PassToArchive,
|
|
502
|
+
operationType: 'singleRow',
|
|
503
|
+
disabled: dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed ? true : isDisabledForSingleRow(),
|
|
504
|
+
onClick: async () => {
|
|
505
|
+
try {
|
|
506
|
+
const item = selectedDcmtInfos.length === 1 ? selectedDcmtInfos[0] : undefined;
|
|
507
|
+
if (!item?.TID || !item?.DID)
|
|
508
|
+
return;
|
|
509
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
510
|
+
const getMetadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(item.TID, item.DID, true);
|
|
511
|
+
const dtdFull = getMetadataResult?.dtdResult;
|
|
512
|
+
const rowsFull = dtdFull?.rows ? dtdFull.rows[0] : [];
|
|
513
|
+
const midsFull = getMetadataResult?.selectMIDs;
|
|
514
|
+
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(item.TID, item.DID, getMetadataResult);
|
|
515
|
+
const allMetadataValues = searchResultToMetadataValues(item.TID, dtdFull, rowsFull, midsFull, dtdWithMetadata?.metadata, LayoutModes.Update);
|
|
516
|
+
const outputMids = allMetadataValues
|
|
517
|
+
?.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
|
|
518
|
+
.map(md => ({ mid: md.mid, value: md.value })) || [];
|
|
519
|
+
TMSpinner.hide();
|
|
520
|
+
passToArchiveCallback?.(outputMids, item.TID);
|
|
521
|
+
}
|
|
522
|
+
catch (error) {
|
|
523
|
+
TMSpinner.hide();
|
|
524
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
const refreshDocumentPreview = async () => {
|
|
530
|
+
const currentDcmt = selectedDcmtInfos?.[0];
|
|
531
|
+
if (!currentDcmt)
|
|
532
|
+
return;
|
|
533
|
+
const cacheKey = `${currentDcmt.TID}-${currentDcmt.DID}`;
|
|
534
|
+
if (dcmtsFileCachePreview.has(cacheKey))
|
|
535
|
+
removeDcmtsFileCache(cacheKey);
|
|
536
|
+
await onRefreshPreviewCallback();
|
|
537
|
+
await onRefreshDataRowsAsync?.();
|
|
538
|
+
};
|
|
539
|
+
const pdfEditorMenuItem = (openEditPdfCallback) => {
|
|
540
|
+
// Take the first document (used for validation checks)
|
|
541
|
+
const firstDoc = selectedDcmtInfos?.[0];
|
|
542
|
+
// Check if the selected document is a PDF
|
|
543
|
+
const isPdf = firstDoc?.FILEEXT?.toLowerCase() === "pdf";
|
|
544
|
+
// Check if the document has been signed
|
|
545
|
+
const isSigned = firstDoc?.ISSIGNED === 1;
|
|
546
|
+
// Check if the user has permission to substitute files
|
|
547
|
+
const canSubstitute = dtd?.perm?.canSubstFile === AccessLevels.Yes;
|
|
548
|
+
// Determine whether the menu item should be disabled
|
|
549
|
+
const isDisabled = !canSubstitute || isDisabledForSingleRow() || !isPdf || isSigned;
|
|
550
|
+
return {
|
|
551
|
+
id: 'pdf-ed',
|
|
552
|
+
icon: _jsx(IconEdit, {}),
|
|
553
|
+
name: "PDF Editor",
|
|
554
|
+
operationType: 'singleRow',
|
|
555
|
+
disabled: isDisabled,
|
|
556
|
+
onClick: () => openEditPdfCallback(selectedDcmtInfos, refreshDocumentPreview),
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
const handleSignApprove = () => {
|
|
560
|
+
if (!onOpenS4TViewerRequest) {
|
|
561
|
+
ShowAlert({
|
|
562
|
+
message: "Non è stato possibile proseguire con la firma e l'approvazione.",
|
|
563
|
+
mode: "warning",
|
|
564
|
+
duration: 3000,
|
|
565
|
+
title: SDKUI_Localizator.SignatureAndApprove,
|
|
566
|
+
});
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
onOpenS4TViewerRequest(selectedDcmtInfos, refreshDocumentPreview);
|
|
570
|
+
};
|
|
571
|
+
const signatureMenuItem = () => {
|
|
572
|
+
return {
|
|
573
|
+
id: 'sign',
|
|
574
|
+
icon: _jsx(IconSignaturePencil, {}),
|
|
575
|
+
name: SDKUI_Localizator.Signature,
|
|
576
|
+
disabled: isDisabledForSingleRow() && isDisabledForMultiRow(),
|
|
577
|
+
submenu: [
|
|
578
|
+
{
|
|
579
|
+
id: 'sign-do',
|
|
580
|
+
icon: _jsx(IconSignaturePencil, {}),
|
|
581
|
+
operationType: 'singleRow',
|
|
582
|
+
disabled: isDisabledForSingleRow(),
|
|
583
|
+
name: SDKUI_Localizator.Signature,
|
|
584
|
+
onClick: handleSignApprove
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: 'sign-info',
|
|
588
|
+
icon: _jsx(IconCircleInfo, {}),
|
|
589
|
+
name: SDKUI_Localizator.SignatureInformation,
|
|
590
|
+
operationType: 'singleRow',
|
|
591
|
+
disabled: isDisabledForSingleRow(),
|
|
592
|
+
onClick: () => signatureInformationCallback(isMobile, selectedDcmtInfos)
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
id: 'sign-verify',
|
|
596
|
+
icon: _jsx(IconCheckIn, {}),
|
|
597
|
+
name: SDKUI_Localizator.VerifySignature,
|
|
598
|
+
operationType: 'multiRow',
|
|
599
|
+
disabled: isDisabledForMultiRow(),
|
|
600
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.VerifySign); }
|
|
601
|
+
},
|
|
602
|
+
]
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
const handleCheckOutOperationCallback = async (checkout) => {
|
|
606
|
+
const firstDoc = selectedDcmtInfos?.[0];
|
|
607
|
+
if (!firstDoc)
|
|
608
|
+
return;
|
|
609
|
+
const onRefreshAsync = async () => {
|
|
610
|
+
await updateCurrentDcmt?.();
|
|
611
|
+
await refreshFocusedDataRowAsync?.(firstDoc.TID, firstDoc.DID, true);
|
|
612
|
+
};
|
|
613
|
+
await handleCheckOutCallback(firstDoc, checkout, dtd?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, onRefreshAsync);
|
|
614
|
+
};
|
|
615
|
+
const handleCheckInOperationCallback = async () => {
|
|
616
|
+
const firstDoc = selectedDcmtInfos?.[0];
|
|
617
|
+
if (!firstDoc)
|
|
618
|
+
return;
|
|
619
|
+
firstDoc.fileName = dtd?.name ?? SDKUI_Localizator.SearchResult;
|
|
620
|
+
const onRefreshAsync = async () => {
|
|
621
|
+
await updateCurrentDcmt?.();
|
|
622
|
+
await refreshFocusedDataRowAsync?.(firstDoc.TID, firstDoc.DID, true);
|
|
623
|
+
};
|
|
624
|
+
await handleCheckInCallback(firstDoc, onRefreshAsync);
|
|
625
|
+
};
|
|
626
|
+
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
627
|
+
const firstDoc = selectedDcmtInfos?.[0];
|
|
628
|
+
if (!firstDoc)
|
|
629
|
+
return;
|
|
630
|
+
copyCheckoutPathToClipboardCallback(firstDoc, dtd?.name ?? SDKUI_Localizator.SearchResult);
|
|
631
|
+
};
|
|
632
|
+
const checkinMenuItem = () => {
|
|
633
|
+
// Take the first document (used for validation checks)
|
|
634
|
+
let dcmt = focusedItem;
|
|
635
|
+
if (isDcmtFormContext) {
|
|
636
|
+
dcmt = dcmtDataRowForCicoStatus;
|
|
637
|
+
}
|
|
638
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(dcmt, allUsers, dtd);
|
|
639
|
+
return {
|
|
640
|
+
id: 'cico',
|
|
641
|
+
icon: _jsx(IconFileDots, {}),
|
|
642
|
+
name: "Check in/Check out",
|
|
643
|
+
disabled: dcmt === undefined || isDisabledForSingleRow(),
|
|
644
|
+
submenu: [
|
|
645
|
+
{
|
|
646
|
+
id: 'co',
|
|
647
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-edit" }),
|
|
648
|
+
name: 'Check out',
|
|
649
|
+
disabled: !cicoEnabled || checkoutStatus.isCheckedOut || isDisabledForSingleRow(),
|
|
650
|
+
onClick: () => handleCheckOutOperationCallback(true),
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
id: 'ci',
|
|
654
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-unlock" }),
|
|
655
|
+
name: 'Check in',
|
|
656
|
+
onClick: () => handleCheckInOperationCallback(),
|
|
657
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || isDisabledForSingleRow()
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
id: 'co-cancel',
|
|
661
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-remove" }),
|
|
662
|
+
name: SDKUI_Localizator.CancelCheckOut,
|
|
663
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || isDisabledForSingleRow(),
|
|
664
|
+
onClick: () => handleCheckOutOperationCallback(false),
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: 'co-info',
|
|
668
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-info" }),
|
|
669
|
+
name: SDKUI_Localizator.CheckoutInfo,
|
|
670
|
+
onClick: showCheckoutInformationFormCallback,
|
|
671
|
+
disabled: !checkoutStatus.isCheckedOut || isDisabledForSingleRow()
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
id: 'co-path',
|
|
675
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-copy" }),
|
|
676
|
+
name: SDKUI_Localizator.CopyCheckoutPath,
|
|
677
|
+
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
678
|
+
disabled: !checkoutStatus.isCheckedOut || isDisabledForSingleRow()
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
id: 'co-hist',
|
|
682
|
+
icon: _jsx("span", { style: { fontSize: '18px' }, className: "dx-icon-clock" }),
|
|
683
|
+
name: SDKUI_Localizator.History,
|
|
684
|
+
disabled: !cicoEnabled || isDisabledForSingleRow(),
|
|
685
|
+
onClick: showHistoryCallback,
|
|
686
|
+
},
|
|
687
|
+
]
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
const relationsMenuItem = () => {
|
|
691
|
+
return {
|
|
692
|
+
id: 'rel',
|
|
693
|
+
icon: _jsx(IconRelation, {}),
|
|
694
|
+
name: SDKUI_Localizator.Relations,
|
|
695
|
+
operationType: 'multiRow',
|
|
696
|
+
disabled: isDisabledForMultiRow(),
|
|
697
|
+
submenu: [
|
|
698
|
+
{
|
|
699
|
+
id: 'rel-pair',
|
|
700
|
+
icon: _jsx(IconPair, {}),
|
|
701
|
+
name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
702
|
+
operationType: 'multiRow',
|
|
703
|
+
disabled: !hasManyToManyRelation || isDisabledForMultiRow(),
|
|
704
|
+
onClick: async () => await pairManyToMany(true)
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
id: 'rel-unpair',
|
|
708
|
+
icon: _jsx(IconUnpair, {}),
|
|
709
|
+
name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
710
|
+
operationType: 'multiRow',
|
|
711
|
+
disabled: !hasManyToManyRelation || isDisabledForMultiRow(),
|
|
712
|
+
onClick: async () => await pairManyToMany(false)
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
id: 'rel-ark-mst',
|
|
716
|
+
icon: _jsx(IconArchiveMaster, {}),
|
|
717
|
+
name: SDKUI_Localizator.ArchiveMasterDocument,
|
|
718
|
+
operationType: 'multiRow',
|
|
719
|
+
beginGroup: true,
|
|
720
|
+
disabled: canArchiveMasterRelation !== true,
|
|
721
|
+
onClick: async () => await archiveMasterDocuments(selectedDcmtInfos?.[0]?.TID)
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
id: 'rel-ark-det',
|
|
725
|
+
icon: _jsx(IconArchiveDetail, {}),
|
|
726
|
+
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
727
|
+
operationType: 'multiRow',
|
|
728
|
+
disabled: canArchiveDetailRelation !== true,
|
|
729
|
+
onClick: async () => await archiveDetailDocuments?.(selectedDcmtInfos?.[0]?.TID)
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
id: 'rel-mst',
|
|
733
|
+
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
|
|
734
|
+
name: SDKUI_Localizator.DcmtsMaster,
|
|
735
|
+
operationType: 'singleRow',
|
|
736
|
+
visible: true,
|
|
737
|
+
beginGroup: true,
|
|
738
|
+
disabled: !contextConfig.hasMasterRelations || !contextConfig.canShowRelations || isDisabledForMultiRow(),
|
|
739
|
+
onClick: () => openMasterDcmtsFormHandler(true)
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
id: 'rel-det',
|
|
743
|
+
icon: _jsx(IconDetailDcmts, {}),
|
|
744
|
+
name: SDKUI_Localizator.DcmtsDetail,
|
|
745
|
+
operationType: 'multiRow',
|
|
746
|
+
disabled: !contextConfig.hasDetailRelations || !contextConfig.canShowRelations || isDisabledForMultiRow(),
|
|
747
|
+
visible: true,
|
|
748
|
+
onClick: () => openDetailDcmtsFormHandler(true)
|
|
749
|
+
}
|
|
750
|
+
]
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
/* const shareMenuItem = (): TMContextMenuItemProps => {
|
|
754
|
+
return {
|
|
755
|
+
icon: <IconShare />,
|
|
756
|
+
name: "Condivisione",
|
|
757
|
+
operationType: 'multiRow',
|
|
758
|
+
disabled: fromDatagrid ? false : isDisabledForMultiRow(),
|
|
759
|
+
submenu: [
|
|
760
|
+
{
|
|
761
|
+
icon: <IconShare />,
|
|
762
|
+
name: "Archiviazione condivisa",
|
|
763
|
+
operationType: 'multiRow',
|
|
764
|
+
disabled: fromDatagrid ? false : isDisabledForMultiRow(),
|
|
765
|
+
onClick: () => ShowAlert({ message: "TODO Archiviazione condivisa", mode: 'info', title: `${"TODO"}`, duration: 3000 })
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
icon: <IconSharedDcmt />,
|
|
769
|
+
name: "Documenti condivisi",
|
|
770
|
+
operationType: 'multiRow',
|
|
771
|
+
disabled: fromDatagrid ? false : isDisabledForMultiRow(),
|
|
772
|
+
onClick: () => ShowAlert({ message: "TODO Documenti condivisi", mode: 'info', title: `${"TODO"}`, duration: 3000 })
|
|
773
|
+
}
|
|
774
|
+
]
|
|
775
|
+
}
|
|
776
|
+
} */
|
|
777
|
+
const sharedDcmtsMenuItem = () => {
|
|
778
|
+
return {
|
|
779
|
+
id: 'shr',
|
|
780
|
+
icon: _jsx(IconSharedDcmt, {}),
|
|
781
|
+
name: SDKUI_Localizator.SharedDocuments,
|
|
782
|
+
operationType: 'multiRow',
|
|
783
|
+
disabled: isDisabledForSingleRow(),
|
|
784
|
+
submenu: [
|
|
785
|
+
{
|
|
786
|
+
id: 'shr-ark',
|
|
787
|
+
icon: _jsx(IconSharedDcmt, {}),
|
|
788
|
+
name: SDKUI_Localizator.SharedArchiving,
|
|
789
|
+
operationType: 'singleRow',
|
|
790
|
+
disabled: isDisabledForSingleRow(),
|
|
791
|
+
onClick: async () => { await openSharedArchiveHandler(); }
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
id: 'shr-show',
|
|
795
|
+
icon: _jsx(IconSharedDcmt, {}),
|
|
796
|
+
name: SDKUI_Localizator.ShowSharedDocuments,
|
|
797
|
+
operationType: 'multiRow',
|
|
798
|
+
disabled: isDisabledForSingleRow(),
|
|
799
|
+
onClick: async () => { await showSharedDcmtsHandler(); }
|
|
800
|
+
}
|
|
801
|
+
]
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
const fullTextSearchMenuItem = () => {
|
|
805
|
+
const dcmt = selectedItemsFull?.[0];
|
|
806
|
+
return {
|
|
807
|
+
id: 'ft',
|
|
808
|
+
icon: _jsx(IconSearch, {}),
|
|
809
|
+
name: SDKUI_Localizator.FullTextSearch,
|
|
810
|
+
operationType: 'multiRow',
|
|
811
|
+
disabled: isDisabledForMultiRow(),
|
|
812
|
+
submenu: [
|
|
813
|
+
{
|
|
814
|
+
id: 'ft-info',
|
|
815
|
+
icon: _jsx(IconInfo, {}),
|
|
816
|
+
name: SDKUI_Localizator.IndexingInformation,
|
|
817
|
+
operationType: 'singleRow',
|
|
818
|
+
disabled: isDisabledForSingleRow(),
|
|
819
|
+
onClick: async () => {
|
|
820
|
+
try {
|
|
821
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Loading}...` });
|
|
822
|
+
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(dcmt.TID, dcmt.DID);
|
|
823
|
+
TMMessageBoxManager.show({
|
|
824
|
+
buttons: [ButtonNames.OK],
|
|
825
|
+
showToppy: false,
|
|
826
|
+
resizable: true,
|
|
827
|
+
initialWidth: !isMobile ? '700px' : undefined,
|
|
828
|
+
message: msg,
|
|
829
|
+
title: SDKUI_Localizator.IndexingInformation
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
catch (e) {
|
|
833
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
834
|
+
}
|
|
835
|
+
finally {
|
|
836
|
+
TMSpinner.hide();
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
id: 'ft-idx',
|
|
842
|
+
icon: _jsx(IconArchiveDoc, {}),
|
|
843
|
+
name: SDKUI_Localizator.IndexOrReindex,
|
|
844
|
+
operationType: 'multiRow',
|
|
845
|
+
disabled: isDisabledForMultiRow(),
|
|
846
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.FreeSearchReindex); }
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
id: 'ft-del',
|
|
850
|
+
icon: _jsx(IconDelete, {}),
|
|
851
|
+
name: SDKUI_Localizator.IndexingDelete,
|
|
852
|
+
operationType: 'multiRow',
|
|
853
|
+
disabled: isDisabledForMultiRow(),
|
|
854
|
+
onClick: async () => { await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.FreeSearchPurge); }
|
|
855
|
+
},
|
|
856
|
+
...(dcmt?.FTExplanations !== undefined
|
|
857
|
+
? [{
|
|
858
|
+
id: 'ft-det',
|
|
859
|
+
icon: _jsx(IconPlatform, {}),
|
|
860
|
+
name: SDKUI_Localizator.ResultDetails,
|
|
861
|
+
operationType: 'singleRow',
|
|
862
|
+
disabled: isDisabledForSingleRow(),
|
|
863
|
+
onClick: () => {
|
|
864
|
+
TMMessageBoxManager.show({
|
|
865
|
+
showToppy: false,
|
|
866
|
+
buttons: [ButtonNames.OK],
|
|
867
|
+
message: dcmt?.FTExplanations, title: "Dettagli del risultato"
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
}] : []),
|
|
871
|
+
]
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
const otherOperationsMenuItem = () => {
|
|
875
|
+
return {
|
|
876
|
+
id: 'oth',
|
|
877
|
+
icon: _jsx(IconDotsVerticalCircleOutline, {}),
|
|
878
|
+
name: SDKUI_Localizator.Other,
|
|
879
|
+
submenu: [
|
|
880
|
+
{
|
|
881
|
+
id: 'oth-search',
|
|
882
|
+
icon: _jsx(IconSearch, {}),
|
|
883
|
+
name: showSearchTMDatagrid ? SDKUI_Localizator.HideSearch : SDKUI_Localizator.ShowSearch,
|
|
884
|
+
disabled: false,
|
|
885
|
+
onClick: () => setShowSearchTMDatagrid(prev => !prev)
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
id: 'oth-exp',
|
|
889
|
+
icon: _jsx(IconExportTo, {}),
|
|
890
|
+
name: SDKUI_Localizator.ExportTo,
|
|
891
|
+
operationType: 'multiRow',
|
|
892
|
+
disabled: false,
|
|
893
|
+
onClick: () => setShowExportForm(true)
|
|
894
|
+
},
|
|
895
|
+
...(enablePinIcons
|
|
896
|
+
? [{
|
|
897
|
+
id: 'oth-float',
|
|
898
|
+
icon: showFloatingBar ? _jsx(IconHide, {}) : _jsx(IconShow, {}),
|
|
899
|
+
name: showFloatingBar
|
|
900
|
+
? SDKUI_Localizator.HideFloatingBar
|
|
901
|
+
: SDKUI_Localizator.ShowFloatingBar,
|
|
902
|
+
disabled: false,
|
|
903
|
+
onClick: () => setShowFloatingBar(prev => !prev)
|
|
904
|
+
}]
|
|
905
|
+
: [])
|
|
906
|
+
]
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
/** MENU SPECIFICO ARCHIVED WORKGROUP */
|
|
910
|
+
const shareFromWgMenuItem = () => {
|
|
911
|
+
return {
|
|
912
|
+
id: 'wg-share',
|
|
913
|
+
icon: _jsx(IconShare, {}),
|
|
914
|
+
name: SDKUI_Localizator.Share,
|
|
915
|
+
visible: workingGroupContext !== undefined && openAddDocumentForm !== undefined,
|
|
916
|
+
disabled: workingGroupContext === undefined,
|
|
917
|
+
onClick: () => openAddDocumentForm && openAddDocumentForm(),
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
const copyFromWgMenuItem = () => {
|
|
921
|
+
return {
|
|
922
|
+
id: 'wg-copy',
|
|
923
|
+
icon: _jsx(IconCopy, {}),
|
|
924
|
+
name: SDKUI_Localizator.CopyToDrafts,
|
|
925
|
+
operationType: 'multiRow',
|
|
926
|
+
visible: openWGsCopyMoveForm !== undefined,
|
|
927
|
+
disabled: isDisabledForMultiRow(),
|
|
928
|
+
onClick: () => { (dtd && openWGsCopyMoveForm) && openWGsCopyMoveForm('copyToWgDraft', dtd, selectedDcmtInfos); },
|
|
929
|
+
};
|
|
930
|
+
};
|
|
931
|
+
const movetofolderFromWgMenuItem = () => {
|
|
932
|
+
return {
|
|
933
|
+
id: 'wg-move',
|
|
934
|
+
icon: _jsx(IconMoveToFolder, {}),
|
|
935
|
+
name: !isMobile ? SDKUI_Localizator.CopyToArchivedDocuments : SDKUI_Localizator.CopyToArchived,
|
|
936
|
+
operationType: 'multiRow',
|
|
937
|
+
visible: openWGsCopyMoveForm !== undefined,
|
|
938
|
+
disabled: isDisabledForMultiRow(),
|
|
939
|
+
onClick: () => { (dtd && openWGsCopyMoveForm) && openWGsCopyMoveForm('copyToWgArchivedDoc', dtd, selectedDcmtInfos); },
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
const commentFromWgMenuItem = (beginGroup) => {
|
|
943
|
+
return {
|
|
944
|
+
id: 'wg-cmt',
|
|
945
|
+
icon: _jsx("span", { className: "dx-icon-chat" }),
|
|
946
|
+
name: SDKUI_Localizator.Comment,
|
|
947
|
+
operationType: 'multiRow',
|
|
948
|
+
visible: workingGroupContext !== undefined && openCommentFormCallback !== undefined,
|
|
949
|
+
disabled: workingGroupContext === undefined,
|
|
950
|
+
onClick: () => openCommentFormCallback && openCommentFormCallback(selectedDcmtInfos),
|
|
951
|
+
beginGroup: beginGroup,
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
const removeFromWgMenuItem = (name) => {
|
|
955
|
+
return {
|
|
956
|
+
id: 'wg-rm',
|
|
957
|
+
icon: _jsx(IconDelete, {}),
|
|
958
|
+
name: name,
|
|
959
|
+
operationType: 'multiRow',
|
|
960
|
+
visible: workingGroupContext !== undefined,
|
|
961
|
+
disabled: workingGroupContext === undefined || isDisabledForMultiRow(),
|
|
962
|
+
onClick: async () => {
|
|
963
|
+
if (workingGroupContext)
|
|
964
|
+
selectedDcmtInfos.forEach(dcmt => dcmt.workingGroupId = workingGroupContext.id);
|
|
965
|
+
await runOperationAsync(selectedDcmtInfos, DcmtOperationTypes.RemoveFromWorkgroup, onRefreshSearchAsyncDatagrid);
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
const handleWFOperationCompleted = async () => {
|
|
970
|
+
await onWFOperationCompleted?.();
|
|
971
|
+
if (context !== SearchResultContext.DCMT_FORM && !showMoreInfoPopup) {
|
|
972
|
+
onCloseDcmtForm?.();
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
const customButtonMenuItems = () => {
|
|
976
|
+
const customButtonsItems = customButtonsLayout?.customButtons?.filter((customButton) => customButton.isForSearchResult && customButton.isForSearchResult > 0)
|
|
977
|
+
.map((customButton) => ({
|
|
978
|
+
icon: TMImageLibrary({ imageID: customButton.glyphID }),
|
|
979
|
+
name: customButton.title || 'Bottone personalizzato',
|
|
980
|
+
onClick: () => setCurrentCustomButton(customButton)
|
|
981
|
+
}));
|
|
982
|
+
return customButtonsItems && customButtonsItems.length > 0 ? {
|
|
983
|
+
icon: _jsx(IconCustom, {}),
|
|
984
|
+
name: SDKUI_Localizator.CustomButtons,
|
|
985
|
+
submenu: customButtonsItems
|
|
986
|
+
} : {};
|
|
987
|
+
};
|
|
988
|
+
// MENU STANDARD
|
|
989
|
+
const getDefaultMenuItems = () => {
|
|
990
|
+
return [
|
|
991
|
+
{
|
|
992
|
+
id: 'doc',
|
|
993
|
+
icon: _jsx(IconFileDots, {}),
|
|
994
|
+
name: !isMobile ? SDKUI_Localizator.DocumentOperations : SDKUI_Localizator.Documents,
|
|
995
|
+
disabled: isDisabledForSingleRow() && isDisabledForMultiRow(),
|
|
996
|
+
submenu: [
|
|
997
|
+
addToFavoriteOperation(),
|
|
998
|
+
addReplaceFileOperation(),
|
|
999
|
+
openFormOperation(),
|
|
1000
|
+
deletetionMenuItem(),
|
|
1001
|
+
fileCheckMenuItem(),
|
|
1002
|
+
fileConversionsMenuItem(),
|
|
1003
|
+
...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
|
|
1004
|
+
downloadFileMenuItem(),
|
|
1005
|
+
downloadXMLAttachmentsMenuItem(),
|
|
1006
|
+
duplicateDocumentMenuItem(),
|
|
1007
|
+
batchUpdateMenuItem(),
|
|
1008
|
+
passToArchive(),
|
|
1009
|
+
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
|
|
1010
|
+
]
|
|
1011
|
+
},
|
|
1012
|
+
signatureMenuItem(),
|
|
1013
|
+
checkinMenuItem(),
|
|
1014
|
+
allowRelations ? relationsMenuItem() : null,
|
|
1015
|
+
sharedDcmtsMenuItem(),
|
|
1016
|
+
// shareMenuItem(),
|
|
1017
|
+
fullTextSearchMenuItem(),
|
|
1018
|
+
otherOperationsMenuItem(),
|
|
1019
|
+
{
|
|
1020
|
+
id: 'wg',
|
|
1021
|
+
icon: _jsx(IconUserGroupOutline, {}),
|
|
1022
|
+
name: !isMobile ? SDKUI_Localizator.WorkgroupOperations : SDKUI_Localizator.WorkingGroups,
|
|
1023
|
+
operationType: 'multiRow',
|
|
1024
|
+
visible: openWGsCopyMoveForm !== undefined || workingGroupContext !== undefined,
|
|
1025
|
+
disabled: isDisabledForMultiRow(),
|
|
1026
|
+
beginGroup: true,
|
|
1027
|
+
submenu: [
|
|
1028
|
+
shareFromWgMenuItem(),
|
|
1029
|
+
copyFromWgMenuItem(),
|
|
1030
|
+
movetofolderFromWgMenuItem(),
|
|
1031
|
+
commentFromWgMenuItem(true),
|
|
1032
|
+
removeFromWgMenuItem(SDKUI_Localizator.Remove)
|
|
1033
|
+
]
|
|
1034
|
+
},
|
|
1035
|
+
];
|
|
1036
|
+
};
|
|
1037
|
+
const getArchivedWorkgroupMenuItems = () => {
|
|
1038
|
+
const items = [
|
|
1039
|
+
addReplaceFileOperation(),
|
|
1040
|
+
openFormOperation(),
|
|
1041
|
+
deletetionMenuItem(),
|
|
1042
|
+
fileConversionsMenuItem(),
|
|
1043
|
+
...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
|
|
1044
|
+
downloadFileMenuItem(),
|
|
1045
|
+
shareFromWgMenuItem(),
|
|
1046
|
+
copyFromWgMenuItem(),
|
|
1047
|
+
movetofolderFromWgMenuItem(),
|
|
1048
|
+
commentFromWgMenuItem(false),
|
|
1049
|
+
removeFromWgMenuItem(SDKUI_Localizator.RemoveFromWorkgroup),
|
|
1050
|
+
];
|
|
1051
|
+
return items.sort((a, b) => a.name.localeCompare(b.name));
|
|
1052
|
+
};
|
|
1053
|
+
const getDcmtFormMenuItems = () => {
|
|
1054
|
+
return [
|
|
1055
|
+
{
|
|
1056
|
+
id: 'doc',
|
|
1057
|
+
icon: _jsx(IconFileDots, {}),
|
|
1058
|
+
name: !isMobile ? SDKUI_Localizator.DocumentOperations : SDKUI_Localizator.Documents,
|
|
1059
|
+
disabled: isDisabledForSingleRow() && isDisabledForMultiRow(),
|
|
1060
|
+
submenu: [
|
|
1061
|
+
addToFavoriteOperation(),
|
|
1062
|
+
openFormOperation(),
|
|
1063
|
+
downloadFileMenuItem(),
|
|
1064
|
+
downloadXMLAttachmentsMenuItem(),
|
|
1065
|
+
]
|
|
1066
|
+
},
|
|
1067
|
+
signatureMenuItem(),
|
|
1068
|
+
checkinMenuItem(),
|
|
1069
|
+
...(allowRelations && inputDcmtFormLayoutMode === LayoutModes.Update ? [relationsMenuItem()] : []),
|
|
1070
|
+
...((inputDcmtFormLayoutMode === LayoutModes.Update) ? [fullTextSearchMenuItem()] : []),
|
|
1071
|
+
];
|
|
1072
|
+
};
|
|
1073
|
+
const getMasterDetailMenuItems = () => {
|
|
1074
|
+
return [
|
|
1075
|
+
{
|
|
1076
|
+
id: 'doc',
|
|
1077
|
+
icon: _jsx(IconCheck, {}),
|
|
1078
|
+
name: !isMobile ? SDKUI_Localizator.DocumentOperations : SDKUI_Localizator.Documents,
|
|
1079
|
+
disabled: isDisabledForSingleRow() && isDisabledForMultiRow(),
|
|
1080
|
+
submenu: [
|
|
1081
|
+
...(inputDcmtFormLayoutMode === LayoutModes.Update ? [addToFavoriteOperation()] : []),
|
|
1082
|
+
addReplaceFileOperation(),
|
|
1083
|
+
openFormOperation(),
|
|
1084
|
+
fileCheckMenuItem(),
|
|
1085
|
+
fileConversionsMenuItem(),
|
|
1086
|
+
...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
|
|
1087
|
+
downloadFileMenuItem(),
|
|
1088
|
+
downloadXMLAttachmentsMenuItem(),
|
|
1089
|
+
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : [])
|
|
1090
|
+
]
|
|
1091
|
+
},
|
|
1092
|
+
signatureMenuItem(),
|
|
1093
|
+
...((inputDcmtFormLayoutMode === LayoutModes.Update) ? [fullTextSearchMenuItem()] : []),
|
|
1094
|
+
];
|
|
1095
|
+
};
|
|
1096
|
+
const getOperationMenuItems = () => {
|
|
1097
|
+
const getMenuItemsByContext = () => {
|
|
1098
|
+
switch (context) {
|
|
1099
|
+
case SearchResultContext.DCMT_FORM:
|
|
1100
|
+
return getDcmtFormMenuItems();
|
|
1101
|
+
case SearchResultContext.ARCHIVED_WORKGROUP:
|
|
1102
|
+
return getArchivedWorkgroupMenuItems();
|
|
1103
|
+
case SearchResultContext.MASTER_DETAIL:
|
|
1104
|
+
return getMasterDetailMenuItems();
|
|
1105
|
+
default:
|
|
1106
|
+
return getDefaultMenuItems();
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
const baseMenuItems = getMenuItemsByContext().filter((item) => item !== null);
|
|
1110
|
+
const customButtons = customButtonMenuItems();
|
|
1111
|
+
return customButtons.name ? baseMenuItems.concat([customButtons]) : baseMenuItems;
|
|
1112
|
+
};
|
|
1113
|
+
const operationItems = () => {
|
|
1114
|
+
return addPinIconToItems(getOperationMenuItems());
|
|
1115
|
+
};
|
|
1116
|
+
const renderFloatingBar = (floatingBarContainerRef && floatingBarContainerRef.current && allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE) ? (_jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: operationItems(), isConstrained: true, defaultPosition: { x: 1, y: 88 }, defaultPinnedItems: ['rel-det', 'rel-mst', 'dl'], defaultOrientation: 'horizontal', hasContextMenu: false, pinnedItemIds: pinnedItemIds, onPinChange: setPinnedItemIds })) : null;
|
|
1117
|
+
const renderDcmtOperations = (_jsxs(_Fragment, { children: [(showExportForm && searchResult && dataColumns && dataSource && selectedRowKeys) && (_jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: () => setShowExportForm(false), searchResult: searchResult })), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: ((isOpenDcmtForm && focusedItem?.TID !== undefined && focusedItem?.DID !== undefined) &&
|
|
1118
|
+
_jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID !== undefined), titleModal: dtd?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, layoutMode: dcmtFormLayoutMode, count: visibleItems?.length, itemIndex: visibleItems ? visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1 : undefined, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onClose: () => {
|
|
1119
|
+
(false);
|
|
1120
|
+
onDcmtFormOpenChange(false, LayoutModes.Update);
|
|
1121
|
+
}, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: onSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showDcmtFormSidebar, datagridUtility: {
|
|
1122
|
+
onRefreshSearchAsyncDatagrid,
|
|
1123
|
+
onRefreshDataRowsAsync,
|
|
1124
|
+
refreshFocusedDataRowAsync,
|
|
1125
|
+
onRefreshBlogDatagrid,
|
|
1126
|
+
onRefreshPreviewDatagrid
|
|
1127
|
+
} })) }), (showHistory && dtd && selectedDcmtInfos.length > 0) && _jsx(TMViewHistoryDcmt, { fromDTD: dtd, deviceType: deviceType, inputDcmt: selectedDcmtInfos[0], onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (commentFormState.show && selectedDcmtInfos.length > 0) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: selectedDcmtInfos[0].TID, did: selectedDcmtInfos[0].DID } }, onClose: hideCommentFormCallback, refreshCallback: onRefreshBlog, participants: [], showAttachmentsSection: true, allArchivedDocumentsFileItems: convertSearchResultDescriptorToFileItems(currentSearchResults ?? []), isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment, selectedAttachmentDid: [Number(selectedDcmtInfos[0].DID)] }), (showCheckoutInformationForm && dtd && selectedDcmtInfos.length > 0) &&
|
|
1128
|
+
_jsx(TMDcmtCheckoutInfoForm, { dtdName: dtd.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: selectedDcmtInfos[0], onClose: hideCheckoutInformationFormCallback }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: selectedDcmtInfos, allowNavigation: selectedDcmtInfos.length === 1, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onTaskCreateRequest: onTaskCreateRequest, datagridUtility: datagridUtility, dcmtUtility: dcmtUtility }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: selectedDcmtInfos, isForMaster: true, allowNavigation: selectedDcmtInfos.length === 1, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onTaskCreateRequest: onTaskCreateRequest, datagridUtility: datagridUtility, dcmtUtility: dcmtUtility }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
1129
|
+
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, 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, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onTaskCreateRequest: onTaskCreateRequest, datagridUtility: datagridUtility, dcmtUtility: dcmtUtility }) }, `${index}-${dcmt.DID}`));
|
|
1130
|
+
})] }), 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: () => {
|
|
1131
|
+
setIsOpenArchiveRelationForm(false);
|
|
1132
|
+
setArchiveType(undefined);
|
|
1133
|
+
setArchiveRelatedDcmtFormTID(undefined);
|
|
1134
|
+
setArchiveRelatedDcmtFormMids([]);
|
|
1135
|
+
}, onSavedAsyncCallback: async (tid, did, metadataResult) => {
|
|
1136
|
+
setIsOpenArchiveRelationForm(false);
|
|
1137
|
+
setArchiveType(undefined);
|
|
1138
|
+
setArchiveRelatedDcmtFormTID(undefined);
|
|
1139
|
+
setArchiveRelatedDcmtFormMids([]);
|
|
1140
|
+
await onRefreshSearchAsyncDatagrid?.();
|
|
1141
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar }), showRelatedDcmtsChooser &&
|
|
1142
|
+
_jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
|
|
1143
|
+
try {
|
|
1144
|
+
setShowRelatedDcmtsChooser(false);
|
|
1145
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1146
|
+
const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
|
|
1147
|
+
if (!relation || !archiveType)
|
|
1148
|
+
return;
|
|
1149
|
+
await archiveRelatedDcmtHandler(relation, archiveType);
|
|
1150
|
+
}
|
|
1151
|
+
catch (error) {
|
|
1152
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
1153
|
+
}
|
|
1154
|
+
finally {
|
|
1155
|
+
TMSpinner.hide();
|
|
1156
|
+
}
|
|
1157
|
+
}, onClose: () => setShowRelatedDcmtsChooser(false), manageUseLocalizedName: false }), showManyToManyChooser &&
|
|
1158
|
+
_jsx(TMChooserForm, { dataSource: manyToManyChooserDataSource, onChoose: async (selectedRelation) => {
|
|
1159
|
+
try {
|
|
1160
|
+
setShowManyToManyChooser(false);
|
|
1161
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1162
|
+
const relation = manyToManyRelations?.find(r => r.id === selectedRelation[0]);
|
|
1163
|
+
if (!relation)
|
|
1164
|
+
return;
|
|
1165
|
+
await executeManyToManyPairing(relation, isPairingManyToMany);
|
|
1166
|
+
}
|
|
1167
|
+
catch (error) {
|
|
1168
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
1169
|
+
}
|
|
1170
|
+
finally {
|
|
1171
|
+
TMSpinner.hide();
|
|
1172
|
+
}
|
|
1173
|
+
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false }), showPairDcmtsModal &&
|
|
1174
|
+
_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid: onRefreshSearchAsyncDatagrid, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, passToArchiveCallback: passToArchiveCallback, showTodoDcmtForm: showTodoDcmtForm, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter }) }), showPairSearchModal &&
|
|
1175
|
+
_jsx(TMModal, { title: "Ricerca documenti", onClose: () => setShowPairSearchModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearch, { onlyShowSearchQueryPanel: true, inputTID: pairSearchModalTargetTID, inputMids: pairSearchModalInputMids, floatingActionConfig: pairSearchModalFloatingActionConfig, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenSharedArchive && _jsx(TMModal, { title: "Archiviazione condivisa", onClose: () => {
|
|
1176
|
+
setIsOpenSharedArchive(false);
|
|
1177
|
+
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputDID: selectedDcmtInfos?.[0].DID, inputTID: selectedDcmtInfos?.[0].TID, inputMids: currentMetadataValues.filter(md => md.mid && md.mid > 100).map(md => ({ mid: md.mid, value: md.value ?? '' })), isSharedArchive: true, inputFile: sharedDcmtFile, onSavedAsyncCallback: async (tid, did) => {
|
|
1178
|
+
setIsOpenSharedArchive(false);
|
|
1179
|
+
await onRefreshSearchAsyncDatagrid?.();
|
|
1180
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), sharedDcmtSearchResults.length > 0 &&
|
|
1181
|
+
_jsx(TMModal, { title: "Documenti condivisi", onClose: () => {
|
|
1182
|
+
setSharedDcmtSearchResults([]);
|
|
1183
|
+
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMSearchResult, { searchResults: sharedDcmtSearchResults, allowFloatingBar: false, showSelector: true, disableAccordionIfSingleCategory: true, showBackButton: isMobile, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${selectedDcmtInfos.length} documenti selezionati)`, inputDcmts: selectedDcmtInfos, TID: selectedDcmtInfos.length > 0 ? selectedDcmtInfos[0]?.TID : undefined, DID: selectedDcmtInfos.length > 0 ? selectedDcmtInfos[0]?.DID : undefined, onBack: () => updateBatchUpdateForm(false), onSavedCallbackAsync: async () => {
|
|
1184
|
+
updateBatchUpdateForm(false);
|
|
1185
|
+
setIsModifiedBatchUpdate(false);
|
|
1186
|
+
await onRefreshDataRowsAsync?.();
|
|
1187
|
+
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, selectedItems: selectedDcmtInfos, isReject: 0, onClose: () => updateShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, selectedItems: selectedDcmtInfos, isReject: 1, onClose: () => updateShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, selectedItems: selectedDcmtInfos, onClose: () => updateShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { fromDTD: dtd, TID: contextConfig.approvalTID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: handleWFOperationCompleted, onClose: () => updateShowMoreInfoPopup(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, triggerBlogRefresh: onRefreshBlogDatagrid }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), taskFormDialogComponent, s4TViewerDialogComponent, currentCustomButton && _jsx(TMCustomButton, { button: currentCustomButton, formData: currentMetadataValues, selectedItems: selectedItemsFull, onClose: () => setCurrentCustomButton(undefined) })] }));
|
|
1188
|
+
return {
|
|
1189
|
+
operationItems: operationItems(),
|
|
1190
|
+
renderFloatingBar,
|
|
1191
|
+
renderDcmtOperations,
|
|
1192
|
+
features: {
|
|
1193
|
+
isOpenDcmtForm,
|
|
1194
|
+
openFormHandler,
|
|
1195
|
+
dcmtFormLayoutMode,
|
|
1196
|
+
onDcmtFormOpenChange,
|
|
1197
|
+
showSearchTMDatagrid,
|
|
1198
|
+
showExportForm,
|
|
1199
|
+
isOpenBatchUpdate,
|
|
1200
|
+
isModifiedBatchUpdate,
|
|
1201
|
+
updateBatchUpdateForm,
|
|
1202
|
+
handleSignApprove,
|
|
1203
|
+
checkoutInfo: {
|
|
1204
|
+
showHistory,
|
|
1205
|
+
showHistoryCallback,
|
|
1206
|
+
hideHistoryCallback,
|
|
1207
|
+
showCheckoutInformationForm,
|
|
1208
|
+
showCheckoutInformationFormCallback,
|
|
1209
|
+
hideCheckoutInformationFormCallback,
|
|
1210
|
+
commentFormState,
|
|
1211
|
+
hideCommentFormCallback,
|
|
1212
|
+
copyCheckoutPathToClipboardCallback,
|
|
1213
|
+
handleCheckOutCallback,
|
|
1214
|
+
handleCheckInCallback,
|
|
1215
|
+
showCicoWaitPanel,
|
|
1216
|
+
cicoWaitPanelTitle,
|
|
1217
|
+
showCicoPrimaryProgress,
|
|
1218
|
+
cicoPrimaryProgressText,
|
|
1219
|
+
cicoPrimaryProgressValue,
|
|
1220
|
+
cicoPrimaryProgressMax,
|
|
1221
|
+
},
|
|
1222
|
+
dcmtOperations: {
|
|
1223
|
+
abortController,
|
|
1224
|
+
showWaitPanel,
|
|
1225
|
+
showPrimary,
|
|
1226
|
+
waitPanelTitle,
|
|
1227
|
+
waitPanelTextPrimary,
|
|
1228
|
+
waitPanelValuePrimary,
|
|
1229
|
+
waitPanelMaxValuePrimary,
|
|
1230
|
+
showSecondary,
|
|
1231
|
+
waitPanelTextSecondary,
|
|
1232
|
+
waitPanelValueSecondary,
|
|
1233
|
+
waitPanelMaxValueSecondary,
|
|
1234
|
+
downloadDcmtsAsync,
|
|
1235
|
+
getDcmtFileAsync,
|
|
1236
|
+
clearDcmtsFileCache,
|
|
1237
|
+
removeDcmtsFileCache,
|
|
1238
|
+
isDcmtFileInCache,
|
|
1239
|
+
runOperationAsync,
|
|
1240
|
+
},
|
|
1241
|
+
relatedDocumentsInfo: {
|
|
1242
|
+
// Data
|
|
1243
|
+
relatedDcmts,
|
|
1244
|
+
pairedSearchResults,
|
|
1245
|
+
manyToManyRelations,
|
|
1246
|
+
selectedManyToManyRelation,
|
|
1247
|
+
manyToManyChooserDataSource,
|
|
1248
|
+
relatedDcmtsChooserDataSource,
|
|
1249
|
+
// Flags / State booleans
|
|
1250
|
+
showRelatedDcmtsChooser,
|
|
1251
|
+
isOpenDetails,
|
|
1252
|
+
isOpenMaster,
|
|
1253
|
+
isOpenArchiveRelationForm,
|
|
1254
|
+
isPairingManyToMany,
|
|
1255
|
+
showManyToManyChooser,
|
|
1256
|
+
showPairSearchModal,
|
|
1257
|
+
currentTIDHasDetailRelations,
|
|
1258
|
+
currentTIDHasMasterRelations,
|
|
1259
|
+
canArchiveMasterRelation,
|
|
1260
|
+
canArchiveDetailRelation,
|
|
1261
|
+
hasManyToManyRelation,
|
|
1262
|
+
showPairDcmtsModal,
|
|
1263
|
+
// Pair search modal state
|
|
1264
|
+
pairSearchModalTargetTID,
|
|
1265
|
+
pairSearchModalParentTID,
|
|
1266
|
+
pairSearchModalParentDID,
|
|
1267
|
+
pairSearchModalRelation,
|
|
1268
|
+
pairSearchModalInputMids,
|
|
1269
|
+
// Config
|
|
1270
|
+
pairFloatingActionConfig,
|
|
1271
|
+
pairSearchModalFloatingActionConfig,
|
|
1272
|
+
// Archive state
|
|
1273
|
+
archiveRelatedDcmtFormTID,
|
|
1274
|
+
archiveRelatedDcmtFormMids,
|
|
1275
|
+
archiveType,
|
|
1276
|
+
// Setters
|
|
1277
|
+
setIsOpenDetails,
|
|
1278
|
+
setIsOpenMaster,
|
|
1279
|
+
setShowRelatedDcmtsChooser,
|
|
1280
|
+
setIsOpenArchiveRelationForm,
|
|
1281
|
+
setArchiveType,
|
|
1282
|
+
setArchiveRelatedDcmtFormTID,
|
|
1283
|
+
setArchiveRelatedDcmtFormMids,
|
|
1284
|
+
setShowManyToManyChooser,
|
|
1285
|
+
setShowPairDcmtsModal,
|
|
1286
|
+
setShowPairSearchModal,
|
|
1287
|
+
// Logic / Helpers
|
|
1288
|
+
checkRelatedDcmtsArchiveCapability,
|
|
1289
|
+
checkManyToManyCapability,
|
|
1290
|
+
// Actions
|
|
1291
|
+
pairManyToMany,
|
|
1292
|
+
executeManyToManyPairing,
|
|
1293
|
+
archiveDetailDocuments,
|
|
1294
|
+
archiveMasterDocuments,
|
|
1295
|
+
archiveRelatedDcmtHandler
|
|
1296
|
+
},
|
|
1297
|
+
toppyOperations: {
|
|
1298
|
+
showApprovePopup,
|
|
1299
|
+
showRejectPopup,
|
|
1300
|
+
showReAssignPopup,
|
|
1301
|
+
showMoreInfoPopup,
|
|
1302
|
+
updateShowApprovePopup,
|
|
1303
|
+
updateShowRejectPopup,
|
|
1304
|
+
updateShowReAssignPopup,
|
|
1305
|
+
updateShowMoreInfoPopup
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
};
|