@topconsultnpm/sdkui-react 6.19.0-dev1.9 → 6.19.0-dev2.2
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/base/Styled.d.ts +1 -0
- package/lib/components/base/Styled.js +40 -0
- package/lib/components/base/TMCustomButton.d.ts +11 -0
- package/lib/components/base/TMCustomButton.js +63 -0
- package/lib/components/base/TMFileManagerDataGridView.js +4 -1
- package/lib/components/base/TMLayout.d.ts +2 -1
- package/lib/components/base/TMLayout.js +2 -2
- package/lib/components/base/TMPopUp.js +5 -18
- package/lib/components/base/TMTreeView.js +3 -2
- package/lib/components/editors/TMHtmlEditor.d.ts +5 -0
- package/lib/components/editors/TMHtmlEditor.js +72 -12
- package/lib/components/editors/TMMetadataValues.js +90 -40
- package/lib/components/features/archive/TMArchive.d.ts +10 -0
- package/lib/components/features/archive/TMArchive.js +56 -25
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +4 -4
- package/lib/components/features/blog/TMBlogCommentForm.js +76 -51
- package/lib/components/features/documents/TMDcmtBlog.d.ts +15 -0
- package/lib/components/features/documents/TMDcmtBlog.js +21 -33
- package/lib/components/features/documents/TMDcmtForm.d.ts +17 -3
- package/lib/components/features/documents/TMDcmtForm.js +205 -46
- package/lib/components/features/documents/TMDcmtTasks.d.ts +13 -0
- package/lib/components/features/documents/TMDcmtTasks.js +24 -0
- package/lib/components/features/documents/TMDragDropOverlay.js +2 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +8 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.js +6 -6
- package/lib/components/features/documents/TMRelationViewer.d.ts +53 -3
- package/lib/components/features/documents/TMRelationViewer.js +232 -85
- package/lib/components/features/search/TMSearch.d.ts +10 -1
- package/lib/components/features/search/TMSearch.js +14 -5
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +36 -7
- package/lib/components/features/search/TMSearchResult.d.ts +10 -1
- package/lib/components/features/search/TMSearchResult.js +140 -422
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.js +33 -8
- package/lib/components/features/tasks/TMTaskForm.d.ts +38 -0
- package/lib/components/features/tasks/TMTaskForm.js +386 -0
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
- package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
- package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
- package/lib/components/features/tasks/TMTasksHeader.js +37 -0
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +20 -0
- package/lib/components/features/tasks/TMTasksPanelContent.js +65 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +132 -0
- package/lib/components/features/tasks/TMTasksUtils.js +634 -0
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +39 -0
- package/lib/components/features/tasks/TMTasksUtilsView.js +118 -0
- package/lib/components/features/tasks/TMTasksView.d.ts +40 -0
- package/lib/components/features/tasks/TMTasksView.js +560 -0
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +3 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +19 -6
- package/lib/components/features/workflow/diagram/RecipientList.js +4 -3
- package/lib/components/forms/Login/Chooser.js +1 -1
- package/lib/components/forms/TMChooserForm.d.ts +1 -1
- package/lib/components/forms/TMChooserForm.js +2 -2
- package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
- package/lib/components/grids/TMBlogAttachments.js +43 -0
- package/lib/components/grids/TMBlogHeader.d.ts +31 -0
- package/lib/components/grids/TMBlogHeader.js +41 -0
- package/lib/components/grids/{TMBlogs.d.ts → TMBlogsPost.d.ts} +42 -58
- package/lib/components/grids/TMBlogsPost.js +628 -0
- package/lib/components/grids/{TMBlogsUtils.d.ts → TMBlogsPostUtils.d.ts} +61 -47
- package/lib/components/grids/{TMBlogsUtils.js → TMBlogsPostUtils.js} +146 -124
- package/lib/components/index.d.ts +14 -1
- package/lib/components/index.js +15 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +7 -0
- package/lib/components/settings/SettingsAppearance.js +8 -0
- package/lib/components/viewers/TMTidViewer.js +20 -2
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +4 -1
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +62 -4
- package/lib/helper/SDKUI_Localizator.js +618 -25
- package/lib/helper/TMCustomSearchBar.d.ts +8 -0
- package/lib/helper/TMCustomSearchBar.js +54 -0
- package/lib/helper/TMIcons.d.ts +2 -0
- package/lib/helper/TMIcons.js +6 -0
- package/lib/helper/TMImageLibrary.d.ts +3 -2
- package/lib/helper/TMImageLibrary.js +230 -230
- package/lib/helper/TMToppyMessage.d.ts +7 -0
- package/lib/helper/TMToppyMessage.js +42 -0
- package/lib/helper/TMUtils.d.ts +10 -1
- package/lib/helper/TMUtils.js +42 -1
- package/lib/helper/dcmtsHelper.d.ts +2 -0
- package/lib/helper/dcmtsHelper.js +18 -0
- package/lib/helper/helpers.js +1 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useRelatedDocuments.d.ts +72 -0
- package/lib/hooks/useRelatedDocuments.js +655 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/ts/types.d.ts +14 -0
- package/lib/ts/types.js +15 -0
- package/lib/utils/theme.d.ts +1 -0
- package/lib/utils/theme.js +1 -0
- package/package.json +7 -7
- package/lib/components/grids/TMBlogs.js +0 -721
- package/lib/stories/TMButton.stories.d.ts +0 -4
- package/lib/stories/TMButton.stories.js +0 -29
- package/lib/stories/TMDataGrid.stories.d.ts +0 -9
- package/lib/stories/TMDataGrid.stories.js +0 -310
- package/lib/stories/TMHtmlContentDisplay.stories.d.ts +0 -6
- package/lib/stories/TMHtmlContentDisplay.stories.js +0 -45
- package/lib/stories/TMHtmlEditor.stories.d.ts +0 -6
- package/lib/stories/TMHtmlEditor.stories.js +0 -49
- package/lib/stories/TMIcons.stories.d.ts +0 -4
- package/lib/stories/TMIcons.stories.js +0 -13
- package/lib/stories/TMSDKUI_Localizator.stories.d.ts +0 -4
- package/lib/stories/TMSDKUI_Localizator.stories.js +0 -123
- package/lib/stories/TMStoriesUtils.d.ts +0 -1
- package/lib/stories/TMStoriesUtils.js +0 -10
- package/lib/stories/TMUserAvatar.stories.d.ts +0 -6
- package/lib/stories/TMUserAvatar.stories.js +0 -20
|
@@ -1,11 +1,12 @@
|
|
|
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,
|
|
3
|
+
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
|
|
6
|
-
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu
|
|
6
|
+
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu } from '../../../helper';
|
|
7
7
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
8
8
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
|
9
|
+
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
9
10
|
import { DcmtOperationTypes, FormModes, SearchResultContext, DownloadTypes } from '../../../ts';
|
|
10
11
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
11
12
|
import { StyledModalContainer, StyledBadge, StyledMultiViewPanel } from '../../base/Styled';
|
|
@@ -21,7 +22,6 @@ import TMMetadataValues from '../../editors/TMMetadataValues';
|
|
|
21
22
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
|
22
23
|
import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
|
23
24
|
import TMTidViewer from '../../viewers/TMTidViewer';
|
|
24
|
-
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
|
25
25
|
import TMDcmtPreview from '../documents/TMDcmtPreview';
|
|
26
26
|
import TMFloatingToolbar from '../../base/TMFloatingToolbar';
|
|
27
27
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
@@ -40,6 +40,8 @@ import ShowAlert from '../../base/TMAlert';
|
|
|
40
40
|
import TMSpinner from '../../base/TMSpinner';
|
|
41
41
|
import TMChooserForm from '../../forms/TMChooserForm';
|
|
42
42
|
import TMModal from '../../base/TMModal';
|
|
43
|
+
import TMSearch from './TMSearch';
|
|
44
|
+
import TMArchive from '../archive/TMArchive';
|
|
43
45
|
//#region Helper Methods
|
|
44
46
|
export const getSearchResultCountersSingleCategory = (searchResults) => {
|
|
45
47
|
// let totDcmtTypes = searchResults.length;
|
|
@@ -57,7 +59,7 @@ const orderByName = (array) => {
|
|
|
57
59
|
return 1;
|
|
58
60
|
} return 0; });
|
|
59
61
|
};
|
|
60
|
-
const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, floatingActionConfig, openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openCommentFormCallback, openAddDocumentForm, openS4TViewer = false, onOpenS4TViewerRequest, passToArchiveCallback, showTodoDcmtForm = false }) => {
|
|
62
|
+
const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, floatingActionConfig, openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openCommentFormCallback, openAddDocumentForm, openS4TViewer = false, onOpenS4TViewerRequest, passToArchiveCallback, showTodoDcmtForm = false, onReferenceClick, }) => {
|
|
61
63
|
const [id, setID] = useState('');
|
|
62
64
|
const [showApprovePopup, setShowApprovePopup] = useState(false);
|
|
63
65
|
const [showRejectPopup, setShowRejectPopup] = useState(false);
|
|
@@ -70,29 +72,11 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
70
72
|
const [selectedSearchResult, setSelectedSearchResult] = useState();
|
|
71
73
|
const [currentSearchResults, setCurrentSearchResults] = useState(searchResults || []);
|
|
72
74
|
const [showSearch, setShowSearch] = useState(false);
|
|
73
|
-
|
|
74
|
-
const [relatedDcmts, setRelatedDcmts] = useState(undefined);
|
|
75
|
-
const [showRelatedDcmtsChooser, setShowRelatedDcmtsChooser] = useState(false);
|
|
76
|
-
const [archiveType, setArchiveType] = useState(undefined);
|
|
77
|
-
const [isOpenDetails, setIsOpenDetails] = useState(false);
|
|
78
|
-
const [isOpenMaster, setIsOpenMaster] = useState(false);
|
|
79
|
-
const [isOpenArchiveRelationForm, setIsOpenArchiveRelationForm] = useState(false);
|
|
80
|
-
const [archiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormTID] = useState(undefined);
|
|
81
|
-
const [archiveRelatedDcmtFormMids, setArchiveRelatedDcmtFormMids] = useState([]);
|
|
82
|
-
const [relatedDcmtsChooserDataSource, setRelatedDcmtsChooserDataSource] = useState(undefined);
|
|
83
|
-
const [showPairDcmtsModal, setShowPairDcmtsModal] = useState(false);
|
|
84
|
-
const [isPairingManyToMany, setIsPairingManyToMany] = useState(false);
|
|
85
|
-
const [pairedSearchResults, setPairedSearchResults] = useState([]);
|
|
86
|
-
const [manyToManyRelations, setManyToManyRelations] = useState(undefined);
|
|
87
|
-
const [showManyToManyChooser, setShowManyToManyChooser] = useState(false);
|
|
88
|
-
const [manyToManyChooserDataSource, setManyToManyChooserDataSource] = useState(undefined);
|
|
75
|
+
const [sharedDcmtSearchResults, setSharedDcmtSearchResults] = useState([]);
|
|
89
76
|
const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
|
|
90
77
|
const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
|
|
91
|
-
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
|
92
|
-
const [currentTIDHasMasterRelations, setCurrentTIDHasMasterRelations] = useState();
|
|
93
|
-
const [canArchiveMasterRelation, setCanArchiveMasterRelation] = useState(false);
|
|
94
|
-
const [canArchiveDetailRelation, setCanArchiveDetailRelation] = useState(false);
|
|
95
78
|
const [isOpenBatchUpdate, setIsOpenBatchUpdate] = useState(false);
|
|
79
|
+
const [isOpenSharedArchive, setIsOpenSharedArchive] = useState(false);
|
|
96
80
|
const [visibleItems, setVisibleItems] = useState([]);
|
|
97
81
|
const [focusedItem, setFocusedItem] = useState();
|
|
98
82
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
@@ -100,20 +84,27 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
100
84
|
const [currentMetadataValues, setCurrentMetadataValues] = useState([]);
|
|
101
85
|
const [dcmtFormLayoutMode, setDcmtFormLayoutMode] = useState(LayoutModes.Update);
|
|
102
86
|
const [isModifiedBatchUpdate, setIsModifiedBatchUpdate] = useState(false);
|
|
87
|
+
const [sharedDcmtFile, setSharedDcmtFile] = useState(undefined);
|
|
103
88
|
// State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
|
|
104
89
|
const [showExportForm, setShowExportForm] = useState(false);
|
|
105
90
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
106
91
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
107
|
-
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
|
|
92
|
+
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync } = useDcmtOperations();
|
|
93
|
+
const relatedDocuments = useRelatedDocuments({ selectedSearchResult, focusedItem, currentSearchResults });
|
|
94
|
+
const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenDetails, isOpenMaster, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showPairDcmtsModal, isPairingManyToMany, pairedSearchResults, manyToManyRelations, selectedManyToManyRelation, showManyToManyChooser, manyToManyChooserDataSource, showPairSearchModal, pairSearchModalTargetTID, pairSearchModalParentTID, pairSearchModalParentDID, pairSearchModalRelation, pairSearchModalInputMids, currentTIDHasDetailRelations, currentTIDHasMasterRelations, canArchiveMasterRelation, canArchiveDetailRelation, hasManyToManyRelation, setIsOpenDetails, setIsOpenMaster, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setShowPairSearchModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, pairFloatingActionConfig, pairSearchModalFloatingActionConfig, archiveMasterDocuments, archiveDetailDocuments, pairManyToMany, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, archiveRelatedDcmtHandler, executeManyToManyPairing, } = relatedDocuments;
|
|
108
95
|
const deviceType = useDeviceType();
|
|
109
96
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
110
|
-
const
|
|
97
|
+
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
111
98
|
// Disable the "Sign/Approve" button if:
|
|
112
99
|
// 1. No document or multiple documents are selected, OR
|
|
113
100
|
// 2. Exactly one document is selected but its FILEEXT property is null
|
|
114
|
-
const disableSignApproveDisable =
|
|
101
|
+
const disableSignApproveDisable = selectedDocs.length !== 1 || (selectedDocs.length === 1 && selectedDocs[0].FILEEXT === null);
|
|
115
102
|
const dcmtsReturned = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsReturned : searchResults[0]?.dcmtsReturned ?? 0);
|
|
116
103
|
const dcmtsFound = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsFound : searchResults[0]?.dcmtsFound ?? 0);
|
|
104
|
+
// Dcmt Blog states
|
|
105
|
+
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
106
|
+
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
107
|
+
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
117
108
|
useEffect(() => { setID(genUniqueId()); }, []);
|
|
118
109
|
useEffect(() => {
|
|
119
110
|
setSelectedItems([]);
|
|
@@ -134,14 +125,13 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
134
125
|
DcmtTypeListCacheService.GetWithNotGrantedAsync(selectedSearchResult?.fromTID, Number(selectedSearchResult?.dtdResult?.rows?.[0]?.[1])).then((dtd) => {
|
|
135
126
|
setFromDTD(dtd);
|
|
136
127
|
});
|
|
137
|
-
hasDetailRelations(selectedSearchResult?.fromTID).then((value) => setCurrentTIDHasDetailRelations(value));
|
|
138
|
-
hasMasterRelations(selectedSearchResult?.fromTID).then((value) => setCurrentTIDHasMasterRelations(value));
|
|
139
128
|
checkRelatedDcmtsArchiveCapability();
|
|
129
|
+
checkManyToManyCapability();
|
|
140
130
|
// Ricava il nuovo dataSource
|
|
141
131
|
const newDataSource = searchResultDescriptorToSimpleArray(selectedSearchResult);
|
|
142
132
|
// Se esiste almeno una riga, seleziona la prima
|
|
143
133
|
setFocusedItem(newDataSource && newDataSource.length > 0 ? newDataSource[0] : undefined);
|
|
144
|
-
}, [selectedSearchResult]);
|
|
134
|
+
}, [selectedSearchResult, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
145
135
|
useEffect(() => {
|
|
146
136
|
if (!focusedItem)
|
|
147
137
|
return;
|
|
@@ -164,7 +154,59 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
164
154
|
fileExt: currentMetadataValues.find(o => o.mid == SystemMIDsAsNumber.FileExt)?.value
|
|
165
155
|
});
|
|
166
156
|
}, [currentMetadataValues]);
|
|
167
|
-
const openFormHandler = (layoutMode) => {
|
|
157
|
+
const openFormHandler = (layoutMode) => {
|
|
158
|
+
setIsOpenDcmtForm(true);
|
|
159
|
+
setDcmtFormLayoutMode(layoutMode);
|
|
160
|
+
};
|
|
161
|
+
const openSharedArchiveHandler = async () => {
|
|
162
|
+
const dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
163
|
+
if (dcmts.length === 0) {
|
|
164
|
+
ShowAlert({ message: "Nessun documento selezionato", mode: "warning", title: 'Archivio Condivisa', duration: 3000 });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (fromDTD?.perm?.canArchive !== AccessLevelsEx.Yes && fromDTD?.perm?.canArchive !== AccessLevelsEx.Mixed) {
|
|
168
|
+
ShowAlert({
|
|
169
|
+
message: "Non hai i permessi per archiviare documenti di questo tipo.",
|
|
170
|
+
mode: 'warning',
|
|
171
|
+
title: 'Archivio Condivisa',
|
|
172
|
+
duration: 5000
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const rfo = new RetrieveFileOptions();
|
|
178
|
+
rfo.retrieveReason = DcmtOpers.None;
|
|
179
|
+
rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
|
|
180
|
+
let dcmtFile = await getDcmtFileAsync({ TID: focusedItem?.TID, DID: focusedItem?.DID }, rfo, 'Archiviazione Condivisa', false, true);
|
|
181
|
+
if (dcmtFile) {
|
|
182
|
+
setSharedDcmtFile(dcmtFile?.file);
|
|
183
|
+
}
|
|
184
|
+
setIsOpenSharedArchive(true);
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const showSharedDcmtsHandler = async () => {
|
|
191
|
+
try {
|
|
192
|
+
TMSpinner.show({ description: "Caricamento documenti condivisi..." });
|
|
193
|
+
const se = SDK_Globals.tmSession?.NewSearchEngine();
|
|
194
|
+
const sharedDcmts = await se?.GetSharedDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].TID, getSelectedDcmtsOrFocused(selectedItems, focusedItem)[0].DID);
|
|
195
|
+
if (sharedDcmts && sharedDcmts.length > 0) {
|
|
196
|
+
console.log(sharedDcmts);
|
|
197
|
+
setSharedDcmtSearchResults(sharedDcmts);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
ShowAlert({ message: "Nessun documento condiviso trovato.", mode: "info", title: 'Documenti Condivisi', duration: 5000 });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (e) {
|
|
204
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
TMSpinner.hide();
|
|
208
|
+
}
|
|
209
|
+
};
|
|
168
210
|
const openTaskFormHandler = (onTaskCreated) => {
|
|
169
211
|
if (selectedItems.length > 1)
|
|
170
212
|
return;
|
|
@@ -259,7 +301,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
259
301
|
return;
|
|
260
302
|
if (e.target === 'content') {
|
|
261
303
|
e.items = e.items || [];
|
|
262
|
-
const menuItems = getCommandsMenuItems(isMobile, fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany);
|
|
304
|
+
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, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation);
|
|
263
305
|
e.items.push(...menuItems);
|
|
264
306
|
}
|
|
265
307
|
};
|
|
@@ -423,386 +465,8 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
423
465
|
break;
|
|
424
466
|
}
|
|
425
467
|
};
|
|
426
|
-
//#region Related Documents Archive Section
|
|
427
|
-
const pairFloatingActionConfig = useMemo(() => ({
|
|
428
|
-
isVisible: true,
|
|
429
|
-
type: 'multi',
|
|
430
|
-
onClick: (selected) => { console.log(selected); },
|
|
431
|
-
iconElement: _jsx(IconRelation, { fontSize: 26 }),
|
|
432
|
-
tooltip: isPairingManyToMany ? 'Abbina' : 'Disabbina',
|
|
433
|
-
}), [isPairingManyToMany, pairedSearchResults]);
|
|
434
|
-
const getAllRelationsAsync = async () => {
|
|
435
|
-
const tmSession = SDK_Globals.tmSession;
|
|
436
|
-
try {
|
|
437
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
438
|
-
let relations = await RelationCacheService.GetAllAsync(tmSession);
|
|
439
|
-
if (!relations)
|
|
440
|
-
throw new Error("Impossibile caricare le relazioni.");
|
|
441
|
-
return relations;
|
|
442
|
-
}
|
|
443
|
-
catch (error) {
|
|
444
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
445
|
-
return undefined;
|
|
446
|
-
}
|
|
447
|
-
finally {
|
|
448
|
-
TMSpinner.hide();
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
const checkRelatedDcmtsArchiveCapability = async () => {
|
|
452
|
-
const tid = selectedSearchResult?.fromTID;
|
|
453
|
-
if (!tid) {
|
|
454
|
-
setCanArchiveMasterRelation(false);
|
|
455
|
-
setCanArchiveDetailRelation(false);
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
try {
|
|
459
|
-
const relations = await getAllRelationsAsync();
|
|
460
|
-
if (!relations) {
|
|
461
|
-
setCanArchiveMasterRelation(false);
|
|
462
|
-
setCanArchiveDetailRelation(false);
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
const detailRelations = relations.filter(r => r.detailTID === tid);
|
|
466
|
-
const hasMasterWithAssociations = detailRelations.some(rel => rel.associations && rel.associations.length > 0);
|
|
467
|
-
setCanArchiveMasterRelation(hasMasterWithAssociations);
|
|
468
|
-
const masterRelations = relations.filter(r => r.masterTID === tid);
|
|
469
|
-
const hasDetailWithAssociations = masterRelations.some(rel => rel.associations && rel.associations.length > 0);
|
|
470
|
-
setCanArchiveDetailRelation(hasDetailWithAssociations);
|
|
471
|
-
}
|
|
472
|
-
catch (error) {
|
|
473
|
-
console.error("Error checking archive capability:", error);
|
|
474
|
-
setCanArchiveMasterRelation(false);
|
|
475
|
-
setCanArchiveDetailRelation(false);
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
const getFocusedItem = () => {
|
|
479
|
-
if (!focusedItem || currentSearchResults.length !== 1)
|
|
480
|
-
return undefined;
|
|
481
|
-
return { mdList: currentSearchResults[0].dtdResult?.rows?.[focusedItem?.rowIndex ?? 0], mids: currentSearchResults[0].selectMIDs ?? [] };
|
|
482
|
-
};
|
|
483
|
-
const fetchAssociatedValues = (mid) => {
|
|
484
|
-
let mdList = getFocusedItem();
|
|
485
|
-
if (!mdList)
|
|
486
|
-
return;
|
|
487
|
-
let index = mdList.mids.findIndex(m => m == mid);
|
|
488
|
-
if (index === -1)
|
|
489
|
-
return;
|
|
490
|
-
return mdList.mdList?.[index];
|
|
491
|
-
};
|
|
492
|
-
const filterRelationsByType = (relations, tid, type) => {
|
|
493
|
-
return type === 'detail'
|
|
494
|
-
? relations.filter(r => r.masterTID == tid)
|
|
495
|
-
: relations.filter(r => r.detailTID == tid);
|
|
496
|
-
};
|
|
497
|
-
const filterRelationsWithAssociations = (relations) => {
|
|
498
|
-
return relations.filter(rel => rel.associations && rel.associations.length > 0);
|
|
499
|
-
};
|
|
500
|
-
const getRelatedDcmt = async (relation, type) => {
|
|
501
|
-
return await DcmtTypeListCacheService.GetAsync(type === 'detail' ? relation.detailTID : relation.masterTID);
|
|
502
|
-
};
|
|
503
|
-
const showNoRelationsAlert = (type) => {
|
|
504
|
-
ShowAlert({
|
|
505
|
-
message: type === 'detail'
|
|
506
|
-
? "Nessun documento di dettaglio trovato per l'archiviazione."
|
|
507
|
-
: "Nessun documento di master trovato per l'archiviazione.",
|
|
508
|
-
mode: 'info',
|
|
509
|
-
title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
|
|
510
|
-
duration: 5000
|
|
511
|
-
});
|
|
512
|
-
};
|
|
513
|
-
const showNoAssociationsAlert = (type) => {
|
|
514
|
-
ShowAlert({
|
|
515
|
-
message: type === 'detail'
|
|
516
|
-
? "Nessuna associazione trovata per i documenti di dettaglio."
|
|
517
|
-
: "Nessuna associazione trovata per i documenti di master.",
|
|
518
|
-
mode: 'info',
|
|
519
|
-
title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
|
|
520
|
-
duration: 5000
|
|
521
|
-
});
|
|
522
|
-
};
|
|
523
|
-
const mapAssociationsToMids = (relation, type) => {
|
|
524
|
-
return relation.associations?.map(assoc => ({
|
|
525
|
-
mid: type === 'detail' ? (assoc.item2 ?? 0) : (assoc.item1 ?? 0),
|
|
526
|
-
value: fetchAssociatedValues(type === 'detail' ? (assoc.item1 ?? 0) : (assoc.item2 ?? 0)) ?? ''
|
|
527
|
-
})) ?? [];
|
|
528
|
-
};
|
|
529
|
-
const archiveRelatedDcmtHandler = (relation, type) => {
|
|
530
|
-
const targetTID = type === 'detail' ? relation.detailTID : relation.masterTID;
|
|
531
|
-
if (!targetTID)
|
|
532
|
-
return;
|
|
533
|
-
const mids = mapAssociationsToMids(relation, type);
|
|
534
|
-
setArchiveType(type);
|
|
535
|
-
setArchiveRelatedDcmtFormTID(targetTID);
|
|
536
|
-
setArchiveRelatedDcmtFormMids(mids);
|
|
537
|
-
setIsOpenArchiveRelationForm(true);
|
|
538
|
-
};
|
|
539
|
-
const archiveRelatedDocuments = async (tid, type) => {
|
|
540
|
-
try {
|
|
541
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
542
|
-
const relations = await getAllRelationsAsync();
|
|
543
|
-
if (!relations || !tid)
|
|
544
|
-
return;
|
|
545
|
-
const filteredRelations = filterRelationsByType(relations, tid, type);
|
|
546
|
-
if (!filteredRelations || filteredRelations.length === 0) {
|
|
547
|
-
showNoRelationsAlert(type);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
const withAssociations = filterRelationsWithAssociations(filteredRelations);
|
|
551
|
-
if (withAssociations.length === 0) {
|
|
552
|
-
showNoAssociationsAlert(type);
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
setRelatedDcmts(withAssociations);
|
|
556
|
-
if (withAssociations.length > 1) {
|
|
557
|
-
const dataSourcePromises = withAssociations.map(async (rel) => {
|
|
558
|
-
const relatedDcmt = await getRelatedDcmt(rel, type);
|
|
559
|
-
return { id: rel?.id, name: relatedDcmt?.name };
|
|
560
|
-
});
|
|
561
|
-
const dataSource = await Promise.all(dataSourcePromises);
|
|
562
|
-
setRelatedDcmtsChooserDataSource(dataSource);
|
|
563
|
-
setArchiveType(type);
|
|
564
|
-
setShowRelatedDcmtsChooser(true);
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
archiveRelatedDcmtHandler(withAssociations[0], type);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
catch (error) {
|
|
571
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
572
|
-
}
|
|
573
|
-
finally {
|
|
574
|
-
TMSpinner.hide();
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
const archiveDetailDocuments = async (tid) => {
|
|
578
|
-
await archiveRelatedDocuments(tid, 'detail');
|
|
579
|
-
};
|
|
580
|
-
const archiveMasterDocuments = async (tid) => {
|
|
581
|
-
await archiveRelatedDocuments(tid, 'master');
|
|
582
|
-
};
|
|
583
|
-
const getAlreadyPairedDIDs = async (relation, currentTID, currentDID) => {
|
|
584
|
-
if (!relation || !currentDID)
|
|
585
|
-
return [];
|
|
586
|
-
try {
|
|
587
|
-
const tmSession = SDK_Globals.tmSession;
|
|
588
|
-
if (!tmSession)
|
|
589
|
-
return [];
|
|
590
|
-
const searchEngine = tmSession.NewSearchEngine();
|
|
591
|
-
if (!searchEngine)
|
|
592
|
-
return [];
|
|
593
|
-
const isMaster = currentTID === relation.masterTID;
|
|
594
|
-
const pairedResults = isMaster
|
|
595
|
-
? await searchEngine.GetAllDetailDcmtsAsync(currentTID, currentDID)
|
|
596
|
-
: await searchEngine.GetAllMasterDcmtsAsync(currentTID, currentDID);
|
|
597
|
-
if (!pairedResults || pairedResults.length === 0)
|
|
598
|
-
return [];
|
|
599
|
-
const relationResult = pairedResults.find(r => r.relationID === relation.id);
|
|
600
|
-
if (!relationResult?.dtdResult)
|
|
601
|
-
return [];
|
|
602
|
-
const pairedDIDs = [];
|
|
603
|
-
const rows = relationResult.dtdResult.rows ?? [];
|
|
604
|
-
const columns = relationResult.dtdResult.columns ?? [];
|
|
605
|
-
const didColumnIndex = columns.findIndex(col => {
|
|
606
|
-
const caption = col.caption?.toUpperCase();
|
|
607
|
-
const mid = col.extendedProperties?.["MID"];
|
|
608
|
-
const midNum = typeof mid === 'string' ? Number.parseInt(mid, 10) : mid;
|
|
609
|
-
return caption === 'DID' || midNum === 5;
|
|
610
|
-
});
|
|
611
|
-
if (didColumnIndex === -1)
|
|
612
|
-
return [];
|
|
613
|
-
for (const row of rows) {
|
|
614
|
-
const did = row[didColumnIndex];
|
|
615
|
-
if (did) {
|
|
616
|
-
const didNumber = typeof did === 'string' ? Number.parseInt(did, 10) : did;
|
|
617
|
-
if (!Number.isNaN(didNumber)) {
|
|
618
|
-
pairedDIDs.push(didNumber);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return pairedDIDs;
|
|
623
|
-
}
|
|
624
|
-
catch (error) {
|
|
625
|
-
console.error('getAlreadyPairedDIDs - Error:', error);
|
|
626
|
-
return [];
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
const executeManyToManyPairing = async (relation, isPairing) => {
|
|
630
|
-
const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
|
|
631
|
-
if (!focusedItem?.TID || !focusedItem?.DID) {
|
|
632
|
-
alert("Seleziona un documento per eseguire la ricerca molti-a-molti.");
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
let qd;
|
|
636
|
-
if (relation.detailTID === selectedSearchResult?.fromTID) {
|
|
637
|
-
qd = relation.retrieveMastersQuery;
|
|
638
|
-
}
|
|
639
|
-
if (relation.masterTID === selectedSearchResult?.fromTID) {
|
|
640
|
-
qd = relation.retrieveDetailsQuery;
|
|
641
|
-
}
|
|
642
|
-
if (!qd) {
|
|
643
|
-
alert("La relazione molti-a-molti selezionata non ha una query di ricerca definita.");
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
qd = structuredClone(qd);
|
|
647
|
-
if (qd.select) {
|
|
648
|
-
for (const s of qd.select) {
|
|
649
|
-
s.visibility = 1;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
const qdRetrieveParamsValue = {
|
|
653
|
-
from: { tid: focusedItem.TID },
|
|
654
|
-
select: [],
|
|
655
|
-
where: [
|
|
656
|
-
{
|
|
657
|
-
tid: focusedItem.TID,
|
|
658
|
-
mid: 5,
|
|
659
|
-
leftBrackets: "(",
|
|
660
|
-
rightBrackets: ")",
|
|
661
|
-
operator: 0,
|
|
662
|
-
value1: focusedItem.DID.toString()
|
|
663
|
-
}
|
|
664
|
-
]
|
|
665
|
-
};
|
|
666
|
-
let notMappedMIDs = false;
|
|
667
|
-
if (qd.params && qd.params.length > 0) {
|
|
668
|
-
for (const param of qd.params) {
|
|
669
|
-
if (!param.mappedMID)
|
|
670
|
-
continue;
|
|
671
|
-
qdRetrieveParamsValue.select.push({
|
|
672
|
-
tid: param.mappedTID ?? focusedItem.TID,
|
|
673
|
-
mid: param.mappedMID,
|
|
674
|
-
visibility: 1
|
|
675
|
-
});
|
|
676
|
-
const currentRowValue = currentSearchResults[0]?.dtdResult?.rows?.[focusedItem.rowIndex];
|
|
677
|
-
const midIndex = currentSearchResults[0]?.selectMIDs?.indexOf(param.mappedMID);
|
|
678
|
-
if (currentRowValue && midIndex !== undefined && midIndex >= 0) {
|
|
679
|
-
const value = currentRowValue[midIndex];
|
|
680
|
-
param.value = value ?? '';
|
|
681
|
-
if (param.value === null || param.value === '')
|
|
682
|
-
notMappedMIDs = true;
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
notMappedMIDs = true;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
if (notMappedMIDs && qdRetrieveParamsValue.select && qdRetrieveParamsValue.select.length > 0) {
|
|
689
|
-
const paramMetadata = await searchEngine.SearchByIDAsync(qdRetrieveParamsValue);
|
|
690
|
-
if (paramMetadata?.dtdResult?.rows?.[0]) {
|
|
691
|
-
for (const param of qd.params) {
|
|
692
|
-
if (!param.mappedMID)
|
|
693
|
-
continue;
|
|
694
|
-
const colIndex = paramMetadata.selectMIDs?.indexOf(param.mappedMID);
|
|
695
|
-
if (colIndex !== undefined && colIndex >= 0) {
|
|
696
|
-
const value = paramMetadata.dtdResult.rows[0][colIndex];
|
|
697
|
-
param.value = value ?? '';
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (qd.where && qd.where.length > 0) {
|
|
703
|
-
for (const whereItem of qd.where) {
|
|
704
|
-
for (const param of qd.params) {
|
|
705
|
-
if (!param.name)
|
|
706
|
-
continue;
|
|
707
|
-
param.value ??= '';
|
|
708
|
-
const paramValue = param.value.toString();
|
|
709
|
-
if (whereItem.value1) {
|
|
710
|
-
whereItem.value1 = whereItem.value1.replace(param.name, paramValue);
|
|
711
|
-
}
|
|
712
|
-
if (whereItem.value2) {
|
|
713
|
-
whereItem.value2 = whereItem.value2.replace(param.name, paramValue);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
const targetTID = relation.detailTID === selectedSearchResult?.fromTID
|
|
720
|
-
? relation.masterTID
|
|
721
|
-
: relation.detailTID;
|
|
722
|
-
const qdWithDID = structuredClone(qd);
|
|
723
|
-
const didSelect = { tid: targetTID, mid: 1, visibility: 1 };
|
|
724
|
-
const fileExtSelect = { tid: targetTID, mid: 5, visibility: 1 };
|
|
725
|
-
if (qdWithDID.select) {
|
|
726
|
-
qdWithDID.select = [didSelect, fileExtSelect, ...qdWithDID.select];
|
|
727
|
-
}
|
|
728
|
-
else {
|
|
729
|
-
qdWithDID.select = [didSelect, fileExtSelect];
|
|
730
|
-
}
|
|
731
|
-
const sq = await searchEngine.SearchByIDAsync(qdWithDID);
|
|
732
|
-
if (!sq?.dtdResult?.rows || sq.dtdResult.rows.length === 0) {
|
|
733
|
-
alert("Nessun documento trovato.");
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
const pairedDIDs = await getAlreadyPairedDIDs(relation, focusedItem.TID, focusedItem.DID);
|
|
737
|
-
const filteredRows = sq.dtdResult.rows.filter(row => {
|
|
738
|
-
const did = row[0];
|
|
739
|
-
const didNum = typeof did === 'string' ? parseInt(did, 10) : did;
|
|
740
|
-
if (isPairing) {
|
|
741
|
-
return !pairedDIDs.includes(didNum);
|
|
742
|
-
}
|
|
743
|
-
else {
|
|
744
|
-
return pairedDIDs.includes(didNum);
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
const filteredSq = {
|
|
748
|
-
...sq,
|
|
749
|
-
dtdResult: {
|
|
750
|
-
...sq.dtdResult,
|
|
751
|
-
rows: filteredRows
|
|
752
|
-
},
|
|
753
|
-
dcmtsReturned: filteredRows.length,
|
|
754
|
-
dcmtsFound: filteredRows.length
|
|
755
|
-
};
|
|
756
|
-
if (filteredRows.length === 0) {
|
|
757
|
-
alert(isPairing ? "Nessun documento da abbinare." : "Nessun documento abbinato trovato.");
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
setPairedSearchResults([filteredSq]);
|
|
761
|
-
setIsPairingManyToMany(isPairing);
|
|
762
|
-
setShowPairDcmtsModal(true);
|
|
763
|
-
};
|
|
764
|
-
const pairManyToMany = async (isPairing) => {
|
|
765
|
-
try {
|
|
766
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
767
|
-
const relations = await getAllRelationsAsync();
|
|
768
|
-
if (!relations)
|
|
769
|
-
return;
|
|
770
|
-
if (!relations.some(r => r.relationType === RelationTypes.ManyToMany)) {
|
|
771
|
-
alert("Nessuna relazione molti-a-molti definita nel sistema.");
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
const manyToManyRels = relations.filter(r => r.relationType === RelationTypes.ManyToMany);
|
|
775
|
-
if (!manyToManyRels.some(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID)) {
|
|
776
|
-
alert("Nessuna relazione molti-a-molti definita per il tipo di documento selezionato.");
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
const relsManyToMany = manyToManyRels.filter(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID);
|
|
780
|
-
setManyToManyRelations(relsManyToMany);
|
|
781
|
-
if (relsManyToMany.length > 1) {
|
|
782
|
-
const dataSourcePromises = relsManyToMany.map(async (rel) => {
|
|
783
|
-
const targetTID = rel.masterTID === selectedSearchResult?.fromTID ? rel.detailTID : rel.masterTID;
|
|
784
|
-
const relatedDcmt = await DcmtTypeListCacheService.GetAsync(targetTID);
|
|
785
|
-
return { id: rel?.id, name: relatedDcmt?.name };
|
|
786
|
-
});
|
|
787
|
-
const dataSource = await Promise.all(dataSourcePromises);
|
|
788
|
-
setManyToManyChooserDataSource(dataSource);
|
|
789
|
-
setIsPairingManyToMany(isPairing);
|
|
790
|
-
setShowManyToManyChooser(true);
|
|
791
|
-
}
|
|
792
|
-
else {
|
|
793
|
-
await executeManyToManyPairing(relsManyToMany[0], isPairing);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
catch (error) {
|
|
797
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
798
|
-
}
|
|
799
|
-
finally {
|
|
800
|
-
TMSpinner.hide();
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
//#endregion Related Documents Archive Section
|
|
804
468
|
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 &&
|
|
805
|
-
_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, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany) })] });
|
|
469
|
+
_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, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) })] });
|
|
806
470
|
const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canPrev: canNavigateHandler('prev'), onPrev: () => onNavigateHandler('prev') }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canNext: canNavigateHandler('next'), onNext: () => onNavigateHandler('next') })] });
|
|
807
471
|
const handleAddItem = (tid, did) => {
|
|
808
472
|
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
@@ -811,6 +475,22 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
811
475
|
const handleRemoveItem = (tid, did) => {
|
|
812
476
|
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
813
477
|
};
|
|
478
|
+
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
479
|
+
try {
|
|
480
|
+
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
481
|
+
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
482
|
+
setBlogsDatasource(res ?? []);
|
|
483
|
+
setHasLoadedDataOnce(true);
|
|
484
|
+
setLastLoadedDid(did);
|
|
485
|
+
}
|
|
486
|
+
catch (e) {
|
|
487
|
+
let err = e;
|
|
488
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
TMSpinner.hide();
|
|
492
|
+
}
|
|
493
|
+
}, []);
|
|
814
494
|
const showToppyForApprove = (isVisible && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isOpenDcmtForm && !isOpenDetails && !isOpenMaster);
|
|
815
495
|
const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
|
|
816
496
|
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
@@ -819,14 +499,24 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
819
499
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
820
500
|
:
|
|
821
501
|
_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 &&
|
|
822
|
-
_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, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany) })] })] })] }), 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: () => {
|
|
502
|
+
_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, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation) })] })] })] }), 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: () => {
|
|
823
503
|
setIsOpenBatchUpdate(false);
|
|
824
504
|
}, onSavedCallbackAsync: async () => {
|
|
825
505
|
setIsOpenBatchUpdate(false);
|
|
826
506
|
setIsModifiedBatchUpdate(false);
|
|
827
507
|
await refreshSelectionDataRowsAsync();
|
|
828
508
|
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), (showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm) &&
|
|
829
|
-
_jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () =>
|
|
509
|
+
_jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
|
|
510
|
+
setShowApprovePopup(true);
|
|
511
|
+
}, onSignApprove: () => {
|
|
512
|
+
handleSignApprove();
|
|
513
|
+
}, onReject: () => {
|
|
514
|
+
setShowRejectPopup(true);
|
|
515
|
+
}, onReAssign: () => {
|
|
516
|
+
setShowReAssignPopup(true);
|
|
517
|
+
}, onMoreInfo: () => {
|
|
518
|
+
setShowMoreInfoPopup(true);
|
|
519
|
+
}, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), showRelatedDcmtsChooser &&
|
|
830
520
|
_jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
|
|
831
521
|
try {
|
|
832
522
|
setShowRelatedDcmtsChooser(false);
|
|
@@ -834,7 +524,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
834
524
|
const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
|
|
835
525
|
if (!relation || !archiveType)
|
|
836
526
|
return;
|
|
837
|
-
archiveRelatedDcmtHandler(relation, archiveType);
|
|
527
|
+
await archiveRelatedDcmtHandler(relation, archiveType);
|
|
838
528
|
}
|
|
839
529
|
catch (error) {
|
|
840
530
|
TMExceptionBoxManager.show({ exception: error });
|
|
@@ -859,7 +549,16 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
859
549
|
TMSpinner.hide();
|
|
860
550
|
}
|
|
861
551
|
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false }), showPairDcmtsModal &&
|
|
862
|
-
_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: onRefreshSearchAsync, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, showTodoDcmtForm: showTodoDcmtForm, floatingActionConfig: pairFloatingActionConfig
|
|
552
|
+
_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, onRefreshSearchAsync: onRefreshSearchAsync, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, showTodoDcmtForm: showTodoDcmtForm, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), showPairSearchModal &&
|
|
553
|
+
_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: () => {
|
|
554
|
+
setIsOpenSharedArchive(false);
|
|
555
|
+
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputDID: focusedItem?.DID, inputTID: focusedItem?.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) => {
|
|
556
|
+
setIsOpenSharedArchive(false);
|
|
557
|
+
await onRefreshSearchAsync?.();
|
|
558
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), sharedDcmtSearchResults.length > 0 &&
|
|
559
|
+
_jsx(TMModal, { title: "Documenti condivisi", onClose: () => {
|
|
560
|
+
setSharedDcmtSearchResults([]);
|
|
561
|
+
}, width: isMobile ? '90%' : '60%', height: isMobile ? '90%' : '80%', children: _jsx(TMSearchResult, { searchResults: sharedDcmtSearchResults, allowFloatingBar: false, showSelector: true, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), (floatingActionConfig && floatingActionConfig.isVisible) && _jsx(TMSearchResultFloatingActionButton, { selectedDcmtsOrFocused: getSelectedDcmtsOrFocused(selectedItems, focusedItem), config: floatingActionConfig })] }), [
|
|
863
562
|
searchResults,
|
|
864
563
|
selectedSearchResult,
|
|
865
564
|
lastUpdateSearchTime,
|
|
@@ -894,8 +593,25 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
894
593
|
showPairDcmtsModal,
|
|
895
594
|
isPairingManyToMany,
|
|
896
595
|
pairedSearchResults,
|
|
596
|
+
selectedManyToManyRelation,
|
|
597
|
+
pairFloatingActionConfig,
|
|
598
|
+
hasManyToManyRelation,
|
|
599
|
+
showPairSearchModal,
|
|
600
|
+
pairSearchModalFloatingActionConfig,
|
|
601
|
+
pairSearchModalTargetTID,
|
|
602
|
+
pairSearchModalParentTID,
|
|
603
|
+
pairSearchModalParentDID,
|
|
604
|
+
pairSearchModalRelation,
|
|
605
|
+
pairSearchModalInputMids,
|
|
606
|
+
isOpenSharedArchive,
|
|
607
|
+
sharedDcmtSearchResults,
|
|
608
|
+
showBackButton,
|
|
609
|
+
isMobile,
|
|
610
|
+
currentMetadataValues,
|
|
611
|
+
sharedDcmtFile,
|
|
612
|
+
onRefreshSearchAsync
|
|
897
613
|
]);
|
|
898
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID }), [focusedItem]);
|
|
614
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { blogsDatasource: blogsDatasource, hasLoadedDataOnce: hasLoadedDataOnce, lastLoadedDid: lastLoadedDid, setBlogsDatasource: setBlogsDatasource, setHasLoadedDataOnce: setHasLoadedDataOnce, setLastLoadedDid: setLastLoadedDid, fetchBlogDataAsync: fetchBlogDataAsync, tid: focusedItem?.TID, did: focusedItem?.DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, allTasks]);
|
|
899
615
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
|
|
900
616
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt }), [currentDcmt]);
|
|
901
617
|
const allInitialPanelVisibility = {
|
|
@@ -920,7 +636,9 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
920
636
|
title: getTitleHeader(),
|
|
921
637
|
showHeader: showToolbarHeader,
|
|
922
638
|
allowMaximize: !isMobile,
|
|
923
|
-
onBack:
|
|
639
|
+
onBack: showBackButton !== undefined
|
|
640
|
+
? (showBackButton ? onBack : undefined)
|
|
641
|
+
: ((!isClosable && context === SearchResultContext.METADATA_SEARCH) || (isMobile && context !== SearchResultContext.METADATA_SEARCH && splitterSize[1] === '100%') ? onBack : undefined),
|
|
924
642
|
onClose: isClosable ? onBack : undefined,
|
|
925
643
|
toolbar: searchResutlToolbar
|
|
926
644
|
},
|
|
@@ -956,11 +674,11 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
956
674
|
}, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: (groupId && groupId.length > 0) ?
|
|
957
675
|
_jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })
|
|
958
676
|
:
|
|
959
|
-
_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
960
|
-
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 }) }, `${index}-${dcmt.DID}`));
|
|
961
|
-
})] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID), titleModal: fromDTD?.name ?? '', TID: focusedItem?.TID, DID: focusedItem?.DID, layoutMode: dcmtFormLayoutMode, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: async (tid, did, metadataResult) => {
|
|
677
|
+
_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar }) }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
678
|
+
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 }) }, `${index}-${dcmt.DID}`));
|
|
679
|
+
})] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID), titleModal: fromDTD?.name ?? '', TID: focusedItem?.TID, DID: focusedItem?.DID, allowButtonsRefs: true, layoutMode: dcmtFormLayoutMode, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: async (tid, did, metadataResult) => {
|
|
962
680
|
await refreshFocusedDataRowAsync(tid, did, true, metadataResult);
|
|
963
|
-
}, onOpenS4TViewerRequest: onOpenS4TViewerRequest }) }), isOpenArchiveRelationForm && _jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, onClose: () => {
|
|
681
|
+
}, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), 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: () => {
|
|
964
682
|
setIsOpenArchiveRelationForm(false);
|
|
965
683
|
setArchiveType(undefined);
|
|
966
684
|
setArchiveRelatedDcmtFormTID(undefined);
|
|
@@ -971,7 +689,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
971
689
|
setArchiveRelatedDcmtFormTID(undefined);
|
|
972
690
|
setArchiveRelatedDcmtFormMids([]);
|
|
973
691
|
await onRefreshSearchAsync?.();
|
|
974
|
-
} })] }));
|
|
692
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
975
693
|
};
|
|
976
694
|
export default TMSearchResult;
|
|
977
695
|
const renderDcmtIcon = (cellData, onDownloadDcmtsAsync, openInOffice) => _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 });
|