@topconsultnpm/sdkui-react-beta 6.14.125 → 6.14.126
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/choosers/TMUserChooser.js +2 -2
- package/lib/components/editors/TMMetadataValues.js +1 -1
- package/lib/components/features/blog/TMBlogCommentForm.js +1 -0
- package/lib/components/features/documents/TMDcmtForm.d.ts +2 -0
- package/lib/components/features/documents/TMDcmtForm.js +25 -23
- package/lib/components/features/workflow/TMWorkflowPopup.js +36 -8
- package/lib/helper/helpers.d.ts +2 -0
- package/lib/helper/helpers.js +2 -0
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import TMSummary from '../editors/TMSummary';
|
|
|
9
9
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
10
|
import { TMColors } from '../../utils/theme';
|
|
11
11
|
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
12
|
-
const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false }) => {
|
|
12
|
+
const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false }) => {
|
|
13
13
|
const [showChooser, setShowChooser] = useState(initialShowChooser);
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
setShowChooser(initialShowChooser);
|
|
@@ -19,7 +19,7 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
|
|
|
19
19
|
const isPlaceholder = values?.[0] === placeHolder;
|
|
20
20
|
return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMUserIdViewer, { userId: values?.[0], showIcon: true, noneSelectionText: '' }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
21
21
|
};
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, width: width, disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
23
23
|
_jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, onClose: () => {
|
|
24
24
|
setShowChooser(false);
|
|
25
25
|
summaryInputRef.current?.focus();
|
|
@@ -297,7 +297,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
297
297
|
break;
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
|
-
return (_jsxs("div", { style: { width: '100%' }, children: [_jsx(TMAccordion, { title: SDKUI_Localizator.DocumentData, children: documentData.map(item => renderMetadataItem(item)) }), _jsx(TMAccordion, { title: SDKUI_Localizator.WorkItemData, children: workItemData.map(item => renderMetadataItem(item, true)) }), _jsx(TMAccordion, { title: SDKUI_Localizator.WorkItemTechnicalData, defaultCollapsed: true, children: technicalWorkItemData.map(item => renderMetadataItem(item, true)) })] }));
|
|
300
|
+
return (_jsxs("div", { style: { width: '100%' }, children: [documentData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.DocumentData, children: documentData.map(item => renderMetadataItem(item)) }), workItemData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.WorkItemData, children: workItemData.map(item => renderMetadataItem(item, true)) }), technicalWorkItemData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.WorkItemTechnicalData, defaultCollapsed: true, children: technicalWorkItemData.map(item => renderMetadataItem(item, true)) })] }));
|
|
301
301
|
};
|
|
302
302
|
return (_jsx(StyledMetadataValuesContainer, { children: !TID ?
|
|
303
303
|
_jsx(TMNothingToShow, { text: 'Nessun documento selezionato.', secondText: 'Metadati di sistema non disponibile.', icon: _jsx(IconDcmtTypeSys, { fontSize: 96 }) }) :
|
|
@@ -94,6 +94,7 @@ const TMBlogCommentForm = (props) => {
|
|
|
94
94
|
}, [participants]);
|
|
95
95
|
const onSaveAsync = async () => {
|
|
96
96
|
try {
|
|
97
|
+
console.log('onSaveAsync', context);
|
|
97
98
|
// Show a loading spinner with a localized description
|
|
98
99
|
TMSpinner.show({ description: SDKUI_Localizator.Comment });
|
|
99
100
|
// Exit early if the engine or its required identifiers are undefined
|
|
@@ -19,12 +19,14 @@ interface ITMDcmtFormProps {
|
|
|
19
19
|
groupId?: string;
|
|
20
20
|
invokedByTodo?: boolean;
|
|
21
21
|
taskFormDialogComponent?: React.ReactNode;
|
|
22
|
+
taskMoreInfo?: TaskDescriptor;
|
|
22
23
|
onNext?: () => void;
|
|
23
24
|
onPrev?: () => void;
|
|
24
25
|
onClose?: () => void;
|
|
25
26
|
onSavedAsyncCallback?: (tid: number | undefined, did: number | undefined) => Promise<void>;
|
|
26
27
|
onSaveRecents?: (TIDs: number[]) => void;
|
|
27
28
|
onWFOperationCompleted?: () => Promise<void>;
|
|
29
|
+
onTaskCompleted?: (task: TaskDescriptor) => void;
|
|
28
30
|
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
29
31
|
isModal?: boolean;
|
|
30
32
|
titleModal?: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
|
|
4
|
+
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, MetadataDataTypes, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
|
|
5
5
|
import { ContextMenu } from 'devextreme-react';
|
|
6
6
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
7
7
|
import { DownloadTypes, FormModes } from '../../../ts';
|
|
8
8
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
9
9
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
10
10
|
import { handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
11
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview } from '../../../helper';
|
|
11
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo } from '../../../helper';
|
|
12
12
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
13
13
|
import { TMColors } from '../../../utils/theme';
|
|
14
14
|
import { StyledFormButtonsContainer, StyledModalContainer, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -32,9 +32,10 @@ import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerCon
|
|
|
32
32
|
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
33
33
|
import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
|
|
34
34
|
import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
|
|
35
|
+
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
35
36
|
let abortControllerLocal = new AbortController();
|
|
36
37
|
//#endregion
|
|
37
|
-
const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted,
|
|
38
|
+
const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, fileFromConnector = null, taskFormDialogComponent, taskMoreInfo }) => {
|
|
38
39
|
const [id, setID] = useState('');
|
|
39
40
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
40
41
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -69,6 +70,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
69
70
|
const [showAll, setShowAll] = useState(layoutMode === LayoutModes.Ark);
|
|
70
71
|
const [fetchError, setFetchError] = useState(false);
|
|
71
72
|
const [workItems, setWorkItems] = useState([]);
|
|
73
|
+
const [showCommentForm, setShowCommentForm] = useState(false);
|
|
72
74
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
73
75
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
|
|
74
76
|
// Custom hook to manage workflow approval data
|
|
@@ -240,6 +242,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
240
242
|
const isDetailsDisabled = layoutMode !== LayoutModes.Update || !DID;
|
|
241
243
|
const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
|
|
242
244
|
const showToppyForApprove = layoutMode === LayoutModes.Update && !fetchError && workItems.length > 0 && !isOpenDetails && !isOpenMaster;
|
|
245
|
+
const showToppyForCompleteMoreInfo = layoutMode === LayoutModes.Update && isTaskMoreInfo(taskMoreInfo?.name) && taskMoreInfo?.state !== Task_States.Completed;
|
|
243
246
|
const approvalVID = workItems.length > 0
|
|
244
247
|
? Number(workItems[0].tid) : -1;
|
|
245
248
|
const commandsMenuItems = [
|
|
@@ -593,24 +596,20 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
593
596
|
// Return the appropriate layout based on context
|
|
594
597
|
return invokedByTodo ? settings?.layoutToDo : settings?.layout;
|
|
595
598
|
};
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
console.error("Error fetching data:", error);
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
fetchData();
|
|
599
|
+
const completeMoreInfoCallback = async () => {
|
|
600
|
+
try {
|
|
601
|
+
TMSpinner.show();
|
|
602
|
+
let newTask = { ...taskMoreInfo, state: Task_States.Completed };
|
|
603
|
+
await SDK_Globals.tmSession?.NewTaskEngine().UpdateAsync(newTask);
|
|
604
|
+
onTaskCompleted?.(newTask);
|
|
605
|
+
onClose?.();
|
|
606
|
+
}
|
|
607
|
+
catch (e) {
|
|
608
|
+
TMSpinner.hide();
|
|
609
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
610
|
+
}
|
|
611
|
+
finally {
|
|
612
|
+
TMSpinner.hide();
|
|
614
613
|
}
|
|
615
614
|
};
|
|
616
615
|
const renderDcmtForm = () => {
|
|
@@ -639,10 +638,13 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
639
638
|
isEditable: true,
|
|
640
639
|
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
641
640
|
}));
|
|
642
|
-
} }), 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:
|
|
641
|
+
} }), 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 ?
|
|
643
642
|
_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: () => ShowAlert({ message: 'TODO', mode: 'info', title: SDKUI_Localizator.SignatureAndApprove, duration: 3000 }), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true) }) })
|
|
644
643
|
:
|
|
645
|
-
_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.`] }) })),
|
|
644
|
+
_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: { paddingRight: 15, 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: `Completa l'attività di richiesta di maggiori informazioni inviata da ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: 'Commenta e completa', color: 'success', showTooltip: false, onClick: () => {
|
|
645
|
+
setShowCommentForm(true);
|
|
646
|
+
} })] }) })), (showCommentForm && TID && DID) &&
|
|
647
|
+
_jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: TID, did: DID } }, onClose: () => setShowCommentForm(false), refreshCallback: completeMoreInfoCallback, participants: [], showAttachmentsSection: false }), isOpenDetails &&
|
|
646
648
|
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false) }) }), isOpenMaster &&
|
|
647
649
|
_jsxs(StyledModalContainer, { style: { backgroundColor: 'white' }, children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
648
650
|
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, 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-beta';
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, IconSignature, DateDisplayTypes } from "../../../helper";
|
|
5
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, IconSignature, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME } from "../../../helper";
|
|
6
6
|
import { TMColors } from "../../../utils/theme";
|
|
7
7
|
import TMButton from "../../base/TMButton";
|
|
8
8
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
@@ -51,6 +51,17 @@ const StyledModalContentContainer = styled.div `
|
|
|
51
51
|
flex-direction: column;
|
|
52
52
|
gap: 5px;
|
|
53
53
|
`;
|
|
54
|
+
const StyledHorizontalContainer = styled.div `
|
|
55
|
+
display: flex;
|
|
56
|
+
gap: 10px;
|
|
57
|
+
/* align-items: flex-end; */
|
|
58
|
+
`;
|
|
59
|
+
const StyledNameInputContainer = styled.div `
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 10px;
|
|
63
|
+
width: 100%;
|
|
64
|
+
`;
|
|
54
65
|
export const WorkFlowOperationButtons = ({ deviceType = DeviceType.DESKTOP, approveDisable = false, signApproveDisable = false, reassignDisable = false, rejectDisable = false, infoDisable = false, onApprove, onSignApprove, onReAssign, onReject, onMoreInfo }) => {
|
|
55
66
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
56
67
|
return (_jsxs(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, 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(IconSignature, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: '160px', disabled: approveDisable, 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(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' })] }));
|
|
@@ -154,11 +165,12 @@ export const WorkFlowMoreInfoPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
|
|
|
154
165
|
const [task, setTask] = useState();
|
|
155
166
|
const [taskOrig, setTaskOrig] = useState();
|
|
156
167
|
const [validationItems, setValidationItems] = useState([]);
|
|
168
|
+
const [nameInput, setNameInput] = useState(''); // State to hold the input value for the name
|
|
157
169
|
const disable = validationItems.filter(o => o.ResultType === ResultTypes.ERROR).length > 0;
|
|
158
170
|
const validatorMoreInfoAsync = async (taskDescriptor) => {
|
|
159
171
|
let vil = [];
|
|
160
172
|
// Validate task name
|
|
161
|
-
if (!
|
|
173
|
+
if (!nameInput || nameInput === "")
|
|
162
174
|
vil.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.Name, `${SDK_Localizator.RequiredField}`));
|
|
163
175
|
// Validate name length (max 100)
|
|
164
176
|
if (taskDescriptor.name && taskDescriptor.name.length > 100) {
|
|
@@ -188,7 +200,12 @@ export const WorkFlowMoreInfoPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
|
|
|
188
200
|
const requestMoreInfoAsync = async () => {
|
|
189
201
|
try {
|
|
190
202
|
TMSpinner.show();
|
|
191
|
-
|
|
203
|
+
// Ensure the task name includes the prefix before sending
|
|
204
|
+
const taskWithPrefix = {
|
|
205
|
+
...task,
|
|
206
|
+
name: `${TASK_MORE_INFO_PREFIX_NAME}${nameInput}`
|
|
207
|
+
};
|
|
208
|
+
await SDK_Globals.tmSession?.NewWorkflowEngine().WorkItem_MoreInfoAsync(TID, DID, taskWithPrefix);
|
|
192
209
|
}
|
|
193
210
|
catch (e) {
|
|
194
211
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -203,16 +220,22 @@ export const WorkFlowMoreInfoPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
|
|
|
203
220
|
const fetchData = async () => {
|
|
204
221
|
TMSpinner.show({ description: SDKUI_Localizator.LoadingParticipants });
|
|
205
222
|
try {
|
|
206
|
-
console.log('TID', TID);
|
|
207
223
|
let newTask = TaskEngine.NewTaskDescriptor();
|
|
208
224
|
newTask.toID = 0;
|
|
225
|
+
// Initialize nameInput from task.name if it exists and remove the prefix
|
|
226
|
+
const initialName = newTask.name?.startsWith(TASK_MORE_INFO_PREFIX_NAME)
|
|
227
|
+
? newTask.name.substring(TASK_MORE_INFO_PREFIX_NAME.length)
|
|
228
|
+
: newTask.name || '';
|
|
229
|
+
setNameInput(initialName);
|
|
230
|
+
// Set task name with prefix for internal state consistency if needed by validation,
|
|
231
|
+
// or ensure validation handles it correctly. For now, we'll keep nameInput for the TMTextBox.
|
|
232
|
+
newTask.name = `${TASK_MORE_INFO_PREFIX_NAME}${initialName}`;
|
|
209
233
|
setTask(newTask);
|
|
210
234
|
setTaskOrig(structuredClone(newTask));
|
|
211
235
|
validatorMoreInfoAsync(newTask);
|
|
212
236
|
// Recupera tutti gli utenti (tranne me)
|
|
213
237
|
const allUsers = await UserListCacheService.GetAllAsync();
|
|
214
238
|
const filteredUsers = allUsers.filter(u => u.id !== SDK_Globals.tmSession?.SessionDescr?.userID);
|
|
215
|
-
console.log('filteredUsers', filteredUsers);
|
|
216
239
|
setUsers(filteredUsers);
|
|
217
240
|
}
|
|
218
241
|
catch (e) {
|
|
@@ -243,11 +266,16 @@ export const WorkFlowMoreInfoPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
|
|
|
243
266
|
}
|
|
244
267
|
});
|
|
245
268
|
};
|
|
246
|
-
return (_jsxs(TMModal, { title: SDKUI_Localizator.MoreInformation, onClose: onClose, width: deviceType === DeviceType.MOBILE ? '95%' : '
|
|
269
|
+
return (_jsxs(TMModal, { title: SDKUI_Localizator.MoreInformation, onClose: onClose, width: deviceType === DeviceType.MOBILE ? '95%' : '640px', height: deviceType === DeviceType.MOBILE ? '60%' : '380px', isModal: true, children: [_jsxs(StyledModalContentContainer, { children: [_jsx(TMUserChooser, { width: "250px", label: "Richiedi a", dataSource: users, values: task?.toID ? [task.toID] : [], validationItems: validationItems?.filter(o => o.PropertyName === "Assegnato a"), onValueChanged: (IDs) => {
|
|
247
270
|
if (IDs === undefined)
|
|
248
271
|
return;
|
|
249
272
|
setTask({ ...task ?? {}, toID: IDs?.[0] });
|
|
250
|
-
} }), _jsx(TMTextBox, { label: SDKUI_Localizator.Name,
|
|
273
|
+
} }), _jsxs(StyledNameInputContainer, { children: [_jsx(TMTextBox, { label: SDKUI_Localizator.Name, width: "250px", value: nameInput, isModifiedWhen: nameInput !== (taskOrig?.name?.startsWith(TASK_MORE_INFO_PREFIX_NAME) ? taskOrig.name.substring(TASK_MORE_INFO_PREFIX_NAME.length) : taskOrig?.name || ''), autoFocus: true, maxLength: 100 - TASK_MORE_INFO_PREFIX_NAME.length, onValueChanged: (e) => {
|
|
274
|
+
const newValue = e.target.value;
|
|
275
|
+
setNameInput(newValue);
|
|
276
|
+
// Update task.name with the prefix
|
|
277
|
+
setTask({ ...task ?? {}, name: `${TASK_MORE_INFO_PREFIX_NAME}${newValue}` });
|
|
278
|
+
}, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }), _jsx("p", { style: { fontStyle: 'italic', marginTop: '8px' }, children: `${TASK_MORE_INFO_PREFIX_NAME}${nameInput}` })] }), _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: task?.description ?? '', rows: 2, maxLength: 200, isModifiedWhen: task?.description !== task?.description, onValueChanged: (e) => { setTask({ ...task ?? {}, description: e.target.value }); },
|
|
251
279
|
// validationItems={validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description)}
|
|
252
|
-
resize: false }), _jsx(TMDropDown, { label: "Priorità", value: task?.priority, dataSource: getPriorityLocalizatorValues(), isModifiedWhen: task?.priority !== taskOrig?.priority, onValueChanged: (e) => setTask({ ...task ?? {}, priority: e?.target?.value }) }), _jsx(TMDateBox, {
|
|
280
|
+
resize: false }), _jsxs(StyledHorizontalContainer, { children: [_jsx(TMDropDown, { label: "Priorità", width: "250px", value: task?.priority, dataSource: getPriorityLocalizatorValues(), isModifiedWhen: task?.priority !== taskOrig?.priority, onValueChanged: (e) => setTask({ ...task ?? {}, priority: e?.target?.value }) }), _jsx(TMDateBox, { width: "250px", resetTimeToZeroOnKeyPress: false, padding: "10px 0px", label: "Entro il", dateDisplayType: DateDisplayTypes.DateTime, value: task?.endTime, isModifiedWhen: task?.endTime !== taskOrig?.endTime, onValueChange: (value) => { setTask({ ...task ?? {}, endTime: value }); }, showClearButton: true })] })] }), _jsx(StyledModalFooter, { children: _jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, icon: _jsx(IconUser, { fontSize: 16 }), caption: "Richiedi", disabled: disable, onClick: () => !disable && requestMoreInfoAsync(), advancedColor: TMColors.tertiary }) })] }));
|
|
253
281
|
};
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare const getSystemMetadata: (withPerm?: boolean) => MetadataDescript
|
|
|
22
22
|
export declare function deepCompare(obj1: any, obj2: any): boolean;
|
|
23
23
|
export declare const extensionHandler: (fileExt: string | undefined) => FileExtensionHandler;
|
|
24
24
|
export declare const downloadBase64File: (base64Data: string, fileName: string) => void;
|
|
25
|
+
export declare const TASK_MORE_INFO_PREFIX_NAME: string;
|
|
26
|
+
export declare const isTaskMoreInfo: (taskName: string | undefined) => boolean | undefined;
|
|
25
27
|
export declare const canNext: (visibleItems: any[], selectedItems: any[]) => boolean;
|
|
26
28
|
export declare const getNext: (visibleItems: any[], selectedItems: any[]) => any;
|
|
27
29
|
export declare const canPrev: (visibleItems: any[], selectedItems: any[]) => boolean;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -494,6 +494,8 @@ export const downloadBase64File = (base64Data, fileName) => {
|
|
|
494
494
|
// Libera l'URL del Blob
|
|
495
495
|
URL.revokeObjectURL(blobUrl);
|
|
496
496
|
};
|
|
497
|
+
export const TASK_MORE_INFO_PREFIX_NAME = `${SDKUI_Localizator.MoreInformation} - `;
|
|
498
|
+
export const isTaskMoreInfo = (taskName) => taskName?.startsWith(TASK_MORE_INFO_PREFIX_NAME);
|
|
497
499
|
//#region Form, Page Helpers
|
|
498
500
|
export const canNext = (visibleItems, selectedItems) => {
|
|
499
501
|
if (!visibleItems)
|