@topconsultnpm/sdkui-react-beta 6.14.124 → 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.
@@ -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 }) }) :
@@ -3,7 +3,7 @@ import { useState, useEffect, useRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { StyledEditor, StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, editorColorManager } from './TMEditorStyled';
5
5
  import { FontSize, TMColors } from '../../utils/theme';
6
- import { genUniqueId, IconClearButton, IconHide, IconShow } from '../../helper';
6
+ import { genUniqueId, IconClearButton, IconHide, IconShow, SDKUI_Localizator } from '../../helper';
7
7
  import ShowAlert from '../base/TMAlert';
8
8
  import { TMExceptionBoxManager } from '../base/TMPopUp';
9
9
  import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
@@ -58,9 +58,9 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
58
58
  setCurrentValue(maxValue.toString());
59
59
  ShowAlert({
60
60
  mode: 'warning',
61
- message: `Max value is ${maxValue}`,
61
+ message: SDKUI_Localizator.Max_Value.replaceParams(maxValue.toString()),
62
62
  duration: 3000,
63
- title: 'Textbox Warning',
63
+ title: SDKUI_Localizator.Warning,
64
64
  });
65
65
  }
66
66
  // Check minValue
@@ -68,9 +68,9 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
68
68
  setCurrentValue(minValue.toString());
69
69
  ShowAlert({
70
70
  mode: 'warning',
71
- message: `Min value is ${minValue}`,
71
+ message: SDKUI_Localizator.Min_Value.replaceParams(minValue.toString()),
72
72
  duration: 3000,
73
- title: 'Textbox Warning',
73
+ title: SDKUI_Localizator.Warning,
74
74
  });
75
75
  }
76
76
  }
@@ -152,7 +152,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
152
152
  mode: 'warning',
153
153
  message: `Max value is ${max}`,
154
154
  duration: 3000,
155
- title: 'Textbox Warning',
155
+ title: SDKUI_Localizator.Warning,
156
156
  });
157
157
  return;
158
158
  }
@@ -162,7 +162,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
162
162
  mode: 'warning',
163
163
  message: `Min value is ${minValue}`,
164
164
  duration: 3000,
165
- title: 'Textbox Warning',
165
+ title: SDKUI_Localizator.Warning,
166
166
  });
167
167
  return;
168
168
  }
