@zeniai/client-epic-state 4.11.22 → 4.11.24
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.
|
@@ -237,7 +237,10 @@ const applyAdvancedFiltersOnCompaniesList = (allCompanies, filters, filteredComp
|
|
|
237
237
|
: filteredCompanies, index + 1);
|
|
238
238
|
};
|
|
239
239
|
const sortAndFilterCompanies = (sortKey, sortOrder, filterText, filters, companies, userState) => {
|
|
240
|
-
|
|
240
|
+
let sortOrderKey = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
|
|
241
|
+
if (sortKey === 'lastReportSent') {
|
|
242
|
+
sortOrderKey = sortOrderKey === 'asc' ? 'desc' : 'asc';
|
|
243
|
+
}
|
|
241
244
|
let updatedCompanies = [];
|
|
242
245
|
const trimmedFilterText = filterText.trim();
|
|
243
246
|
if (trimmedFilterText) {
|
|
@@ -10,6 +10,7 @@ const values_1 = __importDefault(require("lodash/values"));
|
|
|
10
10
|
const userSelector_1 = require("../../entity/user/userSelector");
|
|
11
11
|
const companySelector_1 = require("../../entity/company/companySelector");
|
|
12
12
|
const userAndRole_1 = require("../companyView/types/userAndRole");
|
|
13
|
+
const sortOrderPayload_1 = require("../../commonPayloadTypes/sortOrderPayload");
|
|
13
14
|
exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) => state, (rootState) => {
|
|
14
15
|
const { filterText, sortKey, sortOrder } = rootState.reviewCompanyViewState.uiState;
|
|
15
16
|
const companies = (0, values_1.default)(rootState.reviewCompanyViewState.reviewCompanyById)
|
|
@@ -36,7 +37,38 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
36
37
|
.map((userId) => (0, userSelector_1.getUserByUserId)(rootState.userState, userId))
|
|
37
38
|
.filter((value) => value != null);
|
|
38
39
|
const orderedZeniUsers = (0, orderBy_1.default)(zeniUsers, (user) => (0, userSelector_1.getUserName)(user), 'asc');
|
|
39
|
-
const
|
|
40
|
+
const companiesWithSortKeyValues = [];
|
|
41
|
+
const companiesWithNoSortKeyValues = [];
|
|
42
|
+
companies.forEach((company) => {
|
|
43
|
+
switch (sortKey) {
|
|
44
|
+
case 'uncategorized':
|
|
45
|
+
if (company.uncategorizedTransactions.income ||
|
|
46
|
+
company.uncategorizedTransactions.expense) {
|
|
47
|
+
companiesWithSortKeyValues.push(company);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
companiesWithNoSortKeyValues.push(company);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 'miscategorized':
|
|
54
|
+
if (company.miscategorizedTransactions.income ||
|
|
55
|
+
company.miscategorizedTransactions.expense) {
|
|
56
|
+
companiesWithSortKeyValues.push(company);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
companiesWithNoSortKeyValues.push(company);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'notes':
|
|
63
|
+
case 'warnings':
|
|
64
|
+
case 'auditScore':
|
|
65
|
+
case 'reviewVendor':
|
|
66
|
+
case 'companyName':
|
|
67
|
+
companiesWithSortKeyValues.push(company);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, (company) => {
|
|
40
72
|
var _a;
|
|
41
73
|
const warningCount = (0, exports.getAuditWarningsCount)(company);
|
|
42
74
|
let primarySortValue;
|
|
@@ -47,14 +79,14 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
47
79
|
primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
48
80
|
break;
|
|
49
81
|
case 'uncategorized':
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
isSecondarySortApplicable = true;
|
|
83
|
+
primarySortValue = company.uncategorizedTransactions.income ? 1 : 0;
|
|
84
|
+
secondarySortValue = company.uncategorizedTransactions.expense ? 1 : 0;
|
|
53
85
|
break;
|
|
54
86
|
case 'miscategorized':
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
87
|
+
isSecondarySortApplicable = true;
|
|
88
|
+
primarySortValue = company.miscategorizedTransactions.income ? 1 : 0;
|
|
89
|
+
secondarySortValue = company.miscategorizedTransactions.expense ? 1 : 0;
|
|
58
90
|
break;
|
|
59
91
|
case 'warnings':
|
|
60
92
|
primarySortValue = warningCount;
|
|
@@ -75,9 +107,9 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
75
107
|
return isSecondarySortApplicable === true
|
|
76
108
|
? [primarySortValue, secondarySortValue]
|
|
77
109
|
: primarySortValue;
|
|
78
|
-
},
|
|
110
|
+
}, (0, sortOrderPayload_1.getSortOrder)(sortOrder));
|
|
79
111
|
return {
|
|
80
|
-
companies:
|
|
112
|
+
companies: [...sortedCompaniesWithSortKeyValue, ...companiesWithNoSortKeyValues],
|
|
81
113
|
fetchState: rootState.reviewCompanyViewState.fetchState,
|
|
82
114
|
error: rootState.reviewCompanyViewState.error,
|
|
83
115
|
uiState: rootState.reviewCompanyViewState.uiState,
|
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.24",
|
|
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",
|