@topconsultnpm/sdkui-react 6.19.0-dev3.6 → 6.19.0-dev3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/features/documents/TMDcmtForm.js +10 -3
- package/lib/components/features/search/TMSearchResult.js +38 -14
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.js +31 -58
- package/lib/components/features/search/TMViewHistoryDcmtForm.d.ts +11 -0
- package/lib/components/features/search/TMViewHistoryDcmtForm.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +3 -0
- package/lib/helper/SDKUI_Localizator.js +42 -6
- package/lib/helper/cicoHelper.d.ts +28 -0
- package/lib/helper/cicoHelper.js +132 -0
- package/package.json +2 -2
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +0 -4
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +0 -187
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +0 -11
- package/lib/components/NewComponents/ContextMenu/hooks.js +0 -48
- package/lib/components/NewComponents/ContextMenu/index.d.ts +0 -2
- package/lib/components/NewComponents/ContextMenu/index.js +0 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +0 -27
- package/lib/components/NewComponents/ContextMenu/styles.js +0 -308
- package/lib/components/NewComponents/ContextMenu/types.d.ts +0 -26
- package/lib/components/NewComponents/ContextMenu/types.js +0 -1
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +0 -4
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +0 -370
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/index.js +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +0 -38
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +0 -267
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +0 -30
- package/lib/components/NewComponents/FloatingMenuBar/types.js +0 -1
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
|
@@ -408,9 +408,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
408
408
|
}, [inputMids, layoutMode, formData, formDataOrig]);
|
|
409
409
|
// Memoizza solo il valore WI_SetID per evitare re-render quando altri metadata cambiano
|
|
410
410
|
const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
|
|
411
|
+
// Valore derivato: true se formData ha elementi validi
|
|
412
|
+
const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
|
|
411
413
|
useEffect(() => {
|
|
412
414
|
const loadAllWfData = async () => {
|
|
413
|
-
if (layoutMode !== LayoutModes.Update || !DID) {
|
|
415
|
+
if (layoutMode !== LayoutModes.Update || !DID || fromDTD?.templateTID !== TemplateTIDs.WF_WIApprView) {
|
|
414
416
|
setWorkItems([]);
|
|
415
417
|
setWorkflows([]);
|
|
416
418
|
return;
|
|
@@ -460,7 +462,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
460
462
|
setWorkflows(validWorkflows);
|
|
461
463
|
}
|
|
462
464
|
catch (error) {
|
|
463
|
-
|
|
465
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
464
466
|
setWorkItems([]);
|
|
465
467
|
setWorkflows([]);
|
|
466
468
|
}
|
|
@@ -468,9 +470,14 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
468
470
|
setIsWFDataLoading(false);
|
|
469
471
|
}
|
|
470
472
|
};
|
|
473
|
+
// Usa hasFormData invece di formDataRef.current
|
|
474
|
+
if (!hasFormData || !fromDTD?.id) {
|
|
475
|
+
// console.log("formData is empty or fromDTD not loaded, skipping loadAllWfData");
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
471
478
|
if (workItemSetIDValue !== undefined || workflowApproveData.length > 0)
|
|
472
479
|
loadAllWfData();
|
|
473
|
-
}, [workItemSetIDValue, workflowApproveData, DID, layoutMode]);
|
|
480
|
+
}, [hasFormData, workItemSetIDValue, workflowApproveData, DID, layoutMode, fromDTD?.templateTID, fromDTD?.id]);
|
|
474
481
|
const getSelectionDcmtInfo = useCallback(() => {
|
|
475
482
|
let dcmts = [];
|
|
476
483
|
dcmts.push({ TID: TID ?? 0, DID: DID ?? 0 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, ResultTypes, LayoutCacheService } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, ResultTypes, LayoutCacheService, UserListCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { getAllFieldSelectedDcmtsOrFocused, getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
|
|
6
6
|
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu, getExceptionMessage, IconCheck, svgToString, TMImageLibrary } from '../../../helper';
|
|
@@ -43,6 +43,8 @@ import { TMResultManager } from '../../forms/TMResultDialog';
|
|
|
43
43
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
44
44
|
import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
|
|
45
45
|
import TMSignSettingsForm from './TMSignSettingsForm';
|
|
46
|
+
import { cicoIsEnabled, downloadFilesCallback } from '../../../helper/cicoHelper';
|
|
47
|
+
import TMViewHistoryDcmtForm from './TMViewHistoryDcmtForm';
|
|
46
48
|
//#region Helper Methods
|
|
47
49
|
export const getSearchResultCountersSingleCategory = (searchResults) => {
|
|
48
50
|
// let totDcmtTypes = searchResults.length;
|
|
@@ -110,6 +112,16 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
110
112
|
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
111
113
|
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
112
114
|
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
115
|
+
// State to manage show history selected file
|
|
116
|
+
const [showHistory, setShowHistory] = useState(false);
|
|
117
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const fetchAllUsers = async () => {
|
|
120
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
121
|
+
setAllUsers(users ?? []);
|
|
122
|
+
};
|
|
123
|
+
fetchAllUsers();
|
|
124
|
+
}, []);
|
|
113
125
|
useEffect(() => { setID(genUniqueId()); }, []);
|
|
114
126
|
useEffect(() => {
|
|
115
127
|
setSelectedItems([]);
|
|
@@ -273,6 +285,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
273
285
|
const closeSignSettingsForm = useCallback(() => {
|
|
274
286
|
setShowSignSettingsForm(false);
|
|
275
287
|
}, []);
|
|
288
|
+
const viewHistoryCallback = useCallback(() => {
|
|
289
|
+
setShowHistory(true);
|
|
290
|
+
}, []);
|
|
276
291
|
const getTitleHeader = () => {
|
|
277
292
|
let counters = (showSelector && disableAccordionIfSingleCategory && searchResults.length > 1) ? getSearchResultCountersSingleCategory(searchResults) : "";
|
|
278
293
|
if (title)
|
|
@@ -348,7 +363,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
348
363
|
return;
|
|
349
364
|
if (e.target === 'content') {
|
|
350
365
|
e.items = e.items || [];
|
|
351
|
-
const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation);
|
|
366
|
+
const menuItems = getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, viewHistoryCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation);
|
|
352
367
|
e.items.push(...menuItems);
|
|
353
368
|
//disabilitato per ora
|
|
354
369
|
//e.items.push(customButtonMenuItems());
|
|
@@ -377,9 +392,9 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
377
392
|
if (checkout) {
|
|
378
393
|
await ue.CheckOutAsync()
|
|
379
394
|
.then(async () => {
|
|
380
|
-
|
|
395
|
+
const filename = fromDTD?.nameLoc || SDKUI_Localizator.SearchResult;
|
|
396
|
+
await downloadFilesCallback(filename, [firstDoc], true, downloadDcmtsAsync);
|
|
381
397
|
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
382
|
-
// await refreshSelectionDataRowsAsync();
|
|
383
398
|
await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
|
|
384
399
|
})
|
|
385
400
|
.catch((error) => {
|
|
@@ -391,7 +406,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
391
406
|
await ue.UndoCheckOutAsync()
|
|
392
407
|
.then(async () => {
|
|
393
408
|
result.push({ rowIndex: 0, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
394
|
-
// await refreshSelectionDataRowsAsync();
|
|
395
409
|
await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
|
|
396
410
|
})
|
|
397
411
|
.catch((error) => {
|
|
@@ -588,7 +602,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
588
602
|
}
|
|
589
603
|
};
|
|
590
604
|
const searchResutlToolbar = _jsxs(_Fragment, { children: [(dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
|
591
|
-
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) /*.concat([customButtonMenuItems()])*/ })] });
|
|
605
|
+
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, viewHistoryCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) /*.concat([customButtonMenuItems()])*/ })] });
|
|
592
606
|
const handleAddItem = (tid, did) => {
|
|
593
607
|
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
594
608
|
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
@@ -622,8 +636,8 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
622
636
|
_jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
|
623
637
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
624
638
|
:
|
|
625
|
-
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { showSearch: showSearch, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
626
|
-
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) /*.concat([customButtonMenuItems()])*/ })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
639
|
+
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { showSearch: showSearch, fromDTD: fromDTD, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
640
|
+
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-floating-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, viewHistoryCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) /*.concat([customButtonMenuItems()])*/ })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
627
641
|
setIsOpenBatchUpdate(false);
|
|
628
642
|
}, onSavedCallbackAsync: async () => {
|
|
629
643
|
setIsOpenBatchUpdate(false);
|
|
@@ -810,13 +824,13 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
810
824
|
setArchiveRelatedDcmtFormTID(undefined);
|
|
811
825
|
setArchiveRelatedDcmtFormMids([]);
|
|
812
826
|
await onRefreshSearchAsync?.();
|
|
813
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showSignSettingsForm && fromDTD) && _jsx(TMSignSettingsForm, { fromDTD: fromDTD, inputDcmts: allFieldSelectedDocs, onCloseSignSettingsForm: closeSignSettingsForm, onSavedAsyncCallback: handleSavedAsyncCallback })] }));
|
|
827
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showSignSettingsForm && fromDTD) && _jsx(TMSignSettingsForm, { fromDTD: fromDTD, inputDcmts: allFieldSelectedDocs, onCloseSignSettingsForm: closeSignSettingsForm, onSavedAsyncCallback: handleSavedAsyncCallback }), (showHistory && fromDTD && getSelectedDcmtsOrFocused(selectedItems, focusedItem).length > 0) && _jsx(TMViewHistoryDcmtForm, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0], onClose: () => setShowHistory(false) })] }));
|
|
814
828
|
};
|
|
815
829
|
export default TMSearchResult;
|
|
816
830
|
const renderDcmtIcon = (cellData, onDownloadDcmtsAsync, openInOffice) => {
|
|
817
831
|
return _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow', onDownloadDcmtsAsync: onDownloadDcmtsAsync, openInOffice: openInOffice });
|
|
818
832
|
};
|
|
819
|
-
const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowMultipleSelection = true, showExportForm = false, onCloseExportForm, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
|
|
833
|
+
const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem, showSearch, allowMultipleSelection = true, showExportForm = false, onCloseExportForm, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
|
|
820
834
|
const [dataSource, setDataSource] = useState();
|
|
821
835
|
const [columns, setColumns] = useState([]);
|
|
822
836
|
// State to store selected row keys
|
|
@@ -896,12 +910,20 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
|
|
|
896
910
|
return null;
|
|
897
911
|
const isLogDel = cellData.data.ISLOGDEL == 1;
|
|
898
912
|
const isLexProt = cellData.data.IsLexProt == 1;
|
|
913
|
+
// Prima colonna: la colonna numero 2 (dopo icona e selezione)
|
|
914
|
+
const isFirstColumn = cellData.columnIndex === 2;
|
|
915
|
+
const { checkoutStatus } = cicoIsEnabled(cellData.data, allUsers, fromDTD);
|
|
916
|
+
const shouldShowCheckoutIcon = isFirstColumn && checkoutStatus.isCheckedOut && checkoutStatus.icon;
|
|
899
917
|
let style = {};
|
|
900
918
|
if (isLogDel) {
|
|
901
919
|
style = { color: 'gray', textDecoration: 'line-through' };
|
|
902
920
|
}
|
|
903
|
-
else if (isLexProt)
|
|
921
|
+
else if (isLexProt) {
|
|
904
922
|
style = { color: 'blue' };
|
|
923
|
+
}
|
|
924
|
+
if (shouldShowCheckoutIcon) {
|
|
925
|
+
style = { ...style, display: 'flex', gap: '4px', whiteSpace: 'nowrap' };
|
|
926
|
+
}
|
|
905
927
|
let child = _jsx("div", { children: cellData.text });
|
|
906
928
|
if (dataDomain === MetadataDataDomains.DataList) {
|
|
907
929
|
child = _jsx(TMDataListItemViewer, { dataListId: dataListID, viewMode: dataListViewMode, value: cellData.value });
|
|
@@ -909,8 +931,8 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
|
|
|
909
931
|
if (dataDomain === MetadataDataDomains.UserID) {
|
|
910
932
|
child = _jsx(TMUserIdViewer, { userId: cellData.value, showIcon: true, noneSelectionText: '' });
|
|
911
933
|
}
|
|
912
|
-
return
|
|
913
|
-
}, []);
|
|
934
|
+
return (_jsxs("div", { style: style, children: [shouldShowCheckoutIcon && checkoutStatus.icon, child] }));
|
|
935
|
+
}, [fromDTD, allUsers]);
|
|
914
936
|
const dataType = useCallback((col) => {
|
|
915
937
|
switch (col.dataType) {
|
|
916
938
|
case DataColumnTypes.DateTime: return "datetime";
|
|
@@ -961,6 +983,8 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
|
|
|
961
983
|
return undefined;
|
|
962
984
|
}, []);
|
|
963
985
|
useEffect(() => {
|
|
986
|
+
if (fromDTD === undefined || searchResult === undefined)
|
|
987
|
+
return;
|
|
964
988
|
setFocusedItem(undefined); // resetta sempre prima
|
|
965
989
|
let cols = [];
|
|
966
990
|
// Generate unique keys for all columns
|
|
@@ -983,7 +1007,7 @@ const TMSearchResultGrid = ({ openInOffice, inputFocusedItem, showSearch, allowM
|
|
|
983
1007
|
let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
|
|
984
1008
|
setDataSource(newDataSource);
|
|
985
1009
|
// setFocusedItem(newDataSource && newDataSource.length > 0 ? newDataSource[0] : undefined);
|
|
986
|
-
}, [searchResult]);
|
|
1010
|
+
}, [searchResult, fromDTD, allUsers]);
|
|
987
1011
|
useEffect(() => {
|
|
988
1012
|
let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
|
|
989
1013
|
setDataSource(newDataSource);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGroupDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGroupDescriptor, UserDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
|
4
4
|
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
6
6
|
export declare const getAllFieldSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => any[];
|
|
7
7
|
export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
|
|
8
|
-
export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, showSharedDcmtsHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openSignSettingsForm: () => void, handleCheckOutOperationCallback: (checkout: boolean) => Promise<void>, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
|
|
8
|
+
export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, allUsers: Array<UserDescriptor>, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, showSharedDcmtsHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openSignSettingsForm: () => void, handleCheckOutOperationCallback: (checkout: boolean) => Promise<void>, viewHistoryCallback: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
|
|
9
9
|
mid: number;
|
|
10
10
|
value: string;
|
|
11
11
|
}>, tid?: number) => void, archiveMasterDocuments?: (tid: number | undefined) => Promise<void>, archiveDetailDocuments?: (tid: number | undefined) => Promise<void>, hasMasterRelation?: boolean, hasDetailRelation?: boolean, canArchiveMasterRelation?: boolean, canArchiveDetailRelation?: boolean, pairManyToManyDocuments?: (isPairing: boolean) => Promise<void>, hasManyToManyRelation?: boolean) => Array<TMDataGridContextMenuItem>;
|
|
@@ -1,61 +1,12 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus
|
|
2
|
+
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled, IconPair, IconUnpair, IconSharedDcmt, IconShare, IconCopy, IconMoveToFolder } from '../../../helper';
|
|
4
4
|
import ShowAlert from '../../base/TMAlert';
|
|
5
5
|
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
|
7
7
|
import { DcmtOperationTypes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
8
8
|
import { isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
9
|
-
|
|
10
|
-
const cico = {
|
|
11
|
-
CICO: 0,
|
|
12
|
-
CanCICO: AccessLevels.No,
|
|
13
|
-
CanDelChronology: AccessLevels.No,
|
|
14
|
-
UserID_MID: 0,
|
|
15
|
-
Date_MID: 0,
|
|
16
|
-
Ver_MID: 0,
|
|
17
|
-
UserID_CanViewOrUpdate: AccessLevels.No,
|
|
18
|
-
Date_CanViewOrUpdate: AccessLevels.No,
|
|
19
|
-
Ver_CanViewOrUpdate: AccessLevels.No,
|
|
20
|
-
};
|
|
21
|
-
if (dtd === undefined)
|
|
22
|
-
return cico;
|
|
23
|
-
cico.CICO = dtd.cico ?? 0;
|
|
24
|
-
cico.CanCICO = dtd.perm?.canCICO ?? AccessLevels.No;
|
|
25
|
-
cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
|
|
26
|
-
const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
27
|
-
if (mdCheckout) {
|
|
28
|
-
cico.UserID_MID = mdCheckout.fromMID;
|
|
29
|
-
cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
30
|
-
}
|
|
31
|
-
const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
32
|
-
if (mdDate) {
|
|
33
|
-
cico.Date_MID = mdDate.fromMID;
|
|
34
|
-
cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
35
|
-
}
|
|
36
|
-
const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
37
|
-
if (mdVer) {
|
|
38
|
-
cico.Ver_MID = mdVer.fromMID;
|
|
39
|
-
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
40
|
-
}
|
|
41
|
-
return cico;
|
|
42
|
-
};
|
|
43
|
-
const cicoIsEnabled = (dcmt, dtd) => {
|
|
44
|
-
const cicoInfo = getCicoInfo(dtd);
|
|
45
|
-
let isCheckout = false;
|
|
46
|
-
const CICO_CheckoutUserID = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID)?.id;
|
|
47
|
-
if (dcmt && CICO_CheckoutUserID) {
|
|
48
|
-
const key = dcmt.TID + "_" + CICO_CheckoutUserID;
|
|
49
|
-
const value = dcmt[key];
|
|
50
|
-
if (value && value > 0) {
|
|
51
|
-
isCheckout = true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
|
|
56
|
-
isCheckout: isCheckout
|
|
57
|
-
};
|
|
58
|
-
};
|
|
9
|
+
import { cicoIsEnabled } from '../../../helper/cicoHelper';
|
|
59
10
|
const disabledForSingleRow = (selectedItems, focusedItem) => {
|
|
60
11
|
// Disabilita se ci sono più item selezionati o se focusedItem non ha TID/DID validi
|
|
61
12
|
return selectedItems.length > 1 || focusedItem === undefined || focusedItem.TID === undefined || focusedItem.DID === undefined;
|
|
@@ -145,7 +96,7 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
|
|
|
145
96
|
TMSpinner.hide();
|
|
146
97
|
}
|
|
147
98
|
};
|
|
148
|
-
export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation) => {
|
|
99
|
+
export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, viewHistoryCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation) => {
|
|
149
100
|
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
150
101
|
let pdfEditorAvailable = false;
|
|
151
102
|
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
@@ -377,26 +328,48 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
377
328
|
const selectedDocs = getAllFieldSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
378
329
|
// Take the first document (used for validation checks)
|
|
379
330
|
const firstDoc = selectedDocs?.[0];
|
|
380
|
-
const { cicoEnabled,
|
|
331
|
+
const { cicoEnabled, checkoutStatus } = cicoIsEnabled(firstDoc, allUsers, dtd);
|
|
381
332
|
return {
|
|
382
333
|
icon: svgToString(_jsx(IconFileDots, {})),
|
|
383
334
|
text: "Check in/Check out",
|
|
384
|
-
disabled:
|
|
335
|
+
disabled: firstDoc === undefined || disabledForSingleRow(selectedItems, focusedItem),
|
|
385
336
|
items: [
|
|
386
337
|
{
|
|
387
338
|
icon: "edit",
|
|
388
339
|
text: 'Check out',
|
|
389
|
-
disabled: !cicoEnabled ||
|
|
390
|
-
// disabled: isNotSingleFile || isGroupLocked || isFileCheckedOut,
|
|
340
|
+
disabled: !cicoEnabled || checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem),
|
|
391
341
|
onClick: () => handleCheckOutOperationCallback(true),
|
|
392
342
|
},
|
|
343
|
+
/* {
|
|
344
|
+
icon: "unlock",
|
|
345
|
+
text: 'Check in',
|
|
346
|
+
// onClick: () => handleCheckInOperationCallback(),
|
|
347
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || disabledForSingleRow(selectedItems, focusedItem)
|
|
348
|
+
}, */
|
|
393
349
|
{
|
|
394
350
|
icon: "remove",
|
|
395
351
|
text: SDKUI_Localizator.CancelCheckOut,
|
|
396
|
-
disabled: !cicoEnabled ||
|
|
397
|
-
// disabled: isNotSingleFile || isGroupLocked || isFileNotCheckedOut || isNotCheckedOutByCurrentUser,
|
|
352
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode' || disabledForSingleRow(selectedItems, focusedItem),
|
|
398
353
|
onClick: () => handleCheckOutOperationCallback(false),
|
|
399
354
|
},
|
|
355
|
+
/* {
|
|
356
|
+
icon: "clock",
|
|
357
|
+
text: SDKUI_Localizator.History,
|
|
358
|
+
disabled: checkoutStatus.version === 1 || disabledForSingleRow(selectedItems, focusedItem),
|
|
359
|
+
onClick: viewHistoryCallback,
|
|
360
|
+
}, */
|
|
361
|
+
/* {
|
|
362
|
+
icon: "info",
|
|
363
|
+
text: SDKUI_Localizator.CheckoutInfo,
|
|
364
|
+
// onClick: showCheckoutInformationFormCallback,
|
|
365
|
+
disabled: !checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem)
|
|
366
|
+
}, */
|
|
367
|
+
/* {
|
|
368
|
+
icon: "copy",
|
|
369
|
+
text: SDKUI_Localizator.CopyCheckoutPath,
|
|
370
|
+
// onClick: infoCheckCopyToClipboard,
|
|
371
|
+
disabled: !checkoutStatus.isCheckedOut || disabledForSingleRow(selectedItems, focusedItem)
|
|
372
|
+
}, */
|
|
400
373
|
]
|
|
401
374
|
};
|
|
402
375
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DcmtInfo } from "../../../ts/types";
|
|
2
|
+
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
3
|
+
import { DcmtTypeDescriptor } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
interface TMViewHistoryDcmtFormProps {
|
|
5
|
+
fromDTD: DcmtTypeDescriptor;
|
|
6
|
+
deviceType: DeviceType | undefined;
|
|
7
|
+
inputDcmt: DcmtInfo;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const TMViewHistoryDcmtForm: (props: TMViewHistoryDcmtFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default TMViewHistoryDcmtForm;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { calcResponsiveSizes, SDKUI_Localizator } from "../../../helper";
|
|
3
|
+
import TMModal from "../../base/TMModal";
|
|
4
|
+
import TMToppyMessage from "../../../helper/TMToppyMessage";
|
|
5
|
+
const TMViewHistoryDcmtForm = (props) => {
|
|
6
|
+
const { deviceType, inputDcmt, onClose, fromDTD } = props;
|
|
7
|
+
return _jsx(TMModal, { title: `${SDKUI_Localizator.SearchResult} \u2014 ${SDKUI_Localizator.History + ": " + (fromDTD.nameLoc ?? SDKUI_Localizator.Document) + " (DID:" + inputDcmt.DID})`, width: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), height: calcResponsiveSizes(deviceType, '80%', '80%', '95%'), onClose: onClose, children: _jsx(TMToppyMessage, { message: "Funzionalità in fase di sviluppo." }) });
|
|
8
|
+
};
|
|
9
|
+
export default TMViewHistoryDcmtForm;
|
|
@@ -90,6 +90,7 @@ export declare class SDKUI_Localizator {
|
|
|
90
90
|
static get CheckIn(): "Check in" | "Enregistrement";
|
|
91
91
|
static get Checkmark(): "Häkchen" | "Checkmark" | "Marca de verificación" | "Coche" | "Marca de verificação" | "Spunta";
|
|
92
92
|
static get CheckOut(): "Check out" | "Extraction";
|
|
93
|
+
static get CheckoutInfo(): string;
|
|
93
94
|
static get ChooseFolder(): string;
|
|
94
95
|
static get ChooseGroup(): string;
|
|
95
96
|
static get ChronologyDelete(): "Physische Löschung der Chronologie" | "Physical deletion of chronology" | "Eliminación física de la cronología" | "Suppression physique de la chronologie" | "Exclusão física da cronologia" | "Cancellazione fisica della cronologia";
|
|
@@ -117,6 +118,7 @@ export declare class SDKUI_Localizator {
|
|
|
117
118
|
static get ContinueOperation(): "Fortfahren?" | "Continue ?" | "¿Continuar?" | "Continuer?" | "Continuar?" | "Continuare?";
|
|
118
119
|
static get CopiedSuccessfully(): "In die Zwischenablage kopieren" | "Copied in clipboard successfully" | "Copiado en el portapapeles con éxito" | "Copié dans le presse-papiers avec succès" | "CCopiado na área de transferência com sucesso" | "Copiato negli appunti con successo";
|
|
119
120
|
static get Copy(): string;
|
|
121
|
+
static get CopyCheckoutPath(): string;
|
|
120
122
|
static get CopyToArchived(): string;
|
|
121
123
|
static get CopyToArchivedDocuments(): string;
|
|
122
124
|
static get CopyToClipboard(): "Erfolgreich in die Zwischenablage kopiert" | "Copy in clipboard" | "Copiar en portapapeles" | "Copier dans le presse-papier" | "Copiar na área de transferência" | "Copia negli appunti";
|
|
@@ -297,6 +299,7 @@ export declare class SDKUI_Localizator {
|
|
|
297
299
|
static get HideMetadata(): string;
|
|
298
300
|
static get HideSearch(): "Suche ausblenden" | "Hide search" | "Ocultar búsqueda" | "Masquer la recherche" | "Ocultar pesquisa" | "Nascondi ricerca";
|
|
299
301
|
static get High(): "Hoch" | "High" | "Alta" | "Élevée";
|
|
302
|
+
static get History(): string;
|
|
300
303
|
static get HistoryActionLabel(): string;
|
|
301
304
|
static get HistoryLabel(): string;
|
|
302
305
|
static get ID_Hide(): "Ausblenden ID" | "Hide ID" | "Ocultar ID" | "Masquer ID" | "Nascondi ID";
|
|
@@ -748,11 +748,11 @@ export class SDKUI_Localizator {
|
|
|
748
748
|
static get CancelCheckOut() {
|
|
749
749
|
switch (this._cultureID) {
|
|
750
750
|
case CultureIDs.De_DE: return "Check-out abbrechen";
|
|
751
|
-
case CultureIDs.En_US: return "Cancel
|
|
751
|
+
case CultureIDs.En_US: return "Cancel check Out";
|
|
752
752
|
case CultureIDs.Es_ES: return "Cancelar check-out";
|
|
753
753
|
case CultureIDs.Fr_FR: return "Annuler le check-out";
|
|
754
754
|
case CultureIDs.Pt_PT: return "Cancelar check-out";
|
|
755
|
-
default: return "Annulla
|
|
755
|
+
default: return "Annulla check out";
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
static get CassettoDoganaleExportMRN() {
|
|
@@ -855,6 +855,22 @@ export class SDKUI_Localizator {
|
|
|
855
855
|
default: return "Check out";
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
+
static get CheckoutInfo() {
|
|
859
|
+
switch (this._cultureID) {
|
|
860
|
+
case CultureIDs.De_DE:
|
|
861
|
+
return "Informationen zum Check out";
|
|
862
|
+
case CultureIDs.En_US:
|
|
863
|
+
return "Check out Information";
|
|
864
|
+
case CultureIDs.Es_ES:
|
|
865
|
+
return "Información sobre el pago";
|
|
866
|
+
case CultureIDs.Fr_FR:
|
|
867
|
+
return "Informations sur le paiement";
|
|
868
|
+
case CultureIDs.Pt_PT:
|
|
869
|
+
return "Informações sobre o check out";
|
|
870
|
+
default:
|
|
871
|
+
return "Informazioni sul check out";
|
|
872
|
+
}
|
|
873
|
+
}
|
|
858
874
|
static get ChooseFolder() {
|
|
859
875
|
switch (this._cultureID) {
|
|
860
876
|
case CultureIDs.De_DE: return "Ordner auswählen";
|
|
@@ -1131,6 +1147,16 @@ export class SDKUI_Localizator {
|
|
|
1131
1147
|
default: return "Copia";
|
|
1132
1148
|
}
|
|
1133
1149
|
}
|
|
1150
|
+
static get CopyCheckoutPath() {
|
|
1151
|
+
switch (this._cultureID) {
|
|
1152
|
+
case CultureIDs.De_DE: return "Checkout-Pfad kopieren";
|
|
1153
|
+
case CultureIDs.En_US: return "Copy checkout path";
|
|
1154
|
+
case CultureIDs.Es_ES: return "Copiar ruta de check out";
|
|
1155
|
+
case CultureIDs.Fr_FR: return "Copier le chemin de check out";
|
|
1156
|
+
case CultureIDs.Pt_PT: return "Copiar caminho de check out";
|
|
1157
|
+
default: return "Copia path di check out";
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1134
1160
|
static get CopyToArchived() {
|
|
1135
1161
|
switch (this._cultureID) {
|
|
1136
1162
|
case CultureIDs.De_DE: return "In Archivierte kopieren";
|
|
@@ -2153,21 +2179,21 @@ export class SDKUI_Localizator {
|
|
|
2153
2179
|
static get ExecuteCancelCheckOutQuestion() {
|
|
2154
2180
|
switch (this._cultureID) {
|
|
2155
2181
|
case CultureIDs.De_DE: return "Check-out abbrechen?";
|
|
2156
|
-
case CultureIDs.En_US: return "Cancel
|
|
2182
|
+
case CultureIDs.En_US: return "Cancel check out?";
|
|
2157
2183
|
case CultureIDs.Es_ES: return "¿Cancelar el check-out?";
|
|
2158
2184
|
case CultureIDs.Fr_FR: return "Annuler le check-out ?";
|
|
2159
2185
|
case CultureIDs.Pt_PT: return "Cancelar o check-out?";
|
|
2160
|
-
default: return "Annullare il
|
|
2186
|
+
default: return "Annullare il check out?";
|
|
2161
2187
|
}
|
|
2162
2188
|
}
|
|
2163
2189
|
static get ExecuteCheckOutQuestion() {
|
|
2164
2190
|
switch (this._cultureID) {
|
|
2165
2191
|
case CultureIDs.De_DE: return "Check-out durchführen?";
|
|
2166
|
-
case CultureIDs.En_US: return "Perform
|
|
2192
|
+
case CultureIDs.En_US: return "Perform check out?";
|
|
2167
2193
|
case CultureIDs.Es_ES: return "¿Realizar el check-out?";
|
|
2168
2194
|
case CultureIDs.Fr_FR: return "Effectuer le check-out ?";
|
|
2169
2195
|
case CultureIDs.Pt_PT: return "Executar o check-out?";
|
|
2170
|
-
default: return "Eseguire il
|
|
2196
|
+
default: return "Eseguire il check out?";
|
|
2171
2197
|
}
|
|
2172
2198
|
}
|
|
2173
2199
|
static get ExportDataListsDescriptionField() {
|
|
@@ -2899,6 +2925,16 @@ export class SDKUI_Localizator {
|
|
|
2899
2925
|
default: return "Alta";
|
|
2900
2926
|
}
|
|
2901
2927
|
}
|
|
2928
|
+
static get History() {
|
|
2929
|
+
switch (this._cultureID) {
|
|
2930
|
+
case CultureIDs.De_DE: return "Chronik";
|
|
2931
|
+
case CultureIDs.En_US: return "History";
|
|
2932
|
+
case CultureIDs.Es_ES: return "Historial";
|
|
2933
|
+
case CultureIDs.Fr_FR: return "Historique";
|
|
2934
|
+
case CultureIDs.Pt_PT: return "Histórico";
|
|
2935
|
+
default: return "Cronologia";
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2902
2938
|
static get HistoryActionLabel() {
|
|
2903
2939
|
switch (this._cultureID) {
|
|
2904
2940
|
case CultureIDs.De_DE: return "Archivieren";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AccessLevels, DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtInfo, DownloadModes, DownloadTypes } from "../ts/types";
|
|
4
|
+
export interface CheckInCheckOutInfo {
|
|
5
|
+
CICO: number;
|
|
6
|
+
CanCICO: AccessLevels;
|
|
7
|
+
CanDelChronology: AccessLevels;
|
|
8
|
+
UserID_MID: number;
|
|
9
|
+
Date_MID: number;
|
|
10
|
+
Ver_MID: number;
|
|
11
|
+
UserID_CanViewOrUpdate: AccessLevels;
|
|
12
|
+
Date_CanViewOrUpdate: AccessLevels;
|
|
13
|
+
Ver_CanViewOrUpdate: AccessLevels;
|
|
14
|
+
}
|
|
15
|
+
export declare const colors: {
|
|
16
|
+
MEDIUM_GREEN: string;
|
|
17
|
+
};
|
|
18
|
+
export interface CheckoutStatusResult {
|
|
19
|
+
isCheckedOut: boolean;
|
|
20
|
+
mode: 'editMode' | 'lockMode' | '';
|
|
21
|
+
version: number;
|
|
22
|
+
icon: React.ReactNode | null;
|
|
23
|
+
}
|
|
24
|
+
export declare const cicoIsEnabled: (dcmt: any, allUsers: Array<UserDescriptor>, dtd: DcmtTypeDescriptor | undefined) => {
|
|
25
|
+
cicoEnabled: boolean;
|
|
26
|
+
checkoutStatus: CheckoutStatusResult;
|
|
27
|
+
};
|
|
28
|
+
export declare const downloadFilesCallback: (originalFileName: string, dcmt: Array<DcmtInfo>, checkout: boolean, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>) => Promise<void>;
|