@topconsultnpm/sdkui-react 6.20.0-test1 → 6.21.0-dev1.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/NewComponents/ContextMenu/styles.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +7 -1
- package/lib/components/base/Styled.d.ts +4 -1
- package/lib/components/base/Styled.js +11 -3
- package/lib/components/base/TMPanel.js +6 -4
- package/lib/components/base/TMPopUp.js +4 -0
- package/lib/components/base/TMTreeView.d.ts +3 -1
- package/lib/components/base/TMTreeView.js +68 -21
- package/lib/components/base/TMWaitPanel.js +6 -5
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemEditor.js +130 -0
- package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemFields.js +61 -0
- package/lib/components/choosers/TMDataListItemPicker.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemPicker.js +182 -18
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
- package/lib/components/choosers/TMImageIDChooser.js +53 -0
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMDateBox.js +1 -1
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +3 -3
- package/lib/components/editors/TMMetadataValues.js +203 -41
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +6 -6
- package/lib/components/editors/TMTextBox.js +9 -10
- package/lib/components/features/archive/TMArchive.d.ts +3 -1
- package/lib/components/features/archive/TMArchive.js +31 -44
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +44 -34
- package/lib/components/features/documents/TMDcmtForm.js +365 -563
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +34 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +124 -0
- package/lib/components/features/documents/TMDcmtPreview.js +66 -13
- package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMFileUploader.d.ts +5 -0
- package/lib/components/features/documents/TMFileUploader.js +28 -6
- package/lib/components/features/documents/TMMasterDetailDcmts.js +31 -85
- package/lib/components/features/documents/TMRelationViewer.d.ts +7 -1
- package/lib/components/features/documents/TMRelationViewer.js +497 -111
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchQueryPanel.js +6 -6
- package/lib/components/features/search/TMSearchResult.d.ts +28 -25
- package/lib/components/features/search/TMSearchResult.js +445 -562
- package/lib/components/features/search/TMSignatureInfoContent.js +10 -6
- package/lib/components/features/search/TMTreeSelector.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +3 -1
- package/lib/components/features/tasks/TMTaskForm.js +61 -193
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
- package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksUtils.js +46 -16
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
- package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
- package/lib/components/features/tasks/TMTasksView.js +5 -3
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +21 -109
- package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +102 -5
- package/lib/components/features/workflow/diagram/workflowHelpers.js +31 -19
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +61 -13
- package/lib/components/grids/TMBlogsPost.js +8 -8
- package/lib/components/grids/TMBlogsPostUtils.js +2 -2
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/pages/TMPage.js +4 -0
- package/lib/components/query/TMQueryEditor.d.ts +1 -0
- package/lib/components/query/TMQueryEditor.js +3 -3
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/components/viewers/TMTidViewer.js +7 -3
- package/lib/helper/Enum_Localizator.js +5 -0
- package/lib/helper/GlobalStyles.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +12 -0
- package/lib/helper/SDKUI_Globals.js +21 -1
- package/lib/helper/SDKUI_Localizator.d.ts +31 -7
- package/lib/helper/SDKUI_Localizator.js +286 -46
- package/lib/helper/TMIcons.d.ts +2 -1
- package/lib/helper/TMIcons.js +4 -1
- package/lib/helper/TMUtils.d.ts +33 -41
- package/lib/helper/TMUtils.js +157 -170
- package/lib/helper/checkinCheckoutManager.js +6 -2
- package/lib/helper/helpers.d.ts +6 -2
- package/lib/helper/helpers.js +24 -8
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +1 -1
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +7 -6
- package/lib/hooks/useCheckInOutOperations.js +9 -16
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/lib/hooks/useDcmtOperations.d.ts +3 -2
- package/lib/hooks/useDcmtOperations.js +16 -4
- package/lib/hooks/useDocumentOperations.d.ts +139 -0
- package/lib/hooks/useDocumentOperations.js +1275 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -1
- package/lib/hooks/useRelatedDocuments.js +64 -42
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +4 -0
- package/lib/ts/types.d.ts +5 -1
- package/lib/ts/types.js +1 -0
- package/package.json +55 -55
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +0 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -770
- package/lib/components/features/search/TMSignSettingsForm.d.ts +0 -9
- package/lib/components/features/search/TMSignSettingsForm.js +0 -621
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
4
|
+
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { FormModes, SearchResultContext } from '../../../ts';
|
|
7
6
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
8
|
-
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
9
|
-
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
10
7
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
11
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys,
|
|
12
|
-
import { hasDetailRelations, hasMasterRelations
|
|
8
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconActivity, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, buildWorkItemsFromWFCtrl, IconLock, getDcmtFormToolbarVisibility, taskModalSizes } from '../../../helper';
|
|
9
|
+
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
|
13
10
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
14
|
-
import { StyledFormButtonsContainer, StyledLoadingContainer,
|
|
11
|
+
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
15
12
|
import ShowAlert from '../../base/TMAlert';
|
|
16
13
|
import TMButton from '../../base/TMButton';
|
|
17
14
|
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
|
@@ -23,12 +20,8 @@ import TMMetadataValues, { AdvancedMenuButtons } from '../../editors/TMMetadataV
|
|
|
23
20
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext, TMSaveFormButtonSave, TMSaveFormButtonUndo } from '../../forms/TMSaveForm';
|
|
24
21
|
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
|
25
22
|
import TMFileUploader from '../../features/documents/TMFileUploader';
|
|
26
|
-
import TMMasterDetailDcmts from './TMMasterDetailDcmts';
|
|
27
23
|
import TMDcmtBlog from './TMDcmtBlog';
|
|
28
|
-
import { useInputAttachmentsDialog } from '../../../hooks/useInputDialog';
|
|
29
24
|
import TMModal from '../../base/TMModal';
|
|
30
|
-
import TMChooserForm from '../../forms/TMChooserForm';
|
|
31
|
-
import TMSearchResult from '../search/TMSearchResult';
|
|
32
25
|
import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
33
26
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
34
27
|
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
@@ -40,12 +33,12 @@ import TMDcmtTasks from './TMDcmtTasks';
|
|
|
40
33
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
41
34
|
import { getTaskAssignedByMe, getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
42
35
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
43
|
-
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
44
|
-
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
45
|
-
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
46
36
|
import styled from 'styled-components';
|
|
47
37
|
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
48
38
|
import TMToppyDraggableHelpCenter from '../assistant/TMToppyDraggableHelpCenter';
|
|
39
|
+
import TMTaskForm from '../tasks/TMTaskForm';
|
|
40
|
+
import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
41
|
+
import TMDcmtFormActionButtons from './TMDcmtFormActionButtons';
|
|
49
42
|
//#region Interfaces, Types and Enums
|
|
50
43
|
/**
|
|
51
44
|
* Definisce il contesto da cui è stato invocato il TMDcmtForm.
|
|
@@ -64,8 +57,9 @@ export var InvocationContext;
|
|
|
64
57
|
let abortControllerLocal = new AbortController();
|
|
65
58
|
;
|
|
66
59
|
//#endregion
|
|
67
|
-
const TMDcmtForm = ({
|
|
68
|
-
const {
|
|
60
|
+
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, isModal = false, titleModal, widthModal = "100%", heightModal = "100%", allowNavigation = true, canNext, canPrev, count, itemIndex, onNext, onPrev, inputFile = null, inputMids = [], connectorFileSave = undefined, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowRelations = true, allowButtonsRefs = false, openS4TViewer = false, enableDragDropOverlay = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, datagridUtility }) => {
|
|
61
|
+
const { onRefreshSearchAsyncDatagrid, onRefreshBlogDatagrid, onRefreshPreviewDatagrid } = datagridUtility || {};
|
|
62
|
+
const floatingBarContainerRef = useRef(null);
|
|
69
63
|
const [id, setID] = useState('');
|
|
70
64
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
71
65
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -82,10 +76,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
82
76
|
const [formDataOrig, setFormDataOrig] = useState([]);
|
|
83
77
|
const [validationItems, setValidationItems] = useState([]);
|
|
84
78
|
const [fromDTD, setFromDTD] = useState();
|
|
85
|
-
const [
|
|
86
|
-
const [
|
|
87
|
-
const [showReAssignPopup, setShowReAssignPopup] = useState(false);
|
|
88
|
-
const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
|
|
79
|
+
const [showMoreInfoTaskPopup, setShowMoreInfoTaskPopup] = useState(false);
|
|
80
|
+
const [showMoreInfoTaskTask, setShowMoreInfoTaskTask] = useState(undefined);
|
|
89
81
|
const [layout, setLayout] = useState();
|
|
90
82
|
const [customButtonsLayout, setCustomButtonsLayout] = useState();
|
|
91
83
|
const [customButton, setCustomButton] = useState();
|
|
@@ -99,9 +91,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
99
91
|
const formDataRef = useRef([]);
|
|
100
92
|
const fromDTDRef = useRef();
|
|
101
93
|
const dcmtFileRef = useRef(null);
|
|
102
|
-
const [isOpenDetails, setIsOpenDetails] = useState(false);
|
|
103
|
-
const [isOpenMaster, setIsOpenMaster] = useState(false);
|
|
104
|
-
const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
|
|
105
94
|
const [isOpenDistinctValues, setIsOpenDistinctValues] = useState(false);
|
|
106
95
|
const [isOpenFormulaEditor, setIsOpenFormulaEditor] = useState(false);
|
|
107
96
|
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
|
@@ -121,68 +110,24 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
121
110
|
const [dcmtReferences, setDcmtReferences] = useState(undefined);
|
|
122
111
|
// Stato per triggerare il refresh del blog dall'esterno
|
|
123
112
|
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
113
|
+
// Stato per triggerare il refresh del blog dall'esterno
|
|
114
|
+
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
124
115
|
const [wfError, setWfError] = useState(null);
|
|
125
116
|
const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
|
|
126
|
-
|
|
127
|
-
setRefreshBlogTrigger(prev => prev + 1);
|
|
128
|
-
}, []);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const fetchAllUsers = async () => {
|
|
131
|
-
const users = await UserListCacheService.GetAllAsync();
|
|
132
|
-
setAllUsers(users ?? []);
|
|
133
|
-
};
|
|
134
|
-
fetchAllUsers();
|
|
135
|
-
}, []);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (!allowButtonsRefs)
|
|
138
|
-
setDcmtReferences(undefined);
|
|
139
|
-
}, [allowButtonsRefs]);
|
|
140
|
-
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
141
|
-
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
|
|
142
|
-
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
143
|
-
const currentSearchResults = useMemo(() => {
|
|
144
|
-
if (!formData || formData.length === 0 || !TID || !DID)
|
|
145
|
-
return [];
|
|
146
|
-
const selectMIDs = [];
|
|
147
|
-
const rowValues = [];
|
|
148
|
-
formData.forEach(md => {
|
|
149
|
-
if (md.mid !== undefined) {
|
|
150
|
-
selectMIDs.push(md.mid);
|
|
151
|
-
rowValues.push(md.value);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
const searchResult = {
|
|
155
|
-
fromTID: TID,
|
|
156
|
-
selectMIDs: selectMIDs,
|
|
157
|
-
dtdResult: {
|
|
158
|
-
rows: [rowValues],
|
|
159
|
-
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
160
|
-
},
|
|
161
|
-
dcmtsFound: 1,
|
|
162
|
-
dcmtsReturned: 1
|
|
163
|
-
};
|
|
164
|
-
return [searchResult];
|
|
165
|
-
}, [formData, TID, DID]);
|
|
166
|
-
const relatedDocuments = useRelatedDocuments({
|
|
167
|
-
selectedSearchResult: TID ? { fromTID: Number(TID) } : undefined,
|
|
168
|
-
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, rowIndex: 0 } : undefined,
|
|
169
|
-
currentSearchResults: currentSearchResults
|
|
170
|
-
});
|
|
171
|
-
const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showManyToManyChooser, manyToManyChooserDataSource, manyToManyRelations, isPairingManyToMany, showPairDcmtsModal, pairedSearchResults, pairFloatingActionConfig, hasManyToManyRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, archiveMasterDocuments, archiveDetailDocuments, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, archiveRelatedDcmtHandler, executeManyToManyPairing } = relatedDocuments;
|
|
172
|
-
const fetchErrorShownRef = useRef(false);
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (!TID)
|
|
175
|
-
return;
|
|
176
|
-
checkRelatedDcmtsArchiveCapability();
|
|
177
|
-
checkManyToManyCapability();
|
|
178
|
-
}, [TID, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
117
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
179
118
|
const deviceType = useDeviceType();
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
119
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
120
|
+
const isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
121
|
+
const isApprView = useMemo(() => {
|
|
122
|
+
if (!fromDTD)
|
|
123
|
+
return false;
|
|
124
|
+
return isApprovalWorkflowView(fromDTD);
|
|
125
|
+
}, [fromDTD?.id]);
|
|
126
|
+
const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
|
|
127
|
+
const isReadOnlyOriginCallback = useCallback((fromTID) => {
|
|
128
|
+
return layoutMode !== LayoutModes.Ark && layoutMode !== LayoutModes.ArkFromBasket && layoutMode !== LayoutModes.ArkFromFile && layoutMode !== LayoutModes.ArkFromMail
|
|
129
|
+
&& fromTID?.toString() !== TID?.toString();
|
|
130
|
+
}, [layoutMode, TID]);
|
|
186
131
|
const setMetadataList = useCallback(async (mdList, getMetadataResult = undefined, archived = false, currentDID) => {
|
|
187
132
|
try {
|
|
188
133
|
let did = currentDID ?? DID;
|
|
@@ -194,7 +139,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
194
139
|
let dtd = res?.dtdResult;
|
|
195
140
|
let rows = dtd.rows ? dtd.rows[0] : [];
|
|
196
141
|
let mids = res?.selectMIDs;
|
|
197
|
-
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, origin.fromTID
|
|
142
|
+
let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, isReadOnlyOriginCallback(origin.fromTID));
|
|
198
143
|
if (archived) {
|
|
199
144
|
// Usa setFormData con funzione callback per accedere allo stato precedente
|
|
200
145
|
// invece di dipendere da formDataOrig nell'array di dipendenze
|
|
@@ -233,7 +178,64 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
233
178
|
TMSpinner.hide();
|
|
234
179
|
}
|
|
235
180
|
}, [TID, DID, layoutMode]);
|
|
236
|
-
|
|
181
|
+
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
182
|
+
const refreshMetadataAsync = useCallback(async () => {
|
|
183
|
+
let metadataResult = undefined;
|
|
184
|
+
let hasGetMetadataError = false;
|
|
185
|
+
try {
|
|
186
|
+
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
187
|
+
}
|
|
188
|
+
catch (metadataError) {
|
|
189
|
+
hasGetMetadataError = true;
|
|
190
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
191
|
+
let errorCode = undefined;
|
|
192
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
193
|
+
try {
|
|
194
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
195
|
+
errorCode = detailObj?.ErrorCode;
|
|
196
|
+
}
|
|
197
|
+
catch (parseError) {
|
|
198
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
202
|
+
if (errorCode === -5) {
|
|
203
|
+
TMMessageBoxManager.show({
|
|
204
|
+
message: SDKUI_Localizator.DcmtOutOfView,
|
|
205
|
+
buttons: [ButtonNames.OK],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
210
|
+
}
|
|
211
|
+
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
212
|
+
metadataResult = null;
|
|
213
|
+
}
|
|
214
|
+
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
215
|
+
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
216
|
+
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
217
|
+
}
|
|
218
|
+
return { success: !hasGetMetadataError, result: metadataResult };
|
|
219
|
+
}, [TID, DID, setMetadataList]);
|
|
220
|
+
const updateCurrentDcmt = useCallback(async () => {
|
|
221
|
+
try {
|
|
222
|
+
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
223
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
224
|
+
if (!success)
|
|
225
|
+
onClose?.();
|
|
226
|
+
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
TMSpinner.hide();
|
|
233
|
+
}
|
|
234
|
+
}, [refreshMetadataAsync, onClose]);
|
|
235
|
+
const handleReset = useCallback(() => {
|
|
236
|
+
setDcmtFile(null);
|
|
237
|
+
}, []);
|
|
238
|
+
const onRefreshSearchAsync = useCallback(async () => {
|
|
237
239
|
try {
|
|
238
240
|
setFetchError(false);
|
|
239
241
|
if (!TID)
|
|
@@ -282,7 +284,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
282
284
|
}
|
|
283
285
|
else {
|
|
284
286
|
const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
|
|
285
|
-
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, metadataDcmtOrigin?.fromTID
|
|
287
|
+
const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID));
|
|
286
288
|
setFormDataOrig(structuredClone(metadataList));
|
|
287
289
|
setFormData(structuredClone(metadataList));
|
|
288
290
|
formDataOrigRef.current = structuredClone(metadataList);
|
|
@@ -297,7 +299,128 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
297
299
|
setIsInitialLoading(false);
|
|
298
300
|
setIsNavigating(false);
|
|
299
301
|
}
|
|
300
|
-
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, metadataDcmtOrigin?.fromTID]);
|
|
302
|
+
}, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
303
|
+
const currentSearchResults = useMemo(() => {
|
|
304
|
+
if (!formData || formData.length === 0 || !TID || !DID)
|
|
305
|
+
return [];
|
|
306
|
+
const selectMIDs = [];
|
|
307
|
+
const rowValues = [];
|
|
308
|
+
formData.forEach(md => {
|
|
309
|
+
if (md.mid !== undefined) {
|
|
310
|
+
selectMIDs.push(md.mid);
|
|
311
|
+
rowValues.push(md.value);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
const searchResult = {
|
|
315
|
+
fromTID: TID,
|
|
316
|
+
selectMIDs: selectMIDs,
|
|
317
|
+
dtdResult: {
|
|
318
|
+
rows: [rowValues],
|
|
319
|
+
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
320
|
+
},
|
|
321
|
+
dcmtsFound: 1,
|
|
322
|
+
dcmtsReturned: 1
|
|
323
|
+
};
|
|
324
|
+
return [searchResult];
|
|
325
|
+
}, [formData, TID, DID]);
|
|
326
|
+
const triggerBlogRefresh = useCallback(async () => {
|
|
327
|
+
setRefreshBlogTrigger(prev => prev + 1);
|
|
328
|
+
}, []);
|
|
329
|
+
const triggerPreviewRefresh = useCallback(async () => {
|
|
330
|
+
setRefreshPreviewTrigger(prev => prev + 1);
|
|
331
|
+
}, []);
|
|
332
|
+
const openTaskFormHandler = (onTaskCreated) => {
|
|
333
|
+
if (!currentDcmt || !fromDTD)
|
|
334
|
+
return;
|
|
335
|
+
const item = { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt };
|
|
336
|
+
if (item.TID && item.DID) {
|
|
337
|
+
const name = `${fromDTD?.name ?? '-'} (DID: ${item.DID})`;
|
|
338
|
+
onTaskCreateRequest?.({ document: { tid: item.TID, did: item.DID, name } }, onTaskCreated);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const { operationItems, renderFloatingBar, renderDcmtOperations, features } = useDocumentOperations({
|
|
342
|
+
context: SearchResultContext.DCMT_FORM,
|
|
343
|
+
documentData: {
|
|
344
|
+
dtd: fromDTD,
|
|
345
|
+
selectedItems: currentDcmt ? [{ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 }] : [],
|
|
346
|
+
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 } : undefined,
|
|
347
|
+
searchResult: currentSearchResults ? currentSearchResults[0] : undefined,
|
|
348
|
+
currentSearchResults,
|
|
349
|
+
currentMetadataValues: formData,
|
|
350
|
+
allUsers,
|
|
351
|
+
datagridUtility: {
|
|
352
|
+
onRefreshBlogDatagrid,
|
|
353
|
+
onRefreshPreviewDatagrid,
|
|
354
|
+
},
|
|
355
|
+
dcmtUtility: {
|
|
356
|
+
approvalVID: workItems.length > 0 ? Number(workItems[0].tid) : -1,
|
|
357
|
+
dcmtDataRowForCicoStatus: formData,
|
|
358
|
+
selectedDcmtSearchResultRelations: TID ? { fromTID: Number(TID) } : undefined,
|
|
359
|
+
dcmtTIDHasDetailRelations: currentTIDHasDetailRelations,
|
|
360
|
+
dcmtTIDHasMasterRelations: currentTIDHasMasterRelations,
|
|
361
|
+
updateCurrentDcmt: updateCurrentDcmt,
|
|
362
|
+
onCloseDcmtForm: onClose,
|
|
363
|
+
onRefreshBlogForm: triggerBlogRefresh,
|
|
364
|
+
onRefreshPreviewForm: triggerPreviewRefresh,
|
|
365
|
+
taskFormDialogComponent,
|
|
366
|
+
s4TViewerDialogComponent,
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
uiConfig: {
|
|
370
|
+
floatingBarContainerRef,
|
|
371
|
+
customButtonsLayout,
|
|
372
|
+
openS4TViewer,
|
|
373
|
+
showDcmtFormSidebar,
|
|
374
|
+
allowFloatingBar: false,
|
|
375
|
+
enablePinIcons: false,
|
|
376
|
+
allowRelations,
|
|
377
|
+
inputDcmtFormLayoutMode: layoutMode,
|
|
378
|
+
},
|
|
379
|
+
tasks: {
|
|
380
|
+
allTasks: allTasks,
|
|
381
|
+
getAllTasks: getAllTasks,
|
|
382
|
+
deleteTaskByIdsCallback: deleteTaskByIdsCallback,
|
|
383
|
+
addTaskCallback: addTaskCallback,
|
|
384
|
+
editTaskCallback: editTaskCallback
|
|
385
|
+
},
|
|
386
|
+
callbacks: {
|
|
387
|
+
// Refresh operations (data consistency)
|
|
388
|
+
onRefreshSearchAsync,
|
|
389
|
+
onSavedAsyncCallback,
|
|
390
|
+
// Workflow operations
|
|
391
|
+
onWFOperationCompleted,
|
|
392
|
+
// Navigation
|
|
393
|
+
handleNavigateToWGs,
|
|
394
|
+
handleNavigateToDossiers,
|
|
395
|
+
onReferenceClick,
|
|
396
|
+
// Document forms/operations
|
|
397
|
+
onOpenS4TViewerRequest,
|
|
398
|
+
onOpenPdfEditorRequest,
|
|
399
|
+
// Task related
|
|
400
|
+
onTaskCreateRequest,
|
|
401
|
+
openTaskFormHandler,
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
const { handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
const fetchAllUsers = async () => {
|
|
407
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
408
|
+
setAllUsers(users ?? []);
|
|
409
|
+
};
|
|
410
|
+
fetchAllUsers();
|
|
411
|
+
}, []);
|
|
412
|
+
useEffect(() => {
|
|
413
|
+
if (!allowButtonsRefs)
|
|
414
|
+
setDcmtReferences(undefined);
|
|
415
|
+
}, [allowButtonsRefs]);
|
|
416
|
+
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
417
|
+
const fetchErrorShownRef = useRef(false);
|
|
418
|
+
useEffect(() => {
|
|
419
|
+
if (!TID)
|
|
420
|
+
return;
|
|
421
|
+
checkRelatedDcmtsArchiveCapability();
|
|
422
|
+
checkManyToManyCapability();
|
|
423
|
+
}, [TID, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
301
424
|
const createChange = useCallback((mid, metadataType, modifiedValue) => {
|
|
302
425
|
return { mid, metadataType, modifiedValue };
|
|
303
426
|
}, []);
|
|
@@ -344,12 +467,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
344
467
|
// Distinguish between initial load and navigation
|
|
345
468
|
if (isInitialLoading) {
|
|
346
469
|
// First load - keep isInitialLoading true
|
|
347
|
-
await
|
|
470
|
+
await onRefreshSearchAsync();
|
|
348
471
|
}
|
|
349
472
|
else {
|
|
350
473
|
// Navigation - use isNavigating instead
|
|
351
474
|
setIsNavigating(true);
|
|
352
|
-
await
|
|
475
|
+
await onRefreshSearchAsync();
|
|
353
476
|
}
|
|
354
477
|
}
|
|
355
478
|
catch (e) {
|
|
@@ -363,7 +486,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
363
486
|
}
|
|
364
487
|
};
|
|
365
488
|
run();
|
|
366
|
-
}, [TID, DID,
|
|
489
|
+
}, [TID, DID, onRefreshSearchAsync]);
|
|
367
490
|
useEffect(() => {
|
|
368
491
|
if (formData.length > 0) {
|
|
369
492
|
setValidationItems(validateMetadataList(formData));
|
|
@@ -444,21 +567,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
444
567
|
const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
|
|
445
568
|
// Valore derivato: true se formData ha elementi validi
|
|
446
569
|
const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
|
|
447
|
-
const handleCheckOutOperationCallback = async (checkout) => {
|
|
448
|
-
if (!currentDcmt)
|
|
449
|
-
return;
|
|
450
|
-
await handleCheckOutCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, updateCurrentDcmt);
|
|
451
|
-
};
|
|
452
|
-
const handleCheckInOperationCallback = async () => {
|
|
453
|
-
if (!currentDcmt)
|
|
454
|
-
return;
|
|
455
|
-
await handleCheckInCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, fileName: fromDTD?.name ?? SDKUI_Localizator.SearchResult }, updateCurrentDcmt, undefined);
|
|
456
|
-
};
|
|
457
|
-
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
458
|
-
if (!currentDcmt)
|
|
459
|
-
return;
|
|
460
|
-
copyCheckoutPathToClipboardCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
|
|
461
|
-
};
|
|
462
570
|
// useEffect per il caricamento dei dati del workflow
|
|
463
571
|
useEffect(() => {
|
|
464
572
|
// Funzione helper per caricare le informazioni del workflow
|
|
@@ -611,39 +719,29 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
611
719
|
};
|
|
612
720
|
buildWorkItemsForDiagram();
|
|
613
721
|
}, [workflows, workItems]);
|
|
614
|
-
const getSelectionDcmtInfo = useCallback(() => {
|
|
615
|
-
let dcmts = [];
|
|
616
|
-
dcmts.push({ TID: TID ?? 0, DID: DID ?? 0 });
|
|
617
|
-
return dcmts;
|
|
618
|
-
}, [TID, DID]);
|
|
619
|
-
const handleAddItem = useCallback((tid, did) => {
|
|
620
|
-
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
621
|
-
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
622
|
-
}, []);
|
|
623
|
-
const handleRemoveItem = useCallback((tid, did) => {
|
|
624
|
-
setSecondaryMasterDcmts((prevItems) => prevItems.filter(item => item.TID !== tid && item.DID !== did));
|
|
625
|
-
}, []);
|
|
626
722
|
const handlePassToSearch = useCallback(() => {
|
|
627
723
|
if (!passToSearch)
|
|
628
724
|
return;
|
|
725
|
+
if (fromDTD?.perm?.canSearch !== AccessLevelsEx.Yes && fromDTD?.perm?.canSearch !== AccessLevelsEx.Mixed) {
|
|
726
|
+
ShowAlert({ title: SDKUI_Localizator.PassToSearch, message: 'Non hai i permessi per effettuare la ricerca.', mode: 'warning', duration: 3000 });
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
629
729
|
const outputMids = formData
|
|
630
730
|
.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
|
|
631
731
|
.map(md => ({ mid: md.mid, value: md.value }));
|
|
632
732
|
passToSearch(outputMids, TID);
|
|
633
|
-
}, [passToSearch, formData, TID]);
|
|
733
|
+
}, [passToSearch, formData, TID, fromDTD?.perm?.canSearch]);
|
|
634
734
|
const isPreviewDisabled = useMemo(() => layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata, [layoutMode, fromDTD?.archiveConstraint]);
|
|
635
735
|
const isBoardDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fromDTD?.hasBlog !== 1, [layoutMode, fromDTD?.hasBlog]);
|
|
636
736
|
const isSysMetadataDisabled = useMemo(() => layoutMode !== LayoutModes.Update, [layoutMode]);
|
|
637
|
-
const
|
|
638
|
-
const isMasterDisabled = useMemo(() => layoutMode !== LayoutModes.Update || !DID, [layoutMode, DID]);
|
|
737
|
+
const isDcmtTasksDisabled = useMemo(() => layoutMode !== LayoutModes.Update, [layoutMode]);
|
|
639
738
|
const isWFDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fetchError || (workItems.length <= 0 && workItemsForDiagram.length <= 0), [layoutMode, fetchError, workItems.length, workItemsForDiagram.length]);
|
|
640
739
|
const showToppyForApprove = useMemo(() => layoutMode === LayoutModes.Update && !fetchError && workItems.length > 0 && !isOpenDetails && !isOpenMaster, [layoutMode, fetchError, workItems.length, isOpenDetails, isOpenMaster]);
|
|
641
740
|
const showToppyForCompleteMoreInfo = useMemo(() => {
|
|
642
741
|
if (layoutMode !== LayoutModes.Update || !moreInfoTasks) {
|
|
643
742
|
return false;
|
|
644
743
|
}
|
|
645
|
-
return moreInfoTasks.some(task => isTaskMoreInfo(task.name) &&
|
|
646
|
-
task.state !== Task_States.Completed);
|
|
744
|
+
return moreInfoTasks.some(task => isTaskMoreInfo(task.name) && task.state !== Task_States.Completed && task.state !== Task_States.Closed);
|
|
647
745
|
}, [layoutMode, moreInfoTasks]);
|
|
648
746
|
const showToppyForReferences = useMemo(() => {
|
|
649
747
|
if (!allowButtonsRefs || layoutMode !== LayoutModes.Update || isOpenDetails || isOpenMaster)
|
|
@@ -654,314 +752,13 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
654
752
|
return dcmtReferences.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
655
753
|
}, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
|
|
656
754
|
const isToppyVisible = useMemo(() => Boolean((showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer), [showToppyForApprove, showToppyForCompleteMoreInfo, showToppyForReferences, openS4TViewer]);
|
|
657
|
-
const isMobile = useMemo(() => deviceType === DeviceType.MOBILE, [deviceType]);
|
|
658
|
-
const isApprView = useMemo(() => {
|
|
659
|
-
if (!fromDTD)
|
|
660
|
-
return false;
|
|
661
|
-
return isApprovalWorkflowView(fromDTD);
|
|
662
|
-
}, [fromDTD?.id]);
|
|
663
|
-
const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
|
|
664
|
-
const approvalVID = useMemo(() => workItems.length > 0 ? Number(workItems[0].tid) : -1, [workItems]);
|
|
665
|
-
//here
|
|
666
|
-
const commandsMenuItems = useMemo(() => {
|
|
667
|
-
const items = [];
|
|
668
|
-
const operationsItems = [];
|
|
669
|
-
operationsItems.push({
|
|
670
|
-
icon: _jsx(IconDownload, {}),
|
|
671
|
-
disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
|
|
672
|
-
name: SDKUI_Localizator.DownloadFile,
|
|
673
|
-
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download", undefined, undefined, true)
|
|
674
|
-
}, {
|
|
675
|
-
icon: _jsx(IconDownload, {}),
|
|
676
|
-
disabled: !isXMLFileExt(currentDcmt?.fileExt),
|
|
677
|
-
name: SDKUI_Localizator.DownloadXMLAttachments,
|
|
678
|
-
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
|
|
679
|
-
});
|
|
680
|
-
if (layoutMode === LayoutModes.Update && DID) {
|
|
681
|
-
operationsItems.push({
|
|
682
|
-
icon: _jsx(IconStar, {}),
|
|
683
|
-
name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
|
|
684
|
-
disabled: false,
|
|
685
|
-
onClick: async () => {
|
|
686
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
|
|
687
|
-
},
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
|
|
691
|
-
operationsItems.push({
|
|
692
|
-
icon: _jsx(IconActivity, {}),
|
|
693
|
-
name: SDKUI_Localizator.CreateContextualTask,
|
|
694
|
-
disabled: false,
|
|
695
|
-
onClick: () => {
|
|
696
|
-
const dcmt = getDcmts()[0];
|
|
697
|
-
const name = `${fromDTD?.name ?? '-'} (DID: ${dcmt.DID})`;
|
|
698
|
-
const taskContext = {
|
|
699
|
-
document: {
|
|
700
|
-
tid: dcmt.TID,
|
|
701
|
-
did: dcmt.DID,
|
|
702
|
-
name: name
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
onTaskCreateRequest(taskContext);
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
if (operationsItems.length > 0) {
|
|
710
|
-
items.push({
|
|
711
|
-
icon: _jsx(IconCheck, {}),
|
|
712
|
-
name: SDKUI_Localizator.DocumentOperations,
|
|
713
|
-
submenu: operationsItems
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
if (fromDTD?.id !== SystemTIDs.Drafts) {
|
|
717
|
-
// Check in/Check out menu
|
|
718
|
-
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
719
|
-
items.push({
|
|
720
|
-
icon: _jsx(IconFileDots, {}),
|
|
721
|
-
name: "Check in/Check out",
|
|
722
|
-
disabled: false,
|
|
723
|
-
submenu: [
|
|
724
|
-
{
|
|
725
|
-
name: 'Check out',
|
|
726
|
-
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
727
|
-
onClick: () => handleCheckOutOperationCallback(true),
|
|
728
|
-
},
|
|
729
|
-
{
|
|
730
|
-
name: 'Check in',
|
|
731
|
-
onClick: () => handleCheckInOperationCallback(),
|
|
732
|
-
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
name: SDKUI_Localizator.CancelCheckOut,
|
|
736
|
-
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
737
|
-
onClick: () => handleCheckOutOperationCallback(false),
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
name: SDKUI_Localizator.CheckoutInfo,
|
|
741
|
-
onClick: showCheckoutInformationFormCallback,
|
|
742
|
-
disabled: !checkoutStatus.isCheckedOut
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
name: SDKUI_Localizator.CopyCheckoutPath,
|
|
746
|
-
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
747
|
-
disabled: !checkoutStatus.isCheckedOut
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
name: SDKUI_Localizator.History,
|
|
751
|
-
disabled: !cicoEnabled,
|
|
752
|
-
onClick: showHistoryCallback,
|
|
753
|
-
},
|
|
754
|
-
]
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
758
|
-
const relationsItems = [
|
|
759
|
-
{
|
|
760
|
-
icon: _jsx(IconPair, {}),
|
|
761
|
-
name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
762
|
-
disabled: !hasManyToManyRelation,
|
|
763
|
-
onClick: async () => await pairManyToMany?.(true)
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
icon: _jsx(IconUnpair, {}),
|
|
767
|
-
name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
768
|
-
disabled: !hasManyToManyRelation,
|
|
769
|
-
onClick: async () => await pairManyToMany?.(false)
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
icon: _jsx(IconArchiveMaster, {}),
|
|
773
|
-
name: SDKUI_Localizator.ArchiveMasterDocument,
|
|
774
|
-
disabled: canArchiveMasterRelation !== true,
|
|
775
|
-
onClick: async () => { if (TID)
|
|
776
|
-
await archiveMasterDocuments?.(TID); }
|
|
777
|
-
},
|
|
778
|
-
{
|
|
779
|
-
icon: _jsx(IconArchiveDetail, {}),
|
|
780
|
-
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
781
|
-
disabled: canArchiveDetailRelation !== true,
|
|
782
|
-
onClick: async () => { if (TID)
|
|
783
|
-
await archiveDetailDocuments?.(TID); }
|
|
784
|
-
},
|
|
785
|
-
{
|
|
786
|
-
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
|
|
787
|
-
name: SDKUI_Localizator.DcmtsMaster,
|
|
788
|
-
disabled: !currentTIDHasMasterRelations || isMasterDisabled,
|
|
789
|
-
onClick: () => { if (!isMasterDisabled)
|
|
790
|
-
setIsOpenMaster(!isOpenMaster); }
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
icon: _jsx(IconDetailDcmts, {}),
|
|
794
|
-
name: SDKUI_Localizator.DcmtsDetail,
|
|
795
|
-
disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
|
|
796
|
-
onClick: () => { if (!isDetailsDisabled)
|
|
797
|
-
setIsOpenDetails(!isOpenDetails); }
|
|
798
|
-
}
|
|
799
|
-
];
|
|
800
|
-
items.push({
|
|
801
|
-
icon: _jsx(IconRelation, {}),
|
|
802
|
-
name: SDKUI_Localizator.Relations,
|
|
803
|
-
submenu: relationsItems
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
if (layoutMode === LayoutModes.Update && DID) {
|
|
807
|
-
const fullTextItems = [
|
|
808
|
-
{
|
|
809
|
-
icon: _jsx(IconInfo, {}),
|
|
810
|
-
name: SDKUI_Localizator.IndexingInformation,
|
|
811
|
-
disabled: false,
|
|
812
|
-
onClick: async () => {
|
|
813
|
-
try {
|
|
814
|
-
TMSpinner.show({ description: `${SDKUI_Localizator.Loading}...` });
|
|
815
|
-
const dcmts = getDcmts();
|
|
816
|
-
const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(dcmts[0].TID, dcmts[0].DID);
|
|
817
|
-
TMMessageBoxManager.show({ buttons: [ButtonNames.OK], message: msg, title: SDKUI_Localizator.IndexingInformation });
|
|
818
|
-
}
|
|
819
|
-
catch (e) {
|
|
820
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
821
|
-
}
|
|
822
|
-
finally {
|
|
823
|
-
TMSpinner.hide();
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
icon: _jsx(IconArchiveDoc, {}),
|
|
829
|
-
name: SDKUI_Localizator.IndexOrReindex,
|
|
830
|
-
disabled: false,
|
|
831
|
-
onClick: async () => {
|
|
832
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
|
|
833
|
-
}
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
icon: _jsx(IconDelete, {}),
|
|
837
|
-
name: SDKUI_Localizator.IndexingDelete,
|
|
838
|
-
disabled: false,
|
|
839
|
-
onClick: async () => {
|
|
840
|
-
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
];
|
|
844
|
-
items.push({
|
|
845
|
-
icon: _jsx(IconSearch, {}),
|
|
846
|
-
name: SDKUI_Localizator.FullTextSearch,
|
|
847
|
-
submenu: fullTextItems
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
// Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
|
|
851
|
-
if (customButtonsLayout?.customButtons && Array.isArray(customButtonsLayout.customButtons) && customButtonsLayout.customButtons.length > 0) {
|
|
852
|
-
const customButtonsItems = customButtonsLayout.customButtons
|
|
853
|
-
.filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
|
|
854
|
-
.map((customButton) => ({
|
|
855
|
-
icon: TMImageLibrary({ imageID: customButton.glyphID }),
|
|
856
|
-
name: customButton.title || 'Bottone personalizzato',
|
|
857
|
-
onClick: () => setCustomButton(customButton)
|
|
858
|
-
}));
|
|
859
|
-
customButtonsItems && customButtonsItems.length > 0 && items.push({
|
|
860
|
-
icon: _jsx(IconCustom, {}),
|
|
861
|
-
name: SDKUI_Localizator.CustomButtons,
|
|
862
|
-
submenu: customButtonsItems
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
return items;
|
|
866
|
-
}, [
|
|
867
|
-
fromDTD?.id,
|
|
868
|
-
fromDTD?.perm?.canRetrieveFile,
|
|
869
|
-
fromDTD?.description,
|
|
870
|
-
currentDcmt?.fileExt,
|
|
871
|
-
allowRelations,
|
|
872
|
-
currentTIDHasMasterRelations,
|
|
873
|
-
isMasterDisabled,
|
|
874
|
-
currentTIDHasDetailRelations,
|
|
875
|
-
isDetailsDisabled,
|
|
876
|
-
customButtonsLayout,
|
|
877
|
-
layoutMode,
|
|
878
|
-
TID,
|
|
879
|
-
DID,
|
|
880
|
-
onTaskCreateRequest,
|
|
881
|
-
hasManyToManyRelation,
|
|
882
|
-
canArchiveMasterRelation,
|
|
883
|
-
canArchiveDetailRelation,
|
|
884
|
-
pairManyToMany,
|
|
885
|
-
archiveMasterDocuments,
|
|
886
|
-
archiveDetailDocuments,
|
|
887
|
-
getDcmts,
|
|
888
|
-
downloadDcmtsAsync,
|
|
889
|
-
runOperationAsync,
|
|
890
|
-
openConfirmAttachmentsDialog
|
|
891
|
-
]);
|
|
892
755
|
const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
|
|
893
756
|
const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update &&
|
|
894
|
-
_jsx(ContextMenu, { items:
|
|
895
|
-
_jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode,
|
|
757
|
+
_jsx(ContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
758
|
+
_jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode, operationItems, handlePassToSearch]);
|
|
896
759
|
const handleUndo = useCallback(() => {
|
|
897
760
|
setFormData(structuredClone(formDataOrig));
|
|
898
761
|
}, [formDataOrig]);
|
|
899
|
-
const handleConfirmAction = useCallback(async () => {
|
|
900
|
-
TMMessageBoxManager.show({
|
|
901
|
-
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
902
|
-
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
903
|
-
message: layoutMode === LayoutModes.Update ? SDKUI_Localizator.SaveQuestion : 'Sei sicuro di voler archiviare questo documento?',
|
|
904
|
-
onButtonClick(e) {
|
|
905
|
-
if (e !== ButtonNames.YES)
|
|
906
|
-
return;
|
|
907
|
-
layoutMode === LayoutModes.Update ? handleSave() : handleArchiveCompleted();
|
|
908
|
-
},
|
|
909
|
-
});
|
|
910
|
-
}, [isModal, id, layoutMode]);
|
|
911
|
-
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
912
|
-
const refreshMetadataAsync = useCallback(async () => {
|
|
913
|
-
let metadataResult = undefined;
|
|
914
|
-
let hasGetMetadataError = false;
|
|
915
|
-
try {
|
|
916
|
-
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
917
|
-
}
|
|
918
|
-
catch (metadataError) {
|
|
919
|
-
hasGetMetadataError = true;
|
|
920
|
-
// Estrai ErrorCode dal campo detail se disponibile
|
|
921
|
-
let errorCode = undefined;
|
|
922
|
-
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
923
|
-
try {
|
|
924
|
-
const detailObj = JSON.parse(metadataError.response.detail);
|
|
925
|
-
errorCode = detailObj?.ErrorCode;
|
|
926
|
-
}
|
|
927
|
-
catch (parseError) {
|
|
928
|
-
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
932
|
-
if (errorCode === -5) {
|
|
933
|
-
TMMessageBoxManager.show({
|
|
934
|
-
message: SDKUI_Localizator.DcmtOutOfView,
|
|
935
|
-
buttons: [ButtonNames.OK],
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
else {
|
|
939
|
-
TMExceptionBoxManager.show({ exception: metadataError });
|
|
940
|
-
}
|
|
941
|
-
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
942
|
-
metadataResult = null;
|
|
943
|
-
}
|
|
944
|
-
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
945
|
-
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
946
|
-
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
947
|
-
}
|
|
948
|
-
return { success: !hasGetMetadataError, result: metadataResult };
|
|
949
|
-
}, [TID, DID, setMetadataList]);
|
|
950
|
-
const updateCurrentDcmt = useCallback(async () => {
|
|
951
|
-
try {
|
|
952
|
-
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
953
|
-
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
954
|
-
if (!success)
|
|
955
|
-
onClose?.();
|
|
956
|
-
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
957
|
-
}
|
|
958
|
-
catch (e) {
|
|
959
|
-
TMExceptionBoxManager.show({ exception: e });
|
|
960
|
-
}
|
|
961
|
-
finally {
|
|
962
|
-
TMSpinner.hide();
|
|
963
|
-
}
|
|
964
|
-
}, [refreshMetadataAsync, onClose]);
|
|
965
762
|
const handleSave = useCallback(async () => {
|
|
966
763
|
const ue = new UpdateEngineByID(SDK_Globals.tmSession);
|
|
967
764
|
ue.DID = DID;
|
|
@@ -1085,6 +882,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1085
882
|
const savedFormData = structuredClone(formDataRef.current);
|
|
1086
883
|
setFormDataOrig(savedFormData);
|
|
1087
884
|
formDataOrigRef.current = savedFormData;
|
|
885
|
+
await onRefreshSearchAsyncDatagrid?.();
|
|
1088
886
|
await onSavedAsyncCallback?.(ae.TID, newDID);
|
|
1089
887
|
// Usa fromDTDRef.current invece di fromDTD per evitare stale closure,
|
|
1090
888
|
// garantendo di avere il descrittore del tipo documento corrente.
|
|
@@ -1112,6 +910,18 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1112
910
|
setUseWaitPanelLocalState(false);
|
|
1113
911
|
}
|
|
1114
912
|
}, [TID, connectorFileSave, onSavedAsyncCallback, onSaveRecents, onClose, DID, setMetadataList, handleReset, layoutMode, isSharedDcmt]);
|
|
913
|
+
const handleConfirmAction = useCallback(async () => {
|
|
914
|
+
TMMessageBoxManager.show({
|
|
915
|
+
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
916
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
917
|
+
message: layoutMode === LayoutModes.Update ? SDKUI_Localizator.SaveQuestion : 'Sei sicuro di voler archiviare questo documento?',
|
|
918
|
+
onButtonClick(e) {
|
|
919
|
+
if (e !== ButtonNames.YES)
|
|
920
|
+
return;
|
|
921
|
+
layoutMode === LayoutModes.Update ? handleSave() : handleArchiveCompleted();
|
|
922
|
+
},
|
|
923
|
+
});
|
|
924
|
+
}, [isModal, id, layoutMode, handleSave, handleArchiveCompleted]);
|
|
1115
925
|
const handleClearForm = useCallback(() => {
|
|
1116
926
|
let data = structuredClone(formData);
|
|
1117
927
|
if (!data || data.length === 0)
|
|
@@ -1182,10 +992,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1182
992
|
fd.tid = TID;
|
|
1183
993
|
return fd;
|
|
1184
994
|
}, [focusedMetadataValue?.value, focusedMetadataValue?.mid, TID]);
|
|
1185
|
-
const handleWFOperationCompleted = useCallback(async () => {
|
|
1186
|
-
await onWFOperationCompleted?.();
|
|
1187
|
-
onClose?.();
|
|
1188
|
-
}, [onWFOperationCompleted, onClose]);
|
|
1189
995
|
// Determina se showAll deve essere automaticamente true
|
|
1190
996
|
// Best practice: usa useMemo per calcolare valori derivati invece di useEffect con setState
|
|
1191
997
|
const shouldShowAll = useMemo(() => {
|
|
@@ -1203,11 +1009,14 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1203
1009
|
}
|
|
1204
1010
|
}, [shouldShowAll, showAll]);
|
|
1205
1011
|
const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
|
|
1206
|
-
const shouldRefresh = forceRefresh || (task && task.state === Task_States.Completed) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
1012
|
+
const shouldRefresh = forceRefresh || (task && (task.state === Task_States.Completed || task.state === Task_States.Closed)) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
1207
1013
|
if (TID && DID && shouldRefresh) {
|
|
1014
|
+
// local refresh blog
|
|
1208
1015
|
await triggerBlogRefresh();
|
|
1016
|
+
// refresh blog datagrid
|
|
1017
|
+
await onRefreshBlogDatagrid?.();
|
|
1209
1018
|
}
|
|
1210
|
-
}, [TID, DID, triggerBlogRefresh]);
|
|
1019
|
+
}, [TID, DID, triggerBlogRefresh, onRefreshBlogDatagrid]);
|
|
1211
1020
|
const checkoutBadge = useMemo(() => {
|
|
1212
1021
|
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
1213
1022
|
if (!cicoEnabled || !checkoutStatus.isCheckedOut)
|
|
@@ -1216,7 +1025,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1216
1025
|
}, [formData, fromDTD, isMobile]);
|
|
1217
1026
|
const tmDcmtForm = useMemo(() => {
|
|
1218
1027
|
return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
|
|
1219
|
-
_jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, isReadOnlyOrigin: metadataDcmtOrigin?.fromTID
|
|
1028
|
+
_jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, isReadOnlyOrigin: isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID), onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
1220
1029
|
setFormData((prevItems) => prevItems.map((item) => {
|
|
1221
1030
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
1222
1031
|
return newItem ? { ...item, ...newItem } : item;
|
|
@@ -1235,7 +1044,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1235
1044
|
!isApprView &&
|
|
1236
1045
|
TID !== SystemTIDs.Drafts &&
|
|
1237
1046
|
!shouldShowAll &&
|
|
1238
|
-
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] })
|
|
1047
|
+
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] })] })] });
|
|
1239
1048
|
}, [
|
|
1240
1049
|
TID,
|
|
1241
1050
|
DID,
|
|
@@ -1262,13 +1071,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1262
1071
|
handleConfirmAction,
|
|
1263
1072
|
handleUndo,
|
|
1264
1073
|
handleClearForm,
|
|
1265
|
-
|
|
1074
|
+
isReadOnlyOriginCallback,
|
|
1075
|
+
metadataDcmtOrigin?.fromTID,
|
|
1266
1076
|
]);
|
|
1267
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID,
|
|
1077
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, fetchBlogDataTrigger: refreshBlogTrigger, onRefreshBlogDatagrid: onRefreshBlogDatagrid, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
|
|
1268
1078
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
1269
|
-
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType,
|
|
1270
|
-
setDcmtFile(file);
|
|
1271
|
-
}, enableDragDropOverlay: enableDragDropOverlay }, refreshPreviewTrigger), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
|
|
1079
|
+
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { refreshPreviewTrigger: refreshPreviewTrigger, fromDTD: fromDTD, currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, layoutMode: layoutMode, onFileUpload: (file) => { setDcmtFile(file); }, openFileUploaderPdfEditor: openFileUploaderPdfEditor, enableDragDropOverlay: enableDragDropOverlay, onScanRequest: onScanRequest }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile, onScanRequest, openFileUploaderPdfEditor, refreshPreviewTrigger]);
|
|
1272
1080
|
const tmWF = useMemo(() => {
|
|
1273
1081
|
if (isWFDataLoading) {
|
|
1274
1082
|
return (_jsx("div", { style: {
|
|
@@ -1339,7 +1147,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1339
1147
|
did: Number(DID),
|
|
1340
1148
|
name: fromDTD?.nameLoc ?? SDKUI_Localizator.Widget_Activities,
|
|
1341
1149
|
},
|
|
1342
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, afterTaskSaved: afterTaskSaved }));
|
|
1150
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, afterTaskSaved: afterTaskSaved, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }));
|
|
1343
1151
|
}, [allTasks, TID, DID, fromDTD]);
|
|
1344
1152
|
const normalizedTID = TID !== undefined ? Number(TID) : undefined;
|
|
1345
1153
|
const defaultPanelDimensions = {
|
|
@@ -1366,8 +1174,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1366
1174
|
};
|
|
1367
1175
|
}
|
|
1368
1176
|
try {
|
|
1369
|
-
const assignedToMe = getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
|
|
1370
|
-
const assignedByMe = getTaskAssignedByMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
|
|
1177
|
+
const assignedToMe = getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed && task.state !== Task_States.Closed).length ?? 0;
|
|
1178
|
+
const assignedByMe = getTaskAssignedByMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed && task.state !== Task_States.Closed).length ?? 0;
|
|
1371
1179
|
return {
|
|
1372
1180
|
assignedToMe,
|
|
1373
1181
|
assignedByMe
|
|
@@ -1384,7 +1192,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1384
1192
|
const { assignedToMe, assignedByMe } = getDcmtTasksCounter(TID, DID, allTasks);
|
|
1385
1193
|
let titleDcmtFormPanel = fromDTD?.nameLoc ?? "";
|
|
1386
1194
|
// Caso: Il documento proviene da un'origine esterna
|
|
1387
|
-
if (metadataDcmtOrigin?.fromTID
|
|
1195
|
+
if (isReadOnlyOriginCallback(metadataDcmtOrigin?.fromTID)) {
|
|
1388
1196
|
titleDcmtFormPanel = (_jsxs("div", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' }, children: [_jsx(TMTooltip, { content: _jsxs("div", { style: { textAlign: 'left' }, children: [_jsx("p", { children: "Questo documento proviene da un'altra origine e non pu\u00F2 essere modificato." }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID corrente:" }), " ", TID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome corrente:" }), " ", fromDTD?.nameLoc] }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID origine:" }), " ", metadataDcmtOrigin?.fromTID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome origine:" }), " ", metadataDcmtOrigin?.fromName] })] }), children: _jsx(IconLock, { fontSize: 16, style: { alignSelf: 'center' } }) }), metadataDcmtOrigin?.fromName] }));
|
|
1389
1197
|
}
|
|
1390
1198
|
const panels = [
|
|
@@ -1405,7 +1213,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1405
1213
|
},
|
|
1406
1214
|
toolbarOptions: {
|
|
1407
1215
|
icon: _jsx(IconPreview, { fontSize: 24 }),
|
|
1408
|
-
visible:
|
|
1216
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtForm,
|
|
1409
1217
|
orderNumber: 1,
|
|
1410
1218
|
isActive: allInitialPanelVisibility['tmDcmtForm']
|
|
1411
1219
|
}
|
|
@@ -1416,7 +1224,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1416
1224
|
contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
|
|
1417
1225
|
toolbarOptions: {
|
|
1418
1226
|
icon: _jsx(IconBoard, { fontSize: 24 }),
|
|
1419
|
-
visible:
|
|
1227
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmBlog,
|
|
1420
1228
|
disabled: isBoardDisabled,
|
|
1421
1229
|
orderNumber: 2,
|
|
1422
1230
|
isActive: allInitialPanelVisibility['tmBlog']
|
|
@@ -1426,13 +1234,19 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1426
1234
|
id: 'tmSysMetadata',
|
|
1427
1235
|
name: SDKUI_Localizator.MetadataSystem,
|
|
1428
1236
|
contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
|
|
1429
|
-
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible:
|
|
1237
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmSysMetadata, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
|
1430
1238
|
},
|
|
1431
1239
|
{
|
|
1432
1240
|
id: 'tmDcmtPreview',
|
|
1433
1241
|
name: SDKUI_Localizator.PreviewDocument,
|
|
1434
1242
|
contentOptions: { component: tmDcmtPreview },
|
|
1435
|
-
toolbarOptions: {
|
|
1243
|
+
toolbarOptions: {
|
|
1244
|
+
icon: _jsx(IconShow, { fontSize: 24 }),
|
|
1245
|
+
disabled: isPreviewDisabled,
|
|
1246
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtPreview,
|
|
1247
|
+
orderNumber: 4,
|
|
1248
|
+
isActive: allInitialPanelVisibility['tmDcmtPreview']
|
|
1249
|
+
}
|
|
1436
1250
|
},
|
|
1437
1251
|
{
|
|
1438
1252
|
id: 'tmWF',
|
|
@@ -1445,7 +1259,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1445
1259
|
},
|
|
1446
1260
|
toolbarOptions: {
|
|
1447
1261
|
icon: _jsx(IconWorkflow, { fontSize: 24 }),
|
|
1448
|
-
visible:
|
|
1262
|
+
visible: getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmWF,
|
|
1449
1263
|
disabled: isWFDisabled,
|
|
1450
1264
|
orderNumber: 5,
|
|
1451
1265
|
isActive: allInitialPanelVisibility['tmWF']
|
|
@@ -1459,7 +1273,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1459
1273
|
},
|
|
1460
1274
|
toolbarOptions: {
|
|
1461
1275
|
icon: _jsx(IconActivity, { fontSize: 24 }),
|
|
1462
|
-
visible: layoutMode !== LayoutModes.Ark,
|
|
1276
|
+
visible: layoutMode !== LayoutModes.Ark && getDcmtFormToolbarVisibility(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER).tmDcmtTasks,
|
|
1463
1277
|
orderNumber: 6,
|
|
1464
1278
|
isActive: allInitialPanelVisibility['tmDcmtTasks'],
|
|
1465
1279
|
count: assignedToMe + assignedByMe,
|
|
@@ -1468,7 +1282,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1468
1282
|
},
|
|
1469
1283
|
];
|
|
1470
1284
|
return panels;
|
|
1471
|
-
}, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, metadataDcmtOrigin?.fromTID]);
|
|
1285
|
+
}, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, isReadOnlyOriginCallback, metadataDcmtOrigin?.fromTID]);
|
|
1472
1286
|
// Retrieves the current document form setting based on the normalized TID
|
|
1473
1287
|
const getCurrentDcmtFormSetting = () => {
|
|
1474
1288
|
const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
|
|
@@ -1521,35 +1335,49 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1521
1335
|
// Return the appropriate layout based on context
|
|
1522
1336
|
return invocationContext === InvocationContext.Todo ? settings?.layoutToDo : settings?.layout;
|
|
1523
1337
|
};
|
|
1524
|
-
const
|
|
1338
|
+
const onBlogCommentFormCustomSave = useCallback(async (blogPost) => {
|
|
1525
1339
|
try {
|
|
1340
|
+
if (!moreInfoTasks || moreInfoTasks.length === 0) {
|
|
1341
|
+
ShowAlert({
|
|
1342
|
+
mode: 'info',
|
|
1343
|
+
title: SDKUI_Localizator.MoreInformation,
|
|
1344
|
+
message: 'Nessun attività di maggiori informazioni da completare',
|
|
1345
|
+
duration: 3000
|
|
1346
|
+
});
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
;
|
|
1350
|
+
const firstTask = moreInfoTasks[0];
|
|
1526
1351
|
TMSpinner.show();
|
|
1527
|
-
|
|
1352
|
+
const newTask = {
|
|
1353
|
+
...firstTask,
|
|
1354
|
+
state: Task_States.Completed,
|
|
1355
|
+
response: blogPost.description,
|
|
1356
|
+
};
|
|
1528
1357
|
await SDK_Globals.tmSession?.NewTaskEngine().UpdateAsync(newTask);
|
|
1529
1358
|
onTaskCompleted?.(newTask);
|
|
1530
1359
|
onClose?.();
|
|
1531
|
-
ShowAlert({
|
|
1360
|
+
ShowAlert({
|
|
1361
|
+
mode: 'success',
|
|
1362
|
+
title: SDKUI_Localizator.MoreInformation,
|
|
1363
|
+
message: SDKUI_Localizator.MoreInfoCompleted,
|
|
1364
|
+
duration: 3000
|
|
1365
|
+
});
|
|
1532
1366
|
}
|
|
1533
1367
|
catch (e) {
|
|
1534
|
-
TMSpinner.hide();
|
|
1535
1368
|
TMExceptionBoxManager.show({ exception: e });
|
|
1536
1369
|
}
|
|
1537
1370
|
finally {
|
|
1538
1371
|
TMSpinner.hide();
|
|
1539
1372
|
}
|
|
1540
1373
|
}, [moreInfoTasks, onTaskCompleted, onClose]);
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
mode: "info",
|
|
1549
|
-
duration: 3000,
|
|
1550
|
-
title: SDKUI_Localizator.SignatureAndApprove,
|
|
1551
|
-
});
|
|
1552
|
-
}, [onOpenS4TViewerRequest, TID, DID]);
|
|
1374
|
+
// Memoized props for TMBlogCommentForm to avoid unnecessary re-renders
|
|
1375
|
+
const blogCommentFormContext = useMemo(() => ({ engine: 'SearchEngine', object: { tid: TID, did: DID } }), [TID, DID]);
|
|
1376
|
+
const handleBlogCommentFormClose = useCallback(() => {
|
|
1377
|
+
setShowCommentForm(false);
|
|
1378
|
+
}, []);
|
|
1379
|
+
const emptyParticipants = useMemo(() => [], []);
|
|
1380
|
+
const emptyArchivedDocumentsFileItems = useMemo(() => [], []);
|
|
1553
1381
|
const handleNavigateToReference = useCallback((ref) => {
|
|
1554
1382
|
if (onReferenceClick) {
|
|
1555
1383
|
try {
|
|
@@ -1567,100 +1395,53 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1567
1395
|
[ObjectClasses.WorkingGroup]: { label: SDKUI_Localizator.GoToWorkgroup },
|
|
1568
1396
|
// add other ObjectClasses here as needed
|
|
1569
1397
|
}), []);
|
|
1398
|
+
const onSavedTaskFormCallback = (task) => {
|
|
1399
|
+
if (task && showMoreInfoTaskTask && editTaskCallback) {
|
|
1400
|
+
editTaskCallback(task);
|
|
1401
|
+
setShowMoreInfoTaskPopup(false);
|
|
1402
|
+
setShowMoreInfoTaskTask(undefined);
|
|
1403
|
+
ShowAlert({ message: SDKUI_Localizator.TaskSavedSuccessfully.replaceParams(task.name ?? '-'), mode: 'success', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
ShowAlert({ message: SDKUI_Localizator.TaskSaveError, mode: 'error', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1570
1409
|
const renderDcmtForm = () => {
|
|
1571
1410
|
// Show flat spinner during initial load (before component is mounted)
|
|
1572
1411
|
if (isInitialLoading) {
|
|
1573
1412
|
return _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: true });
|
|
1574
1413
|
}
|
|
1575
|
-
return (_jsxs("div", { style: {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
:
|
|
1603
|
-
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), showToppyForCompleteMoreInfo && (moreInfoTasks?.length === 1 ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `${SDKUI_Localizator.MoreInfoCompleteRequestSentBy} ${moreInfoTasks[0]?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => setShowCommentForm(true) })] })) : (_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `Ci sono ${moreInfoTasks?.length ?? 0} richieste di maggiori informazioni. ${SDKUI_Localizator.ManageFromTaskPanel}` }))), showToppyForReferences && dcmtReferences?.filter(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup)
|
|
1604
|
-
.map((ref, index, arr) => {
|
|
1605
|
-
const mapEntry = referenceActionMap[String(ref.objClass)];
|
|
1606
|
-
const label = mapEntry?.label ?? 'Vai a riferimento';
|
|
1607
|
-
return (_jsxs(React.Fragment, { children: [index === 0 && (showToppyForApprove || showToppyForCompleteMoreInfo) && (_jsx("div", { style: {
|
|
1608
|
-
height: 1,
|
|
1609
|
-
backgroundColor: 'rgba(255,255,255,0.2)',
|
|
1610
|
-
margin: '6px 0'
|
|
1611
|
-
} })), _jsxs(StyledReferenceButton, { onClick: () => handleNavigateToReference(ref), onDoubleClick: (e) => { e.preventDefault(); e.stopPropagation(); }, children: [_jsx("span", { children: label }), _jsx("span", { children: `"${ref.objName}"` })] }, `ref-${index}-${ref.objID}`)] }, `ref-frag-${index}-${ref.objID}`));
|
|
1612
|
-
})] }) })] }), (showCommentForm && TID && DID) &&
|
|
1613
|
-
_jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: TID, did: DID } }, onClose: () => setShowCommentForm(false), refreshCallback: handleCompleteMoreInfo, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [] }), isOpenDetails &&
|
|
1614
|
-
_jsx(StyledModalContainer, { children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenMaster &&
|
|
1615
|
-
_jsxs(StyledModalContainer, { children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
1616
|
-
return (_jsx(StyledModalContainer, { children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }, `${index}-${dcmt.DID}`));
|
|
1617
|
-
})] }), taskFormDialogComponent, s4TViewerDialogComponent] }));
|
|
1414
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: floatingBarContainerRef, style: {
|
|
1415
|
+
display: isOpenDetails || isOpenMaster ? 'none' : 'flex',
|
|
1416
|
+
flexDirection: deviceType === DeviceType.MOBILE ? 'column' : 'row',
|
|
1417
|
+
justifyContent: 'space-between',
|
|
1418
|
+
gap: Gutters.getGutters(),
|
|
1419
|
+
width: '100%',
|
|
1420
|
+
height: '100%',
|
|
1421
|
+
position: 'relative',
|
|
1422
|
+
overflow: 'hidden'
|
|
1423
|
+
}, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: [(groupId && groupId.length > 0)
|
|
1424
|
+
? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
|
|
1425
|
+
: _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1426
|
+
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onClosePanelCallback: () => setIsOpenDistinctValues(false), onSelectionChanged: (e) => {
|
|
1427
|
+
if (!e)
|
|
1428
|
+
return;
|
|
1429
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
|
|
1430
|
+
} }), isOpenFormulaEditor &&
|
|
1431
|
+
_jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
|
|
1432
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
|
1433
|
+
setFocusedMetadataValue(prevState => ({
|
|
1434
|
+
...prevState,
|
|
1435
|
+
isSelected: true,
|
|
1436
|
+
isEditable: true,
|
|
1437
|
+
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
1438
|
+
}));
|
|
1439
|
+
} }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), _jsx(TMToppyDraggableHelpCenter, { isVisible: isToppyVisible, content: _jsx(TMDcmtFormActionButtons, { showToppyForApprove: showToppyForApprove, workItems: workItems, deviceType: deviceType, isMobile: isMobile, handleSignApprove: handleSignApprove, updateShowApprovePopup: updateShowApprovePopup, updateShowRejectPopup: updateShowRejectPopup, updateShowReAssignPopup: updateShowReAssignPopup, updateShowMoreInfoPopup: updateShowMoreInfoPopup, fromDTD: fromDTD, showToppyForCompleteMoreInfo: showToppyForCompleteMoreInfo, moreInfoTasks: moreInfoTasks, setShowCommentForm: setShowCommentForm, showToppyForReferences: showToppyForReferences, dcmtReferences: dcmtReferences, referenceActionMap: referenceActionMap, handleNavigateToReference: handleNavigateToReference, setShowMoreInfoTaskPopup: setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask: setShowMoreInfoTaskTask }) })] }), (showCommentForm && TID && DID) &&
|
|
1440
|
+
_jsx(TMBlogCommentForm, { maxLength: 500, context: blogCommentFormContext, onClose: handleBlogCommentFormClose, onCustomSave: onBlogCommentFormCustomSave, participants: emptyParticipants, showAttachmentsSection: false, allArchivedDocumentsFileItems: emptyArchivedDocumentsFileItems })] }), renderDcmtOperations, renderFloatingBar] }));
|
|
1618
1441
|
};
|
|
1619
|
-
return (_jsxs(
|
|
1442
|
+
return (_jsxs("div", { style: { width: '100%', height: '100%' }, children: [(isModal && onClose)
|
|
1620
1443
|
? _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px", position: 'relative' }, children: renderDcmtForm() }) })
|
|
1621
|
-
: renderDcmtForm(),
|
|
1622
|
-
try {
|
|
1623
|
-
setShowRelatedDcmtsChooser(false);
|
|
1624
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1625
|
-
const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
|
|
1626
|
-
if (!relation || !archiveType)
|
|
1627
|
-
return;
|
|
1628
|
-
await archiveRelatedDcmtHandler(relation, archiveType);
|
|
1629
|
-
}
|
|
1630
|
-
catch (error) {
|
|
1631
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
1632
|
-
}
|
|
1633
|
-
finally {
|
|
1634
|
-
TMSpinner.hide();
|
|
1635
|
-
}
|
|
1636
|
-
}, onClose: () => setShowRelatedDcmtsChooser(false), manageUseLocalizedName: false })), showManyToManyChooser && (_jsx(TMChooserForm, { dataSource: manyToManyChooserDataSource, onChoose: async (selectedRelation) => {
|
|
1637
|
-
try {
|
|
1638
|
-
setShowManyToManyChooser(false);
|
|
1639
|
-
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
1640
|
-
const relation = manyToManyRelations?.find(r => r.id === selectedRelation[0]);
|
|
1641
|
-
if (!relation)
|
|
1642
|
-
return;
|
|
1643
|
-
await executeManyToManyPairing(relation, isPairingManyToMany);
|
|
1644
|
-
}
|
|
1645
|
-
catch (error) {
|
|
1646
|
-
TMExceptionBoxManager.show({ exception: error });
|
|
1647
|
-
}
|
|
1648
|
-
finally {
|
|
1649
|
-
TMSpinner.hide();
|
|
1650
|
-
}
|
|
1651
|
-
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), (showHistory && fromDTD && currentDcmt) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: { TID: currentDcmt.tid, DID: currentDcmt.did }, onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showCheckoutInformationForm && fromDTD && currentDcmt) &&
|
|
1652
|
-
_jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, onClose: hideCheckoutInformationFormCallback }), (commentFormState.show && currentDcmt) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: currentDcmt.tid, did: currentDcmt.did } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment }), isOpenArchiveRelationForm && (_jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
|
|
1653
|
-
setIsOpenArchiveRelationForm(false);
|
|
1654
|
-
setArchiveType(undefined);
|
|
1655
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
1656
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
1657
|
-
}, onSavedAsyncCallback: async (tid, did) => {
|
|
1658
|
-
setIsOpenArchiveRelationForm(false);
|
|
1659
|
-
setArchiveType(undefined);
|
|
1660
|
-
setArchiveRelatedDcmtFormTID(undefined);
|
|
1661
|
-
setArchiveRelatedDcmtFormMids([]);
|
|
1662
|
-
await fetchData();
|
|
1663
|
-
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference })), showPairDcmtsModal && (_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshSearchAsync: async () => await fetchData(), onTaskCreateRequest: onTaskCreateRequest, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, toppyHelpCenterUsePortal: true }) }))] }));
|
|
1444
|
+
: renderDcmtForm(), (showMoreInfoTaskPopup && showMoreInfoTaskTask && showMoreInfoTaskTask.id && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx(TMTaskForm, { id: Number(showMoreInfoTaskTask.id), title: showMoreInfoTaskTask.name ?? 'N/A', formMode: FormModes.Update, onSaved: onSavedTaskFormCallback, editTaskCallback: editTaskCallback, onClose: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, onCancel: () => { setShowMoreInfoTaskPopup(false); setShowMoreInfoTaskTask(undefined); }, isModal: true, showBackButton: false, hasNavigation: false, width: taskModalSizes(deviceType, FormModes.Update).width, height: taskModalSizes(deviceType, FormModes.Update).height, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, visualizedTasks: [], currentTask: null, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback })] }));
|
|
1664
1445
|
};
|
|
1665
1446
|
export default TMDcmtForm;
|
|
1666
1447
|
/**
|
|
@@ -1707,7 +1488,12 @@ export const validateMetadataList = (mvdList = []) => {
|
|
|
1707
1488
|
return validationItems;
|
|
1708
1489
|
}, []);
|
|
1709
1490
|
};
|
|
1710
|
-
const isValidForValidation = (mvd) => {
|
|
1491
|
+
const isValidForValidation = (mvd) => {
|
|
1492
|
+
// I campi Computed non vanno validati (sono calcolati automaticamente)
|
|
1493
|
+
if (mvd.md?.dataDomain === MetadataDataDomains.Computed)
|
|
1494
|
+
return false;
|
|
1495
|
+
return mvd.mid > 99;
|
|
1496
|
+
};
|
|
1711
1497
|
const validateRequiredField = (mvd, value, validationItems) => {
|
|
1712
1498
|
if (mvd.isRequired === '1' && !value.trim()) {
|
|
1713
1499
|
const message = SDKUI_Localizator.RequiredField;
|
|
@@ -1725,21 +1511,37 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1725
1511
|
}
|
|
1726
1512
|
};
|
|
1727
1513
|
//#endregion Validation
|
|
1728
|
-
//
|
|
1729
|
-
|
|
1730
|
-
const
|
|
1731
|
-
const { setToolbarButtonDisabled } = useTMPanelManagerContext();
|
|
1514
|
+
// Synchronizes panel visibility and toolbar button disabled states when panels become disabled
|
|
1515
|
+
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled }) => {
|
|
1516
|
+
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1732
1517
|
useEffect(() => {
|
|
1518
|
+
// Aggiorna lo stato disabled del bottone toolbar
|
|
1519
|
+
setToolbarButtonDisabled('tmSysMetadata', isSysMetadataDisabled);
|
|
1520
|
+
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1733
1521
|
setToolbarButtonDisabled('tmWF', isWFDisabled);
|
|
1734
|
-
|
|
1735
|
-
|
|
1522
|
+
setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
|
|
1523
|
+
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1524
|
+
if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
|
|
1525
|
+
setPanelVisibilityById('tmSysMetadata', false);
|
|
1526
|
+
}
|
|
1527
|
+
if (isBoardDisabled && panelVisibility['tmBlog']) {
|
|
1528
|
+
setPanelVisibilityById('tmBlog', false);
|
|
1529
|
+
}
|
|
1530
|
+
if (isWFDisabled && panelVisibility['tmWF']) {
|
|
1531
|
+
setPanelVisibilityById('tmWF', false);
|
|
1532
|
+
}
|
|
1533
|
+
if (isDcmtTasksDisabled && panelVisibility['tmDcmtTasks']) {
|
|
1534
|
+
setPanelVisibilityById('tmDcmtTasks', false);
|
|
1535
|
+
}
|
|
1536
|
+
}, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1537
|
+
return null;
|
|
1736
1538
|
};
|
|
1737
|
-
const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode,
|
|
1539
|
+
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
|
|
1738
1540
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels, panelVisibility } = useTMPanelManagerContext();
|
|
1739
1541
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1740
1542
|
return (layoutMode === LayoutModes.Update ?
|
|
1741
|
-
_jsx(TMDcmtPreview, { isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined,
|
|
1742
|
-
_jsx(TMFileUploader, { onFileUpload: onFileUpload, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay }));
|
|
1543
|
+
_jsx(TMDcmtPreview, { dcmtData: currentDcmt, isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, isResizingActive: isResizingActive }, refreshPreviewTrigger) :
|
|
1544
|
+
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload, openPdfEditor: openFileUploaderPdfEditor, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay, onScanRequest: onScanRequest }));
|
|
1743
1545
|
};
|
|
1744
1546
|
const Ribbon = styled.div `
|
|
1745
1547
|
font-size: 0.85rem;
|