@itilite/iui-user-management 0.4.19 → 0.4.20
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/dist/index.css +113 -9
- package/dist/index.js +2036 -659
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2040 -663
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -3
- package/dist/VectorinfoIcon~bdIVCeRl.jpg +0 -0
package/dist/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var moment = _interopDefault(require('moment'));
|
|
|
14
14
|
var reduxDevtoolsExtension = require('redux-devtools-extension');
|
|
15
15
|
var reactRouterDom = require('react-router-dom');
|
|
16
16
|
var styles$8 = require('@material-ui/core/styles');
|
|
17
|
+
var Tooltip = _interopDefault(require('@material-ui/core/Tooltip'));
|
|
17
18
|
var Switch = _interopDefault(require('@material-ui/core/Switch'));
|
|
18
19
|
var MoreHorizIcon = _interopDefault(require('@material-ui/icons/MoreHoriz'));
|
|
19
20
|
var Button = _interopDefault(require('@material-ui/core/Button'));
|
|
20
21
|
var core = require('@material-ui/core');
|
|
22
|
+
var useScrollPosition = require('@n8tb1t/use-scroll-position');
|
|
21
23
|
|
|
22
24
|
function _extends() {
|
|
23
25
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -33,6 +35,37 @@ function _extends() {
|
|
|
33
35
|
};
|
|
34
36
|
return _extends.apply(this, arguments);
|
|
35
37
|
}
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
39
|
+
if (!o) return;
|
|
40
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
41
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
42
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
43
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
44
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
45
|
+
}
|
|
46
|
+
function _arrayLikeToArray(arr, len) {
|
|
47
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
48
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
49
|
+
return arr2;
|
|
50
|
+
}
|
|
51
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
52
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
53
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
54
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
55
|
+
if (it) o = it;
|
|
56
|
+
var i = 0;
|
|
57
|
+
return function () {
|
|
58
|
+
if (i >= o.length) return {
|
|
59
|
+
done: true
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
done: false,
|
|
63
|
+
value: o[i++]
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
|
+
}
|
|
36
69
|
|
|
37
70
|
var _Pact = /*#__PURE__*/function () {
|
|
38
71
|
function _Pact() {}
|
|
@@ -70,7 +103,6 @@ var _Pact = /*#__PURE__*/function () {
|
|
|
70
103
|
};
|
|
71
104
|
return _Pact;
|
|
72
105
|
}();
|
|
73
|
-
|
|
74
106
|
function _settle(pact, state, value) {
|
|
75
107
|
if (!pact.s) {
|
|
76
108
|
if (value instanceof _Pact) {
|
|
@@ -99,7 +131,6 @@ function _settle(pact, state, value) {
|
|
|
99
131
|
function _isSettledPact(thenable) {
|
|
100
132
|
return thenable instanceof _Pact && thenable.s & 1;
|
|
101
133
|
}
|
|
102
|
-
|
|
103
134
|
function _forTo(array, body, check) {
|
|
104
135
|
var i = -1,
|
|
105
136
|
pact,
|
|
@@ -131,7 +162,6 @@ function _forTo(array, body, check) {
|
|
|
131
162
|
}
|
|
132
163
|
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
|
|
133
164
|
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
134
|
-
|
|
135
165
|
function _catch(body, recover) {
|
|
136
166
|
try {
|
|
137
167
|
var result = body();
|
|
@@ -150,17 +180,11 @@ function r(e) {
|
|
|
150
180
|
var t,
|
|
151
181
|
f,
|
|
152
182
|
n = "";
|
|
153
|
-
if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++)
|
|
154
|
-
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
155
|
-
} else for (t in e) {
|
|
156
|
-
e[t] && (n && (n += " "), n += t);
|
|
157
|
-
}
|
|
183
|
+
if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
158
184
|
return n;
|
|
159
185
|
}
|
|
160
186
|
function clsx() {
|
|
161
|
-
for (var e, t, f = 0, n = ""; f < arguments.length;)
|
|
162
|
-
(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
163
|
-
}
|
|
187
|
+
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
164
188
|
return n;
|
|
165
189
|
}
|
|
166
190
|
|
|
@@ -364,6 +388,9 @@ var userAddEditUrl = {
|
|
|
364
388
|
approversSearch: function approversSearch() {
|
|
365
389
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/company-approvers";
|
|
366
390
|
},
|
|
391
|
+
transferAppover: function transferAppover() {
|
|
392
|
+
return "api/v1/user-management/users/single-user/transfer-approver-role?";
|
|
393
|
+
},
|
|
367
394
|
preSignedUrl: function preSignedUrl() {
|
|
368
395
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/presigned-url";
|
|
369
396
|
},
|
|
@@ -396,6 +423,12 @@ var userAddEditUrl = {
|
|
|
396
423
|
},
|
|
397
424
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
398
425
|
return "api/v1/onboarding/user-signup-reject/" + userId + "?action=undo";
|
|
426
|
+
},
|
|
427
|
+
cardsEditUserDetails: function cardsEditUserDetails(userId) {
|
|
428
|
+
return env.getCardsapiURL() + "/authorization/user/" + userId;
|
|
429
|
+
},
|
|
430
|
+
cardsAddUsersDetails: function cardsAddUsersDetails() {
|
|
431
|
+
return env.getCardsapiURL() + "/authorization/company/" + IUILocalStorageService.getCompanyId() + "/roles";
|
|
399
432
|
}
|
|
400
433
|
};
|
|
401
434
|
var userListUrl = {
|
|
@@ -451,15 +484,23 @@ var userPanelUrl = {
|
|
|
451
484
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?action=delete&table=" + tableName;
|
|
452
485
|
},
|
|
453
486
|
getUnit: function getUnit(tableName, length, sort) {
|
|
454
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&
|
|
487
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&ordering=" + sort;
|
|
455
488
|
},
|
|
456
489
|
getPaginationUnit: function getPaginationUnit(tableName, length, page, sort) {
|
|
457
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&
|
|
490
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&ordering=" + sort;
|
|
458
491
|
},
|
|
459
492
|
moveUnit: function moveUnit() {
|
|
460
493
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
|
|
461
494
|
}
|
|
462
495
|
};
|
|
496
|
+
var departmentUrl = {
|
|
497
|
+
departmentUrl: function departmentUrl() {
|
|
498
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department";
|
|
499
|
+
},
|
|
500
|
+
getDepartmentHead: function getDepartmentHead(departmentId, page) {
|
|
501
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department/" + departmentId + "/users?page=" + page;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
463
504
|
|
|
464
505
|
var api = utils.configs.api;
|
|
465
506
|
var NAoptionConfig = {
|
|
@@ -469,7 +510,6 @@ var NAoptionConfig = {
|
|
|
469
510
|
},
|
|
470
511
|
applyFor: ['employee_level', 'department']
|
|
471
512
|
};
|
|
472
|
-
|
|
473
513
|
var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
|
|
474
514
|
var page = _ref.page,
|
|
475
515
|
tabelName = _ref.tabelName,
|
|
@@ -602,11 +642,53 @@ var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _r
|
|
|
602
642
|
return Promise.reject(e);
|
|
603
643
|
}
|
|
604
644
|
};
|
|
605
|
-
var
|
|
645
|
+
var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _ref4) {
|
|
606
646
|
var page = _ref4.page,
|
|
607
647
|
product = _ref4.product,
|
|
608
|
-
userId = _ref4.userId
|
|
609
|
-
|
|
648
|
+
userId = _ref4.userId;
|
|
649
|
+
try {
|
|
650
|
+
return Promise.resolve(_catch(function () {
|
|
651
|
+
return Promise.resolve(api.get(userAddEditUrl.transferAppover() + "user_id=" + userId + "&page=" + page + "&search=" + search).then(function (res) {
|
|
652
|
+
return res.data;
|
|
653
|
+
})).then(function (response) {
|
|
654
|
+
var mappedValue = response.results.map(function (item) {
|
|
655
|
+
return {
|
|
656
|
+
value: item.email,
|
|
657
|
+
label: item.email,
|
|
658
|
+
type: 'detailed',
|
|
659
|
+
data: item
|
|
660
|
+
};
|
|
661
|
+
});
|
|
662
|
+
return {
|
|
663
|
+
options: mappedValue,
|
|
664
|
+
hasMore: !!response.next,
|
|
665
|
+
additional: {
|
|
666
|
+
page: page + 1,
|
|
667
|
+
product: product,
|
|
668
|
+
userId: userId
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
});
|
|
672
|
+
}, function () {
|
|
673
|
+
return {
|
|
674
|
+
options: [],
|
|
675
|
+
hasMore: false,
|
|
676
|
+
additional: {
|
|
677
|
+
page: 1,
|
|
678
|
+
product: product,
|
|
679
|
+
userId: userId
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
}));
|
|
683
|
+
} catch (e) {
|
|
684
|
+
return Promise.reject(e);
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
688
|
+
var page = _ref5.page,
|
|
689
|
+
product = _ref5.product,
|
|
690
|
+
userId = _ref5.userId,
|
|
691
|
+
placeholder = _ref5.placeholder;
|
|
610
692
|
try {
|
|
611
693
|
return Promise.resolve(_catch(function () {
|
|
612
694
|
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
@@ -652,9 +734,9 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
|
652
734
|
return Promise.reject(e);
|
|
653
735
|
}
|
|
654
736
|
};
|
|
655
|
-
var countryOptions = function countryOptions(search, loadedOptions,
|
|
656
|
-
var page =
|
|
657
|
-
tabelName =
|
|
737
|
+
var countryOptions = function countryOptions(search, loadedOptions, _ref6) {
|
|
738
|
+
var page = _ref6.page,
|
|
739
|
+
tabelName = _ref6.tabelName;
|
|
658
740
|
try {
|
|
659
741
|
return Promise.resolve(_catch(function () {
|
|
660
742
|
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
@@ -666,7 +748,6 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
|
666
748
|
label: item[tabelName]
|
|
667
749
|
};
|
|
668
750
|
});
|
|
669
|
-
|
|
670
751
|
return {
|
|
671
752
|
options: mappedValue,
|
|
672
753
|
hasMore: !!response.next,
|
|
@@ -690,6 +771,45 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
|
690
771
|
return Promise.reject(e);
|
|
691
772
|
}
|
|
692
773
|
};
|
|
774
|
+
var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions, _ref7) {
|
|
775
|
+
var page = _ref7.page,
|
|
776
|
+
departmentId = _ref7.departmentId;
|
|
777
|
+
try {
|
|
778
|
+
return Promise.resolve(_catch(function () {
|
|
779
|
+
return Promise.resolve(api.get(departmentUrl.getDepartmentHead(departmentId, page) + "&search=" + search).then(function (res) {
|
|
780
|
+
return res.data;
|
|
781
|
+
})).then(function (response) {
|
|
782
|
+
var mappedValue = response.results.map(function (item) {
|
|
783
|
+
return {
|
|
784
|
+
value: item.id,
|
|
785
|
+
label: item.first_name + ' ' + item.last_name,
|
|
786
|
+
type: 'detailed',
|
|
787
|
+
data: item
|
|
788
|
+
};
|
|
789
|
+
});
|
|
790
|
+
return {
|
|
791
|
+
options: mappedValue,
|
|
792
|
+
hasMore: !!response.next,
|
|
793
|
+
additional: {
|
|
794
|
+
page: page + 1,
|
|
795
|
+
departmentId: departmentId
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
});
|
|
799
|
+
}, function () {
|
|
800
|
+
return {
|
|
801
|
+
options: [],
|
|
802
|
+
hasMore: false,
|
|
803
|
+
additional: {
|
|
804
|
+
page: 1,
|
|
805
|
+
departmentId: departmentId
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
}));
|
|
809
|
+
} catch (e) {
|
|
810
|
+
return Promise.reject(e);
|
|
811
|
+
}
|
|
812
|
+
};
|
|
693
813
|
|
|
694
814
|
var UserRole = function UserRole(_ref) {
|
|
695
815
|
var _ref$list = _ref.list,
|
|
@@ -711,6 +831,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
711
831
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
712
832
|
var STOP_LOADER = 'STOP_LOADER';
|
|
713
833
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
834
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
714
835
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
715
836
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
716
837
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -755,9 +876,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
755
876
|
if (payload.productAccess.expense) {
|
|
756
877
|
product.expense = payload.expenseRole || null;
|
|
757
878
|
}
|
|
879
|
+
if (payload.productAccess.card) {
|
|
880
|
+
var splitRole = payload.cardsRole.split(":");
|
|
881
|
+
var cardsUsmRole = splitRole[2];
|
|
882
|
+
product.card = cardsUsmRole || null;
|
|
883
|
+
}
|
|
758
884
|
return product;
|
|
759
885
|
}(),
|
|
760
|
-
approvers: {}
|
|
886
|
+
approvers: {},
|
|
887
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
761
888
|
};
|
|
762
889
|
var userTags = [];
|
|
763
890
|
for (var key in payload.userTagType) {
|
|
@@ -768,7 +895,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
768
895
|
if (userTags.length) {
|
|
769
896
|
res.user_tags = userTags;
|
|
770
897
|
}
|
|
771
|
-
|
|
772
898
|
if (payload.productAccess.travel) {
|
|
773
899
|
var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
|
|
774
900
|
res.approvers.travel = [];
|
|
@@ -780,14 +906,12 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
780
906
|
});
|
|
781
907
|
}
|
|
782
908
|
}
|
|
783
|
-
|
|
784
909
|
if (payload.travelFYI && payload.travelFYI.value) {
|
|
785
910
|
res.approvers.travel.push({
|
|
786
911
|
email: payload.travelFYI.value,
|
|
787
912
|
sequence: 'fyi'
|
|
788
913
|
});
|
|
789
914
|
}
|
|
790
|
-
|
|
791
915
|
res.user_travel_info = {
|
|
792
916
|
passport_issue_country: payload !== null && payload !== void 0 && (_payload$passportInfo = payload.passportInfoInput) !== null && _payload$passportInfo !== void 0 && (_payload$passportInfo2 = _payload$passportInfo.passport_issue_country) !== null && _payload$passportInfo2 !== void 0 && _payload$passportInfo2.value ? payload.passportInfoInput.passport_issue_country.value : null,
|
|
793
917
|
nationality: payload !== null && payload !== void 0 && (_payload$passportInfo3 = payload.passportInfoInput) !== null && _payload$passportInfo3 !== void 0 && (_payload$passportInfo4 = _payload$passportInfo3.nationality) !== null && _payload$passportInfo4 !== void 0 && _payload$passportInfo4.value ? payload.passportInfoInput.nationality.value : null,
|
|
@@ -826,7 +950,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
826
950
|
res.files = [];
|
|
827
951
|
}
|
|
828
952
|
}
|
|
829
|
-
|
|
830
953
|
if (payload.productAccess.expense) {
|
|
831
954
|
res.approvers.expense = [];
|
|
832
955
|
for (var _key2 in payload.expenseApproversInput) {
|
|
@@ -837,7 +960,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
837
960
|
});
|
|
838
961
|
}
|
|
839
962
|
}
|
|
840
|
-
|
|
841
963
|
if (payload.expenseFYI && payload.expenseFYI.value) {
|
|
842
964
|
res.approvers.expense.push({
|
|
843
965
|
email: payload.expenseFYI.value,
|
|
@@ -854,13 +976,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
854
976
|
var res = {
|
|
855
977
|
fields: {
|
|
856
978
|
user_personal_info: {},
|
|
857
|
-
employee_info: {}
|
|
979
|
+
employee_info: {},
|
|
980
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
858
981
|
}
|
|
859
982
|
};
|
|
860
983
|
if (!env$1.isProfilePage()) {
|
|
861
984
|
res.fields.product = function () {
|
|
862
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
985
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.card) {
|
|
986
|
+
return 'expense+travel+card';
|
|
987
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
863
988
|
return 'expense+travel';
|
|
989
|
+
} else if (payload.productAccess.expense && payload.productAccess.card) {
|
|
990
|
+
return 'expense+card';
|
|
991
|
+
} else if (payload.productAccess.travel && payload.productAccess.card) {
|
|
992
|
+
return 'travel+card';
|
|
864
993
|
} else if (payload.productAccess.travel) {
|
|
865
994
|
return 'travel';
|
|
866
995
|
} else {
|
|
@@ -875,6 +1004,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
875
1004
|
if (payload.productAccess.expense) {
|
|
876
1005
|
roles.expense = payload.expenseRole;
|
|
877
1006
|
}
|
|
1007
|
+
if (payload.productAccess.card) {
|
|
1008
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1009
|
+
var cardsUsmRole = splitRole[2];
|
|
1010
|
+
roles.card = cardsUsmRole;
|
|
1011
|
+
}
|
|
878
1012
|
return roles;
|
|
879
1013
|
}();
|
|
880
1014
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -945,7 +1079,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
945
1079
|
});
|
|
946
1080
|
}
|
|
947
1081
|
}
|
|
948
|
-
|
|
949
1082
|
if (payload.travelFYI && payload.travelFYI.value) {
|
|
950
1083
|
res.fields.approvers.travel.push({
|
|
951
1084
|
email: payload.travelFYI.value,
|
|
@@ -1022,7 +1155,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1022
1155
|
res.fields.user_travel_info.redress_number = payload.secureTravelInputInfo.redress_number || null;
|
|
1023
1156
|
}
|
|
1024
1157
|
}
|
|
1025
|
-
|
|
1026
1158
|
if (payload.productAccess.expense) {
|
|
1027
1159
|
if (!env$1.isProfilePage()) {
|
|
1028
1160
|
res.fields.approvers.expense = [];
|
|
@@ -1034,7 +1166,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1034
1166
|
});
|
|
1035
1167
|
}
|
|
1036
1168
|
}
|
|
1037
|
-
|
|
1038
1169
|
if (payload.expenseFYI && payload.expenseFYI.value) {
|
|
1039
1170
|
res.fields.approvers.expense.push({
|
|
1040
1171
|
email: payload.expenseFYI.value,
|
|
@@ -1166,10 +1297,19 @@ var updateTabValue = function updateTabValue(tabId) {
|
|
|
1166
1297
|
payload: tabId
|
|
1167
1298
|
};
|
|
1168
1299
|
};
|
|
1169
|
-
var updateActiveStatus = function updateActiveStatus(activateVal, id) {
|
|
1300
|
+
var updateActiveStatus = function updateActiveStatus(activateVal, id, roleTransfer, newApproverUserId) {
|
|
1301
|
+
if (roleTransfer === void 0) {
|
|
1302
|
+
roleTransfer = false;
|
|
1303
|
+
}
|
|
1304
|
+
var _payload = {
|
|
1305
|
+
role_transfer: roleTransfer
|
|
1306
|
+
};
|
|
1307
|
+
if (roleTransfer) {
|
|
1308
|
+
_payload.new_approver_user_id = newApproverUserId;
|
|
1309
|
+
}
|
|
1170
1310
|
return function (dispatch) {
|
|
1171
1311
|
return new Promise(function (resolve, reject) {
|
|
1172
|
-
api$1.
|
|
1312
|
+
api$1.put(userListUrl.updateActiveStatus + "user_id=" + id + "&activate=" + activateVal, _payload).then(function (res) {
|
|
1173
1313
|
dispatch(setUserActiveStatus({
|
|
1174
1314
|
is_active: activateVal !== 0,
|
|
1175
1315
|
id: id
|
|
@@ -1207,6 +1347,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1207
1347
|
payload: payload
|
|
1208
1348
|
};
|
|
1209
1349
|
};
|
|
1350
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1351
|
+
return {
|
|
1352
|
+
type: SET_CARDS_DETAILS,
|
|
1353
|
+
payload: payload
|
|
1354
|
+
};
|
|
1355
|
+
};
|
|
1210
1356
|
var setCustomField = function setCustomField(payload) {
|
|
1211
1357
|
return {
|
|
1212
1358
|
type: SET_CUSTOM_FIELD,
|
|
@@ -1266,7 +1412,6 @@ var fetchRenderFileds = function fetchRenderFileds() {
|
|
|
1266
1412
|
var _res$data;
|
|
1267
1413
|
IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.message) || 'Opps, Something went wrong.');
|
|
1268
1414
|
dispatch(stopLoader());
|
|
1269
|
-
reject();
|
|
1270
1415
|
}
|
|
1271
1416
|
})["catch"](function (err) {
|
|
1272
1417
|
reject(err);
|
|
@@ -1279,7 +1424,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
|
|
|
1279
1424
|
return new Promise(function (resolve, reject) {
|
|
1280
1425
|
api$2.get(userAddEditUrl.countryCode()).then(function (res) {
|
|
1281
1426
|
dispatch(setCountryCodes(res.data.country_code_details));
|
|
1282
|
-
resolve(
|
|
1427
|
+
resolve(res.data.country_code_details);
|
|
1283
1428
|
})["catch"](function (err) {
|
|
1284
1429
|
reject(err);
|
|
1285
1430
|
})["finally"](function () {});
|
|
@@ -1438,11 +1583,9 @@ var createUser = function createUser(payload) {
|
|
|
1438
1583
|
} else {
|
|
1439
1584
|
if (res.data.errors && typeof res.data.errors === 'object') {
|
|
1440
1585
|
reject(res.data.errors);
|
|
1441
|
-
return;
|
|
1442
1586
|
} else if (!Object.keys(res.data.errors).length) {
|
|
1443
1587
|
IUIToastMessageService$1.warningNotify(res.data.message);
|
|
1444
1588
|
}
|
|
1445
|
-
reject();
|
|
1446
1589
|
}
|
|
1447
1590
|
})["catch"](function (err) {
|
|
1448
1591
|
var _err$response6;
|
|
@@ -1488,17 +1631,13 @@ var uploadSingleDocumnet = function uploadSingleDocumnet(payload) {
|
|
|
1488
1631
|
});
|
|
1489
1632
|
};
|
|
1490
1633
|
};
|
|
1491
|
-
|
|
1492
1634
|
var uploadFileToS3 = function uploadFileToS3(presignedPostData, file) {
|
|
1493
1635
|
return new Promise(function (resolve, reject) {
|
|
1494
1636
|
var formData = new FormData();
|
|
1495
|
-
|
|
1496
1637
|
Object.keys(presignedPostData.fields).forEach(function (key) {
|
|
1497
1638
|
formData.append(key, presignedPostData.fields[key]);
|
|
1498
1639
|
});
|
|
1499
|
-
|
|
1500
1640
|
formData.append('file', file);
|
|
1501
|
-
|
|
1502
1641
|
axios.post(presignedPostData.url, formData, {
|
|
1503
1642
|
headers: {
|
|
1504
1643
|
'Content-Type': 'multipart/form-data'
|
|
@@ -1543,20 +1682,43 @@ var makePrimaryAdmin = function makePrimaryAdmin(payload) {
|
|
|
1543
1682
|
});
|
|
1544
1683
|
};
|
|
1545
1684
|
};
|
|
1546
|
-
var
|
|
1685
|
+
var resetPasswordForUser = function resetPasswordForUser(data) {
|
|
1547
1686
|
return function (dispatch) {
|
|
1548
1687
|
return new Promise(function (resolve, reject) {
|
|
1549
|
-
api$2.
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1688
|
+
api$2.post("" + userAddEditUrl.resetPasswordForUserApi(), {
|
|
1689
|
+
email: data.email
|
|
1690
|
+
}).then(function (res) {
|
|
1691
|
+
IUIToastMessageService$1.sNotify("The link to reset the password has been sent to the user's email address. Check your \"junk mail\" or \"spam\" folders in case it's not received.");
|
|
1692
|
+
resolve();
|
|
1693
|
+
})["catch"](function (err) {
|
|
1694
|
+
var _err$response9, _err$response9$data;
|
|
1695
|
+
if (!(err !== null && err !== void 0 && (_err$response9 = err.response) !== null && _err$response9 !== void 0 && (_err$response9$data = _err$response9.data) !== null && _err$response9$data !== void 0 && _err$response9$data.status)) {
|
|
1696
|
+
var _err$response10, _err$response10$data, _err$response10$data$;
|
|
1697
|
+
IUIToastMessageService$1.errNotify(err === null || err === void 0 ? void 0 : (_err$response10 = err.response) === null || _err$response10 === void 0 ? void 0 : (_err$response10$data = _err$response10.data) === null || _err$response10$data === void 0 ? void 0 : (_err$response10$data$ = _err$response10$data.message) === null || _err$response10$data$ === void 0 ? void 0 : _err$response10$data$.email[0]);
|
|
1698
|
+
reject(err);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
reject(err);
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
};
|
|
1705
|
+
};
|
|
1706
|
+
var resendInviteForUser = function resendInviteForUser(data) {
|
|
1707
|
+
return function (dispatch) {
|
|
1708
|
+
return new Promise(function (resolve, reject) {
|
|
1709
|
+
api$2.post(userAddEditUrl.resendInviteForUserApi(), {
|
|
1710
|
+
user_ids: data
|
|
1711
|
+
}).then(function (res) {
|
|
1712
|
+
IUIToastMessageService$1.sNotify(res.data.message);
|
|
1556
1713
|
resolve();
|
|
1557
1714
|
})["catch"](function (err) {
|
|
1558
|
-
var _err$
|
|
1559
|
-
|
|
1715
|
+
var _err$response11, _err$response11$data;
|
|
1716
|
+
if (!(err !== null && err !== void 0 && (_err$response11 = err.response) !== null && _err$response11 !== void 0 && (_err$response11$data = _err$response11.data) !== null && _err$response11$data !== void 0 && _err$response11$data.status)) {
|
|
1717
|
+
var _err$response12, _err$response12$data, _err$response12$data$;
|
|
1718
|
+
IUIToastMessageService$1.errNotify(err === null || err === void 0 ? void 0 : (_err$response12 = err.response) === null || _err$response12 === void 0 ? void 0 : (_err$response12$data = _err$response12.data) === null || _err$response12$data === void 0 ? void 0 : (_err$response12$data$ = _err$response12$data.message) === null || _err$response12$data$ === void 0 ? void 0 : _err$response12$data$.email[0]);
|
|
1719
|
+
reject(err);
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1560
1722
|
reject(err);
|
|
1561
1723
|
});
|
|
1562
1724
|
});
|
|
@@ -1698,7 +1860,7 @@ var verifyUserInfo = function verifyUserInfo(userId) {
|
|
|
1698
1860
|
var submitAddModalData = function submitAddModalData(tableName, data) {
|
|
1699
1861
|
return function (dispatch) {
|
|
1700
1862
|
return new Promise(function (resolve, reject) {
|
|
1701
|
-
api$2.post(userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
|
|
1863
|
+
api$2.post(tableName === 'department' ? departmentUrl.departmentUrl() : userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
|
|
1702
1864
|
resolve(res);
|
|
1703
1865
|
})["catch"](function (err) {
|
|
1704
1866
|
var _err$response17, _err$response17$data;
|
|
@@ -1734,6 +1896,7 @@ var OPEN_DIALOG = 'OPEN_DIALOG';
|
|
|
1734
1896
|
var CLOSE_DIALOG = 'CLOSE_DIALOG';
|
|
1735
1897
|
var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
|
|
1736
1898
|
var UNASSIGNED_USERS = 'Not assigned';
|
|
1899
|
+
var FETCH_DEPARTMENT_USERS_DATA = 'FETCH_DEPARTMENT_USERS_DATA';
|
|
1737
1900
|
|
|
1738
1901
|
var api$3 = utils.configs.api;
|
|
1739
1902
|
var IUIToastMessageService$2 = utils.services.IUIToastMessageService;
|
|
@@ -1780,18 +1943,17 @@ var getUserPanalData = function getUserPanalData(params) {
|
|
|
1780
1943
|
});
|
|
1781
1944
|
};
|
|
1782
1945
|
};
|
|
1783
|
-
|
|
1784
1946
|
var addRecord = function addRecord(tableName, data, getParam) {
|
|
1785
1947
|
return function (dispatch) {
|
|
1786
1948
|
return new Promise(function (resolve, reject) {
|
|
1787
|
-
api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
1949
|
+
api$3.post(tableName === 'department' ? departmentUrl.departmentUrl() : userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
1788
1950
|
dispatch(getUserPanalData(getParam));
|
|
1789
1951
|
dispatch(closeDialog());
|
|
1790
1952
|
resolve(res);
|
|
1791
1953
|
})["catch"](function (err) {
|
|
1792
|
-
var _err$
|
|
1954
|
+
var _err$response3, _err$response3$data;
|
|
1793
1955
|
dispatch(userPanelStopLoader());
|
|
1794
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
1956
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response3 = err.response) === null || _err$response3 === void 0 ? void 0 : (_err$response3$data = _err$response3.data) === null || _err$response3$data === void 0 ? void 0 : _err$response3$data.message) || 'Opps, Something went wrong.');
|
|
1795
1957
|
});
|
|
1796
1958
|
});
|
|
1797
1959
|
};
|
|
@@ -1805,25 +1967,37 @@ var deleteRecord = function deleteRecord(tableName, id, getParam) {
|
|
|
1805
1967
|
dispatch(userPanelStopLoader());
|
|
1806
1968
|
resolve();
|
|
1807
1969
|
})["catch"](function (err) {
|
|
1808
|
-
var _err$
|
|
1809
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
1970
|
+
var _err$response4, _err$response4$data;
|
|
1971
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response4 = err.response) === null || _err$response4 === void 0 ? void 0 : (_err$response4$data = _err$response4.data) === null || _err$response4$data === void 0 ? void 0 : _err$response4$data.message) || 'Opps, Something went wrong.');
|
|
1810
1972
|
dispatch(userPanelStopLoader());
|
|
1811
1973
|
});
|
|
1812
1974
|
});
|
|
1813
1975
|
};
|
|
1814
1976
|
};
|
|
1815
|
-
var editRecord = function editRecord(tableName, data, getParam) {
|
|
1977
|
+
var editRecord = function editRecord(tableName, data, getParam, optionalParams) {
|
|
1816
1978
|
return function (dispatch) {
|
|
1817
1979
|
return new Promise(function (resolve, reject) {
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1980
|
+
if (tableName === 'department') {
|
|
1981
|
+
api$3.put(departmentUrl.departmentUrl() + "/" + optionalParams, data).then(function (res) {
|
|
1982
|
+
dispatch(getUserPanalData(getParam));
|
|
1983
|
+
dispatch(closeDialog());
|
|
1984
|
+
resolve();
|
|
1985
|
+
})["catch"](function (err) {
|
|
1986
|
+
var _err$response5, _err$response5$data;
|
|
1987
|
+
dispatch(userPanelStopLoader());
|
|
1988
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response5 = err.response) === null || _err$response5 === void 0 ? void 0 : (_err$response5$data = _err$response5.data) === null || _err$response5$data === void 0 ? void 0 : _err$response5$data.message) || 'Opps, Something went wrong.');
|
|
1989
|
+
});
|
|
1990
|
+
} else {
|
|
1991
|
+
api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
|
|
1992
|
+
dispatch(getUserPanalData(getParam));
|
|
1993
|
+
dispatch(closeDialog());
|
|
1994
|
+
resolve();
|
|
1995
|
+
})["catch"](function (err) {
|
|
1996
|
+
var _err$response6, _err$response6$data;
|
|
1997
|
+
dispatch(userPanelStopLoader());
|
|
1998
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response6 = err.response) === null || _err$response6 === void 0 ? void 0 : (_err$response6$data = _err$response6.data) === null || _err$response6$data === void 0 ? void 0 : _err$response6$data.message) || 'Opps, Something went wrong.');
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
1827
2001
|
});
|
|
1828
2002
|
};
|
|
1829
2003
|
};
|
|
@@ -1835,8 +2009,8 @@ var moveRecord = function moveRecord(tableName, data, getParam) {
|
|
|
1835
2009
|
dispatch(closeDialog());
|
|
1836
2010
|
resolve(res);
|
|
1837
2011
|
})["catch"](function (err) {
|
|
1838
|
-
var _err$
|
|
1839
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2012
|
+
var _err$response7, _err$response7$data;
|
|
2013
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response7 = err.response) === null || _err$response7 === void 0 ? void 0 : (_err$response7$data = _err$response7.data) === null || _err$response7$data === void 0 ? void 0 : _err$response7$data.message) || 'Opps, Something went wrong.');
|
|
1840
2014
|
});
|
|
1841
2015
|
});
|
|
1842
2016
|
};
|
|
@@ -2156,7 +2330,7 @@ var PaymentCards = function PaymentCards(_ref3) {
|
|
|
2156
2330
|
isDefaultCard: !!+card.metadata.default_card,
|
|
2157
2331
|
pg: paymentDetails.pg
|
|
2158
2332
|
});
|
|
2159
|
-
}), (!paymentDetails.cards || paymentDetails.cards.length <
|
|
2333
|
+
}), (!paymentDetails.cards || paymentDetails.cards.length < 10) && paymentDetails.pg.gateway.toLowerCase() === 'stripe' && paymentDetails.pg.save_card_enable === 1 && /*#__PURE__*/React__default.createElement(AddCard, {
|
|
2160
2334
|
pg: paymentDetails.pg
|
|
2161
2335
|
}))))));
|
|
2162
2336
|
};
|
|
@@ -2324,7 +2498,6 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
2324
2498
|
setOpenEditAproverModalFlag(false);
|
|
2325
2499
|
});
|
|
2326
2500
|
};
|
|
2327
|
-
|
|
2328
2501
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
2329
2502
|
container: true,
|
|
2330
2503
|
className: (styles.headingPadding)
|
|
@@ -2472,8 +2645,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
2472
2645
|
headerText: "Edit approver field",
|
|
2473
2646
|
cancelLabel: "Cancel",
|
|
2474
2647
|
submitLabel: "Save",
|
|
2475
|
-
submitHandler: handleEditAproverLabel
|
|
2476
|
-
,
|
|
2648
|
+
submitHandler: handleEditAproverLabel,
|
|
2477
2649
|
width: "420px",
|
|
2478
2650
|
modalBodyStyle: {
|
|
2479
2651
|
maxHeight: '600px',
|
|
@@ -2927,8 +3099,8 @@ var workInfo = [{
|
|
|
2927
3099
|
validation: {
|
|
2928
3100
|
regexOnChange: null,
|
|
2929
3101
|
regexOnBlur: [{
|
|
2930
|
-
regex: /^[(A-Z)(a-z)(0-9)
|
|
2931
|
-
message: "Only alphabets, numbers and
|
|
3102
|
+
regex: /^[(A-Z)(a-z)(0-9)\-_& ]*$/,
|
|
3103
|
+
message: "Only alphabets, numbers, - and _ & are allowed."
|
|
2932
3104
|
}],
|
|
2933
3105
|
maxLimit: '',
|
|
2934
3106
|
minLimit: '',
|
|
@@ -3016,8 +3188,8 @@ var workInfo = [{
|
|
|
3016
3188
|
validation: {
|
|
3017
3189
|
regexOnChange: null,
|
|
3018
3190
|
regexOnBlur: [{
|
|
3019
|
-
regex: /^[A-Za-z0-9
|
|
3020
|
-
message: "Only alphabets, numbers & special characters . & ' ( ) - , / are allowed."
|
|
3191
|
+
regex: /^[A-Za-z0-9 \-_.,&'()\/]*$/,
|
|
3192
|
+
message: "Only alphabets, numbers & special characters . & ' ( ) _ - , / are allowed."
|
|
3021
3193
|
}, {
|
|
3022
3194
|
regex: /^[a-zA-Z]/,
|
|
3023
3195
|
message: 'Designation should start with alphabets'
|
|
@@ -3028,31 +3200,6 @@ var workInfo = [{
|
|
|
3028
3200
|
minLength: 0
|
|
3029
3201
|
},
|
|
3030
3202
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3031
|
-
}, {
|
|
3032
|
-
id: 7,
|
|
3033
|
-
label: 'Manager',
|
|
3034
|
-
name: 'manager',
|
|
3035
|
-
required: false,
|
|
3036
|
-
type: 'async_select',
|
|
3037
|
-
fullWidth: false,
|
|
3038
|
-
visibility: true,
|
|
3039
|
-
readOnly: false,
|
|
3040
|
-
placeholder: 'Select manager',
|
|
3041
|
-
tabelName: 'manager',
|
|
3042
|
-
product: 'travel',
|
|
3043
|
-
loadOption: approversOptions
|
|
3044
|
-
}, {
|
|
3045
|
-
id: 8,
|
|
3046
|
-
label: 'Skip manager',
|
|
3047
|
-
name: 'skip manager',
|
|
3048
|
-
required: false,
|
|
3049
|
-
type: 'async_select',
|
|
3050
|
-
fullWidth: false,
|
|
3051
|
-
visibility: true,
|
|
3052
|
-
readOnly: false,
|
|
3053
|
-
placeholder: 'Select manager',
|
|
3054
|
-
product: 'travel',
|
|
3055
|
-
loadOption: approversOptions
|
|
3056
3203
|
}, {
|
|
3057
3204
|
id: 9,
|
|
3058
3205
|
label: 'Base location',
|
|
@@ -3108,6 +3255,12 @@ var products = [{
|
|
|
3108
3255
|
name: 'expense',
|
|
3109
3256
|
type: 'checkbox',
|
|
3110
3257
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3258
|
+
}, {
|
|
3259
|
+
id: 3,
|
|
3260
|
+
label: 'Card',
|
|
3261
|
+
name: 'card',
|
|
3262
|
+
type: 'checkbox',
|
|
3263
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3111
3264
|
}];
|
|
3112
3265
|
var dropdownList = {
|
|
3113
3266
|
gender: [{
|
|
@@ -3278,6 +3431,34 @@ var expenseConstants = {
|
|
|
3278
3431
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3279
3432
|
}]
|
|
3280
3433
|
};
|
|
3434
|
+
var cardsConstants = {
|
|
3435
|
+
heading: 'Card specific information',
|
|
3436
|
+
roleHeading: 'Card role',
|
|
3437
|
+
roleDescription: 'Roles allow users to only access relevant features and functionalities',
|
|
3438
|
+
roles: [{
|
|
3439
|
+
id: 1,
|
|
3440
|
+
label: 'Card holder',
|
|
3441
|
+
description: 'Can view own cards and transactions.',
|
|
3442
|
+
value: '',
|
|
3443
|
+
name: '',
|
|
3444
|
+
type: 'radio',
|
|
3445
|
+
isAssigned: false,
|
|
3446
|
+
fullWidth: false,
|
|
3447
|
+
visibility: true,
|
|
3448
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3449
|
+
}, {
|
|
3450
|
+
id: 2,
|
|
3451
|
+
label: 'Card admin',
|
|
3452
|
+
description: 'Has full administrative access to the card program. Can issue cards, set card limits, add users, has visibility into all transactions, statements and balances.',
|
|
3453
|
+
value: '',
|
|
3454
|
+
name: '',
|
|
3455
|
+
type: 'radio',
|
|
3456
|
+
isAssigned: false,
|
|
3457
|
+
fullWidth: false,
|
|
3458
|
+
visibility: true,
|
|
3459
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3460
|
+
}]
|
|
3461
|
+
};
|
|
3281
3462
|
var passportInfo = [{
|
|
3282
3463
|
id: 1,
|
|
3283
3464
|
label: 'Passport issuing country',
|
|
@@ -3507,6 +3688,12 @@ var initialState = {
|
|
|
3507
3688
|
travelConstants: travelConstants,
|
|
3508
3689
|
expenseConstants: expenseConstants
|
|
3509
3690
|
},
|
|
3691
|
+
isCardsDetailsRendered: false,
|
|
3692
|
+
isCardsAdmin: false,
|
|
3693
|
+
cardsDetails: {
|
|
3694
|
+
cardsRoles: cardsConstants.roles,
|
|
3695
|
+
cardsConstants: cardsConstants
|
|
3696
|
+
},
|
|
3510
3697
|
dropdownList: dropdownList,
|
|
3511
3698
|
maxTravelApprovers: 10,
|
|
3512
3699
|
maxExpenseApprovers: 10,
|
|
@@ -3673,11 +3860,37 @@ var reducer = function reducer(state, action) {
|
|
|
3673
3860
|
isRendered: true
|
|
3674
3861
|
});
|
|
3675
3862
|
}
|
|
3863
|
+
case SET_CARDS_DETAILS:
|
|
3864
|
+
{
|
|
3865
|
+
var _action$payload8, _action$payload8$role, _action$payload9;
|
|
3866
|
+
var cardsDetails = _extends({}, state.cardsDetails);
|
|
3867
|
+
if (action !== null && action !== void 0 && (_action$payload8 = action.payload) !== null && _action$payload8 !== void 0 && (_action$payload8$role = _action$payload8.roles) !== null && _action$payload8$role !== void 0 && _action$payload8$role.length) {
|
|
3868
|
+
cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
|
|
3869
|
+
return {
|
|
3870
|
+
id: role.id,
|
|
3871
|
+
label: role.name,
|
|
3872
|
+
description: role.description,
|
|
3873
|
+
value: role.value,
|
|
3874
|
+
isAssigned: role.is_assigned,
|
|
3875
|
+
name: role.value,
|
|
3876
|
+
type: 'radio',
|
|
3877
|
+
fullWidth: false,
|
|
3878
|
+
visibility: true,
|
|
3879
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3880
|
+
};
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3883
|
+
return _extends({}, state, {
|
|
3884
|
+
cardsDetails: cardsDetails,
|
|
3885
|
+
isCardsDetailsRendered: true,
|
|
3886
|
+
isCardsAdmin: action === null || action === void 0 ? void 0 : (_action$payload9 = action.payload) === null || _action$payload9 === void 0 ? void 0 : _action$payload9.requested_user_is_admin
|
|
3887
|
+
});
|
|
3888
|
+
}
|
|
3676
3889
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3677
3890
|
{
|
|
3678
3891
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3679
|
-
var _action$
|
|
3680
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3892
|
+
var _action$payload10;
|
|
3893
|
+
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$payload10 = action.payload) !== null && _action$payload10 !== void 0 && _action$payload10[input.name]) {
|
|
3681
3894
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3682
3895
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3683
3896
|
}
|
|
@@ -3888,7 +4101,6 @@ var reducer$1 = function reducer(state, action) {
|
|
|
3888
4101
|
_userListInfo.results[i].is_active = action.payload.is_active;
|
|
3889
4102
|
}
|
|
3890
4103
|
});
|
|
3891
|
-
|
|
3892
4104
|
var _deactivatedUsers = _userListInfo.results.length > 0 ? _userListInfo.results.filter(function (val) {
|
|
3893
4105
|
return !val.is_active;
|
|
3894
4106
|
}).map(function (obj) {
|
|
@@ -3911,7 +4123,6 @@ var reducer$1 = function reducer(state, action) {
|
|
|
3911
4123
|
}
|
|
3912
4124
|
});
|
|
3913
4125
|
});
|
|
3914
|
-
|
|
3915
4126
|
var _deactivatedUsers2 = _userListInfo2.results.length > 0 ? _userListInfo2.results.filter(function (val) {
|
|
3916
4127
|
return !val.is_active;
|
|
3917
4128
|
}).map(function (obj) {
|
|
@@ -3965,6 +4176,7 @@ var initialState$2 = {
|
|
|
3965
4176
|
previous: null,
|
|
3966
4177
|
results: []
|
|
3967
4178
|
},
|
|
4179
|
+
deptUsers: [],
|
|
3968
4180
|
loading: false
|
|
3969
4181
|
};
|
|
3970
4182
|
var reducer$2 = function reducer(state, action) {
|
|
@@ -4034,6 +4246,12 @@ var reducer$2 = function reducer(state, action) {
|
|
|
4034
4246
|
loading: false
|
|
4035
4247
|
});
|
|
4036
4248
|
}
|
|
4249
|
+
case FETCH_DEPARTMENT_USERS_DATA:
|
|
4250
|
+
{
|
|
4251
|
+
return _extends({}, state, {
|
|
4252
|
+
deptUsers: action.payload
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4037
4255
|
default:
|
|
4038
4256
|
return state;
|
|
4039
4257
|
}
|
|
@@ -4220,8 +4438,7 @@ var rootReducer = redux.combineReducers({
|
|
|
4220
4438
|
customFields: reducer$5
|
|
4221
4439
|
});
|
|
4222
4440
|
|
|
4223
|
-
var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)
|
|
4224
|
-
));
|
|
4441
|
+
var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)));
|
|
4225
4442
|
|
|
4226
4443
|
function withStore(Component) {
|
|
4227
4444
|
function WrappedComponent(props) {
|
|
@@ -4726,7 +4943,9 @@ var ErrorMessages = {
|
|
|
4726
4943
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4727
4944
|
passport_photo: 'Please attach passport photo.',
|
|
4728
4945
|
travel_docs: 'Please attach travel docs.',
|
|
4729
|
-
products: 'Please select atleast one product access.'
|
|
4946
|
+
products: 'Please select atleast one product access.',
|
|
4947
|
+
only_cards_products: 'Currently, Card cannot be selected as a standalone option. Please add at least one more product.',
|
|
4948
|
+
none_products: 'Select at least one product. If opting for card, please choose at least one additional product.'
|
|
4730
4949
|
};
|
|
4731
4950
|
|
|
4732
4951
|
function AddPanelDialog(_ref) {
|
|
@@ -4764,8 +4983,7 @@ function AddPanelDialog(_ref) {
|
|
|
4764
4983
|
flexDirection: "column",
|
|
4765
4984
|
padding: "8px 20px"
|
|
4766
4985
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
|
|
4767
|
-
label: name + " name"
|
|
4768
|
-
,
|
|
4986
|
+
label: name + " name",
|
|
4769
4987
|
name: "name",
|
|
4770
4988
|
defaultValue: "",
|
|
4771
4989
|
onValueChange: onValueChange,
|
|
@@ -4777,47 +4995,118 @@ function AddPanelDialog(_ref) {
|
|
|
4777
4995
|
})));
|
|
4778
4996
|
}
|
|
4779
4997
|
|
|
4780
|
-
var
|
|
4781
|
-
var
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4998
|
+
var CardsField = function CardsField(props) {
|
|
4999
|
+
var cardsConstants = props.cardsConstants,
|
|
5000
|
+
_props$onRoleChange = props.onRoleChange,
|
|
5001
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
5002
|
+
_props$roleValue = props.roleValue,
|
|
5003
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
4786
5004
|
_props$isProfile = props.isProfile,
|
|
4787
|
-
isProfile = _props$isProfile === void 0 ? false : _props$isProfile
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
5005
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5006
|
+
_props$roles = props.roles,
|
|
5007
|
+
roles = _props$roles === void 0 ? [] : _props$roles,
|
|
5008
|
+
_props$cardsAdmin = props.cardsAdmin,
|
|
5009
|
+
cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
|
|
5010
|
+
editUserId = props.editUserId,
|
|
5011
|
+
loggedInUserId = props.loggedInUserId;
|
|
5012
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5013
|
+
container: true,
|
|
5014
|
+
className: (styles.headingPadding)
|
|
5015
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5016
|
+
variant: "h3",
|
|
5017
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5018
|
+
}, cardsConstants.heading)), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
5019
|
+
className: styles.dividerColor
|
|
5020
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5021
|
+
container: true,
|
|
5022
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5023
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5024
|
+
item: true,
|
|
5025
|
+
sm: 12,
|
|
5026
|
+
md: 4
|
|
5027
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
5028
|
+
label: cardsConstants.roleHeading,
|
|
5029
|
+
headerType: true,
|
|
5030
|
+
description: cardsConstants.roleDescription
|
|
5031
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5032
|
+
item: true,
|
|
5033
|
+
sm: 12,
|
|
5034
|
+
md: 8,
|
|
5035
|
+
lg: 8,
|
|
5036
|
+
xl: 6
|
|
5037
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5038
|
+
container: true,
|
|
5039
|
+
className: styles.formFieldsWrapper
|
|
5040
|
+
}, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React__default.createElement(UserRole, {
|
|
5041
|
+
list: roles,
|
|
5042
|
+
value: roleValue
|
|
5043
|
+
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIRadio, {
|
|
5044
|
+
list: roles,
|
|
5045
|
+
value: roleValue,
|
|
5046
|
+
onValueChange: onRoleChange,
|
|
5047
|
+
disabled: cardsAdmin ? false : true
|
|
5048
|
+
})), !cardsAdmin && !isProfile && /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5049
|
+
item: true,
|
|
5050
|
+
sm: 12,
|
|
5051
|
+
md: 12,
|
|
5052
|
+
lg: 12,
|
|
5053
|
+
style: {
|
|
5054
|
+
marginTop: "24px"
|
|
5055
|
+
}
|
|
5056
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5057
|
+
variant: "body2",
|
|
5058
|
+
component: "span",
|
|
5059
|
+
className: styles.errorTextCls
|
|
5060
|
+
}, editUserId ? "Only Card admin can change the Card role." : "Only Card admin can change card roles. By default this user will have Card Holder role.")))));
|
|
5061
|
+
};
|
|
5062
|
+
|
|
5063
|
+
var IUIToastMessageService$4 = utils.services.IUIToastMessageService,
|
|
5064
|
+
IUILocalStorageService$5 = utils.services.IUILocalStorageService;
|
|
5065
|
+
var env$4 = utils.configs.env;
|
|
5066
|
+
var UserAddEdit = function UserAddEdit(props) {
|
|
5067
|
+
var isEditMode = props.isEditMode,
|
|
5068
|
+
editUserId = props.editUserId,
|
|
5069
|
+
config = props.config,
|
|
5070
|
+
_props$isProfile = props.isProfile,
|
|
5071
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5072
|
+
env$4.init(config, isProfile);
|
|
5073
|
+
var queryParams = new URLSearchParams(window.location.search);
|
|
5074
|
+
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
5075
|
+
var _useSelector = reactRedux.useSelector(function (state) {
|
|
5076
|
+
return state.userAddEdit;
|
|
5077
|
+
}),
|
|
5078
|
+
isPageLoading = _useSelector.loading,
|
|
5079
|
+
renderFields = _useSelector.renderFields,
|
|
5080
|
+
dropdownList = _useSelector.dropdownList,
|
|
5081
|
+
dateFormat = _useSelector.dateFormat,
|
|
5082
|
+
countryCode = _useSelector.countryCode,
|
|
5083
|
+
defaultCurrency = _useSelector.defaultCurrency,
|
|
5084
|
+
isTravelApproverLabelUpadted = _useSelector.isTravelApproverLabelUpadted,
|
|
5085
|
+
isExpenseApproverLabelUpadted = _useSelector.isExpenseApproverLabelUpadted,
|
|
5086
|
+
optionalFields = _useSelector.optionalFields,
|
|
5087
|
+
fieldsVisibility = _useSelector.fieldsVisibility,
|
|
5088
|
+
isRendered = _useSelector.isRendered,
|
|
5089
|
+
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
5090
|
+
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
5091
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5092
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5093
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5094
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
5095
|
+
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
5096
|
+
return state.common;
|
|
5097
|
+
}),
|
|
5098
|
+
isTokenVerified = _useSelector2.isTokenVerified,
|
|
5099
|
+
id = _useSelector2.id,
|
|
5100
|
+
hasVerificationError = _useSelector2.hasVerificationError,
|
|
5101
|
+
isILadmin = _useSelector2.isILadmin,
|
|
5102
|
+
companyName = _useSelector2.companyName;
|
|
5103
|
+
var history = reactRouterDom.useHistory();
|
|
5104
|
+
var location = reactRouterDom.useLocation();
|
|
5105
|
+
var _useState = React.useState({
|
|
5106
|
+
travel: false,
|
|
5107
|
+
expense: false,
|
|
5108
|
+
card: false
|
|
5109
|
+
}),
|
|
4821
5110
|
productAccess = _useState[0],
|
|
4822
5111
|
setProductAccess = _useState[1];
|
|
4823
5112
|
var addProductAccessSelected = function addProductAccessSelected(args) {
|
|
@@ -4827,13 +5116,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4827
5116
|
errorMsgs.products = '';
|
|
4828
5117
|
var _productAccess = _extends({}, productAccess);
|
|
4829
5118
|
_productAccess[value] = !_productAccess[value];
|
|
4830
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5119
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === true) {
|
|
4831
5120
|
var _errorArray = [].concat(errorArray);
|
|
4832
5121
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4833
5122
|
if (_errorArray.indexOf('products') === -1) {
|
|
4834
5123
|
_errorArray.push('products');
|
|
4835
5124
|
}
|
|
4836
|
-
_errorMsgs.products = ErrorMessages.
|
|
5125
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4837
5126
|
setErrorArray(_errorArray);
|
|
4838
5127
|
setErrorMsgs(_errorMsgs);
|
|
4839
5128
|
var el = document.getElementById('products');
|
|
@@ -4843,14 +5132,202 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4843
5132
|
block: 'center'
|
|
4844
5133
|
});
|
|
4845
5134
|
}
|
|
5135
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5136
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5137
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5138
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5139
|
+
_errorArray2.push('products');
|
|
5140
|
+
}
|
|
5141
|
+
_errorMsgs2.products = ErrorMessages.products;
|
|
5142
|
+
setErrorArray(_errorArray2);
|
|
5143
|
+
setErrorMsgs(_errorMsgs2);
|
|
5144
|
+
var _el = document.getElementById('products');
|
|
5145
|
+
if (_el) {
|
|
5146
|
+
_el.scrollIntoView({
|
|
5147
|
+
behavior: 'smooth',
|
|
5148
|
+
block: 'center'
|
|
5149
|
+
});
|
|
5150
|
+
}
|
|
4846
5151
|
} else {
|
|
4847
5152
|
setErrorArray(errorArray);
|
|
4848
5153
|
setErrorMsgs(errorMsgs);
|
|
4849
5154
|
}
|
|
4850
5155
|
setProductAccess(_productAccess);
|
|
4851
5156
|
};
|
|
4852
|
-
|
|
4853
|
-
|
|
5157
|
+
var _useState2 = React.useState(''),
|
|
5158
|
+
newCountryCode = _useState2[0],
|
|
5159
|
+
setNewCountryCode = _useState2[1];
|
|
5160
|
+
var _useState3 = React.useState(),
|
|
5161
|
+
countryDialCode = _useState3[0],
|
|
5162
|
+
setCountryDialCode = _useState3[1];
|
|
5163
|
+
var _useState4 = React.useState([]),
|
|
5164
|
+
countryContactCode = _useState4[0],
|
|
5165
|
+
setCountryContactCode = _useState4[1];
|
|
5166
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5167
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5168
|
+
if (isProfile) {
|
|
5169
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5170
|
+
(config === null || config === void 0 ? void 0 : (_config$routes = config.routes) === null || _config$routes === void 0 ? void 0 : (_config$routes$profil = _config$routes.profile) === null || _config$routes$profil === void 0 ? void 0 : (_config$routes$profil2 = _config$routes$profil.redirectUrl) === null || _config$routes$profil2 === void 0 ? void 0 : _config$routes$profil2.submit) && history.push(config.routes.profile.redirectUrl.submit);
|
|
5171
|
+
} else {
|
|
5172
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5173
|
+
(config === null || config === void 0 ? void 0 : (_config$routes2 = config.routes) === null || _config$routes2 === void 0 ? void 0 : (_config$routes2$users = _config$routes2.users) === null || _config$routes2$users === void 0 ? void 0 : (_config$routes2$users2 = _config$routes2$users.list) === null || _config$routes2$users2 === void 0 ? void 0 : _config$routes2$users2.path) && history.push(config.routes.users.list.path);
|
|
5174
|
+
}
|
|
5175
|
+
setFilesForDelete([]);
|
|
5176
|
+
setProfilePicDelete([]);
|
|
5177
|
+
})["catch"](function (err) {
|
|
5178
|
+
if (typeof err === 'object') {
|
|
5179
|
+
if (err.country_code) {
|
|
5180
|
+
err.contact_number = err.country_code;
|
|
5181
|
+
}
|
|
5182
|
+
if (err.contact_country_code) {
|
|
5183
|
+
err.contact_number = err.contact_country_code;
|
|
5184
|
+
}
|
|
5185
|
+
if (err.passport) {
|
|
5186
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5187
|
+
delete err.passport;
|
|
5188
|
+
}
|
|
5189
|
+
setErrorArray(Object.keys(err));
|
|
5190
|
+
setErrorMsgs(err);
|
|
5191
|
+
var _loop = function _loop() {
|
|
5192
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5193
|
+
if (err[key]) {
|
|
5194
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5195
|
+
setAdditionalInfoFlag('open');
|
|
5196
|
+
}
|
|
5197
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5198
|
+
if (el) {
|
|
5199
|
+
setTimeout(function () {
|
|
5200
|
+
el.scrollIntoView({
|
|
5201
|
+
behavior: 'smooth',
|
|
5202
|
+
block: 'center'
|
|
5203
|
+
});
|
|
5204
|
+
}, 500);
|
|
5205
|
+
return 1;
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
};
|
|
5210
|
+
for (var key in err) {
|
|
5211
|
+
if (_loop()) break;
|
|
5212
|
+
}
|
|
5213
|
+
} else if (typeof err === 'string') {
|
|
5214
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5215
|
+
} else {
|
|
5216
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5217
|
+
}
|
|
5218
|
+
})["finally"](function () {
|
|
5219
|
+
dispatch(stopLoader());
|
|
5220
|
+
});
|
|
5221
|
+
};
|
|
5222
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5223
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5224
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5225
|
+
if (config !== null && config !== void 0 && (_config$routes3 = config.routes) !== null && _config$routes3 !== void 0 && (_config$routes3$users = _config$routes3.users) !== null && _config$routes3$users !== void 0 && (_config$routes3$users2 = _config$routes3$users.list) !== null && _config$routes3$users2 !== void 0 && _config$routes3$users2.path) {
|
|
5226
|
+
history.push({
|
|
5227
|
+
pathname: config.routes.users.list.path
|
|
5228
|
+
});
|
|
5229
|
+
}
|
|
5230
|
+
})["catch"](function (err) {
|
|
5231
|
+
if (typeof err === 'object') {
|
|
5232
|
+
if (err.country_code) {
|
|
5233
|
+
err.contact_number = err.country_code;
|
|
5234
|
+
}
|
|
5235
|
+
if (err.contact_country_code) {
|
|
5236
|
+
err.contact_number = err.contact_country_code;
|
|
5237
|
+
}
|
|
5238
|
+
if (err.passport) {
|
|
5239
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5240
|
+
delete err.passport;
|
|
5241
|
+
}
|
|
5242
|
+
setErrorArray(Object.keys(err));
|
|
5243
|
+
setErrorMsgs(err);
|
|
5244
|
+
var _loop2 = function _loop2() {
|
|
5245
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5246
|
+
if (err[key]) {
|
|
5247
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5248
|
+
setAdditionalInfoFlag('open');
|
|
5249
|
+
}
|
|
5250
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5251
|
+
if (el) {
|
|
5252
|
+
setTimeout(function () {
|
|
5253
|
+
el.scrollIntoView({
|
|
5254
|
+
behavior: 'smooth',
|
|
5255
|
+
block: 'center'
|
|
5256
|
+
});
|
|
5257
|
+
}, 500);
|
|
5258
|
+
return 1;
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
};
|
|
5263
|
+
for (var key in err) {
|
|
5264
|
+
if (_loop2()) break;
|
|
5265
|
+
}
|
|
5266
|
+
} else if (typeof err === 'string') {
|
|
5267
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5268
|
+
} else {
|
|
5269
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5270
|
+
}
|
|
5271
|
+
})["finally"](function () {
|
|
5272
|
+
dispatch(stopLoader());
|
|
5273
|
+
});
|
|
5274
|
+
};
|
|
5275
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5276
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5277
|
+
method: 'GET',
|
|
5278
|
+
headers: {
|
|
5279
|
+
'Content-Type': 'application/json',
|
|
5280
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5281
|
+
}
|
|
5282
|
+
}).then(function (response) {
|
|
5283
|
+
return response.json();
|
|
5284
|
+
}).then(function (res) {
|
|
5285
|
+
var _res$roles;
|
|
5286
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5287
|
+
dispatch(setCardsDetails(res));
|
|
5288
|
+
} else {
|
|
5289
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5290
|
+
}
|
|
5291
|
+
})["catch"](function (error) {
|
|
5292
|
+
console.log("errorrr", error);
|
|
5293
|
+
});
|
|
5294
|
+
};
|
|
5295
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5296
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5297
|
+
method: 'GET',
|
|
5298
|
+
headers: {
|
|
5299
|
+
'Content-Type': 'application/json',
|
|
5300
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5301
|
+
}
|
|
5302
|
+
}).then(function (response) {
|
|
5303
|
+
return response.json();
|
|
5304
|
+
}).then(function (res) {
|
|
5305
|
+
var _res$roles2;
|
|
5306
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5307
|
+
dispatch(setCardsDetails(res));
|
|
5308
|
+
} else {
|
|
5309
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5310
|
+
}
|
|
5311
|
+
})["catch"](function (error) {
|
|
5312
|
+
console.log("errorrr", error);
|
|
5313
|
+
});
|
|
5314
|
+
};
|
|
5315
|
+
React.useEffect(function () {
|
|
5316
|
+
var countryObject = countryContactCode.find(function (t) {
|
|
5317
|
+
return t.dial_code === countryDialCode;
|
|
5318
|
+
});
|
|
5319
|
+
if (countryObject) {
|
|
5320
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5321
|
+
country_code: countryObject.code
|
|
5322
|
+
}));
|
|
5323
|
+
}
|
|
5324
|
+
}, [countryDialCode]);
|
|
5325
|
+
React.useEffect(function () {
|
|
5326
|
+
var extractedNumber = newCountryCode.substring(1);
|
|
5327
|
+
var convertedNumber = parseInt(extractedNumber);
|
|
5328
|
+
setCountryDialCode(convertedNumber);
|
|
5329
|
+
}, [newCountryCode]);
|
|
5330
|
+
var _useState5 = React.useState({
|
|
4854
5331
|
first_name: '',
|
|
4855
5332
|
last_name: '',
|
|
4856
5333
|
email: '',
|
|
@@ -4861,9 +5338,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4861
5338
|
contact_country_code: '',
|
|
4862
5339
|
profile_pic: []
|
|
4863
5340
|
}),
|
|
4864
|
-
personalInfoInput =
|
|
4865
|
-
setPersonalInfoInput =
|
|
4866
|
-
var
|
|
5341
|
+
personalInfoInput = _useState5[0],
|
|
5342
|
+
setPersonalInfoInput = _useState5[1];
|
|
5343
|
+
var _useState6 = React.useState({
|
|
4867
5344
|
emp_level: {
|
|
4868
5345
|
value: '',
|
|
4869
5346
|
label: 'Select employee level'
|
|
@@ -4883,62 +5360,72 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4883
5360
|
},
|
|
4884
5361
|
designation: '',
|
|
4885
5362
|
base_location: '',
|
|
5363
|
+
manager_id: {
|
|
5364
|
+
value: '',
|
|
5365
|
+
label: 'Select Manager'
|
|
5366
|
+
},
|
|
5367
|
+
skip_manager_id: {
|
|
5368
|
+
value: '',
|
|
5369
|
+
label: 'Select Manager'
|
|
5370
|
+
},
|
|
4886
5371
|
currency: {
|
|
4887
5372
|
value: defaultCurrency,
|
|
4888
5373
|
label: defaultCurrency
|
|
4889
5374
|
}
|
|
4890
5375
|
}),
|
|
4891
|
-
employeeInfoInput =
|
|
4892
|
-
setEmployeeInfoInput =
|
|
4893
|
-
var
|
|
5376
|
+
employeeInfoInput = _useState6[0],
|
|
5377
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5378
|
+
var _useState7 = React.useState({
|
|
4894
5379
|
emp_level: 0,
|
|
4895
5380
|
entity: 0,
|
|
4896
5381
|
business_unit: 0,
|
|
4897
5382
|
department: 0,
|
|
4898
|
-
currency: 0
|
|
5383
|
+
currency: 0,
|
|
5384
|
+
manager_id: 0,
|
|
5385
|
+
skip_manager_id: 0
|
|
4899
5386
|
}),
|
|
4900
|
-
cacheForAsyncDropdown =
|
|
4901
|
-
clearCacheForAsyncDropdown =
|
|
4902
|
-
var
|
|
4903
|
-
userTagType =
|
|
4904
|
-
setUserTagType =
|
|
4905
|
-
var
|
|
4906
|
-
scroll =
|
|
4907
|
-
setScroll =
|
|
4908
|
-
var
|
|
4909
|
-
customFieldsInput =
|
|
4910
|
-
setCustomFieldsInput =
|
|
4911
|
-
var
|
|
4912
|
-
travelRole =
|
|
4913
|
-
setTravelRole =
|
|
4914
|
-
var
|
|
4915
|
-
travelApproversInput =
|
|
4916
|
-
setTravelApproversInput =
|
|
4917
|
-
var
|
|
5387
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5388
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5389
|
+
var _useState8 = React.useState({}),
|
|
5390
|
+
userTagType = _useState8[0],
|
|
5391
|
+
setUserTagType = _useState8[1];
|
|
5392
|
+
var _useState9 = React.useState(false),
|
|
5393
|
+
scroll = _useState9[0],
|
|
5394
|
+
setScroll = _useState9[1];
|
|
5395
|
+
var _useState10 = React.useState({}),
|
|
5396
|
+
customFieldsInput = _useState10[0],
|
|
5397
|
+
setCustomFieldsInput = _useState10[1];
|
|
5398
|
+
var _useState11 = React.useState('traveler'),
|
|
5399
|
+
travelRole = _useState11[0],
|
|
5400
|
+
setTravelRole = _useState11[1];
|
|
5401
|
+
var _useState12 = React.useState({}),
|
|
5402
|
+
travelApproversInput = _useState12[0],
|
|
5403
|
+
setTravelApproversInput = _useState12[1];
|
|
5404
|
+
var _useState13 = React.useState({
|
|
4918
5405
|
value: '',
|
|
4919
5406
|
label: 'Select approver'
|
|
4920
5407
|
}),
|
|
4921
|
-
travelFYI =
|
|
4922
|
-
setTravelFYI =
|
|
4923
|
-
var
|
|
4924
|
-
membershipInfoInput =
|
|
4925
|
-
setMembershipInfoInput =
|
|
4926
|
-
var
|
|
4927
|
-
removedMembershipInfoInput =
|
|
4928
|
-
setRemovedMembershipInfoInput =
|
|
4929
|
-
var
|
|
5408
|
+
travelFYI = _useState13[0],
|
|
5409
|
+
setTravelFYI = _useState13[1];
|
|
5410
|
+
var _useState14 = React.useState([]),
|
|
5411
|
+
membershipInfoInput = _useState14[0],
|
|
5412
|
+
setMembershipInfoInput = _useState14[1];
|
|
5413
|
+
var _useState15 = React.useState([]),
|
|
5414
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5415
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5416
|
+
var _useState16 = React.useState({
|
|
4930
5417
|
flight_seat_preference: '',
|
|
4931
5418
|
meal_preference: ''
|
|
4932
5419
|
}),
|
|
4933
|
-
travelPreferenceInfo =
|
|
4934
|
-
settravelPreferenceInfo =
|
|
4935
|
-
var
|
|
5420
|
+
travelPreferenceInfo = _useState16[0],
|
|
5421
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5422
|
+
var _useState17 = React.useState({
|
|
4936
5423
|
trusted_traveller: '',
|
|
4937
5424
|
redress_number: ''
|
|
4938
5425
|
}),
|
|
4939
|
-
secureTravelInputInfo =
|
|
4940
|
-
setSecureTravelInputInfo =
|
|
4941
|
-
var
|
|
5426
|
+
secureTravelInputInfo = _useState17[0],
|
|
5427
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5428
|
+
var _useState18 = React.useState({
|
|
4942
5429
|
passport_issue_country: {
|
|
4943
5430
|
value: '',
|
|
4944
5431
|
label: 'Select country'
|
|
@@ -4953,39 +5440,76 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4953
5440
|
passport_photo: [],
|
|
4954
5441
|
travel_docs: []
|
|
4955
5442
|
}),
|
|
4956
|
-
passportInfoInput =
|
|
4957
|
-
setPassportInfoInput =
|
|
4958
|
-
var
|
|
4959
|
-
filesForDelete =
|
|
4960
|
-
setFilesForDelete =
|
|
4961
|
-
var
|
|
4962
|
-
profilePicDelete =
|
|
4963
|
-
setProfilePicDelete =
|
|
4964
|
-
var
|
|
4965
|
-
isAdditionalInfoExpanded =
|
|
4966
|
-
setAdditionalInfoFlag =
|
|
4967
|
-
var
|
|
4968
|
-
expenseRole =
|
|
4969
|
-
setExpenseRole =
|
|
4970
|
-
var
|
|
4971
|
-
expenseApproversInput =
|
|
4972
|
-
setExpenseApproversInput =
|
|
4973
|
-
var
|
|
5443
|
+
passportInfoInput = _useState18[0],
|
|
5444
|
+
setPassportInfoInput = _useState18[1];
|
|
5445
|
+
var _useState19 = React.useState([]),
|
|
5446
|
+
filesForDelete = _useState19[0],
|
|
5447
|
+
setFilesForDelete = _useState19[1];
|
|
5448
|
+
var _useState20 = React.useState([]),
|
|
5449
|
+
profilePicDelete = _useState20[0],
|
|
5450
|
+
setProfilePicDelete = _useState20[1];
|
|
5451
|
+
var _useState21 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5452
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5453
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5454
|
+
var _useState22 = React.useState('submitter'),
|
|
5455
|
+
expenseRole = _useState22[0],
|
|
5456
|
+
setExpenseRole = _useState22[1];
|
|
5457
|
+
var _useState23 = React.useState({}),
|
|
5458
|
+
expenseApproversInput = _useState23[0],
|
|
5459
|
+
setExpenseApproversInput = _useState23[1];
|
|
5460
|
+
var _useState24 = React.useState({
|
|
4974
5461
|
value: '',
|
|
4975
5462
|
label: 'Select approver'
|
|
4976
5463
|
}),
|
|
4977
|
-
expenseFYI =
|
|
4978
|
-
setExpenseFYI =
|
|
5464
|
+
expenseFYI = _useState24[0],
|
|
5465
|
+
setExpenseFYI = _useState24[1];
|
|
5466
|
+
var _useState25 = React.useState(''),
|
|
5467
|
+
cardsRole = _useState25[0],
|
|
5468
|
+
setCardsRole = _useState25[1];
|
|
5469
|
+
React.useEffect(function () {
|
|
5470
|
+
if (productAccess.card === false) {
|
|
5471
|
+
setCardsRole('');
|
|
5472
|
+
}
|
|
5473
|
+
}, [productAccess.card]);
|
|
5474
|
+
React.useEffect(function () {
|
|
5475
|
+
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5476
|
+
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5477
|
+
return role.isAssigned;
|
|
5478
|
+
});
|
|
5479
|
+
if (selectedRole) {
|
|
5480
|
+
setCardsRole(selectedRole.value);
|
|
5481
|
+
} else {
|
|
5482
|
+
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5483
|
+
var splitRoleVal = role.value.split(':');
|
|
5484
|
+
return splitRoleVal[2] === 'card-holder';
|
|
5485
|
+
});
|
|
5486
|
+
if (defaultRole) {
|
|
5487
|
+
setCardsRole(defaultRole.value);
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5491
|
+
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5492
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5493
|
+
var role = _step.value;
|
|
5494
|
+
var splitRoleVal = role.value.split(':');
|
|
5495
|
+
var profileRole = splitRoleVal[2];
|
|
5496
|
+
if (profileRole === targetRole) {
|
|
5497
|
+
setCardsRole(role.value);
|
|
5498
|
+
break;
|
|
5499
|
+
}
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
4979
5503
|
var asyncSelectRefs = React.useRef({
|
|
4980
5504
|
emp_level: React.useRef(null),
|
|
4981
5505
|
entity: React.useRef(null),
|
|
4982
5506
|
business_unit: React.useRef(null),
|
|
4983
5507
|
department: React.useRef(null)
|
|
4984
5508
|
});
|
|
4985
|
-
var
|
|
4986
|
-
errorArray =
|
|
4987
|
-
setErrorArray =
|
|
4988
|
-
var
|
|
5509
|
+
var _useState26 = React.useState([]),
|
|
5510
|
+
errorArray = _useState26[0],
|
|
5511
|
+
setErrorArray = _useState26[1];
|
|
5512
|
+
var _useState27 = React.useState({
|
|
4989
5513
|
first_name: '',
|
|
4990
5514
|
last_name: '',
|
|
4991
5515
|
email: '',
|
|
@@ -5015,9 +5539,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5015
5539
|
userTagType: '',
|
|
5016
5540
|
profile_pic: ''
|
|
5017
5541
|
}),
|
|
5018
|
-
errorMsgs =
|
|
5019
|
-
setErrorMsgs =
|
|
5020
|
-
var
|
|
5542
|
+
errorMsgs = _useState27[0],
|
|
5543
|
+
setErrorMsgs = _useState27[1];
|
|
5544
|
+
var _useState28 = React.useState({
|
|
5021
5545
|
first_name: false,
|
|
5022
5546
|
last_name: false,
|
|
5023
5547
|
email: false,
|
|
@@ -5044,11 +5568,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5044
5568
|
userTagType: false,
|
|
5045
5569
|
profile_pic: false
|
|
5046
5570
|
}),
|
|
5047
|
-
inputChangeLog =
|
|
5048
|
-
updateInputChangeLog =
|
|
5049
|
-
var
|
|
5050
|
-
uploadedFiles =
|
|
5051
|
-
setUploadedFiles =
|
|
5571
|
+
inputChangeLog = _useState28[0],
|
|
5572
|
+
updateInputChangeLog = _useState28[1];
|
|
5573
|
+
var _useState29 = React.useState([]),
|
|
5574
|
+
uploadedFiles = _useState29[0],
|
|
5575
|
+
setUploadedFiles = _useState29[1];
|
|
5576
|
+
var _useState30 = React.useState(70),
|
|
5577
|
+
maxLengthForModal = _useState30[0],
|
|
5578
|
+
setMaxLengthForModal = _useState30[1];
|
|
5052
5579
|
var defaultAddModalData = {
|
|
5053
5580
|
isOpen: false,
|
|
5054
5581
|
isError: false,
|
|
@@ -5061,25 +5588,41 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5061
5588
|
regexOnBlur: null,
|
|
5062
5589
|
maxLimit: '',
|
|
5063
5590
|
minLimit: '',
|
|
5064
|
-
maxLength:
|
|
5591
|
+
maxLength: maxLengthForModal,
|
|
5065
5592
|
minLength: 0
|
|
5066
5593
|
};
|
|
5067
|
-
var
|
|
5068
|
-
addModalData =
|
|
5069
|
-
setAddModalData =
|
|
5594
|
+
var _useState31 = React.useState(defaultAddModalData),
|
|
5595
|
+
addModalData = _useState31[0],
|
|
5596
|
+
setAddModalData = _useState31[1];
|
|
5070
5597
|
var onAddModalClose = function onAddModalClose() {
|
|
5071
5598
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5072
5599
|
};
|
|
5600
|
+
React.useEffect(function () {
|
|
5601
|
+
var _location$state, _location$state2;
|
|
5602
|
+
if (location !== null && location !== void 0 && (_location$state = location.state) !== null && _location$state !== void 0 && _location$state.id && location !== null && location !== void 0 && (_location$state2 = location.state) !== null && _location$state2 !== void 0 && _location$state2.name) {
|
|
5603
|
+
var _location$state3, _location$state4;
|
|
5604
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, {
|
|
5605
|
+
department: {
|
|
5606
|
+
value: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.id,
|
|
5607
|
+
label: location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.name
|
|
5608
|
+
}
|
|
5609
|
+
}));
|
|
5610
|
+
}
|
|
5611
|
+
}, []);
|
|
5073
5612
|
var onModalOpen = function onModalOpen(e, id) {
|
|
5074
5613
|
var title = '';
|
|
5075
5614
|
if (id === 'entity') {
|
|
5076
5615
|
title = 'Entity';
|
|
5616
|
+
setMaxLengthForModal(70);
|
|
5077
5617
|
} else if (id === 'department') {
|
|
5078
5618
|
title = 'Department';
|
|
5619
|
+
setMaxLengthForModal(70);
|
|
5079
5620
|
} else if (id === 'business_unit') {
|
|
5621
|
+
setMaxLengthForModal(150);
|
|
5080
5622
|
title = 'Business unit';
|
|
5081
5623
|
} else if (id === 'employee_level') {
|
|
5082
5624
|
title = 'Employee level';
|
|
5625
|
+
setMaxLengthForModal(70);
|
|
5083
5626
|
}
|
|
5084
5627
|
setAddModalData(_extends({}, addModalData, {
|
|
5085
5628
|
isOpen: true,
|
|
@@ -5095,23 +5638,42 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5095
5638
|
}));
|
|
5096
5639
|
} else {
|
|
5097
5640
|
dispatch(showLoader());
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5641
|
+
var dataObj;
|
|
5642
|
+
if (addModalData.id === 'department') {
|
|
5643
|
+
dataObj = {
|
|
5644
|
+
name: validatedValue,
|
|
5645
|
+
department_head_id: null
|
|
5646
|
+
};
|
|
5647
|
+
} else {
|
|
5648
|
+
dataObj = {
|
|
5649
|
+
names: [validatedValue]
|
|
5650
|
+
};
|
|
5651
|
+
}
|
|
5652
|
+
dispatch(submitAddModalData(addModalData.id, dataObj)).then(function (res) {
|
|
5653
|
+
var _extends4;
|
|
5102
5654
|
setAddModalData(_extends({}, addModalData, {
|
|
5103
5655
|
isOpen: false
|
|
5104
5656
|
}));
|
|
5105
5657
|
IUIToastMessageService$4.sNotify(addModalData.title + " added successfully.");
|
|
5106
5658
|
var tempKey = addModalData.id === 'employee_level' ? 'emp_level' : addModalData.id;
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5659
|
+
if (addModalData.id === 'department') {
|
|
5660
|
+
var _extends2;
|
|
5661
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
|
|
5662
|
+
value: res.data.result.id,
|
|
5663
|
+
label: res.data.result.name
|
|
5664
|
+
}, _extends2)));
|
|
5665
|
+
} else {
|
|
5666
|
+
var _extends3;
|
|
5667
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends3 = {}, _extends3[tempKey] = {
|
|
5668
|
+
value: res.data.value,
|
|
5669
|
+
label: res.data.label
|
|
5670
|
+
}, _extends3)));
|
|
5671
|
+
}
|
|
5672
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[tempKey] = true, _extends4)));
|
|
5111
5673
|
asyncSelectRefs.current[tempKey].current.blur();
|
|
5112
5674
|
clearCacheForAsyncDropdown(function (prevState) {
|
|
5113
|
-
var
|
|
5114
|
-
return _extends({}, prevState, (
|
|
5675
|
+
var _extends5;
|
|
5676
|
+
return _extends({}, prevState, (_extends5 = {}, _extends5[tempKey] = prevState[tempKey] + 1, _extends5));
|
|
5115
5677
|
});
|
|
5116
5678
|
dispatch(stopLoader());
|
|
5117
5679
|
});
|
|
@@ -5128,10 +5690,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5128
5690
|
};
|
|
5129
5691
|
var onPersonalInfoChange = function onPersonalInfoChange(args) {
|
|
5130
5692
|
try {
|
|
5131
|
-
var
|
|
5693
|
+
var _temp5 = function _temp5() {
|
|
5132
5694
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5133
|
-
var
|
|
5134
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5695
|
+
var _extends6;
|
|
5696
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends6 = {}, _extends6[_name] = true, _extends6)));
|
|
5135
5697
|
}
|
|
5136
5698
|
};
|
|
5137
5699
|
var _name = args._name,
|
|
@@ -5142,7 +5704,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5142
5704
|
_errorMsg = _args$_errorMsg === void 0 ? '' : _args$_errorMsg,
|
|
5143
5705
|
_args$_obj = args._obj,
|
|
5144
5706
|
_obj = _args$_obj === void 0 ? {} : _args$_obj;
|
|
5145
|
-
var
|
|
5707
|
+
var _temp4 = function () {
|
|
5146
5708
|
if (_name === 'contact_number') {
|
|
5147
5709
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5148
5710
|
contact_number: _value.trim(),
|
|
@@ -5153,14 +5715,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5153
5715
|
updateError('country_code', _isError, _errorMsg);
|
|
5154
5716
|
updateError('contact_country_code', _isError, _errorMsg);
|
|
5155
5717
|
} else {
|
|
5156
|
-
var
|
|
5157
|
-
var
|
|
5158
|
-
setPersonalInfoInput(_extends({}, personalInfoInput, (
|
|
5718
|
+
var _temp3 = function _temp3() {
|
|
5719
|
+
var _extends7;
|
|
5720
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, (_extends7 = {}, _extends7[_name] = _value, _extends7)));
|
|
5159
5721
|
updateError(_name, _isError, _errorMsg);
|
|
5160
5722
|
};
|
|
5161
|
-
var
|
|
5723
|
+
var _temp2 = function () {
|
|
5162
5724
|
if (_name === 'profile_pic') {
|
|
5163
|
-
var
|
|
5725
|
+
var _temp = function () {
|
|
5164
5726
|
if (_obj.isUpload) {
|
|
5165
5727
|
return Promise.resolve(uploadDocs(_value, _name)).then(function (docsData) {
|
|
5166
5728
|
_value = _value.map(function (_val) {
|
|
@@ -5191,28 +5753,28 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5191
5753
|
setProfilePicDelete([].concat(profilePicDelete, _deletedFiles));
|
|
5192
5754
|
}
|
|
5193
5755
|
}();
|
|
5194
|
-
if (
|
|
5756
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
5195
5757
|
}
|
|
5196
5758
|
}();
|
|
5197
|
-
return
|
|
5759
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
5198
5760
|
}
|
|
5199
5761
|
}();
|
|
5200
|
-
return Promise.resolve(
|
|
5762
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
|
5201
5763
|
} catch (e) {
|
|
5202
5764
|
return Promise.reject(e);
|
|
5203
5765
|
}
|
|
5204
5766
|
};
|
|
5205
5767
|
var onEmployeeInfoChange = function onEmployeeInfoChange(args) {
|
|
5206
|
-
var
|
|
5768
|
+
var _extends8;
|
|
5207
5769
|
var _name = args._name,
|
|
5208
5770
|
_value = args._value,
|
|
5209
5771
|
_isError = args._isError,
|
|
5210
5772
|
_errorMsg = args._errorMsg;
|
|
5211
|
-
setEmployeeInfoInput(_extends({}, employeeInfoInput, (
|
|
5773
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
|
|
5212
5774
|
updateError(_name, _isError, _errorMsg);
|
|
5213
5775
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5214
|
-
var
|
|
5215
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5776
|
+
var _extends9;
|
|
5777
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends9 = {}, _extends9[_name] = true, _extends9)));
|
|
5216
5778
|
}
|
|
5217
5779
|
};
|
|
5218
5780
|
var getUserTagTypeId = function getUserTagTypeId(name) {
|
|
@@ -5222,9 +5784,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5222
5784
|
return tag.id;
|
|
5223
5785
|
};
|
|
5224
5786
|
var onUserTagTypeChange = function onUserTagTypeChange(args) {
|
|
5225
|
-
var
|
|
5787
|
+
var _extends10;
|
|
5226
5788
|
var e = args._event;
|
|
5227
|
-
setUserTagType(_extends({}, userTagType, (
|
|
5789
|
+
setUserTagType(_extends({}, userTagType, (_extends10 = {}, _extends10[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends10)));
|
|
5228
5790
|
if (Object.hasOwnProperty.call(inputChangeLog, 'userTagType')) {
|
|
5229
5791
|
updateInputChangeLog(_extends({}, inputChangeLog, {
|
|
5230
5792
|
userTagType: true
|
|
@@ -5232,30 +5794,26 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5232
5794
|
}
|
|
5233
5795
|
};
|
|
5234
5796
|
var onCustomFieldsChange = function onCustomFieldsChange(_ref2) {
|
|
5235
|
-
var
|
|
5797
|
+
var _extends11;
|
|
5236
5798
|
var _name = _ref2._name,
|
|
5237
5799
|
_value = _ref2._value;
|
|
5238
|
-
setCustomFieldsInput(_extends({}, customFieldsInput, (
|
|
5800
|
+
setCustomFieldsInput(_extends({}, customFieldsInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
|
|
5239
5801
|
};
|
|
5240
5802
|
var onTravelApproversInputChange = function onTravelApproversInputChange(_ref3) {
|
|
5241
|
-
var
|
|
5803
|
+
var _extends12;
|
|
5242
5804
|
var _name = _ref3._name,
|
|
5243
5805
|
_value = _ref3._value;
|
|
5244
|
-
setTravelApproversInput(_extends({}, travelApproversInput, (
|
|
5806
|
+
setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
|
|
5245
5807
|
};
|
|
5246
5808
|
var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
|
|
5247
|
-
var
|
|
5809
|
+
var _extends13;
|
|
5248
5810
|
var _name = _ref4._name,
|
|
5249
5811
|
_value = _ref4._value;
|
|
5250
|
-
setExpenseApproversInput(_extends({}, expenseApproversInput, (
|
|
5812
|
+
setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
|
|
5251
5813
|
};
|
|
5252
5814
|
var onMemInfoInputChange = function onMemInfoInputChange(index, key, val) {
|
|
5253
5815
|
var _membershipInfoInput = [].concat(membershipInfoInput);
|
|
5254
|
-
|
|
5255
|
-
_membershipInfoInput[index][key] = val.label;
|
|
5256
|
-
} else {
|
|
5257
|
-
_membershipInfoInput[index][key] = val;
|
|
5258
|
-
}
|
|
5816
|
+
_membershipInfoInput[index][key] = val;
|
|
5259
5817
|
_membershipInfoInput[index].isEditMode = isEditMode;
|
|
5260
5818
|
setMembershipInfoInput(_membershipInfoInput);
|
|
5261
5819
|
};
|
|
@@ -5285,39 +5843,39 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5285
5843
|
setMembershipInfoInput(_membershipInfoInputTemp);
|
|
5286
5844
|
};
|
|
5287
5845
|
var travelPreferenceOnChange = function travelPreferenceOnChange(args) {
|
|
5288
|
-
var
|
|
5846
|
+
var _extends14;
|
|
5289
5847
|
var _name = args._name,
|
|
5290
5848
|
_value = args._value,
|
|
5291
5849
|
_isError = args._isError,
|
|
5292
5850
|
_errorMsg = args._errorMsg;
|
|
5293
|
-
settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (
|
|
5851
|
+
settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
|
|
5294
5852
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5295
|
-
var
|
|
5296
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5853
|
+
var _extends15;
|
|
5854
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
|
|
5297
5855
|
}
|
|
5298
5856
|
updateError(_name, _isError, _errorMsg);
|
|
5299
5857
|
};
|
|
5300
5858
|
var onSecureTraveelerInfoInputChange = function onSecureTraveelerInfoInputChange(args) {
|
|
5301
|
-
var
|
|
5859
|
+
var _extends16;
|
|
5302
5860
|
var _name = args._name,
|
|
5303
5861
|
_value = args._value,
|
|
5304
5862
|
_isError = args._isError,
|
|
5305
5863
|
_errorMsg = args._errorMsg;
|
|
5306
|
-
setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (
|
|
5864
|
+
setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
|
|
5307
5865
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5308
|
-
var
|
|
5309
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5866
|
+
var _extends17;
|
|
5867
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
|
|
5310
5868
|
}
|
|
5311
5869
|
updateError(_name, _isError, _errorMsg);
|
|
5312
5870
|
};
|
|
5313
5871
|
var onPassportInfoInputChange = function onPassportInfoInputChange(args) {
|
|
5314
5872
|
try {
|
|
5315
|
-
var
|
|
5316
|
-
var
|
|
5317
|
-
setPassportInfoInput(_extends({}, passportInfoInput, (
|
|
5873
|
+
var _temp8 = function _temp8() {
|
|
5874
|
+
var _extends18;
|
|
5875
|
+
setPassportInfoInput(_extends({}, passportInfoInput, (_extends18 = {}, _extends18[_name] = _value, _extends18)));
|
|
5318
5876
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5319
|
-
var
|
|
5320
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5877
|
+
var _extends19;
|
|
5878
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends19 = {}, _extends19[_name] = true, _extends19)));
|
|
5321
5879
|
}
|
|
5322
5880
|
updateError(_name, _isError, _errorMsg);
|
|
5323
5881
|
};
|
|
@@ -5355,9 +5913,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5355
5913
|
}
|
|
5356
5914
|
return Promise.resolve();
|
|
5357
5915
|
}
|
|
5358
|
-
var
|
|
5916
|
+
var _temp7 = function () {
|
|
5359
5917
|
if (_name === 'passport_photo' || _name === 'travel_docs') {
|
|
5360
|
-
var
|
|
5918
|
+
var _temp6 = function () {
|
|
5361
5919
|
if (_obj.isUpload) {
|
|
5362
5920
|
var checkAlreadyUploadedFiles = uploadedFiles.filter(function (_file) {
|
|
5363
5921
|
if (_name === 'passport_photo') {
|
|
@@ -5401,10 +5959,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5401
5959
|
setFilesForDelete([].concat(filesForDelete, _deletedFiles));
|
|
5402
5960
|
}
|
|
5403
5961
|
}();
|
|
5404
|
-
if (
|
|
5962
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
5405
5963
|
}
|
|
5406
5964
|
}();
|
|
5407
|
-
return Promise.resolve(
|
|
5965
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
|
5408
5966
|
} catch (e) {
|
|
5409
5967
|
return Promise.reject(e);
|
|
5410
5968
|
}
|
|
@@ -5423,8 +5981,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5423
5981
|
return _errorArray;
|
|
5424
5982
|
});
|
|
5425
5983
|
setErrorMsgs(function (prevState) {
|
|
5426
|
-
var
|
|
5427
|
-
return _extends({}, prevState, (
|
|
5984
|
+
var _extends20;
|
|
5985
|
+
return _extends({}, prevState, (_extends20 = {}, _extends20[_name] = _errorMsg, _extends20));
|
|
5428
5986
|
});
|
|
5429
5987
|
};
|
|
5430
5988
|
var dispatch = reactRedux.useDispatch();
|
|
@@ -5446,6 +6004,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5446
6004
|
}, [isTokenVerified]);
|
|
5447
6005
|
React.useEffect(function () {
|
|
5448
6006
|
if (isRendered === true) {
|
|
6007
|
+
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6008
|
+
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6009
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6010
|
+
}
|
|
6011
|
+
});
|
|
5449
6012
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5450
6013
|
country_code: countryCode
|
|
5451
6014
|
}));
|
|
@@ -5456,6 +6019,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5456
6019
|
}
|
|
5457
6020
|
}));
|
|
5458
6021
|
dispatch(fetchCountryCodes()).then(function (_res) {
|
|
6022
|
+
setCountryContactCode(_res);
|
|
5459
6023
|
if (isEditMode) {
|
|
5460
6024
|
if (!isProfile && !editUserId) return false;
|
|
5461
6025
|
dispatch(setStaticFieldsVisibility({
|
|
@@ -5498,6 +6062,20 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5498
6062
|
value: '',
|
|
5499
6063
|
label: 'Select employee level'
|
|
5500
6064
|
},
|
|
6065
|
+
manager_id: res.employee_info.manager ? {
|
|
6066
|
+
value: res.employee_info.manager,
|
|
6067
|
+
label: res.employee_info.manager
|
|
6068
|
+
} : {
|
|
6069
|
+
value: '',
|
|
6070
|
+
label: 'Select Manager'
|
|
6071
|
+
},
|
|
6072
|
+
skip_manager_id: res.employee_info.skip_manager ? {
|
|
6073
|
+
value: res.employee_info.skip_manager,
|
|
6074
|
+
label: res.employee_info.skip_manager
|
|
6075
|
+
} : {
|
|
6076
|
+
value: '',
|
|
6077
|
+
label: 'Select Manager'
|
|
6078
|
+
},
|
|
5501
6079
|
employee_id: res.employee_info.employee_id || '',
|
|
5502
6080
|
entity: res.employee_info.entity ? {
|
|
5503
6081
|
value: res.employee_info.entity.id,
|
|
@@ -5552,7 +6130,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5552
6130
|
var products = res.user_product.split('+');
|
|
5553
6131
|
setProductAccess({
|
|
5554
6132
|
travel: products.includes('travel'),
|
|
5555
|
-
expense: products.includes('expense')
|
|
6133
|
+
expense: products.includes('expense'),
|
|
6134
|
+
card: products.includes('card')
|
|
5556
6135
|
});
|
|
5557
6136
|
if (products.includes('travel')) {
|
|
5558
6137
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5683,7 +6262,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5683
6262
|
required: true
|
|
5684
6263
|
}
|
|
5685
6264
|
}));
|
|
5686
|
-
|
|
5687
6265
|
var _productAccess = _extends({}, productAccess);
|
|
5688
6266
|
renderFields.products.forEach(function (product) {
|
|
5689
6267
|
_productAccess[product.name] = true;
|
|
@@ -5731,7 +6309,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5731
6309
|
}, [renderFields.expenseApprovers]);
|
|
5732
6310
|
var uploadDocs = function uploadDocs(docToUpload, type) {
|
|
5733
6311
|
try {
|
|
5734
|
-
var
|
|
6312
|
+
var _temp10 = function _temp10() {
|
|
5735
6313
|
setUploadedFiles([].concat(uploadedFiles, data));
|
|
5736
6314
|
dispatch(stopLoader());
|
|
5737
6315
|
return data;
|
|
@@ -5747,12 +6325,12 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5747
6325
|
userID: editUserId
|
|
5748
6326
|
});
|
|
5749
6327
|
});
|
|
5750
|
-
var
|
|
6328
|
+
var _temp9 = _forTo(docs, function (i) {
|
|
5751
6329
|
return Promise.resolve(dispatch(uploadSingleDocumnet(docs[i]))).then(function (res) {
|
|
5752
6330
|
data.push(res);
|
|
5753
6331
|
});
|
|
5754
6332
|
});
|
|
5755
|
-
return Promise.resolve(
|
|
6333
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9));
|
|
5756
6334
|
} catch (e) {
|
|
5757
6335
|
return Promise.reject(e);
|
|
5758
6336
|
}
|
|
@@ -5764,6 +6342,15 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5764
6342
|
IUIToastMessageService$4.warningNotify(checkAnyError);
|
|
5765
6343
|
return Promise.resolve();
|
|
5766
6344
|
}
|
|
6345
|
+
if (employeeInfoInput.manager_id.value !== '') {
|
|
6346
|
+
employeeInfoInput.manager_id = employeeInfoInput.manager.value;
|
|
6347
|
+
}
|
|
6348
|
+
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
6349
|
+
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
6350
|
+
}
|
|
6351
|
+
var cardsPayload = {
|
|
6352
|
+
"roles": [cardsRole]
|
|
6353
|
+
};
|
|
5767
6354
|
var payload = {
|
|
5768
6355
|
personalInfoInput: personalInfoInput,
|
|
5769
6356
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5782,7 +6369,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5782
6369
|
uploadedFiles: uploadedFiles,
|
|
5783
6370
|
filesForDelete: filesForDelete,
|
|
5784
6371
|
profilePicDelete: profilePicDelete,
|
|
5785
|
-
userTagType: userTagType
|
|
6372
|
+
userTagType: userTagType,
|
|
6373
|
+
cardsRole: cardsRole,
|
|
6374
|
+
isCardsAdmin: isCardsAdmin
|
|
5786
6375
|
};
|
|
5787
6376
|
if (verifyUserId) {
|
|
5788
6377
|
payload.verifyUserId = verifyUserId;
|
|
@@ -5880,8 +6469,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5880
6469
|
}
|
|
5881
6470
|
_errorMsgs.passport_issue_date = '';
|
|
5882
6471
|
}
|
|
5883
|
-
if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false &&
|
|
5884
|
-
fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
6472
|
+
if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
5885
6473
|
_isError = true;
|
|
5886
6474
|
if (_errorArray.indexOf('passport_photo') === -1) {
|
|
5887
6475
|
_errorArray.push('passport_photo');
|
|
@@ -5893,8 +6481,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5893
6481
|
}
|
|
5894
6482
|
_errorMsgs.passport_photo = '';
|
|
5895
6483
|
}
|
|
5896
|
-
if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false &&
|
|
5897
|
-
fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
6484
|
+
if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
5898
6485
|
_isError = true;
|
|
5899
6486
|
if (_errorArray.indexOf('travel_docs') === -1) {
|
|
5900
6487
|
_errorArray.push('travel_docs');
|
|
@@ -5910,133 +6497,130 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5910
6497
|
if (_isError) {
|
|
5911
6498
|
setErrorArray(_errorArray);
|
|
5912
6499
|
setErrorMsgs(_errorMsgs);
|
|
5913
|
-
|
|
6500
|
+
var _loop3 = function _loop3() {
|
|
5914
6501
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
5915
6502
|
if (_errorMsgs[_key3]) {
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
}
|
|
5930
|
-
}();
|
|
5931
|
-
if (_ret === "break") break;
|
|
6503
|
+
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
6504
|
+
setAdditionalInfoFlag('open');
|
|
6505
|
+
}
|
|
6506
|
+
var el = document.getElementById(_key3 === 'country_code' || _key3 === 'contact_country_code' ? 'contact_number' : _key3);
|
|
6507
|
+
if (el) {
|
|
6508
|
+
setTimeout(function () {
|
|
6509
|
+
el.scrollIntoView({
|
|
6510
|
+
behavior: 'smooth',
|
|
6511
|
+
block: 'center'
|
|
6512
|
+
});
|
|
6513
|
+
}, 500);
|
|
6514
|
+
return 1;
|
|
6515
|
+
}
|
|
5932
6516
|
}
|
|
5933
6517
|
}
|
|
6518
|
+
};
|
|
6519
|
+
for (var _key3 in _errorMsgs) {
|
|
6520
|
+
if (_loop3()) break;
|
|
5934
6521
|
}
|
|
5935
|
-
return Promise.resolve();
|
|
5936
6522
|
}
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
err.contact_number = err.contact_country_code;
|
|
5954
|
-
}
|
|
5955
|
-
if (err.passport) {
|
|
5956
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5957
|
-
delete err.passport;
|
|
5958
|
-
}
|
|
5959
|
-
setErrorArray(Object.keys(err));
|
|
5960
|
-
setErrorMsgs(err);
|
|
5961
|
-
for (var _key4 in err) {
|
|
5962
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
5963
|
-
if (err[_key4]) {
|
|
5964
|
-
var _ret2 = function () {
|
|
5965
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
5966
|
-
setAdditionalInfoFlag('open');
|
|
5967
|
-
}
|
|
5968
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
5969
|
-
if (el) {
|
|
5970
|
-
setTimeout(function () {
|
|
5971
|
-
el.scrollIntoView({
|
|
5972
|
-
behavior: 'smooth',
|
|
5973
|
-
block: 'center'
|
|
5974
|
-
});
|
|
5975
|
-
}, 500);
|
|
5976
|
-
return "break";
|
|
5977
|
-
}
|
|
5978
|
-
}();
|
|
5979
|
-
if (_ret2 === "break") break;
|
|
5980
|
-
}
|
|
6523
|
+
var cardApiflag = false;
|
|
6524
|
+
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6525
|
+
cardApiflag = false;
|
|
6526
|
+
} else {
|
|
6527
|
+
cardApiflag = true;
|
|
6528
|
+
}
|
|
6529
|
+
if (!_isError) {
|
|
6530
|
+
if (isEditMode && editUserId || isProfile) {
|
|
6531
|
+
dispatch(showLoader());
|
|
6532
|
+
if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6533
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6534
|
+
method: 'POST',
|
|
6535
|
+
body: JSON.stringify(cardsPayload),
|
|
6536
|
+
headers: {
|
|
6537
|
+
'Content-Type': 'application/json',
|
|
6538
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5981
6539
|
}
|
|
5982
|
-
}
|
|
5983
|
-
|
|
5984
|
-
|
|
6540
|
+
}).then(function (response) {
|
|
6541
|
+
if (response.status === 200) {
|
|
6542
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6543
|
+
} else {
|
|
6544
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6545
|
+
}
|
|
6546
|
+
})["catch"](function (error) {
|
|
6547
|
+
console.log("errorrr", error);
|
|
6548
|
+
})["finally"](function () {
|
|
6549
|
+
dispatch(stopLoader());
|
|
6550
|
+
});
|
|
5985
6551
|
} else {
|
|
5986
|
-
|
|
6552
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
5987
6553
|
}
|
|
5988
|
-
}
|
|
5989
|
-
dispatch(
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
if (
|
|
6012
|
-
if (err
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6554
|
+
} else {
|
|
6555
|
+
dispatch(showLoader());
|
|
6556
|
+
if (cardApiflag === true) {
|
|
6557
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6558
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6559
|
+
if (res !== null && res !== void 0 && res.user_id) {
|
|
6560
|
+
fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
|
|
6561
|
+
method: 'POST',
|
|
6562
|
+
body: JSON.stringify(cardsPayload),
|
|
6563
|
+
headers: {
|
|
6564
|
+
'Content-Type': 'application/json',
|
|
6565
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6566
|
+
}
|
|
6567
|
+
}).then(function (response) {
|
|
6568
|
+
if (response.status !== 200) {
|
|
6569
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6570
|
+
}
|
|
6571
|
+
})["catch"](function (error) {
|
|
6572
|
+
console.log("errorrr", error);
|
|
6573
|
+
});
|
|
6574
|
+
}
|
|
6575
|
+
(config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
|
|
6576
|
+
})["catch"](function (err) {
|
|
6577
|
+
if (typeof err === 'object') {
|
|
6578
|
+
if (err.country_code) {
|
|
6579
|
+
err.contact_number = err.country_code;
|
|
6580
|
+
}
|
|
6581
|
+
if (err.contact_country_code) {
|
|
6582
|
+
err.contact_number = err.contact_country_code;
|
|
6583
|
+
}
|
|
6584
|
+
if (err.passport) {
|
|
6585
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6586
|
+
delete err.passport;
|
|
6587
|
+
}
|
|
6588
|
+
setErrorArray(Object.keys(err));
|
|
6589
|
+
setErrorMsgs(err);
|
|
6590
|
+
var _loop4 = function _loop4() {
|
|
6591
|
+
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6592
|
+
if (err[_key4]) {
|
|
6593
|
+
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6594
|
+
setAdditionalInfoFlag('open');
|
|
6595
|
+
}
|
|
6596
|
+
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6597
|
+
if (el) {
|
|
6598
|
+
setTimeout(function () {
|
|
6599
|
+
el.scrollIntoView({
|
|
6600
|
+
behavior: 'smooth',
|
|
6601
|
+
block: 'center'
|
|
6602
|
+
});
|
|
6603
|
+
}, 500);
|
|
6604
|
+
return 1;
|
|
6605
|
+
}
|
|
6026
6606
|
}
|
|
6027
|
-
}
|
|
6028
|
-
|
|
6607
|
+
}
|
|
6608
|
+
};
|
|
6609
|
+
for (var _key4 in err) {
|
|
6610
|
+
if (_loop4()) break;
|
|
6029
6611
|
}
|
|
6612
|
+
} else if (typeof err === 'string') {
|
|
6613
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6614
|
+
} else {
|
|
6615
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6030
6616
|
}
|
|
6031
|
-
}
|
|
6032
|
-
|
|
6033
|
-
|
|
6617
|
+
})["finally"](function () {
|
|
6618
|
+
dispatch(stopLoader());
|
|
6619
|
+
});
|
|
6034
6620
|
} else {
|
|
6035
|
-
|
|
6621
|
+
createUserApiCall(payload);
|
|
6036
6622
|
}
|
|
6037
|
-
}
|
|
6038
|
-
dispatch(stopLoader());
|
|
6039
|
-
});
|
|
6623
|
+
}
|
|
6040
6624
|
}
|
|
6041
6625
|
return Promise.resolve();
|
|
6042
6626
|
} catch (e) {
|
|
@@ -6052,10 +6636,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6052
6636
|
window.location.href = config.routes.profile.redirectUrl.cancel;
|
|
6053
6637
|
}
|
|
6054
6638
|
}
|
|
6055
|
-
}
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
(config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
|
|
6639
|
+
} else {
|
|
6640
|
+
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6641
|
+
(config === null || config === void 0 ? void 0 : (_config$routes5 = config.routes) === null || _config$routes5 === void 0 ? void 0 : (_config$routes5$users = _config$routes5.users) === null || _config$routes5$users === void 0 ? void 0 : (_config$routes5$users2 = _config$routes5$users.list) === null || _config$routes5$users2 === void 0 ? void 0 : _config$routes5$users2.path) && history.push(config.routes.users.list.path);
|
|
6059
6642
|
}
|
|
6060
6643
|
};
|
|
6061
6644
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6075,18 +6658,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6075
6658
|
if (verifyUserId) {
|
|
6076
6659
|
dispatch(showLoader());
|
|
6077
6660
|
dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
|
|
6661
|
+
setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
|
|
6078
6662
|
setPersonalInfoInput(function (prevState) {
|
|
6079
6663
|
return _extends({}, prevState, {
|
|
6080
|
-
first_name: res.
|
|
6081
|
-
last_name: res.
|
|
6664
|
+
first_name: res.first_name,
|
|
6665
|
+
last_name: res.last_name,
|
|
6082
6666
|
email: res.email,
|
|
6083
|
-
contact_number: res.
|
|
6084
|
-
dob: function () {
|
|
6085
|
-
var dt = new Date(res.dob);
|
|
6086
|
-
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
6087
|
-
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
6088
|
-
}(),
|
|
6089
|
-
|
|
6667
|
+
contact_number: res === null || res === void 0 ? void 0 : res.contact_number,
|
|
6090
6668
|
gender: function () {
|
|
6091
6669
|
if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
|
|
6092
6670
|
}()
|
|
@@ -6131,7 +6709,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6131
6709
|
}()
|
|
6132
6710
|
});
|
|
6133
6711
|
});
|
|
6134
|
-
|
|
6135
6712
|
if (res.client_admin) {
|
|
6136
6713
|
setTravelApproversInput(function (prevState) {
|
|
6137
6714
|
var nextState = _extends({}, prevState);
|
|
@@ -6165,7 +6742,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6165
6742
|
});
|
|
6166
6743
|
}
|
|
6167
6744
|
};
|
|
6168
|
-
|
|
6169
6745
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6170
6746
|
component: "div",
|
|
6171
6747
|
className: styles.UUIUserManagementAddEdit
|
|
@@ -6182,8 +6758,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6182
6758
|
className: styles.breadcrumb
|
|
6183
6759
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBreadCrumb, {
|
|
6184
6760
|
breadCrumbs: [{
|
|
6185
|
-
href:
|
|
6186
|
-
config.routes.users.list.path,
|
|
6761
|
+
href: config.routes.users.list.path,
|
|
6187
6762
|
label: 'Users',
|
|
6188
6763
|
hasLink: true
|
|
6189
6764
|
}]
|
|
@@ -6252,6 +6827,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6252
6827
|
if (!p.visibility) {
|
|
6253
6828
|
return null;
|
|
6254
6829
|
}
|
|
6830
|
+
if (p.name === 'profile_pic' && config.env.isExpenseProduct) {
|
|
6831
|
+
return null;
|
|
6832
|
+
}
|
|
6255
6833
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6256
6834
|
item: true,
|
|
6257
6835
|
sm: 12,
|
|
@@ -6373,6 +6951,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6373
6951
|
className: styles.productContainerGap
|
|
6374
6952
|
}, renderFields.products.map(function (p, i) {
|
|
6375
6953
|
p.readOnly = isProfile;
|
|
6954
|
+
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6955
|
+
p.readOnly = true;
|
|
6956
|
+
p.disableText = "Only card admin can change this access.";
|
|
6957
|
+
} else if (p.id === 3 && editUserId === (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6958
|
+
p.readOnly = true;
|
|
6959
|
+
p.disableText = "You cannot update your own Card product";
|
|
6960
|
+
}
|
|
6376
6961
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6377
6962
|
item: true,
|
|
6378
6963
|
sm: 12,
|
|
@@ -6465,6 +7050,21 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6465
7050
|
isProfile: isProfile,
|
|
6466
7051
|
editUserId: editUserId,
|
|
6467
7052
|
roles: renderFields.expenseRoles
|
|
7053
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
7054
|
+
className: styles.dividerColor
|
|
7055
|
+
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React__default.createElement(CardsField, {
|
|
7056
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7057
|
+
type: "card",
|
|
7058
|
+
isProfile: isProfile,
|
|
7059
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7060
|
+
var _value = _ref7._value;
|
|
7061
|
+
return setCardsRole(_value);
|
|
7062
|
+
},
|
|
7063
|
+
roleValue: cardsRole,
|
|
7064
|
+
roles: cardsDetails.cardsRoles,
|
|
7065
|
+
cardsAdmin: isCardsAdmin,
|
|
7066
|
+
editUserId: editUserId,
|
|
7067
|
+
loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
|
|
6468
7068
|
}))) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
6469
7069
|
config: config,
|
|
6470
7070
|
errMsg: hasVerificationError
|
|
@@ -6630,17 +7230,13 @@ var uploadBulkUsersFile = function uploadBulkUsersFile(payload) {
|
|
|
6630
7230
|
});
|
|
6631
7231
|
};
|
|
6632
7232
|
};
|
|
6633
|
-
|
|
6634
7233
|
var uploadFileToS3$1 = function uploadFileToS3(presignedPostData, file) {
|
|
6635
7234
|
return new Promise(function (resolve, reject) {
|
|
6636
7235
|
var formData = new FormData();
|
|
6637
|
-
|
|
6638
7236
|
Object.keys(presignedPostData.fields).forEach(function (key) {
|
|
6639
7237
|
formData.append(key, presignedPostData.fields[key]);
|
|
6640
7238
|
});
|
|
6641
|
-
|
|
6642
7239
|
formData.append('file', file);
|
|
6643
|
-
|
|
6644
7240
|
axios.post(presignedPostData.url, formData, {
|
|
6645
7241
|
headers: {
|
|
6646
7242
|
'Content-Type': 'multipart/form-data'
|
|
@@ -6757,7 +7353,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
|
|
|
6757
7353
|
};
|
|
6758
7354
|
};
|
|
6759
7355
|
|
|
6760
|
-
var styles$5 = {"UUIUserManagementList":"_3WNHx","pageHeader":"_1WLpc","buttonWrapper":"_2egTG","headingWrapper":"_1He01","headingSignUpWrapper":"_Q8vqd","heading":"_1uPaO","headingLarge":"_2FsLd","headingMedium":"_nGXA9","headingSmall":"_2rpwF","description":"_25vb9","headerText":"_1Ny9J","letterImage":"_2hr3R","tablewrapper":"_1-RPw","rowText":"_1LXyO","textTransform":"_3kFQS","lightColor":"_3Ghgw","avatarClassName":"_2qO_X","tooltipText":"_151u_","tooltip":"_-LQNH","importModalBodyContainer":"_25xUk","dividerColor":"_2HZv9","w100":"_3vGmU","downloadTemplateContainer":"_3-Xu_","downloadTemplateDescContainer":"_tLw43","labelContainer":"_7TYUZ","downlTempHeader":"__CZpe","downlTempDescription":"_19jEe","downloadTemplateButton":"_1qXtq","fileUploaderContainer":"_1YVz2","colGap":"_3vnY5","deActivateModalContainer":"_28H9H","backdrop":"_1ky1x","errorText":"_26_if","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn"};
|
|
7356
|
+
var styles$5 = {"UUIUserManagementList":"_3WNHx","scrollOverlayMenu":"_2_WEg","overlaysearch":"_1Pbhb","pageHeader":"_1WLpc","buttonWrapper":"_2egTG","headingWrapper":"_1He01","headingSignUpWrapper":"_Q8vqd","heading":"_1uPaO","headingLarge":"_2FsLd","headingMedium":"_nGXA9","headingSmall":"_2rpwF","description":"_25vb9","headerText":"_1Ny9J","letterImage":"_2hr3R","tablewrapper":"_1-RPw","rowText":"_1LXyO","textTransform":"_3kFQS","lightColor":"_3Ghgw","avatarClassName":"_2qO_X","tooltipText":"_151u_","tooltipTextDiv":"_1l4V-","tooltip":"_-LQNH","importModalBodyContainer":"_25xUk","dividerColor":"_2HZv9","w100":"_3vGmU","downloadTemplateContainer":"_3-Xu_","downloadTemplateDescContainer":"_tLw43","labelContainer":"_7TYUZ","downlTempHeader":"__CZpe","downlTempDescription":"_19jEe","downloadTemplateButton":"_1qXtq","fileUploaderContainer":"_1YVz2","colGap":"_3vnY5","deActivateModalContainer":"_28H9H","backdrop":"_1ky1x","errorText":"_26_if","deactivateAlert":"_3hvWz","warningSvg":"_2H6Bq","departmentHeadText":"_3pOsV","deactivateBtn":"_2v6e4","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn","deactivateSubmitBtn":"_1qxY-","deactivateCustomButtonClass":"_2YBWE"};
|
|
6761
7357
|
|
|
6762
7358
|
var BulkUploadModal = function BulkUploadModal(props) {
|
|
6763
7359
|
var isOpenImportUsersModal = props.isOpenImportUsersModal,
|
|
@@ -6826,7 +7422,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
|
|
|
6826
7422
|
file: doc
|
|
6827
7423
|
});
|
|
6828
7424
|
});
|
|
6829
|
-
var
|
|
7425
|
+
var _temp = _forTo(docs, function (i) {
|
|
6830
7426
|
return Promise.resolve(dispatch(uploadBulkUsersFile(docs[i]))).then(function (res) {
|
|
6831
7427
|
return Promise.resolve(dispatch(validateUploadedFile(res.user_file_name)).then(function (validatedRes) {
|
|
6832
7428
|
if (validatedRes.data.status) {
|
|
@@ -6866,7 +7462,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
|
|
|
6866
7462
|
})).then(function () {});
|
|
6867
7463
|
});
|
|
6868
7464
|
});
|
|
6869
|
-
return Promise.resolve(
|
|
7465
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
6870
7466
|
} catch (e) {
|
|
6871
7467
|
return Promise.reject(e);
|
|
6872
7468
|
}
|
|
@@ -7041,7 +7637,6 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
|
|
|
7041
7637
|
setOpenImportUsersModal(false);
|
|
7042
7638
|
handleImportPagenavigation(jobId);
|
|
7043
7639
|
};
|
|
7044
|
-
|
|
7045
7640
|
var handleDownloadRecords = function handleDownloadRecords(type) {
|
|
7046
7641
|
try {
|
|
7047
7642
|
setDownlStatus(true);
|
|
@@ -8067,7 +8662,6 @@ var DropdownBtn = function DropdownBtn(props) {
|
|
|
8067
8662
|
if (val.disable) return false;
|
|
8068
8663
|
if (val.handler && typeof val.handler === 'function') val.handler();
|
|
8069
8664
|
};
|
|
8070
|
-
|
|
8071
8665
|
var prevOpen = React__default.useRef(open);
|
|
8072
8666
|
React__default.useEffect(function () {
|
|
8073
8667
|
if (prevOpen.current === true && open === false) {
|
|
@@ -8182,6 +8776,10 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8182
8776
|
selected = props.selected,
|
|
8183
8777
|
_props$handleSingleCh = props.handleSingleCheckBoxClick,
|
|
8184
8778
|
handleSingleCheckBoxClick = _props$handleSingleCh === void 0 ? function () {} : _props$handleSingleCh,
|
|
8779
|
+
_props$onResetPasswor = props.onResetPasswordHandler,
|
|
8780
|
+
onResetPasswordHandler = _props$onResetPasswor === void 0 ? function () {} : _props$onResetPasswor,
|
|
8781
|
+
_props$toggleInviteMo = props.toggleInviteModal,
|
|
8782
|
+
toggleInviteModal = _props$toggleInviteMo === void 0 ? function () {} : _props$toggleInviteMo,
|
|
8185
8783
|
orderBy = props.orderBy,
|
|
8186
8784
|
order = props.order,
|
|
8187
8785
|
_props$onRequestSort = props.onRequestSort,
|
|
@@ -8199,6 +8797,21 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8199
8797
|
searchValue = props.searchValue,
|
|
8200
8798
|
_props$isILadmin = props.isILadmin,
|
|
8201
8799
|
isILadmin = _props$isILadmin === void 0 ? false : _props$isILadmin;
|
|
8800
|
+
var useStyles = styles$8.makeStyles(function (theme) {
|
|
8801
|
+
return {
|
|
8802
|
+
tooltip: {
|
|
8803
|
+
background: '#1F2937',
|
|
8804
|
+
fontSize: '14px',
|
|
8805
|
+
color: '#ffffff',
|
|
8806
|
+
padding: '12px 16px',
|
|
8807
|
+
borderRadius: '6px'
|
|
8808
|
+
},
|
|
8809
|
+
arrow: {
|
|
8810
|
+
color: '#1F2937'
|
|
8811
|
+
}
|
|
8812
|
+
};
|
|
8813
|
+
});
|
|
8814
|
+
var classes = useStyles();
|
|
8202
8815
|
var columns = [{
|
|
8203
8816
|
id: 'first_name',
|
|
8204
8817
|
label: 'Name',
|
|
@@ -8218,6 +8831,27 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8218
8831
|
profilePath: row === null || row === void 0 ? void 0 : (_row$profile_pic = row.profile_pic) === null || _row$profile_pic === void 0 ? void 0 : _row$profile_pic.presigned_url
|
|
8219
8832
|
}));
|
|
8220
8833
|
}
|
|
8834
|
+
}, {
|
|
8835
|
+
id: 'first_name',
|
|
8836
|
+
label: '',
|
|
8837
|
+
minWidth: 60,
|
|
8838
|
+
sortable: false,
|
|
8839
|
+
cell: function cell(row) {
|
|
8840
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8841
|
+
component: "div",
|
|
8842
|
+
width: 80
|
|
8843
|
+
}, row && row.has_visited === 0 ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
8844
|
+
title: "This user hasn't logged in to the platform yet",
|
|
8845
|
+
arrow: true,
|
|
8846
|
+
classes: {
|
|
8847
|
+
arrow: classes.arrow,
|
|
8848
|
+
tooltip: classes.tooltip
|
|
8849
|
+
},
|
|
8850
|
+
placement: "top-start"
|
|
8851
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
8852
|
+
className: clsx(styles$5.tooltipTextDiv)
|
|
8853
|
+
}, "Invited")) : null);
|
|
8854
|
+
}
|
|
8221
8855
|
}, {
|
|
8222
8856
|
id: 'emp_info__department__name',
|
|
8223
8857
|
label: 'Department',
|
|
@@ -8239,7 +8873,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8239
8873
|
cell: function cell(row) {
|
|
8240
8874
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8241
8875
|
component: "div"
|
|
8242
|
-
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8876
|
+
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !row.products[0].role.toLowerCase().includes("holder") ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8243
8877
|
component: "div",
|
|
8244
8878
|
display: "flex"
|
|
8245
8879
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8252,7 +8886,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8252
8886
|
style: {
|
|
8253
8887
|
whiteSpace: 'nowrap'
|
|
8254
8888
|
}
|
|
8255
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8889
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && !row.products[1].role.toLowerCase().includes("holder") && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8256
8890
|
component: "div",
|
|
8257
8891
|
display: "flex"
|
|
8258
8892
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8265,7 +8899,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8265
8899
|
style: {
|
|
8266
8900
|
whiteSpace: 'nowrap'
|
|
8267
8901
|
}
|
|
8268
|
-
}, "\xA0" + row.products[1].role)))
|
|
8902
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && !row.products[2].role.toLowerCase().includes("holder") && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8903
|
+
component: "div",
|
|
8904
|
+
display: "flex"
|
|
8905
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8906
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8907
|
+
style: {
|
|
8908
|
+
whiteSpace: 'nowrap'
|
|
8909
|
+
}
|
|
8910
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8911
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8912
|
+
style: {
|
|
8913
|
+
whiteSpace: 'nowrap'
|
|
8914
|
+
}
|
|
8915
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8269
8916
|
}
|
|
8270
8917
|
}, {
|
|
8271
8918
|
id: 'status',
|
|
@@ -8305,6 +8952,21 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8305
8952
|
return onEditHandler(row.id);
|
|
8306
8953
|
}
|
|
8307
8954
|
}];
|
|
8955
|
+
if (row && row.has_visited && row.is_active) {
|
|
8956
|
+
options.push({
|
|
8957
|
+
label: 'Reset password',
|
|
8958
|
+
handler: function handler() {
|
|
8959
|
+
return onResetPasswordHandler(row.email);
|
|
8960
|
+
}
|
|
8961
|
+
});
|
|
8962
|
+
} else if (row && row.is_active) {
|
|
8963
|
+
options.push({
|
|
8964
|
+
label: 'Resend invite',
|
|
8965
|
+
handler: function handler() {
|
|
8966
|
+
return toggleInviteModal(row.id, 'single', row.first_name, row.last_name);
|
|
8967
|
+
}
|
|
8968
|
+
});
|
|
8969
|
+
}
|
|
8308
8970
|
if (isILadmin) {
|
|
8309
8971
|
options.push({
|
|
8310
8972
|
label: 'Make primary admin',
|
|
@@ -8328,6 +8990,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8328
8990
|
endIcon: null,
|
|
8329
8991
|
outlinedBtn: false,
|
|
8330
8992
|
className: "threedotMenuBtn",
|
|
8993
|
+
MoreHorizIcon: true,
|
|
8331
8994
|
placement: "bottom-end"
|
|
8332
8995
|
}));
|
|
8333
8996
|
},
|
|
@@ -8335,7 +8998,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8335
8998
|
paddingLeft: '40px'
|
|
8336
8999
|
}
|
|
8337
9000
|
}];
|
|
8338
|
-
|
|
8339
9001
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUITable, {
|
|
8340
9002
|
searchPlaceholder: "Search by name, email & department",
|
|
8341
9003
|
isCheckboxTable: true,
|
|
@@ -8358,7 +9020,8 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8358
9020
|
isDataFetching: isDataFetching,
|
|
8359
9021
|
disableRowCheckbox: disableRowCheckbox,
|
|
8360
9022
|
searchBoxWidth: "400px",
|
|
8361
|
-
searchValue: searchValue
|
|
9023
|
+
searchValue: searchValue,
|
|
9024
|
+
hideTopPagination: false
|
|
8362
9025
|
});
|
|
8363
9026
|
};
|
|
8364
9027
|
var SingupRequests = function SingupRequests(props) {
|
|
@@ -8389,20 +9052,18 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8389
9052
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
8390
9053
|
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
8391
9054
|
};
|
|
8392
|
-
|
|
8393
9055
|
var columns = [{
|
|
8394
|
-
id: '
|
|
9056
|
+
id: 'first_name',
|
|
8395
9057
|
label: 'Name',
|
|
8396
9058
|
minWidth: 250,
|
|
8397
9059
|
sortable: true,
|
|
8398
9060
|
cell: function cell(row) {
|
|
8399
9061
|
var _row$profile_pic2;
|
|
8400
9062
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
|
|
8401
|
-
firstName: row.
|
|
8402
|
-
lastName: row.
|
|
8403
|
-
isLetterAvatar:
|
|
8404
|
-
row.
|
|
8405
|
-
primaryText: row.fname + ' ' + row.lname,
|
|
9063
|
+
firstName: row.first_name,
|
|
9064
|
+
lastName: row.last_name,
|
|
9065
|
+
isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
|
|
9066
|
+
primaryText: row.first_name + ' ' + row.last_name,
|
|
8406
9067
|
secondaryText: row.email,
|
|
8407
9068
|
letterAvatarTextColor: "black",
|
|
8408
9069
|
letterAvatarBackgroundColor: "#d3d3d3",
|
|
@@ -8411,7 +9072,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8411
9072
|
}));
|
|
8412
9073
|
}
|
|
8413
9074
|
}, {
|
|
8414
|
-
id: '
|
|
9075
|
+
id: 'created_at',
|
|
8415
9076
|
label: 'Requested on',
|
|
8416
9077
|
minWidth: 100,
|
|
8417
9078
|
sortable: true,
|
|
@@ -8421,7 +9082,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8421
9082
|
width: 100
|
|
8422
9083
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8423
9084
|
className: clsx(styles$5.rowText, styles$5.textTransform)
|
|
8424
|
-
}, formatDate(row.
|
|
9085
|
+
}, formatDate(row.created_at)));
|
|
8425
9086
|
}
|
|
8426
9087
|
}, {
|
|
8427
9088
|
id: 'actions',
|
|
@@ -8475,11 +9136,89 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8475
9136
|
});
|
|
8476
9137
|
};
|
|
8477
9138
|
|
|
9139
|
+
function InfoYellowIcon(props) {
|
|
9140
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
9141
|
+
width: props.width,
|
|
9142
|
+
height: props.height,
|
|
9143
|
+
viewBox: "0 0 20 20",
|
|
9144
|
+
fill: "none",
|
|
9145
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9146
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9147
|
+
d: "M11 4.99951C11 5.5518 10.5523 5.99951 10 5.99951C9.44771 5.99951 9 5.5518 9 4.99951C9 4.44723 9.44771 3.99951 10 3.99951C10.5523 3.99951 11 4.44723 11 4.99951Z",
|
|
9148
|
+
fill: "#CA8A04"
|
|
9149
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9150
|
+
d: "M8 7.99951C7.44772 7.99951 7 8.44723 7 8.99951C7 9.5518 7.44772 9.99951 8 9.99951H9V12.9995H8C7.44772 12.9995 7 13.4472 7 13.9995C7 14.5518 7.44772 14.9995 8 14.9995H12C12.5523 14.9995 13 14.5518 13 13.9995C13 13.4472 12.5523 12.9995 12 12.9995H11V8.99951C11 8.44723 10.5523 7.99951 10 7.99951H8Z",
|
|
9151
|
+
fill: "#CA8A04"
|
|
9152
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9153
|
+
d: "M0 9.99951C0 15.5224 4.47715 19.9995 10 19.9995C15.5228 19.9995 20 15.5224 20 9.99951C20 4.47666 15.5228 -0.000488281 10 -0.000488281C4.47715 -0.000488281 0 4.47666 0 9.99951ZM10 1.99951C14.4183 1.99951 18 5.58123 18 9.99951C18 14.4178 14.4183 17.9995 10 17.9995C5.58172 17.9995 2 14.4178 2 9.99951C2 5.58123 5.58172 1.99951 10 1.99951Z",
|
|
9154
|
+
fill: "#CA8A04"
|
|
9155
|
+
}));
|
|
9156
|
+
}
|
|
9157
|
+
|
|
9158
|
+
function RedWarningIcon(props) {
|
|
9159
|
+
var _props$color = props.color,
|
|
9160
|
+
color = _props$color === void 0 ? '#E11D48' : _props$color,
|
|
9161
|
+
_props$size = props.size,
|
|
9162
|
+
size = _props$size === void 0 ? '14' : _props$size;
|
|
9163
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
9164
|
+
width: size,
|
|
9165
|
+
height: size,
|
|
9166
|
+
viewBox: "0 0 14 14",
|
|
9167
|
+
fill: color,
|
|
9168
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9169
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9170
|
+
d: "M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14ZM6 4C6 3.44772 6.44772 3 7 3C7.55229 3 8 3.44772 8 4V6C8 6.55229 7.55229 7 7 7C6.44772 7 6 6.55229 6 6V4ZM6 10C6 9.44771 6.44772 9 7 9C7.55229 9 8 9.44771 8 10C8 10.5523 7.55229 11 7 11C6.44772 11 6 10.5523 6 10Z",
|
|
9171
|
+
fill: color
|
|
9172
|
+
}));
|
|
9173
|
+
}
|
|
9174
|
+
|
|
9175
|
+
function InviteInfoIcon() {
|
|
9176
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
9177
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9178
|
+
width: "20",
|
|
9179
|
+
height: "20",
|
|
9180
|
+
fill: "none",
|
|
9181
|
+
viewBox: "0 0 20 20"
|
|
9182
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9183
|
+
fill: "#CA8A04",
|
|
9184
|
+
d: "M11 5a1 1 0 11-2 0 1 1 0 012 0zM8 8a1 1 0 000 2h1v3H8a1 1 0 100 2h4a1 1 0 100-2h-1V9a1 1 0 00-1-1H8z"
|
|
9185
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
9186
|
+
fill: "#CA8A04",
|
|
9187
|
+
d: "M0 10c0 5.522 4.477 10 10 10s10-4.478 10-10c0-5.523-4.477-10-10-10S0 4.477 0 10zm10-8a8 8 0 110 16 8 8 0 010-16z"
|
|
9188
|
+
}));
|
|
9189
|
+
}
|
|
9190
|
+
|
|
8478
9191
|
var IUIToastMessageService$7 = utils.services.IUIToastMessageService;
|
|
8479
|
-
var env$7 = utils.configs.env
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
9192
|
+
var env$7 = utils.configs.env,
|
|
9193
|
+
api$7 = utils.configs.api;
|
|
9194
|
+
var UndoButton = function UndoButton(_ref) {
|
|
9195
|
+
var onUndo = _ref.onUndo,
|
|
9196
|
+
msg = _ref.msg;
|
|
9197
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
9198
|
+
style: {
|
|
9199
|
+
display: 'flex',
|
|
9200
|
+
flexDirection: 'row',
|
|
9201
|
+
width: '270px',
|
|
9202
|
+
justifyContent: 'space-between'
|
|
9203
|
+
}
|
|
9204
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
9205
|
+
style: {
|
|
9206
|
+
whiteSpace: 'nowrap',
|
|
9207
|
+
paddingTop: '8px'
|
|
9208
|
+
}
|
|
9209
|
+
}, msg), /*#__PURE__*/React__default.createElement("p", {
|
|
9210
|
+
onClick: onUndo,
|
|
9211
|
+
style: {
|
|
9212
|
+
whiteSpace: 'nowrap',
|
|
9213
|
+
fontWeight: '600',
|
|
9214
|
+
fontSize: '1rem',
|
|
9215
|
+
padding: '8px 20px 0'
|
|
9216
|
+
}
|
|
9217
|
+
}, "UNDO"));
|
|
9218
|
+
};
|
|
9219
|
+
var UserList = function UserList(_ref2) {
|
|
9220
|
+
var config = _ref2.config,
|
|
9221
|
+
isProfile = _ref2.isProfile;
|
|
8483
9222
|
env$7.init(config, isProfile);
|
|
8484
9223
|
var history = reactRouterDom.useHistory();
|
|
8485
9224
|
var _useSelector = reactRedux.useSelector(function (state) {
|
|
@@ -8489,27 +9228,49 @@ var UserList = function UserList(_ref) {
|
|
|
8489
9228
|
isDataFetching = _useSelector.isDataFetching,
|
|
8490
9229
|
deactivatedUsers = _useSelector.deactivatedUsers,
|
|
8491
9230
|
tabValue = _useSelector.tabValue;
|
|
8492
|
-
var
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
searchValue = _useState2[0],
|
|
8509
|
-
setSearchValue = _useState2[1];
|
|
9231
|
+
var newSelecteds = userListInfo.results;
|
|
9232
|
+
var _React$useState = React__default.useState(''),
|
|
9233
|
+
deactivateUser = _React$useState[0],
|
|
9234
|
+
setDeactivateUser = _React$useState[1];
|
|
9235
|
+
var _React$useState2 = React__default.useState(null),
|
|
9236
|
+
defaultId = _React$useState2[0],
|
|
9237
|
+
setDefaultId = _React$useState2[1];
|
|
9238
|
+
var _React$useState3 = React__default.useState(1),
|
|
9239
|
+
page = _React$useState3[0],
|
|
9240
|
+
setPage = _React$useState3[1];
|
|
9241
|
+
var _useState = React.useState([]),
|
|
9242
|
+
selectedUsersNotApprover = _useState[0],
|
|
9243
|
+
setSelectedUsersNotApprover = _useState[1];
|
|
9244
|
+
var _useState2 = React.useState([]),
|
|
9245
|
+
selectedUsersApprover = _useState2[0],
|
|
9246
|
+
setSelectedUsersApprover = _useState2[1];
|
|
8510
9247
|
var _useState3 = React.useState(false),
|
|
8511
|
-
|
|
8512
|
-
|
|
9248
|
+
isBulkDeactivateModalOpen = _useState3[0],
|
|
9249
|
+
setIsBulkDeactivateModalOpen = _useState3[1];
|
|
9250
|
+
var _React$useState4 = React__default.useState(''),
|
|
9251
|
+
user = _React$useState4[0],
|
|
9252
|
+
setUser = _React$useState4[1];
|
|
9253
|
+
var _useState4 = React.useState(10),
|
|
9254
|
+
rowsPerPage = _useState4[0],
|
|
9255
|
+
setRowsPerPage = _useState4[1];
|
|
9256
|
+
var _React$useState5 = React__default.useState({}),
|
|
9257
|
+
selected = _React$useState5[0],
|
|
9258
|
+
setSelected = _React$useState5[1];
|
|
9259
|
+
var _React$useState6 = React__default.useState('asc'),
|
|
9260
|
+
order = _React$useState6[0],
|
|
9261
|
+
setOrder = _React$useState6[1];
|
|
9262
|
+
var _React$useState7 = React__default.useState(false),
|
|
9263
|
+
deactivateSingle = _React$useState7[0],
|
|
9264
|
+
setDeactivateSingle = _React$useState7[1];
|
|
9265
|
+
var _React$useState8 = React__default.useState('first_name'),
|
|
9266
|
+
orderBy = _React$useState8[0],
|
|
9267
|
+
setOrderBy = _React$useState8[1];
|
|
9268
|
+
var _useState5 = React.useState(''),
|
|
9269
|
+
searchValue = _useState5[0],
|
|
9270
|
+
setSearchValue = _useState5[1];
|
|
9271
|
+
var _useState6 = React.useState(false),
|
|
9272
|
+
isOpenDeActivateModal = _useState6[0],
|
|
9273
|
+
setOpenDeActivateModalFlag = _useState6[1];
|
|
8513
9274
|
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
8514
9275
|
return state.common;
|
|
8515
9276
|
}),
|
|
@@ -8517,69 +9278,140 @@ var UserList = function UserList(_ref) {
|
|
|
8517
9278
|
hasVerificationError = _useSelector2.hasVerificationError,
|
|
8518
9279
|
isILadmin = _useSelector2.isILadmin,
|
|
8519
9280
|
companyName = _useSelector2.companyName;
|
|
8520
|
-
var _useState4 = React.useState(false),
|
|
8521
|
-
isOpenImportUsersModal = _useState4[0],
|
|
8522
|
-
setOpenImportUsersModal = _useState4[1];
|
|
8523
|
-
var _useState5 = React.useState(false),
|
|
8524
|
-
isFileDownloading = _useState5[0],
|
|
8525
|
-
setDownlStatus = _useState5[1];
|
|
8526
|
-
var _useState6 = React.useState(false),
|
|
8527
|
-
isSortingChange = _useState6[0],
|
|
8528
|
-
setSortingChange = _useState6[1];
|
|
8529
9281
|
var _useState7 = React.useState(false),
|
|
8530
|
-
|
|
8531
|
-
|
|
9282
|
+
isOpenImportUsersModal = _useState7[0],
|
|
9283
|
+
setOpenImportUsersModal = _useState7[1];
|
|
8532
9284
|
var _useState8 = React.useState(false),
|
|
8533
|
-
|
|
8534
|
-
|
|
9285
|
+
approveeStatus = _useState8[0],
|
|
9286
|
+
setApproveeStatus = _useState8[1];
|
|
8535
9287
|
var _useState9 = React.useState(false),
|
|
8536
|
-
|
|
8537
|
-
|
|
9288
|
+
isFileDownloading = _useState9[0],
|
|
9289
|
+
setDownlStatus = _useState9[1];
|
|
8538
9290
|
var _useState10 = React.useState(false),
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
setSignUpRowsPerPage = _useState11[1];
|
|
8548
|
-
var _React$useState6 = React__default.useState('asc'),
|
|
8549
|
-
signup_order = _React$useState6[0],
|
|
8550
|
-
setSignUpOrder = _React$useState6[1];
|
|
8551
|
-
var _React$useState7 = React__default.useState('fname'),
|
|
8552
|
-
signup_orderBy = _React$useState7[0],
|
|
8553
|
-
setSignUpOrderBy = _React$useState7[1];
|
|
8554
|
-
var _useState12 = React.useState(''),
|
|
8555
|
-
signup_searchValue = _useState12[0],
|
|
8556
|
-
set_signup_SearchValue = _useState12[1];
|
|
9291
|
+
isSortingChange = _useState10[0],
|
|
9292
|
+
setSortingChange = _useState10[1];
|
|
9293
|
+
var _useState11 = React.useState(false),
|
|
9294
|
+
isSearchingChange = _useState11[0],
|
|
9295
|
+
setSearchingChange = _useState11[1];
|
|
9296
|
+
var _useState12 = React.useState(false),
|
|
9297
|
+
isSortingChangeTemp = _useState12[0],
|
|
9298
|
+
setSortingChangeTemp = _useState12[1];
|
|
8557
9299
|
var _useState13 = React.useState(false),
|
|
8558
|
-
|
|
8559
|
-
|
|
9300
|
+
isSearchingChangeTemp = _useState13[0],
|
|
9301
|
+
setSearchingChangeTemp = _useState13[1];
|
|
8560
9302
|
var _useState14 = React.useState(false),
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
var _useState15 = React.useState(
|
|
8564
|
-
|
|
8565
|
-
|
|
9303
|
+
isApiFetching = _useState14[0],
|
|
9304
|
+
setisApiFetching = _useState14[1];
|
|
9305
|
+
var _useState15 = React.useState({
|
|
9306
|
+
value: '',
|
|
9307
|
+
label: 'Select approver'
|
|
9308
|
+
}),
|
|
9309
|
+
approverRole = _useState15[0],
|
|
9310
|
+
setApproverRole = _useState15[1];
|
|
8566
9311
|
var _useState16 = React.useState(false),
|
|
8567
|
-
|
|
8568
|
-
|
|
9312
|
+
showInviteModal = _useState16[0],
|
|
9313
|
+
setToggleInviteModal = _useState16[1];
|
|
9314
|
+
var _useState17 = React.useState(''),
|
|
9315
|
+
userIds = _useState17[0],
|
|
9316
|
+
setUserIds = _useState17[1];
|
|
9317
|
+
var _React$useState9 = React__default.useState(false),
|
|
9318
|
+
overlayMenu = _React$useState9[0],
|
|
9319
|
+
setOverlayMenu = _React$useState9[1];
|
|
9320
|
+
var _useState18 = React.useState(''),
|
|
9321
|
+
userFirstName = _useState18[0],
|
|
9322
|
+
setUserFirstName = _useState18[1];
|
|
9323
|
+
var _useState19 = React.useState(''),
|
|
9324
|
+
userLastName = _useState19[0],
|
|
9325
|
+
setUserLastName = _useState19[1];
|
|
9326
|
+
var _useState20 = React.useState(true),
|
|
9327
|
+
isDisabledSubmitBtn = _useState20[0],
|
|
9328
|
+
setIsDisabledSubmitBtn = _useState20[1];
|
|
9329
|
+
useScrollPosition.useScrollPosition(function (_ref3) {
|
|
9330
|
+
var prevPos = _ref3.prevPos,
|
|
9331
|
+
currPos = _ref3.currPos;
|
|
9332
|
+
if (prevPos.y - currPos.y > 0) {
|
|
9333
|
+
if (currPos.y <= -275) {
|
|
9334
|
+
setOverlayMenu(true);
|
|
9335
|
+
}
|
|
9336
|
+
} else {
|
|
9337
|
+
if (currPos.y > -295) {
|
|
9338
|
+
setOverlayMenu(false);
|
|
9339
|
+
}
|
|
9340
|
+
}
|
|
9341
|
+
}, [overlayMenu]);
|
|
9342
|
+
var scrollTo = function scrollTo(id) {
|
|
9343
|
+
var el = document.getElementById(id);
|
|
9344
|
+
window.scrollTo({
|
|
9345
|
+
top: el.offsetTop,
|
|
9346
|
+
behavior: 'smooth'
|
|
9347
|
+
});
|
|
9348
|
+
};
|
|
9349
|
+
var _React$useState10 = React__default.useState(1),
|
|
9350
|
+
signup_page = _React$useState10[0],
|
|
9351
|
+
setSignUpPage = _React$useState10[1];
|
|
9352
|
+
var _useState21 = React.useState(5),
|
|
9353
|
+
signup_rowsPerPage = _useState21[0],
|
|
9354
|
+
setSignUpRowsPerPage = _useState21[1];
|
|
9355
|
+
var _React$useState11 = React__default.useState('asc'),
|
|
9356
|
+
signup_order = _React$useState11[0],
|
|
9357
|
+
setSignUpOrder = _React$useState11[1];
|
|
9358
|
+
var _React$useState12 = React__default.useState('first_name'),
|
|
9359
|
+
signup_orderBy = _React$useState12[0],
|
|
9360
|
+
setSignUpOrderBy = _React$useState12[1];
|
|
9361
|
+
var _useState22 = React.useState(''),
|
|
9362
|
+
signup_searchValue = _useState22[0],
|
|
9363
|
+
set_signup_SearchValue = _useState22[1];
|
|
9364
|
+
var _useState23 = React.useState(false),
|
|
9365
|
+
isSignUpSortingChange = _useState23[0],
|
|
9366
|
+
setSignUpSortingChange = _useState23[1];
|
|
9367
|
+
var _useState24 = React.useState(false),
|
|
9368
|
+
isSignUpSearchingChange = _useState24[0],
|
|
9369
|
+
setSignUpSearchingChange = _useState24[1];
|
|
9370
|
+
var _useState25 = React.useState(false),
|
|
9371
|
+
isSignUpSortingChangeTemp = _useState25[0],
|
|
9372
|
+
setSignUpSortingChangeTemp = _useState25[1];
|
|
9373
|
+
var _useState26 = React.useState(false),
|
|
9374
|
+
isSignUpSearchingChangeTemp = _useState26[0],
|
|
9375
|
+
setSignUpSearchingChangeTemp = _useState26[1];
|
|
8569
9376
|
var _useSelector3 = reactRedux.useSelector(function (state) {
|
|
8570
9377
|
return state.userList;
|
|
8571
9378
|
}),
|
|
8572
9379
|
signupRequestListInfo = _useSelector3.signupRequestListInfo;
|
|
9380
|
+
var redirectToNotifications = function redirectToNotifications() {
|
|
9381
|
+
if (config.routes.notification) {
|
|
9382
|
+
history.push({
|
|
9383
|
+
pathname: config.routes.notification.path
|
|
9384
|
+
});
|
|
9385
|
+
}
|
|
9386
|
+
};
|
|
8573
9387
|
var openDeactivateModal = function openDeactivateModal() {
|
|
8574
9388
|
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
8575
9389
|
IUIToastMessageService$7.warningNotify('Select at least one user to deactivate.');
|
|
8576
9390
|
return false;
|
|
8577
9391
|
}
|
|
8578
|
-
|
|
9392
|
+
if (selectedUsersApprover.length) {
|
|
9393
|
+
var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9394
|
+
var _SelectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9395
|
+
var _selected = Object.values(selected).flat();
|
|
9396
|
+
_SelectedUsersNotApprover = _SelectedUsersNotApprover.filter(function (item) {
|
|
9397
|
+
return _selected.includes(item.id.toString());
|
|
9398
|
+
});
|
|
9399
|
+
_SelectedUsersApprover = _SelectedUsersApprover.filter(function (item) {
|
|
9400
|
+
return _selected.includes(item.id.toString());
|
|
9401
|
+
});
|
|
9402
|
+
setSelectedUsersNotApprover(_SelectedUsersNotApprover);
|
|
9403
|
+
setSelectedUsersApprover(_SelectedUsersApprover);
|
|
9404
|
+
setIsBulkDeactivateModalOpen(true);
|
|
9405
|
+
} else {
|
|
9406
|
+
setOpenDeActivateModalFlag(true);
|
|
9407
|
+
}
|
|
8579
9408
|
};
|
|
8580
9409
|
var closeDeActivateModal = function closeDeActivateModal() {
|
|
8581
9410
|
setOpenDeActivateModalFlag(false);
|
|
8582
9411
|
};
|
|
9412
|
+
var closeDeActiveModal = function closeDeActiveModal() {
|
|
9413
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9414
|
+
};
|
|
8583
9415
|
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
8584
9416
|
history.push(config.routes.users.add.path);
|
|
8585
9417
|
};
|
|
@@ -8592,50 +9424,32 @@ var UserList = function UserList(_ref) {
|
|
|
8592
9424
|
var handleVerifyUserClick = function handleVerifyUserClick(userId) {
|
|
8593
9425
|
history.push(config.routes.users.add.path + "?" + config.routes.users.add.queryParamKeys.verifyUserId + "=" + userId);
|
|
8594
9426
|
};
|
|
8595
|
-
var UndoButton = function UndoButton(_ref2) {
|
|
8596
|
-
var msg = _ref2.msg,
|
|
8597
|
-
id = _ref2.id;
|
|
8598
|
-
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8599
|
-
display: "flex",
|
|
8600
|
-
flexDirection: "row",
|
|
8601
|
-
width: "270px"
|
|
8602
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8603
|
-
style: {
|
|
8604
|
-
whiteSpace: 'nowrap',
|
|
8605
|
-
paddingTop: '8px'
|
|
8606
|
-
}
|
|
8607
|
-
}, msg), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
8608
|
-
type: "text",
|
|
8609
|
-
buttonText: "UNDO",
|
|
8610
|
-
style: {
|
|
8611
|
-
color: '#FFFFFF'
|
|
8612
|
-
},
|
|
8613
|
-
onClick: function onClick() {
|
|
8614
|
-
return dispatch(undoneSignUpRejection(id));
|
|
8615
|
-
}
|
|
8616
|
-
}));
|
|
8617
|
-
};
|
|
8618
9427
|
var handleRejectUserClick = function handleRejectUserClick(userId) {
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
9428
|
+
IUIToastMessageService$7.undoNotify( /*#__PURE__*/React__default.createElement(UndoButton, {
|
|
9429
|
+
onUndo: function onUndo() {
|
|
9430
|
+
return IUIToastMessageService$7.setUndoClicked(true);
|
|
9431
|
+
},
|
|
9432
|
+
msg: "Sign-up request rejected"
|
|
9433
|
+
}), function (res) {
|
|
9434
|
+
if (res === false) {
|
|
9435
|
+
dispatch(rejectUserVerification(userId)).then(function (res) {
|
|
9436
|
+
if (res.status === true) {
|
|
9437
|
+
dispatch(showDataFetchingStatus());
|
|
9438
|
+
dispatch(fetchUserSignupRequests({
|
|
9439
|
+
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
9440
|
+
length: signup_rowsPerPage,
|
|
9441
|
+
page: signup_page,
|
|
9442
|
+
search: signup_searchValue.trim(),
|
|
9443
|
+
pagename: 'company'
|
|
9444
|
+
})).then(function () {
|
|
9445
|
+
return dispatch(stopDataFetchingStatus());
|
|
9446
|
+
});
|
|
9447
|
+
}
|
|
9448
|
+
})["catch"](function (err) {
|
|
9449
|
+
console.log(err);
|
|
8635
9450
|
});
|
|
8636
9451
|
}
|
|
8637
|
-
|
|
8638
|
-
console.log(err);
|
|
9452
|
+
IUIToastMessageService$7.setUndoClicked(false);
|
|
8639
9453
|
});
|
|
8640
9454
|
};
|
|
8641
9455
|
var handleBulkActionHistoryClick = function handleBulkActionHistoryClick() {
|
|
@@ -8648,12 +9462,25 @@ var UserList = function UserList(_ref) {
|
|
|
8648
9462
|
};
|
|
8649
9463
|
var deselectingCheckboxHandler = function deselectingCheckboxHandler(page) {
|
|
8650
9464
|
var _extends2;
|
|
8651
|
-
var
|
|
9465
|
+
var selectedId = [];
|
|
9466
|
+
var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9467
|
+
var _selectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9468
|
+
var _newSelecteds = newSelecteds.filter(function (n) {
|
|
8652
9469
|
return n.is_active;
|
|
8653
|
-
}).map(function (obj) {
|
|
8654
|
-
return obj.id.toString();
|
|
8655
9470
|
});
|
|
8656
|
-
|
|
9471
|
+
_newSelecteds.map(function (obj) {
|
|
9472
|
+
if (selected && !Object.values(selected).flat().includes(obj.id.toString())) {
|
|
9473
|
+
if (obj.roles.is_approver === true) {
|
|
9474
|
+
_selectedUsersApprover.push(obj);
|
|
9475
|
+
} else if (obj.roles.is_approver === false) {
|
|
9476
|
+
_selectedUsersNotApprover.push(obj);
|
|
9477
|
+
}
|
|
9478
|
+
}
|
|
9479
|
+
selectedId.push(obj.id.toString());
|
|
9480
|
+
});
|
|
9481
|
+
setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = selectedId, _extends2)));
|
|
9482
|
+
setSelectedUsersNotApprover(_selectedUsersNotApprover);
|
|
9483
|
+
setSelectedUsersApprover(_selectedUsersApprover);
|
|
8657
9484
|
};
|
|
8658
9485
|
var handleSelectAllClick = function handleSelectAllClick(event, page) {
|
|
8659
9486
|
var _extends3;
|
|
@@ -8671,58 +9498,156 @@ var UserList = function UserList(_ref) {
|
|
|
8671
9498
|
setSortingChangeTemp(!isSortingChangeTemp);
|
|
8672
9499
|
};
|
|
8673
9500
|
var onSearchHandler = function onSearchHandler(value) {
|
|
9501
|
+
setPage(1);
|
|
8674
9502
|
setSearchValue(value);
|
|
8675
9503
|
setSearchingChange(true);
|
|
8676
9504
|
setSearchingChangeTemp(!isSearchingChangeTemp);
|
|
8677
9505
|
};
|
|
8678
9506
|
var onSignUpReqeustSearchHandler = function onSignUpReqeustSearchHandler(value) {
|
|
9507
|
+
setPage(1);
|
|
8679
9508
|
set_signup_SearchValue(value);
|
|
8680
9509
|
setSignUpSearchingChange(true);
|
|
8681
9510
|
setSignUpSearchingChangeTemp(!isSignUpSearchingChangeTemp);
|
|
8682
9511
|
};
|
|
8683
|
-
var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page) {
|
|
9512
|
+
var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page, data) {
|
|
8684
9513
|
var _extends4;
|
|
8685
9514
|
var selectedTemp = _extends({}, selected);
|
|
8686
9515
|
if (!(page in selectedTemp)) {
|
|
8687
9516
|
selectedTemp[page] = [];
|
|
8688
9517
|
}
|
|
8689
9518
|
var selectedIndex = selectedTemp[page].indexOf(id);
|
|
8690
|
-
var
|
|
9519
|
+
var _newSelected = [];
|
|
8691
9520
|
if (selectedIndex === -1) {
|
|
8692
|
-
|
|
9521
|
+
_newSelected = _newSelected.concat(selectedTemp[page], id);
|
|
8693
9522
|
} else if (selectedIndex === 0) {
|
|
8694
|
-
|
|
9523
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(1));
|
|
8695
9524
|
} else if (selectedIndex === selectedTemp[page].length - 1) {
|
|
8696
|
-
|
|
9525
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(0, -1));
|
|
8697
9526
|
} else if (selectedIndex > 0) {
|
|
8698
|
-
|
|
9527
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
|
|
8699
9528
|
}
|
|
8700
|
-
|
|
9529
|
+
var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9530
|
+
var _SelectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9531
|
+
if (Object.values(selected).flat().includes(id.toString())) {
|
|
9532
|
+
_SelectedUsersNotApprover = selectedUsersNotApprover.filter(function (item) {
|
|
9533
|
+
return id !== item.id.toString();
|
|
9534
|
+
});
|
|
9535
|
+
_SelectedUsersApprover = selectedUsersApprover.filter(function (item) {
|
|
9536
|
+
return item.id.toString() !== id;
|
|
9537
|
+
});
|
|
9538
|
+
} else if (data !== null && data !== void 0 && data.roles) {
|
|
9539
|
+
if (data.roles.is_approver === true) {
|
|
9540
|
+
_SelectedUsersApprover.push(data);
|
|
9541
|
+
} else if (data.roles.is_approver === false) {
|
|
9542
|
+
_SelectedUsersNotApprover.push(data);
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9545
|
+
setSelectedUsersNotApprover(_SelectedUsersNotApprover);
|
|
9546
|
+
setSelectedUsersApprover(_SelectedUsersApprover);
|
|
9547
|
+
setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = _newSelected, _extends4)));
|
|
8701
9548
|
};
|
|
9549
|
+
React.useEffect(function () {
|
|
9550
|
+
setApproverRole({
|
|
9551
|
+
value: '',
|
|
9552
|
+
label: 'Select approver'
|
|
9553
|
+
});
|
|
9554
|
+
setDefaultId(null);
|
|
9555
|
+
setIsDisabledSubmitBtn(true);
|
|
9556
|
+
setApproveeStatus(false);
|
|
9557
|
+
if (deactivateSingle === true) {
|
|
9558
|
+
api$7.get(userAddEditUrl.transferAppover() + "user_id=" + user.id + "&page=1").then(function (response) {
|
|
9559
|
+
if (response.data["default"].id) {
|
|
9560
|
+
setDefaultId(response.data["default"].id);
|
|
9561
|
+
setApproverRole({
|
|
9562
|
+
value: '',
|
|
9563
|
+
label: response.data["default"].email
|
|
9564
|
+
});
|
|
9565
|
+
setIsDisabledSubmitBtn(false);
|
|
9566
|
+
setApproveeStatus(response.data["default"].approvee_status);
|
|
9567
|
+
}
|
|
9568
|
+
});
|
|
9569
|
+
}
|
|
9570
|
+
}, [deactivateSingle]);
|
|
8702
9571
|
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
8703
9572
|
setRowsPerPage(+event.target.value);
|
|
8704
9573
|
setPage(1);
|
|
8705
9574
|
setSelected({});
|
|
9575
|
+
setSelectedUsersNotApprover([]);
|
|
9576
|
+
setSelectedUsersApprover([]);
|
|
8706
9577
|
setSortingChange(true);
|
|
8707
9578
|
setSortingChangeTemp(!isSortingChangeTemp);
|
|
8708
9579
|
};
|
|
8709
9580
|
var handleActiveUser = function handleActiveUser(e, id, page) {
|
|
8710
9581
|
var isActive = e.target.checked;
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
9582
|
+
var _isApprover;
|
|
9583
|
+
newSelecteds.map(function (item) {
|
|
9584
|
+
if (item.id === id) {
|
|
9585
|
+
_isApprover = item.roles.is_approver;
|
|
9586
|
+
if (_isApprover === true && isActive === false) {
|
|
9587
|
+
setDeactivateSingle(true);
|
|
9588
|
+
setDeactivateUser(item.first_name + ' ' + item.last_name);
|
|
9589
|
+
setUser(item);
|
|
9590
|
+
} else {
|
|
9591
|
+
dispatch(updateActiveStatus(e.target.checked ? 1 : 0, e.target.id, _isApprover)).then(function () {
|
|
9592
|
+
if (!isActive) {
|
|
9593
|
+
if (Object.values(selected).flat().includes(id.toString())) {
|
|
9594
|
+
var _extends5;
|
|
9595
|
+
var selectedTemp = _extends({}, selected);
|
|
9596
|
+
var _selectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9597
|
+
var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9598
|
+
selectedTemp[page].splice(selectedTemp[page].indexOf(id.toString()), 1);
|
|
9599
|
+
_selectedUsersApprover = _selectedUsersApprover.filter(function (item) {
|
|
9600
|
+
return item.id != id;
|
|
9601
|
+
});
|
|
9602
|
+
_selectedUsersNotApprover = _selectedUsersNotApprover.filter(function (item) {
|
|
9603
|
+
return item.id != id;
|
|
9604
|
+
});
|
|
9605
|
+
setSelected(_extends({}, selected, (_extends5 = {}, _extends5[page] = selectedTemp[page], _extends5)));
|
|
9606
|
+
setSelectedUsersApprover(_selectedUsersApprover);
|
|
9607
|
+
setSelectedUsersNotApprover(_selectedUsersNotApprover);
|
|
9608
|
+
}
|
|
9609
|
+
}
|
|
9610
|
+
});
|
|
8718
9611
|
}
|
|
8719
9612
|
}
|
|
8720
9613
|
});
|
|
8721
9614
|
};
|
|
9615
|
+
var selectApprover = function selectApprover(_ref4) {
|
|
9616
|
+
var _value = _ref4._value;
|
|
9617
|
+
if (_value.data.approvee_status) {
|
|
9618
|
+
setApproveeStatus(true);
|
|
9619
|
+
} else {
|
|
9620
|
+
setApproveeStatus(false);
|
|
9621
|
+
}
|
|
9622
|
+
setDefaultId(_value.data.id);
|
|
9623
|
+
setApproverRole(_value);
|
|
9624
|
+
setIsDisabledSubmitBtn(false);
|
|
9625
|
+
};
|
|
9626
|
+
var handleDeactivateUser = function handleDeactivateUser() {
|
|
9627
|
+
dispatch(updateActiveStatus(0, user.id, user.roles.is_approver, defaultId));
|
|
9628
|
+
setOpenDeActivateModalFlag(false);
|
|
9629
|
+
setDeactivateSingle(false);
|
|
9630
|
+
setSelected({});
|
|
9631
|
+
setSelectedUsersNotApprover([]);
|
|
9632
|
+
setSelectedUsersApprover([]);
|
|
9633
|
+
};
|
|
8722
9634
|
var handleDeactivateUsers = function handleDeactivateUsers() {
|
|
8723
9635
|
dispatch(deActivateUsers(Object.values(selected).flat()));
|
|
8724
9636
|
setOpenDeActivateModalFlag(false);
|
|
8725
9637
|
setSelected({});
|
|
9638
|
+
setSelectedUsersNotApprover([]);
|
|
9639
|
+
setSelectedUsersApprover([]);
|
|
9640
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9641
|
+
};
|
|
9642
|
+
var handleDeactivateSafeUsers = function handleDeactivateSafeUsers() {
|
|
9643
|
+
var _selectedUsersNotApprover = selectedUsersNotApprover.map(function (item) {
|
|
9644
|
+
return item.id;
|
|
9645
|
+
});
|
|
9646
|
+
dispatch(deActivateUsers(_selectedUsersNotApprover));
|
|
9647
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9648
|
+
setSelected({});
|
|
9649
|
+
setSelectedUsersNotApprover([]);
|
|
9650
|
+
setSelectedUsersApprover([]);
|
|
8726
9651
|
};
|
|
8727
9652
|
var importUserHandler = function importUserHandler() {
|
|
8728
9653
|
setOpenImportUsersModal(true);
|
|
@@ -8734,6 +9659,43 @@ var UserList = function UserList(_ref) {
|
|
|
8734
9659
|
setOpenImportUsersModal(false);
|
|
8735
9660
|
handleImportPagenavigation(jobId);
|
|
8736
9661
|
};
|
|
9662
|
+
var onResetPasswordHandler = function onResetPasswordHandler(email) {
|
|
9663
|
+
dispatch(resetPasswordForUser({
|
|
9664
|
+
email: email
|
|
9665
|
+
}));
|
|
9666
|
+
};
|
|
9667
|
+
var toggleInviteModal = function toggleInviteModal(ids, type, firstName, lastName) {
|
|
9668
|
+
if (type === undefined) {
|
|
9669
|
+
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
9670
|
+
IUIToastMessageService$7.warningNotify('Select at least one user to invite.');
|
|
9671
|
+
return false;
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
setUserIds(ids);
|
|
9675
|
+
setUserFirstName(firstName);
|
|
9676
|
+
setUserLastName(lastName);
|
|
9677
|
+
setToggleInviteModal(!showInviteModal);
|
|
9678
|
+
};
|
|
9679
|
+
var toggleInviteModalClose = function toggleInviteModalClose() {
|
|
9680
|
+
setToggleInviteModal(!showInviteModal);
|
|
9681
|
+
};
|
|
9682
|
+
var onResendInviteHandler = function onResendInviteHandler() {
|
|
9683
|
+
var userIdArr = [];
|
|
9684
|
+
if (userIds && !isNaN(userIds)) {
|
|
9685
|
+
userIdArr = [userIds];
|
|
9686
|
+
} else if (Object.keys(selected).length) {
|
|
9687
|
+
Object.values(selected).map(function (val, i) {
|
|
9688
|
+
if (val.length) {
|
|
9689
|
+
val.map(function (idx, i) {
|
|
9690
|
+
userIdArr.push(idx);
|
|
9691
|
+
});
|
|
9692
|
+
}
|
|
9693
|
+
});
|
|
9694
|
+
}
|
|
9695
|
+
setUserIds('');
|
|
9696
|
+
dispatch(resendInviteForUser(userIdArr));
|
|
9697
|
+
setToggleInviteModal(!showInviteModal);
|
|
9698
|
+
};
|
|
8737
9699
|
var handleExportUsers = function handleExportUsers() {
|
|
8738
9700
|
try {
|
|
8739
9701
|
setDownlStatus(true);
|
|
@@ -8773,6 +9735,9 @@ var UserList = function UserList(_ref) {
|
|
|
8773
9735
|
}, {
|
|
8774
9736
|
label: 'Bulk action history',
|
|
8775
9737
|
handler: handleBulkActionHistoryClick
|
|
9738
|
+
}, {
|
|
9739
|
+
label: 'Resend invite',
|
|
9740
|
+
handler: toggleInviteModal
|
|
8776
9741
|
}];
|
|
8777
9742
|
React.useEffect(function () {
|
|
8778
9743
|
var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
|
|
@@ -8784,6 +9749,9 @@ var UserList = function UserList(_ref) {
|
|
|
8784
9749
|
userId: userId
|
|
8785
9750
|
}));
|
|
8786
9751
|
};
|
|
9752
|
+
var knowMore = function knowMore() {
|
|
9753
|
+
window.open('https://itilite.notion.site/All-about-deactivating-users-77554de1fb494832ac7e344ca14277f0', '_blank');
|
|
9754
|
+
};
|
|
8787
9755
|
var dispatch = reactRedux.useDispatch();
|
|
8788
9756
|
React.useEffect(function () {
|
|
8789
9757
|
if (isTokenVerified === true) {
|
|
@@ -8797,6 +9765,7 @@ var UserList = function UserList(_ref) {
|
|
|
8797
9765
|
dispatch(fetchUsersList(url)).then(function () {
|
|
8798
9766
|
setSearchingChange(false);
|
|
8799
9767
|
setisApiFetching(false);
|
|
9768
|
+
scrollTo('table-root');
|
|
8800
9769
|
});
|
|
8801
9770
|
}, 1000);
|
|
8802
9771
|
return function () {
|
|
@@ -8810,7 +9779,8 @@ var UserList = function UserList(_ref) {
|
|
|
8810
9779
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8811
9780
|
length: signup_rowsPerPage,
|
|
8812
9781
|
page: signup_page,
|
|
8813
|
-
search: signup_searchValue.trim()
|
|
9782
|
+
search: signup_searchValue.trim(),
|
|
9783
|
+
pagename: 'company'
|
|
8814
9784
|
})).then(function () {
|
|
8815
9785
|
setSignUpSearchingChange(false);
|
|
8816
9786
|
setisApiFetching(false);
|
|
@@ -8822,6 +9792,7 @@ var UserList = function UserList(_ref) {
|
|
|
8822
9792
|
}
|
|
8823
9793
|
if (isSortingChange) {
|
|
8824
9794
|
setisApiFetching(true);
|
|
9795
|
+
scrollTo('table-root');
|
|
8825
9796
|
dispatch(fetchUsersList(url)).then(function () {
|
|
8826
9797
|
setisApiFetching(false);
|
|
8827
9798
|
setSortingChange(false);
|
|
@@ -8836,7 +9807,8 @@ var UserList = function UserList(_ref) {
|
|
|
8836
9807
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8837
9808
|
length: signup_rowsPerPage,
|
|
8838
9809
|
page: signup_page,
|
|
8839
|
-
search: signup_searchValue.trim()
|
|
9810
|
+
search: signup_searchValue.trim(),
|
|
9811
|
+
pagename: 'company'
|
|
8840
9812
|
})).then(function () {
|
|
8841
9813
|
setisApiFetching(false);
|
|
8842
9814
|
setSignUpSortingChange(false);
|
|
@@ -8852,7 +9824,8 @@ var UserList = function UserList(_ref) {
|
|
|
8852
9824
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8853
9825
|
length: signup_rowsPerPage,
|
|
8854
9826
|
page: signup_page,
|
|
8855
|
-
search: signup_searchValue.trim()
|
|
9827
|
+
search: signup_searchValue.trim(),
|
|
9828
|
+
pagename: 'company'
|
|
8856
9829
|
})).then(function () {
|
|
8857
9830
|
return dispatch(stopDataFetchingStatus());
|
|
8858
9831
|
});
|
|
@@ -8860,15 +9833,89 @@ var UserList = function UserList(_ref) {
|
|
|
8860
9833
|
}
|
|
8861
9834
|
}
|
|
8862
9835
|
}, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
|
|
9836
|
+
var topRightButtons = function topRightButtons() {
|
|
9837
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9838
|
+
component: "div",
|
|
9839
|
+
className: styles$5.buttonWrapper,
|
|
9840
|
+
display: "flex",
|
|
9841
|
+
justifyContent: "space-between",
|
|
9842
|
+
alignItems: "center",
|
|
9843
|
+
alignSelf: "flex-start"
|
|
9844
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9845
|
+
component: "div",
|
|
9846
|
+
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
9847
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
9848
|
+
buttonText: "Export all users",
|
|
9849
|
+
type: "outlined",
|
|
9850
|
+
startIcon: /*#__PURE__*/React__default.createElement(BulkDownloadIcon, {
|
|
9851
|
+
width: "22",
|
|
9852
|
+
height: "22"
|
|
9853
|
+
}),
|
|
9854
|
+
onClick: handleExportUsers
|
|
9855
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9856
|
+
component: "div",
|
|
9857
|
+
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
9858
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIDropdownButton, {
|
|
9859
|
+
buttonText: "Bulk actions",
|
|
9860
|
+
type: "outlined",
|
|
9861
|
+
menuListInfo: BulkUploadInfo
|
|
9862
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9863
|
+
component: "div",
|
|
9864
|
+
className: "pageHeader--button-single button-right"
|
|
9865
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
9866
|
+
buttonText: "Add user",
|
|
9867
|
+
type: "contained",
|
|
9868
|
+
startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
|
|
9869
|
+
width: "9",
|
|
9870
|
+
height: "9",
|
|
9871
|
+
color: "white"
|
|
9872
|
+
}),
|
|
9873
|
+
onClick: handleAddPageNavigation
|
|
9874
|
+
})));
|
|
9875
|
+
};
|
|
8863
9876
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8864
9877
|
component: "div",
|
|
8865
9878
|
className: styles$5.UUIUserManagementList
|
|
8866
|
-
},
|
|
9879
|
+
}, overlayMenu ? /*#__PURE__*/React__default.createElement(core.Box, {
|
|
9880
|
+
className: styles$5.scrollOverlayMenu
|
|
9881
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9882
|
+
component: "div",
|
|
9883
|
+
className: clsx(styles$5.pageHeader)
|
|
9884
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9885
|
+
component: "div",
|
|
9886
|
+
display: "flex",
|
|
9887
|
+
justifyContent: "space-between",
|
|
9888
|
+
alignItems: "center",
|
|
9889
|
+
flexWrap: "wrap",
|
|
9890
|
+
style: {
|
|
9891
|
+
gap: '1rem'
|
|
9892
|
+
}
|
|
9893
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9894
|
+
component: "div",
|
|
9895
|
+
display: "flex",
|
|
9896
|
+
flexDirection: "column",
|
|
9897
|
+
style: {
|
|
9898
|
+
gap: '0.5rem'
|
|
9899
|
+
}
|
|
9900
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUISearch, {
|
|
9901
|
+
placeholder: "Search by name, email & department",
|
|
9902
|
+
value: searchValue,
|
|
9903
|
+
onChangeHandler: function onChangeHandler(e) {
|
|
9904
|
+
return onSearchHandler(e.target.value);
|
|
9905
|
+
},
|
|
9906
|
+
className: styles$5.overlaysearch
|
|
9907
|
+
})), topRightButtons()), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9908
|
+
component: "div",
|
|
9909
|
+
display: "flex",
|
|
9910
|
+
justifyContent: "space-between",
|
|
9911
|
+
alignItems: "center"
|
|
9912
|
+
}))) : '', !hasVerificationError ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBackdrop, {
|
|
8867
9913
|
open: isFileDownloading || isApiFetching,
|
|
8868
9914
|
className: styles$5.backdrop
|
|
8869
9915
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUICircularProgress, {
|
|
8870
9916
|
color: "inherit"
|
|
8871
9917
|
})), isDataFetching ? /*#__PURE__*/React__default.createElement(SkeletonLoader, null) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9918
|
+
id: "table-root",
|
|
8872
9919
|
component: "div",
|
|
8873
9920
|
className: clsx(styles$5.pageHeader)
|
|
8874
9921
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
@@ -8893,44 +9940,7 @@ var UserList = function UserList(_ref) {
|
|
|
8893
9940
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8894
9941
|
variant: "h3",
|
|
8895
9942
|
className: clsx(styles$5.heading, styles$5.headingLarge)
|
|
8896
|
-
}, isILadmin && companyName ? companyName + " - Users" : 'Users'))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8897
|
-
component: "div",
|
|
8898
|
-
className: styles$5.buttonWrapper,
|
|
8899
|
-
display: "flex",
|
|
8900
|
-
justifyContent: "space-between",
|
|
8901
|
-
alignItems: "center",
|
|
8902
|
-
alignSelf: "flex-start"
|
|
8903
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8904
|
-
component: "div",
|
|
8905
|
-
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
8906
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
8907
|
-
buttonText: "Export all users",
|
|
8908
|
-
type: "outlined",
|
|
8909
|
-
startIcon: /*#__PURE__*/React__default.createElement(BulkDownloadIcon, {
|
|
8910
|
-
width: "22",
|
|
8911
|
-
height: "22"
|
|
8912
|
-
}),
|
|
8913
|
-
onClick: handleExportUsers
|
|
8914
|
-
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8915
|
-
component: "div",
|
|
8916
|
-
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
8917
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIDropdownButton, {
|
|
8918
|
-
buttonText: "Bulk actions",
|
|
8919
|
-
type: "outlined",
|
|
8920
|
-
menuListInfo: BulkUploadInfo
|
|
8921
|
-
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8922
|
-
component: "div",
|
|
8923
|
-
className: "pageHeader--button-single button-right"
|
|
8924
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
8925
|
-
buttonText: "Add user",
|
|
8926
|
-
type: "contained",
|
|
8927
|
-
startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
|
|
8928
|
-
width: "9",
|
|
8929
|
-
height: "9",
|
|
8930
|
-
color: "white"
|
|
8931
|
-
}),
|
|
8932
|
-
onClick: handleAddPageNavigation
|
|
8933
|
-
})))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9943
|
+
}, isILadmin && companyName ? companyName + " - Users" : 'Users'))), topRightButtons()), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8934
9944
|
component: "div",
|
|
8935
9945
|
display: "flex",
|
|
8936
9946
|
justifyContent: "space-between",
|
|
@@ -8975,7 +9985,9 @@ var UserList = function UserList(_ref) {
|
|
|
8975
9985
|
disableRowCheckbox: deactivatedUsers,
|
|
8976
9986
|
searchValue: searchValue,
|
|
8977
9987
|
isILadmin: isILadmin,
|
|
8978
|
-
onPrimaryAdminHandler: onPrimaryAdminHandler
|
|
9988
|
+
onPrimaryAdminHandler: onPrimaryAdminHandler,
|
|
9989
|
+
onResetPasswordHandler: onResetPasswordHandler,
|
|
9990
|
+
toggleInviteModal: toggleInviteModal
|
|
8979
9991
|
}))
|
|
8980
9992
|
}, {
|
|
8981
9993
|
label: /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, "Sign-up requests", ' ', /*#__PURE__*/React__default.createElement(TabLabelCount, {
|
|
@@ -8991,7 +10003,10 @@ var UserList = function UserList(_ref) {
|
|
|
8991
10003
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8992
10004
|
variant: "body2",
|
|
8993
10005
|
className: clsx(styles$5.description)
|
|
8994
|
-
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in
|
|
10006
|
+
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in", ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
10007
|
+
onClick: redirectToNotifications,
|
|
10008
|
+
className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
|
|
10009
|
+
}, "Notifications"))), /*#__PURE__*/React__default.createElement(SingupRequests, {
|
|
8995
10010
|
data: signupRequestListInfo,
|
|
8996
10011
|
handleChangeRowsPerPage: function handleChangeRowsPerPage(event) {
|
|
8997
10012
|
setSignUpRowsPerPage(+event.target.value);
|
|
@@ -9023,6 +10038,54 @@ var UserList = function UserList(_ref) {
|
|
|
9023
10038
|
}))
|
|
9024
10039
|
}]
|
|
9025
10040
|
}))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
|
|
10041
|
+
isOpen: deactivateSingle,
|
|
10042
|
+
closeHandler: function closeHandler() {
|
|
10043
|
+
setDeactivateSingle(false);
|
|
10044
|
+
},
|
|
10045
|
+
cancelLabel: "Cancel",
|
|
10046
|
+
submitLabel: "Deactivate",
|
|
10047
|
+
submitHandler: handleDeactivateUser,
|
|
10048
|
+
headerText: "Deactivate this user?",
|
|
10049
|
+
width: "400px",
|
|
10050
|
+
subHanderText: "",
|
|
10051
|
+
submitBtnClass: styles$5.deactivateBtn,
|
|
10052
|
+
isDisabledSubmitBtn: isDisabledSubmitBtn,
|
|
10053
|
+
modalClass: "deactivateSingleModal",
|
|
10054
|
+
modalBodyStyle: {
|
|
10055
|
+
overflowY: 'unset'
|
|
10056
|
+
}
|
|
10057
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10058
|
+
className: clsx(styles$5.deactivateSingle, 'iui__mb-16')
|
|
10059
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10060
|
+
className: styles$5.deactivateAlert
|
|
10061
|
+
}, /*#__PURE__*/React__default.createElement(InfoYellowIcon, {
|
|
10062
|
+
width: "9",
|
|
10063
|
+
height: "9"
|
|
10064
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
10065
|
+
variant: "body2"
|
|
10066
|
+
}, /*#__PURE__*/React__default.createElement("b", null, deactivateUser), " is linked with following role. You can deactivate only once you transfer the role to another user. The changes will reflect subsequently.", ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
10067
|
+
onClick: knowMore,
|
|
10068
|
+
className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
|
|
10069
|
+
}, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10070
|
+
className: "iui__mt-15"
|
|
10071
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
|
|
10072
|
+
isMove: true,
|
|
10073
|
+
additional: {
|
|
10074
|
+
page: 1,
|
|
10075
|
+
product: 'travel',
|
|
10076
|
+
userId: user.id
|
|
10077
|
+
},
|
|
10078
|
+
label: "Transfer approver role to",
|
|
10079
|
+
value: approverRole,
|
|
10080
|
+
onValueChange: selectApprover,
|
|
10081
|
+
loadOption: transferRoleOptions,
|
|
10082
|
+
disableText: "Please get in touch with your administrator to change this value.",
|
|
10083
|
+
customLoadingText: "No results found"
|
|
10084
|
+
}), approveeStatus && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10085
|
+
className: "iui__d-flex iui__align-items-baseline iui__mr-5"
|
|
10086
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(RedWarningIcon, null)), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10087
|
+
className: "iui__font--para-normal iui__font--color-black500 iui__mt-5 iui__ml-5"
|
|
10088
|
+
}, "The user you're deactivating is the approver of the user you're transferring the role to. If you continue, this user will become a self-approver"))))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
|
|
9026
10089
|
isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
|
|
9027
10090
|
closeHandler: closeDeActivateModal,
|
|
9028
10091
|
cancelLabel: "Cancel",
|
|
@@ -9048,7 +10111,124 @@ var UserList = function UserList(_ref) {
|
|
|
9048
10111
|
className: styles$5.headerText
|
|
9049
10112
|
}, 'Are you sure you want to deactivate ' + Object.values(selected).flat().length.toString() + (Object.values(selected).flat().length === 1 ? ' user ?' : ' users ?')), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
9050
10113
|
className: styles$5.description
|
|
9051
|
-
}, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(
|
|
10114
|
+
}, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
|
|
10115
|
+
isOpen: isBulkDeactivateModalOpen,
|
|
10116
|
+
closeHandler: closeDeActiveModal,
|
|
10117
|
+
cancelLabel: "Cancel",
|
|
10118
|
+
submitLabel: "Deactivate safe users",
|
|
10119
|
+
isDisabledSubmitBtn: !((selectedUsersNotApprover === null || selectedUsersNotApprover === void 0 ? void 0 : selectedUsersNotApprover.length) > 0),
|
|
10120
|
+
submitBtnClass: clsx(styles$5.deactivateSubmitBtn),
|
|
10121
|
+
customButtonLabel: "Deactivate all users",
|
|
10122
|
+
customButtonHandler: handleDeactivateUsers,
|
|
10123
|
+
submitHandler: handleDeactivateSafeUsers,
|
|
10124
|
+
width: "640px",
|
|
10125
|
+
customButtonClass: clsx(styles$5.deactivateCustomButtonClass),
|
|
10126
|
+
headerText: "Deactivate users?",
|
|
10127
|
+
modalBodyStyle: {
|
|
10128
|
+
maxHeight: 'calc(100vh - 50vh)'
|
|
10129
|
+
}
|
|
10130
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10131
|
+
className: clsx(styles$5.deactivateAlert, styles$5.warningSvg)
|
|
10132
|
+
}, /*#__PURE__*/React__default.createElement(RedWarningIcon, {
|
|
10133
|
+
color: "#9A6700",
|
|
10134
|
+
size: "14"
|
|
10135
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
10136
|
+
variant: "body2"
|
|
10137
|
+
}, "Some users are linked with approval roles. Deactivating these users will result in missing roles and approvers. Deactivate these users individually and transfer their roles to avoid missing roles. The changes will reflect subsequently.", ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
10138
|
+
onClick: knowMore,
|
|
10139
|
+
className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
|
|
10140
|
+
}, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10141
|
+
className: "iui__my-15"
|
|
10142
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10143
|
+
className: "iui__font--para-large iui__font--weight-medium"
|
|
10144
|
+
}, "Users with roles"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10145
|
+
className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
|
|
10146
|
+
}, "Deactivating these users will affect the associated approval rules."), (selectedUsersApprover === null || selectedUsersApprover === void 0 ? void 0 : selectedUsersApprover.length) && selectedUsersApprover.map(function (item, index) {
|
|
10147
|
+
var _item$data;
|
|
10148
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10149
|
+
key: index,
|
|
10150
|
+
className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
|
|
10151
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
|
|
10152
|
+
firstName: item.first_name,
|
|
10153
|
+
lastName: item.last_name,
|
|
10154
|
+
isLetterAvatar: "true",
|
|
10155
|
+
primaryText: item.first_name + ' ' + item.last_name,
|
|
10156
|
+
secondaryText: item.email,
|
|
10157
|
+
letterAvatarTextColor: "black",
|
|
10158
|
+
letterAvatarBackgroundColor: "#d3d3d3",
|
|
10159
|
+
profilePath: (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.profile_pic
|
|
10160
|
+
}), /*#__PURE__*/React__default.createElement(RedWarningIcon, {
|
|
10161
|
+
color: "#9A6700",
|
|
10162
|
+
size: "14"
|
|
10163
|
+
}));
|
|
10164
|
+
})), selectedUsersNotApprover !== null && selectedUsersNotApprover !== void 0 && selectedUsersNotApprover.length ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement("hr", {
|
|
10165
|
+
style: {
|
|
10166
|
+
borderColor: '#E5E9ED'
|
|
10167
|
+
}
|
|
10168
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10169
|
+
className: "iui__my-15"
|
|
10170
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10171
|
+
className: "iui__font--para-large iui__font--weight-medium"
|
|
10172
|
+
}, "Safe users"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10173
|
+
className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
|
|
10174
|
+
}, "These users are not linked to any roles and can be deactivated safely."), (selectedUsersNotApprover === null || selectedUsersNotApprover === void 0 ? void 0 : selectedUsersNotApprover.length) && selectedUsersNotApprover.map(function (item, index) {
|
|
10175
|
+
var _item$data2;
|
|
10176
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10177
|
+
key: index,
|
|
10178
|
+
className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
|
|
10179
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
|
|
10180
|
+
firstName: item.first_name,
|
|
10181
|
+
lastName: item.last_name,
|
|
10182
|
+
isLetterAvatar: "true",
|
|
10183
|
+
primaryText: item.first_name + ' ' + item.last_name,
|
|
10184
|
+
secondaryText: item.email,
|
|
10185
|
+
letterAvatarTextColor: "black",
|
|
10186
|
+
letterAvatarBackgroundColor: "#d3d3d3",
|
|
10187
|
+
profilePath: (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.profile_pic
|
|
10188
|
+
}));
|
|
10189
|
+
}))) : null), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
|
|
10190
|
+
isOpen: showInviteModal,
|
|
10191
|
+
closeHandler: function closeHandler() {
|
|
10192
|
+
return toggleInviteModalClose();
|
|
10193
|
+
},
|
|
10194
|
+
cancelLabel: "Cancel",
|
|
10195
|
+
headerText: "Resend Invites?",
|
|
10196
|
+
submitLabel: "Send",
|
|
10197
|
+
submitHandler: function submitHandler() {
|
|
10198
|
+
return onResendInviteHandler();
|
|
10199
|
+
},
|
|
10200
|
+
width: "400px",
|
|
10201
|
+
modalBodyStyle: {
|
|
10202
|
+
padding: '0px'
|
|
10203
|
+
},
|
|
10204
|
+
footerStyle: {
|
|
10205
|
+
justifyContent: 'center'
|
|
10206
|
+
}
|
|
10207
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
10208
|
+
style: {
|
|
10209
|
+
display: 'flex',
|
|
10210
|
+
padding: '16px',
|
|
10211
|
+
margin: '8px 24px',
|
|
10212
|
+
border: '1px solid #FDE047',
|
|
10213
|
+
background: '#FEFCE8',
|
|
10214
|
+
borderRadius: '5px'
|
|
10215
|
+
}
|
|
10216
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
10217
|
+
style: {
|
|
10218
|
+
marginRight: '5px'
|
|
10219
|
+
}
|
|
10220
|
+
}, /*#__PURE__*/React__default.createElement(InviteInfoIcon, null)), /*#__PURE__*/React__default.createElement("div", {
|
|
10221
|
+
style: {
|
|
10222
|
+
fontSize: '14px',
|
|
10223
|
+
color: '#374151'
|
|
10224
|
+
}
|
|
10225
|
+
}, "This invitation will be sent to", ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
10226
|
+
style: {
|
|
10227
|
+
fontSize: '14px',
|
|
10228
|
+
color: '#374151',
|
|
10229
|
+
fontWeight: 'bold'
|
|
10230
|
+
}
|
|
10231
|
+
}, userFirstName != null ? userFirstName + " " + userLastName : 'selected users'), ", who have not logged into the platform."))), /*#__PURE__*/React__default.createElement(BulkUploadModal, {
|
|
9052
10232
|
isOpenImportUsersModal: isOpenImportUsersModal,
|
|
9053
10233
|
closeImportUsersModal: closeImportUsersModal,
|
|
9054
10234
|
closeImportModal: closeImportModal
|
|
@@ -9057,8 +10237,8 @@ var UserList = function UserList(_ref) {
|
|
|
9057
10237
|
errMsg: hasVerificationError
|
|
9058
10238
|
}));
|
|
9059
10239
|
};
|
|
9060
|
-
var TabLabelCount = function TabLabelCount(
|
|
9061
|
-
var count =
|
|
10240
|
+
var TabLabelCount = function TabLabelCount(_ref5) {
|
|
10241
|
+
var count = _ref5.count;
|
|
9062
10242
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9063
10243
|
className: styles$5.TabLabelCount
|
|
9064
10244
|
}, " ", count, " ");
|
|
@@ -9133,11 +10313,12 @@ function Header(props) {
|
|
|
9133
10313
|
})));
|
|
9134
10314
|
}
|
|
9135
10315
|
|
|
9136
|
-
var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV","tableContainer":"_3xdGF"};
|
|
10316
|
+
var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","rowText":"_2XKxl","lightColor":"_3uyfh","buttonWidth":"_13tv0","readOnlyInput":"_3yYuQ","addUserButton":"_1zbr_","alertDescContainer":"_3h8DM","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV","tableContainer":"_3xdGF"};
|
|
9137
10317
|
|
|
9138
10318
|
function Listview(_ref) {
|
|
9139
10319
|
var data = _ref.data,
|
|
9140
10320
|
name = _ref.name,
|
|
10321
|
+
tableName = _ref.tableName,
|
|
9141
10322
|
handleEditDialog = _ref.handleEditDialog,
|
|
9142
10323
|
handleDeleteDialog = _ref.handleDeleteDialog,
|
|
9143
10324
|
orderBy = _ref.orderBy,
|
|
@@ -9150,10 +10331,16 @@ function Listview(_ref) {
|
|
|
9150
10331
|
handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
|
|
9151
10332
|
page = _ref.page,
|
|
9152
10333
|
rowsPerPage = _ref.rowsPerPage;
|
|
10334
|
+
var deptHeadDetails = function deptHeadDetails(data) {
|
|
10335
|
+
var _data$dept_head_detai;
|
|
10336
|
+
if ((data === null || data === void 0 ? void 0 : (_data$dept_head_detai = data.dept_head_details) === null || _data$dept_head_detai === void 0 ? void 0 : _data$dept_head_detai.length) > 0) {
|
|
10337
|
+
return data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name;
|
|
10338
|
+
}
|
|
10339
|
+
};
|
|
9153
10340
|
var columns = [{
|
|
9154
10341
|
id: 'name',
|
|
9155
10342
|
label: name,
|
|
9156
|
-
width: '
|
|
10343
|
+
width: '40%',
|
|
9157
10344
|
sortable: true,
|
|
9158
10345
|
cell: function cell(row) {
|
|
9159
10346
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
@@ -9163,7 +10350,7 @@ function Listview(_ref) {
|
|
|
9163
10350
|
}, {
|
|
9164
10351
|
id: 'no_of_users',
|
|
9165
10352
|
label: 'Number of users',
|
|
9166
|
-
width: '
|
|
10353
|
+
width: '40%',
|
|
9167
10354
|
sortable: true,
|
|
9168
10355
|
cell: function cell(row) {
|
|
9169
10356
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
@@ -9173,7 +10360,67 @@ function Listview(_ref) {
|
|
|
9173
10360
|
}, {
|
|
9174
10361
|
id: 'actions',
|
|
9175
10362
|
label: 'Actions',
|
|
9176
|
-
width: '
|
|
10363
|
+
width: '20%',
|
|
10364
|
+
cell: function cell(row) {
|
|
10365
|
+
return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10366
|
+
display: "flex"
|
|
10367
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
10368
|
+
buttonText: "Edit",
|
|
10369
|
+
className: styles$7.buttonWidth,
|
|
10370
|
+
onClick: function onClick() {
|
|
10371
|
+
return handleEditDialog(row);
|
|
10372
|
+
}
|
|
10373
|
+
}), row.no_of_users > 0 ? /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
10374
|
+
buttonText: "Delete",
|
|
10375
|
+
className: styles$7.buttonWidth,
|
|
10376
|
+
onClick: function onClick() {
|
|
10377
|
+
return handleDeleteDialog(row, true);
|
|
10378
|
+
}
|
|
10379
|
+
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
10380
|
+
buttonText: "Delete",
|
|
10381
|
+
className: styles$7.buttonWidth,
|
|
10382
|
+
onClick: function onClick() {
|
|
10383
|
+
return handleDeleteDialog(row, false);
|
|
10384
|
+
}
|
|
10385
|
+
}));
|
|
10386
|
+
}
|
|
10387
|
+
}];
|
|
10388
|
+
var departmentColumns = [{
|
|
10389
|
+
id: 'name',
|
|
10390
|
+
label: name,
|
|
10391
|
+
width: '30%',
|
|
10392
|
+
sortable: true,
|
|
10393
|
+
cell: function cell(row) {
|
|
10394
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10395
|
+
component: "div"
|
|
10396
|
+
}, row.name);
|
|
10397
|
+
}
|
|
10398
|
+
}, {
|
|
10399
|
+
id: 'department_head',
|
|
10400
|
+
label: 'Department head',
|
|
10401
|
+
width: '30%',
|
|
10402
|
+
sortable: true,
|
|
10403
|
+
cell: function cell(row) {
|
|
10404
|
+
return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10405
|
+
component: "div"
|
|
10406
|
+
}, deptHeadDetails(row)), row.is_default_dept_head && /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
10407
|
+
className: clsx(styles$7.rowText, styles$7.textTransform, styles$7.lightColor)
|
|
10408
|
+
}, "Assigned by default"));
|
|
10409
|
+
}
|
|
10410
|
+
}, {
|
|
10411
|
+
id: 'no_of_users',
|
|
10412
|
+
label: 'Number of users',
|
|
10413
|
+
width: '45%',
|
|
10414
|
+
sortable: false,
|
|
10415
|
+
cell: function cell(row) {
|
|
10416
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10417
|
+
component: "div"
|
|
10418
|
+
}, row.no_of_users);
|
|
10419
|
+
}
|
|
10420
|
+
}, {
|
|
10421
|
+
id: 'actions',
|
|
10422
|
+
label: 'Actions',
|
|
10423
|
+
width: '15%',
|
|
9177
10424
|
cell: function cell(row) {
|
|
9178
10425
|
return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9179
10426
|
display: "flex"
|
|
@@ -9206,7 +10453,7 @@ function Listview(_ref) {
|
|
|
9206
10453
|
hasFilter: true,
|
|
9207
10454
|
isCheckboxTable: false,
|
|
9208
10455
|
count: data.count,
|
|
9209
|
-
columns: columns,
|
|
10456
|
+
columns: tableName === 'department' ? departmentColumns : columns,
|
|
9210
10457
|
rows: data.results,
|
|
9211
10458
|
page: page,
|
|
9212
10459
|
handleChangePage: handleChangePage,
|
|
@@ -9263,16 +10510,43 @@ function EditPanelDialog(_ref) {
|
|
|
9263
10510
|
var isOpen = _ref.isOpen,
|
|
9264
10511
|
closeHandler = _ref.closeHandler,
|
|
9265
10512
|
onValueChange = _ref.onValueChange,
|
|
9266
|
-
|
|
10513
|
+
_submitHandler = _ref.submitHandler,
|
|
9267
10514
|
isError = _ref.isError,
|
|
9268
10515
|
name = _ref.name,
|
|
9269
10516
|
isDisabledSubmitBtn = _ref.isDisabledSubmitBtn,
|
|
9270
|
-
validation = _ref.validation
|
|
10517
|
+
validation = _ref.validation,
|
|
10518
|
+
rowData = _ref.rowData,
|
|
10519
|
+
tableName = _ref.tableName,
|
|
10520
|
+
config = _ref.config;
|
|
9271
10521
|
var _useSelector = reactRedux.useSelector(function (state) {
|
|
9272
10522
|
return state.userPanel;
|
|
9273
10523
|
}),
|
|
9274
10524
|
dialogData = _useSelector.dialogData;
|
|
9275
|
-
|
|
10525
|
+
var deptHeadDetails = function deptHeadDetails(data) {
|
|
10526
|
+
var _data$dept_head_detai;
|
|
10527
|
+
if ((data === null || data === void 0 ? void 0 : (_data$dept_head_detai = data.dept_head_details) === null || _data$dept_head_detai === void 0 ? void 0 : _data$dept_head_detai.length) > 0) {
|
|
10528
|
+
setHead({
|
|
10529
|
+
value: data.dept_head_details[0].id,
|
|
10530
|
+
label: data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name
|
|
10531
|
+
});
|
|
10532
|
+
}
|
|
10533
|
+
};
|
|
10534
|
+
var _useState = React.useState({
|
|
10535
|
+
value: '',
|
|
10536
|
+
label: 'Select'
|
|
10537
|
+
}),
|
|
10538
|
+
head = _useState[0],
|
|
10539
|
+
setHead = _useState[1];
|
|
10540
|
+
React.useEffect(function () {
|
|
10541
|
+
deptHeadDetails(rowData);
|
|
10542
|
+
}, [rowData]);
|
|
10543
|
+
var history = reactRouterDom.useHistory();
|
|
10544
|
+
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
10545
|
+
history.push({
|
|
10546
|
+
pathname: config.routes.users.add.path,
|
|
10547
|
+
state: rowData
|
|
10548
|
+
});
|
|
10549
|
+
};
|
|
9276
10550
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
|
|
9277
10551
|
isDisabledSubmitBtn: isDisabledSubmitBtn,
|
|
9278
10552
|
isOpen: isOpen,
|
|
@@ -9280,27 +10554,60 @@ function EditPanelDialog(_ref) {
|
|
|
9280
10554
|
headerText: "Edit " + name.toLowerCase(),
|
|
9281
10555
|
cancelLabel: (_dialogData$labels = dialogData.labels) === null || _dialogData$labels === void 0 ? void 0 : _dialogData$labels.cancelLabel,
|
|
9282
10556
|
submitLabel: (_dialogData$labels2 = dialogData.labels) === null || _dialogData$labels2 === void 0 ? void 0 : _dialogData$labels2.submitLabel,
|
|
9283
|
-
submitHandler: submitHandler
|
|
9284
|
-
|
|
10557
|
+
submitHandler: function submitHandler() {
|
|
10558
|
+
return _submitHandler(head);
|
|
10559
|
+
},
|
|
10560
|
+
width: tableName === 'department' ? '400px' : '365px',
|
|
9285
10561
|
hideCloseIcon: false,
|
|
9286
10562
|
modalBodyStyle: {
|
|
9287
|
-
|
|
9288
|
-
overflow: 'auto',
|
|
9289
|
-
margin: '0px'
|
|
10563
|
+
overflowY: 'visible'
|
|
9290
10564
|
},
|
|
9291
10565
|
footerStyle: {
|
|
9292
10566
|
justifyContent: 'end'
|
|
9293
10567
|
}
|
|
10568
|
+
}, tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10569
|
+
display: "flex",
|
|
10570
|
+
justifyContent: "center",
|
|
10571
|
+
alignItems: "center",
|
|
10572
|
+
flexDirection: "column",
|
|
10573
|
+
style: {
|
|
10574
|
+
marginBottom: '30px'
|
|
10575
|
+
}
|
|
9294
10576
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9295
|
-
component: "div",
|
|
9296
10577
|
display: "flex",
|
|
9297
10578
|
justifyContent: "center",
|
|
9298
10579
|
alignItems: "center",
|
|
9299
10580
|
flexDirection: "column",
|
|
9300
|
-
|
|
9301
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.
|
|
9302
|
-
|
|
9303
|
-
|
|
10581
|
+
className: styles$7.baseAlert
|
|
10582
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10583
|
+
className: styles$7.alertDescContainer
|
|
10584
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10585
|
+
className: styles$7.iconLayout,
|
|
10586
|
+
style: {
|
|
10587
|
+
paddingTop: '4px'
|
|
10588
|
+
}
|
|
10589
|
+
}, /*#__PURE__*/React__default.createElement(BoldInfoIcon, {
|
|
10590
|
+
color: "#CA8A04",
|
|
10591
|
+
width: "25",
|
|
10592
|
+
height: "20",
|
|
10593
|
+
className: styles$7.iconStyle
|
|
10594
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
10595
|
+
label: "By default, the primary admin gets assigned as the department head. This department has no users, so to change department head, add a new user.",
|
|
10596
|
+
style: {
|
|
10597
|
+
fontWeight: 'normal'
|
|
10598
|
+
}
|
|
10599
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
10600
|
+
buttonText: "Add user",
|
|
10601
|
+
type: "text",
|
|
10602
|
+
startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
|
|
10603
|
+
width: "9",
|
|
10604
|
+
height: "9",
|
|
10605
|
+
color: "#EC5D25"
|
|
10606
|
+
}),
|
|
10607
|
+
onClick: handleAddPageNavigation,
|
|
10608
|
+
className: styles$7.addUserButton
|
|
10609
|
+
}))), /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
|
|
10610
|
+
label: name + " name",
|
|
9304
10611
|
name: "name",
|
|
9305
10612
|
defaultValue: dialogData.data.name,
|
|
9306
10613
|
onValueChange: onValueChange,
|
|
@@ -9308,7 +10615,49 @@ function EditPanelDialog(_ref) {
|
|
|
9308
10615
|
isError: isError,
|
|
9309
10616
|
validation: validation,
|
|
9310
10617
|
errorMsg: "Please enter " + name.toLowerCase() + " name.",
|
|
9311
|
-
required: true
|
|
10618
|
+
required: true,
|
|
10619
|
+
style: tableName === 'department' && {
|
|
10620
|
+
width: '350px'
|
|
10621
|
+
}
|
|
10622
|
+
}), tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10623
|
+
className: "iui__mt-15",
|
|
10624
|
+
style: {
|
|
10625
|
+
width: '100%'
|
|
10626
|
+
}
|
|
10627
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
|
|
10628
|
+
label: "Department head",
|
|
10629
|
+
name: "name",
|
|
10630
|
+
defaultValue: head.label,
|
|
10631
|
+
placeholder: "",
|
|
10632
|
+
readOnly: true,
|
|
10633
|
+
style: {
|
|
10634
|
+
width: '350px'
|
|
10635
|
+
}
|
|
10636
|
+
})), tableName === 'department' && rowData.no_of_users > 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
10637
|
+
className: "iui__mt-15",
|
|
10638
|
+
style: {
|
|
10639
|
+
width: '100%'
|
|
10640
|
+
}
|
|
10641
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
|
|
10642
|
+
noResultsText: true,
|
|
10643
|
+
isMove: true,
|
|
10644
|
+
additional: {
|
|
10645
|
+
page: 1,
|
|
10646
|
+
departmentId: rowData.id
|
|
10647
|
+
},
|
|
10648
|
+
placeHolderCheck: head !== undefined && head.value === '',
|
|
10649
|
+
label: "Department head",
|
|
10650
|
+
value: head,
|
|
10651
|
+
onValueChange: function onValueChange(_ref2) {
|
|
10652
|
+
var _value = _ref2._value;
|
|
10653
|
+
return setHead(_value);
|
|
10654
|
+
},
|
|
10655
|
+
loadOption: departmentHeadOptions,
|
|
10656
|
+
disableText: "Please get in touch with your administrator to change this value.",
|
|
10657
|
+
customLoadingText: "No users found in this department",
|
|
10658
|
+
customLoadingTextStyle: {
|
|
10659
|
+
color: '#374151'
|
|
10660
|
+
}
|
|
9312
10661
|
})));
|
|
9313
10662
|
}
|
|
9314
10663
|
|
|
@@ -9487,12 +10836,15 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9487
10836
|
var _useState13 = React.useState(false),
|
|
9488
10837
|
isSortingChangeTemp = _useState13[0],
|
|
9489
10838
|
setSortingChangeTemp = _useState13[1];
|
|
9490
|
-
var _useState14 = React.useState(
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
var _useState15 = React.useState(
|
|
9494
|
-
|
|
9495
|
-
|
|
10839
|
+
var _useState14 = React.useState([]),
|
|
10840
|
+
rowData = _useState14[0],
|
|
10841
|
+
setRowData = _useState14[1];
|
|
10842
|
+
var _useState15 = React.useState(1),
|
|
10843
|
+
page = _useState15[0],
|
|
10844
|
+
setPage = _useState15[1];
|
|
10845
|
+
var _useState16 = React.useState(5),
|
|
10846
|
+
rowsPerPage = _useState16[0],
|
|
10847
|
+
setRowsPerPage = _useState16[1];
|
|
9496
10848
|
var orderingParam = orderBy;
|
|
9497
10849
|
var _useSelector = reactRedux.useSelector(function (state) {
|
|
9498
10850
|
return state.userPanel;
|
|
@@ -9505,18 +10857,25 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9505
10857
|
}),
|
|
9506
10858
|
isTokenVerified = _useSelector2.isTokenVerified,
|
|
9507
10859
|
hasVerificationError = _useSelector2.hasVerificationError;
|
|
9508
|
-
|
|
9509
10860
|
var onValueChange = function onValueChange(_ref2) {
|
|
9510
10861
|
var _value = _ref2._value;
|
|
9511
10862
|
var validatedValue = _value.replace(/\s+/g, ' ').trim();
|
|
9512
10863
|
setDataList(validatedValue);
|
|
9513
10864
|
};
|
|
10865
|
+
var _useState17 = React.useState(70),
|
|
10866
|
+
maxLengthForModal = _useState17[0],
|
|
10867
|
+
setMaxLengthForModal = _useState17[1];
|
|
10868
|
+
React.useEffect(function () {
|
|
10869
|
+
if (title === 'Business unit') {
|
|
10870
|
+
setMaxLengthForModal(150);
|
|
10871
|
+
}
|
|
10872
|
+
}, []);
|
|
9514
10873
|
var validation = {
|
|
9515
10874
|
regexOnChange: /^[(A-Z)(a-z)(0-9)&'\-_.,/: ]*$/,
|
|
9516
10875
|
regexOnBlur: null,
|
|
9517
10876
|
maxLimit: '',
|
|
9518
10877
|
minLimit: '',
|
|
9519
|
-
maxLength:
|
|
10878
|
+
maxLength: maxLengthForModal,
|
|
9520
10879
|
minLength: 0
|
|
9521
10880
|
};
|
|
9522
10881
|
React.useEffect(function () {
|
|
@@ -9589,6 +10948,7 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9589
10948
|
submitLabel: 'Save'
|
|
9590
10949
|
}, '', data));
|
|
9591
10950
|
setDataList(data.name);
|
|
10951
|
+
setRowData(data);
|
|
9592
10952
|
setEditModal(true);
|
|
9593
10953
|
};
|
|
9594
10954
|
var closeEditDialog = function closeEditDialog() {
|
|
@@ -9603,6 +10963,12 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9603
10963
|
var payload = {
|
|
9604
10964
|
names: [dataList]
|
|
9605
10965
|
};
|
|
10966
|
+
if (tableName === 'department') {
|
|
10967
|
+
payload = {
|
|
10968
|
+
name: dataList,
|
|
10969
|
+
department_head_id: null
|
|
10970
|
+
};
|
|
10971
|
+
}
|
|
9606
10972
|
var message = title + " added successfully.";
|
|
9607
10973
|
handleApiCall(addRecord, payload, message, 'add');
|
|
9608
10974
|
} else {
|
|
@@ -9616,10 +10982,12 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9616
10982
|
var message = title + " deleted successfully.";
|
|
9617
10983
|
handleApiCall(deleteRecord, payload, message, 'delete');
|
|
9618
10984
|
};
|
|
9619
|
-
|
|
9620
|
-
|
|
10985
|
+
var handleApiCall = function handleApiCall(dispatchFun, payload, message, type, optionalParams) {
|
|
10986
|
+
if (optionalParams === void 0) {
|
|
10987
|
+
optionalParams = null;
|
|
10988
|
+
}
|
|
9621
10989
|
dispatch(userPanelShowLoader());
|
|
9622
|
-
dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
|
|
10990
|
+
dispatch(dispatchFun(tableName, payload, getApiData(), optionalParams)).then(function (res) {
|
|
9623
10991
|
IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
|
|
9624
10992
|
dispatch(userPanelStopLoader());
|
|
9625
10993
|
if (type === 'delete') {
|
|
@@ -9661,8 +11029,14 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9661
11029
|
name: dataList
|
|
9662
11030
|
}]
|
|
9663
11031
|
};
|
|
11032
|
+
if (tableName === 'department') {
|
|
11033
|
+
payload = {
|
|
11034
|
+
name: dataList,
|
|
11035
|
+
department_head_id: data.value === '' || rowData.is_default_dept_head && rowData.dept_head === data.value ? null : data.value
|
|
11036
|
+
};
|
|
11037
|
+
}
|
|
9664
11038
|
var message = title + " updated successfully.";
|
|
9665
|
-
handleApiCall(editRecord, payload, message, 'edit');
|
|
11039
|
+
handleApiCall(editRecord, payload, message, 'edit', dialogData.data.id);
|
|
9666
11040
|
setErrorEdit(false);
|
|
9667
11041
|
} else {
|
|
9668
11042
|
setErrorEdit(true);
|
|
@@ -9769,7 +11143,10 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9769
11143
|
submitHandler: handleEditPanel,
|
|
9770
11144
|
isError: errorEdit,
|
|
9771
11145
|
isDisabledSubmitBtn: loading,
|
|
9772
|
-
validation: validation
|
|
11146
|
+
validation: validation,
|
|
11147
|
+
rowData: rowData,
|
|
11148
|
+
tableName: tableName,
|
|
11149
|
+
config: config
|
|
9773
11150
|
})) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
9774
11151
|
config: config
|
|
9775
11152
|
}));
|