@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
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { AssignedTab, checkIfNew, createTasksMenuItems, getHeaderPriorityFilterConfig, getHeaderStatusFilterConfig, getMondayOfCurrentWeek, getNewTaskCount, getStatusLocalizatorValue, isTaskAssignedToAnotherUser, TaskView, TEXT_NOT_SELECTED_COLOR } from "./TMTasksUtils";
|
|
4
|
+
import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
|
5
|
+
import { Priorities, ResultTypes, SDK_Globals, Task_States } from "@topconsultnpm/sdk-ts";
|
|
6
|
+
import { calculateNumberOfDays, renderTaskIcons } from "./TMTasksUtilsView";
|
|
7
|
+
import { getPriorityLocalizatorValue } from "../tasks/TMTasksUtils";
|
|
8
|
+
import ContextMenu from 'devextreme-react/cjs/context-menu';
|
|
9
|
+
import { calcResponsiveSizes, getExceptionMessage, SDKUI_Localizator, StyledTabItem, TMCountBadge } from "../../../helper";
|
|
10
|
+
import { useDeviceType } from "../../base/TMDeviceProvider";
|
|
11
|
+
import { FormModes } from "../../../ts";
|
|
12
|
+
import TMDataGrid from "../../base/TMDataGrid";
|
|
13
|
+
import { TMMessageBoxManager, ButtonNames } from "../../base/TMPopUp";
|
|
14
|
+
import TMTooltip from "../../base/TMTooltip";
|
|
15
|
+
import { TMLayoutWaitingContainer } from "../../base/TMWaitPanel";
|
|
16
|
+
import { TMResultManager } from "../../forms/TMResultDialog";
|
|
17
|
+
import TMTasksCalendar from "./TMTasksCalendar";
|
|
18
|
+
import TMTasksAgenda from "./TMTasksAgenda";
|
|
19
|
+
import TMTaskForm from "./TMTaskForm";
|
|
20
|
+
let abortController = new AbortController();
|
|
21
|
+
const TMTasksView = (props) => {
|
|
22
|
+
const { id, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, visualizedTasks, activeComponent, activeTabIndex, setActiveTabIndex, currentTask, setCurrentTask, assignedToMeCount, assignedByMeCount, allTasksFilteredCount, showId, setShowId, showSearch, setShowSearch, showContextualWG, setShowContextualWG, showContextualDossier, setShowContextualDossier, showContextualDocument, setShowContextualDocument, handleNavigateToWGs, handleNavigateToDossiers, taskContext, usersList, onOpenS4TViewerRequest, s4TViewerDialogComponent, afterTaskSaved, } = props;
|
|
23
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
24
|
+
const deviceType = useDeviceType();
|
|
25
|
+
// State to manage show comment form selected file
|
|
26
|
+
const [showTaskForm, setShowTaskForm] = useState(false);
|
|
27
|
+
// State to store form mode (None, Create, Update, Duplicate, ReadOnly)
|
|
28
|
+
const [formMode, setFormMode] = useState(undefined);
|
|
29
|
+
// State to know if there are filters applied
|
|
30
|
+
const [hasFilters, setHasFilters] = useState(false);
|
|
31
|
+
// State to store selected row keys
|
|
32
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
33
|
+
// State hook to store the currently focused row key, initially set to undefined
|
|
34
|
+
const [focusedRowKey, setFocusedRowKey] = useState(undefined);
|
|
35
|
+
// State to manage the current agenda date
|
|
36
|
+
const [currentAgendaDate, setCurrentAgendaDate] = useState(getMondayOfCurrentWeek(new Date()));
|
|
37
|
+
// State to manage the current agenda date
|
|
38
|
+
const [currentCalendarDate, setCurrentCalendarDate] = useState(getMondayOfCurrentWeek(new Date()));
|
|
39
|
+
/* State to manage the calendar start date */
|
|
40
|
+
const [calendarStartDate, setCalendarStartDate] = useState(undefined);
|
|
41
|
+
/* State to manage the calendar end date */
|
|
42
|
+
const [calendarEndDate, setCalendarEndDate] = useState(undefined);
|
|
43
|
+
// State variable to control the visibility of the wait panel.
|
|
44
|
+
const [showWaitPanel, setShowWaitPanel] = useState(false);
|
|
45
|
+
// State variable to store the title of the wait panel.
|
|
46
|
+
const [waitPanelTitle, setWaitPanelTitle] = useState('');
|
|
47
|
+
// State variable to control the visibility of the primary section of the wait panel.
|
|
48
|
+
const [showPrimary, setShowPrimary] = useState(false);
|
|
49
|
+
// State variable to store the primary text of the wait panel.
|
|
50
|
+
const [waitPanelTextPrimary, setWaitPanelTextPrimary] = useState('');
|
|
51
|
+
// State variable to track the current value of the primary progress indicator in the wait panel.
|
|
52
|
+
const [waitPanelValuePrimary, setWaitPanelValuePrimary] = useState(0);
|
|
53
|
+
// State variable to define the maximum value for the primary progress indicator in the wait panel.
|
|
54
|
+
const [waitPanelMaxValuePrimary, setWaitPanelMaxValuePrimary] = useState(0);
|
|
55
|
+
const [isContextualCreate, setIsContextualCreate] = useState(false);
|
|
56
|
+
// This function open the task form for editing a selected task
|
|
57
|
+
const editTaskAgendaCallback = (rowId) => {
|
|
58
|
+
if (rowId === undefined)
|
|
59
|
+
return;
|
|
60
|
+
const selectedTask = visualizedTasks.find(task => task.id === rowId);
|
|
61
|
+
if (selectedTask) {
|
|
62
|
+
openTaskFormCallback(FormModes.Update, selectedTask);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
console.error(`Task with ID ${rowId} not found.`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const onDuplicateAgendaCallback = (rowId) => {
|
|
69
|
+
if (rowId === undefined)
|
|
70
|
+
return;
|
|
71
|
+
const selectedTask = visualizedTasks.find(task => task.id === rowId);
|
|
72
|
+
if (selectedTask) {
|
|
73
|
+
openTaskFormCallback(FormModes.Duplicate, selectedTask);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.error(`Task with ID ${rowId} not found.`);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const agendaCalendarItems = useCallback(() => {
|
|
80
|
+
const taskDescriptor = visualizedTasks.find(task => task.id === focusedRowKey);
|
|
81
|
+
return [
|
|
82
|
+
...createTasksMenuItems(taskDescriptor, showId, setShowId, showSearch, setShowSearch, () => { openTaskFormCallback(FormModes.Create); }, () => { if (focusedRowKey)
|
|
83
|
+
editTaskAgendaCallback(focusedRowKey); }, () => { if (focusedRowKey)
|
|
84
|
+
onDuplicateAgendaCallback(focusedRowKey); }, () => { if (focusedRowKey)
|
|
85
|
+
onDeleteCallback([focusedRowKey]); }, (rowIds, status) => { if (focusedRowKey)
|
|
86
|
+
markAsStatus([focusedRowKey], status); }, getAllTasks, taskContext?.workingGroup?.id !== undefined, showContextualWG, setShowContextualWG, taskContext?.dossier?.id !== undefined, showContextualDossier, setShowContextualDossier, taskContext?.document?.tid !== undefined && taskContext?.document?.did !== undefined, showContextualDocument, setShowContextualDocument, true, () => { setCurrentCalendarDate(new Date()); setCurrentAgendaDate(new Date()); }, false),
|
|
87
|
+
];
|
|
88
|
+
}, [visualizedTasks, focusedRowKey, showId, showSearch, showContextualWG, showContextualDossier, taskContext]);
|
|
89
|
+
const [menuItems, setMenuItems] = useState(agendaCalendarItems());
|
|
90
|
+
const newTaskCount = getNewTaskCount(allTasks);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setMenuItems(agendaCalendarItems());
|
|
93
|
+
}, [agendaCalendarItems]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (activeComponent !== TaskView.CALENDAR_TASK) {
|
|
96
|
+
setCalendarStartDate(undefined);
|
|
97
|
+
setCalendarEndDate(undefined);
|
|
98
|
+
}
|
|
99
|
+
}, [activeComponent]);
|
|
100
|
+
// Callback function to close the task form and reset related states
|
|
101
|
+
const closeTaskFormCallback = useCallback(() => {
|
|
102
|
+
setFormMode(undefined);
|
|
103
|
+
setShowTaskForm(false);
|
|
104
|
+
}, []);
|
|
105
|
+
// Callback function to open the task form in a specific mode
|
|
106
|
+
const openTaskFormCallback = useCallback((mode, task, isContextual) => {
|
|
107
|
+
setFormMode(mode);
|
|
108
|
+
setShowTaskForm(true);
|
|
109
|
+
setIsContextualCreate(isContextual ?? false);
|
|
110
|
+
// If a task is provided, set it as the current task to be processed
|
|
111
|
+
setCurrentTask(task ?? null);
|
|
112
|
+
}, []);
|
|
113
|
+
// Updates the active tab index when the selected index changes
|
|
114
|
+
const onSelectedIndexChange = (index) => {
|
|
115
|
+
setActiveTabIndex(index);
|
|
116
|
+
setSelectedRowKeys([]);
|
|
117
|
+
};
|
|
118
|
+
const handleSelectionChange = useCallback((rows) => {
|
|
119
|
+
const selectedKeys = rows.map(row => row.id).filter(id => id !== undefined);
|
|
120
|
+
setSelectedRowKeys([...selectedKeys]);
|
|
121
|
+
}, []);
|
|
122
|
+
// Handles focus change in the data grid
|
|
123
|
+
const handleFocusedRowChange = useCallback((row) => {
|
|
124
|
+
setFocusedRowKey(row?.id ?? undefined);
|
|
125
|
+
}, []);
|
|
126
|
+
// Handles selection change in the data grid
|
|
127
|
+
const onSelectionChanged = useCallback((e) => {
|
|
128
|
+
const selectedKeys = e.component.getSelectedRowKeys() ?? [];
|
|
129
|
+
if (JSON.stringify(selectedKeys) === JSON.stringify(selectedRowKeys))
|
|
130
|
+
return;
|
|
131
|
+
setSelectedRowKeys(selectedKeys);
|
|
132
|
+
}, [selectedRowKeys]);
|
|
133
|
+
// Handles focus change in the data grid
|
|
134
|
+
const onFocusedRowChanged = useCallback((e) => {
|
|
135
|
+
setFocusedRowKey(e.row?.key);
|
|
136
|
+
}, []);
|
|
137
|
+
// Handler for double-click row event
|
|
138
|
+
const onRowDblClick = useCallback((e) => {
|
|
139
|
+
openTaskFormCallback(FormModes.Update, e.data);
|
|
140
|
+
}, [openTaskFormCallback]);
|
|
141
|
+
const onDeleteCallback = useCallback((rowIds) => {
|
|
142
|
+
let msg = "";
|
|
143
|
+
switch (rowIds.length) {
|
|
144
|
+
case 0: return;
|
|
145
|
+
case 1: {
|
|
146
|
+
const selectedTaskId = Number(rowIds[0]);
|
|
147
|
+
const selectedTask = visualizedTasks.find(task => task.id === selectedTaskId);
|
|
148
|
+
if (selectedTask)
|
|
149
|
+
msg = SDKUI_Localizator.Delete_ConfirmFor1.replaceParams(selectedTask.name);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
default:
|
|
153
|
+
msg = SDKUI_Localizator.Delete_ConfirmForN.replaceParams(rowIds.length);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
TMMessageBoxManager.show({
|
|
157
|
+
title: SDKUI_Localizator.Delete, message: msg, buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
158
|
+
onButtonClick: async (e) => {
|
|
159
|
+
if (e !== ButtonNames.YES)
|
|
160
|
+
return;
|
|
161
|
+
setWaitPanelTitle(SDKUI_Localizator.Delete);
|
|
162
|
+
setShowWaitPanel(true);
|
|
163
|
+
setShowPrimary(true);
|
|
164
|
+
abortController = new AbortController();
|
|
165
|
+
let result = [];
|
|
166
|
+
let i = 0;
|
|
167
|
+
const deletedTaskIds = [];
|
|
168
|
+
setWaitPanelMaxValuePrimary(rowIds.length);
|
|
169
|
+
for (const key of rowIds) {
|
|
170
|
+
i++;
|
|
171
|
+
const deletedTaskId = Number(key);
|
|
172
|
+
const deletedTask = visualizedTasks.find(task => task.id === deletedTaskId);
|
|
173
|
+
setWaitPanelValuePrimary(i);
|
|
174
|
+
if (abortController.signal.aborted) {
|
|
175
|
+
result.push({ rowIndex: i, id1: deletedTaskId, id2: deletedTaskId, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborate ${i} attività` });
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
setWaitPanelTextPrimary(SDKUI_Localizator.TaskXofY.replaceParams(i, rowIds.length));
|
|
180
|
+
try {
|
|
181
|
+
const deletionNotAllowed = deletedTask?.fromID !== SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
182
|
+
if (deletionNotAllowed) {
|
|
183
|
+
result.push({ rowIndex: key, id1: key, id2: 0, resultType: ResultTypes.ERROR, description: SDKUI_Localizator.OperationNotAllowed });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
await SDK_Globals.tmSession?.NewTaskEngine().DeleteAsync(deletedTaskId);
|
|
187
|
+
result.push({ rowIndex: key, id1: key, id2: 0, description: SDKUI_Localizator.DeletionCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
188
|
+
deletedTaskIds.push(deletedTaskId);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
result.push({ rowIndex: key, id1: key, id2: 0, resultType: ResultTypes.ERROR, description: getExceptionMessage(err) });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
await deleteTaskByIdsCallback(deletedTaskIds);
|
|
197
|
+
handleSelectionChange([]);
|
|
198
|
+
setWaitPanelTextPrimary('');
|
|
199
|
+
setWaitPanelMaxValuePrimary(0);
|
|
200
|
+
setWaitPanelValuePrimary(0);
|
|
201
|
+
setShowWaitPanel(false);
|
|
202
|
+
TMResultManager.show(result, SDKUI_Localizator.Delete, "ID", undefined);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}, [visualizedTasks]);
|
|
206
|
+
const markAsStatus = useCallback((rowIds, status) => {
|
|
207
|
+
let msg = "";
|
|
208
|
+
switch (rowIds.length) {
|
|
209
|
+
case 0: return;
|
|
210
|
+
case 1: {
|
|
211
|
+
const selectedTaskId = Number(rowIds[0]);
|
|
212
|
+
const selectedTask = visualizedTasks.find(task => task.id === selectedTaskId);
|
|
213
|
+
if (selectedTask)
|
|
214
|
+
msg = SDKUI_Localizator.Edit_ConfirmFor1.replaceParams(selectedTask.name);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
default:
|
|
218
|
+
msg = SDKUI_Localizator.Edit_ConfirmForN.replaceParams(rowIds.length);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
TMMessageBoxManager.show({
|
|
222
|
+
title: SDKUI_Localizator.MarkAs, message: msg, buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
223
|
+
onButtonClick: async (e) => {
|
|
224
|
+
if (e !== ButtonNames.YES)
|
|
225
|
+
return;
|
|
226
|
+
setWaitPanelTitle(SDKUI_Localizator.MarkAs);
|
|
227
|
+
setShowWaitPanel(true);
|
|
228
|
+
setShowPrimary(true);
|
|
229
|
+
abortController = new AbortController();
|
|
230
|
+
let result = [];
|
|
231
|
+
let i = 0;
|
|
232
|
+
setWaitPanelMaxValuePrimary(rowIds.length);
|
|
233
|
+
for (const key of rowIds) {
|
|
234
|
+
i++;
|
|
235
|
+
const selectedTask = visualizedTasks.find(task => task.id === key) || undefined;
|
|
236
|
+
if (selectedTask === undefined)
|
|
237
|
+
return;
|
|
238
|
+
selectedTask.state = status;
|
|
239
|
+
setWaitPanelValuePrimary(i);
|
|
240
|
+
if (abortController.signal.aborted) {
|
|
241
|
+
result.push({ rowIndex: i, id1: selectedTask.id, id2: selectedTask.id, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborate ${i} attività` });
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
setWaitPanelTextPrimary(SDKUI_Localizator.TaskXofY.replaceParams(i, rowIds.length));
|
|
246
|
+
try {
|
|
247
|
+
await SDK_Globals.tmSession?.NewTaskEngine().UpdateAsync(selectedTask);
|
|
248
|
+
result.push({ rowIndex: key, id1: key, id2: 0, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
result.push({ rowIndex: key, id1: key, id2: 0, resultType: ResultTypes.ERROR, description: getExceptionMessage(err) });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
await getAllTasks().then(() => {
|
|
256
|
+
handleSelectionChange([]);
|
|
257
|
+
setWaitPanelTextPrimary('');
|
|
258
|
+
setWaitPanelMaxValuePrimary(0);
|
|
259
|
+
setWaitPanelValuePrimary(0);
|
|
260
|
+
setShowWaitPanel(false);
|
|
261
|
+
TMResultManager.show(result, SDKUI_Localizator.MarkAs, "ID", undefined);
|
|
262
|
+
if (afterTaskSaved) {
|
|
263
|
+
afterTaskSaved(undefined, undefined, true);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}, [visualizedTasks]);
|
|
269
|
+
const onSavedCallback = async (task) => {
|
|
270
|
+
// If task is undefined or has no ID, exit early
|
|
271
|
+
if (task === undefined || task.id === undefined)
|
|
272
|
+
return;
|
|
273
|
+
// Determine the active tab based on task assignment.
|
|
274
|
+
// If assigned to another user, switch to the "Assigned By Me" tab;
|
|
275
|
+
let activeTab = activeTabIndex;
|
|
276
|
+
if (isTaskAssignedToAnotherUser(task))
|
|
277
|
+
activeTab = AssignedTab.AssignedByMe;
|
|
278
|
+
setActiveTabIndex(activeTab);
|
|
279
|
+
// Focus the task row by setting its ID as selected in the list view
|
|
280
|
+
if (task.id) {
|
|
281
|
+
setFocusedRowKey(task.id);
|
|
282
|
+
setCurrentAgendaDate(task.startTime ?? (task.endTime ?? new Date()));
|
|
283
|
+
setCurrentCalendarDate(task.startTime ?? (task.endTime ?? new Date()));
|
|
284
|
+
}
|
|
285
|
+
// Dispatch appropriate action based on form mode (Create or Edit).
|
|
286
|
+
// If in Create mode or in Duplicate mode, add the new task; otherwise, edit the existing task.
|
|
287
|
+
if (formMode === FormModes.Create || formMode === FormModes.Duplicate) {
|
|
288
|
+
await addTaskCallback(task);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
await editTaskCallback(task);
|
|
292
|
+
}
|
|
293
|
+
if (afterTaskSaved) {
|
|
294
|
+
await afterTaskSaved(task, formMode);
|
|
295
|
+
}
|
|
296
|
+
setShowTaskForm(false);
|
|
297
|
+
};
|
|
298
|
+
const handleNavigateToDossiersWrapper = useCallback(async (dossierId) => {
|
|
299
|
+
setShowTaskForm(false);
|
|
300
|
+
await handleNavigateToDossiers(dossierId);
|
|
301
|
+
}, []);
|
|
302
|
+
const handleNavigateToWGsWrapper = useCallback(async (workGroupId) => {
|
|
303
|
+
setShowTaskForm(false);
|
|
304
|
+
await handleNavigateToWGs(workGroupId);
|
|
305
|
+
}, []);
|
|
306
|
+
const onContextMenuPreparing = (e) => {
|
|
307
|
+
if (e === undefined)
|
|
308
|
+
return;
|
|
309
|
+
if (e.target === 'content') {
|
|
310
|
+
e.items = e.items || [];
|
|
311
|
+
e.items = createTasksMenuItems(e.row?.data, showId, setShowId, showSearch, setShowSearch, openTaskFormCallback, () => { openTaskFormCallback(FormModes.Update, e.row?.data); }, () => { openTaskFormCallback(FormModes.Duplicate, e.row?.data); }, onDeleteCallback, markAsStatus, getAllTasks, taskContext?.workingGroup?.id !== undefined, showContextualWG, setShowContextualWG, taskContext?.dossier?.id !== undefined, showContextualDossier, setShowContextualDossier, taskContext?.document?.tid !== undefined && taskContext?.document?.did !== undefined, showContextualDocument, setShowContextualDocument, false);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const RenderCustomHeader = ({ data }) => { return _jsx("p", { style: { color: TEXT_NOT_SELECTED_COLOR }, children: data.column.caption }); };
|
|
315
|
+
const cellDefaultRender = useCallback((cellData) => {
|
|
316
|
+
const data = cellData.data;
|
|
317
|
+
const { endTime, state, fromID, isNew } = data;
|
|
318
|
+
// Determine styles
|
|
319
|
+
const isCompleted = state === Task_States.Completed;
|
|
320
|
+
const isExpired = endTime && endTime < new Date();
|
|
321
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
322
|
+
return _jsx("div", { style: {
|
|
323
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
324
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
325
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
326
|
+
}, children: cellData.value });
|
|
327
|
+
}, []);
|
|
328
|
+
const cellStateRender = useCallback((cellData) => {
|
|
329
|
+
const data = cellData.data;
|
|
330
|
+
const { startTime, endTime, remTime, pdG, iD1Name, state, fromID, isNew } = data;
|
|
331
|
+
// Determine styles
|
|
332
|
+
const isCompleted = state === Task_States.Completed;
|
|
333
|
+
const isExpired = endTime && endTime < new Date();
|
|
334
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
335
|
+
const stateLabel = state || Task_States.None;
|
|
336
|
+
const stateTooltipLabel = getStatusLocalizatorValue(stateLabel);
|
|
337
|
+
const numberOfDays = calculateNumberOfDays(startTime, endTime);
|
|
338
|
+
return _jsx("div", { style: {
|
|
339
|
+
display: 'flex',
|
|
340
|
+
alignItems: 'left',
|
|
341
|
+
justifyContent: 'left',
|
|
342
|
+
gap: 2,
|
|
343
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
344
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
345
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
346
|
+
}, children: renderTaskIcons({
|
|
347
|
+
stateLabel,
|
|
348
|
+
stateTooltipLabel,
|
|
349
|
+
pdg: pdG ?? undefined,
|
|
350
|
+
ID1Name: iD1Name ?? '',
|
|
351
|
+
endTime,
|
|
352
|
+
remTime,
|
|
353
|
+
isNew: isNewTask,
|
|
354
|
+
numberOfDays
|
|
355
|
+
}) });
|
|
356
|
+
}, []);
|
|
357
|
+
const cellPriorityRender = useCallback((cellData) => {
|
|
358
|
+
const data = cellData.data;
|
|
359
|
+
const { endTime, state, fromID, isNew } = data;
|
|
360
|
+
const priorityLabel = getPriorityLocalizatorValue(cellData.value || Priorities.Low);
|
|
361
|
+
// Determine styles
|
|
362
|
+
const isCompleted = state === Task_States.Completed;
|
|
363
|
+
const isExpired = endTime && endTime < new Date();
|
|
364
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
365
|
+
return _jsx("div", { style: {
|
|
366
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
367
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
368
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
369
|
+
}, children: priorityLabel });
|
|
370
|
+
}, []);
|
|
371
|
+
const cellDatetimeRender = useCallback((cellData) => {
|
|
372
|
+
const data = cellData.data;
|
|
373
|
+
const { endTime, state, fromID, isNew } = data;
|
|
374
|
+
const formattedDate = cellData.value ? new Date(cellData.value).toLocaleString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : '';
|
|
375
|
+
// Determine styles
|
|
376
|
+
const isCompleted = state === Task_States.Completed;
|
|
377
|
+
const isExpired = endTime && endTime < new Date();
|
|
378
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
379
|
+
return _jsx("div", { style: {
|
|
380
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
381
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
382
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
383
|
+
}, children: formattedDate });
|
|
384
|
+
}, []);
|
|
385
|
+
const cellFromRender = useCallback((cellData) => {
|
|
386
|
+
const data = cellData.data;
|
|
387
|
+
const { endTime, state, fromID, isNew, fromName } = data;
|
|
388
|
+
// Determine styles
|
|
389
|
+
const isCompleted = state === Task_States.Completed;
|
|
390
|
+
const isExpired = endTime && endTime < new Date();
|
|
391
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
392
|
+
// Initial styles setup for default layout
|
|
393
|
+
let style = {
|
|
394
|
+
width: "100%",
|
|
395
|
+
height: "100%",
|
|
396
|
+
display: 'flex',
|
|
397
|
+
justifyContent: 'center',
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
400
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
401
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
402
|
+
};
|
|
403
|
+
return (_jsx("div", { style: { width: '100%', display: 'flex', alignItems: 'left', justifyContent: 'left' }, children: _jsx(TMTooltip, { content: fromName, children: _jsx("div", { style: style, children: _jsxs("div", { children: [fromName, " ", (showId && fromID) && "(" + fromID + ")", " "] }) }) }) }));
|
|
404
|
+
}, []);
|
|
405
|
+
const cellToRender = useCallback((cellData) => {
|
|
406
|
+
const data = cellData.data;
|
|
407
|
+
const { endTime, state, fromID, isNew, toName, toID } = data;
|
|
408
|
+
// Determine styles
|
|
409
|
+
const isCompleted = state === Task_States.Completed;
|
|
410
|
+
const isExpired = endTime && endTime < new Date();
|
|
411
|
+
const isNewTask = checkIfNew(fromID, isNew);
|
|
412
|
+
// Initial styles setup for default layout
|
|
413
|
+
let style = {
|
|
414
|
+
width: "100%",
|
|
415
|
+
height: "100%",
|
|
416
|
+
display: 'flex',
|
|
417
|
+
justifyContent: 'center',
|
|
418
|
+
alignItems: 'center',
|
|
419
|
+
color: isCompleted ? '#000' : (isExpired ? 'red' : '#000'),
|
|
420
|
+
textDecoration: isCompleted ? 'line-through' : 'none',
|
|
421
|
+
fontWeight: isNewTask ? 'bold' : 'normal'
|
|
422
|
+
};
|
|
423
|
+
return (_jsx("div", { style: { width: '100%', display: 'flex', alignItems: 'left', justifyContent: 'left' }, children: _jsx(TMTooltip, { content: toName, children: _jsx("div", { style: style, children: _jsxs("div", { children: [toName, " ", (showId && toID) && "(" + toID + ")", " "] }) }) }) }));
|
|
424
|
+
}, []);
|
|
425
|
+
const getDataColumns = useCallback((fromCell = false, toCell = false) => {
|
|
426
|
+
return [
|
|
427
|
+
{
|
|
428
|
+
dataField: "id",
|
|
429
|
+
caption: "ID",
|
|
430
|
+
dataType: 'string',
|
|
431
|
+
cellRender: cellDefaultRender,
|
|
432
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
433
|
+
visible: showId,
|
|
434
|
+
alignment: "left"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
dataField: "state",
|
|
438
|
+
caption: SDKUI_Localizator.Status,
|
|
439
|
+
dataType: 'string',
|
|
440
|
+
cellRender: cellStateRender,
|
|
441
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
442
|
+
headerFilter: getHeaderStatusFilterConfig(),
|
|
443
|
+
visible: true,
|
|
444
|
+
alignment: "left"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
dataField: "name",
|
|
448
|
+
caption: SDKUI_Localizator.Name,
|
|
449
|
+
dataType: 'string',
|
|
450
|
+
cellRender: cellDefaultRender,
|
|
451
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
452
|
+
visible: true,
|
|
453
|
+
alignment: "left"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
dataField: "priority",
|
|
457
|
+
caption: SDKUI_Localizator.Priority,
|
|
458
|
+
dataType: 'string',
|
|
459
|
+
cellRender: cellPriorityRender,
|
|
460
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
461
|
+
headerFilter: getHeaderPriorityFilterConfig(),
|
|
462
|
+
visible: true,
|
|
463
|
+
alignment: "left"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
dataField: "startTime",
|
|
467
|
+
caption: SDKUI_Localizator.StartDate,
|
|
468
|
+
dataType: 'datetime',
|
|
469
|
+
cellRender: cellDatetimeRender,
|
|
470
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
471
|
+
visible: true,
|
|
472
|
+
alignment: "left",
|
|
473
|
+
format: 'dd/MM/yyyy HH:mm'
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
dataField: "endTime",
|
|
477
|
+
caption: SDKUI_Localizator.Expiration,
|
|
478
|
+
dataType: 'datetime',
|
|
479
|
+
cellRender: cellDatetimeRender,
|
|
480
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
481
|
+
visible: true,
|
|
482
|
+
alignment: "left",
|
|
483
|
+
format: 'dd/MM/yyyy HH:mm'
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
dataField: "remTime",
|
|
487
|
+
caption: SDKUI_Localizator.Reminder,
|
|
488
|
+
dataType: 'datetime',
|
|
489
|
+
cellRender: cellDatetimeRender,
|
|
490
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
491
|
+
visible: true,
|
|
492
|
+
alignment: "left",
|
|
493
|
+
format: 'dd/MM/yyyy HH:mm'
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
dataField: "fromName",
|
|
497
|
+
caption: SDKUI_Localizator.AssignedBy,
|
|
498
|
+
dataType: 'string',
|
|
499
|
+
cellRender: cellFromRender,
|
|
500
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
501
|
+
visible: fromCell,
|
|
502
|
+
alignment: "left"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
dataField: "toName",
|
|
506
|
+
caption: SDKUI_Localizator.AssignedTo,
|
|
507
|
+
dataType: 'string',
|
|
508
|
+
cellRender: cellToRender,
|
|
509
|
+
headerCellRender: (e) => _jsx(RenderCustomHeader, { data: e }),
|
|
510
|
+
visible: toCell,
|
|
511
|
+
alignment: "left"
|
|
512
|
+
},
|
|
513
|
+
];
|
|
514
|
+
}, [showId]);
|
|
515
|
+
const getFromOrToDatagridElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
516
|
+
return _jsx(TMDataGrid, { dataSource: fromOrToDataSource, dataColumns: getDataColumns(fromCell, toCell), selection: { mode: 'multiple', showCheckBoxesMode: "always" }, focusedRowKey: focusedRowKey, selectedRowKeys: [...selectedRowKeys], onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onRowDblClick: onRowDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: showSearch, noDataText: SDKUI_Localizator.TasksEmpty, counterConfig: { show: true }, onHasFiltersChange: (active) => setHasFilters(active) });
|
|
517
|
+
};
|
|
518
|
+
const getFromOrToAgendaElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
519
|
+
return _jsxs("div", { style: { width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: "auto" }, children: [_jsx(ContextMenu, { dataSource: menuItems, target: `#tasks-agenda-wrapper-${id}` }), _jsx("div", { style: { width: "100%", height: "100%" }, children: _jsx(TMTasksAgenda, { id: id, showId: showId, showSearch: showSearch, visualizedTasks: fromOrToDataSource, fromCell: fromCell, toCell: toCell, currentAgendaDate: currentAgendaDate, setCurrentAgendaDate: setCurrentAgendaDate, openTaskForm: openTaskFormCallback, handleFocusedRowChange: handleFocusedRowChange }) })] });
|
|
520
|
+
};
|
|
521
|
+
const getFromOrToCalendarElement = (fromOrToDataSource, fromCell = false, toCell = false) => {
|
|
522
|
+
return _jsxs("div", { style: { width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: "auto" }, children: [_jsx(ContextMenu, { dataSource: menuItems, target: `#tasks-calendar-wrapper-${id}` }), _jsx("div", { style: { width: "100%", height: "100%" }, children: _jsx(TMTasksCalendar, { id: id, visualizedTasks: fromOrToDataSource, showId: showId, fromCell: fromCell, toCell: toCell, showSearch: showSearch, currentCalendarDate: currentCalendarDate, setCurrentCalendarDate: setCurrentCalendarDate, openTaskForm: openTaskFormCallback, onDeleteCallback: onDeleteCallback, setCalendarStartDate: setCalendarStartDate, setCalendarEndDate: setCalendarEndDate, focusedRowKey: focusedRowKey, handleFocusedRowChange: handleFocusedRowChange }) })] });
|
|
523
|
+
};
|
|
524
|
+
return _jsxs("div", { style: { width: '100%', height: '100%' }, onContextMenu: (e) => e.preventDefault(), children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TabPanel, { width: "100%", height: "100%", animationEnabled: false, swipeEnabled: false, loop: false, showNavButtons: true, repaintChangesOnly: true, stylingMode: "primary", iconPosition: 'start', tabsPosition: 'top', selectedIndex: activeTabIndex, onSelectedIndexChange: onSelectedIndexChange, id: "task-centered-tab-title", children: [_jsx(Item, { title: SDKUI_Localizator.AssignedToMe, icon: "user", tabRender: (params) => {
|
|
525
|
+
return _jsxs(StyledTabItem, { "$isSelected": activeTabIndex === AssignedTab.AssignedToMe, children: [_jsxs(TMTooltip, { content: SDKUI_Localizator.AssignedToMe, children: [_jsx("i", { className: `dx-icon-${params.icon}` }), "\u00A0", params.title, " ", (assignedToMeCount > 0) ? `(${assignedToMeCount})` : ''] }), newTaskCount > 0 && (_jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivitiesNumber + ": " + newTaskCount, children: _jsx(TMCountBadge, { children: newTaskCount }) }))] });
|
|
526
|
+
}, render: () => activeTabIndex === AssignedTab.AssignedToMe ?
|
|
527
|
+
_jsxs(_Fragment, { children: [activeComponent === TaskView.LIST_TASK && getFromOrToDatagridElement(visualizedTasks, true, false), activeComponent === TaskView.AGENDA_TASK && getFromOrToAgendaElement(visualizedTasks, true, false), activeComponent === TaskView.CALENDAR_TASK && getFromOrToCalendarElement(visualizedTasks, true, false)] }) : '' }), _jsx(Item, { title: SDKUI_Localizator.AssignedByMe, icon: "login", tabRender: (params) => {
|
|
528
|
+
return _jsx(StyledTabItem, { "$isSelected": activeTabIndex === AssignedTab.AssignedByMe, children: _jsxs(TMTooltip, { content: SDKUI_Localizator.AssignedByMe, children: [_jsx("i", { className: `dx-icon-${params.icon}` }), "\u00A0", params.title, " ", (assignedByMeCount > 0) ? `(${assignedByMeCount})` : ''] }) });
|
|
529
|
+
}, render: () => activeTabIndex === AssignedTab.AssignedByMe ?
|
|
530
|
+
_jsxs(_Fragment, { children: [activeComponent === TaskView.CALENDAR_TASK && getFromOrToCalendarElement(visualizedTasks, false, true), activeComponent === TaskView.AGENDA_TASK && getFromOrToAgendaElement(visualizedTasks, false, true), activeComponent === TaskView.LIST_TASK && getFromOrToDatagridElement(visualizedTasks, false, true)] }) : '' }), _jsx(Item, { title: SDKUI_Localizator.AllFemale, icon: "fields", tabRender: (params) => {
|
|
531
|
+
return _jsxs(StyledTabItem, { "$isSelected": activeTabIndex === AssignedTab.All, children: [_jsxs(TMTooltip, { content: SDKUI_Localizator.AllFemale, children: [_jsx("i", { className: `dx-icon-${params.icon}` }), "\u00A0", params.title, " ", (allTasksFilteredCount > 0) ? `(${allTasksFilteredCount})` : ''] }), newTaskCount > 0 && (_jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivitiesNumber + ": " + newTaskCount, children: _jsx(TMCountBadge, { children: newTaskCount }) }))] });
|
|
532
|
+
}, render: () => activeTabIndex === AssignedTab.All ?
|
|
533
|
+
_jsxs(_Fragment, { children: [activeComponent === TaskView.CALENDAR_TASK && getFromOrToCalendarElement(visualizedTasks, true, true), activeComponent === TaskView.AGENDA_TASK && getFromOrToAgendaElement(visualizedTasks, true, true), activeComponent === TaskView.LIST_TASK && getFromOrToDatagridElement(visualizedTasks, true, true)] }) : '' })] }) }), showTaskForm && _jsx(TMTaskForm, { id: currentTask?.id ?? -1, width: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), height: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), title: isContextualCreate ? SDKUI_Localizator.ContextualTask : SDKUI_Localizator.Widget_Activities, isModal: true, formMode: formMode ?? FormModes.Create, visualizedTasks: visualizedTasks, currentTask: currentTask, setCurrentTask: setCurrentTask, isContextualCreate: isContextualCreate, selectedRowKeys: selectedRowKeys, handleFocusedRowKeyChange: handleFocusedRowChange, taskContext: taskContext, usersList: usersList, onStatusChanged: () => { }, onClose: closeTaskFormCallback, onCancel: closeTaskFormCallback, showBackButton: false, onSaved: onSavedCallback, startDate: calendarStartDate, endDate: calendarEndDate, onOpenS4TViewerRequest: onOpenS4TViewerRequest, s4TViewerDialogComponent: s4TViewerDialogComponent, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGsWrapper, handleNavigateToDossiers: handleNavigateToDossiersWrapper }), _jsx("button", { style: {
|
|
534
|
+
position: 'absolute',
|
|
535
|
+
bottom: hasFilters ? '90px' : '18px',
|
|
536
|
+
right: '20px',
|
|
537
|
+
width: '40px',
|
|
538
|
+
height: '40px',
|
|
539
|
+
borderRadius: "50%",
|
|
540
|
+
backgroundColor: "#C2388B",
|
|
541
|
+
color: '#fff',
|
|
542
|
+
border: 'none',
|
|
543
|
+
cursor: 'pointer',
|
|
544
|
+
boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
|
|
545
|
+
zIndex: 1000,
|
|
546
|
+
transition: 'background-color 0.3s ease, transform 0.2s ease',
|
|
547
|
+
display: 'flex',
|
|
548
|
+
justifyContent: 'center',
|
|
549
|
+
alignItems: 'center',
|
|
550
|
+
}, onMouseEnter: (e) => {
|
|
551
|
+
e.currentTarget.style.backgroundColor = '#D94A9F';
|
|
552
|
+
e.currentTarget.style.transform = 'scale(1.1)';
|
|
553
|
+
e.currentTarget.style.boxShadow = '0 4px 12px rgba(37, 89, 165, 0.6)';
|
|
554
|
+
}, onMouseLeave: (e) => {
|
|
555
|
+
e.currentTarget.style.backgroundColor = "#C2388B";
|
|
556
|
+
e.currentTarget.style.transform = 'scale(1)';
|
|
557
|
+
e.currentTarget.style.boxShadow = '0 2px 6px rgba(0,0,0,0.2)';
|
|
558
|
+
}, onClick: () => openTaskFormCallback(FormModes.Create, undefined, taskContext !== undefined), children: _jsx(TMTooltip, { content: SDKUI_Localizator.Create, children: _jsx("i", { className: "dx-icon-add", style: { fontSize: '25px' } }) }) })] });
|
|
559
|
+
};
|
|
560
|
+
export default TMTasksView;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { DcmtTypeDescriptor } from '@topconsultnpm/sdk-ts';
|
|
1
2
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
2
3
|
interface IWorkflowOperationButtonsProps {
|
|
4
|
+
dtd: DcmtTypeDescriptor | undefined;
|
|
3
5
|
approveDisable?: boolean;
|
|
4
6
|
signApproveDisable?: boolean;
|
|
5
7
|
rejectDisable?: boolean;
|
|
@@ -12,7 +14,7 @@ interface IWorkflowOperationButtonsProps {
|
|
|
12
14
|
onReAssign?: () => void;
|
|
13
15
|
onMoreInfo?: () => void;
|
|
14
16
|
}
|
|
15
|
-
export declare const WorkFlowOperationButtons: (
|
|
17
|
+
export declare const WorkFlowOperationButtons: (props: IWorkflowOperationButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export declare const WorkFlowApproveRejectPopUp: ({ TID, DID, deviceType, isReject, selectedItems, onClose, onCompleted }: {
|
|
17
19
|
TID?: number;
|
|
18
20
|
DID?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { Priorities, ResultTypes, SDK_Globals, SDK_Localizator, TaskEngine, UserListCacheService, ValidationItem, WorkflowCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil } from "../../../helper";
|
|
5
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo, DateDisplayTypes, TASK_MORE_INFO_PREFIX_NAME, IconSignaturePencil, isSign4TopEnabled } from "../../../helper";
|
|
6
6
|
import { TMColors } from "../../../utils/theme";
|
|
7
7
|
import TMButton from "../../base/TMButton";
|
|
8
8
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
@@ -65,9 +65,22 @@ const StyledHorizontalContainer = styled.div `
|
|
|
65
65
|
gap: 10px;
|
|
66
66
|
/* align-items: flex-end; */
|
|
67
67
|
`;
|
|
68
|
-
export const WorkFlowOperationButtons = (
|
|
68
|
+
export const WorkFlowOperationButtons = (props) => {
|
|
69
|
+
const { dtd = undefined, deviceType = DeviceType.DESKTOP, approveDisable = false, signApproveDisable = false, rejectDisable = false, reassignDisable = false, infoDisable = false, onApprove, onSignApprove, onReject, onReAssign, onMoreInfo } = props;
|
|
69
70
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
70
|
-
|
|
71
|
+
// Stato per distinguere workflow di firma vs approvazione
|
|
72
|
+
const [isSignWorkflow, setIsSignWorkflow] = useState(false);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
// Controlla se il documento ha dei widget definiti, se il documento ha il widget SIGN4_TOP abilitato, allora è un workflow di firma
|
|
75
|
+
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
76
|
+
setIsSignWorkflow(isSign4TopEnabled(dtd.widgets));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Se non ci sono widget o non è SIGN4_TOP, imposta il workflow di default (approvazione senza firma)
|
|
80
|
+
setIsSignWorkflow(false);
|
|
81
|
+
}
|
|
82
|
+
}, [dtd]);
|
|
83
|
+
return (_jsx(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: isSignWorkflow ? (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: "160px", disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), advancedColor: TMColors.success, color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) : (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: TMColors.success, color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: "tertiary" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) }));
|
|
71
84
|
};
|
|
72
85
|
export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, selectedItems = [], onClose, onCompleted }) => {
|
|
73
86
|
const [commentValue, setCommentValue] = useState('');
|
|
@@ -252,9 +265,9 @@ export const WorkFlowMoreInfoPopUp = ({ DID = 0, TID = 0, deviceType = DeviceTyp
|
|
|
252
265
|
return Object.values(filteredPriorities).map(priority => {
|
|
253
266
|
switch (priority) {
|
|
254
267
|
case Priorities.High:
|
|
255
|
-
return ({ value: priority, display: SDKUI_Localizator.
|
|
268
|
+
return ({ value: priority, display: SDKUI_Localizator.High });
|
|
256
269
|
default:
|
|
257
|
-
return ({ value: priority, display: SDKUI_Localizator.
|
|
270
|
+
return ({ value: priority, display: SDKUI_Localizator.Low });
|
|
258
271
|
}
|
|
259
272
|
});
|
|
260
273
|
};
|