@@ -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, onTaskCreateRequest, fileFromConnector = null, taskFormDialogComponent, }) => {
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 openTaskFormHandler = (onTaskCreated) => {
597
- if (TID && DID) {
598
- const fetchData = async () => {
599
- try {
600
- const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(TID, DID);
601
- if (dtd) {
602
- const isWorkItem = dtd?.templateTID === TemplateTIDs.WF_WIApprView;
603
- const name = `${dtd.name ?? '-'} (DID: ${DID})`;
604
- onTaskCreateRequest?.(isWorkItem
605
- ? { workItem: { tid: TID, did: DID, name } }
606
- : { document: { tid: TID, did: DID, name } }, onTaskCreated);
607
- }
608
- }
609
- catch (error) {
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: onWFOperationCompleted, 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 ?
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.`] }) })), isOpenDetails &&
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 (!taskDescriptor.name || taskDescriptor.name === "")
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
- await SDK_Globals.tmSession?.NewWorkflowEngine().WorkItem_MoreInfoAsync(TID, DID, task);
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%' : '60%', height: '60%', isModal: true, children: [_jsxs(StyledModalContentContainer, { children: [_jsx(TMUserChooser, { label: "Richiedi a", dataSource: users, values: task?.toID ? [task.toID] : [], validationItems: validationItems?.filter(o => o.PropertyName === "Assegnato a"), onValueChanged: (IDs) => {
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, value: task?.name ?? '', isModifiedWhen: task?.description !== taskOrig?.description, autoFocus: true, maxLength: 100, onValueChanged: (e) => { setTask({ ...task ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }), _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 }); },
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, { id: "end-date", 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 }) })] }));
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
  };
@@ -230,6 +230,7 @@ export declare class SDKUI_Localizator {
230
230
  static get Login(): string;
231
231
  static get LogDelete(): "Löschen der Logik" | "Logical delete" | "Cancelación lógica" | "Suppression logique" | "Lógica de cancelamento" | "Cancellazione logica";
232
232
  static get MakeEditable(): "Bearbeitbar machen" | "Make editable" | "Hacer editable" | "Rendre modifiable" | "Faça editável" | "Rendi editabile";
233
+ static get Max_Value(): "Der Maximalwert ist {{0}}" | "The maximum value is {{0}}" | "El valor máximo es {{0}}" | "La valeur maximale est {{0}}" | "O valor máximo é {{0}}" | "Il valore massimo è {{0}}";
233
234
  static get MaxDcmtsToBeReturned(): "Maximale Anzahl von Dokumenten" | "Max number of documents" | "Número máximo de documentos" | "Nombre maximum de documents" | "O número máximo de documentos" | "Numero massimo di documenti";
234
235
  static get Maximize(): "Maximieren" | "Maximize" | "Maximizar" | "Maximiser" | "Massimizza";
235
236
  static get MetadataFlag(): "Markieren von Methadaten" | "Flag metadata" | "Metadato de indicador" | "Mètadonnée de marque" | "Marcação de metadados" | "Metadato di contrassegno";
@@ -259,6 +260,7 @@ export declare class SDKUI_Localizator {
259
260
  static get MetadataSystem(): "System-Methadaten" | "System metadata" | "Metadatos de sistema" | "Métadonnées de système" | "Metadados system" | "Metadati di sistema";
260
261
  static get MetadataUsers(): "Benutzermetadaten" | "User metadata" | "Metadatos de usuario" | "Métadonnées de l'utilisateur" | "Metadados do usuário" | "Metadati utente";
261
262
  static get Message(): "Nachricht" | "Message" | "Mensaje" | "Mensagem" | "Messaggio";
263
+ static get Min_Value(): "Der Minimalwert ist {{0}}" | "The minimum value is {{0}}" | "El valor mínimo es {{0}}" | "La valeur minimale est {{0}}" | "O valor mínimo é {{0}}" | "Il valore minimo è {{0}}";
262
264
  static get Minimize(): "Minimieren" | "Minimize" | "Minimizar" | "Minimiser" | "Minimizza";
263
265
  static get More(): "andere" | "more" | "otros" | "autres" | "outros" | "altri";
264
266
  static get MoreInformation(): "Mehr Informationen" | "More information" | "Más información" | "Plus d'informations" | "Mais informações" | "Maggiori informazioni";
@@ -469,6 +471,7 @@ export declare class SDKUI_Localizator {
469
471
  static get ViewWithCheckOption(): "Kontrolle über Archivierung und Bearbeitung" | "Check on archive and update" | "Control en almacenamiento y modificación" | "Contrôle de l'archivage et la modifie" | "Controle de arquivamento e edição" | "Controllo su archiviazione e modifica";
470
472
  static get Visible(): "Sichtbar" | "Visible" | "Visibles" | "Visibiles" | "Visíveis" | "Visibili";
471
473
  static get VisibleItems(): "sichtbare Elemente" | "Visible items" | "elementos visibles" | "éléments visibles" | "itens visíveis" | "Elementi visibili";
474
+ static get Warning(): "Warnung" | "Warning" | "advertencia" | "avertissement" | "aviso" | "Avviso";
472
475
  static get WelcomeTo(): "Willkommen bei {{0}}" | "Welcome to {{0}}" | "Bienvenido a {{0}}" | "Bienvenue sur {{0}}" | "Bem-vindo à {{0}}" | "Benvenuto su {{0}}";
473
476
  static get WorkflowApproval(): "Workflow-Genehmigung" | "Workflow approval" | "Aprobación de flujo de trabajo" | "Approbation de workflow" | "Aprovação de fluxo de trabalho" | "Approvazione workflow";
474
477
  static get WorkGroup(): "Arbeitsgruppe" | "Work Group" | "Grupo de Trabajo" | "Groupe de travail" | "Grupo de Trabalho" | "Gruppo di lavoro";
@@ -2260,6 +2260,16 @@ export class SDKUI_Localizator {
2260
2260
  default: return "Rendi editabile";
2261
2261
  }
2262
2262
  }
2263
+ static get Max_Value() {
2264
+ switch (this._cultureID) {
2265
+ case CultureIDs.De_DE: return "Der Maximalwert ist {{0}}";
2266
+ case CultureIDs.En_US: return "The maximum value is {{0}}";
2267
+ case CultureIDs.Es_ES: return "El valor máximo es {{0}}";
2268
+ case CultureIDs.Fr_FR: return "La valeur maximale est {{0}}";
2269
+ case CultureIDs.Pt_PT: return "O valor máximo é {{0}}";
2270
+ default: return "Il valore massimo è {{0}}";
2271
+ }
2272
+ }
2263
2273
  static get MaxDcmtsToBeReturned() {
2264
2274
  switch (this._cultureID) {
2265
2275
  case CultureIDs.De_DE: return "Maximale Anzahl von Dokumenten";
@@ -2541,6 +2551,16 @@ export class SDKUI_Localizator {
2541
2551
  default: return "Messaggio";
2542
2552
  }
2543
2553
  }
2554
+ static get Min_Value() {
2555
+ switch (this._cultureID) {
2556
+ case CultureIDs.De_DE: return "Der Minimalwert ist {{0}}";
2557
+ case CultureIDs.En_US: return "The minimum value is {{0}}";
2558
+ case CultureIDs.Es_ES: return "El valor mínimo es {{0}}";
2559
+ case CultureIDs.Fr_FR: return "La valeur minimale est {{0}}";
2560
+ case CultureIDs.Pt_PT: return "O valor mínimo é {{0}}";
2561
+ default: return "Il valore minimo è {{0}}";
2562
+ }
2563
+ }
2544
2564
  static get Minimize() {
2545
2565
  switch (this._cultureID) {
2546
2566
  case CultureIDs.De_DE: return "Minimieren";
@@ -4649,6 +4669,16 @@ export class SDKUI_Localizator {
4649
4669
  default: return "Elementi visibili";
4650
4670
  }
4651
4671
  }
4672
+ static get Warning() {
4673
+ switch (this._cultureID) {
4674
+ case CultureIDs.De_DE: return "Warnung";
4675
+ case CultureIDs.En_US: return "Warning";
4676
+ case CultureIDs.Es_ES: return "advertencia";
4677
+ case CultureIDs.Fr_FR: return "avertissement";
4678
+ case CultureIDs.Pt_PT: return "aviso";
4679
+ default: return "Avviso";
4680
+ }
4681
+ }
4652
4682
  static get WelcomeTo() {
4653
4683
  switch (this._cultureID) {
4654
4684
  case CultureIDs.De_DE: return "Willkommen bei {{0}}";
@@ -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;
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.14.124",
3
+ "version": "6.14.126",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",