@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.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
|
|
1
|
+
import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUISearch, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
|
|
2
2
|
import React, { useState, useEffect, useRef, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { configs, services, utilUrls } from '@itilite/utils';
|
|
4
4
|
import axios from 'axios';
|
|
@@ -9,12 +9,14 @@ import { combineReducers, createStore, applyMiddleware } from 'redux';
|
|
|
9
9
|
import thunk from 'redux-thunk';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { composeWithDevTools } from 'redux-devtools-extension';
|
|
12
|
-
import { useHistory } from 'react-router-dom';
|
|
13
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
12
|
+
import { useHistory, useLocation } from 'react-router-dom';
|
|
13
|
+
import { withStyles, makeStyles } from '@material-ui/core/styles';
|
|
14
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
14
15
|
import Switch from '@material-ui/core/Switch';
|
|
15
16
|
import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
|
|
16
17
|
import Button from '@material-ui/core/Button';
|
|
17
|
-
import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography } from '@material-ui/core';
|
|
18
|
+
import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography, Box } from '@material-ui/core';
|
|
19
|
+
import { useScrollPosition } from '@n8tb1t/use-scroll-position';
|
|
18
20
|
|
|
19
21
|
function _extends() {
|
|
20
22
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -30,6 +32,37 @@ function _extends() {
|
|
|
30
32
|
};
|
|
31
33
|
return _extends.apply(this, arguments);
|
|
32
34
|
}
|
|
35
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
36
|
+
if (!o) return;
|
|
37
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
38
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
40
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
41
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
42
|
+
}
|
|
43
|
+
function _arrayLikeToArray(arr, len) {
|
|
44
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
45
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
46
|
+
return arr2;
|
|
47
|
+
}
|
|
48
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
49
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
50
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
51
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
52
|
+
if (it) o = it;
|
|
53
|
+
var i = 0;
|
|
54
|
+
return function () {
|
|
55
|
+
if (i >= o.length) return {
|
|
56
|
+
done: true
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
done: false,
|
|
60
|
+
value: o[i++]
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
65
|
+
}
|
|
33
66
|
|
|
34
67
|
var _Pact = /*#__PURE__*/function () {
|
|
35
68
|
function _Pact() {}
|
|
@@ -67,7 +100,6 @@ var _Pact = /*#__PURE__*/function () {
|
|
|
67
100
|
};
|
|
68
101
|
return _Pact;
|
|
69
102
|
}();
|
|
70
|
-
|
|
71
103
|
function _settle(pact, state, value) {
|
|
72
104
|
if (!pact.s) {
|
|
73
105
|
if (value instanceof _Pact) {
|
|
@@ -96,7 +128,6 @@ function _settle(pact, state, value) {
|
|
|
96
128
|
function _isSettledPact(thenable) {
|
|
97
129
|
return thenable instanceof _Pact && thenable.s & 1;
|
|
98
130
|
}
|
|
99
|
-
|
|
100
131
|
function _forTo(array, body, check) {
|
|
101
132
|
var i = -1,
|
|
102
133
|
pact,
|
|
@@ -128,7 +159,6 @@ function _forTo(array, body, check) {
|
|
|
128
159
|
}
|
|
129
160
|
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
|
|
130
161
|
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
131
|
-
|
|
132
162
|
function _catch(body, recover) {
|
|
133
163
|
try {
|
|
134
164
|
var result = body();
|
|
@@ -147,17 +177,11 @@ function r(e) {
|
|
|
147
177
|
var t,
|
|
148
178
|
f,
|
|
149
179
|
n = "";
|
|
150
|
-
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++)
|
|
151
|
-
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
152
|
-
} else for (t in e) {
|
|
153
|
-
e[t] && (n && (n += " "), n += t);
|
|
154
|
-
}
|
|
180
|
+
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);
|
|
155
181
|
return n;
|
|
156
182
|
}
|
|
157
183
|
function clsx() {
|
|
158
|
-
for (var e, t, f = 0, n = ""; f < arguments.length;)
|
|
159
|
-
(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
160
|
-
}
|
|
184
|
+
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
161
185
|
return n;
|
|
162
186
|
}
|
|
163
187
|
|
|
@@ -361,6 +385,9 @@ var userAddEditUrl = {
|
|
|
361
385
|
approversSearch: function approversSearch() {
|
|
362
386
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/company-approvers";
|
|
363
387
|
},
|
|
388
|
+
transferAppover: function transferAppover() {
|
|
389
|
+
return "api/v1/user-management/users/single-user/transfer-approver-role?";
|
|
390
|
+
},
|
|
364
391
|
preSignedUrl: function preSignedUrl() {
|
|
365
392
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/presigned-url";
|
|
366
393
|
},
|
|
@@ -393,6 +420,12 @@ var userAddEditUrl = {
|
|
|
393
420
|
},
|
|
394
421
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
395
422
|
return "api/v1/onboarding/user-signup-reject/" + userId + "?action=undo";
|
|
423
|
+
},
|
|
424
|
+
cardsEditUserDetails: function cardsEditUserDetails(userId) {
|
|
425
|
+
return env.getCardsapiURL() + "/authorization/user/" + userId;
|
|
426
|
+
},
|
|
427
|
+
cardsAddUsersDetails: function cardsAddUsersDetails() {
|
|
428
|
+
return env.getCardsapiURL() + "/authorization/company/" + IUILocalStorageService.getCompanyId() + "/roles";
|
|
396
429
|
}
|
|
397
430
|
};
|
|
398
431
|
var userListUrl = {
|
|
@@ -448,15 +481,23 @@ var userPanelUrl = {
|
|
|
448
481
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?action=delete&table=" + tableName;
|
|
449
482
|
},
|
|
450
483
|
getUnit: function getUnit(tableName, length, sort) {
|
|
451
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&
|
|
484
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&ordering=" + sort;
|
|
452
485
|
},
|
|
453
486
|
getPaginationUnit: function getPaginationUnit(tableName, length, page, sort) {
|
|
454
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&
|
|
487
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&ordering=" + sort;
|
|
455
488
|
},
|
|
456
489
|
moveUnit: function moveUnit() {
|
|
457
490
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
|
|
458
491
|
}
|
|
459
492
|
};
|
|
493
|
+
var departmentUrl = {
|
|
494
|
+
departmentUrl: function departmentUrl() {
|
|
495
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department";
|
|
496
|
+
},
|
|
497
|
+
getDepartmentHead: function getDepartmentHead(departmentId, page) {
|
|
498
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department/" + departmentId + "/users?page=" + page;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
460
501
|
|
|
461
502
|
var api = configs.api;
|
|
462
503
|
var NAoptionConfig = {
|
|
@@ -466,7 +507,6 @@ var NAoptionConfig = {
|
|
|
466
507
|
},
|
|
467
508
|
applyFor: ['employee_level', 'department']
|
|
468
509
|
};
|
|
469
|
-
|
|
470
510
|
var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
|
|
471
511
|
var page = _ref.page,
|
|
472
512
|
tabelName = _ref.tabelName,
|
|
@@ -599,11 +639,53 @@ var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _r
|
|
|
599
639
|
return Promise.reject(e);
|
|
600
640
|
}
|
|
601
641
|
};
|
|
602
|
-
var
|
|
642
|
+
var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _ref4) {
|
|
603
643
|
var page = _ref4.page,
|
|
604
644
|
product = _ref4.product,
|
|
605
|
-
userId = _ref4.userId
|
|
606
|
-
|
|
645
|
+
userId = _ref4.userId;
|
|
646
|
+
try {
|
|
647
|
+
return Promise.resolve(_catch(function () {
|
|
648
|
+
return Promise.resolve(api.get(userAddEditUrl.transferAppover() + "user_id=" + userId + "&page=" + page + "&search=" + search).then(function (res) {
|
|
649
|
+
return res.data;
|
|
650
|
+
})).then(function (response) {
|
|
651
|
+
var mappedValue = response.results.map(function (item) {
|
|
652
|
+
return {
|
|
653
|
+
value: item.email,
|
|
654
|
+
label: item.email,
|
|
655
|
+
type: 'detailed',
|
|
656
|
+
data: item
|
|
657
|
+
};
|
|
658
|
+
});
|
|
659
|
+
return {
|
|
660
|
+
options: mappedValue,
|
|
661
|
+
hasMore: !!response.next,
|
|
662
|
+
additional: {
|
|
663
|
+
page: page + 1,
|
|
664
|
+
product: product,
|
|
665
|
+
userId: userId
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
});
|
|
669
|
+
}, function () {
|
|
670
|
+
return {
|
|
671
|
+
options: [],
|
|
672
|
+
hasMore: false,
|
|
673
|
+
additional: {
|
|
674
|
+
page: 1,
|
|
675
|
+
product: product,
|
|
676
|
+
userId: userId
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
}));
|
|
680
|
+
} catch (e) {
|
|
681
|
+
return Promise.reject(e);
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
685
|
+
var page = _ref5.page,
|
|
686
|
+
product = _ref5.product,
|
|
687
|
+
userId = _ref5.userId,
|
|
688
|
+
placeholder = _ref5.placeholder;
|
|
607
689
|
try {
|
|
608
690
|
return Promise.resolve(_catch(function () {
|
|
609
691
|
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
@@ -649,9 +731,9 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
|
649
731
|
return Promise.reject(e);
|
|
650
732
|
}
|
|
651
733
|
};
|
|
652
|
-
var countryOptions = function countryOptions(search, loadedOptions,
|
|
653
|
-
var page =
|
|
654
|
-
tabelName =
|
|
734
|
+
var countryOptions = function countryOptions(search, loadedOptions, _ref6) {
|
|
735
|
+
var page = _ref6.page,
|
|
736
|
+
tabelName = _ref6.tabelName;
|
|
655
737
|
try {
|
|
656
738
|
return Promise.resolve(_catch(function () {
|
|
657
739
|
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
@@ -663,7 +745,6 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
|
663
745
|
label: item[tabelName]
|
|
664
746
|
};
|
|
665
747
|
});
|
|
666
|
-
|
|
667
748
|
return {
|
|
668
749
|
options: mappedValue,
|
|
669
750
|
hasMore: !!response.next,
|
|
@@ -687,6 +768,45 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
|
687
768
|
return Promise.reject(e);
|
|
688
769
|
}
|
|
689
770
|
};
|
|
771
|
+
var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions, _ref7) {
|
|
772
|
+
var page = _ref7.page,
|
|
773
|
+
departmentId = _ref7.departmentId;
|
|
774
|
+
try {
|
|
775
|
+
return Promise.resolve(_catch(function () {
|
|
776
|
+
return Promise.resolve(api.get(departmentUrl.getDepartmentHead(departmentId, page) + "&search=" + search).then(function (res) {
|
|
777
|
+
return res.data;
|
|
778
|
+
})).then(function (response) {
|
|
779
|
+
var mappedValue = response.results.map(function (item) {
|
|
780
|
+
return {
|
|
781
|
+
value: item.id,
|
|
782
|
+
label: item.first_name + ' ' + item.last_name,
|
|
783
|
+
type: 'detailed',
|
|
784
|
+
data: item
|
|
785
|
+
};
|
|
786
|
+
});
|
|
787
|
+
return {
|
|
788
|
+
options: mappedValue,
|
|
789
|
+
hasMore: !!response.next,
|
|
790
|
+
additional: {
|
|
791
|
+
page: page + 1,
|
|
792
|
+
departmentId: departmentId
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
});
|
|
796
|
+
}, function () {
|
|
797
|
+
return {
|
|
798
|
+
options: [],
|
|
799
|
+
hasMore: false,
|
|
800
|
+
additional: {
|
|
801
|
+
page: 1,
|
|
802
|
+
departmentId: departmentId
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
}));
|
|
806
|
+
} catch (e) {
|
|
807
|
+
return Promise.reject(e);
|
|
808
|
+
}
|
|
809
|
+
};
|
|
690
810
|
|
|
691
811
|
var UserRole = function UserRole(_ref) {
|
|
692
812
|
var _ref$list = _ref.list,
|
|
@@ -708,6 +828,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
708
828
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
709
829
|
var STOP_LOADER = 'STOP_LOADER';
|
|
710
830
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
831
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
711
832
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
712
833
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
713
834
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -752,9 +873,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
752
873
|
if (payload.productAccess.expense) {
|
|
753
874
|
product.expense = payload.expenseRole || null;
|
|
754
875
|
}
|
|
876
|
+
if (payload.productAccess.card) {
|
|
877
|
+
var splitRole = payload.cardsRole.split(":");
|
|
878
|
+
var cardsUsmRole = splitRole[2];
|
|
879
|
+
product.card = cardsUsmRole || null;
|
|
880
|
+
}
|
|
755
881
|
return product;
|
|
756
882
|
}(),
|
|
757
|
-
approvers: {}
|
|
883
|
+
approvers: {},
|
|
884
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
758
885
|
};
|
|
759
886
|
var userTags = [];
|
|
760
887
|
for (var key in payload.userTagType) {
|
|
@@ -765,7 +892,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
765
892
|
if (userTags.length) {
|
|
766
893
|
res.user_tags = userTags;
|
|
767
894
|
}
|
|
768
|
-
|
|
769
895
|
if (payload.productAccess.travel) {
|
|
770
896
|
var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
|
|
771
897
|
res.approvers.travel = [];
|
|
@@ -777,14 +903,12 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
777
903
|
});
|
|
778
904
|
}
|
|
779
905
|
}
|
|
780
|
-
|
|
781
906
|
if (payload.travelFYI && payload.travelFYI.value) {
|
|
782
907
|
res.approvers.travel.push({
|
|
783
908
|
email: payload.travelFYI.value,
|
|
784
909
|
sequence: 'fyi'
|
|
785
910
|
});
|
|
786
911
|
}
|
|
787
|
-
|
|
788
912
|
res.user_travel_info = {
|
|
789
913
|
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,
|
|
790
914
|
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,
|
|
@@ -823,7 +947,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
823
947
|
res.files = [];
|
|
824
948
|
}
|
|
825
949
|
}
|
|
826
|
-
|
|
827
950
|
if (payload.productAccess.expense) {
|
|
828
951
|
res.approvers.expense = [];
|
|
829
952
|
for (var _key2 in payload.expenseApproversInput) {
|
|
@@ -834,7 +957,6 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
834
957
|
});
|
|
835
958
|
}
|
|
836
959
|
}
|
|
837
|
-
|
|
838
960
|
if (payload.expenseFYI && payload.expenseFYI.value) {
|
|
839
961
|
res.approvers.expense.push({
|
|
840
962
|
email: payload.expenseFYI.value,
|
|
@@ -851,13 +973,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
851
973
|
var res = {
|
|
852
974
|
fields: {
|
|
853
975
|
user_personal_info: {},
|
|
854
|
-
employee_info: {}
|
|
976
|
+
employee_info: {},
|
|
977
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
855
978
|
}
|
|
856
979
|
};
|
|
857
980
|
if (!env$1.isProfilePage()) {
|
|
858
981
|
res.fields.product = function () {
|
|
859
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
982
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.card) {
|
|
983
|
+
return 'expense+travel+card';
|
|
984
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
860
985
|
return 'expense+travel';
|
|
986
|
+
} else if (payload.productAccess.expense && payload.productAccess.card) {
|
|
987
|
+
return 'expense+card';
|
|
988
|
+
} else if (payload.productAccess.travel && payload.productAccess.card) {
|
|
989
|
+
return 'travel+card';
|
|
861
990
|
} else if (payload.productAccess.travel) {
|
|
862
991
|
return 'travel';
|
|
863
992
|
} else {
|
|
@@ -872,6 +1001,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
872
1001
|
if (payload.productAccess.expense) {
|
|
873
1002
|
roles.expense = payload.expenseRole;
|
|
874
1003
|
}
|
|
1004
|
+
if (payload.productAccess.card) {
|
|
1005
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1006
|
+
var cardsUsmRole = splitRole[2];
|
|
1007
|
+
roles.card = cardsUsmRole;
|
|
1008
|
+
}
|
|
875
1009
|
return roles;
|
|
876
1010
|
}();
|
|
877
1011
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -942,7 +1076,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
942
1076
|
});
|
|
943
1077
|
}
|
|
944
1078
|
}
|
|
945
|
-
|
|
946
1079
|
if (payload.travelFYI && payload.travelFYI.value) {
|
|
947
1080
|
res.fields.approvers.travel.push({
|
|
948
1081
|
email: payload.travelFYI.value,
|
|
@@ -1019,7 +1152,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1019
1152
|
res.fields.user_travel_info.redress_number = payload.secureTravelInputInfo.redress_number || null;
|
|
1020
1153
|
}
|
|
1021
1154
|
}
|
|
1022
|
-
|
|
1023
1155
|
if (payload.productAccess.expense) {
|
|
1024
1156
|
if (!env$1.isProfilePage()) {
|
|
1025
1157
|
res.fields.approvers.expense = [];
|
|
@@ -1031,7 +1163,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1031
1163
|
});
|
|
1032
1164
|
}
|
|
1033
1165
|
}
|
|
1034
|
-
|
|
1035
1166
|
if (payload.expenseFYI && payload.expenseFYI.value) {
|
|
1036
1167
|
res.fields.approvers.expense.push({
|
|
1037
1168
|
email: payload.expenseFYI.value,
|
|
@@ -1163,10 +1294,19 @@ var updateTabValue = function updateTabValue(tabId) {
|
|
|
1163
1294
|
payload: tabId
|
|
1164
1295
|
};
|
|
1165
1296
|
};
|
|
1166
|
-
var updateActiveStatus = function updateActiveStatus(activateVal, id) {
|
|
1297
|
+
var updateActiveStatus = function updateActiveStatus(activateVal, id, roleTransfer, newApproverUserId) {
|
|
1298
|
+
if (roleTransfer === void 0) {
|
|
1299
|
+
roleTransfer = false;
|
|
1300
|
+
}
|
|
1301
|
+
var _payload = {
|
|
1302
|
+
role_transfer: roleTransfer
|
|
1303
|
+
};
|
|
1304
|
+
if (roleTransfer) {
|
|
1305
|
+
_payload.new_approver_user_id = newApproverUserId;
|
|
1306
|
+
}
|
|
1167
1307
|
return function (dispatch) {
|
|
1168
1308
|
return new Promise(function (resolve, reject) {
|
|
1169
|
-
api$1.
|
|
1309
|
+
api$1.put(userListUrl.updateActiveStatus + "user_id=" + id + "&activate=" + activateVal, _payload).then(function (res) {
|
|
1170
1310
|
dispatch(setUserActiveStatus({
|
|
1171
1311
|
is_active: activateVal !== 0,
|
|
1172
1312
|
id: id
|
|
@@ -1204,6 +1344,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1204
1344
|
payload: payload
|
|
1205
1345
|
};
|
|
1206
1346
|
};
|
|
1347
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1348
|
+
return {
|
|
1349
|
+
type: SET_CARDS_DETAILS,
|
|
1350
|
+
payload: payload
|
|
1351
|
+
};
|
|
1352
|
+
};
|
|
1207
1353
|
var setCustomField = function setCustomField(payload) {
|
|
1208
1354
|
return {
|
|
1209
1355
|
type: SET_CUSTOM_FIELD,
|
|
@@ -1263,7 +1409,6 @@ var fetchRenderFileds = function fetchRenderFileds() {
|
|
|
1263
1409
|
var _res$data;
|
|
1264
1410
|
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.');
|
|
1265
1411
|
dispatch(stopLoader());
|
|
1266
|
-
reject();
|
|
1267
1412
|
}
|
|
1268
1413
|
})["catch"](function (err) {
|
|
1269
1414
|
reject(err);
|
|
@@ -1276,7 +1421,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
|
|
|
1276
1421
|
return new Promise(function (resolve, reject) {
|
|
1277
1422
|
api$2.get(userAddEditUrl.countryCode()).then(function (res) {
|
|
1278
1423
|
dispatch(setCountryCodes(res.data.country_code_details));
|
|
1279
|
-
resolve(
|
|
1424
|
+
resolve(res.data.country_code_details);
|
|
1280
1425
|
})["catch"](function (err) {
|
|
1281
1426
|
reject(err);
|
|
1282
1427
|
})["finally"](function () {});
|
|
@@ -1435,11 +1580,9 @@ var createUser = function createUser(payload) {
|
|
|
1435
1580
|
} else {
|
|
1436
1581
|
if (res.data.errors && typeof res.data.errors === 'object') {
|
|
1437
1582
|
reject(res.data.errors);
|
|
1438
|
-
return;
|
|
1439
1583
|
} else if (!Object.keys(res.data.errors).length) {
|
|
1440
1584
|
IUIToastMessageService$1.warningNotify(res.data.message);
|
|
1441
1585
|
}
|
|
1442
|
-
reject();
|
|
1443
1586
|
}
|
|
1444
1587
|
})["catch"](function (err) {
|
|
1445
1588
|
var _err$response6;
|
|
@@ -1485,17 +1628,13 @@ var uploadSingleDocumnet = function uploadSingleDocumnet(payload) {
|
|
|
1485
1628
|
});
|
|
1486
1629
|
};
|
|
1487
1630
|
};
|
|
1488
|
-
|
|
1489
1631
|
var uploadFileToS3 = function uploadFileToS3(presignedPostData, file) {
|
|
1490
1632
|
return new Promise(function (resolve, reject) {
|
|
1491
1633
|
var formData = new FormData();
|
|
1492
|
-
|
|
1493
1634
|
Object.keys(presignedPostData.fields).forEach(function (key) {
|
|
1494
1635
|
formData.append(key, presignedPostData.fields[key]);
|
|
1495
1636
|
});
|
|
1496
|
-
|
|
1497
1637
|
formData.append('file', file);
|
|
1498
|
-
|
|
1499
1638
|
axios.post(presignedPostData.url, formData, {
|
|
1500
1639
|
headers: {
|
|
1501
1640
|
'Content-Type': 'multipart/form-data'
|
|
@@ -1540,20 +1679,43 @@ var makePrimaryAdmin = function makePrimaryAdmin(payload) {
|
|
|
1540
1679
|
});
|
|
1541
1680
|
};
|
|
1542
1681
|
};
|
|
1543
|
-
var
|
|
1682
|
+
var resetPasswordForUser = function resetPasswordForUser(data) {
|
|
1544
1683
|
return function (dispatch) {
|
|
1545
1684
|
return new Promise(function (resolve, reject) {
|
|
1546
|
-
api$2.
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1685
|
+
api$2.post("" + userAddEditUrl.resetPasswordForUserApi(), {
|
|
1686
|
+
email: data.email
|
|
1687
|
+
}).then(function (res) {
|
|
1688
|
+
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.");
|
|
1689
|
+
resolve();
|
|
1690
|
+
})["catch"](function (err) {
|
|
1691
|
+
var _err$response9, _err$response9$data;
|
|
1692
|
+
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)) {
|
|
1693
|
+
var _err$response10, _err$response10$data, _err$response10$data$;
|
|
1694
|
+
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]);
|
|
1695
|
+
reject(err);
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
reject(err);
|
|
1699
|
+
});
|
|
1700
|
+
});
|
|
1701
|
+
};
|
|
1702
|
+
};
|
|
1703
|
+
var resendInviteForUser = function resendInviteForUser(data) {
|
|
1704
|
+
return function (dispatch) {
|
|
1705
|
+
return new Promise(function (resolve, reject) {
|
|
1706
|
+
api$2.post(userAddEditUrl.resendInviteForUserApi(), {
|
|
1707
|
+
user_ids: data
|
|
1708
|
+
}).then(function (res) {
|
|
1709
|
+
IUIToastMessageService$1.sNotify(res.data.message);
|
|
1553
1710
|
resolve();
|
|
1554
1711
|
})["catch"](function (err) {
|
|
1555
|
-
var _err$
|
|
1556
|
-
|
|
1712
|
+
var _err$response11, _err$response11$data;
|
|
1713
|
+
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)) {
|
|
1714
|
+
var _err$response12, _err$response12$data, _err$response12$data$;
|
|
1715
|
+
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]);
|
|
1716
|
+
reject(err);
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1557
1719
|
reject(err);
|
|
1558
1720
|
});
|
|
1559
1721
|
});
|
|
@@ -1695,7 +1857,7 @@ var verifyUserInfo = function verifyUserInfo(userId) {
|
|
|
1695
1857
|
var submitAddModalData = function submitAddModalData(tableName, data) {
|
|
1696
1858
|
return function (dispatch) {
|
|
1697
1859
|
return new Promise(function (resolve, reject) {
|
|
1698
|
-
api$2.post(userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
|
|
1860
|
+
api$2.post(tableName === 'department' ? departmentUrl.departmentUrl() : userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
|
|
1699
1861
|
resolve(res);
|
|
1700
1862
|
})["catch"](function (err) {
|
|
1701
1863
|
var _err$response17, _err$response17$data;
|
|
@@ -1731,6 +1893,7 @@ var OPEN_DIALOG = 'OPEN_DIALOG';
|
|
|
1731
1893
|
var CLOSE_DIALOG = 'CLOSE_DIALOG';
|
|
1732
1894
|
var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
|
|
1733
1895
|
var UNASSIGNED_USERS = 'Not assigned';
|
|
1896
|
+
var FETCH_DEPARTMENT_USERS_DATA = 'FETCH_DEPARTMENT_USERS_DATA';
|
|
1734
1897
|
|
|
1735
1898
|
var api$3 = configs.api;
|
|
1736
1899
|
var IUIToastMessageService$2 = services.IUIToastMessageService;
|
|
@@ -1777,18 +1940,17 @@ var getUserPanalData = function getUserPanalData(params) {
|
|
|
1777
1940
|
});
|
|
1778
1941
|
};
|
|
1779
1942
|
};
|
|
1780
|
-
|
|
1781
1943
|
var addRecord = function addRecord(tableName, data, getParam) {
|
|
1782
1944
|
return function (dispatch) {
|
|
1783
1945
|
return new Promise(function (resolve, reject) {
|
|
1784
|
-
api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
1946
|
+
api$3.post(tableName === 'department' ? departmentUrl.departmentUrl() : userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
1785
1947
|
dispatch(getUserPanalData(getParam));
|
|
1786
1948
|
dispatch(closeDialog());
|
|
1787
1949
|
resolve(res);
|
|
1788
1950
|
})["catch"](function (err) {
|
|
1789
|
-
var _err$
|
|
1951
|
+
var _err$response3, _err$response3$data;
|
|
1790
1952
|
dispatch(userPanelStopLoader());
|
|
1791
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
1953
|
+
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.');
|
|
1792
1954
|
});
|
|
1793
1955
|
});
|
|
1794
1956
|
};
|
|
@@ -1802,25 +1964,37 @@ var deleteRecord = function deleteRecord(tableName, id, getParam) {
|
|
|
1802
1964
|
dispatch(userPanelStopLoader());
|
|
1803
1965
|
resolve();
|
|
1804
1966
|
})["catch"](function (err) {
|
|
1805
|
-
var _err$
|
|
1806
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
1967
|
+
var _err$response4, _err$response4$data;
|
|
1968
|
+
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.');
|
|
1807
1969
|
dispatch(userPanelStopLoader());
|
|
1808
1970
|
});
|
|
1809
1971
|
});
|
|
1810
1972
|
};
|
|
1811
1973
|
};
|
|
1812
|
-
var editRecord = function editRecord(tableName, data, getParam) {
|
|
1974
|
+
var editRecord = function editRecord(tableName, data, getParam, optionalParams) {
|
|
1813
1975
|
return function (dispatch) {
|
|
1814
1976
|
return new Promise(function (resolve, reject) {
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1977
|
+
if (tableName === 'department') {
|
|
1978
|
+
api$3.put(departmentUrl.departmentUrl() + "/" + optionalParams, data).then(function (res) {
|
|
1979
|
+
dispatch(getUserPanalData(getParam));
|
|
1980
|
+
dispatch(closeDialog());
|
|
1981
|
+
resolve();
|
|
1982
|
+
})["catch"](function (err) {
|
|
1983
|
+
var _err$response5, _err$response5$data;
|
|
1984
|
+
dispatch(userPanelStopLoader());
|
|
1985
|
+
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.');
|
|
1986
|
+
});
|
|
1987
|
+
} else {
|
|
1988
|
+
api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
|
|
1989
|
+
dispatch(getUserPanalData(getParam));
|
|
1990
|
+
dispatch(closeDialog());
|
|
1991
|
+
resolve();
|
|
1992
|
+
})["catch"](function (err) {
|
|
1993
|
+
var _err$response6, _err$response6$data;
|
|
1994
|
+
dispatch(userPanelStopLoader());
|
|
1995
|
+
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.');
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1824
1998
|
});
|
|
1825
1999
|
};
|
|
1826
2000
|
};
|
|
@@ -1832,8 +2006,8 @@ var moveRecord = function moveRecord(tableName, data, getParam) {
|
|
|
1832
2006
|
dispatch(closeDialog());
|
|
1833
2007
|
resolve(res);
|
|
1834
2008
|
})["catch"](function (err) {
|
|
1835
|
-
var _err$
|
|
1836
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2009
|
+
var _err$response7, _err$response7$data;
|
|
2010
|
+
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.');
|
|
1837
2011
|
});
|
|
1838
2012
|
});
|
|
1839
2013
|
};
|
|
@@ -2153,7 +2327,7 @@ var PaymentCards = function PaymentCards(_ref3) {
|
|
|
2153
2327
|
isDefaultCard: !!+card.metadata.default_card,
|
|
2154
2328
|
pg: paymentDetails.pg
|
|
2155
2329
|
});
|
|
2156
|
-
}), (!paymentDetails.cards || paymentDetails.cards.length <
|
|
2330
|
+
}), (!paymentDetails.cards || paymentDetails.cards.length < 10) && paymentDetails.pg.gateway.toLowerCase() === 'stripe' && paymentDetails.pg.save_card_enable === 1 && /*#__PURE__*/React.createElement(AddCard, {
|
|
2157
2331
|
pg: paymentDetails.pg
|
|
2158
2332
|
}))))));
|
|
2159
2333
|
};
|
|
@@ -2321,7 +2495,6 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
2321
2495
|
setOpenEditAproverModalFlag(false);
|
|
2322
2496
|
});
|
|
2323
2497
|
};
|
|
2324
|
-
|
|
2325
2498
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
2326
2499
|
container: true,
|
|
2327
2500
|
className: (styles.headingPadding)
|
|
@@ -2469,8 +2642,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
2469
2642
|
headerText: "Edit approver field",
|
|
2470
2643
|
cancelLabel: "Cancel",
|
|
2471
2644
|
submitLabel: "Save",
|
|
2472
|
-
submitHandler: handleEditAproverLabel
|
|
2473
|
-
,
|
|
2645
|
+
submitHandler: handleEditAproverLabel,
|
|
2474
2646
|
width: "420px",
|
|
2475
2647
|
modalBodyStyle: {
|
|
2476
2648
|
maxHeight: '600px',
|
|
@@ -2924,8 +3096,8 @@ var workInfo = [{
|
|
|
2924
3096
|
validation: {
|
|
2925
3097
|
regexOnChange: null,
|
|
2926
3098
|
regexOnBlur: [{
|
|
2927
|
-
regex: /^[(A-Z)(a-z)(0-9)
|
|
2928
|
-
message: "Only alphabets, numbers and
|
|
3099
|
+
regex: /^[(A-Z)(a-z)(0-9)\-_& ]*$/,
|
|
3100
|
+
message: "Only alphabets, numbers, - and _ & are allowed."
|
|
2929
3101
|
}],
|
|
2930
3102
|
maxLimit: '',
|
|
2931
3103
|
minLimit: '',
|
|
@@ -3013,8 +3185,8 @@ var workInfo = [{
|
|
|
3013
3185
|
validation: {
|
|
3014
3186
|
regexOnChange: null,
|
|
3015
3187
|
regexOnBlur: [{
|
|
3016
|
-
regex: /^[A-Za-z0-9
|
|
3017
|
-
message: "Only alphabets, numbers & special characters . & ' ( ) - , / are allowed."
|
|
3188
|
+
regex: /^[A-Za-z0-9 \-_.,&'()\/]*$/,
|
|
3189
|
+
message: "Only alphabets, numbers & special characters . & ' ( ) _ - , / are allowed."
|
|
3018
3190
|
}, {
|
|
3019
3191
|
regex: /^[a-zA-Z]/,
|
|
3020
3192
|
message: 'Designation should start with alphabets'
|
|
@@ -3025,31 +3197,6 @@ var workInfo = [{
|
|
|
3025
3197
|
minLength: 0
|
|
3026
3198
|
},
|
|
3027
3199
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3028
|
-
}, {
|
|
3029
|
-
id: 7,
|
|
3030
|
-
label: 'Manager',
|
|
3031
|
-
name: 'manager',
|
|
3032
|
-
required: false,
|
|
3033
|
-
type: 'async_select',
|
|
3034
|
-
fullWidth: false,
|
|
3035
|
-
visibility: true,
|
|
3036
|
-
readOnly: false,
|
|
3037
|
-
placeholder: 'Select manager',
|
|
3038
|
-
tabelName: 'manager',
|
|
3039
|
-
product: 'travel',
|
|
3040
|
-
loadOption: approversOptions
|
|
3041
|
-
}, {
|
|
3042
|
-
id: 8,
|
|
3043
|
-
label: 'Skip manager',
|
|
3044
|
-
name: 'skip manager',
|
|
3045
|
-
required: false,
|
|
3046
|
-
type: 'async_select',
|
|
3047
|
-
fullWidth: false,
|
|
3048
|
-
visibility: true,
|
|
3049
|
-
readOnly: false,
|
|
3050
|
-
placeholder: 'Select manager',
|
|
3051
|
-
product: 'travel',
|
|
3052
|
-
loadOption: approversOptions
|
|
3053
3200
|
}, {
|
|
3054
3201
|
id: 9,
|
|
3055
3202
|
label: 'Base location',
|
|
@@ -3105,6 +3252,12 @@ var products = [{
|
|
|
3105
3252
|
name: 'expense',
|
|
3106
3253
|
type: 'checkbox',
|
|
3107
3254
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3255
|
+
}, {
|
|
3256
|
+
id: 3,
|
|
3257
|
+
label: 'Card',
|
|
3258
|
+
name: 'card',
|
|
3259
|
+
type: 'checkbox',
|
|
3260
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3108
3261
|
}];
|
|
3109
3262
|
var dropdownList = {
|
|
3110
3263
|
gender: [{
|
|
@@ -3275,6 +3428,34 @@ var expenseConstants = {
|
|
|
3275
3428
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3276
3429
|
}]
|
|
3277
3430
|
};
|
|
3431
|
+
var cardsConstants = {
|
|
3432
|
+
heading: 'Card specific information',
|
|
3433
|
+
roleHeading: 'Card role',
|
|
3434
|
+
roleDescription: 'Roles allow users to only access relevant features and functionalities',
|
|
3435
|
+
roles: [{
|
|
3436
|
+
id: 1,
|
|
3437
|
+
label: 'Card holder',
|
|
3438
|
+
description: 'Can view own cards and transactions.',
|
|
3439
|
+
value: '',
|
|
3440
|
+
name: '',
|
|
3441
|
+
type: 'radio',
|
|
3442
|
+
isAssigned: false,
|
|
3443
|
+
fullWidth: false,
|
|
3444
|
+
visibility: true,
|
|
3445
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3446
|
+
}, {
|
|
3447
|
+
id: 2,
|
|
3448
|
+
label: 'Card admin',
|
|
3449
|
+
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.',
|
|
3450
|
+
value: '',
|
|
3451
|
+
name: '',
|
|
3452
|
+
type: 'radio',
|
|
3453
|
+
isAssigned: false,
|
|
3454
|
+
fullWidth: false,
|
|
3455
|
+
visibility: true,
|
|
3456
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3457
|
+
}]
|
|
3458
|
+
};
|
|
3278
3459
|
var passportInfo = [{
|
|
3279
3460
|
id: 1,
|
|
3280
3461
|
label: 'Passport issuing country',
|
|
@@ -3504,6 +3685,12 @@ var initialState = {
|
|
|
3504
3685
|
travelConstants: travelConstants,
|
|
3505
3686
|
expenseConstants: expenseConstants
|
|
3506
3687
|
},
|
|
3688
|
+
isCardsDetailsRendered: false,
|
|
3689
|
+
isCardsAdmin: false,
|
|
3690
|
+
cardsDetails: {
|
|
3691
|
+
cardsRoles: cardsConstants.roles,
|
|
3692
|
+
cardsConstants: cardsConstants
|
|
3693
|
+
},
|
|
3507
3694
|
dropdownList: dropdownList,
|
|
3508
3695
|
maxTravelApprovers: 10,
|
|
3509
3696
|
maxExpenseApprovers: 10,
|
|
@@ -3670,11 +3857,37 @@ var reducer = function reducer(state, action) {
|
|
|
3670
3857
|
isRendered: true
|
|
3671
3858
|
});
|
|
3672
3859
|
}
|
|
3860
|
+
case SET_CARDS_DETAILS:
|
|
3861
|
+
{
|
|
3862
|
+
var _action$payload8, _action$payload8$role, _action$payload9;
|
|
3863
|
+
var cardsDetails = _extends({}, state.cardsDetails);
|
|
3864
|
+
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) {
|
|
3865
|
+
cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
|
|
3866
|
+
return {
|
|
3867
|
+
id: role.id,
|
|
3868
|
+
label: role.name,
|
|
3869
|
+
description: role.description,
|
|
3870
|
+
value: role.value,
|
|
3871
|
+
isAssigned: role.is_assigned,
|
|
3872
|
+
name: role.value,
|
|
3873
|
+
type: 'radio',
|
|
3874
|
+
fullWidth: false,
|
|
3875
|
+
visibility: true,
|
|
3876
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3877
|
+
};
|
|
3878
|
+
});
|
|
3879
|
+
}
|
|
3880
|
+
return _extends({}, state, {
|
|
3881
|
+
cardsDetails: cardsDetails,
|
|
3882
|
+
isCardsDetailsRendered: true,
|
|
3883
|
+
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
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3673
3886
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3674
3887
|
{
|
|
3675
3888
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3676
|
-
var _action$
|
|
3677
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3889
|
+
var _action$payload10;
|
|
3890
|
+
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]) {
|
|
3678
3891
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3679
3892
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3680
3893
|
}
|
|
@@ -3885,7 +4098,6 @@ var reducer$1 = function reducer(state, action) {
|
|
|
3885
4098
|
_userListInfo.results[i].is_active = action.payload.is_active;
|
|
3886
4099
|
}
|
|
3887
4100
|
});
|
|
3888
|
-
|
|
3889
4101
|
var _deactivatedUsers = _userListInfo.results.length > 0 ? _userListInfo.results.filter(function (val) {
|
|
3890
4102
|
return !val.is_active;
|
|
3891
4103
|
}).map(function (obj) {
|
|
@@ -3908,7 +4120,6 @@ var reducer$1 = function reducer(state, action) {
|
|
|
3908
4120
|
}
|
|
3909
4121
|
});
|
|
3910
4122
|
});
|
|
3911
|
-
|
|
3912
4123
|
var _deactivatedUsers2 = _userListInfo2.results.length > 0 ? _userListInfo2.results.filter(function (val) {
|
|
3913
4124
|
return !val.is_active;
|
|
3914
4125
|
}).map(function (obj) {
|
|
@@ -3962,6 +4173,7 @@ var initialState$2 = {
|
|
|
3962
4173
|
previous: null,
|
|
3963
4174
|
results: []
|
|
3964
4175
|
},
|
|
4176
|
+
deptUsers: [],
|
|
3965
4177
|
loading: false
|
|
3966
4178
|
};
|
|
3967
4179
|
var reducer$2 = function reducer(state, action) {
|
|
@@ -4031,6 +4243,12 @@ var reducer$2 = function reducer(state, action) {
|
|
|
4031
4243
|
loading: false
|
|
4032
4244
|
});
|
|
4033
4245
|
}
|
|
4246
|
+
case FETCH_DEPARTMENT_USERS_DATA:
|
|
4247
|
+
{
|
|
4248
|
+
return _extends({}, state, {
|
|
4249
|
+
deptUsers: action.payload
|
|
4250
|
+
});
|
|
4251
|
+
}
|
|
4034
4252
|
default:
|
|
4035
4253
|
return state;
|
|
4036
4254
|
}
|
|
@@ -4217,8 +4435,7 @@ var rootReducer = combineReducers({
|
|
|
4217
4435
|
customFields: reducer$5
|
|
4218
4436
|
});
|
|
4219
4437
|
|
|
4220
|
-
var store = createStore(rootReducer, composeWithDevTools(applyMiddleware(thunk)
|
|
4221
|
-
));
|
|
4438
|
+
var store = createStore(rootReducer, composeWithDevTools(applyMiddleware(thunk)));
|
|
4222
4439
|
|
|
4223
4440
|
function withStore(Component) {
|
|
4224
4441
|
function WrappedComponent(props) {
|
|
@@ -4723,7 +4940,9 @@ var ErrorMessages = {
|
|
|
4723
4940
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4724
4941
|
passport_photo: 'Please attach passport photo.',
|
|
4725
4942
|
travel_docs: 'Please attach travel docs.',
|
|
4726
|
-
products: 'Please select atleast one product access.'
|
|
4943
|
+
products: 'Please select atleast one product access.',
|
|
4944
|
+
only_cards_products: 'Currently, Card cannot be selected as a standalone option. Please add at least one more product.',
|
|
4945
|
+
none_products: 'Select at least one product. If opting for card, please choose at least one additional product.'
|
|
4727
4946
|
};
|
|
4728
4947
|
|
|
4729
4948
|
function AddPanelDialog(_ref) {
|
|
@@ -4761,8 +4980,7 @@ function AddPanelDialog(_ref) {
|
|
|
4761
4980
|
flexDirection: "column",
|
|
4762
4981
|
padding: "8px 20px"
|
|
4763
4982
|
}, /*#__PURE__*/React.createElement(IUIInput, {
|
|
4764
|
-
label: name + " name"
|
|
4765
|
-
,
|
|
4983
|
+
label: name + " name",
|
|
4766
4984
|
name: "name",
|
|
4767
4985
|
defaultValue: "",
|
|
4768
4986
|
onValueChange: onValueChange,
|
|
@@ -4774,47 +4992,118 @@ function AddPanelDialog(_ref) {
|
|
|
4774
4992
|
})));
|
|
4775
4993
|
}
|
|
4776
4994
|
|
|
4777
|
-
var
|
|
4778
|
-
var
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4995
|
+
var CardsField = function CardsField(props) {
|
|
4996
|
+
var cardsConstants = props.cardsConstants,
|
|
4997
|
+
_props$onRoleChange = props.onRoleChange,
|
|
4998
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
4999
|
+
_props$roleValue = props.roleValue,
|
|
5000
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
4783
5001
|
_props$isProfile = props.isProfile,
|
|
4784
|
-
isProfile = _props$isProfile === void 0 ? false : _props$isProfile
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
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
|
-
|
|
5002
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5003
|
+
_props$roles = props.roles,
|
|
5004
|
+
roles = _props$roles === void 0 ? [] : _props$roles,
|
|
5005
|
+
_props$cardsAdmin = props.cardsAdmin,
|
|
5006
|
+
cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
|
|
5007
|
+
editUserId = props.editUserId,
|
|
5008
|
+
loggedInUserId = props.loggedInUserId;
|
|
5009
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5010
|
+
container: true,
|
|
5011
|
+
className: (styles.headingPadding)
|
|
5012
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5013
|
+
variant: "h3",
|
|
5014
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5015
|
+
}, cardsConstants.heading)), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
5016
|
+
className: styles.dividerColor
|
|
5017
|
+
}), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5018
|
+
container: true,
|
|
5019
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5020
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5021
|
+
item: true,
|
|
5022
|
+
sm: 12,
|
|
5023
|
+
md: 4
|
|
5024
|
+
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
5025
|
+
label: cardsConstants.roleHeading,
|
|
5026
|
+
headerType: true,
|
|
5027
|
+
description: cardsConstants.roleDescription
|
|
5028
|
+
})), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5029
|
+
item: true,
|
|
5030
|
+
sm: 12,
|
|
5031
|
+
md: 8,
|
|
5032
|
+
lg: 8,
|
|
5033
|
+
xl: 6
|
|
5034
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5035
|
+
container: true,
|
|
5036
|
+
className: styles.formFieldsWrapper
|
|
5037
|
+
}, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React.createElement(UserRole, {
|
|
5038
|
+
list: roles,
|
|
5039
|
+
value: roleValue
|
|
5040
|
+
}) : /*#__PURE__*/React.createElement(IUIRadio, {
|
|
5041
|
+
list: roles,
|
|
5042
|
+
value: roleValue,
|
|
5043
|
+
onValueChange: onRoleChange,
|
|
5044
|
+
disabled: cardsAdmin ? false : true
|
|
5045
|
+
})), !cardsAdmin && !isProfile && /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5046
|
+
item: true,
|
|
5047
|
+
sm: 12,
|
|
5048
|
+
md: 12,
|
|
5049
|
+
lg: 12,
|
|
5050
|
+
style: {
|
|
5051
|
+
marginTop: "24px"
|
|
5052
|
+
}
|
|
5053
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5054
|
+
variant: "body2",
|
|
5055
|
+
component: "span",
|
|
5056
|
+
className: styles.errorTextCls
|
|
5057
|
+
}, 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.")))));
|
|
5058
|
+
};
|
|
5059
|
+
|
|
5060
|
+
var IUIToastMessageService$4 = services.IUIToastMessageService,
|
|
5061
|
+
IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
5062
|
+
var env$4 = configs.env;
|
|
5063
|
+
var UserAddEdit = function UserAddEdit(props) {
|
|
5064
|
+
var isEditMode = props.isEditMode,
|
|
5065
|
+
editUserId = props.editUserId,
|
|
5066
|
+
config = props.config,
|
|
5067
|
+
_props$isProfile = props.isProfile,
|
|
5068
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5069
|
+
env$4.init(config, isProfile);
|
|
5070
|
+
var queryParams = new URLSearchParams(window.location.search);
|
|
5071
|
+
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
5072
|
+
var _useSelector = useSelector(function (state) {
|
|
5073
|
+
return state.userAddEdit;
|
|
5074
|
+
}),
|
|
5075
|
+
isPageLoading = _useSelector.loading,
|
|
5076
|
+
renderFields = _useSelector.renderFields,
|
|
5077
|
+
dropdownList = _useSelector.dropdownList,
|
|
5078
|
+
dateFormat = _useSelector.dateFormat,
|
|
5079
|
+
countryCode = _useSelector.countryCode,
|
|
5080
|
+
defaultCurrency = _useSelector.defaultCurrency,
|
|
5081
|
+
isTravelApproverLabelUpadted = _useSelector.isTravelApproverLabelUpadted,
|
|
5082
|
+
isExpenseApproverLabelUpadted = _useSelector.isExpenseApproverLabelUpadted,
|
|
5083
|
+
optionalFields = _useSelector.optionalFields,
|
|
5084
|
+
fieldsVisibility = _useSelector.fieldsVisibility,
|
|
5085
|
+
isRendered = _useSelector.isRendered,
|
|
5086
|
+
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
5087
|
+
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
5088
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5089
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5090
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5091
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
5092
|
+
var _useSelector2 = useSelector(function (state) {
|
|
5093
|
+
return state.common;
|
|
5094
|
+
}),
|
|
5095
|
+
isTokenVerified = _useSelector2.isTokenVerified,
|
|
5096
|
+
id = _useSelector2.id,
|
|
5097
|
+
hasVerificationError = _useSelector2.hasVerificationError,
|
|
5098
|
+
isILadmin = _useSelector2.isILadmin,
|
|
5099
|
+
companyName = _useSelector2.companyName;
|
|
5100
|
+
var history = useHistory();
|
|
5101
|
+
var location = useLocation();
|
|
5102
|
+
var _useState = useState({
|
|
5103
|
+
travel: false,
|
|
5104
|
+
expense: false,
|
|
5105
|
+
card: false
|
|
5106
|
+
}),
|
|
4818
5107
|
productAccess = _useState[0],
|
|
4819
5108
|
setProductAccess = _useState[1];
|
|
4820
5109
|
var addProductAccessSelected = function addProductAccessSelected(args) {
|
|
@@ -4824,13 +5113,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4824
5113
|
errorMsgs.products = '';
|
|
4825
5114
|
var _productAccess = _extends({}, productAccess);
|
|
4826
5115
|
_productAccess[value] = !_productAccess[value];
|
|
4827
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5116
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === true) {
|
|
4828
5117
|
var _errorArray = [].concat(errorArray);
|
|
4829
5118
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4830
5119
|
if (_errorArray.indexOf('products') === -1) {
|
|
4831
5120
|
_errorArray.push('products');
|
|
4832
5121
|
}
|
|
4833
|
-
_errorMsgs.products = ErrorMessages.
|
|
5122
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4834
5123
|
setErrorArray(_errorArray);
|
|
4835
5124
|
setErrorMsgs(_errorMsgs);
|
|
4836
5125
|
var el = document.getElementById('products');
|
|
@@ -4840,14 +5129,202 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4840
5129
|
block: 'center'
|
|
4841
5130
|
});
|
|
4842
5131
|
}
|
|
5132
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5133
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5134
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5135
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5136
|
+
_errorArray2.push('products');
|
|
5137
|
+
}
|
|
5138
|
+
_errorMsgs2.products = ErrorMessages.products;
|
|
5139
|
+
setErrorArray(_errorArray2);
|
|
5140
|
+
setErrorMsgs(_errorMsgs2);
|
|
5141
|
+
var _el = document.getElementById('products');
|
|
5142
|
+
if (_el) {
|
|
5143
|
+
_el.scrollIntoView({
|
|
5144
|
+
behavior: 'smooth',
|
|
5145
|
+
block: 'center'
|
|
5146
|
+
});
|
|
5147
|
+
}
|
|
4843
5148
|
} else {
|
|
4844
5149
|
setErrorArray(errorArray);
|
|
4845
5150
|
setErrorMsgs(errorMsgs);
|
|
4846
5151
|
}
|
|
4847
5152
|
setProductAccess(_productAccess);
|
|
4848
5153
|
};
|
|
4849
|
-
|
|
4850
|
-
|
|
5154
|
+
var _useState2 = useState(''),
|
|
5155
|
+
newCountryCode = _useState2[0],
|
|
5156
|
+
setNewCountryCode = _useState2[1];
|
|
5157
|
+
var _useState3 = useState(),
|
|
5158
|
+
countryDialCode = _useState3[0],
|
|
5159
|
+
setCountryDialCode = _useState3[1];
|
|
5160
|
+
var _useState4 = useState([]),
|
|
5161
|
+
countryContactCode = _useState4[0],
|
|
5162
|
+
setCountryContactCode = _useState4[1];
|
|
5163
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5164
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5165
|
+
if (isProfile) {
|
|
5166
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5167
|
+
(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);
|
|
5168
|
+
} else {
|
|
5169
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5170
|
+
(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);
|
|
5171
|
+
}
|
|
5172
|
+
setFilesForDelete([]);
|
|
5173
|
+
setProfilePicDelete([]);
|
|
5174
|
+
})["catch"](function (err) {
|
|
5175
|
+
if (typeof err === 'object') {
|
|
5176
|
+
if (err.country_code) {
|
|
5177
|
+
err.contact_number = err.country_code;
|
|
5178
|
+
}
|
|
5179
|
+
if (err.contact_country_code) {
|
|
5180
|
+
err.contact_number = err.contact_country_code;
|
|
5181
|
+
}
|
|
5182
|
+
if (err.passport) {
|
|
5183
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5184
|
+
delete err.passport;
|
|
5185
|
+
}
|
|
5186
|
+
setErrorArray(Object.keys(err));
|
|
5187
|
+
setErrorMsgs(err);
|
|
5188
|
+
var _loop = function _loop() {
|
|
5189
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5190
|
+
if (err[key]) {
|
|
5191
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5192
|
+
setAdditionalInfoFlag('open');
|
|
5193
|
+
}
|
|
5194
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5195
|
+
if (el) {
|
|
5196
|
+
setTimeout(function () {
|
|
5197
|
+
el.scrollIntoView({
|
|
5198
|
+
behavior: 'smooth',
|
|
5199
|
+
block: 'center'
|
|
5200
|
+
});
|
|
5201
|
+
}, 500);
|
|
5202
|
+
return 1;
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
for (var key in err) {
|
|
5208
|
+
if (_loop()) break;
|
|
5209
|
+
}
|
|
5210
|
+
} else if (typeof err === 'string') {
|
|
5211
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5212
|
+
} else {
|
|
5213
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5214
|
+
}
|
|
5215
|
+
})["finally"](function () {
|
|
5216
|
+
dispatch(stopLoader());
|
|
5217
|
+
});
|
|
5218
|
+
};
|
|
5219
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5220
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5221
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5222
|
+
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) {
|
|
5223
|
+
history.push({
|
|
5224
|
+
pathname: config.routes.users.list.path
|
|
5225
|
+
});
|
|
5226
|
+
}
|
|
5227
|
+
})["catch"](function (err) {
|
|
5228
|
+
if (typeof err === 'object') {
|
|
5229
|
+
if (err.country_code) {
|
|
5230
|
+
err.contact_number = err.country_code;
|
|
5231
|
+
}
|
|
5232
|
+
if (err.contact_country_code) {
|
|
5233
|
+
err.contact_number = err.contact_country_code;
|
|
5234
|
+
}
|
|
5235
|
+
if (err.passport) {
|
|
5236
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5237
|
+
delete err.passport;
|
|
5238
|
+
}
|
|
5239
|
+
setErrorArray(Object.keys(err));
|
|
5240
|
+
setErrorMsgs(err);
|
|
5241
|
+
var _loop2 = function _loop2() {
|
|
5242
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5243
|
+
if (err[key]) {
|
|
5244
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5245
|
+
setAdditionalInfoFlag('open');
|
|
5246
|
+
}
|
|
5247
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5248
|
+
if (el) {
|
|
5249
|
+
setTimeout(function () {
|
|
5250
|
+
el.scrollIntoView({
|
|
5251
|
+
behavior: 'smooth',
|
|
5252
|
+
block: 'center'
|
|
5253
|
+
});
|
|
5254
|
+
}, 500);
|
|
5255
|
+
return 1;
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
};
|
|
5260
|
+
for (var key in err) {
|
|
5261
|
+
if (_loop2()) break;
|
|
5262
|
+
}
|
|
5263
|
+
} else if (typeof err === 'string') {
|
|
5264
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5265
|
+
} else {
|
|
5266
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5267
|
+
}
|
|
5268
|
+
})["finally"](function () {
|
|
5269
|
+
dispatch(stopLoader());
|
|
5270
|
+
});
|
|
5271
|
+
};
|
|
5272
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5273
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5274
|
+
method: 'GET',
|
|
5275
|
+
headers: {
|
|
5276
|
+
'Content-Type': 'application/json',
|
|
5277
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5278
|
+
}
|
|
5279
|
+
}).then(function (response) {
|
|
5280
|
+
return response.json();
|
|
5281
|
+
}).then(function (res) {
|
|
5282
|
+
var _res$roles;
|
|
5283
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5284
|
+
dispatch(setCardsDetails(res));
|
|
5285
|
+
} else {
|
|
5286
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5287
|
+
}
|
|
5288
|
+
})["catch"](function (error) {
|
|
5289
|
+
console.log("errorrr", error);
|
|
5290
|
+
});
|
|
5291
|
+
};
|
|
5292
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5293
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5294
|
+
method: 'GET',
|
|
5295
|
+
headers: {
|
|
5296
|
+
'Content-Type': 'application/json',
|
|
5297
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5298
|
+
}
|
|
5299
|
+
}).then(function (response) {
|
|
5300
|
+
return response.json();
|
|
5301
|
+
}).then(function (res) {
|
|
5302
|
+
var _res$roles2;
|
|
5303
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5304
|
+
dispatch(setCardsDetails(res));
|
|
5305
|
+
} else {
|
|
5306
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5307
|
+
}
|
|
5308
|
+
})["catch"](function (error) {
|
|
5309
|
+
console.log("errorrr", error);
|
|
5310
|
+
});
|
|
5311
|
+
};
|
|
5312
|
+
useEffect(function () {
|
|
5313
|
+
var countryObject = countryContactCode.find(function (t) {
|
|
5314
|
+
return t.dial_code === countryDialCode;
|
|
5315
|
+
});
|
|
5316
|
+
if (countryObject) {
|
|
5317
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5318
|
+
country_code: countryObject.code
|
|
5319
|
+
}));
|
|
5320
|
+
}
|
|
5321
|
+
}, [countryDialCode]);
|
|
5322
|
+
useEffect(function () {
|
|
5323
|
+
var extractedNumber = newCountryCode.substring(1);
|
|
5324
|
+
var convertedNumber = parseInt(extractedNumber);
|
|
5325
|
+
setCountryDialCode(convertedNumber);
|
|
5326
|
+
}, [newCountryCode]);
|
|
5327
|
+
var _useState5 = useState({
|
|
4851
5328
|
first_name: '',
|
|
4852
5329
|
last_name: '',
|
|
4853
5330
|
email: '',
|
|
@@ -4858,9 +5335,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4858
5335
|
contact_country_code: '',
|
|
4859
5336
|
profile_pic: []
|
|
4860
5337
|
}),
|
|
4861
|
-
personalInfoInput =
|
|
4862
|
-
setPersonalInfoInput =
|
|
4863
|
-
var
|
|
5338
|
+
personalInfoInput = _useState5[0],
|
|
5339
|
+
setPersonalInfoInput = _useState5[1];
|
|
5340
|
+
var _useState6 = useState({
|
|
4864
5341
|
emp_level: {
|
|
4865
5342
|
value: '',
|
|
4866
5343
|
label: 'Select employee level'
|
|
@@ -4880,62 +5357,72 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4880
5357
|
},
|
|
4881
5358
|
designation: '',
|
|
4882
5359
|
base_location: '',
|
|
5360
|
+
manager_id: {
|
|
5361
|
+
value: '',
|
|
5362
|
+
label: 'Select Manager'
|
|
5363
|
+
},
|
|
5364
|
+
skip_manager_id: {
|
|
5365
|
+
value: '',
|
|
5366
|
+
label: 'Select Manager'
|
|
5367
|
+
},
|
|
4883
5368
|
currency: {
|
|
4884
5369
|
value: defaultCurrency,
|
|
4885
5370
|
label: defaultCurrency
|
|
4886
5371
|
}
|
|
4887
5372
|
}),
|
|
4888
|
-
employeeInfoInput =
|
|
4889
|
-
setEmployeeInfoInput =
|
|
4890
|
-
var
|
|
5373
|
+
employeeInfoInput = _useState6[0],
|
|
5374
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5375
|
+
var _useState7 = useState({
|
|
4891
5376
|
emp_level: 0,
|
|
4892
5377
|
entity: 0,
|
|
4893
5378
|
business_unit: 0,
|
|
4894
5379
|
department: 0,
|
|
4895
|
-
currency: 0
|
|
5380
|
+
currency: 0,
|
|
5381
|
+
manager_id: 0,
|
|
5382
|
+
skip_manager_id: 0
|
|
4896
5383
|
}),
|
|
4897
|
-
cacheForAsyncDropdown =
|
|
4898
|
-
clearCacheForAsyncDropdown =
|
|
4899
|
-
var
|
|
4900
|
-
userTagType =
|
|
4901
|
-
setUserTagType =
|
|
4902
|
-
var
|
|
4903
|
-
scroll =
|
|
4904
|
-
setScroll =
|
|
4905
|
-
var
|
|
4906
|
-
customFieldsInput =
|
|
4907
|
-
setCustomFieldsInput =
|
|
4908
|
-
var
|
|
4909
|
-
travelRole =
|
|
4910
|
-
setTravelRole =
|
|
4911
|
-
var
|
|
4912
|
-
travelApproversInput =
|
|
4913
|
-
setTravelApproversInput =
|
|
4914
|
-
var
|
|
5384
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5385
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5386
|
+
var _useState8 = useState({}),
|
|
5387
|
+
userTagType = _useState8[0],
|
|
5388
|
+
setUserTagType = _useState8[1];
|
|
5389
|
+
var _useState9 = useState(false),
|
|
5390
|
+
scroll = _useState9[0],
|
|
5391
|
+
setScroll = _useState9[1];
|
|
5392
|
+
var _useState10 = useState({}),
|
|
5393
|
+
customFieldsInput = _useState10[0],
|
|
5394
|
+
setCustomFieldsInput = _useState10[1];
|
|
5395
|
+
var _useState11 = useState('traveler'),
|
|
5396
|
+
travelRole = _useState11[0],
|
|
5397
|
+
setTravelRole = _useState11[1];
|
|
5398
|
+
var _useState12 = useState({}),
|
|
5399
|
+
travelApproversInput = _useState12[0],
|
|
5400
|
+
setTravelApproversInput = _useState12[1];
|
|
5401
|
+
var _useState13 = useState({
|
|
4915
5402
|
value: '',
|
|
4916
5403
|
label: 'Select approver'
|
|
4917
5404
|
}),
|
|
4918
|
-
travelFYI =
|
|
4919
|
-
setTravelFYI =
|
|
4920
|
-
var
|
|
4921
|
-
membershipInfoInput =
|
|
4922
|
-
setMembershipInfoInput =
|
|
4923
|
-
var
|
|
4924
|
-
removedMembershipInfoInput =
|
|
4925
|
-
setRemovedMembershipInfoInput =
|
|
4926
|
-
var
|
|
5405
|
+
travelFYI = _useState13[0],
|
|
5406
|
+
setTravelFYI = _useState13[1];
|
|
5407
|
+
var _useState14 = useState([]),
|
|
5408
|
+
membershipInfoInput = _useState14[0],
|
|
5409
|
+
setMembershipInfoInput = _useState14[1];
|
|
5410
|
+
var _useState15 = useState([]),
|
|
5411
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5412
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5413
|
+
var _useState16 = useState({
|
|
4927
5414
|
flight_seat_preference: '',
|
|
4928
5415
|
meal_preference: ''
|
|
4929
5416
|
}),
|
|
4930
|
-
travelPreferenceInfo =
|
|
4931
|
-
settravelPreferenceInfo =
|
|
4932
|
-
var
|
|
5417
|
+
travelPreferenceInfo = _useState16[0],
|
|
5418
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5419
|
+
var _useState17 = useState({
|
|
4933
5420
|
trusted_traveller: '',
|
|
4934
5421
|
redress_number: ''
|
|
4935
5422
|
}),
|
|
4936
|
-
secureTravelInputInfo =
|
|
4937
|
-
setSecureTravelInputInfo =
|
|
4938
|
-
var
|
|
5423
|
+
secureTravelInputInfo = _useState17[0],
|
|
5424
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5425
|
+
var _useState18 = useState({
|
|
4939
5426
|
passport_issue_country: {
|
|
4940
5427
|
value: '',
|
|
4941
5428
|
label: 'Select country'
|
|
@@ -4950,39 +5437,76 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4950
5437
|
passport_photo: [],
|
|
4951
5438
|
travel_docs: []
|
|
4952
5439
|
}),
|
|
4953
|
-
passportInfoInput =
|
|
4954
|
-
setPassportInfoInput =
|
|
4955
|
-
var
|
|
4956
|
-
filesForDelete =
|
|
4957
|
-
setFilesForDelete =
|
|
4958
|
-
var
|
|
4959
|
-
profilePicDelete =
|
|
4960
|
-
setProfilePicDelete =
|
|
4961
|
-
var
|
|
4962
|
-
isAdditionalInfoExpanded =
|
|
4963
|
-
setAdditionalInfoFlag =
|
|
4964
|
-
var
|
|
4965
|
-
expenseRole =
|
|
4966
|
-
setExpenseRole =
|
|
4967
|
-
var
|
|
4968
|
-
expenseApproversInput =
|
|
4969
|
-
setExpenseApproversInput =
|
|
4970
|
-
var
|
|
5440
|
+
passportInfoInput = _useState18[0],
|
|
5441
|
+
setPassportInfoInput = _useState18[1];
|
|
5442
|
+
var _useState19 = useState([]),
|
|
5443
|
+
filesForDelete = _useState19[0],
|
|
5444
|
+
setFilesForDelete = _useState19[1];
|
|
5445
|
+
var _useState20 = useState([]),
|
|
5446
|
+
profilePicDelete = _useState20[0],
|
|
5447
|
+
setProfilePicDelete = _useState20[1];
|
|
5448
|
+
var _useState21 = useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5449
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5450
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5451
|
+
var _useState22 = useState('submitter'),
|
|
5452
|
+
expenseRole = _useState22[0],
|
|
5453
|
+
setExpenseRole = _useState22[1];
|
|
5454
|
+
var _useState23 = useState({}),
|
|
5455
|
+
expenseApproversInput = _useState23[0],
|
|
5456
|
+
setExpenseApproversInput = _useState23[1];
|
|
5457
|
+
var _useState24 = useState({
|
|
4971
5458
|
value: '',
|
|
4972
5459
|
label: 'Select approver'
|
|
4973
5460
|
}),
|
|
4974
|
-
expenseFYI =
|
|
4975
|
-
setExpenseFYI =
|
|
5461
|
+
expenseFYI = _useState24[0],
|
|
5462
|
+
setExpenseFYI = _useState24[1];
|
|
5463
|
+
var _useState25 = useState(''),
|
|
5464
|
+
cardsRole = _useState25[0],
|
|
5465
|
+
setCardsRole = _useState25[1];
|
|
5466
|
+
useEffect(function () {
|
|
5467
|
+
if (productAccess.card === false) {
|
|
5468
|
+
setCardsRole('');
|
|
5469
|
+
}
|
|
5470
|
+
}, [productAccess.card]);
|
|
5471
|
+
useEffect(function () {
|
|
5472
|
+
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5473
|
+
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5474
|
+
return role.isAssigned;
|
|
5475
|
+
});
|
|
5476
|
+
if (selectedRole) {
|
|
5477
|
+
setCardsRole(selectedRole.value);
|
|
5478
|
+
} else {
|
|
5479
|
+
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5480
|
+
var splitRoleVal = role.value.split(':');
|
|
5481
|
+
return splitRoleVal[2] === 'card-holder';
|
|
5482
|
+
});
|
|
5483
|
+
if (defaultRole) {
|
|
5484
|
+
setCardsRole(defaultRole.value);
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5488
|
+
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5489
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5490
|
+
var role = _step.value;
|
|
5491
|
+
var splitRoleVal = role.value.split(':');
|
|
5492
|
+
var profileRole = splitRoleVal[2];
|
|
5493
|
+
if (profileRole === targetRole) {
|
|
5494
|
+
setCardsRole(role.value);
|
|
5495
|
+
break;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
4976
5500
|
var asyncSelectRefs = useRef({
|
|
4977
5501
|
emp_level: useRef(null),
|
|
4978
5502
|
entity: useRef(null),
|
|
4979
5503
|
business_unit: useRef(null),
|
|
4980
5504
|
department: useRef(null)
|
|
4981
5505
|
});
|
|
4982
|
-
var
|
|
4983
|
-
errorArray =
|
|
4984
|
-
setErrorArray =
|
|
4985
|
-
var
|
|
5506
|
+
var _useState26 = useState([]),
|
|
5507
|
+
errorArray = _useState26[0],
|
|
5508
|
+
setErrorArray = _useState26[1];
|
|
5509
|
+
var _useState27 = useState({
|
|
4986
5510
|
first_name: '',
|
|
4987
5511
|
last_name: '',
|
|
4988
5512
|
email: '',
|
|
@@ -5012,9 +5536,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5012
5536
|
userTagType: '',
|
|
5013
5537
|
profile_pic: ''
|
|
5014
5538
|
}),
|
|
5015
|
-
errorMsgs =
|
|
5016
|
-
setErrorMsgs =
|
|
5017
|
-
var
|
|
5539
|
+
errorMsgs = _useState27[0],
|
|
5540
|
+
setErrorMsgs = _useState27[1];
|
|
5541
|
+
var _useState28 = useState({
|
|
5018
5542
|
first_name: false,
|
|
5019
5543
|
last_name: false,
|
|
5020
5544
|
email: false,
|
|
@@ -5041,11 +5565,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5041
5565
|
userTagType: false,
|
|
5042
5566
|
profile_pic: false
|
|
5043
5567
|
}),
|
|
5044
|
-
inputChangeLog =
|
|
5045
|
-
updateInputChangeLog =
|
|
5046
|
-
var
|
|
5047
|
-
uploadedFiles =
|
|
5048
|
-
setUploadedFiles =
|
|
5568
|
+
inputChangeLog = _useState28[0],
|
|
5569
|
+
updateInputChangeLog = _useState28[1];
|
|
5570
|
+
var _useState29 = useState([]),
|
|
5571
|
+
uploadedFiles = _useState29[0],
|
|
5572
|
+
setUploadedFiles = _useState29[1];
|
|
5573
|
+
var _useState30 = useState(70),
|
|
5574
|
+
maxLengthForModal = _useState30[0],
|
|
5575
|
+
setMaxLengthForModal = _useState30[1];
|
|
5049
5576
|
var defaultAddModalData = {
|
|
5050
5577
|
isOpen: false,
|
|
5051
5578
|
isError: false,
|
|
@@ -5058,25 +5585,41 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5058
5585
|
regexOnBlur: null,
|
|
5059
5586
|
maxLimit: '',
|
|
5060
5587
|
minLimit: '',
|
|
5061
|
-
maxLength:
|
|
5588
|
+
maxLength: maxLengthForModal,
|
|
5062
5589
|
minLength: 0
|
|
5063
5590
|
};
|
|
5064
|
-
var
|
|
5065
|
-
addModalData =
|
|
5066
|
-
setAddModalData =
|
|
5591
|
+
var _useState31 = useState(defaultAddModalData),
|
|
5592
|
+
addModalData = _useState31[0],
|
|
5593
|
+
setAddModalData = _useState31[1];
|
|
5067
5594
|
var onAddModalClose = function onAddModalClose() {
|
|
5068
5595
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5069
5596
|
};
|
|
5597
|
+
useEffect(function () {
|
|
5598
|
+
var _location$state, _location$state2;
|
|
5599
|
+
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) {
|
|
5600
|
+
var _location$state3, _location$state4;
|
|
5601
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, {
|
|
5602
|
+
department: {
|
|
5603
|
+
value: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.id,
|
|
5604
|
+
label: location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.name
|
|
5605
|
+
}
|
|
5606
|
+
}));
|
|
5607
|
+
}
|
|
5608
|
+
}, []);
|
|
5070
5609
|
var onModalOpen = function onModalOpen(e, id) {
|
|
5071
5610
|
var title = '';
|
|
5072
5611
|
if (id === 'entity') {
|
|
5073
5612
|
title = 'Entity';
|
|
5613
|
+
setMaxLengthForModal(70);
|
|
5074
5614
|
} else if (id === 'department') {
|
|
5075
5615
|
title = 'Department';
|
|
5616
|
+
setMaxLengthForModal(70);
|
|
5076
5617
|
} else if (id === 'business_unit') {
|
|
5618
|
+
setMaxLengthForModal(150);
|
|
5077
5619
|
title = 'Business unit';
|
|
5078
5620
|
} else if (id === 'employee_level') {
|
|
5079
5621
|
title = 'Employee level';
|
|
5622
|
+
setMaxLengthForModal(70);
|
|
5080
5623
|
}
|
|
5081
5624
|
setAddModalData(_extends({}, addModalData, {
|
|
5082
5625
|
isOpen: true,
|
|
@@ -5092,23 +5635,42 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5092
5635
|
}));
|
|
5093
5636
|
} else {
|
|
5094
5637
|
dispatch(showLoader());
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5638
|
+
var dataObj;
|
|
5639
|
+
if (addModalData.id === 'department') {
|
|
5640
|
+
dataObj = {
|
|
5641
|
+
name: validatedValue,
|
|
5642
|
+
department_head_id: null
|
|
5643
|
+
};
|
|
5644
|
+
} else {
|
|
5645
|
+
dataObj = {
|
|
5646
|
+
names: [validatedValue]
|
|
5647
|
+
};
|
|
5648
|
+
}
|
|
5649
|
+
dispatch(submitAddModalData(addModalData.id, dataObj)).then(function (res) {
|
|
5650
|
+
var _extends4;
|
|
5099
5651
|
setAddModalData(_extends({}, addModalData, {
|
|
5100
5652
|
isOpen: false
|
|
5101
5653
|
}));
|
|
5102
5654
|
IUIToastMessageService$4.sNotify(addModalData.title + " added successfully.");
|
|
5103
5655
|
var tempKey = addModalData.id === 'employee_level' ? 'emp_level' : addModalData.id;
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5656
|
+
if (addModalData.id === 'department') {
|
|
5657
|
+
var _extends2;
|
|
5658
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
|
|
5659
|
+
value: res.data.result.id,
|
|
5660
|
+
label: res.data.result.name
|
|
5661
|
+
}, _extends2)));
|
|
5662
|
+
} else {
|
|
5663
|
+
var _extends3;
|
|
5664
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends3 = {}, _extends3[tempKey] = {
|
|
5665
|
+
value: res.data.value,
|
|
5666
|
+
label: res.data.label
|
|
5667
|
+
}, _extends3)));
|
|
5668
|
+
}
|
|
5669
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[tempKey] = true, _extends4)));
|
|
5108
5670
|
asyncSelectRefs.current[tempKey].current.blur();
|
|
5109
5671
|
clearCacheForAsyncDropdown(function (prevState) {
|
|
5110
|
-
var
|
|
5111
|
-
return _extends({}, prevState, (
|
|
5672
|
+
var _extends5;
|
|
5673
|
+
return _extends({}, prevState, (_extends5 = {}, _extends5[tempKey] = prevState[tempKey] + 1, _extends5));
|
|
5112
5674
|
});
|
|
5113
5675
|
dispatch(stopLoader());
|
|
5114
5676
|
});
|
|
@@ -5125,10 +5687,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5125
5687
|
};
|
|
5126
5688
|
var onPersonalInfoChange = function onPersonalInfoChange(args) {
|
|
5127
5689
|
try {
|
|
5128
|
-
var
|
|
5690
|
+
var _temp5 = function _temp5() {
|
|
5129
5691
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5130
|
-
var
|
|
5131
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5692
|
+
var _extends6;
|
|
5693
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends6 = {}, _extends6[_name] = true, _extends6)));
|
|
5132
5694
|
}
|
|
5133
5695
|
};
|
|
5134
5696
|
var _name = args._name,
|
|
@@ -5139,7 +5701,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5139
5701
|
_errorMsg = _args$_errorMsg === void 0 ? '' : _args$_errorMsg,
|
|
5140
5702
|
_args$_obj = args._obj,
|
|
5141
5703
|
_obj = _args$_obj === void 0 ? {} : _args$_obj;
|
|
5142
|
-
var
|
|
5704
|
+
var _temp4 = function () {
|
|
5143
5705
|
if (_name === 'contact_number') {
|
|
5144
5706
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5145
5707
|
contact_number: _value.trim(),
|
|
@@ -5150,14 +5712,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5150
5712
|
updateError('country_code', _isError, _errorMsg);
|
|
5151
5713
|
updateError('contact_country_code', _isError, _errorMsg);
|
|
5152
5714
|
} else {
|
|
5153
|
-
var
|
|
5154
|
-
var
|
|
5155
|
-
setPersonalInfoInput(_extends({}, personalInfoInput, (
|
|
5715
|
+
var _temp3 = function _temp3() {
|
|
5716
|
+
var _extends7;
|
|
5717
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, (_extends7 = {}, _extends7[_name] = _value, _extends7)));
|
|
5156
5718
|
updateError(_name, _isError, _errorMsg);
|
|
5157
5719
|
};
|
|
5158
|
-
var
|
|
5720
|
+
var _temp2 = function () {
|
|
5159
5721
|
if (_name === 'profile_pic') {
|
|
5160
|
-
var
|
|
5722
|
+
var _temp = function () {
|
|
5161
5723
|
if (_obj.isUpload) {
|
|
5162
5724
|
return Promise.resolve(uploadDocs(_value, _name)).then(function (docsData) {
|
|
5163
5725
|
_value = _value.map(function (_val) {
|
|
@@ -5188,28 +5750,28 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5188
5750
|
setProfilePicDelete([].concat(profilePicDelete, _deletedFiles));
|
|
5189
5751
|
}
|
|
5190
5752
|
}();
|
|
5191
|
-
if (
|
|
5753
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
5192
5754
|
}
|
|
5193
5755
|
}();
|
|
5194
|
-
return
|
|
5756
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
5195
5757
|
}
|
|
5196
5758
|
}();
|
|
5197
|
-
return Promise.resolve(
|
|
5759
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
|
5198
5760
|
} catch (e) {
|
|
5199
5761
|
return Promise.reject(e);
|
|
5200
5762
|
}
|
|
5201
5763
|
};
|
|
5202
5764
|
var onEmployeeInfoChange = function onEmployeeInfoChange(args) {
|
|
5203
|
-
var
|
|
5765
|
+
var _extends8;
|
|
5204
5766
|
var _name = args._name,
|
|
5205
5767
|
_value = args._value,
|
|
5206
5768
|
_isError = args._isError,
|
|
5207
5769
|
_errorMsg = args._errorMsg;
|
|
5208
|
-
setEmployeeInfoInput(_extends({}, employeeInfoInput, (
|
|
5770
|
+
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
|
|
5209
5771
|
updateError(_name, _isError, _errorMsg);
|
|
5210
5772
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5211
|
-
var
|
|
5212
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5773
|
+
var _extends9;
|
|
5774
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends9 = {}, _extends9[_name] = true, _extends9)));
|
|
5213
5775
|
}
|
|
5214
5776
|
};
|
|
5215
5777
|
var getUserTagTypeId = function getUserTagTypeId(name) {
|
|
@@ -5219,9 +5781,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5219
5781
|
return tag.id;
|
|
5220
5782
|
};
|
|
5221
5783
|
var onUserTagTypeChange = function onUserTagTypeChange(args) {
|
|
5222
|
-
var
|
|
5784
|
+
var _extends10;
|
|
5223
5785
|
var e = args._event;
|
|
5224
|
-
setUserTagType(_extends({}, userTagType, (
|
|
5786
|
+
setUserTagType(_extends({}, userTagType, (_extends10 = {}, _extends10[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends10)));
|
|
5225
5787
|
if (Object.hasOwnProperty.call(inputChangeLog, 'userTagType')) {
|
|
5226
5788
|
updateInputChangeLog(_extends({}, inputChangeLog, {
|
|
5227
5789
|
userTagType: true
|
|
@@ -5229,30 +5791,26 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5229
5791
|
}
|
|
5230
5792
|
};
|
|
5231
5793
|
var onCustomFieldsChange = function onCustomFieldsChange(_ref2) {
|
|
5232
|
-
var
|
|
5794
|
+
var _extends11;
|
|
5233
5795
|
var _name = _ref2._name,
|
|
5234
5796
|
_value = _ref2._value;
|
|
5235
|
-
setCustomFieldsInput(_extends({}, customFieldsInput, (
|
|
5797
|
+
setCustomFieldsInput(_extends({}, customFieldsInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
|
|
5236
5798
|
};
|
|
5237
5799
|
var onTravelApproversInputChange = function onTravelApproversInputChange(_ref3) {
|
|
5238
|
-
var
|
|
5800
|
+
var _extends12;
|
|
5239
5801
|
var _name = _ref3._name,
|
|
5240
5802
|
_value = _ref3._value;
|
|
5241
|
-
setTravelApproversInput(_extends({}, travelApproversInput, (
|
|
5803
|
+
setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
|
|
5242
5804
|
};
|
|
5243
5805
|
var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
|
|
5244
|
-
var
|
|
5806
|
+
var _extends13;
|
|
5245
5807
|
var _name = _ref4._name,
|
|
5246
5808
|
_value = _ref4._value;
|
|
5247
|
-
setExpenseApproversInput(_extends({}, expenseApproversInput, (
|
|
5809
|
+
setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
|
|
5248
5810
|
};
|
|
5249
5811
|
var onMemInfoInputChange = function onMemInfoInputChange(index, key, val) {
|
|
5250
5812
|
var _membershipInfoInput = [].concat(membershipInfoInput);
|
|
5251
|
-
|
|
5252
|
-
_membershipInfoInput[index][key] = val.label;
|
|
5253
|
-
} else {
|
|
5254
|
-
_membershipInfoInput[index][key] = val;
|
|
5255
|
-
}
|
|
5813
|
+
_membershipInfoInput[index][key] = val;
|
|
5256
5814
|
_membershipInfoInput[index].isEditMode = isEditMode;
|
|
5257
5815
|
setMembershipInfoInput(_membershipInfoInput);
|
|
5258
5816
|
};
|
|
@@ -5282,39 +5840,39 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5282
5840
|
setMembershipInfoInput(_membershipInfoInputTemp);
|
|
5283
5841
|
};
|
|
5284
5842
|
var travelPreferenceOnChange = function travelPreferenceOnChange(args) {
|
|
5285
|
-
var
|
|
5843
|
+
var _extends14;
|
|
5286
5844
|
var _name = args._name,
|
|
5287
5845
|
_value = args._value,
|
|
5288
5846
|
_isError = args._isError,
|
|
5289
5847
|
_errorMsg = args._errorMsg;
|
|
5290
|
-
settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (
|
|
5848
|
+
settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
|
|
5291
5849
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5292
|
-
var
|
|
5293
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5850
|
+
var _extends15;
|
|
5851
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
|
|
5294
5852
|
}
|
|
5295
5853
|
updateError(_name, _isError, _errorMsg);
|
|
5296
5854
|
};
|
|
5297
5855
|
var onSecureTraveelerInfoInputChange = function onSecureTraveelerInfoInputChange(args) {
|
|
5298
|
-
var
|
|
5856
|
+
var _extends16;
|
|
5299
5857
|
var _name = args._name,
|
|
5300
5858
|
_value = args._value,
|
|
5301
5859
|
_isError = args._isError,
|
|
5302
5860
|
_errorMsg = args._errorMsg;
|
|
5303
|
-
setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (
|
|
5861
|
+
setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
|
|
5304
5862
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5305
|
-
var
|
|
5306
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5863
|
+
var _extends17;
|
|
5864
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
|
|
5307
5865
|
}
|
|
5308
5866
|
updateError(_name, _isError, _errorMsg);
|
|
5309
5867
|
};
|
|
5310
5868
|
var onPassportInfoInputChange = function onPassportInfoInputChange(args) {
|
|
5311
5869
|
try {
|
|
5312
|
-
var
|
|
5313
|
-
var
|
|
5314
|
-
setPassportInfoInput(_extends({}, passportInfoInput, (
|
|
5870
|
+
var _temp8 = function _temp8() {
|
|
5871
|
+
var _extends18;
|
|
5872
|
+
setPassportInfoInput(_extends({}, passportInfoInput, (_extends18 = {}, _extends18[_name] = _value, _extends18)));
|
|
5315
5873
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
5316
|
-
var
|
|
5317
|
-
updateInputChangeLog(_extends({}, inputChangeLog, (
|
|
5874
|
+
var _extends19;
|
|
5875
|
+
updateInputChangeLog(_extends({}, inputChangeLog, (_extends19 = {}, _extends19[_name] = true, _extends19)));
|
|
5318
5876
|
}
|
|
5319
5877
|
updateError(_name, _isError, _errorMsg);
|
|
5320
5878
|
};
|
|
@@ -5352,9 +5910,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5352
5910
|
}
|
|
5353
5911
|
return Promise.resolve();
|
|
5354
5912
|
}
|
|
5355
|
-
var
|
|
5913
|
+
var _temp7 = function () {
|
|
5356
5914
|
if (_name === 'passport_photo' || _name === 'travel_docs') {
|
|
5357
|
-
var
|
|
5915
|
+
var _temp6 = function () {
|
|
5358
5916
|
if (_obj.isUpload) {
|
|
5359
5917
|
var checkAlreadyUploadedFiles = uploadedFiles.filter(function (_file) {
|
|
5360
5918
|
if (_name === 'passport_photo') {
|
|
@@ -5398,10 +5956,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5398
5956
|
setFilesForDelete([].concat(filesForDelete, _deletedFiles));
|
|
5399
5957
|
}
|
|
5400
5958
|
}();
|
|
5401
|
-
if (
|
|
5959
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
5402
5960
|
}
|
|
5403
5961
|
}();
|
|
5404
|
-
return Promise.resolve(
|
|
5962
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
|
5405
5963
|
} catch (e) {
|
|
5406
5964
|
return Promise.reject(e);
|
|
5407
5965
|
}
|
|
@@ -5420,8 +5978,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5420
5978
|
return _errorArray;
|
|
5421
5979
|
});
|
|
5422
5980
|
setErrorMsgs(function (prevState) {
|
|
5423
|
-
var
|
|
5424
|
-
return _extends({}, prevState, (
|
|
5981
|
+
var _extends20;
|
|
5982
|
+
return _extends({}, prevState, (_extends20 = {}, _extends20[_name] = _errorMsg, _extends20));
|
|
5425
5983
|
});
|
|
5426
5984
|
};
|
|
5427
5985
|
var dispatch = useDispatch();
|
|
@@ -5443,6 +6001,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5443
6001
|
}, [isTokenVerified]);
|
|
5444
6002
|
useEffect(function () {
|
|
5445
6003
|
if (isRendered === true) {
|
|
6004
|
+
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6005
|
+
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6006
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6007
|
+
}
|
|
6008
|
+
});
|
|
5446
6009
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5447
6010
|
country_code: countryCode
|
|
5448
6011
|
}));
|
|
@@ -5453,6 +6016,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5453
6016
|
}
|
|
5454
6017
|
}));
|
|
5455
6018
|
dispatch(fetchCountryCodes()).then(function (_res) {
|
|
6019
|
+
setCountryContactCode(_res);
|
|
5456
6020
|
if (isEditMode) {
|
|
5457
6021
|
if (!isProfile && !editUserId) return false;
|
|
5458
6022
|
dispatch(setStaticFieldsVisibility({
|
|
@@ -5495,6 +6059,20 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5495
6059
|
value: '',
|
|
5496
6060
|
label: 'Select employee level'
|
|
5497
6061
|
},
|
|
6062
|
+
manager_id: res.employee_info.manager ? {
|
|
6063
|
+
value: res.employee_info.manager,
|
|
6064
|
+
label: res.employee_info.manager
|
|
6065
|
+
} : {
|
|
6066
|
+
value: '',
|
|
6067
|
+
label: 'Select Manager'
|
|
6068
|
+
},
|
|
6069
|
+
skip_manager_id: res.employee_info.skip_manager ? {
|
|
6070
|
+
value: res.employee_info.skip_manager,
|
|
6071
|
+
label: res.employee_info.skip_manager
|
|
6072
|
+
} : {
|
|
6073
|
+
value: '',
|
|
6074
|
+
label: 'Select Manager'
|
|
6075
|
+
},
|
|
5498
6076
|
employee_id: res.employee_info.employee_id || '',
|
|
5499
6077
|
entity: res.employee_info.entity ? {
|
|
5500
6078
|
value: res.employee_info.entity.id,
|
|
@@ -5549,7 +6127,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5549
6127
|
var products = res.user_product.split('+');
|
|
5550
6128
|
setProductAccess({
|
|
5551
6129
|
travel: products.includes('travel'),
|
|
5552
|
-
expense: products.includes('expense')
|
|
6130
|
+
expense: products.includes('expense'),
|
|
6131
|
+
card: products.includes('card')
|
|
5553
6132
|
});
|
|
5554
6133
|
if (products.includes('travel')) {
|
|
5555
6134
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5680,7 +6259,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5680
6259
|
required: true
|
|
5681
6260
|
}
|
|
5682
6261
|
}));
|
|
5683
|
-
|
|
5684
6262
|
var _productAccess = _extends({}, productAccess);
|
|
5685
6263
|
renderFields.products.forEach(function (product) {
|
|
5686
6264
|
_productAccess[product.name] = true;
|
|
@@ -5728,7 +6306,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5728
6306
|
}, [renderFields.expenseApprovers]);
|
|
5729
6307
|
var uploadDocs = function uploadDocs(docToUpload, type) {
|
|
5730
6308
|
try {
|
|
5731
|
-
var
|
|
6309
|
+
var _temp10 = function _temp10() {
|
|
5732
6310
|
setUploadedFiles([].concat(uploadedFiles, data));
|
|
5733
6311
|
dispatch(stopLoader());
|
|
5734
6312
|
return data;
|
|
@@ -5744,12 +6322,12 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5744
6322
|
userID: editUserId
|
|
5745
6323
|
});
|
|
5746
6324
|
});
|
|
5747
|
-
var
|
|
6325
|
+
var _temp9 = _forTo(docs, function (i) {
|
|
5748
6326
|
return Promise.resolve(dispatch(uploadSingleDocumnet(docs[i]))).then(function (res) {
|
|
5749
6327
|
data.push(res);
|
|
5750
6328
|
});
|
|
5751
6329
|
});
|
|
5752
|
-
return Promise.resolve(
|
|
6330
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9));
|
|
5753
6331
|
} catch (e) {
|
|
5754
6332
|
return Promise.reject(e);
|
|
5755
6333
|
}
|
|
@@ -5761,6 +6339,15 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5761
6339
|
IUIToastMessageService$4.warningNotify(checkAnyError);
|
|
5762
6340
|
return Promise.resolve();
|
|
5763
6341
|
}
|
|
6342
|
+
if (employeeInfoInput.manager_id.value !== '') {
|
|
6343
|
+
employeeInfoInput.manager_id = employeeInfoInput.manager.value;
|
|
6344
|
+
}
|
|
6345
|
+
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
6346
|
+
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
6347
|
+
}
|
|
6348
|
+
var cardsPayload = {
|
|
6349
|
+
"roles": [cardsRole]
|
|
6350
|
+
};
|
|
5764
6351
|
var payload = {
|
|
5765
6352
|
personalInfoInput: personalInfoInput,
|
|
5766
6353
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5779,7 +6366,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5779
6366
|
uploadedFiles: uploadedFiles,
|
|
5780
6367
|
filesForDelete: filesForDelete,
|
|
5781
6368
|
profilePicDelete: profilePicDelete,
|
|
5782
|
-
userTagType: userTagType
|
|
6369
|
+
userTagType: userTagType,
|
|
6370
|
+
cardsRole: cardsRole,
|
|
6371
|
+
isCardsAdmin: isCardsAdmin
|
|
5783
6372
|
};
|
|
5784
6373
|
if (verifyUserId) {
|
|
5785
6374
|
payload.verifyUserId = verifyUserId;
|
|
@@ -5877,8 +6466,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5877
6466
|
}
|
|
5878
6467
|
_errorMsgs.passport_issue_date = '';
|
|
5879
6468
|
}
|
|
5880
|
-
if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false &&
|
|
5881
|
-
fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
6469
|
+
if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
5882
6470
|
_isError = true;
|
|
5883
6471
|
if (_errorArray.indexOf('passport_photo') === -1) {
|
|
5884
6472
|
_errorArray.push('passport_photo');
|
|
@@ -5890,8 +6478,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5890
6478
|
}
|
|
5891
6479
|
_errorMsgs.passport_photo = '';
|
|
5892
6480
|
}
|
|
5893
|
-
if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false &&
|
|
5894
|
-
fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
6481
|
+
if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
|
|
5895
6482
|
_isError = true;
|
|
5896
6483
|
if (_errorArray.indexOf('travel_docs') === -1) {
|
|
5897
6484
|
_errorArray.push('travel_docs');
|
|
@@ -5907,133 +6494,130 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5907
6494
|
if (_isError) {
|
|
5908
6495
|
setErrorArray(_errorArray);
|
|
5909
6496
|
setErrorMsgs(_errorMsgs);
|
|
5910
|
-
|
|
6497
|
+
var _loop3 = function _loop3() {
|
|
5911
6498
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
5912
6499
|
if (_errorMsgs[_key3]) {
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
}
|
|
5927
|
-
}();
|
|
5928
|
-
if (_ret === "break") break;
|
|
6500
|
+
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
6501
|
+
setAdditionalInfoFlag('open');
|
|
6502
|
+
}
|
|
6503
|
+
var el = document.getElementById(_key3 === 'country_code' || _key3 === 'contact_country_code' ? 'contact_number' : _key3);
|
|
6504
|
+
if (el) {
|
|
6505
|
+
setTimeout(function () {
|
|
6506
|
+
el.scrollIntoView({
|
|
6507
|
+
behavior: 'smooth',
|
|
6508
|
+
block: 'center'
|
|
6509
|
+
});
|
|
6510
|
+
}, 500);
|
|
6511
|
+
return 1;
|
|
6512
|
+
}
|
|
5929
6513
|
}
|
|
5930
6514
|
}
|
|
6515
|
+
};
|
|
6516
|
+
for (var _key3 in _errorMsgs) {
|
|
6517
|
+
if (_loop3()) break;
|
|
5931
6518
|
}
|
|
5932
|
-
return Promise.resolve();
|
|
5933
6519
|
}
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
err.contact_number = err.contact_country_code;
|
|
5951
|
-
}
|
|
5952
|
-
if (err.passport) {
|
|
5953
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5954
|
-
delete err.passport;
|
|
5955
|
-
}
|
|
5956
|
-
setErrorArray(Object.keys(err));
|
|
5957
|
-
setErrorMsgs(err);
|
|
5958
|
-
for (var _key4 in err) {
|
|
5959
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
5960
|
-
if (err[_key4]) {
|
|
5961
|
-
var _ret2 = function () {
|
|
5962
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
5963
|
-
setAdditionalInfoFlag('open');
|
|
5964
|
-
}
|
|
5965
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
5966
|
-
if (el) {
|
|
5967
|
-
setTimeout(function () {
|
|
5968
|
-
el.scrollIntoView({
|
|
5969
|
-
behavior: 'smooth',
|
|
5970
|
-
block: 'center'
|
|
5971
|
-
});
|
|
5972
|
-
}, 500);
|
|
5973
|
-
return "break";
|
|
5974
|
-
}
|
|
5975
|
-
}();
|
|
5976
|
-
if (_ret2 === "break") break;
|
|
5977
|
-
}
|
|
6520
|
+
var cardApiflag = false;
|
|
6521
|
+
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6522
|
+
cardApiflag = false;
|
|
6523
|
+
} else {
|
|
6524
|
+
cardApiflag = true;
|
|
6525
|
+
}
|
|
6526
|
+
if (!_isError) {
|
|
6527
|
+
if (isEditMode && editUserId || isProfile) {
|
|
6528
|
+
dispatch(showLoader());
|
|
6529
|
+
if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6530
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6531
|
+
method: 'POST',
|
|
6532
|
+
body: JSON.stringify(cardsPayload),
|
|
6533
|
+
headers: {
|
|
6534
|
+
'Content-Type': 'application/json',
|
|
6535
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5978
6536
|
}
|
|
5979
|
-
}
|
|
5980
|
-
|
|
5981
|
-
|
|
6537
|
+
}).then(function (response) {
|
|
6538
|
+
if (response.status === 200) {
|
|
6539
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6540
|
+
} else {
|
|
6541
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6542
|
+
}
|
|
6543
|
+
})["catch"](function (error) {
|
|
6544
|
+
console.log("errorrr", error);
|
|
6545
|
+
})["finally"](function () {
|
|
6546
|
+
dispatch(stopLoader());
|
|
6547
|
+
});
|
|
5982
6548
|
} else {
|
|
5983
|
-
|
|
6549
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
5984
6550
|
}
|
|
5985
|
-
}
|
|
5986
|
-
dispatch(
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
if (
|
|
6009
|
-
if (err
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6551
|
+
} else {
|
|
6552
|
+
dispatch(showLoader());
|
|
6553
|
+
if (cardApiflag === true) {
|
|
6554
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6555
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6556
|
+
if (res !== null && res !== void 0 && res.user_id) {
|
|
6557
|
+
fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
|
|
6558
|
+
method: 'POST',
|
|
6559
|
+
body: JSON.stringify(cardsPayload),
|
|
6560
|
+
headers: {
|
|
6561
|
+
'Content-Type': 'application/json',
|
|
6562
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6563
|
+
}
|
|
6564
|
+
}).then(function (response) {
|
|
6565
|
+
if (response.status !== 200) {
|
|
6566
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6567
|
+
}
|
|
6568
|
+
})["catch"](function (error) {
|
|
6569
|
+
console.log("errorrr", error);
|
|
6570
|
+
});
|
|
6571
|
+
}
|
|
6572
|
+
(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);
|
|
6573
|
+
})["catch"](function (err) {
|
|
6574
|
+
if (typeof err === 'object') {
|
|
6575
|
+
if (err.country_code) {
|
|
6576
|
+
err.contact_number = err.country_code;
|
|
6577
|
+
}
|
|
6578
|
+
if (err.contact_country_code) {
|
|
6579
|
+
err.contact_number = err.contact_country_code;
|
|
6580
|
+
}
|
|
6581
|
+
if (err.passport) {
|
|
6582
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6583
|
+
delete err.passport;
|
|
6584
|
+
}
|
|
6585
|
+
setErrorArray(Object.keys(err));
|
|
6586
|
+
setErrorMsgs(err);
|
|
6587
|
+
var _loop4 = function _loop4() {
|
|
6588
|
+
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6589
|
+
if (err[_key4]) {
|
|
6590
|
+
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6591
|
+
setAdditionalInfoFlag('open');
|
|
6592
|
+
}
|
|
6593
|
+
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6594
|
+
if (el) {
|
|
6595
|
+
setTimeout(function () {
|
|
6596
|
+
el.scrollIntoView({
|
|
6597
|
+
behavior: 'smooth',
|
|
6598
|
+
block: 'center'
|
|
6599
|
+
});
|
|
6600
|
+
}, 500);
|
|
6601
|
+
return 1;
|
|
6602
|
+
}
|
|
6023
6603
|
}
|
|
6024
|
-
}
|
|
6025
|
-
|
|
6604
|
+
}
|
|
6605
|
+
};
|
|
6606
|
+
for (var _key4 in err) {
|
|
6607
|
+
if (_loop4()) break;
|
|
6026
6608
|
}
|
|
6609
|
+
} else if (typeof err === 'string') {
|
|
6610
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6611
|
+
} else {
|
|
6612
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6027
6613
|
}
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
|
-
|
|
6614
|
+
})["finally"](function () {
|
|
6615
|
+
dispatch(stopLoader());
|
|
6616
|
+
});
|
|
6031
6617
|
} else {
|
|
6032
|
-
|
|
6618
|
+
createUserApiCall(payload);
|
|
6033
6619
|
}
|
|
6034
|
-
}
|
|
6035
|
-
dispatch(stopLoader());
|
|
6036
|
-
});
|
|
6620
|
+
}
|
|
6037
6621
|
}
|
|
6038
6622
|
return Promise.resolve();
|
|
6039
6623
|
} catch (e) {
|
|
@@ -6049,10 +6633,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6049
6633
|
window.location.href = config.routes.profile.redirectUrl.cancel;
|
|
6050
6634
|
}
|
|
6051
6635
|
}
|
|
6052
|
-
}
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
(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);
|
|
6636
|
+
} else {
|
|
6637
|
+
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6638
|
+
(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);
|
|
6056
6639
|
}
|
|
6057
6640
|
};
|
|
6058
6641
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6072,18 +6655,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6072
6655
|
if (verifyUserId) {
|
|
6073
6656
|
dispatch(showLoader());
|
|
6074
6657
|
dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
|
|
6658
|
+
setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
|
|
6075
6659
|
setPersonalInfoInput(function (prevState) {
|
|
6076
6660
|
return _extends({}, prevState, {
|
|
6077
|
-
first_name: res.
|
|
6078
|
-
last_name: res.
|
|
6661
|
+
first_name: res.first_name,
|
|
6662
|
+
last_name: res.last_name,
|
|
6079
6663
|
email: res.email,
|
|
6080
|
-
contact_number: res.
|
|
6081
|
-
dob: function () {
|
|
6082
|
-
var dt = new Date(res.dob);
|
|
6083
|
-
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
6084
|
-
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
6085
|
-
}(),
|
|
6086
|
-
|
|
6664
|
+
contact_number: res === null || res === void 0 ? void 0 : res.contact_number,
|
|
6087
6665
|
gender: function () {
|
|
6088
6666
|
if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
|
|
6089
6667
|
}()
|
|
@@ -6128,7 +6706,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6128
6706
|
}()
|
|
6129
6707
|
});
|
|
6130
6708
|
});
|
|
6131
|
-
|
|
6132
6709
|
if (res.client_admin) {
|
|
6133
6710
|
setTravelApproversInput(function (prevState) {
|
|
6134
6711
|
var nextState = _extends({}, prevState);
|
|
@@ -6162,7 +6739,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6162
6739
|
});
|
|
6163
6740
|
}
|
|
6164
6741
|
};
|
|
6165
|
-
|
|
6166
6742
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
6167
6743
|
component: "div",
|
|
6168
6744
|
className: styles.UUIUserManagementAddEdit
|
|
@@ -6179,8 +6755,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6179
6755
|
className: styles.breadcrumb
|
|
6180
6756
|
}, /*#__PURE__*/React.createElement(IUIBreadCrumb, {
|
|
6181
6757
|
breadCrumbs: [{
|
|
6182
|
-
href:
|
|
6183
|
-
config.routes.users.list.path,
|
|
6758
|
+
href: config.routes.users.list.path,
|
|
6184
6759
|
label: 'Users',
|
|
6185
6760
|
hasLink: true
|
|
6186
6761
|
}]
|
|
@@ -6249,6 +6824,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6249
6824
|
if (!p.visibility) {
|
|
6250
6825
|
return null;
|
|
6251
6826
|
}
|
|
6827
|
+
if (p.name === 'profile_pic' && config.env.isExpenseProduct) {
|
|
6828
|
+
return null;
|
|
6829
|
+
}
|
|
6252
6830
|
return /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6253
6831
|
item: true,
|
|
6254
6832
|
sm: 12,
|
|
@@ -6370,6 +6948,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6370
6948
|
className: styles.productContainerGap
|
|
6371
6949
|
}, renderFields.products.map(function (p, i) {
|
|
6372
6950
|
p.readOnly = isProfile;
|
|
6951
|
+
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6952
|
+
p.readOnly = true;
|
|
6953
|
+
p.disableText = "Only card admin can change this access.";
|
|
6954
|
+
} else if (p.id === 3 && editUserId === (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6955
|
+
p.readOnly = true;
|
|
6956
|
+
p.disableText = "You cannot update your own Card product";
|
|
6957
|
+
}
|
|
6373
6958
|
return /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6374
6959
|
item: true,
|
|
6375
6960
|
sm: 12,
|
|
@@ -6462,6 +7047,21 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6462
7047
|
isProfile: isProfile,
|
|
6463
7048
|
editUserId: editUserId,
|
|
6464
7049
|
roles: renderFields.expenseRoles
|
|
7050
|
+
}), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
7051
|
+
className: styles.dividerColor
|
|
7052
|
+
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React.createElement(CardsField, {
|
|
7053
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7054
|
+
type: "card",
|
|
7055
|
+
isProfile: isProfile,
|
|
7056
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7057
|
+
var _value = _ref7._value;
|
|
7058
|
+
return setCardsRole(_value);
|
|
7059
|
+
},
|
|
7060
|
+
roleValue: cardsRole,
|
|
7061
|
+
roles: cardsDetails.cardsRoles,
|
|
7062
|
+
cardsAdmin: isCardsAdmin,
|
|
7063
|
+
editUserId: editUserId,
|
|
7064
|
+
loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
|
|
6465
7065
|
}))) : /*#__PURE__*/React.createElement(VerificationError, {
|
|
6466
7066
|
config: config,
|
|
6467
7067
|
errMsg: hasVerificationError
|
|
@@ -6627,17 +7227,13 @@ var uploadBulkUsersFile = function uploadBulkUsersFile(payload) {
|
|
|
6627
7227
|
});
|
|
6628
7228
|
};
|
|
6629
7229
|
};
|
|
6630
|
-
|
|
6631
7230
|
var uploadFileToS3$1 = function uploadFileToS3(presignedPostData, file) {
|
|
6632
7231
|
return new Promise(function (resolve, reject) {
|
|
6633
7232
|
var formData = new FormData();
|
|
6634
|
-
|
|
6635
7233
|
Object.keys(presignedPostData.fields).forEach(function (key) {
|
|
6636
7234
|
formData.append(key, presignedPostData.fields[key]);
|
|
6637
7235
|
});
|
|
6638
|
-
|
|
6639
7236
|
formData.append('file', file);
|
|
6640
|
-
|
|
6641
7237
|
axios.post(presignedPostData.url, formData, {
|
|
6642
7238
|
headers: {
|
|
6643
7239
|
'Content-Type': 'multipart/form-data'
|
|
@@ -6754,7 +7350,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
|
|
|
6754
7350
|
};
|
|
6755
7351
|
};
|
|
6756
7352
|
|
|
6757
|
-
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"};
|
|
7353
|
+
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"};
|
|
6758
7354
|
|
|
6759
7355
|
var BulkUploadModal = function BulkUploadModal(props) {
|
|
6760
7356
|
var isOpenImportUsersModal = props.isOpenImportUsersModal,
|
|
@@ -6823,7 +7419,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
|
|
|
6823
7419
|
file: doc
|
|
6824
7420
|
});
|
|
6825
7421
|
});
|
|
6826
|
-
var
|
|
7422
|
+
var _temp = _forTo(docs, function (i) {
|
|
6827
7423
|
return Promise.resolve(dispatch(uploadBulkUsersFile(docs[i]))).then(function (res) {
|
|
6828
7424
|
return Promise.resolve(dispatch(validateUploadedFile(res.user_file_name)).then(function (validatedRes) {
|
|
6829
7425
|
if (validatedRes.data.status) {
|
|
@@ -6863,7 +7459,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
|
|
|
6863
7459
|
})).then(function () {});
|
|
6864
7460
|
});
|
|
6865
7461
|
});
|
|
6866
|
-
return Promise.resolve(
|
|
7462
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
6867
7463
|
} catch (e) {
|
|
6868
7464
|
return Promise.reject(e);
|
|
6869
7465
|
}
|
|
@@ -7038,7 +7634,6 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
|
|
|
7038
7634
|
setOpenImportUsersModal(false);
|
|
7039
7635
|
handleImportPagenavigation(jobId);
|
|
7040
7636
|
};
|
|
7041
|
-
|
|
7042
7637
|
var handleDownloadRecords = function handleDownloadRecords(type) {
|
|
7043
7638
|
try {
|
|
7044
7639
|
setDownlStatus(true);
|
|
@@ -8064,7 +8659,6 @@ var DropdownBtn = function DropdownBtn(props) {
|
|
|
8064
8659
|
if (val.disable) return false;
|
|
8065
8660
|
if (val.handler && typeof val.handler === 'function') val.handler();
|
|
8066
8661
|
};
|
|
8067
|
-
|
|
8068
8662
|
var prevOpen = React.useRef(open);
|
|
8069
8663
|
React.useEffect(function () {
|
|
8070
8664
|
if (prevOpen.current === true && open === false) {
|
|
@@ -8179,6 +8773,10 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8179
8773
|
selected = props.selected,
|
|
8180
8774
|
_props$handleSingleCh = props.handleSingleCheckBoxClick,
|
|
8181
8775
|
handleSingleCheckBoxClick = _props$handleSingleCh === void 0 ? function () {} : _props$handleSingleCh,
|
|
8776
|
+
_props$onResetPasswor = props.onResetPasswordHandler,
|
|
8777
|
+
onResetPasswordHandler = _props$onResetPasswor === void 0 ? function () {} : _props$onResetPasswor,
|
|
8778
|
+
_props$toggleInviteMo = props.toggleInviteModal,
|
|
8779
|
+
toggleInviteModal = _props$toggleInviteMo === void 0 ? function () {} : _props$toggleInviteMo,
|
|
8182
8780
|
orderBy = props.orderBy,
|
|
8183
8781
|
order = props.order,
|
|
8184
8782
|
_props$onRequestSort = props.onRequestSort,
|
|
@@ -8196,6 +8794,21 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8196
8794
|
searchValue = props.searchValue,
|
|
8197
8795
|
_props$isILadmin = props.isILadmin,
|
|
8198
8796
|
isILadmin = _props$isILadmin === void 0 ? false : _props$isILadmin;
|
|
8797
|
+
var useStyles = makeStyles(function (theme) {
|
|
8798
|
+
return {
|
|
8799
|
+
tooltip: {
|
|
8800
|
+
background: '#1F2937',
|
|
8801
|
+
fontSize: '14px',
|
|
8802
|
+
color: '#ffffff',
|
|
8803
|
+
padding: '12px 16px',
|
|
8804
|
+
borderRadius: '6px'
|
|
8805
|
+
},
|
|
8806
|
+
arrow: {
|
|
8807
|
+
color: '#1F2937'
|
|
8808
|
+
}
|
|
8809
|
+
};
|
|
8810
|
+
});
|
|
8811
|
+
var classes = useStyles();
|
|
8199
8812
|
var columns = [{
|
|
8200
8813
|
id: 'first_name',
|
|
8201
8814
|
label: 'Name',
|
|
@@ -8215,6 +8828,27 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8215
8828
|
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
|
|
8216
8829
|
}));
|
|
8217
8830
|
}
|
|
8831
|
+
}, {
|
|
8832
|
+
id: 'first_name',
|
|
8833
|
+
label: '',
|
|
8834
|
+
minWidth: 60,
|
|
8835
|
+
sortable: false,
|
|
8836
|
+
cell: function cell(row) {
|
|
8837
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8838
|
+
component: "div",
|
|
8839
|
+
width: 80
|
|
8840
|
+
}, row && row.has_visited === 0 ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
8841
|
+
title: "This user hasn't logged in to the platform yet",
|
|
8842
|
+
arrow: true,
|
|
8843
|
+
classes: {
|
|
8844
|
+
arrow: classes.arrow,
|
|
8845
|
+
tooltip: classes.tooltip
|
|
8846
|
+
},
|
|
8847
|
+
placement: "top-start"
|
|
8848
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
8849
|
+
className: clsx(styles$5.tooltipTextDiv)
|
|
8850
|
+
}, "Invited")) : null);
|
|
8851
|
+
}
|
|
8218
8852
|
}, {
|
|
8219
8853
|
id: 'emp_info__department__name',
|
|
8220
8854
|
label: 'Department',
|
|
@@ -8236,7 +8870,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8236
8870
|
cell: function cell(row) {
|
|
8237
8871
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8238
8872
|
component: "div"
|
|
8239
|
-
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
8873
|
+
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, !row.products[0].role.toLowerCase().includes("holder") ? /*#__PURE__*/React.createElement(IUIBox, {
|
|
8240
8874
|
component: "div",
|
|
8241
8875
|
display: "flex"
|
|
8242
8876
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8249,7 +8883,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8249
8883
|
style: {
|
|
8250
8884
|
whiteSpace: 'nowrap'
|
|
8251
8885
|
}
|
|
8252
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8886
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && !row.products[1].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8253
8887
|
component: "div",
|
|
8254
8888
|
display: "flex"
|
|
8255
8889
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8262,7 +8896,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8262
8896
|
style: {
|
|
8263
8897
|
whiteSpace: 'nowrap'
|
|
8264
8898
|
}
|
|
8265
|
-
}, "\xA0" + row.products[1].role)))
|
|
8899
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && !row.products[2].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8900
|
+
component: "div",
|
|
8901
|
+
display: "flex"
|
|
8902
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8903
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8904
|
+
style: {
|
|
8905
|
+
whiteSpace: 'nowrap'
|
|
8906
|
+
}
|
|
8907
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React.createElement(IUITypography, {
|
|
8908
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8909
|
+
style: {
|
|
8910
|
+
whiteSpace: 'nowrap'
|
|
8911
|
+
}
|
|
8912
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8266
8913
|
}
|
|
8267
8914
|
}, {
|
|
8268
8915
|
id: 'status',
|
|
@@ -8302,6 +8949,21 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8302
8949
|
return onEditHandler(row.id);
|
|
8303
8950
|
}
|
|
8304
8951
|
}];
|
|
8952
|
+
if (row && row.has_visited && row.is_active) {
|
|
8953
|
+
options.push({
|
|
8954
|
+
label: 'Reset password',
|
|
8955
|
+
handler: function handler() {
|
|
8956
|
+
return onResetPasswordHandler(row.email);
|
|
8957
|
+
}
|
|
8958
|
+
});
|
|
8959
|
+
} else if (row && row.is_active) {
|
|
8960
|
+
options.push({
|
|
8961
|
+
label: 'Resend invite',
|
|
8962
|
+
handler: function handler() {
|
|
8963
|
+
return toggleInviteModal(row.id, 'single', row.first_name, row.last_name);
|
|
8964
|
+
}
|
|
8965
|
+
});
|
|
8966
|
+
}
|
|
8305
8967
|
if (isILadmin) {
|
|
8306
8968
|
options.push({
|
|
8307
8969
|
label: 'Make primary admin',
|
|
@@ -8325,6 +8987,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8325
8987
|
endIcon: null,
|
|
8326
8988
|
outlinedBtn: false,
|
|
8327
8989
|
className: "threedotMenuBtn",
|
|
8990
|
+
MoreHorizIcon: true,
|
|
8328
8991
|
placement: "bottom-end"
|
|
8329
8992
|
}));
|
|
8330
8993
|
},
|
|
@@ -8332,7 +8995,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8332
8995
|
paddingLeft: '40px'
|
|
8333
8996
|
}
|
|
8334
8997
|
}];
|
|
8335
|
-
|
|
8336
8998
|
return /*#__PURE__*/React.createElement(IUITable, {
|
|
8337
8999
|
searchPlaceholder: "Search by name, email & department",
|
|
8338
9000
|
isCheckboxTable: true,
|
|
@@ -8355,7 +9017,8 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8355
9017
|
isDataFetching: isDataFetching,
|
|
8356
9018
|
disableRowCheckbox: disableRowCheckbox,
|
|
8357
9019
|
searchBoxWidth: "400px",
|
|
8358
|
-
searchValue: searchValue
|
|
9020
|
+
searchValue: searchValue,
|
|
9021
|
+
hideTopPagination: false
|
|
8359
9022
|
});
|
|
8360
9023
|
};
|
|
8361
9024
|
var SingupRequests = function SingupRequests(props) {
|
|
@@ -8386,20 +9049,18 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8386
9049
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
8387
9050
|
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
8388
9051
|
};
|
|
8389
|
-
|
|
8390
9052
|
var columns = [{
|
|
8391
|
-
id: '
|
|
9053
|
+
id: 'first_name',
|
|
8392
9054
|
label: 'Name',
|
|
8393
9055
|
minWidth: 250,
|
|
8394
9056
|
sortable: true,
|
|
8395
9057
|
cell: function cell(row) {
|
|
8396
9058
|
var _row$profile_pic2;
|
|
8397
9059
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIProfileBox, {
|
|
8398
|
-
firstName: row.
|
|
8399
|
-
lastName: row.
|
|
8400
|
-
isLetterAvatar:
|
|
8401
|
-
row.
|
|
8402
|
-
primaryText: row.fname + ' ' + row.lname,
|
|
9060
|
+
firstName: row.first_name,
|
|
9061
|
+
lastName: row.last_name,
|
|
9062
|
+
isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
|
|
9063
|
+
primaryText: row.first_name + ' ' + row.last_name,
|
|
8403
9064
|
secondaryText: row.email,
|
|
8404
9065
|
letterAvatarTextColor: "black",
|
|
8405
9066
|
letterAvatarBackgroundColor: "#d3d3d3",
|
|
@@ -8408,7 +9069,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8408
9069
|
}));
|
|
8409
9070
|
}
|
|
8410
9071
|
}, {
|
|
8411
|
-
id: '
|
|
9072
|
+
id: 'created_at',
|
|
8412
9073
|
label: 'Requested on',
|
|
8413
9074
|
minWidth: 100,
|
|
8414
9075
|
sortable: true,
|
|
@@ -8418,7 +9079,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8418
9079
|
width: 100
|
|
8419
9080
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8420
9081
|
className: clsx(styles$5.rowText, styles$5.textTransform)
|
|
8421
|
-
}, formatDate(row.
|
|
9082
|
+
}, formatDate(row.created_at)));
|
|
8422
9083
|
}
|
|
8423
9084
|
}, {
|
|
8424
9085
|
id: 'actions',
|
|
@@ -8472,11 +9133,89 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8472
9133
|
});
|
|
8473
9134
|
};
|
|
8474
9135
|
|
|
9136
|
+
function InfoYellowIcon(props) {
|
|
9137
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
9138
|
+
width: props.width,
|
|
9139
|
+
height: props.height,
|
|
9140
|
+
viewBox: "0 0 20 20",
|
|
9141
|
+
fill: "none",
|
|
9142
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9143
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
9144
|
+
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",
|
|
9145
|
+
fill: "#CA8A04"
|
|
9146
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
9147
|
+
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",
|
|
9148
|
+
fill: "#CA8A04"
|
|
9149
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
9150
|
+
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",
|
|
9151
|
+
fill: "#CA8A04"
|
|
9152
|
+
}));
|
|
9153
|
+
}
|
|
9154
|
+
|
|
9155
|
+
function RedWarningIcon(props) {
|
|
9156
|
+
var _props$color = props.color,
|
|
9157
|
+
color = _props$color === void 0 ? '#E11D48' : _props$color,
|
|
9158
|
+
_props$size = props.size,
|
|
9159
|
+
size = _props$size === void 0 ? '14' : _props$size;
|
|
9160
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
9161
|
+
width: size,
|
|
9162
|
+
height: size,
|
|
9163
|
+
viewBox: "0 0 14 14",
|
|
9164
|
+
fill: color,
|
|
9165
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9166
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
9167
|
+
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",
|
|
9168
|
+
fill: color
|
|
9169
|
+
}));
|
|
9170
|
+
}
|
|
9171
|
+
|
|
9172
|
+
function InviteInfoIcon() {
|
|
9173
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
9174
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9175
|
+
width: "20",
|
|
9176
|
+
height: "20",
|
|
9177
|
+
fill: "none",
|
|
9178
|
+
viewBox: "0 0 20 20"
|
|
9179
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
9180
|
+
fill: "#CA8A04",
|
|
9181
|
+
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"
|
|
9182
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
9183
|
+
fill: "#CA8A04",
|
|
9184
|
+
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"
|
|
9185
|
+
}));
|
|
9186
|
+
}
|
|
9187
|
+
|
|
8475
9188
|
var IUIToastMessageService$7 = services.IUIToastMessageService;
|
|
8476
|
-
var env$7 = configs.env
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
9189
|
+
var env$7 = configs.env,
|
|
9190
|
+
api$7 = configs.api;
|
|
9191
|
+
var UndoButton = function UndoButton(_ref) {
|
|
9192
|
+
var onUndo = _ref.onUndo,
|
|
9193
|
+
msg = _ref.msg;
|
|
9194
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9195
|
+
style: {
|
|
9196
|
+
display: 'flex',
|
|
9197
|
+
flexDirection: 'row',
|
|
9198
|
+
width: '270px',
|
|
9199
|
+
justifyContent: 'space-between'
|
|
9200
|
+
}
|
|
9201
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
9202
|
+
style: {
|
|
9203
|
+
whiteSpace: 'nowrap',
|
|
9204
|
+
paddingTop: '8px'
|
|
9205
|
+
}
|
|
9206
|
+
}, msg), /*#__PURE__*/React.createElement("p", {
|
|
9207
|
+
onClick: onUndo,
|
|
9208
|
+
style: {
|
|
9209
|
+
whiteSpace: 'nowrap',
|
|
9210
|
+
fontWeight: '600',
|
|
9211
|
+
fontSize: '1rem',
|
|
9212
|
+
padding: '8px 20px 0'
|
|
9213
|
+
}
|
|
9214
|
+
}, "UNDO"));
|
|
9215
|
+
};
|
|
9216
|
+
var UserList = function UserList(_ref2) {
|
|
9217
|
+
var config = _ref2.config,
|
|
9218
|
+
isProfile = _ref2.isProfile;
|
|
8480
9219
|
env$7.init(config, isProfile);
|
|
8481
9220
|
var history = useHistory();
|
|
8482
9221
|
var _useSelector = useSelector(function (state) {
|
|
@@ -8486,27 +9225,49 @@ var UserList = function UserList(_ref) {
|
|
|
8486
9225
|
isDataFetching = _useSelector.isDataFetching,
|
|
8487
9226
|
deactivatedUsers = _useSelector.deactivatedUsers,
|
|
8488
9227
|
tabValue = _useSelector.tabValue;
|
|
8489
|
-
var
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
searchValue = _useState2[0],
|
|
8506
|
-
setSearchValue = _useState2[1];
|
|
9228
|
+
var newSelecteds = userListInfo.results;
|
|
9229
|
+
var _React$useState = React.useState(''),
|
|
9230
|
+
deactivateUser = _React$useState[0],
|
|
9231
|
+
setDeactivateUser = _React$useState[1];
|
|
9232
|
+
var _React$useState2 = React.useState(null),
|
|
9233
|
+
defaultId = _React$useState2[0],
|
|
9234
|
+
setDefaultId = _React$useState2[1];
|
|
9235
|
+
var _React$useState3 = React.useState(1),
|
|
9236
|
+
page = _React$useState3[0],
|
|
9237
|
+
setPage = _React$useState3[1];
|
|
9238
|
+
var _useState = useState([]),
|
|
9239
|
+
selectedUsersNotApprover = _useState[0],
|
|
9240
|
+
setSelectedUsersNotApprover = _useState[1];
|
|
9241
|
+
var _useState2 = useState([]),
|
|
9242
|
+
selectedUsersApprover = _useState2[0],
|
|
9243
|
+
setSelectedUsersApprover = _useState2[1];
|
|
8507
9244
|
var _useState3 = useState(false),
|
|
8508
|
-
|
|
8509
|
-
|
|
9245
|
+
isBulkDeactivateModalOpen = _useState3[0],
|
|
9246
|
+
setIsBulkDeactivateModalOpen = _useState3[1];
|
|
9247
|
+
var _React$useState4 = React.useState(''),
|
|
9248
|
+
user = _React$useState4[0],
|
|
9249
|
+
setUser = _React$useState4[1];
|
|
9250
|
+
var _useState4 = useState(10),
|
|
9251
|
+
rowsPerPage = _useState4[0],
|
|
9252
|
+
setRowsPerPage = _useState4[1];
|
|
9253
|
+
var _React$useState5 = React.useState({}),
|
|
9254
|
+
selected = _React$useState5[0],
|
|
9255
|
+
setSelected = _React$useState5[1];
|
|
9256
|
+
var _React$useState6 = React.useState('asc'),
|
|
9257
|
+
order = _React$useState6[0],
|
|
9258
|
+
setOrder = _React$useState6[1];
|
|
9259
|
+
var _React$useState7 = React.useState(false),
|
|
9260
|
+
deactivateSingle = _React$useState7[0],
|
|
9261
|
+
setDeactivateSingle = _React$useState7[1];
|
|
9262
|
+
var _React$useState8 = React.useState('first_name'),
|
|
9263
|
+
orderBy = _React$useState8[0],
|
|
9264
|
+
setOrderBy = _React$useState8[1];
|
|
9265
|
+
var _useState5 = useState(''),
|
|
9266
|
+
searchValue = _useState5[0],
|
|
9267
|
+
setSearchValue = _useState5[1];
|
|
9268
|
+
var _useState6 = useState(false),
|
|
9269
|
+
isOpenDeActivateModal = _useState6[0],
|
|
9270
|
+
setOpenDeActivateModalFlag = _useState6[1];
|
|
8510
9271
|
var _useSelector2 = useSelector(function (state) {
|
|
8511
9272
|
return state.common;
|
|
8512
9273
|
}),
|
|
@@ -8514,69 +9275,140 @@ var UserList = function UserList(_ref) {
|
|
|
8514
9275
|
hasVerificationError = _useSelector2.hasVerificationError,
|
|
8515
9276
|
isILadmin = _useSelector2.isILadmin,
|
|
8516
9277
|
companyName = _useSelector2.companyName;
|
|
8517
|
-
var _useState4 = useState(false),
|
|
8518
|
-
isOpenImportUsersModal = _useState4[0],
|
|
8519
|
-
setOpenImportUsersModal = _useState4[1];
|
|
8520
|
-
var _useState5 = useState(false),
|
|
8521
|
-
isFileDownloading = _useState5[0],
|
|
8522
|
-
setDownlStatus = _useState5[1];
|
|
8523
|
-
var _useState6 = useState(false),
|
|
8524
|
-
isSortingChange = _useState6[0],
|
|
8525
|
-
setSortingChange = _useState6[1];
|
|
8526
9278
|
var _useState7 = useState(false),
|
|
8527
|
-
|
|
8528
|
-
|
|
9279
|
+
isOpenImportUsersModal = _useState7[0],
|
|
9280
|
+
setOpenImportUsersModal = _useState7[1];
|
|
8529
9281
|
var _useState8 = useState(false),
|
|
8530
|
-
|
|
8531
|
-
|
|
9282
|
+
approveeStatus = _useState8[0],
|
|
9283
|
+
setApproveeStatus = _useState8[1];
|
|
8532
9284
|
var _useState9 = useState(false),
|
|
8533
|
-
|
|
8534
|
-
|
|
9285
|
+
isFileDownloading = _useState9[0],
|
|
9286
|
+
setDownlStatus = _useState9[1];
|
|
8535
9287
|
var _useState10 = useState(false),
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
setSignUpRowsPerPage = _useState11[1];
|
|
8545
|
-
var _React$useState6 = React.useState('asc'),
|
|
8546
|
-
signup_order = _React$useState6[0],
|
|
8547
|
-
setSignUpOrder = _React$useState6[1];
|
|
8548
|
-
var _React$useState7 = React.useState('fname'),
|
|
8549
|
-
signup_orderBy = _React$useState7[0],
|
|
8550
|
-
setSignUpOrderBy = _React$useState7[1];
|
|
8551
|
-
var _useState12 = useState(''),
|
|
8552
|
-
signup_searchValue = _useState12[0],
|
|
8553
|
-
set_signup_SearchValue = _useState12[1];
|
|
9288
|
+
isSortingChange = _useState10[0],
|
|
9289
|
+
setSortingChange = _useState10[1];
|
|
9290
|
+
var _useState11 = useState(false),
|
|
9291
|
+
isSearchingChange = _useState11[0],
|
|
9292
|
+
setSearchingChange = _useState11[1];
|
|
9293
|
+
var _useState12 = useState(false),
|
|
9294
|
+
isSortingChangeTemp = _useState12[0],
|
|
9295
|
+
setSortingChangeTemp = _useState12[1];
|
|
8554
9296
|
var _useState13 = useState(false),
|
|
8555
|
-
|
|
8556
|
-
|
|
9297
|
+
isSearchingChangeTemp = _useState13[0],
|
|
9298
|
+
setSearchingChangeTemp = _useState13[1];
|
|
8557
9299
|
var _useState14 = useState(false),
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
var _useState15 = useState(
|
|
8561
|
-
|
|
8562
|
-
|
|
9300
|
+
isApiFetching = _useState14[0],
|
|
9301
|
+
setisApiFetching = _useState14[1];
|
|
9302
|
+
var _useState15 = useState({
|
|
9303
|
+
value: '',
|
|
9304
|
+
label: 'Select approver'
|
|
9305
|
+
}),
|
|
9306
|
+
approverRole = _useState15[0],
|
|
9307
|
+
setApproverRole = _useState15[1];
|
|
8563
9308
|
var _useState16 = useState(false),
|
|
8564
|
-
|
|
8565
|
-
|
|
9309
|
+
showInviteModal = _useState16[0],
|
|
9310
|
+
setToggleInviteModal = _useState16[1];
|
|
9311
|
+
var _useState17 = useState(''),
|
|
9312
|
+
userIds = _useState17[0],
|
|
9313
|
+
setUserIds = _useState17[1];
|
|
9314
|
+
var _React$useState9 = React.useState(false),
|
|
9315
|
+
overlayMenu = _React$useState9[0],
|
|
9316
|
+
setOverlayMenu = _React$useState9[1];
|
|
9317
|
+
var _useState18 = useState(''),
|
|
9318
|
+
userFirstName = _useState18[0],
|
|
9319
|
+
setUserFirstName = _useState18[1];
|
|
9320
|
+
var _useState19 = useState(''),
|
|
9321
|
+
userLastName = _useState19[0],
|
|
9322
|
+
setUserLastName = _useState19[1];
|
|
9323
|
+
var _useState20 = useState(true),
|
|
9324
|
+
isDisabledSubmitBtn = _useState20[0],
|
|
9325
|
+
setIsDisabledSubmitBtn = _useState20[1];
|
|
9326
|
+
useScrollPosition(function (_ref3) {
|
|
9327
|
+
var prevPos = _ref3.prevPos,
|
|
9328
|
+
currPos = _ref3.currPos;
|
|
9329
|
+
if (prevPos.y - currPos.y > 0) {
|
|
9330
|
+
if (currPos.y <= -275) {
|
|
9331
|
+
setOverlayMenu(true);
|
|
9332
|
+
}
|
|
9333
|
+
} else {
|
|
9334
|
+
if (currPos.y > -295) {
|
|
9335
|
+
setOverlayMenu(false);
|
|
9336
|
+
}
|
|
9337
|
+
}
|
|
9338
|
+
}, [overlayMenu]);
|
|
9339
|
+
var scrollTo = function scrollTo(id) {
|
|
9340
|
+
var el = document.getElementById(id);
|
|
9341
|
+
window.scrollTo({
|
|
9342
|
+
top: el.offsetTop,
|
|
9343
|
+
behavior: 'smooth'
|
|
9344
|
+
});
|
|
9345
|
+
};
|
|
9346
|
+
var _React$useState10 = React.useState(1),
|
|
9347
|
+
signup_page = _React$useState10[0],
|
|
9348
|
+
setSignUpPage = _React$useState10[1];
|
|
9349
|
+
var _useState21 = useState(5),
|
|
9350
|
+
signup_rowsPerPage = _useState21[0],
|
|
9351
|
+
setSignUpRowsPerPage = _useState21[1];
|
|
9352
|
+
var _React$useState11 = React.useState('asc'),
|
|
9353
|
+
signup_order = _React$useState11[0],
|
|
9354
|
+
setSignUpOrder = _React$useState11[1];
|
|
9355
|
+
var _React$useState12 = React.useState('first_name'),
|
|
9356
|
+
signup_orderBy = _React$useState12[0],
|
|
9357
|
+
setSignUpOrderBy = _React$useState12[1];
|
|
9358
|
+
var _useState22 = useState(''),
|
|
9359
|
+
signup_searchValue = _useState22[0],
|
|
9360
|
+
set_signup_SearchValue = _useState22[1];
|
|
9361
|
+
var _useState23 = useState(false),
|
|
9362
|
+
isSignUpSortingChange = _useState23[0],
|
|
9363
|
+
setSignUpSortingChange = _useState23[1];
|
|
9364
|
+
var _useState24 = useState(false),
|
|
9365
|
+
isSignUpSearchingChange = _useState24[0],
|
|
9366
|
+
setSignUpSearchingChange = _useState24[1];
|
|
9367
|
+
var _useState25 = useState(false),
|
|
9368
|
+
isSignUpSortingChangeTemp = _useState25[0],
|
|
9369
|
+
setSignUpSortingChangeTemp = _useState25[1];
|
|
9370
|
+
var _useState26 = useState(false),
|
|
9371
|
+
isSignUpSearchingChangeTemp = _useState26[0],
|
|
9372
|
+
setSignUpSearchingChangeTemp = _useState26[1];
|
|
8566
9373
|
var _useSelector3 = useSelector(function (state) {
|
|
8567
9374
|
return state.userList;
|
|
8568
9375
|
}),
|
|
8569
9376
|
signupRequestListInfo = _useSelector3.signupRequestListInfo;
|
|
9377
|
+
var redirectToNotifications = function redirectToNotifications() {
|
|
9378
|
+
if (config.routes.notification) {
|
|
9379
|
+
history.push({
|
|
9380
|
+
pathname: config.routes.notification.path
|
|
9381
|
+
});
|
|
9382
|
+
}
|
|
9383
|
+
};
|
|
8570
9384
|
var openDeactivateModal = function openDeactivateModal() {
|
|
8571
9385
|
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
8572
9386
|
IUIToastMessageService$7.warningNotify('Select at least one user to deactivate.');
|
|
8573
9387
|
return false;
|
|
8574
9388
|
}
|
|
8575
|
-
|
|
9389
|
+
if (selectedUsersApprover.length) {
|
|
9390
|
+
var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9391
|
+
var _SelectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9392
|
+
var _selected = Object.values(selected).flat();
|
|
9393
|
+
_SelectedUsersNotApprover = _SelectedUsersNotApprover.filter(function (item) {
|
|
9394
|
+
return _selected.includes(item.id.toString());
|
|
9395
|
+
});
|
|
9396
|
+
_SelectedUsersApprover = _SelectedUsersApprover.filter(function (item) {
|
|
9397
|
+
return _selected.includes(item.id.toString());
|
|
9398
|
+
});
|
|
9399
|
+
setSelectedUsersNotApprover(_SelectedUsersNotApprover);
|
|
9400
|
+
setSelectedUsersApprover(_SelectedUsersApprover);
|
|
9401
|
+
setIsBulkDeactivateModalOpen(true);
|
|
9402
|
+
} else {
|
|
9403
|
+
setOpenDeActivateModalFlag(true);
|
|
9404
|
+
}
|
|
8576
9405
|
};
|
|
8577
9406
|
var closeDeActivateModal = function closeDeActivateModal() {
|
|
8578
9407
|
setOpenDeActivateModalFlag(false);
|
|
8579
9408
|
};
|
|
9409
|
+
var closeDeActiveModal = function closeDeActiveModal() {
|
|
9410
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9411
|
+
};
|
|
8580
9412
|
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
8581
9413
|
history.push(config.routes.users.add.path);
|
|
8582
9414
|
};
|
|
@@ -8589,50 +9421,32 @@ var UserList = function UserList(_ref) {
|
|
|
8589
9421
|
var handleVerifyUserClick = function handleVerifyUserClick(userId) {
|
|
8590
9422
|
history.push(config.routes.users.add.path + "?" + config.routes.users.add.queryParamKeys.verifyUserId + "=" + userId);
|
|
8591
9423
|
};
|
|
8592
|
-
var UndoButton = function UndoButton(_ref2) {
|
|
8593
|
-
var msg = _ref2.msg,
|
|
8594
|
-
id = _ref2.id;
|
|
8595
|
-
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8596
|
-
display: "flex",
|
|
8597
|
-
flexDirection: "row",
|
|
8598
|
-
width: "270px"
|
|
8599
|
-
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8600
|
-
style: {
|
|
8601
|
-
whiteSpace: 'nowrap',
|
|
8602
|
-
paddingTop: '8px'
|
|
8603
|
-
}
|
|
8604
|
-
}, msg), /*#__PURE__*/React.createElement(IUIButton, {
|
|
8605
|
-
type: "text",
|
|
8606
|
-
buttonText: "UNDO",
|
|
8607
|
-
style: {
|
|
8608
|
-
color: '#FFFFFF'
|
|
8609
|
-
},
|
|
8610
|
-
onClick: function onClick() {
|
|
8611
|
-
return dispatch(undoneSignUpRejection(id));
|
|
8612
|
-
}
|
|
8613
|
-
}));
|
|
8614
|
-
};
|
|
8615
9424
|
var handleRejectUserClick = function handleRejectUserClick(userId) {
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
9425
|
+
IUIToastMessageService$7.undoNotify( /*#__PURE__*/React.createElement(UndoButton, {
|
|
9426
|
+
onUndo: function onUndo() {
|
|
9427
|
+
return IUIToastMessageService$7.setUndoClicked(true);
|
|
9428
|
+
},
|
|
9429
|
+
msg: "Sign-up request rejected"
|
|
9430
|
+
}), function (res) {
|
|
9431
|
+
if (res === false) {
|
|
9432
|
+
dispatch(rejectUserVerification(userId)).then(function (res) {
|
|
9433
|
+
if (res.status === true) {
|
|
9434
|
+
dispatch(showDataFetchingStatus());
|
|
9435
|
+
dispatch(fetchUserSignupRequests({
|
|
9436
|
+
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
9437
|
+
length: signup_rowsPerPage,
|
|
9438
|
+
page: signup_page,
|
|
9439
|
+
search: signup_searchValue.trim(),
|
|
9440
|
+
pagename: 'company'
|
|
9441
|
+
})).then(function () {
|
|
9442
|
+
return dispatch(stopDataFetchingStatus());
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9445
|
+
})["catch"](function (err) {
|
|
9446
|
+
console.log(err);
|
|
8632
9447
|
});
|
|
8633
9448
|
}
|
|
8634
|
-
|
|
8635
|
-
console.log(err);
|
|
9449
|
+
IUIToastMessageService$7.setUndoClicked(false);
|
|
8636
9450
|
});
|
|
8637
9451
|
};
|
|
8638
9452
|
var handleBulkActionHistoryClick = function handleBulkActionHistoryClick() {
|
|
@@ -8645,12 +9459,25 @@ var UserList = function UserList(_ref) {
|
|
|
8645
9459
|
};
|
|
8646
9460
|
var deselectingCheckboxHandler = function deselectingCheckboxHandler(page) {
|
|
8647
9461
|
var _extends2;
|
|
8648
|
-
var
|
|
9462
|
+
var selectedId = [];
|
|
9463
|
+
var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9464
|
+
var _selectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9465
|
+
var _newSelecteds = newSelecteds.filter(function (n) {
|
|
8649
9466
|
return n.is_active;
|
|
8650
|
-
}).map(function (obj) {
|
|
8651
|
-
return obj.id.toString();
|
|
8652
9467
|
});
|
|
8653
|
-
|
|
9468
|
+
_newSelecteds.map(function (obj) {
|
|
9469
|
+
if (selected && !Object.values(selected).flat().includes(obj.id.toString())) {
|
|
9470
|
+
if (obj.roles.is_approver === true) {
|
|
9471
|
+
_selectedUsersApprover.push(obj);
|
|
9472
|
+
} else if (obj.roles.is_approver === false) {
|
|
9473
|
+
_selectedUsersNotApprover.push(obj);
|
|
9474
|
+
}
|
|
9475
|
+
}
|
|
9476
|
+
selectedId.push(obj.id.toString());
|
|
9477
|
+
});
|
|
9478
|
+
setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = selectedId, _extends2)));
|
|
9479
|
+
setSelectedUsersNotApprover(_selectedUsersNotApprover);
|
|
9480
|
+
setSelectedUsersApprover(_selectedUsersApprover);
|
|
8654
9481
|
};
|
|
8655
9482
|
var handleSelectAllClick = function handleSelectAllClick(event, page) {
|
|
8656
9483
|
var _extends3;
|
|
@@ -8668,58 +9495,156 @@ var UserList = function UserList(_ref) {
|
|
|
8668
9495
|
setSortingChangeTemp(!isSortingChangeTemp);
|
|
8669
9496
|
};
|
|
8670
9497
|
var onSearchHandler = function onSearchHandler(value) {
|
|
9498
|
+
setPage(1);
|
|
8671
9499
|
setSearchValue(value);
|
|
8672
9500
|
setSearchingChange(true);
|
|
8673
9501
|
setSearchingChangeTemp(!isSearchingChangeTemp);
|
|
8674
9502
|
};
|
|
8675
9503
|
var onSignUpReqeustSearchHandler = function onSignUpReqeustSearchHandler(value) {
|
|
9504
|
+
setPage(1);
|
|
8676
9505
|
set_signup_SearchValue(value);
|
|
8677
9506
|
setSignUpSearchingChange(true);
|
|
8678
9507
|
setSignUpSearchingChangeTemp(!isSignUpSearchingChangeTemp);
|
|
8679
9508
|
};
|
|
8680
|
-
var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page) {
|
|
9509
|
+
var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page, data) {
|
|
8681
9510
|
var _extends4;
|
|
8682
9511
|
var selectedTemp = _extends({}, selected);
|
|
8683
9512
|
if (!(page in selectedTemp)) {
|
|
8684
9513
|
selectedTemp[page] = [];
|
|
8685
9514
|
}
|
|
8686
9515
|
var selectedIndex = selectedTemp[page].indexOf(id);
|
|
8687
|
-
var
|
|
9516
|
+
var _newSelected = [];
|
|
8688
9517
|
if (selectedIndex === -1) {
|
|
8689
|
-
|
|
9518
|
+
_newSelected = _newSelected.concat(selectedTemp[page], id);
|
|
8690
9519
|
} else if (selectedIndex === 0) {
|
|
8691
|
-
|
|
9520
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(1));
|
|
8692
9521
|
} else if (selectedIndex === selectedTemp[page].length - 1) {
|
|
8693
|
-
|
|
9522
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(0, -1));
|
|
8694
9523
|
} else if (selectedIndex > 0) {
|
|
8695
|
-
|
|
9524
|
+
_newSelected = _newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
|
|
8696
9525
|
}
|
|
8697
|
-
|
|
9526
|
+
var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9527
|
+
var _SelectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9528
|
+
if (Object.values(selected).flat().includes(id.toString())) {
|
|
9529
|
+
_SelectedUsersNotApprover = selectedUsersNotApprover.filter(function (item) {
|
|
9530
|
+
return id !== item.id.toString();
|
|
9531
|
+
});
|
|
9532
|
+
_SelectedUsersApprover = selectedUsersApprover.filter(function (item) {
|
|
9533
|
+
return item.id.toString() !== id;
|
|
9534
|
+
});
|
|
9535
|
+
} else if (data !== null && data !== void 0 && data.roles) {
|
|
9536
|
+
if (data.roles.is_approver === true) {
|
|
9537
|
+
_SelectedUsersApprover.push(data);
|
|
9538
|
+
} else if (data.roles.is_approver === false) {
|
|
9539
|
+
_SelectedUsersNotApprover.push(data);
|
|
9540
|
+
}
|
|
9541
|
+
}
|
|
9542
|
+
setSelectedUsersNotApprover(_SelectedUsersNotApprover);
|
|
9543
|
+
setSelectedUsersApprover(_SelectedUsersApprover);
|
|
9544
|
+
setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = _newSelected, _extends4)));
|
|
8698
9545
|
};
|
|
9546
|
+
useEffect(function () {
|
|
9547
|
+
setApproverRole({
|
|
9548
|
+
value: '',
|
|
9549
|
+
label: 'Select approver'
|
|
9550
|
+
});
|
|
9551
|
+
setDefaultId(null);
|
|
9552
|
+
setIsDisabledSubmitBtn(true);
|
|
9553
|
+
setApproveeStatus(false);
|
|
9554
|
+
if (deactivateSingle === true) {
|
|
9555
|
+
api$7.get(userAddEditUrl.transferAppover() + "user_id=" + user.id + "&page=1").then(function (response) {
|
|
9556
|
+
if (response.data["default"].id) {
|
|
9557
|
+
setDefaultId(response.data["default"].id);
|
|
9558
|
+
setApproverRole({
|
|
9559
|
+
value: '',
|
|
9560
|
+
label: response.data["default"].email
|
|
9561
|
+
});
|
|
9562
|
+
setIsDisabledSubmitBtn(false);
|
|
9563
|
+
setApproveeStatus(response.data["default"].approvee_status);
|
|
9564
|
+
}
|
|
9565
|
+
});
|
|
9566
|
+
}
|
|
9567
|
+
}, [deactivateSingle]);
|
|
8699
9568
|
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
8700
9569
|
setRowsPerPage(+event.target.value);
|
|
8701
9570
|
setPage(1);
|
|
8702
9571
|
setSelected({});
|
|
9572
|
+
setSelectedUsersNotApprover([]);
|
|
9573
|
+
setSelectedUsersApprover([]);
|
|
8703
9574
|
setSortingChange(true);
|
|
8704
9575
|
setSortingChangeTemp(!isSortingChangeTemp);
|
|
8705
9576
|
};
|
|
8706
9577
|
var handleActiveUser = function handleActiveUser(e, id, page) {
|
|
8707
9578
|
var isActive = e.target.checked;
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
9579
|
+
var _isApprover;
|
|
9580
|
+
newSelecteds.map(function (item) {
|
|
9581
|
+
if (item.id === id) {
|
|
9582
|
+
_isApprover = item.roles.is_approver;
|
|
9583
|
+
if (_isApprover === true && isActive === false) {
|
|
9584
|
+
setDeactivateSingle(true);
|
|
9585
|
+
setDeactivateUser(item.first_name + ' ' + item.last_name);
|
|
9586
|
+
setUser(item);
|
|
9587
|
+
} else {
|
|
9588
|
+
dispatch(updateActiveStatus(e.target.checked ? 1 : 0, e.target.id, _isApprover)).then(function () {
|
|
9589
|
+
if (!isActive) {
|
|
9590
|
+
if (Object.values(selected).flat().includes(id.toString())) {
|
|
9591
|
+
var _extends5;
|
|
9592
|
+
var selectedTemp = _extends({}, selected);
|
|
9593
|
+
var _selectedUsersApprover = [].concat(selectedUsersApprover);
|
|
9594
|
+
var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
|
|
9595
|
+
selectedTemp[page].splice(selectedTemp[page].indexOf(id.toString()), 1);
|
|
9596
|
+
_selectedUsersApprover = _selectedUsersApprover.filter(function (item) {
|
|
9597
|
+
return item.id != id;
|
|
9598
|
+
});
|
|
9599
|
+
_selectedUsersNotApprover = _selectedUsersNotApprover.filter(function (item) {
|
|
9600
|
+
return item.id != id;
|
|
9601
|
+
});
|
|
9602
|
+
setSelected(_extends({}, selected, (_extends5 = {}, _extends5[page] = selectedTemp[page], _extends5)));
|
|
9603
|
+
setSelectedUsersApprover(_selectedUsersApprover);
|
|
9604
|
+
setSelectedUsersNotApprover(_selectedUsersNotApprover);
|
|
9605
|
+
}
|
|
9606
|
+
}
|
|
9607
|
+
});
|
|
8715
9608
|
}
|
|
8716
9609
|
}
|
|
8717
9610
|
});
|
|
8718
9611
|
};
|
|
9612
|
+
var selectApprover = function selectApprover(_ref4) {
|
|
9613
|
+
var _value = _ref4._value;
|
|
9614
|
+
if (_value.data.approvee_status) {
|
|
9615
|
+
setApproveeStatus(true);
|
|
9616
|
+
} else {
|
|
9617
|
+
setApproveeStatus(false);
|
|
9618
|
+
}
|
|
9619
|
+
setDefaultId(_value.data.id);
|
|
9620
|
+
setApproverRole(_value);
|
|
9621
|
+
setIsDisabledSubmitBtn(false);
|
|
9622
|
+
};
|
|
9623
|
+
var handleDeactivateUser = function handleDeactivateUser() {
|
|
9624
|
+
dispatch(updateActiveStatus(0, user.id, user.roles.is_approver, defaultId));
|
|
9625
|
+
setOpenDeActivateModalFlag(false);
|
|
9626
|
+
setDeactivateSingle(false);
|
|
9627
|
+
setSelected({});
|
|
9628
|
+
setSelectedUsersNotApprover([]);
|
|
9629
|
+
setSelectedUsersApprover([]);
|
|
9630
|
+
};
|
|
8719
9631
|
var handleDeactivateUsers = function handleDeactivateUsers() {
|
|
8720
9632
|
dispatch(deActivateUsers(Object.values(selected).flat()));
|
|
8721
9633
|
setOpenDeActivateModalFlag(false);
|
|
8722
9634
|
setSelected({});
|
|
9635
|
+
setSelectedUsersNotApprover([]);
|
|
9636
|
+
setSelectedUsersApprover([]);
|
|
9637
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9638
|
+
};
|
|
9639
|
+
var handleDeactivateSafeUsers = function handleDeactivateSafeUsers() {
|
|
9640
|
+
var _selectedUsersNotApprover = selectedUsersNotApprover.map(function (item) {
|
|
9641
|
+
return item.id;
|
|
9642
|
+
});
|
|
9643
|
+
dispatch(deActivateUsers(_selectedUsersNotApprover));
|
|
9644
|
+
setIsBulkDeactivateModalOpen(false);
|
|
9645
|
+
setSelected({});
|
|
9646
|
+
setSelectedUsersNotApprover([]);
|
|
9647
|
+
setSelectedUsersApprover([]);
|
|
8723
9648
|
};
|
|
8724
9649
|
var importUserHandler = function importUserHandler() {
|
|
8725
9650
|
setOpenImportUsersModal(true);
|
|
@@ -8731,6 +9656,43 @@ var UserList = function UserList(_ref) {
|
|
|
8731
9656
|
setOpenImportUsersModal(false);
|
|
8732
9657
|
handleImportPagenavigation(jobId);
|
|
8733
9658
|
};
|
|
9659
|
+
var onResetPasswordHandler = function onResetPasswordHandler(email) {
|
|
9660
|
+
dispatch(resetPasswordForUser({
|
|
9661
|
+
email: email
|
|
9662
|
+
}));
|
|
9663
|
+
};
|
|
9664
|
+
var toggleInviteModal = function toggleInviteModal(ids, type, firstName, lastName) {
|
|
9665
|
+
if (type === undefined) {
|
|
9666
|
+
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
9667
|
+
IUIToastMessageService$7.warningNotify('Select at least one user to invite.');
|
|
9668
|
+
return false;
|
|
9669
|
+
}
|
|
9670
|
+
}
|
|
9671
|
+
setUserIds(ids);
|
|
9672
|
+
setUserFirstName(firstName);
|
|
9673
|
+
setUserLastName(lastName);
|
|
9674
|
+
setToggleInviteModal(!showInviteModal);
|
|
9675
|
+
};
|
|
9676
|
+
var toggleInviteModalClose = function toggleInviteModalClose() {
|
|
9677
|
+
setToggleInviteModal(!showInviteModal);
|
|
9678
|
+
};
|
|
9679
|
+
var onResendInviteHandler = function onResendInviteHandler() {
|
|
9680
|
+
var userIdArr = [];
|
|
9681
|
+
if (userIds && !isNaN(userIds)) {
|
|
9682
|
+
userIdArr = [userIds];
|
|
9683
|
+
} else if (Object.keys(selected).length) {
|
|
9684
|
+
Object.values(selected).map(function (val, i) {
|
|
9685
|
+
if (val.length) {
|
|
9686
|
+
val.map(function (idx, i) {
|
|
9687
|
+
userIdArr.push(idx);
|
|
9688
|
+
});
|
|
9689
|
+
}
|
|
9690
|
+
});
|
|
9691
|
+
}
|
|
9692
|
+
setUserIds('');
|
|
9693
|
+
dispatch(resendInviteForUser(userIdArr));
|
|
9694
|
+
setToggleInviteModal(!showInviteModal);
|
|
9695
|
+
};
|
|
8734
9696
|
var handleExportUsers = function handleExportUsers() {
|
|
8735
9697
|
try {
|
|
8736
9698
|
setDownlStatus(true);
|
|
@@ -8770,6 +9732,9 @@ var UserList = function UserList(_ref) {
|
|
|
8770
9732
|
}, {
|
|
8771
9733
|
label: 'Bulk action history',
|
|
8772
9734
|
handler: handleBulkActionHistoryClick
|
|
9735
|
+
}, {
|
|
9736
|
+
label: 'Resend invite',
|
|
9737
|
+
handler: toggleInviteModal
|
|
8773
9738
|
}];
|
|
8774
9739
|
useEffect(function () {
|
|
8775
9740
|
var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
|
|
@@ -8781,6 +9746,9 @@ var UserList = function UserList(_ref) {
|
|
|
8781
9746
|
userId: userId
|
|
8782
9747
|
}));
|
|
8783
9748
|
};
|
|
9749
|
+
var knowMore = function knowMore() {
|
|
9750
|
+
window.open('https://itilite.notion.site/All-about-deactivating-users-77554de1fb494832ac7e344ca14277f0', '_blank');
|
|
9751
|
+
};
|
|
8784
9752
|
var dispatch = useDispatch();
|
|
8785
9753
|
useEffect(function () {
|
|
8786
9754
|
if (isTokenVerified === true) {
|
|
@@ -8794,6 +9762,7 @@ var UserList = function UserList(_ref) {
|
|
|
8794
9762
|
dispatch(fetchUsersList(url)).then(function () {
|
|
8795
9763
|
setSearchingChange(false);
|
|
8796
9764
|
setisApiFetching(false);
|
|
9765
|
+
scrollTo('table-root');
|
|
8797
9766
|
});
|
|
8798
9767
|
}, 1000);
|
|
8799
9768
|
return function () {
|
|
@@ -8807,7 +9776,8 @@ var UserList = function UserList(_ref) {
|
|
|
8807
9776
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8808
9777
|
length: signup_rowsPerPage,
|
|
8809
9778
|
page: signup_page,
|
|
8810
|
-
search: signup_searchValue.trim()
|
|
9779
|
+
search: signup_searchValue.trim(),
|
|
9780
|
+
pagename: 'company'
|
|
8811
9781
|
})).then(function () {
|
|
8812
9782
|
setSignUpSearchingChange(false);
|
|
8813
9783
|
setisApiFetching(false);
|
|
@@ -8819,6 +9789,7 @@ var UserList = function UserList(_ref) {
|
|
|
8819
9789
|
}
|
|
8820
9790
|
if (isSortingChange) {
|
|
8821
9791
|
setisApiFetching(true);
|
|
9792
|
+
scrollTo('table-root');
|
|
8822
9793
|
dispatch(fetchUsersList(url)).then(function () {
|
|
8823
9794
|
setisApiFetching(false);
|
|
8824
9795
|
setSortingChange(false);
|
|
@@ -8833,7 +9804,8 @@ var UserList = function UserList(_ref) {
|
|
|
8833
9804
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8834
9805
|
length: signup_rowsPerPage,
|
|
8835
9806
|
page: signup_page,
|
|
8836
|
-
search: signup_searchValue.trim()
|
|
9807
|
+
search: signup_searchValue.trim(),
|
|
9808
|
+
pagename: 'company'
|
|
8837
9809
|
})).then(function () {
|
|
8838
9810
|
setisApiFetching(false);
|
|
8839
9811
|
setSignUpSortingChange(false);
|
|
@@ -8849,7 +9821,8 @@ var UserList = function UserList(_ref) {
|
|
|
8849
9821
|
ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
|
|
8850
9822
|
length: signup_rowsPerPage,
|
|
8851
9823
|
page: signup_page,
|
|
8852
|
-
search: signup_searchValue.trim()
|
|
9824
|
+
search: signup_searchValue.trim(),
|
|
9825
|
+
pagename: 'company'
|
|
8853
9826
|
})).then(function () {
|
|
8854
9827
|
return dispatch(stopDataFetchingStatus());
|
|
8855
9828
|
});
|
|
@@ -8857,15 +9830,89 @@ var UserList = function UserList(_ref) {
|
|
|
8857
9830
|
}
|
|
8858
9831
|
}
|
|
8859
9832
|
}, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
|
|
9833
|
+
var topRightButtons = function topRightButtons() {
|
|
9834
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
9835
|
+
component: "div",
|
|
9836
|
+
className: styles$5.buttonWrapper,
|
|
9837
|
+
display: "flex",
|
|
9838
|
+
justifyContent: "space-between",
|
|
9839
|
+
alignItems: "center",
|
|
9840
|
+
alignSelf: "flex-start"
|
|
9841
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9842
|
+
component: "div",
|
|
9843
|
+
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
9844
|
+
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
9845
|
+
buttonText: "Export all users",
|
|
9846
|
+
type: "outlined",
|
|
9847
|
+
startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
|
|
9848
|
+
width: "22",
|
|
9849
|
+
height: "22"
|
|
9850
|
+
}),
|
|
9851
|
+
onClick: handleExportUsers
|
|
9852
|
+
})), /*#__PURE__*/React.createElement(IUIBox, {
|
|
9853
|
+
component: "div",
|
|
9854
|
+
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
9855
|
+
}, /*#__PURE__*/React.createElement(IUIDropdownButton, {
|
|
9856
|
+
buttonText: "Bulk actions",
|
|
9857
|
+
type: "outlined",
|
|
9858
|
+
menuListInfo: BulkUploadInfo
|
|
9859
|
+
})), /*#__PURE__*/React.createElement(IUIBox, {
|
|
9860
|
+
component: "div",
|
|
9861
|
+
className: "pageHeader--button-single button-right"
|
|
9862
|
+
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
9863
|
+
buttonText: "Add user",
|
|
9864
|
+
type: "contained",
|
|
9865
|
+
startIcon: /*#__PURE__*/React.createElement(AddIcon, {
|
|
9866
|
+
width: "9",
|
|
9867
|
+
height: "9",
|
|
9868
|
+
color: "white"
|
|
9869
|
+
}),
|
|
9870
|
+
onClick: handleAddPageNavigation
|
|
9871
|
+
})));
|
|
9872
|
+
};
|
|
8860
9873
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8861
9874
|
component: "div",
|
|
8862
9875
|
className: styles$5.UUIUserManagementList
|
|
8863
|
-
},
|
|
9876
|
+
}, overlayMenu ? /*#__PURE__*/React.createElement(Box, {
|
|
9877
|
+
className: styles$5.scrollOverlayMenu
|
|
9878
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9879
|
+
component: "div",
|
|
9880
|
+
className: clsx(styles$5.pageHeader)
|
|
9881
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9882
|
+
component: "div",
|
|
9883
|
+
display: "flex",
|
|
9884
|
+
justifyContent: "space-between",
|
|
9885
|
+
alignItems: "center",
|
|
9886
|
+
flexWrap: "wrap",
|
|
9887
|
+
style: {
|
|
9888
|
+
gap: '1rem'
|
|
9889
|
+
}
|
|
9890
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9891
|
+
component: "div",
|
|
9892
|
+
display: "flex",
|
|
9893
|
+
flexDirection: "column",
|
|
9894
|
+
style: {
|
|
9895
|
+
gap: '0.5rem'
|
|
9896
|
+
}
|
|
9897
|
+
}, /*#__PURE__*/React.createElement(IUISearch, {
|
|
9898
|
+
placeholder: "Search by name, email & department",
|
|
9899
|
+
value: searchValue,
|
|
9900
|
+
onChangeHandler: function onChangeHandler(e) {
|
|
9901
|
+
return onSearchHandler(e.target.value);
|
|
9902
|
+
},
|
|
9903
|
+
className: styles$5.overlaysearch
|
|
9904
|
+
})), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
|
|
9905
|
+
component: "div",
|
|
9906
|
+
display: "flex",
|
|
9907
|
+
justifyContent: "space-between",
|
|
9908
|
+
alignItems: "center"
|
|
9909
|
+
}))) : '', !hasVerificationError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBackdrop, {
|
|
8864
9910
|
open: isFileDownloading || isApiFetching,
|
|
8865
9911
|
className: styles$5.backdrop
|
|
8866
9912
|
}, /*#__PURE__*/React.createElement(IUICircularProgress, {
|
|
8867
9913
|
color: "inherit"
|
|
8868
9914
|
})), isDataFetching ? /*#__PURE__*/React.createElement(SkeletonLoader, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9915
|
+
id: "table-root",
|
|
8869
9916
|
component: "div",
|
|
8870
9917
|
className: clsx(styles$5.pageHeader)
|
|
8871
9918
|
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
@@ -8890,44 +9937,7 @@ var UserList = function UserList(_ref) {
|
|
|
8890
9937
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8891
9938
|
variant: "h3",
|
|
8892
9939
|
className: clsx(styles$5.heading, styles$5.headingLarge)
|
|
8893
|
-
}, isILadmin && companyName ? companyName + " - Users" : 'Users'))), /*#__PURE__*/React.createElement(IUIBox, {
|
|
8894
|
-
component: "div",
|
|
8895
|
-
className: styles$5.buttonWrapper,
|
|
8896
|
-
display: "flex",
|
|
8897
|
-
justifyContent: "space-between",
|
|
8898
|
-
alignItems: "center",
|
|
8899
|
-
alignSelf: "flex-start"
|
|
8900
|
-
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
8901
|
-
component: "div",
|
|
8902
|
-
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
8903
|
-
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
8904
|
-
buttonText: "Export all users",
|
|
8905
|
-
type: "outlined",
|
|
8906
|
-
startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
|
|
8907
|
-
width: "22",
|
|
8908
|
-
height: "22"
|
|
8909
|
-
}),
|
|
8910
|
-
onClick: handleExportUsers
|
|
8911
|
-
})), /*#__PURE__*/React.createElement(IUIBox, {
|
|
8912
|
-
component: "div",
|
|
8913
|
-
className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
|
|
8914
|
-
}, /*#__PURE__*/React.createElement(IUIDropdownButton, {
|
|
8915
|
-
buttonText: "Bulk actions",
|
|
8916
|
-
type: "outlined",
|
|
8917
|
-
menuListInfo: BulkUploadInfo
|
|
8918
|
-
})), /*#__PURE__*/React.createElement(IUIBox, {
|
|
8919
|
-
component: "div",
|
|
8920
|
-
className: "pageHeader--button-single button-right"
|
|
8921
|
-
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
8922
|
-
buttonText: "Add user",
|
|
8923
|
-
type: "contained",
|
|
8924
|
-
startIcon: /*#__PURE__*/React.createElement(AddIcon, {
|
|
8925
|
-
width: "9",
|
|
8926
|
-
height: "9",
|
|
8927
|
-
color: "white"
|
|
8928
|
-
}),
|
|
8929
|
-
onClick: handleAddPageNavigation
|
|
8930
|
-
})))), /*#__PURE__*/React.createElement(IUIBox, {
|
|
9940
|
+
}, isILadmin && companyName ? companyName + " - Users" : 'Users'))), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
|
|
8931
9941
|
component: "div",
|
|
8932
9942
|
display: "flex",
|
|
8933
9943
|
justifyContent: "space-between",
|
|
@@ -8972,7 +9982,9 @@ var UserList = function UserList(_ref) {
|
|
|
8972
9982
|
disableRowCheckbox: deactivatedUsers,
|
|
8973
9983
|
searchValue: searchValue,
|
|
8974
9984
|
isILadmin: isILadmin,
|
|
8975
|
-
onPrimaryAdminHandler: onPrimaryAdminHandler
|
|
9985
|
+
onPrimaryAdminHandler: onPrimaryAdminHandler,
|
|
9986
|
+
onResetPasswordHandler: onResetPasswordHandler,
|
|
9987
|
+
toggleInviteModal: toggleInviteModal
|
|
8976
9988
|
}))
|
|
8977
9989
|
}, {
|
|
8978
9990
|
label: /*#__PURE__*/React.createElement(IUIBox, null, "Sign-up requests", ' ', /*#__PURE__*/React.createElement(TabLabelCount, {
|
|
@@ -8988,7 +10000,10 @@ var UserList = function UserList(_ref) {
|
|
|
8988
10000
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8989
10001
|
variant: "body2",
|
|
8990
10002
|
className: clsx(styles$5.description)
|
|
8991
|
-
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in
|
|
10003
|
+
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
10004
|
+
onClick: redirectToNotifications,
|
|
10005
|
+
className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
|
|
10006
|
+
}, "Notifications"))), /*#__PURE__*/React.createElement(SingupRequests, {
|
|
8992
10007
|
data: signupRequestListInfo,
|
|
8993
10008
|
handleChangeRowsPerPage: function handleChangeRowsPerPage(event) {
|
|
8994
10009
|
setSignUpRowsPerPage(+event.target.value);
|
|
@@ -9020,6 +10035,54 @@ var UserList = function UserList(_ref) {
|
|
|
9020
10035
|
}))
|
|
9021
10036
|
}]
|
|
9022
10037
|
}))), /*#__PURE__*/React.createElement(IUIModal, {
|
|
10038
|
+
isOpen: deactivateSingle,
|
|
10039
|
+
closeHandler: function closeHandler() {
|
|
10040
|
+
setDeactivateSingle(false);
|
|
10041
|
+
},
|
|
10042
|
+
cancelLabel: "Cancel",
|
|
10043
|
+
submitLabel: "Deactivate",
|
|
10044
|
+
submitHandler: handleDeactivateUser,
|
|
10045
|
+
headerText: "Deactivate this user?",
|
|
10046
|
+
width: "400px",
|
|
10047
|
+
subHanderText: "",
|
|
10048
|
+
submitBtnClass: styles$5.deactivateBtn,
|
|
10049
|
+
isDisabledSubmitBtn: isDisabledSubmitBtn,
|
|
10050
|
+
modalClass: "deactivateSingleModal",
|
|
10051
|
+
modalBodyStyle: {
|
|
10052
|
+
overflowY: 'unset'
|
|
10053
|
+
}
|
|
10054
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10055
|
+
className: clsx(styles$5.deactivateSingle, 'iui__mb-16')
|
|
10056
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10057
|
+
className: styles$5.deactivateAlert
|
|
10058
|
+
}, /*#__PURE__*/React.createElement(InfoYellowIcon, {
|
|
10059
|
+
width: "9",
|
|
10060
|
+
height: "9"
|
|
10061
|
+
}), /*#__PURE__*/React.createElement(IUITypography, {
|
|
10062
|
+
variant: "body2"
|
|
10063
|
+
}, /*#__PURE__*/React.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.createElement("span", {
|
|
10064
|
+
onClick: knowMore,
|
|
10065
|
+
className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
|
|
10066
|
+
}, "Know more"))), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10067
|
+
className: "iui__mt-15"
|
|
10068
|
+
}, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
|
|
10069
|
+
isMove: true,
|
|
10070
|
+
additional: {
|
|
10071
|
+
page: 1,
|
|
10072
|
+
product: 'travel',
|
|
10073
|
+
userId: user.id
|
|
10074
|
+
},
|
|
10075
|
+
label: "Transfer approver role to",
|
|
10076
|
+
value: approverRole,
|
|
10077
|
+
onValueChange: selectApprover,
|
|
10078
|
+
loadOption: transferRoleOptions,
|
|
10079
|
+
disableText: "Please get in touch with your administrator to change this value.",
|
|
10080
|
+
customLoadingText: "No results found"
|
|
10081
|
+
}), approveeStatus && /*#__PURE__*/React.createElement(IUIBox, {
|
|
10082
|
+
className: "iui__d-flex iui__align-items-baseline iui__mr-5"
|
|
10083
|
+
}, /*#__PURE__*/React.createElement(IUIBox, null, /*#__PURE__*/React.createElement(RedWarningIcon, null)), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10084
|
+
className: "iui__font--para-normal iui__font--color-black500 iui__mt-5 iui__ml-5"
|
|
10085
|
+
}, "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.createElement(IUIModal, {
|
|
9023
10086
|
isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
|
|
9024
10087
|
closeHandler: closeDeActivateModal,
|
|
9025
10088
|
cancelLabel: "Cancel",
|
|
@@ -9045,7 +10108,124 @@ var UserList = function UserList(_ref) {
|
|
|
9045
10108
|
className: styles$5.headerText
|
|
9046
10109
|
}, 'Are you sure you want to deactivate ' + Object.values(selected).flat().length.toString() + (Object.values(selected).flat().length === 1 ? ' user ?' : ' users ?')), /*#__PURE__*/React.createElement(IUITypography, {
|
|
9047
10110
|
className: styles$5.description
|
|
9048
|
-
}, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React.createElement(
|
|
10111
|
+
}, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React.createElement(IUIModal, {
|
|
10112
|
+
isOpen: isBulkDeactivateModalOpen,
|
|
10113
|
+
closeHandler: closeDeActiveModal,
|
|
10114
|
+
cancelLabel: "Cancel",
|
|
10115
|
+
submitLabel: "Deactivate safe users",
|
|
10116
|
+
isDisabledSubmitBtn: !((selectedUsersNotApprover === null || selectedUsersNotApprover === void 0 ? void 0 : selectedUsersNotApprover.length) > 0),
|
|
10117
|
+
submitBtnClass: clsx(styles$5.deactivateSubmitBtn),
|
|
10118
|
+
customButtonLabel: "Deactivate all users",
|
|
10119
|
+
customButtonHandler: handleDeactivateUsers,
|
|
10120
|
+
submitHandler: handleDeactivateSafeUsers,
|
|
10121
|
+
width: "640px",
|
|
10122
|
+
customButtonClass: clsx(styles$5.deactivateCustomButtonClass),
|
|
10123
|
+
headerText: "Deactivate users?",
|
|
10124
|
+
modalBodyStyle: {
|
|
10125
|
+
maxHeight: 'calc(100vh - 50vh)'
|
|
10126
|
+
}
|
|
10127
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10128
|
+
className: clsx(styles$5.deactivateAlert, styles$5.warningSvg)
|
|
10129
|
+
}, /*#__PURE__*/React.createElement(RedWarningIcon, {
|
|
10130
|
+
color: "#9A6700",
|
|
10131
|
+
size: "14"
|
|
10132
|
+
}), /*#__PURE__*/React.createElement(IUITypography, {
|
|
10133
|
+
variant: "body2"
|
|
10134
|
+
}, "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.createElement("span", {
|
|
10135
|
+
onClick: knowMore,
|
|
10136
|
+
className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
|
|
10137
|
+
}, "Know more"))), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10138
|
+
className: "iui__my-15"
|
|
10139
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10140
|
+
className: "iui__font--para-large iui__font--weight-medium"
|
|
10141
|
+
}, "Users with roles"), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10142
|
+
className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
|
|
10143
|
+
}, "Deactivating these users will affect the associated approval rules."), (selectedUsersApprover === null || selectedUsersApprover === void 0 ? void 0 : selectedUsersApprover.length) && selectedUsersApprover.map(function (item, index) {
|
|
10144
|
+
var _item$data;
|
|
10145
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
10146
|
+
key: index,
|
|
10147
|
+
className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
|
|
10148
|
+
}, /*#__PURE__*/React.createElement(IUIProfileBox, {
|
|
10149
|
+
firstName: item.first_name,
|
|
10150
|
+
lastName: item.last_name,
|
|
10151
|
+
isLetterAvatar: "true",
|
|
10152
|
+
primaryText: item.first_name + ' ' + item.last_name,
|
|
10153
|
+
secondaryText: item.email,
|
|
10154
|
+
letterAvatarTextColor: "black",
|
|
10155
|
+
letterAvatarBackgroundColor: "#d3d3d3",
|
|
10156
|
+
profilePath: (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.profile_pic
|
|
10157
|
+
}), /*#__PURE__*/React.createElement(RedWarningIcon, {
|
|
10158
|
+
color: "#9A6700",
|
|
10159
|
+
size: "14"
|
|
10160
|
+
}));
|
|
10161
|
+
})), selectedUsersNotApprover !== null && selectedUsersNotApprover !== void 0 && selectedUsersNotApprover.length ? /*#__PURE__*/React.createElement(IUIBox, null, /*#__PURE__*/React.createElement("hr", {
|
|
10162
|
+
style: {
|
|
10163
|
+
borderColor: '#E5E9ED'
|
|
10164
|
+
}
|
|
10165
|
+
}), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10166
|
+
className: "iui__my-15"
|
|
10167
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10168
|
+
className: "iui__font--para-large iui__font--weight-medium"
|
|
10169
|
+
}, "Safe users"), /*#__PURE__*/React.createElement(IUIBox, {
|
|
10170
|
+
className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
|
|
10171
|
+
}, "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) {
|
|
10172
|
+
var _item$data2;
|
|
10173
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
10174
|
+
key: index,
|
|
10175
|
+
className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
|
|
10176
|
+
}, /*#__PURE__*/React.createElement(IUIProfileBox, {
|
|
10177
|
+
firstName: item.first_name,
|
|
10178
|
+
lastName: item.last_name,
|
|
10179
|
+
isLetterAvatar: "true",
|
|
10180
|
+
primaryText: item.first_name + ' ' + item.last_name,
|
|
10181
|
+
secondaryText: item.email,
|
|
10182
|
+
letterAvatarTextColor: "black",
|
|
10183
|
+
letterAvatarBackgroundColor: "#d3d3d3",
|
|
10184
|
+
profilePath: (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.profile_pic
|
|
10185
|
+
}));
|
|
10186
|
+
}))) : null), /*#__PURE__*/React.createElement(IUIModal, {
|
|
10187
|
+
isOpen: showInviteModal,
|
|
10188
|
+
closeHandler: function closeHandler() {
|
|
10189
|
+
return toggleInviteModalClose();
|
|
10190
|
+
},
|
|
10191
|
+
cancelLabel: "Cancel",
|
|
10192
|
+
headerText: "Resend Invites?",
|
|
10193
|
+
submitLabel: "Send",
|
|
10194
|
+
submitHandler: function submitHandler() {
|
|
10195
|
+
return onResendInviteHandler();
|
|
10196
|
+
},
|
|
10197
|
+
width: "400px",
|
|
10198
|
+
modalBodyStyle: {
|
|
10199
|
+
padding: '0px'
|
|
10200
|
+
},
|
|
10201
|
+
footerStyle: {
|
|
10202
|
+
justifyContent: 'center'
|
|
10203
|
+
}
|
|
10204
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10205
|
+
style: {
|
|
10206
|
+
display: 'flex',
|
|
10207
|
+
padding: '16px',
|
|
10208
|
+
margin: '8px 24px',
|
|
10209
|
+
border: '1px solid #FDE047',
|
|
10210
|
+
background: '#FEFCE8',
|
|
10211
|
+
borderRadius: '5px'
|
|
10212
|
+
}
|
|
10213
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10214
|
+
style: {
|
|
10215
|
+
marginRight: '5px'
|
|
10216
|
+
}
|
|
10217
|
+
}, /*#__PURE__*/React.createElement(InviteInfoIcon, null)), /*#__PURE__*/React.createElement("div", {
|
|
10218
|
+
style: {
|
|
10219
|
+
fontSize: '14px',
|
|
10220
|
+
color: '#374151'
|
|
10221
|
+
}
|
|
10222
|
+
}, "This invitation will be sent to", ' ', /*#__PURE__*/React.createElement("span", {
|
|
10223
|
+
style: {
|
|
10224
|
+
fontSize: '14px',
|
|
10225
|
+
color: '#374151',
|
|
10226
|
+
fontWeight: 'bold'
|
|
10227
|
+
}
|
|
10228
|
+
}, userFirstName != null ? userFirstName + " " + userLastName : 'selected users'), ", who have not logged into the platform."))), /*#__PURE__*/React.createElement(BulkUploadModal, {
|
|
9049
10229
|
isOpenImportUsersModal: isOpenImportUsersModal,
|
|
9050
10230
|
closeImportUsersModal: closeImportUsersModal,
|
|
9051
10231
|
closeImportModal: closeImportModal
|
|
@@ -9054,8 +10234,8 @@ var UserList = function UserList(_ref) {
|
|
|
9054
10234
|
errMsg: hasVerificationError
|
|
9055
10235
|
}));
|
|
9056
10236
|
};
|
|
9057
|
-
var TabLabelCount = function TabLabelCount(
|
|
9058
|
-
var count =
|
|
10237
|
+
var TabLabelCount = function TabLabelCount(_ref5) {
|
|
10238
|
+
var count = _ref5.count;
|
|
9059
10239
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
9060
10240
|
className: styles$5.TabLabelCount
|
|
9061
10241
|
}, " ", count, " ");
|
|
@@ -9130,11 +10310,12 @@ function Header(props) {
|
|
|
9130
10310
|
})));
|
|
9131
10311
|
}
|
|
9132
10312
|
|
|
9133
|
-
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"};
|
|
10313
|
+
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"};
|
|
9134
10314
|
|
|
9135
10315
|
function Listview(_ref) {
|
|
9136
10316
|
var data = _ref.data,
|
|
9137
10317
|
name = _ref.name,
|
|
10318
|
+
tableName = _ref.tableName,
|
|
9138
10319
|
handleEditDialog = _ref.handleEditDialog,
|
|
9139
10320
|
handleDeleteDialog = _ref.handleDeleteDialog,
|
|
9140
10321
|
orderBy = _ref.orderBy,
|
|
@@ -9147,10 +10328,16 @@ function Listview(_ref) {
|
|
|
9147
10328
|
handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
|
|
9148
10329
|
page = _ref.page,
|
|
9149
10330
|
rowsPerPage = _ref.rowsPerPage;
|
|
10331
|
+
var deptHeadDetails = function deptHeadDetails(data) {
|
|
10332
|
+
var _data$dept_head_detai;
|
|
10333
|
+
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) {
|
|
10334
|
+
return data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name;
|
|
10335
|
+
}
|
|
10336
|
+
};
|
|
9150
10337
|
var columns = [{
|
|
9151
10338
|
id: 'name',
|
|
9152
10339
|
label: name,
|
|
9153
|
-
width: '
|
|
10340
|
+
width: '40%',
|
|
9154
10341
|
sortable: true,
|
|
9155
10342
|
cell: function cell(row) {
|
|
9156
10343
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
@@ -9160,7 +10347,7 @@ function Listview(_ref) {
|
|
|
9160
10347
|
}, {
|
|
9161
10348
|
id: 'no_of_users',
|
|
9162
10349
|
label: 'Number of users',
|
|
9163
|
-
width: '
|
|
10350
|
+
width: '40%',
|
|
9164
10351
|
sortable: true,
|
|
9165
10352
|
cell: function cell(row) {
|
|
9166
10353
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
@@ -9170,7 +10357,67 @@ function Listview(_ref) {
|
|
|
9170
10357
|
}, {
|
|
9171
10358
|
id: 'actions',
|
|
9172
10359
|
label: 'Actions',
|
|
9173
|
-
width: '
|
|
10360
|
+
width: '20%',
|
|
10361
|
+
cell: function cell(row) {
|
|
10362
|
+
return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React.createElement(IUIBox, {
|
|
10363
|
+
display: "flex"
|
|
10364
|
+
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
10365
|
+
buttonText: "Edit",
|
|
10366
|
+
className: styles$7.buttonWidth,
|
|
10367
|
+
onClick: function onClick() {
|
|
10368
|
+
return handleEditDialog(row);
|
|
10369
|
+
}
|
|
10370
|
+
}), row.no_of_users > 0 ? /*#__PURE__*/React.createElement(IUIButton, {
|
|
10371
|
+
buttonText: "Delete",
|
|
10372
|
+
className: styles$7.buttonWidth,
|
|
10373
|
+
onClick: function onClick() {
|
|
10374
|
+
return handleDeleteDialog(row, true);
|
|
10375
|
+
}
|
|
10376
|
+
}) : /*#__PURE__*/React.createElement(IUIButton, {
|
|
10377
|
+
buttonText: "Delete",
|
|
10378
|
+
className: styles$7.buttonWidth,
|
|
10379
|
+
onClick: function onClick() {
|
|
10380
|
+
return handleDeleteDialog(row, false);
|
|
10381
|
+
}
|
|
10382
|
+
}));
|
|
10383
|
+
}
|
|
10384
|
+
}];
|
|
10385
|
+
var departmentColumns = [{
|
|
10386
|
+
id: 'name',
|
|
10387
|
+
label: name,
|
|
10388
|
+
width: '30%',
|
|
10389
|
+
sortable: true,
|
|
10390
|
+
cell: function cell(row) {
|
|
10391
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
10392
|
+
component: "div"
|
|
10393
|
+
}, row.name);
|
|
10394
|
+
}
|
|
10395
|
+
}, {
|
|
10396
|
+
id: 'department_head',
|
|
10397
|
+
label: 'Department head',
|
|
10398
|
+
width: '30%',
|
|
10399
|
+
sortable: true,
|
|
10400
|
+
cell: function cell(row) {
|
|
10401
|
+
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10402
|
+
component: "div"
|
|
10403
|
+
}, deptHeadDetails(row)), row.is_default_dept_head && /*#__PURE__*/React.createElement(IUITypography, {
|
|
10404
|
+
className: clsx(styles$7.rowText, styles$7.textTransform, styles$7.lightColor)
|
|
10405
|
+
}, "Assigned by default"));
|
|
10406
|
+
}
|
|
10407
|
+
}, {
|
|
10408
|
+
id: 'no_of_users',
|
|
10409
|
+
label: 'Number of users',
|
|
10410
|
+
width: '45%',
|
|
10411
|
+
sortable: false,
|
|
10412
|
+
cell: function cell(row) {
|
|
10413
|
+
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
10414
|
+
component: "div"
|
|
10415
|
+
}, row.no_of_users);
|
|
10416
|
+
}
|
|
10417
|
+
}, {
|
|
10418
|
+
id: 'actions',
|
|
10419
|
+
label: 'Actions',
|
|
10420
|
+
width: '15%',
|
|
9174
10421
|
cell: function cell(row) {
|
|
9175
10422
|
return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React.createElement(IUIBox, {
|
|
9176
10423
|
display: "flex"
|
|
@@ -9203,7 +10450,7 @@ function Listview(_ref) {
|
|
|
9203
10450
|
hasFilter: true,
|
|
9204
10451
|
isCheckboxTable: false,
|
|
9205
10452
|
count: data.count,
|
|
9206
|
-
columns: columns,
|
|
10453
|
+
columns: tableName === 'department' ? departmentColumns : columns,
|
|
9207
10454
|
rows: data.results,
|
|
9208
10455
|
page: page,
|
|
9209
10456
|
handleChangePage: handleChangePage,
|
|
@@ -9260,16 +10507,43 @@ function EditPanelDialog(_ref) {
|
|
|
9260
10507
|
var isOpen = _ref.isOpen,
|
|
9261
10508
|
closeHandler = _ref.closeHandler,
|
|
9262
10509
|
onValueChange = _ref.onValueChange,
|
|
9263
|
-
|
|
10510
|
+
_submitHandler = _ref.submitHandler,
|
|
9264
10511
|
isError = _ref.isError,
|
|
9265
10512
|
name = _ref.name,
|
|
9266
10513
|
isDisabledSubmitBtn = _ref.isDisabledSubmitBtn,
|
|
9267
|
-
validation = _ref.validation
|
|
10514
|
+
validation = _ref.validation,
|
|
10515
|
+
rowData = _ref.rowData,
|
|
10516
|
+
tableName = _ref.tableName,
|
|
10517
|
+
config = _ref.config;
|
|
9268
10518
|
var _useSelector = useSelector(function (state) {
|
|
9269
10519
|
return state.userPanel;
|
|
9270
10520
|
}),
|
|
9271
10521
|
dialogData = _useSelector.dialogData;
|
|
9272
|
-
|
|
10522
|
+
var deptHeadDetails = function deptHeadDetails(data) {
|
|
10523
|
+
var _data$dept_head_detai;
|
|
10524
|
+
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) {
|
|
10525
|
+
setHead({
|
|
10526
|
+
value: data.dept_head_details[0].id,
|
|
10527
|
+
label: data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name
|
|
10528
|
+
});
|
|
10529
|
+
}
|
|
10530
|
+
};
|
|
10531
|
+
var _useState = useState({
|
|
10532
|
+
value: '',
|
|
10533
|
+
label: 'Select'
|
|
10534
|
+
}),
|
|
10535
|
+
head = _useState[0],
|
|
10536
|
+
setHead = _useState[1];
|
|
10537
|
+
useEffect(function () {
|
|
10538
|
+
deptHeadDetails(rowData);
|
|
10539
|
+
}, [rowData]);
|
|
10540
|
+
var history = useHistory();
|
|
10541
|
+
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
10542
|
+
history.push({
|
|
10543
|
+
pathname: config.routes.users.add.path,
|
|
10544
|
+
state: rowData
|
|
10545
|
+
});
|
|
10546
|
+
};
|
|
9273
10547
|
return /*#__PURE__*/React.createElement(IUIModal, {
|
|
9274
10548
|
isDisabledSubmitBtn: isDisabledSubmitBtn,
|
|
9275
10549
|
isOpen: isOpen,
|
|
@@ -9277,27 +10551,60 @@ function EditPanelDialog(_ref) {
|
|
|
9277
10551
|
headerText: "Edit " + name.toLowerCase(),
|
|
9278
10552
|
cancelLabel: (_dialogData$labels = dialogData.labels) === null || _dialogData$labels === void 0 ? void 0 : _dialogData$labels.cancelLabel,
|
|
9279
10553
|
submitLabel: (_dialogData$labels2 = dialogData.labels) === null || _dialogData$labels2 === void 0 ? void 0 : _dialogData$labels2.submitLabel,
|
|
9280
|
-
submitHandler: submitHandler
|
|
9281
|
-
|
|
10554
|
+
submitHandler: function submitHandler() {
|
|
10555
|
+
return _submitHandler(head);
|
|
10556
|
+
},
|
|
10557
|
+
width: tableName === 'department' ? '400px' : '365px',
|
|
9282
10558
|
hideCloseIcon: false,
|
|
9283
10559
|
modalBodyStyle: {
|
|
9284
|
-
|
|
9285
|
-
overflow: 'auto',
|
|
9286
|
-
margin: '0px'
|
|
10560
|
+
overflowY: 'visible'
|
|
9287
10561
|
},
|
|
9288
10562
|
footerStyle: {
|
|
9289
10563
|
justifyContent: 'end'
|
|
9290
10564
|
}
|
|
10565
|
+
}, tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React.createElement(IUIBox, {
|
|
10566
|
+
display: "flex",
|
|
10567
|
+
justifyContent: "center",
|
|
10568
|
+
alignItems: "center",
|
|
10569
|
+
flexDirection: "column",
|
|
10570
|
+
style: {
|
|
10571
|
+
marginBottom: '30px'
|
|
10572
|
+
}
|
|
9291
10573
|
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9292
|
-
component: "div",
|
|
9293
10574
|
display: "flex",
|
|
9294
10575
|
justifyContent: "center",
|
|
9295
10576
|
alignItems: "center",
|
|
9296
10577
|
flexDirection: "column",
|
|
9297
|
-
|
|
9298
|
-
}, /*#__PURE__*/React.createElement(
|
|
9299
|
-
|
|
9300
|
-
|
|
10578
|
+
className: styles$7.baseAlert
|
|
10579
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10580
|
+
className: styles$7.alertDescContainer
|
|
10581
|
+
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
10582
|
+
className: styles$7.iconLayout,
|
|
10583
|
+
style: {
|
|
10584
|
+
paddingTop: '4px'
|
|
10585
|
+
}
|
|
10586
|
+
}, /*#__PURE__*/React.createElement(BoldInfoIcon, {
|
|
10587
|
+
color: "#CA8A04",
|
|
10588
|
+
width: "25",
|
|
10589
|
+
height: "20",
|
|
10590
|
+
className: styles$7.iconStyle
|
|
10591
|
+
})), /*#__PURE__*/React.createElement(IUILabel, {
|
|
10592
|
+
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.",
|
|
10593
|
+
style: {
|
|
10594
|
+
fontWeight: 'normal'
|
|
10595
|
+
}
|
|
10596
|
+
})), /*#__PURE__*/React.createElement(IUIButton, {
|
|
10597
|
+
buttonText: "Add user",
|
|
10598
|
+
type: "text",
|
|
10599
|
+
startIcon: /*#__PURE__*/React.createElement(AddIcon, {
|
|
10600
|
+
width: "9",
|
|
10601
|
+
height: "9",
|
|
10602
|
+
color: "#EC5D25"
|
|
10603
|
+
}),
|
|
10604
|
+
onClick: handleAddPageNavigation,
|
|
10605
|
+
className: styles$7.addUserButton
|
|
10606
|
+
}))), /*#__PURE__*/React.createElement(IUIInput, {
|
|
10607
|
+
label: name + " name",
|
|
9301
10608
|
name: "name",
|
|
9302
10609
|
defaultValue: dialogData.data.name,
|
|
9303
10610
|
onValueChange: onValueChange,
|
|
@@ -9305,7 +10612,49 @@ function EditPanelDialog(_ref) {
|
|
|
9305
10612
|
isError: isError,
|
|
9306
10613
|
validation: validation,
|
|
9307
10614
|
errorMsg: "Please enter " + name.toLowerCase() + " name.",
|
|
9308
|
-
required: true
|
|
10615
|
+
required: true,
|
|
10616
|
+
style: tableName === 'department' && {
|
|
10617
|
+
width: '350px'
|
|
10618
|
+
}
|
|
10619
|
+
}), tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React.createElement(IUIBox, {
|
|
10620
|
+
className: "iui__mt-15",
|
|
10621
|
+
style: {
|
|
10622
|
+
width: '100%'
|
|
10623
|
+
}
|
|
10624
|
+
}, /*#__PURE__*/React.createElement(IUIInput, {
|
|
10625
|
+
label: "Department head",
|
|
10626
|
+
name: "name",
|
|
10627
|
+
defaultValue: head.label,
|
|
10628
|
+
placeholder: "",
|
|
10629
|
+
readOnly: true,
|
|
10630
|
+
style: {
|
|
10631
|
+
width: '350px'
|
|
10632
|
+
}
|
|
10633
|
+
})), tableName === 'department' && rowData.no_of_users > 0 && /*#__PURE__*/React.createElement(IUIBox, {
|
|
10634
|
+
className: "iui__mt-15",
|
|
10635
|
+
style: {
|
|
10636
|
+
width: '100%'
|
|
10637
|
+
}
|
|
10638
|
+
}, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
|
|
10639
|
+
noResultsText: true,
|
|
10640
|
+
isMove: true,
|
|
10641
|
+
additional: {
|
|
10642
|
+
page: 1,
|
|
10643
|
+
departmentId: rowData.id
|
|
10644
|
+
},
|
|
10645
|
+
placeHolderCheck: head !== undefined && head.value === '',
|
|
10646
|
+
label: "Department head",
|
|
10647
|
+
value: head,
|
|
10648
|
+
onValueChange: function onValueChange(_ref2) {
|
|
10649
|
+
var _value = _ref2._value;
|
|
10650
|
+
return setHead(_value);
|
|
10651
|
+
},
|
|
10652
|
+
loadOption: departmentHeadOptions,
|
|
10653
|
+
disableText: "Please get in touch with your administrator to change this value.",
|
|
10654
|
+
customLoadingText: "No users found in this department",
|
|
10655
|
+
customLoadingTextStyle: {
|
|
10656
|
+
color: '#374151'
|
|
10657
|
+
}
|
|
9309
10658
|
})));
|
|
9310
10659
|
}
|
|
9311
10660
|
|
|
@@ -9484,12 +10833,15 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9484
10833
|
var _useState13 = useState(false),
|
|
9485
10834
|
isSortingChangeTemp = _useState13[0],
|
|
9486
10835
|
setSortingChangeTemp = _useState13[1];
|
|
9487
|
-
var _useState14 = useState(
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
var _useState15 = useState(
|
|
9491
|
-
|
|
9492
|
-
|
|
10836
|
+
var _useState14 = useState([]),
|
|
10837
|
+
rowData = _useState14[0],
|
|
10838
|
+
setRowData = _useState14[1];
|
|
10839
|
+
var _useState15 = useState(1),
|
|
10840
|
+
page = _useState15[0],
|
|
10841
|
+
setPage = _useState15[1];
|
|
10842
|
+
var _useState16 = useState(5),
|
|
10843
|
+
rowsPerPage = _useState16[0],
|
|
10844
|
+
setRowsPerPage = _useState16[1];
|
|
9493
10845
|
var orderingParam = orderBy;
|
|
9494
10846
|
var _useSelector = useSelector(function (state) {
|
|
9495
10847
|
return state.userPanel;
|
|
@@ -9502,18 +10854,25 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9502
10854
|
}),
|
|
9503
10855
|
isTokenVerified = _useSelector2.isTokenVerified,
|
|
9504
10856
|
hasVerificationError = _useSelector2.hasVerificationError;
|
|
9505
|
-
|
|
9506
10857
|
var onValueChange = function onValueChange(_ref2) {
|
|
9507
10858
|
var _value = _ref2._value;
|
|
9508
10859
|
var validatedValue = _value.replace(/\s+/g, ' ').trim();
|
|
9509
10860
|
setDataList(validatedValue);
|
|
9510
10861
|
};
|
|
10862
|
+
var _useState17 = useState(70),
|
|
10863
|
+
maxLengthForModal = _useState17[0],
|
|
10864
|
+
setMaxLengthForModal = _useState17[1];
|
|
10865
|
+
useEffect(function () {
|
|
10866
|
+
if (title === 'Business unit') {
|
|
10867
|
+
setMaxLengthForModal(150);
|
|
10868
|
+
}
|
|
10869
|
+
}, []);
|
|
9511
10870
|
var validation = {
|
|
9512
10871
|
regexOnChange: /^[(A-Z)(a-z)(0-9)&'\-_.,/: ]*$/,
|
|
9513
10872
|
regexOnBlur: null,
|
|
9514
10873
|
maxLimit: '',
|
|
9515
10874
|
minLimit: '',
|
|
9516
|
-
maxLength:
|
|
10875
|
+
maxLength: maxLengthForModal,
|
|
9517
10876
|
minLength: 0
|
|
9518
10877
|
};
|
|
9519
10878
|
useEffect(function () {
|
|
@@ -9586,6 +10945,7 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9586
10945
|
submitLabel: 'Save'
|
|
9587
10946
|
}, '', data));
|
|
9588
10947
|
setDataList(data.name);
|
|
10948
|
+
setRowData(data);
|
|
9589
10949
|
setEditModal(true);
|
|
9590
10950
|
};
|
|
9591
10951
|
var closeEditDialog = function closeEditDialog() {
|
|
@@ -9600,6 +10960,12 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9600
10960
|
var payload = {
|
|
9601
10961
|
names: [dataList]
|
|
9602
10962
|
};
|
|
10963
|
+
if (tableName === 'department') {
|
|
10964
|
+
payload = {
|
|
10965
|
+
name: dataList,
|
|
10966
|
+
department_head_id: null
|
|
10967
|
+
};
|
|
10968
|
+
}
|
|
9603
10969
|
var message = title + " added successfully.";
|
|
9604
10970
|
handleApiCall(addRecord, payload, message, 'add');
|
|
9605
10971
|
} else {
|
|
@@ -9613,10 +10979,12 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9613
10979
|
var message = title + " deleted successfully.";
|
|
9614
10980
|
handleApiCall(deleteRecord, payload, message, 'delete');
|
|
9615
10981
|
};
|
|
9616
|
-
|
|
9617
|
-
|
|
10982
|
+
var handleApiCall = function handleApiCall(dispatchFun, payload, message, type, optionalParams) {
|
|
10983
|
+
if (optionalParams === void 0) {
|
|
10984
|
+
optionalParams = null;
|
|
10985
|
+
}
|
|
9618
10986
|
dispatch(userPanelShowLoader());
|
|
9619
|
-
dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
|
|
10987
|
+
dispatch(dispatchFun(tableName, payload, getApiData(), optionalParams)).then(function (res) {
|
|
9620
10988
|
IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
|
|
9621
10989
|
dispatch(userPanelStopLoader());
|
|
9622
10990
|
if (type === 'delete') {
|
|
@@ -9658,8 +11026,14 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9658
11026
|
name: dataList
|
|
9659
11027
|
}]
|
|
9660
11028
|
};
|
|
11029
|
+
if (tableName === 'department') {
|
|
11030
|
+
payload = {
|
|
11031
|
+
name: dataList,
|
|
11032
|
+
department_head_id: data.value === '' || rowData.is_default_dept_head && rowData.dept_head === data.value ? null : data.value
|
|
11033
|
+
};
|
|
11034
|
+
}
|
|
9661
11035
|
var message = title + " updated successfully.";
|
|
9662
|
-
handleApiCall(editRecord, payload, message, 'edit');
|
|
11036
|
+
handleApiCall(editRecord, payload, message, 'edit', dialogData.data.id);
|
|
9663
11037
|
setErrorEdit(false);
|
|
9664
11038
|
} else {
|
|
9665
11039
|
setErrorEdit(true);
|
|
@@ -9766,7 +11140,10 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9766
11140
|
submitHandler: handleEditPanel,
|
|
9767
11141
|
isError: errorEdit,
|
|
9768
11142
|
isDisabledSubmitBtn: loading,
|
|
9769
|
-
validation: validation
|
|
11143
|
+
validation: validation,
|
|
11144
|
+
rowData: rowData,
|
|
11145
|
+
tableName: tableName,
|
|
11146
|
+
config: config
|
|
9770
11147
|
})) : /*#__PURE__*/React.createElement(VerificationError, {
|
|
9771
11148
|
config: config
|
|
9772
11149
|
}));
|