@topconsultnpm/sdkui-react 6.20.0-dev1.2 → 6.20.0-dev1.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 +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
- package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
- package/lib/components/base/TMAccordion.js +2 -2
- package/lib/components/base/TMCustomButton.js +0 -1
- package/lib/components/base/TMDataGrid.d.ts +2 -2
- package/lib/components/base/TMDataGrid.js +16 -5
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +20 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
- package/lib/components/features/documents/TMDcmtBlog.js +29 -2
- package/lib/components/features/documents/TMDcmtForm.js +270 -173
- package/lib/components/features/documents/TMDcmtPreview.js +100 -33
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
- package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
- package/lib/components/features/search/TMSearchResult.js +76 -114
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +16 -17
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +2 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +13 -14
- package/lib/helper/SDKUI_Globals.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +8 -0
- package/lib/helper/SDKUI_Localizator.js +98 -0
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +51 -0
- package/lib/helper/checkinCheckoutManager.d.ts +85 -0
- package/lib/helper/checkinCheckoutManager.js +348 -0
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.js +7 -1
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +29 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +12 -10
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
- package/lib/helper/cicoHelper.d.ts +0 -31
- package/lib/helper/cicoHelper.js +0 -155
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import { ContextMenu } from 'devextreme-react';
|
|
4
|
+
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
6
5
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
7
6
|
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
8
7
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
9
8
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
10
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
11
10
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
12
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts,
|
|
11
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail, getDcmtCicoStatus, IconFileDots } from '../../../helper';
|
|
13
12
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
14
13
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
15
14
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -42,9 +41,15 @@ import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
|
42
41
|
import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
43
42
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
44
43
|
import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
|
|
44
|
+
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
45
|
+
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
46
|
+
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
47
|
+
import styled from 'styled-components';
|
|
48
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
45
49
|
let abortControllerLocal = new AbortController();
|
|
46
50
|
//#endregion
|
|
47
51
|
const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, 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, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
52
|
+
const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
|
|
48
53
|
const [id, setID] = useState('');
|
|
49
54
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
50
55
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -68,6 +73,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
68
73
|
const [layout, setLayout] = useState();
|
|
69
74
|
const [customButtonsLayout, setCustomButtonsLayout] = useState();
|
|
70
75
|
const [customButton, setCustomButton] = useState();
|
|
76
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
71
77
|
const appliedInputMidsRef = useRef(null);
|
|
72
78
|
// Refs per evitare stale closure nei callback
|
|
73
79
|
// I useCallback catturano i valori delle dipendenze al momento della creazione.
|
|
@@ -96,10 +102,18 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
96
102
|
const [isInitialLoading, setIsInitialLoading] = useState(true);
|
|
97
103
|
const [isNavigating, setIsNavigating] = useState(false);
|
|
98
104
|
const [dcmtReferences, setDcmtReferences] = useState(undefined);
|
|
99
|
-
//
|
|
100
|
-
const [
|
|
101
|
-
const
|
|
102
|
-
|
|
105
|
+
// Stato per triggerare il refresh del blog dall'esterno
|
|
106
|
+
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
107
|
+
const triggerBlogRefresh = useCallback(async () => {
|
|
108
|
+
setRefreshBlogTrigger(prev => prev + 1);
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
const fetchAllUsers = async () => {
|
|
112
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
113
|
+
setAllUsers(users ?? []);
|
|
114
|
+
};
|
|
115
|
+
fetchAllUsers();
|
|
116
|
+
}, []);
|
|
103
117
|
useEffect(() => {
|
|
104
118
|
if (!allowButtonsRefs)
|
|
105
119
|
setDcmtReferences(undefined);
|
|
@@ -123,7 +137,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
123
137
|
selectMIDs: selectMIDs,
|
|
124
138
|
dtdResult: {
|
|
125
139
|
rows: [rowValues],
|
|
126
|
-
columns: selectMIDs.map(mid => ({ name: `MID_${mid}
|
|
140
|
+
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
127
141
|
},
|
|
128
142
|
dcmtsFound: 1,
|
|
129
143
|
dcmtsReturned: 1
|
|
@@ -237,8 +251,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
237
251
|
// Imposta il layout e customButtonsLayout immediatamente
|
|
238
252
|
setLayout(resLayout);
|
|
239
253
|
if (layoutMode === LayoutModes.Update && customButtonsLayoutResult) {
|
|
240
|
-
|
|
241
|
-
//setCustomButtonsLayout(customButtonsLayoutResult);
|
|
254
|
+
setCustomButtonsLayout(customButtonsLayoutResult);
|
|
242
255
|
}
|
|
243
256
|
// Carica DTD e metadata
|
|
244
257
|
let dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(TID, DID, getMetadataResult);
|
|
@@ -410,6 +423,21 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
410
423
|
const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
|
|
411
424
|
// Valore derivato: true se formData ha elementi validi
|
|
412
425
|
const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
|
|
426
|
+
const handleCheckOutOperationCallback = async (checkout) => {
|
|
427
|
+
if (!currentDcmt)
|
|
428
|
+
return;
|
|
429
|
+
await handleCheckOutCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, updateCurrentDcmt);
|
|
430
|
+
};
|
|
431
|
+
const handleCheckInOperationCallback = async () => {
|
|
432
|
+
if (!currentDcmt)
|
|
433
|
+
return;
|
|
434
|
+
await handleCheckInCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, fileName: fromDTD?.name ?? SDKUI_Localizator.SearchResult }, updateCurrentDcmt, undefined);
|
|
435
|
+
};
|
|
436
|
+
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
437
|
+
if (!currentDcmt)
|
|
438
|
+
return;
|
|
439
|
+
copyCheckoutPathToClipboardCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
|
|
440
|
+
};
|
|
413
441
|
useEffect(() => {
|
|
414
442
|
const loadAllWfData = async () => {
|
|
415
443
|
if (layoutMode !== LayoutModes.Update || !DID || fromDTD?.templateTID !== TemplateTIDs.WF_WIApprView) {
|
|
@@ -516,23 +544,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
516
544
|
const items = [];
|
|
517
545
|
const operationsItems = [];
|
|
518
546
|
operationsItems.push({
|
|
519
|
-
icon:
|
|
520
|
-
operationType: 'singleRow',
|
|
547
|
+
icon: _jsx(IconDownload, {}),
|
|
521
548
|
disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
|
|
522
|
-
|
|
549
|
+
name: SDKUI_Localizator.DownloadFile,
|
|
523
550
|
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download", undefined, undefined, true)
|
|
524
551
|
}, {
|
|
525
|
-
icon:
|
|
526
|
-
operationType: 'singleRow',
|
|
552
|
+
icon: _jsx(IconDownload, {}),
|
|
527
553
|
disabled: !isXMLFileExt(currentDcmt?.fileExt),
|
|
528
|
-
|
|
554
|
+
name: SDKUI_Localizator.DownloadXMLAttachments,
|
|
529
555
|
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
|
|
530
556
|
});
|
|
531
557
|
if (layoutMode === LayoutModes.Update && DID) {
|
|
532
558
|
operationsItems.push({
|
|
533
|
-
icon:
|
|
534
|
-
|
|
535
|
-
operationType: 'singleRow',
|
|
559
|
+
icon: _jsx(IconStar, {}),
|
|
560
|
+
name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
|
|
536
561
|
disabled: false,
|
|
537
562
|
onClick: async () => {
|
|
538
563
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
|
|
@@ -541,9 +566,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
541
566
|
}
|
|
542
567
|
if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
|
|
543
568
|
operationsItems.push({
|
|
544
|
-
icon:
|
|
545
|
-
|
|
546
|
-
operationType: 'singleRow',
|
|
569
|
+
icon: _jsx(IconActivity, {}),
|
|
570
|
+
name: SDKUI_Localizator.CreateContextualTask,
|
|
547
571
|
disabled: false,
|
|
548
572
|
onClick: () => {
|
|
549
573
|
const dcmt = getDcmts()[0];
|
|
@@ -560,76 +584,106 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
560
584
|
}
|
|
561
585
|
if (operationsItems.length > 0) {
|
|
562
586
|
items.push({
|
|
563
|
-
icon:
|
|
564
|
-
|
|
565
|
-
|
|
587
|
+
icon: _jsx(IconCheck, {}),
|
|
588
|
+
name: SDKUI_Localizator.DocumentOperations,
|
|
589
|
+
submenu: operationsItems
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
if (fromDTD?.id !== SystemTIDs.Drafts) {
|
|
593
|
+
// Check in/Check out menu
|
|
594
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
595
|
+
items.push({
|
|
596
|
+
icon: _jsx(IconFileDots, {}),
|
|
597
|
+
name: "Check in/Check out",
|
|
598
|
+
disabled: false,
|
|
599
|
+
submenu: [
|
|
600
|
+
{
|
|
601
|
+
name: 'Check out',
|
|
602
|
+
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
603
|
+
onClick: () => handleCheckOutOperationCallback(true),
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
name: 'Check in',
|
|
607
|
+
onClick: () => handleCheckInOperationCallback(),
|
|
608
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: SDKUI_Localizator.CancelCheckOut,
|
|
612
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
613
|
+
onClick: () => handleCheckOutOperationCallback(false),
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: SDKUI_Localizator.CheckoutInfo,
|
|
617
|
+
onClick: showCheckoutInformationFormCallback,
|
|
618
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: SDKUI_Localizator.CopyCheckoutPath,
|
|
622
|
+
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
623
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: SDKUI_Localizator.History,
|
|
627
|
+
disabled: !cicoEnabled,
|
|
628
|
+
onClick: showHistoryCallback,
|
|
629
|
+
},
|
|
630
|
+
]
|
|
566
631
|
});
|
|
567
632
|
}
|
|
568
633
|
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
569
634
|
const relationsItems = [
|
|
570
635
|
{
|
|
571
|
-
icon:
|
|
572
|
-
|
|
573
|
-
operationType: 'singleRow',
|
|
636
|
+
icon: _jsx(IconPair, {}),
|
|
637
|
+
name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
574
638
|
disabled: !hasManyToManyRelation,
|
|
575
639
|
onClick: async () => await pairManyToMany?.(true)
|
|
576
640
|
},
|
|
577
641
|
{
|
|
578
|
-
icon:
|
|
579
|
-
|
|
580
|
-
operationType: 'singleRow',
|
|
642
|
+
icon: _jsx(IconUnpair, {}),
|
|
643
|
+
name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
581
644
|
disabled: !hasManyToManyRelation,
|
|
582
645
|
onClick: async () => await pairManyToMany?.(false)
|
|
583
646
|
},
|
|
584
647
|
{
|
|
585
|
-
icon:
|
|
586
|
-
|
|
587
|
-
operationType: 'singleRow',
|
|
588
|
-
beginGroup: true,
|
|
648
|
+
icon: _jsx(IconArchiveMaster, {}),
|
|
649
|
+
name: SDKUI_Localizator.ArchiveMasterDocument,
|
|
589
650
|
disabled: canArchiveMasterRelation !== true,
|
|
590
651
|
onClick: async () => { if (TID)
|
|
591
652
|
await archiveMasterDocuments?.(TID); }
|
|
592
653
|
},
|
|
593
654
|
{
|
|
594
|
-
icon:
|
|
595
|
-
|
|
596
|
-
operationType: 'singleRow',
|
|
655
|
+
icon: _jsx(IconArchiveDetail, {}),
|
|
656
|
+
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
597
657
|
disabled: canArchiveDetailRelation !== true,
|
|
598
658
|
onClick: async () => { if (TID)
|
|
599
659
|
await archiveDetailDocuments?.(TID); }
|
|
600
660
|
},
|
|
601
661
|
{
|
|
602
|
-
icon:
|
|
603
|
-
|
|
604
|
-
operationType: 'singleRow',
|
|
605
|
-
visible: true,
|
|
606
|
-
beginGroup: true,
|
|
662
|
+
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
|
|
663
|
+
name: SDKUI_Localizator.DcmtsMaster,
|
|
607
664
|
disabled: !currentTIDHasMasterRelations || isMasterDisabled,
|
|
608
665
|
onClick: () => { if (!isMasterDisabled)
|
|
609
666
|
setIsOpenMaster(!isOpenMaster); }
|
|
610
667
|
},
|
|
611
668
|
{
|
|
612
|
-
icon:
|
|
613
|
-
|
|
614
|
-
operationType: 'singleRow',
|
|
669
|
+
icon: _jsx(IconDetailDcmts, {}),
|
|
670
|
+
name: SDKUI_Localizator.DcmtsDetail,
|
|
615
671
|
disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
|
|
616
|
-
visible: true,
|
|
617
672
|
onClick: () => { if (!isDetailsDisabled)
|
|
618
673
|
setIsOpenDetails(!isOpenDetails); }
|
|
619
674
|
}
|
|
620
675
|
];
|
|
621
676
|
items.push({
|
|
622
|
-
icon:
|
|
623
|
-
|
|
624
|
-
|
|
677
|
+
icon: _jsx(IconRelation, {}),
|
|
678
|
+
name: SDKUI_Localizator.Relations,
|
|
679
|
+
submenu: relationsItems
|
|
625
680
|
});
|
|
626
681
|
}
|
|
627
682
|
if (layoutMode === LayoutModes.Update && DID) {
|
|
628
683
|
const fullTextItems = [
|
|
629
684
|
{
|
|
630
|
-
icon:
|
|
631
|
-
|
|
632
|
-
operationType: 'singleRow',
|
|
685
|
+
icon: _jsx(IconInfo, {}),
|
|
686
|
+
name: SDKUI_Localizator.IndexingInformation,
|
|
633
687
|
disabled: false,
|
|
634
688
|
onClick: async () => {
|
|
635
689
|
try {
|
|
@@ -647,18 +701,16 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
647
701
|
}
|
|
648
702
|
},
|
|
649
703
|
{
|
|
650
|
-
icon:
|
|
651
|
-
|
|
652
|
-
operationType: 'singleRow',
|
|
704
|
+
icon: _jsx(IconArchiveDoc, {}),
|
|
705
|
+
name: SDKUI_Localizator.IndexOrReindex,
|
|
653
706
|
disabled: false,
|
|
654
707
|
onClick: async () => {
|
|
655
708
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
|
|
656
709
|
}
|
|
657
710
|
},
|
|
658
711
|
{
|
|
659
|
-
icon:
|
|
660
|
-
|
|
661
|
-
operationType: 'singleRow',
|
|
712
|
+
icon: _jsx(IconDelete, {}),
|
|
713
|
+
name: SDKUI_Localizator.IndexingDelete,
|
|
662
714
|
disabled: false,
|
|
663
715
|
onClick: async () => {
|
|
664
716
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
|
|
@@ -666,9 +718,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
666
718
|
}
|
|
667
719
|
];
|
|
668
720
|
items.push({
|
|
669
|
-
icon:
|
|
670
|
-
|
|
671
|
-
|
|
721
|
+
icon: _jsx(IconSearch, {}),
|
|
722
|
+
name: SDKUI_Localizator.FullTextSearch,
|
|
723
|
+
submenu: fullTextItems
|
|
672
724
|
});
|
|
673
725
|
}
|
|
674
726
|
// Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
|
|
@@ -676,20 +728,19 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
676
728
|
const customButtonsItems = customButtonsLayout.customButtons
|
|
677
729
|
.filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
|
|
678
730
|
.map((customButton) => ({
|
|
679
|
-
icon:
|
|
680
|
-
|
|
731
|
+
icon: TMImageLibrary({ imageID: customButton.glyphID, showPath: false }),
|
|
732
|
+
name: customButton.title || 'Bottone personalizzato',
|
|
681
733
|
onClick: () => setCustomButton(customButton)
|
|
682
734
|
}));
|
|
683
|
-
//disabilitato per ora
|
|
684
|
-
/*
|
|
685
735
|
items.push({
|
|
686
|
-
icon:
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
736
|
+
icon: _jsx(IconCheck, {}),
|
|
737
|
+
name: SDKUI_Localizator.CustomButtons,
|
|
738
|
+
submenu: customButtonsItems
|
|
739
|
+
});
|
|
690
740
|
}
|
|
691
741
|
return items;
|
|
692
742
|
}, [
|
|
743
|
+
fromDTD?.id,
|
|
693
744
|
fromDTD?.perm?.canRetrieveFile,
|
|
694
745
|
fromDTD?.description,
|
|
695
746
|
currentDcmt?.fileExt,
|
|
@@ -715,8 +766,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
715
766
|
openConfirmAttachmentsDialog
|
|
716
767
|
]);
|
|
717
768
|
const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
|
|
718
|
-
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 &&
|
|
719
|
-
_jsx(
|
|
769
|
+
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 &&
|
|
770
|
+
_jsx(ContextMenu, { items: commandsMenuItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
771
|
+
_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, commandsMenuItems, handlePassToSearch]);
|
|
720
772
|
const handleUndo = useCallback(() => {
|
|
721
773
|
setFormData(structuredClone(formDataOrig));
|
|
722
774
|
}, [formDataOrig]);
|
|
@@ -732,6 +784,60 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
732
784
|
},
|
|
733
785
|
});
|
|
734
786
|
}, [isModal, id, layoutMode]);
|
|
787
|
+
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
788
|
+
const refreshMetadataAsync = useCallback(async () => {
|
|
789
|
+
let metadataResult = undefined;
|
|
790
|
+
let hasGetMetadataError = false;
|
|
791
|
+
try {
|
|
792
|
+
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
793
|
+
}
|
|
794
|
+
catch (metadataError) {
|
|
795
|
+
hasGetMetadataError = true;
|
|
796
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
797
|
+
let errorCode = undefined;
|
|
798
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
799
|
+
try {
|
|
800
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
801
|
+
errorCode = detailObj?.ErrorCode;
|
|
802
|
+
}
|
|
803
|
+
catch (parseError) {
|
|
804
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
808
|
+
if (errorCode === -5) {
|
|
809
|
+
TMMessageBoxManager.show({
|
|
810
|
+
message: SDKUI_Localizator.DcmtOutOfView,
|
|
811
|
+
buttons: [ButtonNames.OK],
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
816
|
+
}
|
|
817
|
+
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
818
|
+
metadataResult = null;
|
|
819
|
+
}
|
|
820
|
+
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
821
|
+
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
822
|
+
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
823
|
+
}
|
|
824
|
+
return { success: !hasGetMetadataError, result: metadataResult };
|
|
825
|
+
}, [TID, DID, setMetadataList]);
|
|
826
|
+
const updateCurrentDcmt = useCallback(async () => {
|
|
827
|
+
try {
|
|
828
|
+
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
829
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
830
|
+
if (!success)
|
|
831
|
+
onClose?.();
|
|
832
|
+
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
833
|
+
}
|
|
834
|
+
catch (e) {
|
|
835
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
836
|
+
}
|
|
837
|
+
finally {
|
|
838
|
+
TMSpinner.hide();
|
|
839
|
+
}
|
|
840
|
+
}, [refreshMetadataAsync, onClose]);
|
|
735
841
|
const handleSave = useCallback(async () => {
|
|
736
842
|
const ue = new UpdateEngineByID(SDK_Globals.tmSession);
|
|
737
843
|
ue.DID = DID;
|
|
@@ -768,55 +874,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
768
874
|
const savedFormData = structuredClone(formDataRef.current);
|
|
769
875
|
setFormDataOrig(savedFormData);
|
|
770
876
|
formDataOrigRef.current = savedFormData;
|
|
771
|
-
//
|
|
772
|
-
|
|
773
|
-
let hasGetMetadataError = false;
|
|
774
|
-
try {
|
|
775
|
-
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
776
|
-
}
|
|
777
|
-
catch (metadataError) {
|
|
778
|
-
hasGetMetadataError = true;
|
|
779
|
-
// Estrai ErrorCode dal campo detail se disponibile
|
|
780
|
-
let errorCode = undefined;
|
|
781
|
-
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
782
|
-
try {
|
|
783
|
-
const detailObj = JSON.parse(metadataError.response.detail);
|
|
784
|
-
errorCode = detailObj?.ErrorCode;
|
|
785
|
-
}
|
|
786
|
-
catch (parseError) {
|
|
787
|
-
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
791
|
-
if (errorCode === -5) {
|
|
792
|
-
TMMessageBoxManager.show({
|
|
793
|
-
message: SDKUI_Localizator.DcmtOutOfView,
|
|
794
|
-
buttons: [ButtonNames.OK],
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
else {
|
|
798
|
-
TMExceptionBoxManager.show({ exception: metadataError });
|
|
799
|
-
}
|
|
800
|
-
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
801
|
-
metadataResult = null;
|
|
802
|
-
}
|
|
877
|
+
// Usa la funzione helper per ottenere i metadati aggiornati
|
|
878
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
803
879
|
// Esegui sempre il callback:
|
|
804
880
|
// - Se metadataResult è un oggetto: refresh normale
|
|
805
881
|
// - Se metadataResult è null: GetMetadataAsync fallito, rimuove il documento dalla griglia senza ritentare
|
|
806
882
|
// - Se metadataResult è undefined: nessun parametro passato, il callback può decidere cosa fare
|
|
807
883
|
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
808
884
|
// Mostra messaggio di successo solo se non ci sono stati errori critici
|
|
809
|
-
if (
|
|
810
|
-
if (metadataResult && metadataResult !== null) {
|
|
811
|
-
// Usa fromDTDRef.current invece di fromDTD per evitare stale closure.
|
|
812
|
-
// fromDTD potrebbe essere undefined/vuoto nel callback se lo stato è cambiato,
|
|
813
|
-
// mentre fromDTDRef.current contiene sempre il valore corrente sincronizzato tramite useEffect.
|
|
814
|
-
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
815
|
-
}
|
|
885
|
+
if (success) {
|
|
816
886
|
ShowAlert({ mode: 'success', title: 'Form di documento', message: 'Le modifiche sono state salvate con successo', duration: 3000 });
|
|
817
887
|
}
|
|
818
|
-
else
|
|
888
|
+
else {
|
|
819
889
|
onClose?.();
|
|
890
|
+
}
|
|
820
891
|
}
|
|
821
892
|
catch (e) {
|
|
822
893
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -824,7 +895,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
824
895
|
finally {
|
|
825
896
|
TMSpinner.hide();
|
|
826
897
|
}
|
|
827
|
-
}, [DID, TID, getSpecificChangedKeysWithValues, onSavedAsyncCallback, onClose
|
|
898
|
+
}, [DID, TID, getSpecificChangedKeysWithValues, refreshMetadataAsync, onSavedAsyncCallback, onClose]);
|
|
828
899
|
const handleArchiveCompleted = useCallback(async () => {
|
|
829
900
|
let firstBlock = true;
|
|
830
901
|
let maxFileSize = 0;
|
|
@@ -1007,50 +1078,40 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1007
1078
|
setShowAll(true);
|
|
1008
1079
|
}
|
|
1009
1080
|
}, [shouldShowAll, showAll]);
|
|
1010
|
-
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
1011
|
-
try {
|
|
1012
|
-
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
1013
|
-
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
1014
|
-
setBlogsDatasource(res ?? []);
|
|
1015
|
-
setHasLoadedDataOnce(true);
|
|
1016
|
-
setLastLoadedDid(did);
|
|
1017
|
-
}
|
|
1018
|
-
catch (e) {
|
|
1019
|
-
let err = e;
|
|
1020
|
-
TMExceptionBoxManager.show({ exception: err });
|
|
1021
|
-
}
|
|
1022
|
-
finally {
|
|
1023
|
-
TMSpinner.hide();
|
|
1024
|
-
}
|
|
1025
|
-
}, []);
|
|
1026
1081
|
const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
|
|
1027
1082
|
const shouldRefresh = forceRefresh || (task && task.state === Task_States.Completed) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
1028
1083
|
if (TID && DID && shouldRefresh) {
|
|
1029
|
-
await
|
|
1084
|
+
await triggerBlogRefresh();
|
|
1030
1085
|
}
|
|
1031
|
-
}, [TID, DID]);
|
|
1086
|
+
}, [TID, DID, triggerBlogRefresh]);
|
|
1087
|
+
const checkoutBadge = useMemo(() => {
|
|
1088
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
1089
|
+
if (!cicoEnabled || !checkoutStatus.isCheckedOut)
|
|
1090
|
+
return null;
|
|
1091
|
+
return (_jsx(Ribbon, { "$isMobile": isMobile, children: _jsx(TMTooltip, { content: checkoutStatus.editLockTooltipText, position: "right", children: _jsx("span", { children: checkoutStatus.mode === 'editMode' ? SDKUI_Localizator.CheckOut : 'Locked' }) }) }));
|
|
1092
|
+
}, [formData, fromDTD, isMobile]);
|
|
1032
1093
|
const tmDcmtForm = useMemo(() => {
|
|
1033
|
-
return
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1094
|
+
return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
|
|
1095
|
+
_jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
1096
|
+
setFormData((prevItems) => prevItems.map((item) => {
|
|
1097
|
+
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
1098
|
+
return newItem ? { ...item, ...newItem } : item;
|
|
1099
|
+
}));
|
|
1100
|
+
}, onAdvancedMenuClick: (e) => {
|
|
1101
|
+
switch (e.button) {
|
|
1102
|
+
case AdvancedMenuButtons.DistinctValues:
|
|
1103
|
+
setIsOpenDistinctValues(!isOpenDistinctValues);
|
|
1104
|
+
break;
|
|
1105
|
+
case AdvancedMenuButtons.FormulaEditor:
|
|
1106
|
+
setIsOpenFormulaEditor(!isOpenFormulaEditor);
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
} }), _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 })] }) :
|
|
1110
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _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 &&
|
|
1111
|
+
!isApprView &&
|
|
1112
|
+
TID !== SystemTIDs.Drafts &&
|
|
1113
|
+
!shouldShowAll &&
|
|
1114
|
+
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] })] });
|
|
1054
1115
|
}, [
|
|
1055
1116
|
TID,
|
|
1056
1117
|
DID,
|
|
@@ -1078,11 +1139,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1078
1139
|
handleUndo,
|
|
1079
1140
|
handleClearForm
|
|
1080
1141
|
]);
|
|
1081
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, {
|
|
1142
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, fetchBlogDataTrigger: refreshBlogTrigger, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger]);
|
|
1082
1143
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
1083
1144
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
|
|
1084
1145
|
setDcmtFile(file);
|
|
1085
|
-
}, enableDragDropOverlay: enableDragDropOverlay }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
|
|
1146
|
+
}, enableDragDropOverlay: enableDragDropOverlay }, refreshPreviewTrigger), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
|
|
1086
1147
|
const tmWF = useMemo(() => {
|
|
1087
1148
|
if (isWFDataLoading) {
|
|
1088
1149
|
return (_jsx("div", { style: {
|
|
@@ -1347,23 +1408,23 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1347
1408
|
height: '100%',
|
|
1348
1409
|
position: 'relative',
|
|
1349
1410
|
overflow: 'hidden'
|
|
1350
|
-
}, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) &&
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1411
|
+
}, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: [(groupId && groupId.length > 0)
|
|
1412
|
+
? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
|
|
1413
|
+
: _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(WfButtonStateHandler, { isWFDisabled: isWFDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1414
|
+
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
|
|
1415
|
+
if (!e)
|
|
1416
|
+
return;
|
|
1417
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
|
|
1418
|
+
} }), isOpenFormulaEditor &&
|
|
1419
|
+
_jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
|
|
1420
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
|
1421
|
+
setFocusedMetadataValue(prevState => ({
|
|
1422
|
+
...prevState,
|
|
1423
|
+
isSelected: true,
|
|
1424
|
+
isEditable: true,
|
|
1425
|
+
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
1426
|
+
}));
|
|
1427
|
+
} }), 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 })] }) }), _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, isVisible: (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
|
|
1367
1428
|
_jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
|
|
1368
1429
|
:
|
|
1369
1430
|
_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 && (_jsxs(_Fragment, { children: [_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `${SDKUI_Localizator.MoreInfoCompleteRequestSentBy} ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => {
|
|
@@ -1417,7 +1478,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1417
1478
|
finally {
|
|
1418
1479
|
TMSpinner.hide();
|
|
1419
1480
|
}
|
|
1420
|
-
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })),
|
|
1481
|
+
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), (showHistory && fromDTD && currentDcmt) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: { TID: currentDcmt.tid, DID: currentDcmt.did }, onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showCheckoutInformationForm && fromDTD && currentDcmt) &&
|
|
1482
|
+
_jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, onClose: hideCheckoutInformationFormCallback }), (commentFormState.show && currentDcmt) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: currentDcmt.tid, did: currentDcmt.did } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment }), isOpenArchiveRelationForm && (_jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
|
|
1421
1483
|
setIsOpenArchiveRelationForm(false);
|
|
1422
1484
|
setArchiveType(undefined);
|
|
1423
1485
|
setArchiveRelatedDcmtFormTID(undefined);
|
|
@@ -1451,8 +1513,11 @@ const applyMetadataFilter = (data, showAll, listMaxItems, TID) => {
|
|
|
1451
1513
|
o.mid === SystemMIDsAsNumber.FileSize ||
|
|
1452
1514
|
o.mid === SystemMIDsAsNumber.LastUpdateTime ||
|
|
1453
1515
|
o.mid === SystemMIDsAsNumber.CreationTime;
|
|
1516
|
+
const chronologySystemFilter = (o) => baseFilter(o) ||
|
|
1517
|
+
o.mid === SystemMIDsAsNumber.FileExt ||
|
|
1518
|
+
o.mid === SystemMIDsAsNumber.FileSize;
|
|
1454
1519
|
// Select the appropriate filter based on document type
|
|
1455
|
-
const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : baseFilter;
|
|
1520
|
+
const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : TID === SystemTIDs.Chronology ? chronologySystemFilter : baseFilter;
|
|
1456
1521
|
// Apply filter once
|
|
1457
1522
|
const filteredData = data.filter(currentFilter);
|
|
1458
1523
|
// Return all filtered data or slice to max items
|
|
@@ -1506,3 +1571,35 @@ const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode, fromDTD, dcmtFile, devi
|
|
|
1506
1571
|
_jsx(TMDcmtPreview, { isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, dcmtData: currentDcmt, isResizingActive: isResizingActive }) :
|
|
1507
1572
|
_jsx(TMFileUploader, { onFileUpload: onFileUpload, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay }));
|
|
1508
1573
|
};
|
|
1574
|
+
const Ribbon = styled.div `
|
|
1575
|
+
font-size: 0.85rem;
|
|
1576
|
+
font-weight: 600;
|
|
1577
|
+
color: #fff;
|
|
1578
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
|
|
1579
|
+
--f: .4em; /* control the folded part */
|
|
1580
|
+
position: absolute;
|
|
1581
|
+
top: 2px;
|
|
1582
|
+
left: 2px;
|
|
1583
|
+
z-index: 1200;
|
|
1584
|
+
line-height: 1.6;
|
|
1585
|
+
padding-inline: 0.8lh;
|
|
1586
|
+
padding-bottom: var(--f);
|
|
1587
|
+
border-image: conic-gradient(#0008 0 0) 51%/var(--f);
|
|
1588
|
+
clip-path: polygon(100% calc(100% - var(--f)),100% 100%,calc(100% - var(--f)) calc(100% - var(--f)),var(--f) calc(100% - var(--f)), 0 100%,0 calc(100% - var(--f)),999px calc(100% - var(--f) - 999px),calc(100% - 999px) calc(100% - var(--f) - 999px));
|
|
1589
|
+
transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg);
|
|
1590
|
+
transform-origin: 100% 100%;
|
|
1591
|
+
background-color: rgba(217, 148, 13, 0.92);
|
|
1592
|
+
display: inline-block;
|
|
1593
|
+
padding-top: 0.1em;
|
|
1594
|
+
white-space: nowrap;
|
|
1595
|
+
transition: ${props => props.$isMobile ? 'none' : 'all 0.3s ease'};
|
|
1596
|
+
cursor: 'default';
|
|
1597
|
+
|
|
1598
|
+
${props => !props.$isMobile && `
|
|
1599
|
+
&:hover {
|
|
1600
|
+
background-color: #d9940d;
|
|
1601
|
+
font-size: 1.1rem;
|
|
1602
|
+
transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg) scale(1.05);
|
|
1603
|
+
}
|
|
1604
|
+
`}
|
|
1605
|
+
`;
|