@topconsultnpm/sdkui-react-beta 6.17.38 → 6.17.40

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.
@@ -75,6 +75,10 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
75
75
  const [archiveType, setArchiveType] = useState(undefined);
76
76
  const [isOpenDetails, setIsOpenDetails] = useState(false);
77
77
  const [isOpenMaster, setIsOpenMaster] = useState(false);
78
+ const [isOpenArchiveRelationForm, setIsOpenArchiveRelationForm] = useState(false);
79
+ const [archiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormTID] = useState(undefined);
80
+ const [archiveRelatedDcmtFormMids, setArchiveRelatedDcmtFormMids] = useState([]);
81
+ const [relatedDcmtsChooserDataSource, setRelatedDcmtsChooserDataSource] = useState(undefined);
78
82
  const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
79
83
  const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
80
84
  const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
@@ -450,6 +454,9 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
450
454
  const filterRelationsWithAssociations = (relations) => {
451
455
  return relations.filter(rel => rel.associations && rel.associations.length > 0);
452
456
  };
457
+ const getRelatedDcmt = async (relation, type) => {
458
+ return await DcmtTypeListCacheService.GetAsync(type === 'detail' ? relation.detailTID : relation.masterTID);
459
+ };
453
460
  const showNoRelationsAlert = (type) => {
454
461
  ShowAlert({
455
462
  message: type === 'detail'
@@ -476,13 +483,15 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
476
483
  value: fetchAssociatedValues(type === 'detail' ? (assoc.item1 ?? 0) : (assoc.item2 ?? 0)) ?? ''
477
484
  })) ?? [];
478
485
  };
479
- const navigateToArchive = (relation, type) => {
486
+ const archiveRelatedDcmtHandler = (relation, type) => {
480
487
  const targetTID = type === 'detail' ? relation.detailTID : relation.masterTID;
481
488
  if (!targetTID)
482
489
  return;
483
490
  const mids = mapAssociationsToMids(relation, type);
484
- onSelectedTIDChanged?.(targetTID);
485
- passToArchiveCallback?.(mids, targetTID);
491
+ setArchiveType(type);
492
+ setArchiveRelatedDcmtFormTID(targetTID);
493
+ setArchiveRelatedDcmtFormMids(mids);
494
+ setIsOpenArchiveRelationForm(true);
486
495
  };
487
496
  const archiveRelatedDocuments = async (tid, type) => {
488
497
  try {
@@ -502,11 +511,17 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
502
511
  }
503
512
  setRelatedDcmts(withAssociations);
504
513
  if (withAssociations.length > 1) {
514
+ const dataSourcePromises = withAssociations.map(async (rel) => {
515
+ const relatedDcmt = await getRelatedDcmt(rel, type);
516
+ return { id: rel?.id, name: relatedDcmt?.name };
517
+ });
518
+ const dataSource = await Promise.all(dataSourcePromises);
519
+ setRelatedDcmtsChooserDataSource(dataSource);
505
520
  setArchiveType(type);
506
521
  setShowRelatedDcmtsChooser(true);
507
522
  }
508
523
  else {
509
- navigateToArchive(withAssociations[0], type);
524
+ archiveRelatedDcmtHandler(withAssociations[0], type);
510
525
  }
511
526
  }
512
527
  catch (error) {
@@ -549,14 +564,14 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
549
564
  await refreshSelectionDataRowsAsync();
550
565
  }, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), (showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm) &&
551
566
  _jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), approveDisable: disable, signApproveDisable: disableSignApproveDisable, rejectDisable: disable, reassignDisable: disable, infoDisable: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length !== 1 }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), showRelatedDcmtsChooser &&
552
- _jsx(TMChooserForm, { dataSource: relatedDcmts, onChoose: async (selectedRelation) => {
567
+ _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
553
568
  try {
554
569
  setShowRelatedDcmtsChooser(false);
555
570
  TMSpinner.show({ description: SDKUI_Localizator.Loading });
556
571
  const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
557
572
  if (!relation || !archiveType)
558
573
  return;
559
- navigateToArchive(relation, archiveType);
574
+ archiveRelatedDcmtHandler(relation, archiveType);
560
575
  }
561
576
  catch (error) {
562
577
  TMExceptionBoxManager.show({ exception: error });
@@ -581,6 +596,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
581
596
  isOpenDetails,
582
597
  isOpenMaster,
583
598
  isOpenDcmtForm,
599
+ isOpenArchiveRelationForm,
584
600
  showToppyForApprove,
585
601
  floatingActionConfig,
586
602
  disableAccordionIfSingleCategory,
@@ -588,7 +604,8 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
588
604
  openS4TViewer,
589
605
  showRelatedDcmtsChooser,
590
606
  relatedDcmts,
591
- setShowRelatedDcmtsChooser
607
+ setShowRelatedDcmtsChooser,
608
+ relatedDcmtsChooserDataSource
592
609
  ]);
593
610
  const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID }), [focusedItem]);
