@zeniai/client-epic-state 4.11.7 → 4.11.8
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/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/task/taskPayload.d.ts +2 -2
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/entity/taskGroup/taskGroupPayload.d.ts +9 -0
- package/lib/entity/taskGroup/taskGroupPayload.js +14 -0
- package/lib/entity/taskGroup/taskGroupReducer.d.ts +6 -0
- package/lib/entity/taskGroup/taskGroupReducer.js +33 -0
- package/lib/entity/taskGroup/taskGroupSelector.d.ts +4 -0
- package/lib/entity/taskGroup/taskGroupSelector.js +18 -0
- package/lib/entity/taskGroup/taskGroupState.d.ts +12 -0
- package/lib/entity/taskGroup/taskGroupState.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
- package/lib/entity/tenant/clearAllEpic.js +6 -0
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/entity/transaction/stateTypes/transactionType.d.ts +3 -0
- package/lib/entity/transaction/stateTypes/transactionType.js +7 -3
- package/lib/epic.d.ts +7 -1
- package/lib/epic.js +7 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.js +10 -2
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +11 -4
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -1
- package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.d.ts +10 -0
- package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.js +57 -0
- package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.d.ts +10 -0
- package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.js +41 -0
- package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.d.ts +8 -0
- package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.js +33 -0
- package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.d.ts +10 -0
- package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.js +51 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.d.ts +6 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.js +2 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.d.ts +34 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.js +123 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewState.d.ts +7 -0
- package/lib/view/taskManager/taskGroupView/taskGroupViewState.js +2 -0
- package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.d.ts +8 -0
- package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.js +89 -0
- package/lib/view/taskManager/taskListView/dragNDropTasksEpic.d.ts +6 -0
- package/lib/view/taskManager/taskListView/dragNDropTasksEpic.js +20 -0
- package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.d.ts +3 -1
- package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +12 -0
- package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +31 -2
- package/lib/view/taskManager/taskListView/taskListReducer.js +136 -9
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +12 -2
- package/lib/view/taskManager/taskListView/taskListSelector.js +59 -23
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -5
- package/package.json +1 -1
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearTaskList = exports.updateTaskFilters = exports.updateTaskListUIState = exports.updateTaskListSearchText = exports.updateTaskListFetchStatus = exports.updateTaskList = exports.fetchTaskList = exports.fetchTaskListPage = exports.initialState = void 0;
|
|
4
|
+
exports.clearTaskList = exports.updateTaskListOnTaskGroupNameUpdate = exports.updateTaskListOnNewTaskCreationSuccess = exports.dragNDropTasks = exports.updateTaskListOnTaskGroupDeletion = exports.updateTaskListLocalData = exports.initiateTaskListLocalData = exports.updateTasksListOnBulkUpdateTasksFailure = exports.updateTasksListOnBulkUpdateTasksSuccess = exports.bulkUpdateTaskList = exports.updateTaskListOnNewGroupCreationSuccess = exports.updateTaskFilters = exports.updateTaskListUIState = exports.updateTaskListSearchText = exports.updateTaskListFetchStatus = exports.updateTaskList = exports.fetchTaskList = exports.fetchTaskListPage = exports.initialState = exports.initialLocalData = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialLocalData = {
|
|
7
|
+
newTaskGroupName: '',
|
|
8
|
+
existingTaskGroupNamesByGroupId: {},
|
|
9
|
+
selectedTaskIds: [],
|
|
10
|
+
defaultTaskGroupId: null,
|
|
11
|
+
};
|
|
6
12
|
exports.initialState = {
|
|
7
13
|
taskIds: [],
|
|
14
|
+
taskIdsByGroupsIds: {},
|
|
8
15
|
fetchState: 'Not-Started',
|
|
9
16
|
searchText: '',
|
|
10
17
|
error: undefined,
|
|
@@ -26,6 +33,11 @@ exports.initialState = {
|
|
|
26
33
|
hasValidState() {
|
|
27
34
|
return this.fetchState == 'Completed';
|
|
28
35
|
},
|
|
36
|
+
localData: Object.assign({}, exports.initialLocalData),
|
|
37
|
+
updateTasksFetchState: {
|
|
38
|
+
fetchState: 'Not-Started',
|
|
39
|
+
error: undefined,
|
|
40
|
+
},
|
|
29
41
|
};
|
|
30
42
|
const taskList = (0, toolkit_1.createSlice)({
|
|
31
43
|
name: 'taskList',
|
|
@@ -46,15 +58,40 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
46
58
|
draft.error = undefined;
|
|
47
59
|
},
|
|
48
60
|
updateTaskList(draft, action) {
|
|
49
|
-
|
|
50
|
-
const { data, updateType } = action.payload;
|
|
61
|
+
const { data } = action.payload;
|
|
51
62
|
draft.fetchState = 'Completed';
|
|
52
63
|
draft.error = undefined;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
const taskIdsByGroupsIds = {};
|
|
65
|
+
data.forEach((task) => {
|
|
66
|
+
draft.taskIds.push(task.task_id);
|
|
67
|
+
if (task.task_group_ids != null) {
|
|
68
|
+
task.task_group_ids.forEach((groupId) => {
|
|
69
|
+
if (taskIdsByGroupsIds[groupId] != null) {
|
|
70
|
+
taskIdsByGroupsIds[groupId].push(task.task_id);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
taskIdsByGroupsIds[groupId] = [task.task_id];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
draft.taskIdsByGroupsIds = taskIdsByGroupsIds;
|
|
79
|
+
},
|
|
80
|
+
initiateTaskListLocalData(draft, action) {
|
|
81
|
+
const { taskGroupById } = action.payload;
|
|
82
|
+
const existingTaskGroupNamesByGroupId = {};
|
|
83
|
+
let defaultTaskGroupId = null;
|
|
84
|
+
Object.keys(taskGroupById).forEach((groupId) => {
|
|
85
|
+
existingTaskGroupNamesByGroupId[groupId] = taskGroupById[groupId].name;
|
|
86
|
+
if (taskGroupById[groupId].isDefault === true) {
|
|
87
|
+
defaultTaskGroupId = groupId;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
draft.localData = Object.assign(Object.assign({}, exports.initialLocalData), { defaultTaskGroupId,
|
|
91
|
+
existingTaskGroupNamesByGroupId });
|
|
92
|
+
},
|
|
93
|
+
updateTaskListLocalData(draft, action) {
|
|
94
|
+
draft.localData = action.payload.localData;
|
|
58
95
|
},
|
|
59
96
|
updateTaskListFetchStatus(draft, action) {
|
|
60
97
|
draft.fetchState = action.payload.fetchState;
|
|
@@ -79,10 +116,100 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
79
116
|
draft.filters = action.payload.filters;
|
|
80
117
|
}
|
|
81
118
|
},
|
|
119
|
+
updateTaskListOnNewGroupCreationSuccess(draft, action) {
|
|
120
|
+
const { newTaskGroup } = action.payload;
|
|
121
|
+
draft.localData = Object.assign(Object.assign({}, draft.localData), { existingTaskGroupNamesByGroupId: Object.assign(Object.assign({}, draft.localData.existingTaskGroupNamesByGroupId), { [newTaskGroup.task_group_id]: newTaskGroup.name }) });
|
|
122
|
+
},
|
|
123
|
+
bulkUpdateTaskList: {
|
|
124
|
+
reducer(draft) {
|
|
125
|
+
draft.updateTasksFetchState = {
|
|
126
|
+
fetchState: 'In-Progress',
|
|
127
|
+
error: undefined,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
prepare(taskIds, updates) {
|
|
131
|
+
return {
|
|
132
|
+
payload: {
|
|
133
|
+
taskIds,
|
|
134
|
+
updates,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
dragNDropTasks: {
|
|
140
|
+
reducer() {
|
|
141
|
+
//do nothing
|
|
142
|
+
},
|
|
143
|
+
prepare(taskIds, groupId) {
|
|
144
|
+
return {
|
|
145
|
+
payload: {
|
|
146
|
+
taskIds,
|
|
147
|
+
groupId,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
updateTasksListOnBulkUpdateTasksSuccess(draft, action) {
|
|
153
|
+
const { taskIds, groupId } = action.payload;
|
|
154
|
+
draft.updateTasksFetchState.fetchState = 'Completed';
|
|
155
|
+
draft.updateTasksFetchState.error = undefined;
|
|
156
|
+
Object.keys(draft.taskIdsByGroupsIds).forEach((groupId) => {
|
|
157
|
+
draft.taskIdsByGroupsIds[groupId] = draft.taskIdsByGroupsIds[groupId].filter((taskId) => taskIds.includes(taskId) === false);
|
|
158
|
+
});
|
|
159
|
+
if (groupId != null) {
|
|
160
|
+
if (draft.taskIdsByGroupsIds[groupId] != null) {
|
|
161
|
+
draft.taskIdsByGroupsIds[groupId] = [
|
|
162
|
+
...draft.taskIdsByGroupsIds[groupId],
|
|
163
|
+
...taskIds,
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
draft.taskIdsByGroupsIds = Object.assign(Object.assign({}, draft.taskIdsByGroupsIds), { [groupId]: taskIds });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
draft.localData = Object.assign(Object.assign({}, draft.localData), { newTaskGroupName: '', selectedTaskIds: [] });
|
|
171
|
+
},
|
|
172
|
+
updateTasksListOnBulkUpdateTasksFailure(draft, action) {
|
|
173
|
+
draft.updateTasksFetchState.fetchState = 'Error';
|
|
174
|
+
draft.updateTasksFetchState.error = action.payload.error;
|
|
175
|
+
},
|
|
176
|
+
updateTaskListOnTaskGroupDeletion(draft, action) {
|
|
177
|
+
var _a;
|
|
178
|
+
const { taskGroupId } = action.payload;
|
|
179
|
+
const { defaultTaskGroupId } = draft.localData;
|
|
180
|
+
if (((_a = draft.taskIdsByGroupsIds[taskGroupId]) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
181
|
+
const tasks = draft.taskIdsByGroupsIds[taskGroupId];
|
|
182
|
+
if (defaultTaskGroupId != null) {
|
|
183
|
+
draft.taskIdsByGroupsIds[defaultTaskGroupId] = [
|
|
184
|
+
...draft.taskIdsByGroupsIds[defaultTaskGroupId],
|
|
185
|
+
...tasks,
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
delete draft.taskIdsByGroupsIds[taskGroupId];
|
|
190
|
+
delete draft.localData.existingTaskGroupNamesByGroupId[taskGroupId];
|
|
191
|
+
},
|
|
192
|
+
updateTaskListOnNewTaskCreationSuccess(draft, action) {
|
|
193
|
+
const { taskId, taskGroupId } = action.payload;
|
|
194
|
+
draft.taskIds.push(taskId);
|
|
195
|
+
if (draft.taskIdsByGroupsIds[taskGroupId] != null) {
|
|
196
|
+
draft.taskIdsByGroupsIds[taskGroupId] = [
|
|
197
|
+
taskId,
|
|
198
|
+
...draft.taskIdsByGroupsIds[taskGroupId],
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
draft.taskIdsByGroupsIds[taskGroupId] = [taskId];
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
updateTaskListOnTaskGroupNameUpdate(draft, action) {
|
|
206
|
+
const { taskGroupName, taskGroupId } = action.payload;
|
|
207
|
+
draft.localData.existingTaskGroupNamesByGroupId = Object.assign(Object.assign({}, draft.localData.existingTaskGroupNamesByGroupId), { [taskGroupId]: taskGroupName });
|
|
208
|
+
},
|
|
82
209
|
clearTaskList(draft) {
|
|
83
210
|
Object.assign(draft, exports.initialState);
|
|
84
211
|
},
|
|
85
212
|
},
|
|
86
213
|
});
|
|
87
|
-
_a = taskList.actions, exports.fetchTaskListPage = _a.fetchTaskListPage, exports.fetchTaskList = _a.fetchTaskList, exports.updateTaskList = _a.updateTaskList, exports.updateTaskListFetchStatus = _a.updateTaskListFetchStatus, exports.updateTaskListSearchText = _a.updateTaskListSearchText, exports.updateTaskListUIState = _a.updateTaskListUIState, exports.updateTaskFilters = _a.updateTaskFilters, exports.clearTaskList = _a.clearTaskList;
|
|
214
|
+
_a = taskList.actions, exports.fetchTaskListPage = _a.fetchTaskListPage, exports.fetchTaskList = _a.fetchTaskList, exports.updateTaskList = _a.updateTaskList, exports.updateTaskListFetchStatus = _a.updateTaskListFetchStatus, exports.updateTaskListSearchText = _a.updateTaskListSearchText, exports.updateTaskListUIState = _a.updateTaskListUIState, exports.updateTaskFilters = _a.updateTaskFilters, exports.updateTaskListOnNewGroupCreationSuccess = _a.updateTaskListOnNewGroupCreationSuccess, exports.bulkUpdateTaskList = _a.bulkUpdateTaskList, exports.updateTasksListOnBulkUpdateTasksSuccess = _a.updateTasksListOnBulkUpdateTasksSuccess, exports.updateTasksListOnBulkUpdateTasksFailure = _a.updateTasksListOnBulkUpdateTasksFailure, exports.initiateTaskListLocalData = _a.initiateTaskListLocalData, exports.updateTaskListLocalData = _a.updateTaskListLocalData, exports.updateTaskListOnTaskGroupDeletion = _a.updateTaskListOnTaskGroupDeletion, exports.dragNDropTasks = _a.dragNDropTasks, exports.updateTaskListOnNewTaskCreationSuccess = _a.updateTaskListOnNewTaskCreationSuccess, exports.updateTaskListOnTaskGroupNameUpdate = _a.updateTaskListOnTaskGroupNameUpdate, exports.clearTaskList = _a.clearTaskList;
|
|
88
215
|
exports.default = taskList.reducer;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
1
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
2
3
|
import { Task } from '../../../entity/task/taskState';
|
|
3
4
|
import { RootState } from '../../../reducer';
|
|
4
5
|
import { UserAndRole } from '../../companyView/types/userAndRole';
|
|
5
|
-
import { TaskListFilters, TaskListUIState } from './taskList';
|
|
6
|
+
import { TaskListFilters, TaskListUIState, TaskListLocalData } from './taskList';
|
|
6
7
|
import { UserListSelectorView } from '../../userListView/userListViewSelector';
|
|
8
|
+
import { TaskGroup } from '../../../entity/taskGroup/taskGroupState';
|
|
7
9
|
export interface TaskWithUserDetails extends Task {
|
|
8
10
|
assigneeUsers: UserAndRole[];
|
|
9
11
|
}
|
|
12
|
+
export interface TaskGroupWithTasksList extends TaskGroup {
|
|
13
|
+
tasks: TaskWithUserDetails[];
|
|
14
|
+
}
|
|
10
15
|
export interface TaskListSelectorView extends SelectorView {
|
|
11
|
-
|
|
16
|
+
taskGroupsWithTasksList: TaskGroupWithTasksList[];
|
|
12
17
|
searchText: string;
|
|
13
18
|
uiState: TaskListUIState;
|
|
14
19
|
filters: TaskListFilters;
|
|
15
20
|
userList: UserListSelectorView;
|
|
21
|
+
localData: TaskListLocalData;
|
|
22
|
+
updateTasksFetchState: FetchStateAndError;
|
|
23
|
+
taskGroupDeleteStatus: FetchStateAndError;
|
|
24
|
+
taskGroupUpdateStatus: FetchStateAndError;
|
|
25
|
+
taskGroupCreationStatus: FetchStateAndError;
|
|
16
26
|
}
|
|
17
27
|
export declare const getAllTasks: (state: RootState) => TaskListSelectorView;
|
|
@@ -12,26 +12,10 @@ const userAndRole_1 = require("../../companyView/types/userAndRole");
|
|
|
12
12
|
const userListViewSelector_1 = require("../../userListView/userListViewSelector");
|
|
13
13
|
const spendManagementFilterHelpers_1 = require("../../spendManagement/spendManagementFilterHelpers");
|
|
14
14
|
const tagSelector_1 = require("../../../entity/tag/tagSelector");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
.map((taskId) => {
|
|
20
|
-
const task = (0, taskSelector_1.getTaskById)(taskState, taskId);
|
|
21
|
-
if (task != null) {
|
|
22
|
-
const assigneeUsers = task.assignees
|
|
23
|
-
.map((userId) => (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, userId))
|
|
24
|
-
.filter((value) => value != null);
|
|
25
|
-
return Object.assign(Object.assign({}, task), { assigneeUsers });
|
|
26
|
-
}
|
|
27
|
-
return undefined;
|
|
28
|
-
})
|
|
29
|
-
.filter((value) => value != null);
|
|
30
|
-
const searchedTaskList = unFilteredTaskList.filter((task) => task.name.toLowerCase().includes(searchText.toLowerCase()));
|
|
31
|
-
const sortKey = taskListState.uiState.sortKey;
|
|
32
|
-
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(taskListState.uiState.sortOrder);
|
|
33
|
-
const filteredTaskList = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('task_management', searchedTaskList, taskListState.filters);
|
|
34
|
-
const tasksInOrder = (0, orderBy_1.default)(filteredTaskList, (task) => {
|
|
15
|
+
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
16
|
+
const taskGroupSelector_1 = require("../../../entity/taskGroup/taskGroupSelector");
|
|
17
|
+
const sortTasksList = (state, tasksList, sortKey, sortOrder) => {
|
|
18
|
+
const tasksInOrder = (0, orderBy_1.default)(tasksList, (task) => {
|
|
35
19
|
var _a, _b;
|
|
36
20
|
const tagsByIds = (0, tagSelector_1.getTagsByIds)(state.tagState, task.tagIds);
|
|
37
21
|
switch (sortKey) {
|
|
@@ -50,15 +34,67 @@ const getAllTasks = (state) => {
|
|
|
50
34
|
return task.name.toLowerCase();
|
|
51
35
|
}
|
|
52
36
|
}, sortOrder);
|
|
37
|
+
return tasksInOrder;
|
|
38
|
+
};
|
|
39
|
+
const getAllTasks = (state) => {
|
|
40
|
+
const { taskListState, taskState, userState, userRoleState, addressState, taskGroupState, taskGroupViewState, tagViewState, } = state;
|
|
41
|
+
const { localData, searchText } = taskListState;
|
|
42
|
+
const sortKey = taskListState.uiState.sortKey;
|
|
43
|
+
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(taskListState.uiState.sortOrder);
|
|
44
|
+
const taskGroupIds = taskGroupViewState.taskGroupsIds;
|
|
45
|
+
const taskGroupsWithTasksList = taskGroupIds
|
|
46
|
+
.map((taskGroupId) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const taskGroup = (0, taskGroupSelector_1.getTaskGroupById)(taskGroupState, taskGroupId);
|
|
49
|
+
const taskIds = (_a = taskListState.taskIdsByGroupsIds[taskGroupId]) !== null && _a !== void 0 ? _a : [];
|
|
50
|
+
const tasks = taskIds
|
|
51
|
+
.map((taskId) => {
|
|
52
|
+
const task = (0, taskSelector_1.getTaskById)(taskState, taskId);
|
|
53
|
+
if (task != null) {
|
|
54
|
+
const assigneeUsers = task.assignees
|
|
55
|
+
.map((userId) => (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, userId))
|
|
56
|
+
.filter((value) => value != null);
|
|
57
|
+
return Object.assign(Object.assign({}, task), { assigneeUsers });
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
})
|
|
61
|
+
.filter((value) => (value === null || value === void 0 ? void 0 : value.name.toLowerCase().includes(searchText.toLowerCase())) ===
|
|
62
|
+
true);
|
|
63
|
+
if (taskGroup != null) {
|
|
64
|
+
const filteredTaskList = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('task_management', tasks, taskListState.filters);
|
|
65
|
+
const sortedTaskList = sortTasksList(state, filteredTaskList, sortKey, sortOrder);
|
|
66
|
+
return Object.assign(Object.assign({}, taskGroup), { tasks: sortedTaskList });
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
})
|
|
70
|
+
.filter((value) => value != null);
|
|
71
|
+
taskGroupsWithTasksList.sort((a, b) => {
|
|
72
|
+
return b.createdAt.valueOf() - a.createdAt.valueOf();
|
|
73
|
+
});
|
|
74
|
+
const sortedTaskGroupsWithTasksList = taskGroupsWithTasksList.filter((taskGroup) => taskGroup.isDefault === false);
|
|
75
|
+
const defaultTaskGroup = taskGroupsWithTasksList.find((taskGroup) => taskGroup.isDefault === true);
|
|
76
|
+
if (defaultTaskGroup != null) {
|
|
77
|
+
sortedTaskGroupsWithTasksList.push(defaultTaskGroup);
|
|
78
|
+
}
|
|
79
|
+
const { fetchState, error } = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
80
|
+
taskListState,
|
|
81
|
+
taskGroupViewState,
|
|
82
|
+
tagViewState,
|
|
83
|
+
]);
|
|
53
84
|
return {
|
|
54
|
-
taskList: tasksInOrder,
|
|
55
85
|
searchText: taskListState.searchText,
|
|
56
86
|
uiState: taskListState.uiState,
|
|
57
87
|
filters: taskListState.filters,
|
|
58
|
-
fetchState:
|
|
88
|
+
fetchState: fetchState,
|
|
59
89
|
userList: (0, userListViewSelector_1.getUserList)(state, 'taskManagerCandidate'),
|
|
60
|
-
error:
|
|
90
|
+
error: error,
|
|
61
91
|
version: 0,
|
|
92
|
+
taskGroupsWithTasksList: sortedTaskGroupsWithTasksList,
|
|
93
|
+
localData,
|
|
94
|
+
updateTasksFetchState: taskListState.updateTasksFetchState,
|
|
95
|
+
taskGroupDeleteStatus: taskGroupViewState.taskGroupDeleteStatus,
|
|
96
|
+
taskGroupUpdateStatus: taskGroupViewState.taskGroupUpdateStatus,
|
|
97
|
+
taskGroupCreationStatus: taskGroupViewState.taskGroupCreationStatus,
|
|
62
98
|
};
|
|
63
99
|
};
|
|
64
100
|
exports.getAllTasks = getAllTasks;
|
|
@@ -23,8 +23,8 @@ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
|
23
23
|
const recommendationPayload_1 = require("../../../commonPayloadTypes/recommendationPayload");
|
|
24
24
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
25
25
|
const vendorReducer_1 = require("../../../entity/vendor/vendorReducer");
|
|
26
|
-
const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
|
|
27
26
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
27
|
+
const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
|
|
28
28
|
const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.updateTransactionDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
29
29
|
const { transactionState, vendorState, transactionDetailState } = state$.value;
|
|
30
30
|
return zeniAPI
|
|
@@ -63,11 +63,15 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
63
63
|
}));
|
|
64
64
|
actions.push((0, transactionDetailReducer_1.updateTransactionDetailSaveStatus)(transactionIdResp, 'Completed'));
|
|
65
65
|
let callMarkTransactionAsNotMiscategorized = true;
|
|
66
|
-
// NOTE: If tran is vendorType transaction and there is no vendor chosen on this tranaction while saving,
|
|
66
|
+
// NOTE: If tran is vendorType OR JE OR Deposit transaction and there is no vendor chosen on this tranaction while saving,
|
|
67
67
|
// then we need to skip mark-miscategorized-as-correct api call
|
|
68
|
-
if ((0, transactionType_1.toVendorTransactionTypeStrict)(response.data.transaction.transaction_type) != null
|
|
68
|
+
if ((0, transactionType_1.toVendorTransactionTypeStrict)(response.data.transaction.transaction_type) != null ||
|
|
69
|
+
(0, transactionType_1.toJEAndDepositTransactionTypeStrict)(response.data.transaction.transaction_type) != null) {
|
|
69
70
|
const isAnyClassMissing = checkIfClassMissingForAnyLineItem(response.data.transaction);
|
|
70
|
-
|
|
71
|
+
const isVendorOrCustomerMissingInAnyLine = checkIfVendorOrCustomerMissingForAnyLineItem(response.data.transaction);
|
|
72
|
+
if (((vendorUpdates === null || vendorUpdates === void 0 ? void 0 : vendorUpdates.id) == null &&
|
|
73
|
+
isVendorOrCustomerMissingInAnyLine == true) ||
|
|
74
|
+
isAnyClassMissing == true) {
|
|
71
75
|
callMarkTransactionAsNotMiscategorized = false;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -196,7 +200,7 @@ const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
|
196
200
|
};
|
|
197
201
|
const checkIfClassMissingForAnyLineItem = (transactionPayload) => {
|
|
198
202
|
let isAnyClassMissing = false;
|
|
199
|
-
if (
|
|
203
|
+
if (transactionPayload.lines != null) {
|
|
200
204
|
transactionPayload.lines.forEach((line) => {
|
|
201
205
|
var _a;
|
|
202
206
|
if (((_a = line.line_detail) === null || _a === void 0 ? void 0 : _a.class.accounting_class_id) == null) {
|
|
@@ -206,6 +210,19 @@ const checkIfClassMissingForAnyLineItem = (transactionPayload) => {
|
|
|
206
210
|
}
|
|
207
211
|
return isAnyClassMissing;
|
|
208
212
|
};
|
|
213
|
+
const checkIfVendorOrCustomerMissingForAnyLineItem = (transactionPayload) => {
|
|
214
|
+
let isAnyVendorOrCustomerMissing = false;
|
|
215
|
+
if (transactionPayload.lines != null) {
|
|
216
|
+
transactionPayload.lines.forEach((line) => {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
if (((_a = line.line_detail) === null || _a === void 0 ? void 0 : _a.vendor) == null &&
|
|
219
|
+
((_b = line.line_detail) === null || _b === void 0 ? void 0 : _b.customer) == null) {
|
|
220
|
+
isAnyVendorOrCustomerMissing = true;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return isAnyVendorOrCustomerMissing;
|
|
225
|
+
};
|
|
209
226
|
const toEntityUpdatePayload = (entityUpdates) => {
|
|
210
227
|
const entityUpdatesPayload = [];
|
|
211
228
|
let entityKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.8",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|