@topconsultnpm/sdkui-react 6.19.0-dev1.11 → 6.19.0-dev1.13
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.
|
@@ -990,7 +990,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
990
990
|
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
991
991
|
}));
|
|
992
992
|
} }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), showToppyForApprove && (_jsx(ToppyHelpCenter, { deviceType: deviceType, usePortal: false, content: workItems.length === 1 ?
|
|
993
|
-
_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true) }) })
|
|
993
|
+
_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD }) })
|
|
994
994
|
:
|
|
995
995
|
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Devi approvare ${workItems.length} workitem(s) per questo documento.`, `Vai alla sezione di approvazione.`] }) })), showToppyForCompleteMoreInfo && (_jsx(ToppyHelpCenter, { deviceType: deviceType, usePortal: false, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, 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} ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => {
|
|
996
996
|
setShowCommentForm(true);
|
|
@@ -109,11 +109,11 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
109
109
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
|
|
110
110
|
const deviceType = useDeviceType();
|
|
111
111
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
112
|
-
const
|
|
112
|
+
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
113
113
|
// Disable the "Sign/Approve" button if:
|
|
114
114
|
// 1. No document or multiple documents are selected, OR
|
|
115
115
|
// 2. Exactly one document is selected but its FILEEXT property is null
|
|
116
|
-
const disableSignApproveDisable =
|
|
116
|
+
const disableSignApproveDisable = selectedDocs.length !== 1 || (selectedDocs.length === 1 && selectedDocs[0].FILEEXT === null);
|
|
117
117
|
const dcmtsReturned = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsReturned : searchResults[0]?.dcmtsReturned ?? 0);
|
|
118
118
|
const dcmtsFound = (searchResults?.length > 1 ? selectedSearchResult?.dcmtsFound : searchResults[0]?.dcmtsFound ?? 0);
|
|
119
119
|
useEffect(() => { setID(genUniqueId()); }, []);
|
|
@@ -709,7 +709,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
709
709
|
const executeManyToManyPairing = async (relation, isPairing) => {
|
|
710
710
|
const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
|
|
711
711
|
if (!focusedItem?.TID || !focusedItem?.DID) {
|
|
712
|
-
|
|
712
|
+
ShowAlert({
|
|
713
|
+
message: "Nessun documento selezionato per l'operazione molti-a-molti.",
|
|
714
|
+
mode: 'warning',
|
|
715
|
+
title: 'Operazione molti-a-molti',
|
|
716
|
+
duration: 5000
|
|
717
|
+
});
|
|
713
718
|
return;
|
|
714
719
|
}
|
|
715
720
|
setSelectedManyToManyRelation(relation);
|
|
@@ -721,7 +726,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
721
726
|
qd = relation.retrieveDetailsQuery;
|
|
722
727
|
}
|
|
723
728
|
if (!qd) {
|
|
724
|
-
|
|
729
|
+
ShowAlert({
|
|
730
|
+
message: "Nessuna query di recupero associata alla relazione molti-a-molti.",
|
|
731
|
+
mode: 'warning',
|
|
732
|
+
title: 'Operazione molti-a-molti',
|
|
733
|
+
duration: 5000
|
|
734
|
+
});
|
|
725
735
|
return;
|
|
726
736
|
}
|
|
727
737
|
qd = structuredClone(qd);
|
|
@@ -821,7 +831,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
821
831
|
}
|
|
822
832
|
const sq = await searchEngine.SearchByIDAsync(qdWithSystemMIDs);
|
|
823
833
|
if (!sq?.dtdResult?.rows || sq.dtdResult.rows.length === 0) {
|
|
824
|
-
|
|
834
|
+
ShowAlert({
|
|
835
|
+
message: "Nessun documento trovato.",
|
|
836
|
+
mode: 'warning',
|
|
837
|
+
title: 'Operazione molti-a-molti',
|
|
838
|
+
duration: 5000
|
|
839
|
+
});
|
|
825
840
|
return;
|
|
826
841
|
}
|
|
827
842
|
const pairedDIDs = await getAlreadyPairedDIDs(relation, focusedItem.TID, focusedItem.DID);
|
|
@@ -845,7 +860,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
845
860
|
dcmtsFound: filteredRows.length
|
|
846
861
|
};
|
|
847
862
|
if (filteredRows.length === 0) {
|
|
848
|
-
|
|
863
|
+
ShowAlert({
|
|
864
|
+
message: isPairing ? "Nessun documento da abbinare." : "Nessun documento abbinato trovato.",
|
|
865
|
+
mode: 'warning',
|
|
866
|
+
title: 'Operazione molti-a-molti',
|
|
867
|
+
duration: 5000
|
|
868
|
+
});
|
|
849
869
|
return;
|
|
850
870
|
}
|
|
851
871
|
console.log(filteredSq);
|
|
@@ -860,12 +880,22 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
860
880
|
if (!relations)
|
|
861
881
|
return;
|
|
862
882
|
if (!relations.some(r => r.relationType === RelationTypes.ManyToMany)) {
|
|
863
|
-
|
|
883
|
+
ShowAlert({
|
|
884
|
+
message: "Nessuna relazione molti-a-molti definita nel sistema.",
|
|
885
|
+
mode: 'warning',
|
|
886
|
+
title: 'Operazione molti-a-molti',
|
|
887
|
+
duration: 5000
|
|
888
|
+
});
|
|
864
889
|
return;
|
|
865
890
|
}
|
|
866
891
|
const manyToManyRels = relations.filter(r => r.relationType === RelationTypes.ManyToMany);
|
|
867
892
|
if (!manyToManyRels.some(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID)) {
|
|
868
|
-
|
|
893
|
+
ShowAlert({
|
|
894
|
+
message: "Nessuna relazione molti-a-molti definita per il tipo di documento selezionato.",
|
|
895
|
+
mode: 'warning',
|
|
896
|
+
title: 'Operazione molti-a-molti',
|
|
897
|
+
duration: 5000
|
|
898
|
+
});
|
|
869
899
|
return;
|
|
870
900
|
}
|
|
871
901
|
const relsManyToMany = manyToManyRels.filter(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID);
|
|
@@ -918,7 +948,17 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
918
948
|
setIsModifiedBatchUpdate(false);
|
|
919
949
|
await refreshSelectionDataRowsAsync();
|
|
920
950
|
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), (showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm) &&
|
|
921
|
-
_jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () =>
|
|
951
|
+
_jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
|
|
952
|
+
setShowApprovePopup(true);
|
|
953
|
+
}, onSignApprove: () => {
|
|
954
|
+
handleSignApprove();
|
|
955
|
+
}, onReject: () => {
|
|
956
|
+
setShowRejectPopup(true);
|
|
957
|
+
}, onReAssign: () => {
|
|
958
|
+
setShowReAssignPopup(true);
|
|
959
|
+
}, onMoreInfo: () => {
|
|
960
|
+
setShowMoreInfoPopup(true);
|
|
961
|
+
}, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), showRelatedDcmtsChooser &&
|
|
922
962
|
_jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
|
|
923
963
|
try {
|
|
924
964
|
setShowRelatedDcmtsChooser(false);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { DcmtTypeDescriptor } from '@topconsultnpm/sdk-ts';
|
|
1
2
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
2
3
|
interface IWorkflowOperationButtonsProps {
|
|
4
|
+
dtd: DcmtTypeDescriptor | undefined;
|
|
3
5
|
approveDisable?: boolean;
|
|
4
6
|
signApproveDisable?: boolean;
|
|
5
7
|
rejectDisable?: boolean;
|
|
@@ -12,7 +14,7 @@ interface IWorkflowOperationButtonsProps {
|
|
|
12
14
|
onReAssign?: () => void;
|
|
13
15
|
onMoreInfo?: () => void;
|
|
14
16
|
}
|
|
15
|
-
export declare const WorkFlowOperationButtons: (
|
|
17
|
+
export declare const WorkFlowOperationButtons: (props: IWorkflowOperationButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export declare const WorkFlowApproveRejectPopUp: ({ TID, DID, deviceType, isReject, selectedItems, onClose, onCompleted }: {
|
|
17
19
|
TID?: number;
|
|
18
20
|
DID?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { Priorities, ResultTypes, SDK_Globals, SDK_Localizator, TaskEngine, UserListCacheService, ValidationItem, WorkflowCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil } from "../../../helper";
|
|
5
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil, isSign4TopEnabled } from "../../../helper";
|
|
6
6
|
import { TMColors } from "../../../utils/theme";
|
|
7
7
|
import TMButton from "../../base/TMButton";
|
|
8
8
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
@@ -65,9 +65,22 @@ const StyledHorizontalContainer = styled.div `
|
|
|
65
65
|
gap: 10px;
|
|
66
66
|
/* align-items: flex-end; */
|
|
67
67
|
`;
|
|
68
|
-
export const WorkFlowOperationButtons = (
|
|
68
|
+
export const WorkFlowOperationButtons = (props) => {
|
|
69
|
+
const { dtd = undefined, deviceType = DeviceType.DESKTOP, approveDisable = false, signApproveDisable = false, rejectDisable = false, reassignDisable = false, infoDisable = false, onApprove, onSignApprove, onReject, onReAssign, onMoreInfo } = props;
|
|
69
70
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
70
|
-
|
|
71
|
+
// Stato per distinguere workflow di firma vs approvazione
|
|
72
|
+
const [isSignWorkflow, setIsSignWorkflow] = useState(false);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
// Controlla se il documento ha dei widget definiti, se il documento ha il widget SIGN4_TOP abilitato, allora è un workflow di firma
|
|
75
|
+
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
76
|
+
setIsSignWorkflow(isSign4TopEnabled(dtd.widgets));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Se non ci sono widget o non è SIGN4_TOP, imposta il workflow di default (approvazione senza firma)
|
|
80
|
+
setIsSignWorkflow(false);
|
|
81
|
+
}
|
|
82
|
+
}, [dtd]);
|
|
83
|
+
return (_jsx(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: isSignWorkflow ? (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: "160px", disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), advancedColor: TMColors.success, color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) : (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: TMColors.success, color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: "tertiary" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) }));
|
|
71
84
|
};
|
|
72
85
|
export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, selectedItems = [], onClose, onCompleted }) => {
|
|
73
86
|
const [commentValue, setCommentValue] = useState('');
|