594
611
  const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [focusedItem, currentMetadataValues, deviceType]);
@@ -655,7 +672,18 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
655
672
  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}`));
656
673
  })] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID), titleModal: fromDTD?.name ?? '', TID: focusedItem?.TID, DID: focusedItem?.DID, layoutMode: dcmtFormLayoutMode, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: async (tid, did, metadataResult) => {
657
674
  await refreshFocusedDataRowAsync(tid, did, true, metadataResult);
658
- }, onOpenS4TViewerRequest: onOpenS4TViewerRequest }) })] }));
675
+ }, onOpenS4TViewerRequest: onOpenS4TViewerRequest }) }), isOpenArchiveRelationForm && _jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, onClose: () => {
676
+ setIsOpenArchiveRelationForm(false);
677
+ setArchiveType(undefined);
678
+ setArchiveRelatedDcmtFormTID(undefined);
679
+ setArchiveRelatedDcmtFormMids([]);
680
+ }, onSavedAsyncCallback: async (tid, did, metadataResult) => {
681
+ setIsOpenArchiveRelationForm(false);
682
+ setArchiveType(undefined);
683
+ setArchiveRelatedDcmtFormTID(undefined);
684
+ setArchiveRelatedDcmtFormMids([]);
685
+ await onRefreshSearchAsync?.();
686
+ } })] }));
659
687
  };
660
688
  export default TMSearchResult;
661
689
  const renderDcmtIcon = (cellData, onDownloadDcmtsAsync, openInOffice) => _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow', onDownloadDcmtsAsync: onDownloadDcmtsAsync, openInOffice: openInOffice });
@@ -353,33 +353,33 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
353
353
  operationType: 'multiRow',
354
354
  disabled: disabledForMultiRow(selectedItems, focusedItem),
355
355
  items: [
356
- // {
357
- // icon: svgToString(<IconRelation />),
358
- // text: "Abbina documenti molti a molti",
359
- // operationType: 'multiRow',
360
- // disabled: fromDatagrid ? false : disabledForMultiRow(selectedItems, focusedItem),
361
- // onClick: () => ShowAlert({ message: "TODO Abbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 })
362
- // },
363
- // {
364
- // icon: svgToString(<IconRelation />),
365
- // text: "Disabbina documenti molti a molti",
366
- // operationType: 'multiRow',
367
- // disabled: fromDatagrid ? false : disabledForMultiRow(selectedItems, focusedItem),
368
- // onClick: () => ShowAlert({ message: "TODO Disabbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 })
369
- // },
370
356
  {
371
357
  icon: svgToString(_jsx(IconRelation, {})),
372
- text: "Archivia documento master",
358
+ text: "Abbina documenti molti a molti",
373
359
  operationType: 'multiRow',
374
- beginGroup: true,
375
- onClick: async () => await archiveMasterDocuments?.(focusedItem?.TID)
360
+ disabled: disabledForMultiRow(selectedItems, focusedItem),
361
+ onClick: () => ShowAlert({ message: "TODO Abbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 })
362
+ },
363
+ {
364
+ icon: svgToString(_jsx(IconRelation, {})),
365
+ text: "Disabbina documenti molti a molti",
366
+ operationType: 'multiRow',
367
+ disabled: disabledForMultiRow(selectedItems, focusedItem),
368
+ onClick: () => ShowAlert({ message: "TODO Disabbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 })
376
369
  },
377
370
  {
378
371
  icon: svgToString(_jsx(IconRelation, {})),
379
372
  text: "Archivia documento dettaglio",
380
373
  operationType: 'multiRow',
374
+ beginGroup: true,
381
375
  onClick: async () => await archiveDetailDocuments?.(focusedItem?.TID)
382
376
  },
377
+ {
378
+ icon: svgToString(_jsx(IconRelation, {})),
379
+ text: "Archivia documento master",
380
+ operationType: 'multiRow',
381
+ onClick: async () => await archiveMasterDocuments?.(focusedItem?.TID)
382
+ },
383
383
  {
384
384
  icon: svgToString(_jsx(IconRelation, {})),
385
385
  text: SDKUI_Localizator.DcmtsMaster,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.17.38",
3
+ "version": "6.17.40",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",