@topconsultnpm/sdkui-react 6.19.0-dev1.9 → 6.19.0-dev2.2
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/base/Styled.d.ts +1 -0
- package/lib/components/base/Styled.js +40 -0
- package/lib/components/base/TMCustomButton.d.ts +11 -0
- package/lib/components/base/TMCustomButton.js +63 -0
- package/lib/components/base/TMFileManagerDataGridView.js +4 -1
- package/lib/components/base/TMLayout.d.ts +2 -1
- package/lib/components/base/TMLayout.js +2 -2
- package/lib/components/base/TMPopUp.js +5 -18
- package/lib/components/base/TMTreeView.js +3 -2
- package/lib/components/editors/TMHtmlEditor.d.ts +5 -0
- package/lib/components/editors/TMHtmlEditor.js +72 -12
- package/lib/components/editors/TMMetadataValues.js +90 -40
- package/lib/components/features/archive/TMArchive.d.ts +10 -0
- package/lib/components/features/archive/TMArchive.js +56 -25
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +4 -4
- package/lib/components/features/blog/TMBlogCommentForm.js +76 -51
- package/lib/components/features/documents/TMDcmtBlog.d.ts +15 -0
- package/lib/components/features/documents/TMDcmtBlog.js +21 -33
- package/lib/components/features/documents/TMDcmtForm.d.ts +17 -3
- package/lib/components/features/documents/TMDcmtForm.js +205 -46
- package/lib/components/features/documents/TMDcmtTasks.d.ts +13 -0
- package/lib/components/features/documents/TMDcmtTasks.js +24 -0
- package/lib/components/features/documents/TMDragDropOverlay.js +2 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +8 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.js +6 -6
- package/lib/components/features/documents/TMRelationViewer.d.ts +53 -3
- package/lib/components/features/documents/TMRelationViewer.js +232 -85
- package/lib/components/features/search/TMSearch.d.ts +10 -1
- package/lib/components/features/search/TMSearch.js +14 -5
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +36 -7
- package/lib/components/features/search/TMSearchResult.d.ts +10 -1
- package/lib/components/features/search/TMSearchResult.js +140 -422
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.js +33 -8
- package/lib/components/features/tasks/TMTaskForm.d.ts +38 -0
- package/lib/components/features/tasks/TMTaskForm.js +386 -0
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
- package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
- package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
- package/lib/components/features/tasks/TMTasksHeader.js +37 -0
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +20 -0
- package/lib/components/features/tasks/TMTasksPanelContent.js +65 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +132 -0
- package/lib/components/features/tasks/TMTasksUtils.js +634 -0
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +39 -0
- package/lib/components/features/tasks/TMTasksUtilsView.js +118 -0
- package/lib/components/features/tasks/TMTasksView.d.ts +40 -0
- package/lib/components/features/tasks/TMTasksView.js +560 -0
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +3 -1
- package/lib/components/features/workflow/TMWorkflowPopup.js +19 -6
- package/lib/components/features/workflow/diagram/RecipientList.js +4 -3
- package/lib/components/forms/Login/Chooser.js +1 -1
- package/lib/components/forms/TMChooserForm.d.ts +1 -1
- package/lib/components/forms/TMChooserForm.js +2 -2
- package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
- package/lib/components/grids/TMBlogAttachments.js +43 -0
- package/lib/components/grids/TMBlogHeader.d.ts +31 -0
- package/lib/components/grids/TMBlogHeader.js +41 -0
- package/lib/components/grids/{TMBlogs.d.ts → TMBlogsPost.d.ts} +42 -58
- package/lib/components/grids/TMBlogsPost.js +628 -0
- package/lib/components/grids/{TMBlogsUtils.d.ts → TMBlogsPostUtils.d.ts} +61 -47
- package/lib/components/grids/{TMBlogsUtils.js → TMBlogsPostUtils.js} +146 -124
- package/lib/components/index.d.ts +14 -1
- package/lib/components/index.js +15 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +7 -0
- package/lib/components/settings/SettingsAppearance.js +8 -0
- package/lib/components/viewers/TMTidViewer.js +20 -2
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +4 -1
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +62 -4
- package/lib/helper/SDKUI_Localizator.js +618 -25
- package/lib/helper/TMCustomSearchBar.d.ts +8 -0
- package/lib/helper/TMCustomSearchBar.js +54 -0
- package/lib/helper/TMIcons.d.ts +2 -0
- package/lib/helper/TMIcons.js +6 -0
- package/lib/helper/TMImageLibrary.d.ts +3 -2
- package/lib/helper/TMImageLibrary.js +230 -230
- package/lib/helper/TMToppyMessage.d.ts +7 -0
- package/lib/helper/TMToppyMessage.js +42 -0
- package/lib/helper/TMUtils.d.ts +10 -1
- package/lib/helper/TMUtils.js +42 -1
- package/lib/helper/dcmtsHelper.d.ts +2 -0
- package/lib/helper/dcmtsHelper.js +18 -0
- package/lib/helper/helpers.js +1 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useRelatedDocuments.d.ts +72 -0
- package/lib/hooks/useRelatedDocuments.js +655 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/ts/types.d.ts +14 -0
- package/lib/ts/types.js +15 -0
- package/lib/utils/theme.d.ts +1 -0
- package/lib/utils/theme.js +1 -0
- package/package.json +7 -7
- package/lib/components/grids/TMBlogs.js +0 -721
- package/lib/stories/TMButton.stories.d.ts +0 -4
- package/lib/stories/TMButton.stories.js +0 -29
- package/lib/stories/TMDataGrid.stories.d.ts +0 -9
- package/lib/stories/TMDataGrid.stories.js +0 -310
- package/lib/stories/TMHtmlContentDisplay.stories.d.ts +0 -6
- package/lib/stories/TMHtmlContentDisplay.stories.js +0 -45
- package/lib/stories/TMHtmlEditor.stories.d.ts +0 -6
- package/lib/stories/TMHtmlEditor.stories.js +0 -49
- package/lib/stories/TMIcons.stories.d.ts +0 -4
- package/lib/stories/TMIcons.stories.js +0 -13
- package/lib/stories/TMSDKUI_Localizator.stories.d.ts +0 -4
- package/lib/stories/TMSDKUI_Localizator.stories.js +0 -123
- package/lib/stories/TMStoriesUtils.d.ts +0 -1
- package/lib/stories/TMStoriesUtils.js +0 -10
- package/lib/stories/TMUserAvatar.stories.d.ts +0 -6
- package/lib/stories/TMUserAvatar.stories.js +0 -20
|
@@ -4,7 +4,7 @@ import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
|
|
4
4
|
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
6
6
|
export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
|
|
7
|
-
export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
|
|
7
|
+
export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, showSharedDcmtsHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
|
|
8
8
|
mid: number;
|
|
9
9
|
value: string;
|
|
10
|
-
}
|
|
10
|
+
}>, tid?: number) => void, archiveMasterDocuments?: (tid: number | undefined) => Promise<void>, archiveDetailDocuments?: (tid: number | undefined) => Promise<void>, hasMasterRelation?: boolean, hasDetailRelation?: boolean, canArchiveMasterRelation?: boolean, canArchiveDetailRelation?: boolean, pairManyToManyDocuments?: (isPairing: boolean) => Promise<void>, hasManyToManyRelation?: boolean) => Array<TMDataGridContextMenuItem>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus } from '@topconsultnpm/sdk-ts';
|
|
3
|
-
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled } from '../../../helper';
|
|
3
|
+
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled, IconPair, IconUnpair, IconSharedDcmt } from '../../../helper';
|
|
4
4
|
import ShowAlert from '../../base/TMAlert';
|
|
5
5
|
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
|
@@ -75,7 +75,7 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
|
|
|
75
75
|
TMExceptionBoxManager.show({ exception: error });
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments) => {
|
|
78
|
+
export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation) => {
|
|
79
79
|
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
80
80
|
let pdfEditorAvailable = false;
|
|
81
81
|
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
@@ -235,7 +235,7 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
235
235
|
?.filter(md => md.mid && md.mid > 100 && md.value && md.value.length > 0)
|
|
236
236
|
.map(md => ({ mid: md.mid, value: md.value })) || [];
|
|
237
237
|
TMSpinner.hide();
|
|
238
|
-
passToArchiveCallback?.(outputMids);
|
|
238
|
+
passToArchiveCallback?.(outputMids, item.TID);
|
|
239
239
|
}
|
|
240
240
|
catch (error) {
|
|
241
241
|
TMSpinner.hide();
|
|
@@ -346,17 +346,17 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
346
346
|
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
347
347
|
items: [
|
|
348
348
|
{
|
|
349
|
-
icon: svgToString(_jsx(
|
|
349
|
+
icon: svgToString(_jsx(IconPair, {})),
|
|
350
350
|
text: "Abbina documenti molti a molti",
|
|
351
351
|
operationType: 'multiRow',
|
|
352
|
-
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
352
|
+
disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
|
|
353
353
|
onClick: async () => await pairManyToManyDocuments?.(true)
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
|
-
icon: svgToString(_jsx(
|
|
356
|
+
icon: svgToString(_jsx(IconUnpair, {})),
|
|
357
357
|
text: "Disabbina documenti molti a molti",
|
|
358
358
|
operationType: 'multiRow',
|
|
359
|
-
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
359
|
+
disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
|
|
360
360
|
onClick: async () => await pairManyToManyDocuments?.(false)
|
|
361
361
|
},
|
|
362
362
|
{
|
|
@@ -394,6 +394,30 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
394
394
|
]
|
|
395
395
|
};
|
|
396
396
|
};
|
|
397
|
+
const sharedDcmtsMenuItem = () => {
|
|
398
|
+
return {
|
|
399
|
+
icon: svgToString(_jsx(IconSharedDcmt, {})),
|
|
400
|
+
text: 'Documenti condivisi',
|
|
401
|
+
operationType: 'multiRow',
|
|
402
|
+
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
403
|
+
items: [
|
|
404
|
+
{
|
|
405
|
+
icon: svgToString(_jsx(IconSharedDcmt, {})),
|
|
406
|
+
text: "Archiviazione condivisa",
|
|
407
|
+
operationType: 'singleRow',
|
|
408
|
+
disabled: disabledForSingleRow(selectedItems, focusedItem),
|
|
409
|
+
onClick: async () => { await openSharedArchiveHandler(); }
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
icon: svgToString(_jsx(IconSharedDcmt, {})),
|
|
413
|
+
text: "Mostra documenti condivisi",
|
|
414
|
+
operationType: 'multiRow',
|
|
415
|
+
disabled: disabledForMultiRow(selectedItems, focusedItem),
|
|
416
|
+
onClick: async () => { await showSharedDcmtsHandler(); }
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
};
|
|
420
|
+
};
|
|
397
421
|
/* const shareMenuItem = (): TMDataGridContextMenuItem => {
|
|
398
422
|
return {
|
|
399
423
|
icon: svgToString(<IconShare />),
|
|
@@ -625,8 +649,9 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
|
|
|
625
649
|
]
|
|
626
650
|
},
|
|
627
651
|
signatureMenuItem(),
|
|
628
|
-
// checkinMenuItem()
|
|
652
|
+
// checkinMenuItem(),\
|
|
629
653
|
relationsMenuItem(),
|
|
654
|
+
sharedDcmtsMenuItem(),
|
|
630
655
|
// shareMenuItem(),
|
|
631
656
|
fullTextSearchMenuItem(),
|
|
632
657
|
otherMenuItem(),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TaskDescriptor, UserDescriptor, HomeBlogPost } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DcmtInfo, FormModes, TaskContext } from '../../../ts';
|
|
4
|
+
export interface TMTaskFormProps {
|
|
5
|
+
allTasks: Array<TaskDescriptor>;
|
|
6
|
+
getAllTasks: () => Promise<void>;
|
|
7
|
+
deleteTaskByIdsCallback: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
8
|
+
addTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
9
|
+
editTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
handleNavigateToWGs: (value: HomeBlogPost | number) => Promise<void>;
|
|
11
|
+
handleNavigateToDossiers: (value: HomeBlogPost | number) => Promise<void>;
|
|
12
|
+
id: number;
|
|
13
|
+
title: string;
|
|
14
|
+
isModal: boolean;
|
|
15
|
+
formMode: FormModes;
|
|
16
|
+
visualizedTasks: Array<TaskDescriptor>;
|
|
17
|
+
currentTask: TaskDescriptor | null;
|
|
18
|
+
setCurrentTask?: React.Dispatch<React.SetStateAction<TaskDescriptor | null>>;
|
|
19
|
+
isContextualCreate?: boolean;
|
|
20
|
+
selectedRowKeys: Array<number>;
|
|
21
|
+
handleFocusedRowKeyChange?: (row: TaskDescriptor | undefined) => void;
|
|
22
|
+
onStatusChanged?: () => void;
|
|
23
|
+
onSaved?: (newTask: TaskDescriptor) => void;
|
|
24
|
+
onClose?: () => void;
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
taskContext?: TaskContext;
|
|
27
|
+
startDate?: Date;
|
|
28
|
+
endDate?: Date;
|
|
29
|
+
showBackButton?: boolean;
|
|
30
|
+
hasNavigation?: boolean;
|
|
31
|
+
width?: string;
|
|
32
|
+
height?: string;
|
|
33
|
+
usersList?: Array<UserDescriptor>;
|
|
34
|
+
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
|
|
35
|
+
s4TViewerDialogComponent?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
declare const TMTaskForm: (props: TMTaskFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export default TMTaskForm;
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { ObjectClasses, TaskDescriptor, Priorities, PdGs, SDK_Globals, UserListCacheService, SDK_Localizator, Task_States } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { areDifferentIDs, formatDate, getOriginLabel, getPriorityLocalizatorValue, getPriorityLocalizatorValues, getStatusLocalizatorValues, gotoPDGExtendedLabel, taskValidatorAsync } from './TMTasksUtils';
|
|
5
|
+
import ScrollView from 'devextreme-react/cjs/scroll-view';
|
|
6
|
+
import TMLayoutContainer from '../../base/TMLayout';
|
|
7
|
+
import { FormModes } from '../../../ts';
|
|
8
|
+
import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
|
|
9
|
+
import { SaveFormOptions, useSaveForm } from '../../../hooks/useForm';
|
|
10
|
+
import { SDKUI_Localizator, calcIsModified, TMConditionalWrapper, getPdgsIconMap, DateDisplayTypes } from '../../../helper';
|
|
11
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
12
|
+
import TMSpinner from '../../base/TMSpinner';
|
|
13
|
+
import TMTooltip from '../../base/TMTooltip';
|
|
14
|
+
import TMUserChooser from '../../choosers/TMUserChooser';
|
|
15
|
+
import TMDateBox from '../../editors/TMDateBox';
|
|
16
|
+
import TMDropDown from '../../editors/TMDropDown';
|
|
17
|
+
import TMTextArea from '../../editors/TMTextArea';
|
|
18
|
+
import TMTextBox from '../../editors/TMTextBox';
|
|
19
|
+
import TMSaveForm from '../../forms/TMSaveForm';
|
|
20
|
+
import TMDcmtForm from '../documents/TMDcmtForm';
|
|
21
|
+
import styled from 'styled-components';
|
|
22
|
+
import { TMColors } from '../../../utils/theme';
|
|
23
|
+
import { renderContextBlock } from './TMTasksUtilsView';
|
|
24
|
+
const ResponseCommentWrapper = styled.div `
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 100%;
|
|
27
|
+
`;
|
|
28
|
+
const ResponseCommentLabel = styled.label `
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: -8px;
|
|
31
|
+
left: 12px;
|
|
32
|
+
background-color: white;
|
|
33
|
+
padding: 0 4px;
|
|
34
|
+
font-size: 0.9rem;
|
|
35
|
+
color: rgb(80,80,80);
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 4px;
|
|
39
|
+
`;
|
|
40
|
+
const ResponseCommentTextArea = styled.textarea.attrs({
|
|
41
|
+
maxLength: 500,
|
|
42
|
+
}) `
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100px;
|
|
45
|
+
border: 1px solid ${props => props.$isValid ? (props.$isModifiedWhen ? "#E29000" : '#b4b4b4') : TMColors.error};
|
|
46
|
+
border-radius: 10px;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
resize: none;
|
|
49
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'text'};
|
|
50
|
+
&:focus {
|
|
51
|
+
outline: none;
|
|
52
|
+
border-bottom: 4px solid ${props => props.$isValid ? TMColors.primaryColor : TMColors.error};
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const ResponseCommentCharacterCounter = styled.div `
|
|
56
|
+
text-align: right;
|
|
57
|
+
font-size: 0.8rem;
|
|
58
|
+
color: #6c757d;
|
|
59
|
+
margin-top: 4px;
|
|
60
|
+
`;
|
|
61
|
+
const TMTaskForm = (props) => {
|
|
62
|
+
// Custom hook to manage workflow approval data
|
|
63
|
+
const { refreshWorkflowApprove } = useWorkflowApprove();
|
|
64
|
+
const validator = async (taskDescriptor) => { return await taskValidatorAsync(taskDescriptor); };
|
|
65
|
+
// Destructure the props object to extract individual properties
|
|
66
|
+
const { id, title, isModal, formMode, visualizedTasks, editTaskCallback, currentTask, setCurrentTask, isContextualCreate = false, selectedRowKeys, handleFocusedRowKeyChange, onStatusChanged, onSaved, onClose, onCancel, taskContext, startDate, endDate, showBackButton = true, hasNavigation = true, width = "100%", height = "100%", usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, handleNavigateToWGs, handleNavigateToDossiers } = props;
|
|
67
|
+
const sfo = new SaveFormOptions();
|
|
68
|
+
sfo.objClass = ObjectClasses.Task;
|
|
69
|
+
const customizeFormData = (task) => {
|
|
70
|
+
if (!isContextualCreate)
|
|
71
|
+
return task;
|
|
72
|
+
if (formMode !== FormModes.Create)
|
|
73
|
+
return task;
|
|
74
|
+
if (task.id && task.id > 0)
|
|
75
|
+
return task;
|
|
76
|
+
if (taskContext?.document) {
|
|
77
|
+
task.pdG = PdGs.DT;
|
|
78
|
+
task.iD1 = taskContext.document.tid;
|
|
79
|
+
task.iD2 = taskContext.document.did;
|
|
80
|
+
}
|
|
81
|
+
else if (taskContext?.workingGroup) {
|
|
82
|
+
task.pdG = PdGs.WG;
|
|
83
|
+
task.iD1 = taskContext.workingGroup.id;
|
|
84
|
+
}
|
|
85
|
+
else if (taskContext?.dossier) {
|
|
86
|
+
task.pdG = PdGs.CF;
|
|
87
|
+
task.iD1 = taskContext.dossier.id;
|
|
88
|
+
if (currentTask) {
|
|
89
|
+
task.name = currentTask.name;
|
|
90
|
+
task.toID = 0;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (taskContext?.workItem) {
|
|
94
|
+
task.pdG = PdGs.DT;
|
|
95
|
+
task.iD1 = taskContext.workItem.tid;
|
|
96
|
+
task.iD2 = taskContext.workItem.did;
|
|
97
|
+
task.toID = 0;
|
|
98
|
+
}
|
|
99
|
+
return task;
|
|
100
|
+
};
|
|
101
|
+
const { formData, setFormData, formDataOrig, validationItems, exception, saveDataAsync } = useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChanged, customizeFormData);
|
|
102
|
+
const containerRef = useRef(null);
|
|
103
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
104
|
+
const [showDcmtForm, setShowDcmtForm] = useState(false);
|
|
105
|
+
const mobileBreakpoint = 768;
|
|
106
|
+
const [users, setUsers] = useState([]); // State to store the users
|
|
107
|
+
// Initial state for the fields' editability (readonly)
|
|
108
|
+
const [fieldsReadOnly, setFieldsReadOnly] = useState({
|
|
109
|
+
name: false,
|
|
110
|
+
description: false,
|
|
111
|
+
fromID: false,
|
|
112
|
+
assignedTO: false,
|
|
113
|
+
status: false,
|
|
114
|
+
priority: false,
|
|
115
|
+
startDate: false,
|
|
116
|
+
endDate: false,
|
|
117
|
+
remTime: false,
|
|
118
|
+
response: false
|
|
119
|
+
});
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const fetchUsers = async () => {
|
|
122
|
+
try {
|
|
123
|
+
// Show spinner while loading
|
|
124
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Users} ...` });
|
|
125
|
+
const userList = await UserListCacheService.GetAllAsync();
|
|
126
|
+
setUsers(userList); // Update state with the fetched users
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
TMSpinner.hide();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
fetchUsers();
|
|
136
|
+
}, []);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (isModal)
|
|
139
|
+
setIsMobile(true);
|
|
140
|
+
}, [isModal]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (formDataOrig && formMode === FormModes.Update) {
|
|
143
|
+
const isTaskAssignedByDifferentUser = areDifferentIDs(formDataOrig.fromID, SDK_Globals.tmSession?.SessionDescr?.userID);
|
|
144
|
+
setFieldsReadOnly({
|
|
145
|
+
name: isTaskAssignedByDifferentUser,
|
|
146
|
+
description: isTaskAssignedByDifferentUser,
|
|
147
|
+
fromID: isTaskAssignedByDifferentUser,
|
|
148
|
+
assignedTO: isTaskAssignedByDifferentUser,
|
|
149
|
+
status: false,
|
|
150
|
+
priority: isTaskAssignedByDifferentUser,
|
|
151
|
+
startDate: isTaskAssignedByDifferentUser,
|
|
152
|
+
endDate: isTaskAssignedByDifferentUser,
|
|
153
|
+
remTime: false,
|
|
154
|
+
response: false
|
|
155
|
+
});
|
|
156
|
+
const newTaskDescriptor = new TaskDescriptor();
|
|
157
|
+
Object.assign(newTaskDescriptor, formDataOrig);
|
|
158
|
+
newTaskDescriptor.isNew = 0;
|
|
159
|
+
editTaskCallback(newTaskDescriptor);
|
|
160
|
+
}
|
|
161
|
+
else if (formDataOrig && formMode === FormModes.Create && taskContext?.dossier && currentTask) {
|
|
162
|
+
setFieldsReadOnly({
|
|
163
|
+
name: true,
|
|
164
|
+
description: false,
|
|
165
|
+
fromID: false,
|
|
166
|
+
assignedTO: false,
|
|
167
|
+
status: false,
|
|
168
|
+
priority: false,
|
|
169
|
+
startDate: false,
|
|
170
|
+
endDate: false,
|
|
171
|
+
remTime: false,
|
|
172
|
+
response: false
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, [formDataOrig, formMode]);
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
if (!isModal) {
|
|
178
|
+
// Function to handle resize events and update the mobile state based on container width.
|
|
179
|
+
const updateDimensions = (entries) => {
|
|
180
|
+
for (let entry of entries) {
|
|
181
|
+
const { width } = entry.contentRect;
|
|
182
|
+
setIsMobile(width <= mobileBreakpoint);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
// Create a ResizeObserver to observe container size changes
|
|
186
|
+
const resizeObserver = new ResizeObserver(updateDimensions);
|
|
187
|
+
if (containerRef.current) {
|
|
188
|
+
resizeObserver.observe(containerRef.current);
|
|
189
|
+
}
|
|
190
|
+
// Cleanup: Stop observing when the component unmounts or the dependency changes.
|
|
191
|
+
return () => {
|
|
192
|
+
if (containerRef.current) {
|
|
193
|
+
resizeObserver.unobserve(containerRef.current);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}, [containerRef, isModal]); // Dependency array ensures this effect runs when containerRef changes.
|
|
199
|
+
// Function to handle changes in the status value of a TM Drop Down
|
|
200
|
+
const onStatusValueChange = (e) => {
|
|
201
|
+
if (!e?.target?.value)
|
|
202
|
+
return;
|
|
203
|
+
setFormData({ ...formData ?? {}, state: e?.target?.value });
|
|
204
|
+
};
|
|
205
|
+
// Function to handle changes in the priority value of a TM Drop Down
|
|
206
|
+
const onPriorityValueChange = (e) => {
|
|
207
|
+
if (!e?.target?.value)
|
|
208
|
+
return;
|
|
209
|
+
setFormData({ ...formData ?? {}, priority: e?.target?.value });
|
|
210
|
+
};
|
|
211
|
+
const onAnswerChange = (e) => {
|
|
212
|
+
setFormData({ ...formData ?? {}, response: e.target.value ?? '' });
|
|
213
|
+
};
|
|
214
|
+
// Function to handle the undo action
|
|
215
|
+
const onUndoCallback = () => {
|
|
216
|
+
setFormData(formDataOrig);
|
|
217
|
+
};
|
|
218
|
+
const canNext = () => {
|
|
219
|
+
if (currentTask === null)
|
|
220
|
+
return false;
|
|
221
|
+
if (visualizedTasks.length === 1)
|
|
222
|
+
return false;
|
|
223
|
+
let index = visualizedTasks.findIndex(item => item.id === currentTask.id);
|
|
224
|
+
if (index < visualizedTasks.length - 1) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const canPrev = () => {
|
|
232
|
+
if (currentTask === null)
|
|
233
|
+
return false;
|
|
234
|
+
if (visualizedTasks.length === 1)
|
|
235
|
+
return false;
|
|
236
|
+
let index = visualizedTasks.findIndex(item => item.id === currentTask.id);
|
|
237
|
+
if (index > 0) {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
const onNextCallback = () => {
|
|
245
|
+
if (currentTask === null)
|
|
246
|
+
return;
|
|
247
|
+
if (visualizedTasks.length === 0)
|
|
248
|
+
return;
|
|
249
|
+
let index = visualizedTasks.findIndex(item => item.id === currentTask.id);
|
|
250
|
+
const nextTask = visualizedTasks[index + 1];
|
|
251
|
+
if (nextTask) {
|
|
252
|
+
setCurrentTask?.(nextTask);
|
|
253
|
+
if (nextTask.id)
|
|
254
|
+
handleFocusedRowKeyChange?.(nextTask);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const onPrevCallback = () => {
|
|
258
|
+
if (currentTask === null)
|
|
259
|
+
return;
|
|
260
|
+
if (visualizedTasks.length === 0)
|
|
261
|
+
return;
|
|
262
|
+
let index = visualizedTasks.findIndex(item => item.id === currentTask.id);
|
|
263
|
+
const prevTask = visualizedTasks[index - 1];
|
|
264
|
+
if (prevTask) {
|
|
265
|
+
setCurrentTask?.(prevTask);
|
|
266
|
+
if (prevTask.id)
|
|
267
|
+
handleFocusedRowKeyChange?.(prevTask);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const gotoPDGExtendedLabelClickCallback = () => {
|
|
271
|
+
// Return early if formData is not defined
|
|
272
|
+
if (!formData)
|
|
273
|
+
return;
|
|
274
|
+
// Destructure needed properties from formData
|
|
275
|
+
const { pdG = PdGs.None, iD1, iD2, iD1Name } = formData;
|
|
276
|
+
// Check if pdG is None
|
|
277
|
+
if (pdG === PdGs.None)
|
|
278
|
+
return;
|
|
279
|
+
// If both id1 and id2 are present and pdg is of type DT, show the document form
|
|
280
|
+
if (iD1 && iD2 && pdG === PdGs.DT) {
|
|
281
|
+
setShowDcmtForm(true);
|
|
282
|
+
return; // Exit the function after showing the form
|
|
283
|
+
}
|
|
284
|
+
if (iD1 && pdG === PdGs.WG) {
|
|
285
|
+
// Working Group navigation
|
|
286
|
+
if (handleNavigateToWGs) {
|
|
287
|
+
handleNavigateToWGs(iD1);
|
|
288
|
+
}
|
|
289
|
+
return; // Exit the function after navigation
|
|
290
|
+
}
|
|
291
|
+
if (iD1 && pdG === PdGs.CF) {
|
|
292
|
+
// Dossier navigation
|
|
293
|
+
if (handleNavigateToDossiers) {
|
|
294
|
+
handleNavigateToDossiers(iD1);
|
|
295
|
+
}
|
|
296
|
+
return; // Exit the function after navigation
|
|
297
|
+
}
|
|
298
|
+
// Otherwise, alert the user with the provided information
|
|
299
|
+
alert(gotoPDGExtendedLabel(false, pdG, iD1Name));
|
|
300
|
+
};
|
|
301
|
+
const handleStartTimeContentReady = () => {
|
|
302
|
+
setTimeout(() => { if (startDate && !formData?.startTime && formMode === FormModes.Create) {
|
|
303
|
+
setFormData(prev => ({ ...prev, startTime: startDate }));
|
|
304
|
+
} }, 100);
|
|
305
|
+
};
|
|
306
|
+
const handleEndTimeContentReady = () => {
|
|
307
|
+
setTimeout(() => { if (endDate && !formData?.endTime && formMode === FormModes.Create) {
|
|
308
|
+
setFormData(prev => ({ ...prev, endTime: endDate }));
|
|
309
|
+
} }, 200);
|
|
310
|
+
};
|
|
311
|
+
const onCloseCallback = () => {
|
|
312
|
+
if (formData && formData.id) {
|
|
313
|
+
if (!selectedRowKeys.includes(formData.id)) {
|
|
314
|
+
handleFocusedRowKeyChange?.(formData);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
onClose?.();
|
|
318
|
+
};
|
|
319
|
+
const onTaskCompleted = async (task) => {
|
|
320
|
+
await editTaskCallback(task);
|
|
321
|
+
onClose?.();
|
|
322
|
+
};
|
|
323
|
+
return (_jsx("div", { style: { width: "100%", height: "100%", overflow: "auto" }, ref: containerRef, children: _jsx(TMSaveForm, { width: width, height: height, id: id, title: title, isModal: isModal, formMode: formMode, onSaveAsync: saveDataAsync, onClose: onCloseCallback, onUndo: onUndoCallback, exception: exception, isModified: calcIsModified(formData, formDataOrig), validationItems: validationItems, showBackButton: showBackButton, hasNavigation: (hasNavigation && formMode !== FormModes.Create), canNext: canNext(), onNext: onNextCallback, canPrev: canPrev(), onPrev: onPrevCallback, showToolbar: !(showDcmtForm && formData?.iD1 && formData?.iD2), children: _jsxs(_Fragment, { children: [_jsx(ScrollView, { direction: "vertical", useNative: true, height: "calc(100% - 35px)", children: _jsx("div", { style: { marginRight: "5px" }, children: _jsxs(TMLayoutContainer, { direction: 'vertical', gap: 2, children: [(formMode === FormModes.Update && areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) && _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs("div", { style: { width: '100%', display: 'flex', alignItems: 'center', color: "#E29000" }, children: [_jsx("i", { className: "dx-icon-info", style: { fontSize: 20 } }), "\u00A0", _jsx("span", { children: SDKUI_Localizator.TaskAssignedMessage.replaceParams(formDataOrig?.fromName ?? '') })] }) }), taskContext?.workItem === undefined && (!areDifferentIDs(formData?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)
|
|
324
|
+
&& !areDifferentIDs(formData?.toID, SDK_Globals.tmSession?.SessionDescr?.userID))
|
|
325
|
+
&& _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs("div", { style: { width: '100%', display: 'flex', alignItems: 'center', color: "#2559A5" }, children: [_jsx("i", { className: "dx-icon-info", style: { fontSize: 20 } }), "\u00A0", _jsx("span", { children: SDKUI_Localizator.PersonalTaskAssignmentMessage })] }) }), (!areDifferentIDs(formData?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)
|
|
326
|
+
&& areDifferentIDs(formData?.toID, SDK_Globals.tmSession?.SessionDescr?.userID))
|
|
327
|
+
&& _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs("div", { style: { width: '100%', display: 'flex', alignItems: 'center', color: "#2559A5" }, children: [_jsx("i", { className: "dx-icon-info", style: { fontSize: 20 } }), "\u00A0", _jsx("span", { children: SDKUI_Localizator.TaskAssignedToUserMessage.replaceParams(users.find(user => user.id === formData?.toID)?.name ?? '-') })] }) }), renderContextBlock({
|
|
328
|
+
condition: formMode === FormModes.Create && isContextualCreate && !!taskContext?.workingGroup?.id,
|
|
329
|
+
pdg: PdGs.WG,
|
|
330
|
+
label: getOriginLabel(PdGs.WG, taskContext?.workingGroup?.name),
|
|
331
|
+
isMobile: isMobile
|
|
332
|
+
}), renderContextBlock({
|
|
333
|
+
condition: formMode === FormModes.Create && isContextualCreate && !!taskContext?.dossier?.id,
|
|
334
|
+
pdg: PdGs.CF,
|
|
335
|
+
label: getOriginLabel(PdGs.CF, taskContext?.dossier?.name),
|
|
336
|
+
isMobile: isMobile
|
|
337
|
+
}), renderContextBlock({
|
|
338
|
+
condition: formMode === FormModes.Create && isContextualCreate && !!taskContext?.document?.tid && !!taskContext?.document?.did,
|
|
339
|
+
pdg: PdGs.DT,
|
|
340
|
+
label: getOriginLabel(PdGs.DT, taskContext?.document?.name),
|
|
341
|
+
isMobile: isMobile
|
|
342
|
+
}), renderContextBlock({
|
|
343
|
+
condition: formMode === FormModes.Create && isContextualCreate && !!taskContext?.workItem?.tid && !!taskContext?.workItem?.did,
|
|
344
|
+
pdg: PdGs.DT,
|
|
345
|
+
label: getOriginLabel(PdGs.DT, taskContext?.workItem?.name),
|
|
346
|
+
isMobile: isMobile
|
|
347
|
+
}), formMode === FormModes.Update && formData?.pdG && formData?.iD1Name && (_jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => (_jsx("div", { style: {
|
|
348
|
+
display: 'flex',
|
|
349
|
+
flexDirection: 'row',
|
|
350
|
+
width: '100%',
|
|
351
|
+
gap: 16,
|
|
352
|
+
padding: '8px 0'
|
|
353
|
+
}, children: children })), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx("div", { style: {
|
|
354
|
+
display: 'flex',
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
marginTop: 12
|
|
357
|
+
}, children: _jsx(TMTooltip, { content: formData.pdG !== PdGs.None ? gotoPDGExtendedLabel(true, formData.pdG, formData.iD1Name) : '', children: _jsxs("span", { onClick: () => formData.pdG !== PdGs.None ? gotoPDGExtendedLabelClickCallback() : null, style: {
|
|
358
|
+
display: 'inline-flex',
|
|
359
|
+
alignItems: 'center',
|
|
360
|
+
padding: '6px 10px',
|
|
361
|
+
borderRadius: 8,
|
|
362
|
+
backgroundColor: formData.pdG !== PdGs.None ? '#f5f5f7' : 'transparent',
|
|
363
|
+
color: formData.pdG !== PdGs.None ? '#2559A5' : '#444',
|
|
364
|
+
cursor: formData.pdG !== PdGs.None ? 'pointer' : 'default',
|
|
365
|
+
fontWeight: 600,
|
|
366
|
+
transition: 'all 0.25s ease',
|
|
367
|
+
gap: 6
|
|
368
|
+
}, onMouseEnter: e => {
|
|
369
|
+
if (formData.pdG !== PdGs.None)
|
|
370
|
+
e.currentTarget.style.backgroundColor = '#ebebef';
|
|
371
|
+
}, onMouseLeave: e => {
|
|
372
|
+
if (formData.pdG !== PdGs.None)
|
|
373
|
+
e.currentTarget.style.backgroundColor = '#f5f5f7';
|
|
374
|
+
}, children: [getPdgsIconMap().get(formData.pdG), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
|
|
375
|
+
_jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo), onValueChanged: (newValue) => {
|
|
376
|
+
if (newValue === undefined)
|
|
377
|
+
return;
|
|
378
|
+
setFormData({ ...formData ?? {}, toID: newValue[0] });
|
|
379
|
+
} }) })
|
|
380
|
+
: formMode === FormModes.Update && _jsxs(_Fragment, { children: [areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedBy, value: formData?.fromName ?? '', readOnly: true }) }), areDifferentIDs(formDataOrig?.toID, SDK_Globals.tmSession?.SessionDescr?.userID) && _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.AssignedTo, value: formData?.toName ?? '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.Status, value: formData?.state, dataSource: getStatusLocalizatorValues(), isModifiedWhen: formData?.state !== formDataOrig?.state, onValueChanged: onStatusValueChange, readOnly: fieldsReadOnly.status }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: !fieldsReadOnly.priority ? _jsx(TMDropDown, { label: SDKUI_Localizator.Priority, value: formData?.priority, dataSource: getPriorityLocalizatorValues(), isModifiedWhen: formData?.priority !== formDataOrig?.priority, onValueChanged: onPriorityValueChange })
|
|
381
|
+
: _jsx(TMTextBox, { label: SDKUI_Localizator.Priority, value: getPriorityLocalizatorValue(formData?.priority ?? Priorities.Low), readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsxs(_Fragment, { children: [_jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "start-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.StartDate, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.startTime, isModifiedWhen: formData?.startTime !== formDataOrig?.startTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate), onContentReady: handleStartTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, startTime: value }); }, showClearButton: true }) : _jsx(TMTextBox, { label: SDKUI_Localizator.StartDate, value: formData?.startTime ? formatDate(formData?.startTime) : '', readOnly: true }) }), _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: !fieldsReadOnly.startDate ? _jsx(TMDateBox, { id: "end-date", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Expiration, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.endTime, isModifiedWhen: formData?.endTime !== formDataOrig?.endTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorStartEndDate || o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onContentReady: handleEndTimeContentReady, onValueChange: (value) => { setFormData({ ...formData ?? {}, endTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.endDate }) : _jsx(TMTextBox, { label: SDKUI_Localizator.Expiration, value: formData?.endTime ? formatDate(formData?.endTime) : '', readOnly: true }) })] }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsx(TMDateBox, { id: "alert-time", resetTimeToZeroOnKeyPress: false, label: SDKUI_Localizator.Reminder, dateDisplayType: DateDisplayTypes.DateTime, value: formData?.remTime ?? undefined, isModifiedWhen: formData?.remTime !== formDataOrig?.remTime, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.ErrorEndRemDate), onValueChange: (value) => { setFormData({ ...formData ?? {}, remTime: value }); }, showClearButton: true, readOnly: fieldsReadOnly.remTime }) }) }), (formData?.state && [Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state) ||
|
|
382
|
+
(formData?.response ?? "") !== "") && _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 3 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%', marginTop: 10 }, children: _jsxs(ResponseCommentWrapper, { children: [_jsx(ResponseCommentTextArea, { id: "responseId", name: "response", "$isValid": true, value: formData?.response ?? '', onChange: onAnswerChange, "$isModifiedWhen": formData?.response !== formDataOrig?.response, disabled: (formData?.response ?? "") !== "" &&
|
|
383
|
+
(formData?.state && ![Task_States.Completed, Task_States.Waiting, Task_States.Deferred].includes(formData?.state)) }), _jsxs(ResponseCommentLabel, { htmlFor: "responseId", children: [SDKUI_Localizator.Answer, _jsxs(TMTooltip, { content: SDKUI_Localizator.AnswerTooltip, children: [" ", _jsx("i", { className: 'dx-icon-info' }), " "] })] }), _jsx(ResponseCommentCharacterCounter, { children: `${500 - (formData?.response ?? '').length} ${SDKUI_Localizator.CharactersRemaining}` })] }) }) })] }) }) }), (showDcmtForm && formData?.iD1 && formData?.iD2) &&
|
|
384
|
+
_jsx(TMDcmtForm, { titleModal: formData.iD1Name ?? '-', isModal: true, TID: formData.iD1, DID: formData.iD2, allowButtonsRefs: true, taskMoreInfo: formData, onWFOperationCompleted: refreshWorkflowApprove, onTaskCompleted: onTaskCompleted, onClose: () => { setShowDcmtForm(false); }, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }) }) }));
|
|
385
|
+
};
|
|
386
|
+
export default TMTaskForm;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TaskDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { FormModes } from "../../../ts";
|
|
4
|
+
interface TMTasksAgendaProps {
|
|
5
|
+
id: string;
|
|
6
|
+
showId: boolean;
|
|
7
|
+
showSearch: boolean;
|
|
8
|
+
visualizedTasks: Array<TaskDescriptor>;
|
|
9
|
+
fromCell: boolean;
|
|
10
|
+
toCell: boolean;
|
|
11
|
+
currentAgendaDate: Date;
|
|
12
|
+
setCurrentAgendaDate: React.Dispatch<React.SetStateAction<Date>>;
|
|
13
|
+
openTaskForm: (formMode: FormModes, task?: TaskDescriptor) => void;
|
|
14
|
+
handleFocusedRowChange: (row: TaskDescriptor | undefined) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const TMTasksAgenda: React.MemoExoticComponent<(props: TMTasksAgendaProps) => import("react/jsx-runtime").JSX.Element>;
|
|
17
|
+
export default TMTasksAgenda;
|