@topconsultnpm/sdkui-react 6.22.0-dev2.2 → 6.22.0-dev2.21
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/TMContextMenu.js +1 -1
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
- package/lib/components/base/TMButton.d.ts +13 -0
- package/lib/components/base/TMButton.js +137 -5
- package/lib/components/base/TMDataGrid.d.ts +2 -0
- package/lib/components/base/TMDataGrid.js +68 -4
- package/lib/components/base/TMEditorBase.d.ts +2 -0
- package/lib/components/base/TMModal.d.ts +4 -0
- package/lib/components/base/TMModal.js +42 -11
- package/lib/components/base/TMPanel.d.ts +1 -0
- package/lib/components/base/TMPanel.js +79 -20
- package/lib/components/base/TMTooltip.d.ts +2 -1
- package/lib/components/base/TMTooltip.js +23 -6
- package/lib/components/base/TMTreeView.js +108 -67
- package/lib/components/choosers/TMDcmtTypeChooser.js +4 -3
- package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
- package/lib/components/choosers/TMDistinctValues.js +149 -142
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +12 -0
- package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
- package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
- package/lib/components/choosers/TMSelectedValuesSummary.js +91 -0
- package/lib/components/editors/TMDropDown.d.ts +3 -0
- package/lib/components/editors/TMDropDown.js +197 -5
- package/lib/components/editors/TMMetadataEditor.d.ts +5 -1
- package/lib/components/editors/TMMetadataEditor.js +8 -3
- package/lib/components/editors/TMTextBox.js +15 -15
- package/lib/components/features/documents/TMBatchUpdateForm.js +19 -5
- package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtForm.js +104 -42
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +74 -7
- package/lib/components/features/documents/TMMasterDetailDcmts.js +95 -33
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +19 -0
- package/lib/components/features/documents/TMMasterInfoFields.js +172 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +40 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +277 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +354 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +234 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +14 -1
- package/lib/components/features/documents/TMRelationViewer.js +69 -20
- package/lib/components/features/search/TMSearch.js +29 -16
- package/lib/components/features/search/TMSearchQueryEditor.js +5 -3
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +28 -7
- package/lib/components/features/search/TMSearchResult.d.ts +9 -0
- package/lib/components/features/search/TMSearchResult.js +323 -92
- package/lib/components/features/search/TMTreeSelector.js +18 -5
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +8 -4
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +24 -14
- package/lib/components/layout/panelManager/TMPanelWrapper.js +2 -2
- package/lib/components/layout/panelManager/types.d.ts +3 -0
- package/lib/components/viewers/TMMidViewer.js +4 -1
- package/lib/components/viewers/TMTidViewer.js +25 -11
- package/lib/helper/SDKUI_Globals.d.ts +55 -0
- package/lib/helper/SDKUI_Globals.js +82 -0
- package/lib/helper/SDKUI_Localizator.d.ts +24 -0
- package/lib/helper/SDKUI_Localizator.js +240 -0
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/dataGridSearchHelper.d.ts +28 -0
- package/lib/helper/dataGridSearchHelper.js +51 -0
- package/lib/helper/dcmtsHelper.d.ts +20 -0
- package/lib/helper/dcmtsHelper.js +58 -1
- package/lib/helper/helpers.d.ts +20 -0
- package/lib/helper/helpers.js +40 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.d.ts +2 -0
- package/lib/helper/queryHelper.js +3 -1
- package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
- package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
- package/lib/hooks/useArchiveListForm.d.ts +39 -0
- package/lib/hooks/useArchiveListForm.js +46 -0
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/hooks/useDataUserIdItem.d.ts +1 -0
- package/lib/hooks/useDataUserIdItem.js +1 -0
- package/lib/hooks/useDocumentOperations.d.ts +2 -0
- package/lib/hooks/useDocumentOperations.js +28 -5
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +98 -0
- package/lib/hooks/useMultiMasterDetailDcmts.js +567 -0
- package/lib/hooks/useRelatedDocuments.js +2 -26
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
- package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
- package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
- package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
- package/lib/hooks/useTMDistinctValuesSource.js +105 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/caseflow/CaseFlowService.d.ts +236 -0
- package/lib/services/caseflow/CaseFlowService.js +693 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +66 -66
|
@@ -5,7 +5,7 @@ import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, Dcmt
|
|
|
5
5
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
6
6
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
7
7
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
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';
|
|
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, IconArchiveMultipleDetailDocuments } from '../../../helper';
|
|
9
9
|
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
|
10
10
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
11
11
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -26,6 +26,7 @@ import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManag
|
|
|
26
26
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
27
27
|
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
28
28
|
import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
|
|
29
|
+
import { useCaseFlowApprove } from '../../../hooks/useCaseFlowApprove';
|
|
29
30
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
30
31
|
import WFDiagram from '../workflow/diagram/WFDiagram';
|
|
31
32
|
import TMTooltip from '../../base/TMTooltip';
|
|
@@ -39,6 +40,8 @@ import TMToppyDraggableHelpCenter from '../assistant/TMToppyDraggableHelpCenter'
|
|
|
39
40
|
import TMTaskForm from '../tasks/TMTaskForm';
|
|
40
41
|
import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
41
42
|
import TMDcmtFormActionButtons from './TMDcmtFormActionButtons';
|
|
43
|
+
import { useArchiveListForm } from '../../../hooks/useArchiveListForm';
|
|
44
|
+
import TMMultiMasterDetailDcmtsForm from './TMMultiMasterDetailDcmtsForm';
|
|
42
45
|
//#region Interfaces, Types and Enums
|
|
43
46
|
/**
|
|
44
47
|
* Definisce il contesto da cui è stato invocato il TMDcmtForm.
|
|
@@ -57,7 +60,7 @@ export var InvocationContext;
|
|
|
57
60
|
let abortControllerLocal = new AbortController();
|
|
58
61
|
;
|
|
59
62
|
//#endregion
|
|
60
|
-
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, showTodoDcmtForm = 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, editPdfForm = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, fetchRemoteCertificates, datagridUtility, graphometricManager }) => {
|
|
63
|
+
const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMode = FormModes.Update, invocationContext = InvocationContext.Default, showHeader = true, showBackButton = true, showDcmtFormSidebar = true, isClosable = false, showTodoDcmtForm = 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, editPdfForm = false, onClose, onSavedAsyncCallback, onSaveRecents, onWFOperationCompleted, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, onTaskCompleted, onTaskCreateRequest, moreInfoTasks, taskFormDialogComponent, handleNavigateToWGs, handleNavigateToDossiers, onReferenceClick, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, s4TViewerDialogComponent, onScanRequest, passToSearch, archiveListMode, fetchRemoteCertificates, datagridUtility, graphometricManager }) => {
|
|
61
64
|
const { onRefreshSearchAsyncDatagrid, onRefreshBlogDatagrid, onRefreshPreviewDatagrid } = datagridUtility || {};
|
|
62
65
|
const floatingBarContainerRef = useRef(null);
|
|
63
66
|
const [id, setID] = useState('');
|
|
@@ -96,6 +99,10 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
96
99
|
const [isOpenFormulaEditor, setIsOpenFormulaEditor] = useState(false);
|
|
97
100
|
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
|
98
101
|
const [currentTIDHasMasterRelations, setCurrentTIDHasMasterRelations] = useState();
|
|
102
|
+
// Modale "Archivia documenti di dettaglio multipli" aperto dall'azione secondaria del form di archiviazione:
|
|
103
|
+
// dopo aver archiviato il master si apre il modale con il master appena archiviato come documento di partenza.
|
|
104
|
+
const [showMultiDetailArchiveModal, setShowMultiDetailArchiveModal] = useState(false);
|
|
105
|
+
const [multiDetailMasterDcmts, setMultiDetailMasterDcmts] = useState([]);
|
|
99
106
|
const [currentDcmt, setCurrentDcmt] = useState();
|
|
100
107
|
const [dcmtFile, setDcmtFile] = useState(null);
|
|
101
108
|
const [focusedMetadataValue, setFocusedMetadataValue] = useState();
|
|
@@ -116,6 +123,10 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
116
123
|
const [wfError, setWfError] = useState(null);
|
|
117
124
|
const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
|
|
118
125
|
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
126
|
+
// Attività delle PRATICHE (CaseFlow) su questo documento. Come per il workflow
|
|
127
|
+
// la scoperta avviene QUI: da qualunque punto si apra il form, l'utente trova
|
|
128
|
+
// le sue azioni nel Toppy.
|
|
129
|
+
const { caseFlowWorkItems, completeCaseFlowWorkItem, rejectCaseFlowWorkItem } = useCaseFlowApprove(TID, DID);
|
|
119
130
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
120
131
|
const deviceType = useDeviceType();
|
|
121
132
|
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
@@ -450,7 +461,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
450
461
|
openTaskFormHandler,
|
|
451
462
|
},
|
|
452
463
|
});
|
|
453
|
-
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;
|
|
464
|
+
const { handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, canArchiveDetailRelation, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
454
465
|
useEffect(() => {
|
|
455
466
|
const fetchAllUsers = async () => {
|
|
456
467
|
const users = await UserListCacheService.GetAllAsync();
|
|
@@ -804,11 +815,54 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
804
815
|
// Verifica che ci siano riferimenti renderizzabili (solo Dossier o WorkingGroup)
|
|
805
816
|
return dcmtReferences.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
806
817
|
}, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
|
|
807
|
-
|
|
808
|
-
|
|
818
|
+
// Attività di pratica: stesse condizioni dell'approvazione workflow (documento
|
|
819
|
+
// in consultazione, senza errori, non dentro master/detail).
|
|
820
|
+
const showToppyForCaseFlow = useMemo(() => layoutMode === LayoutModes.Update && !fetchError && caseFlowWorkItems.length > 0 && !isOpenDetails && !isOpenMaster, [layoutMode, fetchError, caseFlowWorkItems.length, isOpenDetails, isOpenMaster]);
|
|
821
|
+
const isToppyVisible = useMemo(() => Boolean((showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences || showToppyForCaseFlow) && !openS4TViewer && !showTodoDcmtForm && !editPdfForm), [showToppyForApprove, showToppyForCompleteMoreInfo, showToppyForReferences, showToppyForCaseFlow, openS4TViewer, showTodoDcmtForm, editPdfForm]);
|
|
822
|
+
const handleClearForm = useCallback(() => {
|
|
823
|
+
let data = structuredClone(formData);
|
|
824
|
+
if (!data || data.length === 0)
|
|
825
|
+
return;
|
|
826
|
+
for (let md of data) {
|
|
827
|
+
if (!md.mid)
|
|
828
|
+
continue;
|
|
829
|
+
if (md.mid > 99) {
|
|
830
|
+
const defaultValue = md.md?.defaultValue;
|
|
831
|
+
if (defaultValue) {
|
|
832
|
+
if (FormulaHelper.isFormula(defaultValue)) {
|
|
833
|
+
md.value = undefined;
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
md.value = defaultValue;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
else if (formDataOrig.find(metadata => metadata.mid === md.mid)?.value === undefined) {
|
|
840
|
+
if (md.value)
|
|
841
|
+
md.value = undefined;
|
|
842
|
+
}
|
|
843
|
+
else if (md.value && md.value.length > 0) {
|
|
844
|
+
md.value = '';
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
setFormData(data);
|
|
849
|
+
}, [formData, formDataOrig]);
|
|
850
|
+
// Modalità "aggiungi a elenco" (archiviazione dettagli multipli): tutta la logica specifica è nell'hook.
|
|
851
|
+
const archiveList = useArchiveListForm({
|
|
852
|
+
mode: archiveListMode,
|
|
853
|
+
editingRowValues: inputMids,
|
|
854
|
+
formDataOrig,
|
|
855
|
+
formDataRef,
|
|
856
|
+
dcmtFileRef,
|
|
857
|
+
tid: TID,
|
|
858
|
+
isModal,
|
|
859
|
+
id,
|
|
860
|
+
clearForm: handleClearForm,
|
|
861
|
+
});
|
|
862
|
+
const isModified = useMemo(() => calcIsModified(formData, archiveList.referenceValues), [formData, archiveList.referenceValues]);
|
|
809
863
|
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 &&
|
|
810
|
-
_jsx(ContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
811
|
-
_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]);
|
|
864
|
+
_jsx(ContextMenu, { items: operationItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark && !archiveList.enabled &&
|
|
865
|
+
_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, archiveList.enabled]);
|
|
812
866
|
const handleUndo = useCallback(() => {
|
|
813
867
|
setFormData(structuredClone(formDataOrig));
|
|
814
868
|
}, [formDataOrig]);
|
|
@@ -964,9 +1018,13 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
964
1018
|
const isDuplication = layoutMode === LayoutModes.Ark && DID;
|
|
965
1019
|
if (isDuplication)
|
|
966
1020
|
onClose?.();
|
|
1021
|
+
// Ritorna il DID del documento appena archiviato, così il chiamante può proseguire
|
|
1022
|
+
// (es. aprire il modale di archiviazione dei documenti di dettaglio sul master appena creato).
|
|
1023
|
+
return newDID;
|
|
967
1024
|
}
|
|
968
1025
|
catch (err) {
|
|
969
1026
|
TMExceptionBoxManager.show({ exception: err });
|
|
1027
|
+
return undefined;
|
|
970
1028
|
}
|
|
971
1029
|
finally {
|
|
972
1030
|
setShowWaitPanelLocal(false);
|
|
@@ -985,34 +1043,24 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
985
1043
|
},
|
|
986
1044
|
});
|
|
987
1045
|
}, [isModal, id, layoutMode, handleSave, handleArchiveCompleted]);
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
if (md.value)
|
|
1007
|
-
md.value = undefined;
|
|
1008
|
-
}
|
|
1009
|
-
else if (md.value && md.value.length > 0) {
|
|
1010
|
-
md.value = '';
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
setFormData(data);
|
|
1015
|
-
}, [formData, formDataOrig]);
|
|
1046
|
+
// Azione secondaria del form di archiviazione: archivia il master e, subito dopo,
|
|
1047
|
+
// apre il modale di archiviazione dei documenti di dettaglio multipli usando il master appena creato.
|
|
1048
|
+
const handleArchiveMasterAndDetails = useCallback(async () => {
|
|
1049
|
+
TMMessageBoxManager.show({
|
|
1050
|
+
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
1051
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
1052
|
+
message: SDKUI_Localizator.ArchiveMasterAndDetails_Confirm,
|
|
1053
|
+
onButtonClick: async (e) => {
|
|
1054
|
+
if (e !== ButtonNames.YES)
|
|
1055
|
+
return;
|
|
1056
|
+
const newDID = await handleArchiveCompleted();
|
|
1057
|
+
if (newDID === undefined || newDID === null)
|
|
1058
|
+
return;
|
|
1059
|
+
setMultiDetailMasterDcmts([{ TID: TID, DID: newDID }]);
|
|
1060
|
+
setShowMultiDetailArchiveModal(true);
|
|
1061
|
+
},
|
|
1062
|
+
});
|
|
1063
|
+
}, [isModal, id, handleArchiveCompleted, TID]);
|
|
1016
1064
|
const clearFormBtnDisabled = useMemo(() => formData.filter(md => md.mid && md.value && md.mid > 99 && md.value.length > 0).length > 0, [formData]);
|
|
1017
1065
|
const archiveBtnDisabled = useMemo(() => layoutMode === LayoutModes.Update || (fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && !dcmtFile) || validationItems.length > 0, [layoutMode, fromDTD?.archiveConstraint, dcmtFile, validationItems.length]);
|
|
1018
1066
|
const undoBtnDisabled = useMemo(() => layoutMode === LayoutModes.Update || !isModified, [layoutMode, isModified]);
|
|
@@ -1021,10 +1069,14 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1021
1069
|
const metadataValuesSource = useMemo(() => {
|
|
1022
1070
|
return applyMetadataFilter(formData, showAll, listMaxItems, TID);
|
|
1023
1071
|
}, [showAll, formData, listMaxItems, TID]);
|
|
1024
|
-
const metadataValuesSourceOrig = useMemo(() =>
|
|
1025
|
-
|
|
1026
|
-
|
|
1072
|
+
const metadataValuesSourceOrig = useMemo(() =>
|
|
1073
|
+
// I valori di riferimento (in modifica riga includono i valori già caricati) li calcola l'hook:
|
|
1074
|
+
// così i campi pre-compilati non si colorano di giallo finché l'utente non li cambia davvero.
|
|
1075
|
+
applyMetadataFilter(archiveList.referenceValues, showAll, listMaxItems, TID), [showAll, archiveList.referenceValues, listMaxItems, TID]);
|
|
1027
1076
|
const handleClose = useCallback(() => {
|
|
1077
|
+
// Modalità "aggiungi a elenco": la X non archivia ma aggiorna l'elenco (gestita dall'hook).
|
|
1078
|
+
if (archiveList.requestClose(isModified, onClose))
|
|
1079
|
+
return;
|
|
1028
1080
|
if (!isModified) {
|
|
1029
1081
|
onClose?.();
|
|
1030
1082
|
return;
|
|
@@ -1045,7 +1097,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1045
1097
|
}
|
|
1046
1098
|
}
|
|
1047
1099
|
});
|
|
1048
|
-
}, [isModified, onClose, isModal, id, handleSave]);
|
|
1100
|
+
}, [isModified, onClose, isModal, id, handleSave, archiveList]);
|
|
1049
1101
|
const getFormula = useCallback(() => {
|
|
1050
1102
|
let fd = new FormulaDescriptor();
|
|
1051
1103
|
fd.expression = FormulaHelper.isFormula(focusedMetadataValue?.value) ? FormulaHelper.removeFormulaTag(focusedMetadataValue?.value) : undefined;
|
|
@@ -1118,7 +1170,14 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1118
1170
|
break;
|
|
1119
1171
|
}
|
|
1120
1172
|
} }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: handleConfirmAction }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: handleUndo })] }) :
|
|
1121
|
-
|
|
1173
|
+
archiveList.enabled ?
|
|
1174
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: archiveList.isEditingRow ? SDKUI_Localizator.Update : SDKUI_Localizator.Add, advancedColor: TMColors.success, onClick: archiveList.submit }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm })] }) :
|
|
1175
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: canArchiveDetailRelation ? '120px' : 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction, secondaryActions: canArchiveDetailRelation ? [{
|
|
1176
|
+
name: SDKUI_Localizator.ArchiveMasterAndMultipleDetailDocuments,
|
|
1177
|
+
icon: _jsx(IconArchiveMultipleDetailDocuments, {}),
|
|
1178
|
+
disabled: archiveBtnDisabled,
|
|
1179
|
+
onClick: handleArchiveMasterAndDetails,
|
|
1180
|
+
}] : undefined }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), customButton && _jsx(TMCustomButton, { button: customButton, formData: formData, selectedItems: [], onClose: () => setCustomButton(undefined) }), totalItems > listMaxItems &&
|
|
1122
1181
|
!isApprView &&
|
|
1123
1182
|
TID !== SystemTIDs.Drafts &&
|
|
1124
1183
|
!shouldShowAll &&
|
|
@@ -1149,6 +1208,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1149
1208
|
handleConfirmAction,
|
|
1150
1209
|
handleUndo,
|
|
1151
1210
|
handleClearForm,
|
|
1211
|
+
canArchiveDetailRelation,
|
|
1212
|
+
handleArchiveMasterAndDetails,
|
|
1152
1213
|
isReadOnlyOriginCallback,
|
|
1153
1214
|
metadataDcmtOrigin?.fromTID,
|
|
1154
1215
|
]);
|
|
@@ -1571,12 +1632,13 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1571
1632
|
isEditable: true,
|
|
1572
1633
|
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
1573
1634
|
}));
|
|
1574
|
-
} }), (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) &&
|
|
1635
|
+
} }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), _jsx(TMToppyDraggableHelpCenter, { isVisible: isToppyVisible, content: _jsx(TMDcmtFormActionButtons, { showToppyForApprove: showToppyForApprove, workItems: workItems, caseFlowWorkItems: showToppyForCaseFlow ? caseFlowWorkItems : [], onCompleteCaseFlowWorkItem: completeCaseFlowWorkItem, onRejectCaseFlowWorkItem: rejectCaseFlowWorkItem, 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) &&
|
|
1575
1636
|
_jsx(TMBlogCommentForm, { maxLength: 500, context: blogCommentFormContext, onClose: handleBlogCommentFormClose, onCustomSave: onBlogCommentFormCustomSave, participants: emptyParticipants, showAttachmentsSection: false, allArchivedDocumentsFileItems: emptyArchivedDocumentsFileItems })] }), renderDcmtOperations, renderFloatingBar] }));
|
|
1576
1637
|
};
|
|
1577
1638
|
return (_jsxs("div", { style: { width: '100%', height: '100%' }, children: [(isModal && onClose)
|
|
1578
1639
|
? _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() }) })
|
|
1579
|
-
: 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 })
|
|
1640
|
+
: 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 }), (showMultiDetailArchiveModal && fromDTD && multiDetailMasterDcmts.length > 0) &&
|
|
1641
|
+
_jsx(TMMultiMasterDetailDcmtsForm, { dtd: fromDTD, masterDcmt: multiDetailMasterDcmts[0], onClose: () => { setShowMultiDetailArchiveModal(false); setMultiDetailMasterDcmts([]); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar, showTodoDcmtForm: showTodoDcmtForm, openFileUploaderPdfEditor: openFileUploaderPdfEditor, graphometricManager: graphometricManager, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, fetchRemoteCertificates: fetchRemoteCertificates, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onReferenceClick: onReferenceClick, onTaskCreateRequest: onTaskCreateRequest })] }));
|
|
1580
1642
|
};
|
|
1581
1643
|
export default TMDcmtForm;
|
|
1582
1644
|
/**
|
|
@@ -2,9 +2,20 @@ import React from "react";
|
|
|
2
2
|
import { DcmtTypeDescriptor, TaskDescriptor, ObjectRef } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import { IWorkItemData } from "../../../ts";
|
|
4
4
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
5
|
+
import { CaseFlowDcmtWorkItem } from "../../../hooks/useCaseFlowApprove";
|
|
5
6
|
interface TMDcmtFormActionButtonsProps {
|
|
6
7
|
showToppyForApprove: boolean;
|
|
7
8
|
workItems: Array<IWorkItemData>;
|
|
9
|
+
/** Attività delle PRATICHE (CaseFlow) pendenti su QUESTO documento. */
|
|
10
|
+
caseFlowWorkItems?: Array<CaseFlowDcmtWorkItem>;
|
|
11
|
+
/**
|
|
12
|
+
* Completa l'attività di pratica. NON usato per la FIRMA: là si apre il viewer
|
|
13
|
+
* di firma ed è quello, a firma riuscita, a completare — esattamente come per
|
|
14
|
+
* i work item del workflow.
|
|
15
|
+
*/
|
|
16
|
+
onCompleteCaseFlowWorkItem?: (item: CaseFlowDcmtWorkItem, comment?: string) => Promise<void>;
|
|
17
|
+
/** Rifiuta l'attività di pratica con un motivo. */
|
|
18
|
+
onRejectCaseFlowWorkItem?: (item: CaseFlowDcmtWorkItem, reason: string) => Promise<void>;
|
|
8
19
|
deviceType: DeviceType | undefined;
|
|
9
20
|
isMobile: boolean;
|
|
10
21
|
handleSignApprove: () => void;
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { ObjectClasses, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { TASK_MORE_INFO_PREFIX_NAME, SDKUI_Localizator, PDGS_COLORS, calcResponsiveSizes } from "../../../helper";
|
|
4
|
+
import { TASK_MORE_INFO_PREFIX_NAME, SDKUI_Localizator, PDGS_COLORS, calcResponsiveSizes, isSign4TopEnabled } from "../../../helper";
|
|
5
5
|
import { TMColors } from "../../../utils/theme";
|
|
6
6
|
import { StyledReferenceButton } from "../../base/Styled";
|
|
7
7
|
import TMButton from "../../base/TMButton";
|
|
8
8
|
import TMModal from "../../base/TMModal";
|
|
9
9
|
import TMTooltip from "../../base/TMTooltip";
|
|
10
10
|
import { WorkFlowOperationButtons } from "../workflow/TMWorkflowPopup";
|
|
11
|
+
import { getWorkItemActionName, isSignatureWorkItem } from "../../../services/caseflow/caseFlowWorkItemUtils";
|
|
11
12
|
const TMDcmtFormActionButtons = (props) => {
|
|
12
|
-
const { showToppyForApprove, workItems, deviceType, isMobile, handleSignApprove, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup, fromDTD, showToppyForCompleteMoreInfo, moreInfoTasks, setShowCommentForm, showToppyForReferences, dcmtReferences, referenceActionMap, handleNavigateToReference, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
13
|
+
const { showToppyForApprove, workItems, caseFlowWorkItems, onCompleteCaseFlowWorkItem, onRejectCaseFlowWorkItem, deviceType, isMobile, handleSignApprove, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup, fromDTD, showToppyForCompleteMoreInfo, moreInfoTasks, setShowCommentForm, showToppyForReferences, dcmtReferences, referenceActionMap, handleNavigateToReference, setShowMoreInfoTaskPopup, setShowMoreInfoTaskTask } = props;
|
|
13
14
|
const [showAllMoreInfoModal, setShowAllMoreInfoModal] = useState(false);
|
|
14
15
|
const [showAllDossiersModal, setShowAllDossiersModal] = useState(false);
|
|
15
16
|
const [showAllWorkingGroupsModal, setShowAllWorkingGroupsModal] = useState(false);
|
|
17
|
+
// Rifiuto di un'attività di pratica: il motivo è obbligatorio, quindi si passa
|
|
18
|
+
// da un dialogo. `busyItemId` disabilita i pulsanti dell'attività in corso.
|
|
19
|
+
const [rejectingItem, setRejectingItem] = useState(null);
|
|
20
|
+
const [rejectReason, setRejectReason] = useState('');
|
|
21
|
+
const [busyItemId, setBusyItemId] = useState(null);
|
|
22
|
+
const cfItems = useMemo(() => caseFlowWorkItems ?? [], [caseFlowWorkItems]);
|
|
23
|
+
const runCaseFlowAction = useCallback(async (item, action) => {
|
|
24
|
+
setBusyItemId(item.workItem.id ?? null);
|
|
25
|
+
try {
|
|
26
|
+
await action();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
setBusyItemId(null);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
16
32
|
const tasksNumber = useMemo(() => moreInfoTasks?.length ?? 0, [moreInfoTasks]);
|
|
17
33
|
const firstTask = useMemo(() => {
|
|
18
34
|
if (!moreInfoTasks || moreInfoTasks.length === 0)
|
|
@@ -31,19 +47,63 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
31
47
|
return false;
|
|
32
48
|
return true;
|
|
33
49
|
}, [firstTask]);
|
|
34
|
-
const { hasMoreInfo, hasApprove, hasReferences } = useMemo(() => {
|
|
50
|
+
const { hasMoreInfo, hasApprove, hasReferences, hasCaseFlow } = useMemo(() => {
|
|
35
51
|
const referencesExist = showToppyForReferences && dcmtReferences?.some(ref => ref.objClass === ObjectClasses.Dossier || ref.objClass === ObjectClasses.WorkingGroup);
|
|
36
52
|
return {
|
|
37
53
|
hasMoreInfo: Boolean(showToppyForCompleteMoreInfo),
|
|
38
54
|
hasApprove: Boolean(showToppyForApprove),
|
|
39
|
-
hasReferences: Boolean(referencesExist)
|
|
55
|
+
hasReferences: Boolean(referencesExist),
|
|
56
|
+
hasCaseFlow: cfItems.length > 0
|
|
40
57
|
};
|
|
41
58
|
}, [
|
|
42
59
|
showToppyForCompleteMoreInfo,
|
|
43
60
|
showToppyForApprove,
|
|
44
61
|
showToppyForReferences,
|
|
45
|
-
dcmtReferences
|
|
62
|
+
dcmtReferences,
|
|
63
|
+
cfItems
|
|
46
64
|
]);
|
|
65
|
+
/**
|
|
66
|
+
* Attività di pratica: contesto (pratica + testo dell'attività) e gli STESSI
|
|
67
|
+
* pulsanti dei work item del workflow (`WorkFlowOperationButtons`), così le due
|
|
68
|
+
* provenienze si comportano allo stesso modo davanti all'utente.
|
|
69
|
+
*
|
|
70
|
+
* La forma dei pulsanti la decide la CATEGORIA dell'attività, non il tipo
|
|
71
|
+
* documento: un'approvazione su un tipo abilitato alla firma non deve mostrare
|
|
72
|
+
* "Firma e approva" (per questo si passa `signFlow`). La firma richiede comunque
|
|
73
|
+
* il widget Sign4Top sul tipo, altrimenti il viewer non avrebbe come aprirsi.
|
|
74
|
+
*
|
|
75
|
+
* Per la FIRMA il pulsante apre il viewer (`handleSignApprove`, lo stesso del
|
|
76
|
+
* workflow) e il completamento avviene lì a firma riuscita: il form non sa
|
|
77
|
+
* firmare, e completare qui "a fiducia" chiuderebbe l'attività su un documento
|
|
78
|
+
* non firmato.
|
|
79
|
+
*/
|
|
80
|
+
const renderCaseFlowWorkItemCard = (item) => {
|
|
81
|
+
const { caseflow, workItem } = item;
|
|
82
|
+
const isBusy = busyItemId === workItem.id;
|
|
83
|
+
const canSign = !!fromDTD?.widgets && isSign4TopEnabled(fromDTD.widgets);
|
|
84
|
+
const requiresSignature = isSignatureWorkItem(workItem) && canSign;
|
|
85
|
+
const description = workItem.description || getWorkItemActionName(caseflow, workItem);
|
|
86
|
+
return (_jsxs("div", { style: {
|
|
87
|
+
display: 'flex',
|
|
88
|
+
flexDirection: 'column',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
textAlign: 'center',
|
|
91
|
+
gap: '10px',
|
|
92
|
+
cursor: 'default',
|
|
93
|
+
}, children: [_jsx("div", { style: {
|
|
94
|
+
padding: '8px 10px',
|
|
95
|
+
maxWidth: '240px',
|
|
96
|
+
color: '#FFFFFF',
|
|
97
|
+
background: 'linear-gradient(135deg, #7E57C2 0%, #5E35B1 60%, #4527A0 100%)',
|
|
98
|
+
border: '1px solid rgba(255,255,255,0.15)',
|
|
99
|
+
borderRadius: 10,
|
|
100
|
+
boxShadow: '0 8px 20px rgba(0, 0, 50, 0.4)',
|
|
101
|
+
}, children: description && _jsx("div", { style: { whiteSpace: 'pre-line' }, children: description }) }), _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, signFlow: requiresSignature, approveDisable: isBusy, signApproveDisable: isBusy, rejectDisable: isBusy, onSignApprove: handleSignApprove, onApprove: onCompleteCaseFlowWorkItem
|
|
102
|
+
? () => void runCaseFlowAction(item, () => onCompleteCaseFlowWorkItem(item))
|
|
103
|
+
: undefined, onReject: onRejectCaseFlowWorkItem
|
|
104
|
+
? () => { setRejectReason(''); setRejectingItem(item); }
|
|
105
|
+
: undefined })] }, workItem.id));
|
|
106
|
+
};
|
|
47
107
|
// Raggruppa references per categoria
|
|
48
108
|
const { dossierRefs, workingGroupRefs } = useMemo(() => {
|
|
49
109
|
const dossiers = dcmtReferences?.filter(ref => ref.objClass === ObjectClasses.Dossier) ?? [];
|
|
@@ -171,10 +231,17 @@ const TMDcmtFormActionButtons = (props) => {
|
|
|
171
231
|
e.currentTarget.style.transform = 'translateY(-50%)';
|
|
172
232
|
}, children: formatBadgeCount(othersCount) }))] }));
|
|
173
233
|
};
|
|
174
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && firstTask && isMoreInfoCardVisible && (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center', paddingRight: tasksNumber > 1 ? '36px' : '0' }, children: renderMoreInfoCard(firstTask, tasksNumber > 1) })), hasMoreInfo && isMoreInfoCardVisible && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
234
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [hasMoreInfo && firstTask && isMoreInfoCardVisible && (_jsx("div", { style: { display: 'flex', gap: "10px", flexDirection: 'column', alignItems: 'center', paddingRight: tasksNumber > 1 ? '36px' : '0' }, children: renderMoreInfoCard(firstTask, tasksNumber > 1) })), hasMoreInfo && isMoreInfoCardVisible && hasCaseFlow && _jsx(Divider, {}), hasCaseFlow && (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px', alignItems: 'center' }, children: cfItems.map(item => renderCaseFlowWorkItemCard(item)) })), hasCaseFlow && hasApprove && _jsx(Divider, {}), hasMoreInfo && isMoreInfoCardVisible && !hasCaseFlow && hasApprove && _jsx(Divider, {}), hasApprove && (workItems.length === 1 ?
|
|
175
235
|
_jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => updateShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => updateShowRejectPopup(true), onReAssign: () => updateShowReAssignPopup(true), onMoreInfo: () => updateShowMoreInfoPopup(true) })
|
|
176
236
|
:
|
|
177
|
-
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), (hasApprove && hasReferences) || (hasMoreInfo && isMoreInfoCardVisible && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px', alignItems: 'center' }, children: [dossierRefs.length > 0 && (_jsx("div", { style: { paddingRight: dossierRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(dossierRefs[0], dossierRefs, dossierRefs.length > 1, () => setShowAllDossiersModal(true)) })), workingGroupRefs.length > 0 && (_jsx("div", { style: { paddingRight: workingGroupRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(workingGroupRefs[0], workingGroupRefs, workingGroupRefs.length > 1, () => setShowAllWorkingGroupsModal(true)) }))] }))] }),
|
|
237
|
+
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Questo documento è associato a ${workItems.length} workitem.`, _jsx("br", {}), `Per approvare, vai alla pagina "Approvazione workflow".`] })), (hasApprove && hasReferences) || (hasMoreInfo && isMoreInfoCardVisible && !hasApprove && hasReferences) ? (_jsx(Divider, {})) : null, hasReferences && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px', alignItems: 'center' }, children: [dossierRefs.length > 0 && (_jsx("div", { style: { paddingRight: dossierRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(dossierRefs[0], dossierRefs, dossierRefs.length > 1, () => setShowAllDossiersModal(true)) })), workingGroupRefs.length > 0 && (_jsx("div", { style: { paddingRight: workingGroupRefs.length > 1 ? '36px' : '0' }, children: renderReferenceCard(workingGroupRefs[0], workingGroupRefs, workingGroupRefs.length > 1, () => setShowAllWorkingGroupsModal(true)) }))] }))] }), rejectingItem && onRejectCaseFlowWorkItem && (_jsx(TMModal, { title: rejectingItem.workItem.rejectLabel || SDKUI_Localizator.Reject, onClose: () => { setRejectingItem(null); setRejectReason(''); }, width: calcResponsiveSizes(deviceType, '450px', '450px', '95%'), height: 'auto', children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12, padding: 15 }, children: [_jsx("div", { style: { fontSize: 13, color: '#555' }, children: `${SDKUI_Localizator.Description}:` }), _jsx("textarea", { value: rejectReason, onChange: (e) => setRejectReason(e.target.value), rows: 4, style: { width: '100%', resize: 'vertical', fontFamily: 'inherit', fontSize: 13, padding: 8 } }), _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end', gap: 8 }, children: [_jsx(TMButton, { caption: SDKUI_Localizator.Cancel, showTooltip: false, onClick: () => { setRejectingItem(null); setRejectReason(''); } }), _jsx(TMButton, { caption: rejectingItem.workItem.rejectLabel || SDKUI_Localizator.Reject, color: 'error', showTooltip: false, disabled: !rejectReason.trim() || busyItemId === rejectingItem.workItem.id, onClick: () => {
|
|
238
|
+
const item = rejectingItem;
|
|
239
|
+
void runCaseFlowAction(item, async () => {
|
|
240
|
+
await onRejectCaseFlowWorkItem(item, rejectReason.trim());
|
|
241
|
+
setRejectingItem(null);
|
|
242
|
+
setRejectReason('');
|
|
243
|
+
});
|
|
244
|
+
} })] })] }) })), showAllMoreInfoModal && moreInfoTasks && moreInfoTasks.length > 1 && (_jsx(TMModal, { title: `Altre richieste maggiori informazioni (${moreInfoTasks.length - 1})`, onClose: () => setShowAllMoreInfoModal(false), width: calcResponsiveSizes(deviceType, '450px', '450px', '95%'), height: 'auto', children: _jsx("div", { style: {
|
|
178
245
|
display: 'flex',
|
|
179
246
|
flexDirection: 'column',
|
|
180
247
|
gap: '8px',
|