@itilite/iui-user-management 0.5.11 → 1.0.0

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.js CHANGED
@@ -14,12 +14,10 @@ var moment = _interopDefault(require('moment'));
14
14
  var reduxDevtoolsExtension = require('redux-devtools-extension');
15
15
  var reactRouterDom = require('react-router-dom');
16
16
  var styles$8 = require('@material-ui/core/styles');
17
- var Tooltip = _interopDefault(require('@material-ui/core/Tooltip'));
18
17
  var Switch = _interopDefault(require('@material-ui/core/Switch'));
19
18
  var MoreHorizIcon = _interopDefault(require('@material-ui/icons/MoreHoriz'));
20
19
  var Button = _interopDefault(require('@material-ui/core/Button'));
21
20
  var core = require('@material-ui/core');
22
- var useScrollPosition = require('@n8tb1t/use-scroll-position');
23
21
 
24
22
  function _extends() {
25
23
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -72,6 +70,7 @@ var _Pact = /*#__PURE__*/function () {
72
70
  };
73
71
  return _Pact;
74
72
  }();
73
+
75
74
  function _settle(pact, state, value) {
76
75
  if (!pact.s) {
77
76
  if (value instanceof _Pact) {
@@ -100,6 +99,7 @@ function _settle(pact, state, value) {
100
99
  function _isSettledPact(thenable) {
101
100
  return thenable instanceof _Pact && thenable.s & 1;
102
101
  }
102
+
103
103
  function _forTo(array, body, check) {
104
104
  var i = -1,
105
105
  pact,
@@ -131,6 +131,7 @@ function _forTo(array, body, check) {
131
131
  }
132
132
  var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
133
133
  var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
134
+
134
135
  function _catch(body, recover) {
135
136
  try {
136
137
  var result = body();
@@ -149,11 +150,17 @@ function r(e) {
149
150
  var t,
150
151
  f,
151
152
  n = "";
152
- 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);
153
+ if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) {
154
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
155
+ } else for (t in e) {
156
+ e[t] && (n && (n += " "), n += t);
157
+ }
153
158
  return n;
154
159
  }
155
160
  function clsx() {
156
- for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
161
+ for (var e, t, f = 0, n = ""; f < arguments.length;) {
162
+ (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
163
+ }
157
164
  return n;
158
165
  }
159
166
 
@@ -357,9 +364,6 @@ var userAddEditUrl = {
357
364
  approversSearch: function approversSearch() {
358
365
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/company-approvers";
359
366
  },
360
- transferAppover: function transferAppover() {
361
- return "api/v1/user-management/users/single-user/transfer-approver-role?";
362
- },
363
367
  preSignedUrl: function preSignedUrl() {
364
368
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/presigned-url";
365
369
  },
@@ -447,23 +451,15 @@ var userPanelUrl = {
447
451
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?action=delete&table=" + tableName;
448
452
  },
449
453
  getUnit: function getUnit(tableName, length, sort) {
450
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&ordering=" + sort;
454
+ return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&order=" + sort;
451
455
  },
452
456
  getPaginationUnit: function getPaginationUnit(tableName, length, page, sort) {
453
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&ordering=" + sort;
457
+ return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&order=" + sort;
454
458
  },
455
459
  moveUnit: function moveUnit() {
456
460
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
457
461
  }
458
462
  };
459
- var departmentUrl = {
460
- departmentUrl: function departmentUrl() {
461
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department";
462
- },
463
- getDepartmentHead: function getDepartmentHead(departmentId, page) {
464
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/department/" + departmentId + "/users?page=" + page;
465
- }
466
- };
467
463
 
468
464
  var api = utils.configs.api;
469
465
  var NAoptionConfig = {
@@ -473,6 +469,7 @@ var NAoptionConfig = {
473
469
  },
474
470
  applyFor: ['employee_level', 'department']
475
471
  };
472
+
476
473
  var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
477
474
  var page = _ref.page,
478
475
  tabelName = _ref.tabelName,
@@ -605,53 +602,11 @@ var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _r
605
602
  return Promise.reject(e);
606
603
  }
607
604
  };
608
- var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _ref4) {
605
+ var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
609
606
  var page = _ref4.page,
610
607
  product = _ref4.product,
611
- userId = _ref4.userId;
612
- try {
613
- return Promise.resolve(_catch(function () {
614
- return Promise.resolve(api.get(userAddEditUrl.transferAppover() + "user_id=" + userId + "&page=" + page + "&search=" + search).then(function (res) {
615
- return res.data;
616
- })).then(function (response) {
617
- var mappedValue = response.results.map(function (item) {
618
- return {
619
- value: item.email,
620
- label: item.email,
621
- type: 'detailed',
622
- data: item
623
- };
624
- });
625
- return {
626
- options: mappedValue,
627
- hasMore: !!response.next,
628
- additional: {
629
- page: page + 1,
630
- product: product,
631
- userId: userId
632
- }
633
- };
634
- });
635
- }, function () {
636
- return {
637
- options: [],
638
- hasMore: false,
639
- additional: {
640
- page: 1,
641
- product: product,
642
- userId: userId
643
- }
644
- };
645
- }));
646
- } catch (e) {
647
- return Promise.reject(e);
648
- }
649
- };
650
- var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
651
- var page = _ref5.page,
652
- product = _ref5.product,
653
- userId = _ref5.userId,
654
- placeholder = _ref5.placeholder;
608
+ userId = _ref4.userId,
609
+ placeholder = _ref4.placeholder;
655
610
  try {
656
611
  return Promise.resolve(_catch(function () {
657
612
  return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
@@ -697,9 +652,9 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
697
652
  return Promise.reject(e);
698
653
  }
699
654
  };
700
- var countryOptions = function countryOptions(search, loadedOptions, _ref6) {
701
- var page = _ref6.page,
702
- tabelName = _ref6.tabelName;
655
+ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
656
+ var page = _ref5.page,
657
+ tabelName = _ref5.tabelName;
703
658
  try {
704
659
  return Promise.resolve(_catch(function () {
705
660
  return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
@@ -711,6 +666,7 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref6) {
711
666
  label: item[tabelName]
712
667
  };
713
668
  });
669
+
714
670
  return {
715
671
  options: mappedValue,
716
672
  hasMore: !!response.next,
@@ -734,45 +690,6 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref6) {
734
690
  return Promise.reject(e);
735
691
  }
736
692
  };
737
- var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions, _ref7) {
738
- var page = _ref7.page,
739
- departmentId = _ref7.departmentId;
740
- try {
741
- return Promise.resolve(_catch(function () {
742
- return Promise.resolve(api.get(departmentUrl.getDepartmentHead(departmentId, page) + "&search=" + search).then(function (res) {
743
- return res.data;
744
- })).then(function (response) {
745
- var mappedValue = response.results.map(function (item) {
746
- return {
747
- value: item.id,
748
- label: item.first_name + ' ' + item.last_name,
749
- type: 'detailed',
750
- data: item
751
- };
752
- });
753
- return {
754
- options: mappedValue,
755
- hasMore: !!response.next,
756
- additional: {
757
- page: page + 1,
758
- departmentId: departmentId
759
- }
760
- };
761
- });
762
- }, function () {
763
- return {
764
- options: [],
765
- hasMore: false,
766
- additional: {
767
- page: 1,
768
- departmentId: departmentId
769
- }
770
- };
771
- }));
772
- } catch (e) {
773
- return Promise.reject(e);
774
- }
775
- };
776
693
 
777
694
  var UserRole = function UserRole(_ref) {
778
695
  var _ref$list = _ref.list,
@@ -851,6 +768,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
851
768
  if (userTags.length) {
852
769
  res.user_tags = userTags;
853
770
  }
771
+
854
772
  if (payload.productAccess.travel) {
855
773
  var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
856
774
  res.approvers.travel = [];
@@ -862,12 +780,14 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
862
780
  });
863
781
  }
864
782
  }
783
+
865
784
  if (payload.travelFYI && payload.travelFYI.value) {
866
785
  res.approvers.travel.push({
867
786
  email: payload.travelFYI.value,
868
787
  sequence: 'fyi'
869
788
  });
870
789
  }
790
+
871
791
  res.user_travel_info = {
872
792
  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,
873
793
  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,
@@ -906,6 +826,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
906
826
  res.files = [];
907
827
  }
908
828
  }
829
+
909
830
  if (payload.productAccess.expense) {
910
831
  res.approvers.expense = [];
911
832
  for (var _key2 in payload.expenseApproversInput) {
@@ -916,6 +837,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
916
837
  });
917
838
  }
918
839
  }
840
+
919
841
  if (payload.expenseFYI && payload.expenseFYI.value) {
920
842
  res.approvers.expense.push({
921
843
  email: payload.expenseFYI.value,
@@ -1023,6 +945,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1023
945
  });
1024
946
  }
1025
947
  }
948
+
1026
949
  if (payload.travelFYI && payload.travelFYI.value) {
1027
950
  res.fields.approvers.travel.push({
1028
951
  email: payload.travelFYI.value,
@@ -1099,6 +1022,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1099
1022
  res.fields.user_travel_info.redress_number = payload.secureTravelInputInfo.redress_number || null;
1100
1023
  }
1101
1024
  }
1025
+
1102
1026
  if (payload.productAccess.expense) {
1103
1027
  if (!env$1.isProfilePage()) {
1104
1028
  res.fields.approvers.expense = [];
@@ -1110,6 +1034,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1110
1034
  });
1111
1035
  }
1112
1036
  }
1037
+
1113
1038
  if (payload.expenseFYI && payload.expenseFYI.value) {
1114
1039
  res.fields.approvers.expense.push({
1115
1040
  email: payload.expenseFYI.value,
@@ -1241,19 +1166,10 @@ var updateTabValue = function updateTabValue(tabId) {
1241
1166
  payload: tabId
1242
1167
  };
1243
1168
  };
1244
- var updateActiveStatus = function updateActiveStatus(activateVal, id, roleTransfer, newApproverUserId) {
1245
- if (roleTransfer === void 0) {
1246
- roleTransfer = false;
1247
- }
1248
- var _payload = {
1249
- role_transfer: roleTransfer
1250
- };
1251
- if (roleTransfer) {
1252
- _payload.new_approver_user_id = newApproverUserId;
1253
- }
1169
+ var updateActiveStatus = function updateActiveStatus(activateVal, id) {
1254
1170
  return function (dispatch) {
1255
1171
  return new Promise(function (resolve, reject) {
1256
- api$1.put(userListUrl.updateActiveStatus + "user_id=" + id + "&activate=" + activateVal, _payload).then(function (res) {
1172
+ api$1.get(userListUrl.updateActiveStatus + 'user_id=' + id + '&activate=' + activateVal).then(function (res) {
1257
1173
  dispatch(setUserActiveStatus({
1258
1174
  is_active: activateVal !== 0,
1259
1175
  id: id
@@ -1350,6 +1266,7 @@ var fetchRenderFileds = function fetchRenderFileds() {
1350
1266
  var _res$data;
1351
1267
  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.');
1352
1268
  dispatch(stopLoader());
1269
+ reject();
1353
1270
  }
1354
1271
  })["catch"](function (err) {
1355
1272
  reject(err);
@@ -1362,7 +1279,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
1362
1279
  return new Promise(function (resolve, reject) {
1363
1280
  api$2.get(userAddEditUrl.countryCode()).then(function (res) {
1364
1281
  dispatch(setCountryCodes(res.data.country_code_details));
1365
- resolve(res.data.country_code_details);
1282
+ resolve('success');
1366
1283
  })["catch"](function (err) {
1367
1284
  reject(err);
1368
1285
  })["finally"](function () {});
@@ -1521,9 +1438,11 @@ var createUser = function createUser(payload) {
1521
1438
  } else {
1522
1439
  if (res.data.errors && typeof res.data.errors === 'object') {
1523
1440
  reject(res.data.errors);
1441
+ return;
1524
1442
  } else if (!Object.keys(res.data.errors).length) {
1525
1443
  IUIToastMessageService$1.warningNotify(res.data.message);
1526
1444
  }
1445
+ reject();
1527
1446
  }
1528
1447
  })["catch"](function (err) {
1529
1448
  var _err$response6;
@@ -1569,13 +1488,17 @@ var uploadSingleDocumnet = function uploadSingleDocumnet(payload) {
1569
1488
  });
1570
1489
  };
1571
1490
  };
1491
+
1572
1492
  var uploadFileToS3 = function uploadFileToS3(presignedPostData, file) {
1573
1493
  return new Promise(function (resolve, reject) {
1574
1494
  var formData = new FormData();
1495
+
1575
1496
  Object.keys(presignedPostData.fields).forEach(function (key) {
1576
1497
  formData.append(key, presignedPostData.fields[key]);
1577
1498
  });
1499
+
1578
1500
  formData.append('file', file);
1501
+
1579
1502
  axios.post(presignedPostData.url, formData, {
1580
1503
  headers: {
1581
1504
  'Content-Type': 'multipart/form-data'
@@ -1620,43 +1543,20 @@ var makePrimaryAdmin = function makePrimaryAdmin(payload) {
1620
1543
  });
1621
1544
  };
1622
1545
  };
1623
- var resetPasswordForUser = function resetPasswordForUser(data) {
1624
- return function (dispatch) {
1625
- return new Promise(function (resolve, reject) {
1626
- api$2.post("" + userAddEditUrl.resetPasswordForUserApi(), {
1627
- email: data.email
1628
- }).then(function (res) {
1629
- 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.");
1630
- resolve();
1631
- })["catch"](function (err) {
1632
- var _err$response9, _err$response9$data;
1633
- 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)) {
1634
- var _err$response10, _err$response10$data, _err$response10$data$;
1635
- 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]);
1636
- reject(err);
1637
- return;
1638
- }
1639
- reject(err);
1640
- });
1641
- });
1642
- };
1643
- };
1644
- var resendInviteForUser = function resendInviteForUser(data) {
1546
+ var undoneSignUpRejection = function undoneSignUpRejection(userId) {
1645
1547
  return function (dispatch) {
1646
1548
  return new Promise(function (resolve, reject) {
1647
- api$2.post(userAddEditUrl.resendInviteForUserApi(), {
1648
- user_ids: data
1649
- }).then(function (res) {
1650
- IUIToastMessageService$1.sNotify(res.data.message);
1549
+ api$2.patch(userAddEditUrl.undoRejectUserVerification(userId)).then(function (res) {
1550
+ dispatch(fetchUserSignupRequests({
1551
+ ordering: 'asc',
1552
+ length: 5,
1553
+ page: 1,
1554
+ search: ''
1555
+ }));
1651
1556
  resolve();
1652
1557
  })["catch"](function (err) {
1653
- var _err$response11, _err$response11$data;
1654
- 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)) {
1655
- var _err$response12, _err$response12$data, _err$response12$data$;
1656
- 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]);
1657
- reject(err);
1658
- return;
1659
- }
1558
+ var _err$response8, _err$response8$data;
1559
+ IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response8 = err.response) === null || _err$response8 === void 0 ? void 0 : (_err$response8$data = _err$response8.data) === null || _err$response8$data === void 0 ? void 0 : _err$response8$data.message) || 'Opps, Something went wrong.');
1660
1560
  reject(err);
1661
1561
  });
1662
1562
  });
@@ -1798,7 +1698,7 @@ var verifyUserInfo = function verifyUserInfo(userId) {
1798
1698
  var submitAddModalData = function submitAddModalData(tableName, data) {
1799
1699
  return function (dispatch) {
1800
1700
  return new Promise(function (resolve, reject) {
1801
- api$2.post(tableName === 'department' ? departmentUrl.departmentUrl() : userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
1701
+ api$2.post(userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
1802
1702
  resolve(res);
1803
1703
  })["catch"](function (err) {
1804
1704
  var _err$response17, _err$response17$data;
@@ -1834,7 +1734,6 @@ var OPEN_DIALOG = 'OPEN_DIALOG';
1834
1734
  var CLOSE_DIALOG = 'CLOSE_DIALOG';
1835
1735
  var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
1836
1736
  var UNASSIGNED_USERS = 'Not assigned';
1837
- var FETCH_DEPARTMENT_USERS_DATA = 'FETCH_DEPARTMENT_USERS_DATA';
1838
1737
 
1839
1738
  var api$3 = utils.configs.api;
1840
1739
  var IUIToastMessageService$2 = utils.services.IUIToastMessageService;
@@ -1881,17 +1780,18 @@ var getUserPanalData = function getUserPanalData(params) {
1881
1780
  });
1882
1781
  };
1883
1782
  };
1783
+
1884
1784
  var addRecord = function addRecord(tableName, data, getParam) {
1885
1785
  return function (dispatch) {
1886
1786
  return new Promise(function (resolve, reject) {
1887
- api$3.post(tableName === 'department' ? departmentUrl.departmentUrl() : userPanelUrl.addUnit(tableName), data).then(function (res) {
1787
+ api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
1888
1788
  dispatch(getUserPanalData(getParam));
1889
1789
  dispatch(closeDialog());
1890
1790
  resolve(res);
1891
1791
  })["catch"](function (err) {
1892
- var _err$response3, _err$response3$data;
1792
+ var _err$response2, _err$response2$data;
1893
1793
  dispatch(userPanelStopLoader());
1894
- 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.');
1794
+ IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.message) || 'Opps, Something went wrong.');
1895
1795
  });
1896
1796
  });
1897
1797
  };
@@ -1905,37 +1805,25 @@ var deleteRecord = function deleteRecord(tableName, id, getParam) {
1905
1805
  dispatch(userPanelStopLoader());
1906
1806
  resolve();
1907
1807
  })["catch"](function (err) {
1908
- var _err$response4, _err$response4$data;
1909
- 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.');
1808
+ var _err$response3, _err$response3$data;
1809
+ 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.');
1910
1810
  dispatch(userPanelStopLoader());
1911
1811
  });
1912
1812
  });
1913
1813
  };
1914
1814
  };
1915
- var editRecord = function editRecord(tableName, data, getParam, optionalParams) {
1815
+ var editRecord = function editRecord(tableName, data, getParam) {
1916
1816
  return function (dispatch) {
1917
1817
  return new Promise(function (resolve, reject) {
1918
- if (tableName === 'department') {
1919
- api$3.put(departmentUrl.departmentUrl() + "/" + optionalParams, data).then(function (res) {
1920
- dispatch(getUserPanalData(getParam));
1921
- dispatch(closeDialog());
1922
- resolve();
1923
- })["catch"](function (err) {
1924
- var _err$response5, _err$response5$data;
1925
- dispatch(userPanelStopLoader());
1926
- 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.');
1927
- });
1928
- } else {
1929
- api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
1930
- dispatch(getUserPanalData(getParam));
1931
- dispatch(closeDialog());
1932
- resolve();
1933
- })["catch"](function (err) {
1934
- var _err$response6, _err$response6$data;
1935
- dispatch(userPanelStopLoader());
1936
- 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.');
1937
- });
1938
- }
1818
+ api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
1819
+ dispatch(getUserPanalData(getParam));
1820
+ dispatch(closeDialog());
1821
+ resolve();
1822
+ })["catch"](function (err) {
1823
+ var _err$response4, _err$response4$data;
1824
+ dispatch(userPanelStopLoader());
1825
+ 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.');
1826
+ });
1939
1827
  });
1940
1828
  };
1941
1829
  };
@@ -1947,8 +1835,8 @@ var moveRecord = function moveRecord(tableName, data, getParam) {
1947
1835
  dispatch(closeDialog());
1948
1836
  resolve(res);
1949
1837
  })["catch"](function (err) {
1950
- var _err$response7, _err$response7$data;
1951
- 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.');
1838
+ var _err$response5, _err$response5$data;
1839
+ 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.');
1952
1840
  });
1953
1841
  });
1954
1842
  };
@@ -2436,6 +2324,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2436
2324
  setOpenEditAproverModalFlag(false);
2437
2325
  });
2438
2326
  };
2327
+
2439
2328
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
2440
2329
  container: true,
2441
2330
  className: (styles.headingPadding)
@@ -2583,7 +2472,8 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2583
2472
  headerText: "Edit approver field",
2584
2473
  cancelLabel: "Cancel",
2585
2474
  submitLabel: "Save",
2586
- submitHandler: handleEditAproverLabel,
2475
+ submitHandler: handleEditAproverLabel
2476
+ ,
2587
2477
  width: "420px",
2588
2478
  modalBodyStyle: {
2589
2479
  maxHeight: '600px',
@@ -3037,8 +2927,8 @@ var workInfo = [{
3037
2927
  validation: {
3038
2928
  regexOnChange: null,
3039
2929
  regexOnBlur: [{
3040
- regex: /^[(A-Z)(a-z)(0-9)\-_& ]*$/,
3041
- message: "Only alphabets, numbers, - and _ & are allowed."
2930
+ regex: /^[(A-Z)(a-z)(0-9)\-& ]*$/,
2931
+ message: "Only alphabets, numbers and - & are allowed."
3042
2932
  }],
3043
2933
  maxLimit: '',
3044
2934
  minLimit: '',
@@ -3126,8 +3016,8 @@ var workInfo = [{
3126
3016
  validation: {
3127
3017
  regexOnChange: null,
3128
3018
  regexOnBlur: [{
3129
- regex: /^[A-Za-z0-9 \-_.,&'()\/]*$/,
3130
- message: "Only alphabets, numbers & special characters . & ' ( ) _ - , / are allowed."
3019
+ regex: /^[A-Za-z0-9 \-.,&'()\/]*$/,
3020
+ message: "Only alphabets, numbers & special characters . & ' ( ) - , / are allowed."
3131
3021
  }, {
3132
3022
  regex: /^[a-zA-Z]/,
3133
3023
  message: 'Designation should start with alphabets'
@@ -3138,6 +3028,31 @@ var workInfo = [{
3138
3028
  minLength: 0
3139
3029
  },
3140
3030
  disableText: 'Please get in touch with your administrator to change this value.'
3031
+ }, {
3032
+ id: 7,
3033
+ label: 'Manager',
3034
+ name: 'manager',
3035
+ required: false,
3036
+ type: 'async_select',
3037
+ fullWidth: false,
3038
+ visibility: true,
3039
+ readOnly: false,
3040
+ placeholder: 'Select manager',
3041
+ tabelName: 'manager',
3042
+ product: 'travel',
3043
+ loadOption: approversOptions
3044
+ }, {
3045
+ id: 8,
3046
+ label: 'Skip manager',
3047
+ name: 'skip manager',
3048
+ required: false,
3049
+ type: 'async_select',
3050
+ fullWidth: false,
3051
+ visibility: true,
3052
+ readOnly: false,
3053
+ placeholder: 'Select manager',
3054
+ product: 'travel',
3055
+ loadOption: approversOptions
3141
3056
  }, {
3142
3057
  id: 9,
3143
3058
  label: 'Base location',
@@ -3973,6 +3888,7 @@ var reducer$1 = function reducer(state, action) {
3973
3888
  _userListInfo.results[i].is_active = action.payload.is_active;
3974
3889
  }
3975
3890
  });
3891
+
3976
3892
  var _deactivatedUsers = _userListInfo.results.length > 0 ? _userListInfo.results.filter(function (val) {
3977
3893
  return !val.is_active;
3978
3894
  }).map(function (obj) {
@@ -3995,6 +3911,7 @@ var reducer$1 = function reducer(state, action) {
3995
3911
  }
3996
3912
  });
3997
3913
  });
3914
+
3998
3915
  var _deactivatedUsers2 = _userListInfo2.results.length > 0 ? _userListInfo2.results.filter(function (val) {
3999
3916
  return !val.is_active;
4000
3917
  }).map(function (obj) {
@@ -4048,7 +3965,6 @@ var initialState$2 = {
4048
3965
  previous: null,
4049
3966
  results: []
4050
3967
  },
4051
- deptUsers: [],
4052
3968
  loading: false
4053
3969
  };
4054
3970
  var reducer$2 = function reducer(state, action) {
@@ -4118,12 +4034,6 @@ var reducer$2 = function reducer(state, action) {
4118
4034
  loading: false
4119
4035
  });
4120
4036
  }
4121
- case FETCH_DEPARTMENT_USERS_DATA:
4122
- {
4123
- return _extends({}, state, {
4124
- deptUsers: action.payload
4125
- });
4126
- }
4127
4037
  default:
4128
4038
  return state;
4129
4039
  }
@@ -4310,7 +4220,8 @@ var rootReducer = redux.combineReducers({
4310
4220
  customFields: reducer$5
4311
4221
  });
4312
4222
 
4313
- var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)));
4223
+ var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)
4224
+ ));
4314
4225
 
4315
4226
  function withStore(Component) {
4316
4227
  function WrappedComponent(props) {
@@ -4853,7 +4764,8 @@ function AddPanelDialog(_ref) {
4853
4764
  flexDirection: "column",
4854
4765
  padding: "8px 20px"
4855
4766
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
4856
- label: name + " name",
4767
+ label: name + " name"
4768
+ ,
4857
4769
  name: "name",
4858
4770
  defaultValue: "",
4859
4771
  onValueChange: onValueChange,
@@ -4902,7 +4814,6 @@ var UserAddEdit = function UserAddEdit(props) {
4902
4814
  isILadmin = _useSelector2.isILadmin,
4903
4815
  companyName = _useSelector2.companyName;
4904
4816
  var history = reactRouterDom.useHistory();
4905
- var location = reactRouterDom.useLocation();
4906
4817
  var _useState = React.useState({
4907
4818
  travel: false,
4908
4819
  expense: false
@@ -4938,31 +4849,8 @@ var UserAddEdit = function UserAddEdit(props) {
4938
4849
  }
4939
4850
  setProductAccess(_productAccess);
4940
4851
  };
4941
- var _useState2 = React.useState(''),
4942
- newCountryCode = _useState2[0],
4943
- setNewCountryCode = _useState2[1];
4944
- var _useState3 = React.useState(),
4945
- countryDialCode = _useState3[0],
4946
- setCountryDialCode = _useState3[1];
4947
- var _useState4 = React.useState([]),
4948
- countryContactCode = _useState4[0],
4949
- setCountryContactCode = _useState4[1];
4950
- React.useEffect(function () {
4951
- var countryObject = countryContactCode.find(function (t) {
4952
- return t.dial_code === countryDialCode;
4953
- });
4954
- if (countryObject) {
4955
- setPersonalInfoInput(_extends({}, personalInfoInput, {
4956
- country_code: countryObject.code
4957
- }));
4958
- }
4959
- }, [countryDialCode]);
4960
- React.useEffect(function () {
4961
- var extractedNumber = newCountryCode.substring(1);
4962
- var convertedNumber = parseInt(extractedNumber);
4963
- setCountryDialCode(convertedNumber);
4964
- }, [newCountryCode]);
4965
- var _useState5 = React.useState({
4852
+
4853
+ var _useState2 = React.useState({
4966
4854
  first_name: '',
4967
4855
  last_name: '',
4968
4856
  email: '',
@@ -4973,9 +4861,9 @@ var UserAddEdit = function UserAddEdit(props) {
4973
4861
  contact_country_code: '',
4974
4862
  profile_pic: []
4975
4863
  }),
4976
- personalInfoInput = _useState5[0],
4977
- setPersonalInfoInput = _useState5[1];
4978
- var _useState6 = React.useState({
4864
+ personalInfoInput = _useState2[0],
4865
+ setPersonalInfoInput = _useState2[1];
4866
+ var _useState3 = React.useState({
4979
4867
  emp_level: {
4980
4868
  value: '',
4981
4869
  label: 'Select employee level'
@@ -4995,72 +4883,62 @@ var UserAddEdit = function UserAddEdit(props) {
4995
4883
  },
4996
4884
  designation: '',
4997
4885
  base_location: '',
4998
- manager_id: {
4999
- value: '',
5000
- label: 'Select Manager'
5001
- },
5002
- skip_manager_id: {
5003
- value: '',
5004
- label: 'Select Manager'
5005
- },
5006
4886
  currency: {
5007
4887
  value: defaultCurrency,
5008
4888
  label: defaultCurrency
5009
4889
  }
5010
4890
  }),
5011
- employeeInfoInput = _useState6[0],
5012
- setEmployeeInfoInput = _useState6[1];
5013
- var _useState7 = React.useState({
4891
+ employeeInfoInput = _useState3[0],
4892
+ setEmployeeInfoInput = _useState3[1];
4893
+ var _useState4 = React.useState({
5014
4894
  emp_level: 0,
5015
4895
  entity: 0,
5016
4896
  business_unit: 0,
5017
4897
  department: 0,
5018
- currency: 0,
5019
- manager_id: 0,
5020
- skip_manager_id: 0
4898
+ currency: 0
5021
4899
  }),
5022
- cacheForAsyncDropdown = _useState7[0],
5023
- clearCacheForAsyncDropdown = _useState7[1];
5024
- var _useState8 = React.useState({}),
5025
- userTagType = _useState8[0],
5026
- setUserTagType = _useState8[1];
5027
- var _useState9 = React.useState(false),
5028
- scroll = _useState9[0],
5029
- setScroll = _useState9[1];
5030
- var _useState10 = React.useState({}),
5031
- customFieldsInput = _useState10[0],
5032
- setCustomFieldsInput = _useState10[1];
5033
- var _useState11 = React.useState('traveler'),
5034
- travelRole = _useState11[0],
5035
- setTravelRole = _useState11[1];
5036
- var _useState12 = React.useState({}),
5037
- travelApproversInput = _useState12[0],
5038
- setTravelApproversInput = _useState12[1];
5039
- var _useState13 = React.useState({
4900
+ cacheForAsyncDropdown = _useState4[0],
4901
+ clearCacheForAsyncDropdown = _useState4[1];
4902
+ var _useState5 = React.useState({}),
4903
+ userTagType = _useState5[0],
4904
+ setUserTagType = _useState5[1];
4905
+ var _useState6 = React.useState(false),
4906
+ scroll = _useState6[0],
4907
+ setScroll = _useState6[1];
4908
+ var _useState7 = React.useState({}),
4909
+ customFieldsInput = _useState7[0],
4910
+ setCustomFieldsInput = _useState7[1];
4911
+ var _useState8 = React.useState('traveler'),
4912
+ travelRole = _useState8[0],
4913
+ setTravelRole = _useState8[1];
4914
+ var _useState9 = React.useState({}),
4915
+ travelApproversInput = _useState9[0],
4916
+ setTravelApproversInput = _useState9[1];
4917
+ var _useState10 = React.useState({
5040
4918
  value: '',
5041
4919
  label: 'Select approver'
5042
4920
  }),
5043
- travelFYI = _useState13[0],
5044
- setTravelFYI = _useState13[1];
5045
- var _useState14 = React.useState([]),
5046
- membershipInfoInput = _useState14[0],
5047
- setMembershipInfoInput = _useState14[1];
5048
- var _useState15 = React.useState([]),
5049
- removedMembershipInfoInput = _useState15[0],
5050
- setRemovedMembershipInfoInput = _useState15[1];
5051
- var _useState16 = React.useState({
4921
+ travelFYI = _useState10[0],
4922
+ setTravelFYI = _useState10[1];
4923
+ var _useState11 = React.useState([]),
4924
+ membershipInfoInput = _useState11[0],
4925
+ setMembershipInfoInput = _useState11[1];
4926
+ var _useState12 = React.useState([]),
4927
+ removedMembershipInfoInput = _useState12[0],
4928
+ setRemovedMembershipInfoInput = _useState12[1];
4929
+ var _useState13 = React.useState({
5052
4930
  flight_seat_preference: '',
5053
4931
  meal_preference: ''
5054
4932
  }),
5055
- travelPreferenceInfo = _useState16[0],
5056
- settravelPreferenceInfo = _useState16[1];
5057
- var _useState17 = React.useState({
4933
+ travelPreferenceInfo = _useState13[0],
4934
+ settravelPreferenceInfo = _useState13[1];
4935
+ var _useState14 = React.useState({
5058
4936
  trusted_traveller: '',
5059
4937
  redress_number: ''
5060
4938
  }),
5061
- secureTravelInputInfo = _useState17[0],
5062
- setSecureTravelInputInfo = _useState17[1];
5063
- var _useState18 = React.useState({
4939
+ secureTravelInputInfo = _useState14[0],
4940
+ setSecureTravelInputInfo = _useState14[1];
4941
+ var _useState15 = React.useState({
5064
4942
  passport_issue_country: {
5065
4943
  value: '',
5066
4944
  label: 'Select country'
@@ -5075,39 +4953,39 @@ var UserAddEdit = function UserAddEdit(props) {
5075
4953
  passport_photo: [],
5076
4954
  travel_docs: []
5077
4955
  }),
5078
- passportInfoInput = _useState18[0],
5079
- setPassportInfoInput = _useState18[1];
5080
- var _useState19 = React.useState([]),
5081
- filesForDelete = _useState19[0],
5082
- setFilesForDelete = _useState19[1];
5083
- var _useState20 = React.useState([]),
5084
- profilePicDelete = _useState20[0],
5085
- setProfilePicDelete = _useState20[1];
5086
- var _useState21 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
5087
- isAdditionalInfoExpanded = _useState21[0],
5088
- setAdditionalInfoFlag = _useState21[1];
5089
- var _useState22 = React.useState('submitter'),
5090
- expenseRole = _useState22[0],
5091
- setExpenseRole = _useState22[1];
5092
- var _useState23 = React.useState({}),
5093
- expenseApproversInput = _useState23[0],
5094
- setExpenseApproversInput = _useState23[1];
5095
- var _useState24 = React.useState({
4956
+ passportInfoInput = _useState15[0],
4957
+ setPassportInfoInput = _useState15[1];
4958
+ var _useState16 = React.useState([]),
4959
+ filesForDelete = _useState16[0],
4960
+ setFilesForDelete = _useState16[1];
4961
+ var _useState17 = React.useState([]),
4962
+ profilePicDelete = _useState17[0],
4963
+ setProfilePicDelete = _useState17[1];
4964
+ var _useState18 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
4965
+ isAdditionalInfoExpanded = _useState18[0],
4966
+ setAdditionalInfoFlag = _useState18[1];
4967
+ var _useState19 = React.useState('submitter'),
4968
+ expenseRole = _useState19[0],
4969
+ setExpenseRole = _useState19[1];
4970
+ var _useState20 = React.useState({}),
4971
+ expenseApproversInput = _useState20[0],
4972
+ setExpenseApproversInput = _useState20[1];
4973
+ var _useState21 = React.useState({
5096
4974
  value: '',
5097
4975
  label: 'Select approver'
5098
4976
  }),
5099
- expenseFYI = _useState24[0],
5100
- setExpenseFYI = _useState24[1];
4977
+ expenseFYI = _useState21[0],
4978
+ setExpenseFYI = _useState21[1];
5101
4979
  var asyncSelectRefs = React.useRef({
5102
4980
  emp_level: React.useRef(null),
5103
4981
  entity: React.useRef(null),
5104
4982
  business_unit: React.useRef(null),
5105
4983
  department: React.useRef(null)
5106
4984
  });
5107
- var _useState25 = React.useState([]),
5108
- errorArray = _useState25[0],
5109
- setErrorArray = _useState25[1];
5110
- var _useState26 = React.useState({
4985
+ var _useState22 = React.useState([]),
4986
+ errorArray = _useState22[0],
4987
+ setErrorArray = _useState22[1];
4988
+ var _useState23 = React.useState({
5111
4989
  first_name: '',
5112
4990
  last_name: '',
5113
4991
  email: '',
@@ -5137,9 +5015,9 @@ var UserAddEdit = function UserAddEdit(props) {
5137
5015
  userTagType: '',
5138
5016
  profile_pic: ''
5139
5017
  }),
5140
- errorMsgs = _useState26[0],
5141
- setErrorMsgs = _useState26[1];
5142
- var _useState27 = React.useState({
5018
+ errorMsgs = _useState23[0],
5019
+ setErrorMsgs = _useState23[1];
5020
+ var _useState24 = React.useState({
5143
5021
  first_name: false,
5144
5022
  last_name: false,
5145
5023
  email: false,
@@ -5166,14 +5044,11 @@ var UserAddEdit = function UserAddEdit(props) {
5166
5044
  userTagType: false,
5167
5045
  profile_pic: false
5168
5046
  }),
5169
- inputChangeLog = _useState27[0],
5170
- updateInputChangeLog = _useState27[1];
5171
- var _useState28 = React.useState([]),
5172
- uploadedFiles = _useState28[0],
5173
- setUploadedFiles = _useState28[1];
5174
- var _useState29 = React.useState(70),
5175
- maxLengthForModal = _useState29[0],
5176
- setMaxLengthForModal = _useState29[1];
5047
+ inputChangeLog = _useState24[0],
5048
+ updateInputChangeLog = _useState24[1];
5049
+ var _useState25 = React.useState([]),
5050
+ uploadedFiles = _useState25[0],
5051
+ setUploadedFiles = _useState25[1];
5177
5052
  var defaultAddModalData = {
5178
5053
  isOpen: false,
5179
5054
  isError: false,
@@ -5186,41 +5061,25 @@ var UserAddEdit = function UserAddEdit(props) {
5186
5061
  regexOnBlur: null,
5187
5062
  maxLimit: '',
5188
5063
  minLimit: '',
5189
- maxLength: maxLengthForModal,
5064
+ maxLength: 70,
5190
5065
  minLength: 0
5191
5066
  };
5192
- var _useState30 = React.useState(defaultAddModalData),
5193
- addModalData = _useState30[0],
5194
- setAddModalData = _useState30[1];
5067
+ var _useState26 = React.useState(defaultAddModalData),
5068
+ addModalData = _useState26[0],
5069
+ setAddModalData = _useState26[1];
5195
5070
  var onAddModalClose = function onAddModalClose() {
5196
5071
  setAddModalData(_extends({}, defaultAddModalData));
5197
5072
  };
5198
- React.useEffect(function () {
5199
- var _location$state, _location$state2;
5200
- 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) {
5201
- var _location$state3, _location$state4;
5202
- setEmployeeInfoInput(_extends({}, employeeInfoInput, {
5203
- department: {
5204
- value: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.id,
5205
- label: location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.name
5206
- }
5207
- }));
5208
- }
5209
- }, []);
5210
5073
  var onModalOpen = function onModalOpen(e, id) {
5211
5074
  var title = '';
5212
5075
  if (id === 'entity') {
5213
5076
  title = 'Entity';
5214
- setMaxLengthForModal(70);
5215
5077
  } else if (id === 'department') {
5216
5078
  title = 'Department';
5217
- setMaxLengthForModal(70);
5218
5079
  } else if (id === 'business_unit') {
5219
- setMaxLengthForModal(150);
5220
5080
  title = 'Business unit';
5221
5081
  } else if (id === 'employee_level') {
5222
5082
  title = 'Employee level';
5223
- setMaxLengthForModal(70);
5224
5083
  }
5225
5084
  setAddModalData(_extends({}, addModalData, {
5226
5085
  isOpen: true,
@@ -5236,42 +5095,23 @@ var UserAddEdit = function UserAddEdit(props) {
5236
5095
  }));
5237
5096
  } else {
5238
5097
  dispatch(showLoader());
5239
- var dataObj;
5240
- if (addModalData.id === 'department') {
5241
- dataObj = {
5242
- name: validatedValue,
5243
- department_head_id: null
5244
- };
5245
- } else {
5246
- dataObj = {
5247
- names: [validatedValue]
5248
- };
5249
- }
5250
- dispatch(submitAddModalData(addModalData.id, dataObj)).then(function (res) {
5251
- var _extends4;
5098
+ dispatch(submitAddModalData(addModalData.id, {
5099
+ names: [validatedValue]
5100
+ })).then(function (res) {
5101
+ var _extends2;
5252
5102
  setAddModalData(_extends({}, addModalData, {
5253
5103
  isOpen: false
5254
5104
  }));
5255
5105
  IUIToastMessageService$4.sNotify(addModalData.title + " added successfully.");
5256
5106
  var tempKey = addModalData.id === 'employee_level' ? 'emp_level' : addModalData.id;
5257
- if (addModalData.id === 'department') {
5258
- var _extends2;
5259
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
5260
- value: res.data.result.id,
5261
- label: res.data.result.name
5262
- }, _extends2)));
5263
- } else {
5264
- var _extends3;
5265
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends3 = {}, _extends3[tempKey] = {
5266
- value: res.data.value,
5267
- label: res.data.label
5268
- }, _extends3)));
5269
- }
5270
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[tempKey] = true, _extends4)));
5107
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
5108
+ value: res.data.value,
5109
+ label: res.data.label
5110
+ }, _extends2)));
5271
5111
  asyncSelectRefs.current[tempKey].current.blur();
5272
5112
  clearCacheForAsyncDropdown(function (prevState) {
5273
- var _extends5;
5274
- return _extends({}, prevState, (_extends5 = {}, _extends5[tempKey] = prevState[tempKey] + 1, _extends5));
5113
+ var _extends3;
5114
+ return _extends({}, prevState, (_extends3 = {}, _extends3[tempKey] = prevState[tempKey] + 1, _extends3));
5275
5115
  });
5276
5116
  dispatch(stopLoader());
5277
5117
  });
@@ -5288,10 +5128,10 @@ var UserAddEdit = function UserAddEdit(props) {
5288
5128
  };
5289
5129
  var onPersonalInfoChange = function onPersonalInfoChange(args) {
5290
5130
  try {
5291
- var _temp5 = function _temp5() {
5131
+ var _temp6 = function _temp6() {
5292
5132
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5293
- var _extends6;
5294
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends6 = {}, _extends6[_name] = true, _extends6)));
5133
+ var _extends4;
5134
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[_name] = true, _extends4)));
5295
5135
  }
5296
5136
  };
5297
5137
  var _name = args._name,
@@ -5302,7 +5142,7 @@ var UserAddEdit = function UserAddEdit(props) {
5302
5142
  _errorMsg = _args$_errorMsg === void 0 ? '' : _args$_errorMsg,
5303
5143
  _args$_obj = args._obj,
5304
5144
  _obj = _args$_obj === void 0 ? {} : _args$_obj;
5305
- var _temp4 = function () {
5145
+ var _temp7 = function () {
5306
5146
  if (_name === 'contact_number') {
5307
5147
  setPersonalInfoInput(_extends({}, personalInfoInput, {
5308
5148
  contact_number: _value.trim(),
@@ -5313,14 +5153,14 @@ var UserAddEdit = function UserAddEdit(props) {
5313
5153
  updateError('country_code', _isError, _errorMsg);
5314
5154
  updateError('contact_country_code', _isError, _errorMsg);
5315
5155
  } else {
5316
- var _temp3 = function _temp3() {
5317
- var _extends7;
5318
- setPersonalInfoInput(_extends({}, personalInfoInput, (_extends7 = {}, _extends7[_name] = _value, _extends7)));
5156
+ var _temp8 = function _temp8() {
5157
+ var _extends5;
5158
+ setPersonalInfoInput(_extends({}, personalInfoInput, (_extends5 = {}, _extends5[_name] = _value, _extends5)));
5319
5159
  updateError(_name, _isError, _errorMsg);
5320
5160
  };
5321
- var _temp2 = function () {
5161
+ var _temp9 = function () {
5322
5162
  if (_name === 'profile_pic') {
5323
- var _temp = function () {
5163
+ var _temp10 = function () {
5324
5164
  if (_obj.isUpload) {
5325
5165
  return Promise.resolve(uploadDocs(_value, _name)).then(function (docsData) {
5326
5166
  _value = _value.map(function (_val) {
@@ -5351,28 +5191,28 @@ var UserAddEdit = function UserAddEdit(props) {
5351
5191
  setProfilePicDelete([].concat(profilePicDelete, _deletedFiles));
5352
5192
  }
5353
5193
  }();
5354
- if (_temp && _temp.then) return _temp.then(function () {});
5194
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
5355
5195
  }
5356
5196
  }();
5357
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
5197
+ return _temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9);
5358
5198
  }
5359
5199
  }();
5360
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
5200
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
5361
5201
  } catch (e) {
5362
5202
  return Promise.reject(e);
5363
5203
  }
5364
5204
  };
5365
5205
  var onEmployeeInfoChange = function onEmployeeInfoChange(args) {
5366
- var _extends8;
5206
+ var _extends6;
5367
5207
  var _name = args._name,
5368
5208
  _value = args._value,
5369
5209
  _isError = args._isError,
5370
5210
  _errorMsg = args._errorMsg;
5371
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
5211
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends6 = {}, _extends6[_name] = _value, _extends6)));
5372
5212
  updateError(_name, _isError, _errorMsg);
5373
5213
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5374
- var _extends9;
5375
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends9 = {}, _extends9[_name] = true, _extends9)));
5214
+ var _extends7;
5215
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends7 = {}, _extends7[_name] = true, _extends7)));
5376
5216
  }
5377
5217
  };
5378
5218
  var getUserTagTypeId = function getUserTagTypeId(name) {
@@ -5382,9 +5222,9 @@ var UserAddEdit = function UserAddEdit(props) {
5382
5222
  return tag.id;
5383
5223
  };
5384
5224
  var onUserTagTypeChange = function onUserTagTypeChange(args) {
5385
- var _extends10;
5225
+ var _extends8;
5386
5226
  var e = args._event;
5387
- setUserTagType(_extends({}, userTagType, (_extends10 = {}, _extends10[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends10)));
5227
+ setUserTagType(_extends({}, userTagType, (_extends8 = {}, _extends8[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends8)));
5388
5228
  if (Object.hasOwnProperty.call(inputChangeLog, 'userTagType')) {
5389
5229
  updateInputChangeLog(_extends({}, inputChangeLog, {
5390
5230
  userTagType: true
@@ -5392,26 +5232,30 @@ var UserAddEdit = function UserAddEdit(props) {
5392
5232
  }
5393
5233
  };
5394
5234
  var onCustomFieldsChange = function onCustomFieldsChange(_ref2) {
5395
- var _extends11;
5235
+ var _extends9;
5396
5236
  var _name = _ref2._name,
5397
5237
  _value = _ref2._value;
5398
- setCustomFieldsInput(_extends({}, customFieldsInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5238
+ setCustomFieldsInput(_extends({}, customFieldsInput, (_extends9 = {}, _extends9[_name] = _value, _extends9)));
5399
5239
  };
5400
5240
  var onTravelApproversInputChange = function onTravelApproversInputChange(_ref3) {
5401
- var _extends12;
5241
+ var _extends10;
5402
5242
  var _name = _ref3._name,
5403
5243
  _value = _ref3._value;
5404
- setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5244
+ setTravelApproversInput(_extends({}, travelApproversInput, (_extends10 = {}, _extends10[_name] = _value, _extends10)));
5405
5245
  };
5406
5246
  var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
5407
- var _extends13;
5247
+ var _extends11;
5408
5248
  var _name = _ref4._name,
5409
5249
  _value = _ref4._value;
5410
- setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
5250
+ setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5411
5251
  };
5412
5252
  var onMemInfoInputChange = function onMemInfoInputChange(index, key, val) {
5413
5253
  var _membershipInfoInput = [].concat(membershipInfoInput);
5414
- _membershipInfoInput[index][key] = val;
5254
+ if (_membershipInfoInput[index].membership_type === 'flight' && key === 'name') {
5255
+ _membershipInfoInput[index][key] = val.label;
5256
+ } else {
5257
+ _membershipInfoInput[index][key] = val;
5258
+ }
5415
5259
  _membershipInfoInput[index].isEditMode = isEditMode;
5416
5260
  setMembershipInfoInput(_membershipInfoInput);
5417
5261
  };
@@ -5441,39 +5285,39 @@ var UserAddEdit = function UserAddEdit(props) {
5441
5285
  setMembershipInfoInput(_membershipInfoInputTemp);
5442
5286
  };
5443
5287
  var travelPreferenceOnChange = function travelPreferenceOnChange(args) {
5444
- var _extends14;
5288
+ var _extends12;
5445
5289
  var _name = args._name,
5446
5290
  _value = args._value,
5447
5291
  _isError = args._isError,
5448
5292
  _errorMsg = args._errorMsg;
5449
- settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
5293
+ settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5450
5294
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5451
- var _extends15;
5452
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
5295
+ var _extends13;
5296
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends13 = {}, _extends13[_name] = true, _extends13)));
5453
5297
  }
5454
5298
  updateError(_name, _isError, _errorMsg);
5455
5299
  };
5456
5300
  var onSecureTraveelerInfoInputChange = function onSecureTraveelerInfoInputChange(args) {
5457
- var _extends16;
5301
+ var _extends14;
5458
5302
  var _name = args._name,
5459
5303
  _value = args._value,
5460
5304
  _isError = args._isError,
5461
5305
  _errorMsg = args._errorMsg;
5462
- setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
5306
+ setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
5463
5307
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5464
- var _extends17;
5465
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
5308
+ var _extends15;
5309
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
5466
5310
  }
5467
5311
  updateError(_name, _isError, _errorMsg);
5468
5312
  };
5469
5313
  var onPassportInfoInputChange = function onPassportInfoInputChange(args) {
5470
5314
  try {
5471
- var _temp8 = function _temp8() {
5472
- var _extends18;
5473
- setPassportInfoInput(_extends({}, passportInfoInput, (_extends18 = {}, _extends18[_name] = _value, _extends18)));
5315
+ var _temp14 = function _temp14() {
5316
+ var _extends16;
5317
+ setPassportInfoInput(_extends({}, passportInfoInput, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
5474
5318
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5475
- var _extends19;
5476
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends19 = {}, _extends19[_name] = true, _extends19)));
5319
+ var _extends17;
5320
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
5477
5321
  }
5478
5322
  updateError(_name, _isError, _errorMsg);
5479
5323
  };
@@ -5511,9 +5355,9 @@ var UserAddEdit = function UserAddEdit(props) {
5511
5355
  }
5512
5356
  return Promise.resolve();
5513
5357
  }
5514
- var _temp7 = function () {
5358
+ var _temp15 = function () {
5515
5359
  if (_name === 'passport_photo' || _name === 'travel_docs') {
5516
- var _temp6 = function () {
5360
+ var _temp16 = function () {
5517
5361
  if (_obj.isUpload) {
5518
5362
  var checkAlreadyUploadedFiles = uploadedFiles.filter(function (_file) {
5519
5363
  if (_name === 'passport_photo') {
@@ -5557,10 +5401,10 @@ var UserAddEdit = function UserAddEdit(props) {
5557
5401
  setFilesForDelete([].concat(filesForDelete, _deletedFiles));
5558
5402
  }
5559
5403
  }();
5560
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
5404
+ if (_temp16 && _temp16.then) return _temp16.then(function () {});
5561
5405
  }
5562
5406
  }();
5563
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
5407
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
5564
5408
  } catch (e) {
5565
5409
  return Promise.reject(e);
5566
5410
  }
@@ -5579,8 +5423,8 @@ var UserAddEdit = function UserAddEdit(props) {
5579
5423
  return _errorArray;
5580
5424
  });
5581
5425
  setErrorMsgs(function (prevState) {
5582
- var _extends20;
5583
- return _extends({}, prevState, (_extends20 = {}, _extends20[_name] = _errorMsg, _extends20));
5426
+ var _extends18;
5427
+ return _extends({}, prevState, (_extends18 = {}, _extends18[_name] = _errorMsg, _extends18));
5584
5428
  });
5585
5429
  };
5586
5430
  var dispatch = reactRedux.useDispatch();
@@ -5612,7 +5456,6 @@ var UserAddEdit = function UserAddEdit(props) {
5612
5456
  }
5613
5457
  }));
5614
5458
  dispatch(fetchCountryCodes()).then(function (_res) {
5615
- setCountryContactCode(_res);
5616
5459
  if (isEditMode) {
5617
5460
  if (!isProfile && !editUserId) return false;
5618
5461
  dispatch(setStaticFieldsVisibility({
@@ -5655,20 +5498,6 @@ var UserAddEdit = function UserAddEdit(props) {
5655
5498
  value: '',
5656
5499
  label: 'Select employee level'
5657
5500
  },
5658
- manager_id: res.employee_info.manager ? {
5659
- value: res.employee_info.manager,
5660
- label: res.employee_info.manager
5661
- } : {
5662
- value: '',
5663
- label: 'Select Manager'
5664
- },
5665
- skip_manager_id: res.employee_info.skip_manager ? {
5666
- value: res.employee_info.skip_manager,
5667
- label: res.employee_info.skip_manager
5668
- } : {
5669
- value: '',
5670
- label: 'Select Manager'
5671
- },
5672
5501
  employee_id: res.employee_info.employee_id || '',
5673
5502
  entity: res.employee_info.entity ? {
5674
5503
  value: res.employee_info.entity.id,
@@ -5854,6 +5683,7 @@ var UserAddEdit = function UserAddEdit(props) {
5854
5683
  required: true
5855
5684
  }
5856
5685
  }));
5686
+
5857
5687
  var _productAccess = _extends({}, productAccess);
5858
5688
  renderFields.products.forEach(function (product) {
5859
5689
  _productAccess[product.name] = true;
@@ -5901,7 +5731,7 @@ var UserAddEdit = function UserAddEdit(props) {
5901
5731
  }, [renderFields.expenseApprovers]);
5902
5732
  var uploadDocs = function uploadDocs(docToUpload, type) {
5903
5733
  try {
5904
- var _temp10 = function _temp10() {
5734
+ var _temp19 = function _temp19() {
5905
5735
  setUploadedFiles([].concat(uploadedFiles, data));
5906
5736
  dispatch(stopLoader());
5907
5737
  return data;
@@ -5917,12 +5747,12 @@ var UserAddEdit = function UserAddEdit(props) {
5917
5747
  userID: editUserId
5918
5748
  });
5919
5749
  });
5920
- var _temp9 = _forTo(docs, function (i) {
5750
+ var _temp20 = _forTo(docs, function (i) {
5921
5751
  return Promise.resolve(dispatch(uploadSingleDocumnet(docs[i]))).then(function (res) {
5922
5752
  data.push(res);
5923
5753
  });
5924
5754
  });
5925
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9));
5755
+ return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
5926
5756
  } catch (e) {
5927
5757
  return Promise.reject(e);
5928
5758
  }
@@ -5934,12 +5764,6 @@ var UserAddEdit = function UserAddEdit(props) {
5934
5764
  IUIToastMessageService$4.warningNotify(checkAnyError);
5935
5765
  return Promise.resolve();
5936
5766
  }
5937
- if (employeeInfoInput.manager_id.value !== '') {
5938
- employeeInfoInput.manager_id = employeeInfoInput.manager.value;
5939
- }
5940
- if (employeeInfoInput.skip_manager_id.value !== '') {
5941
- employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
5942
- }
5943
5767
  var payload = {
5944
5768
  personalInfoInput: personalInfoInput,
5945
5769
  employeeInfoInput: employeeInfoInput,
@@ -6056,7 +5880,8 @@ var UserAddEdit = function UserAddEdit(props) {
6056
5880
  }
6057
5881
  _errorMsgs.passport_issue_date = '';
6058
5882
  }
6059
- if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
5883
+ if (passportInfoInput.passport_photo.length === 0 && userTravelInfo.file_name === false &&
5884
+ fieldsVisibility.user_travel_info.file_name !== 2) {
6060
5885
  _isError = true;
6061
5886
  if (_errorArray.indexOf('passport_photo') === -1) {
6062
5887
  _errorArray.push('passport_photo');
@@ -6068,7 +5893,8 @@ var UserAddEdit = function UserAddEdit(props) {
6068
5893
  }
6069
5894
  _errorMsgs.passport_photo = '';
6070
5895
  }
6071
- if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false && fieldsVisibility.user_travel_info.file_name !== 2) {
5896
+ if (passportInfoInput.travel_docs.length === 0 && userTravelInfo.file_name === false &&
5897
+ fieldsVisibility.user_travel_info.file_name !== 2) {
6072
5898
  _isError = true;
6073
5899
  if (_errorArray.indexOf('travel_docs') === -1) {
6074
5900
  _errorArray.push('travel_docs');
@@ -6084,59 +5910,58 @@ var UserAddEdit = function UserAddEdit(props) {
6084
5910
  if (_isError) {
6085
5911
  setErrorArray(_errorArray);
6086
5912
  setErrorMsgs(_errorMsgs);
6087
- var _loop = function _loop() {
5913
+ for (var _key3 in _errorMsgs) {
6088
5914
  if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
6089
5915
  if (_errorMsgs[_key3]) {
6090
- if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
6091
- setAdditionalInfoFlag('open');
6092
- }
6093
- var el = document.getElementById(_key3 === 'country_code' || _key3 === 'contact_country_code' ? 'contact_number' : _key3);
6094
- if (el) {
6095
- setTimeout(function () {
6096
- el.scrollIntoView({
6097
- behavior: 'smooth',
6098
- block: 'center'
6099
- });
6100
- }, 500);
6101
- return 1;
6102
- }
5916
+ var _ret = function () {
5917
+ if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
5918
+ setAdditionalInfoFlag('open');
5919
+ }
5920
+ var el = document.getElementById(_key3 === 'country_code' || _key3 === 'contact_country_code' ? 'contact_number' : _key3);
5921
+ if (el) {
5922
+ setTimeout(function () {
5923
+ el.scrollIntoView({
5924
+ behavior: 'smooth',
5925
+ block: 'center'
5926
+ });
5927
+ }, 500);
5928
+ return "break";
5929
+ }
5930
+ }();
5931
+ if (_ret === "break") break;
6103
5932
  }
6104
5933
  }
6105
- };
6106
- for (var _key3 in _errorMsgs) {
6107
- if (_loop()) break;
6108
5934
  }
5935
+ return Promise.resolve();
6109
5936
  }
6110
- if (!_isError) {
6111
- if (isEditMode && editUserId || isProfile) {
6112
- dispatch(showLoader());
6113
- dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
6114
- if (isProfile) {
6115
- var _config$routes, _config$routes$profil, _config$routes$profil2;
6116
- (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);
6117
- } else {
6118
- var _config$routes2, _config$routes2$users, _config$routes2$users2;
6119
- (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);
5937
+ if (isEditMode && editUserId || isProfile) {
5938
+ dispatch(showLoader());
5939
+ dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
5940
+ if (isProfile) {
5941
+ var _config$routes, _config$routes$profil, _config$routes$profil2;
5942
+ (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);
5943
+ } else {
5944
+ var _config$routes2, _config$routes2$users, _config$routes2$users2;
5945
+ (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);
5946
+ }
5947
+ })["catch"](function (err) {
5948
+ if (typeof err === 'object') {
5949
+ if (err.country_code) {
5950
+ err.contact_number = err.country_code;
6120
5951
  }
6121
- setFilesForDelete([]);
6122
- setProfilePicDelete([]);
6123
- })["catch"](function (err) {
6124
- if (typeof err === 'object') {
6125
- if (err.country_code) {
6126
- err.contact_number = err.country_code;
6127
- }
6128
- if (err.contact_country_code) {
6129
- err.contact_number = err.contact_country_code;
6130
- }
6131
- if (err.passport) {
6132
- err.passport_photo = _extends({}, err.passport);
6133
- delete err.passport;
6134
- }
6135
- setErrorArray(Object.keys(err));
6136
- setErrorMsgs(err);
6137
- var _loop2 = function _loop2() {
6138
- if (Object.hasOwnProperty.call(err, _key4)) {
6139
- if (err[_key4]) {
5952
+ if (err.contact_country_code) {
5953
+ err.contact_number = err.contact_country_code;
5954
+ }
5955
+ if (err.passport) {
5956
+ err.passport_photo = _extends({}, err.passport);
5957
+ delete err.passport;
5958
+ }
5959
+ setErrorArray(Object.keys(err));
5960
+ setErrorMsgs(err);
5961
+ for (var _key4 in err) {
5962
+ if (Object.hasOwnProperty.call(err, _key4)) {
5963
+ if (err[_key4]) {
5964
+ var _ret2 = function () {
6140
5965
  if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
6141
5966
  setAdditionalInfoFlag('open');
6142
5967
  }
@@ -6148,44 +5973,44 @@ var UserAddEdit = function UserAddEdit(props) {
6148
5973
  block: 'center'
6149
5974
  });
6150
5975
  }, 500);
6151
- return 1;
5976
+ return "break";
6152
5977
  }
6153
- }
5978
+ }();
5979
+ if (_ret2 === "break") break;
6154
5980
  }
6155
- };
6156
- for (var _key4 in err) {
6157
- if (_loop2()) break;
6158
5981
  }
6159
- } else if (typeof err === 'string') {
6160
- IUIToastMessageService$4.warningNotify(err);
6161
- } else {
6162
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6163
5982
  }
6164
- })["finally"](function () {
6165
- dispatch(stopLoader());
6166
- });
6167
- } else {
6168
- dispatch(showLoader());
6169
- dispatch(createUser(payload)).then(function (res) {
6170
- var _config$routes3, _config$routes3$users, _config$routes3$users2;
6171
- (config === null || config === void 0 ? void 0 : (_config$routes3 = config.routes) === null || _config$routes3 === void 0 ? void 0 : (_config$routes3$users = _config$routes3.users) === null || _config$routes3$users === void 0 ? void 0 : (_config$routes3$users2 = _config$routes3$users.list) === null || _config$routes3$users2 === void 0 ? void 0 : _config$routes3$users2.path) && history.push(config.routes.users.list.path);
6172
- })["catch"](function (err) {
6173
- if (typeof err === 'object') {
6174
- if (err.country_code) {
6175
- err.contact_number = err.country_code;
6176
- }
6177
- if (err.contact_country_code) {
6178
- err.contact_number = err.contact_country_code;
6179
- }
6180
- if (err.passport) {
6181
- err.passport_photo = _extends({}, err.passport);
6182
- delete err.passport;
6183
- }
6184
- setErrorArray(Object.keys(err));
6185
- setErrorMsgs(err);
6186
- var _loop3 = function _loop3() {
6187
- if (Object.hasOwnProperty.call(err, _key5)) {
6188
- if (err[_key5]) {
5983
+ } else if (typeof err === 'string') {
5984
+ IUIToastMessageService$4.warningNotify(err);
5985
+ } else {
5986
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5987
+ }
5988
+ })["finally"](function () {
5989
+ dispatch(stopLoader());
5990
+ });
5991
+ } else {
5992
+ dispatch(showLoader());
5993
+ dispatch(createUser(payload)).then(function (res) {
5994
+ var _config$routes3, _config$routes3$users, _config$routes3$users2;
5995
+ (config === null || config === void 0 ? void 0 : (_config$routes3 = config.routes) === null || _config$routes3 === void 0 ? void 0 : (_config$routes3$users = _config$routes3.users) === null || _config$routes3$users === void 0 ? void 0 : (_config$routes3$users2 = _config$routes3$users.list) === null || _config$routes3$users2 === void 0 ? void 0 : _config$routes3$users2.path) && history.push(config.routes.users.list.path);
5996
+ })["catch"](function (err) {
5997
+ if (typeof err === 'object') {
5998
+ if (err.country_code) {
5999
+ err.contact_number = err.country_code;
6000
+ }
6001
+ if (err.contact_country_code) {
6002
+ err.contact_number = err.contact_country_code;
6003
+ }
6004
+ if (err.passport) {
6005
+ err.passport_photo = _extends({}, err.passport);
6006
+ delete err.passport;
6007
+ }
6008
+ setErrorArray(Object.keys(err));
6009
+ setErrorMsgs(err);
6010
+ for (var _key5 in err) {
6011
+ if (Object.hasOwnProperty.call(err, _key5)) {
6012
+ if (err[_key5]) {
6013
+ var _ret3 = function () {
6189
6014
  if (_key5 in passportInfoInput || _key5 in travelPreferenceInfo || _key5 in secureTravelInputInfo) {
6190
6015
  setAdditionalInfoFlag('open');
6191
6016
  }
@@ -6197,23 +6022,21 @@ var UserAddEdit = function UserAddEdit(props) {
6197
6022
  block: 'center'
6198
6023
  });
6199
6024
  }, 500);
6200
- return 1;
6025
+ return "break";
6201
6026
  }
6202
- }
6027
+ }();
6028
+ if (_ret3 === "break") break;
6203
6029
  }
6204
- };
6205
- for (var _key5 in err) {
6206
- if (_loop3()) break;
6207
6030
  }
6208
- } else if (typeof err === 'string') {
6209
- IUIToastMessageService$4.warningNotify(err);
6210
- } else {
6211
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6212
6031
  }
6213
- })["finally"](function () {
6214
- dispatch(stopLoader());
6215
- });
6216
- }
6032
+ } else if (typeof err === 'string') {
6033
+ IUIToastMessageService$4.warningNotify(err);
6034
+ } else {
6035
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6036
+ }
6037
+ })["finally"](function () {
6038
+ dispatch(stopLoader());
6039
+ });
6217
6040
  }
6218
6041
  return Promise.resolve();
6219
6042
  } catch (e) {
@@ -6229,7 +6052,8 @@ var UserAddEdit = function UserAddEdit(props) {
6229
6052
  window.location.href = config.routes.profile.redirectUrl.cancel;
6230
6053
  }
6231
6054
  }
6232
- } else {
6055
+ }
6056
+ else {
6233
6057
  var _config$routes4, _config$routes4$users, _config$routes4$users2;
6234
6058
  (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
6235
6059
  }
@@ -6251,13 +6075,18 @@ var UserAddEdit = function UserAddEdit(props) {
6251
6075
  if (verifyUserId) {
6252
6076
  dispatch(showLoader());
6253
6077
  dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
6254
- setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
6255
6078
  setPersonalInfoInput(function (prevState) {
6256
6079
  return _extends({}, prevState, {
6257
- first_name: res.first_name,
6258
- last_name: res.last_name,
6080
+ first_name: res.fname,
6081
+ last_name: res.lname,
6259
6082
  email: res.email,
6260
- contact_number: res === null || res === void 0 ? void 0 : res.contact_number,
6083
+ contact_number: res.phone,
6084
+ dob: function () {
6085
+ var dt = new Date(res.dob);
6086
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
6087
+ return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
6088
+ }(),
6089
+
6261
6090
  gender: function () {
6262
6091
  if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
6263
6092
  }()
@@ -6302,6 +6131,7 @@ var UserAddEdit = function UserAddEdit(props) {
6302
6131
  }()
6303
6132
  });
6304
6133
  });
6134
+
6305
6135
  if (res.client_admin) {
6306
6136
  setTravelApproversInput(function (prevState) {
6307
6137
  var nextState = _extends({}, prevState);
@@ -6335,6 +6165,7 @@ var UserAddEdit = function UserAddEdit(props) {
6335
6165
  });
6336
6166
  }
6337
6167
  };
6168
+
6338
6169
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
6339
6170
  component: "div",
6340
6171
  className: styles.UUIUserManagementAddEdit
@@ -6351,7 +6182,8 @@ var UserAddEdit = function UserAddEdit(props) {
6351
6182
  className: styles.breadcrumb
6352
6183
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBreadCrumb, {
6353
6184
  breadCrumbs: [{
6354
- href: config.routes.users.list.path,
6185
+ href:
6186
+ config.routes.users.list.path,
6355
6187
  label: 'Users',
6356
6188
  hasLink: true
6357
6189
  }]
@@ -6420,9 +6252,6 @@ var UserAddEdit = function UserAddEdit(props) {
6420
6252
  if (!p.visibility) {
6421
6253
  return null;
6422
6254
  }
6423
- if (p.name === 'profile_pic' && config.env.isExpenseProduct) {
6424
- return null;
6425
- }
6426
6255
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
6427
6256
  item: true,
6428
6257
  sm: 12,
@@ -6801,13 +6630,17 @@ var uploadBulkUsersFile = function uploadBulkUsersFile(payload) {
6801
6630
  });
6802
6631
  };
6803
6632
  };
6633
+
6804
6634
  var uploadFileToS3$1 = function uploadFileToS3(presignedPostData, file) {
6805
6635
  return new Promise(function (resolve, reject) {
6806
6636
  var formData = new FormData();
6637
+
6807
6638
  Object.keys(presignedPostData.fields).forEach(function (key) {
6808
6639
  formData.append(key, presignedPostData.fields[key]);
6809
6640
  });
6641
+
6810
6642
  formData.append('file', file);
6643
+
6811
6644
  axios.post(presignedPostData.url, formData, {
6812
6645
  headers: {
6813
6646
  'Content-Type': 'multipart/form-data'
@@ -6924,7 +6757,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
6924
6757
  };
6925
6758
  };
6926
6759
 
6927
- 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"};
6760
+ var styles$5 = {"UUIUserManagementList":"_3WNHx","pageHeader":"_1WLpc","buttonWrapper":"_2egTG","headingWrapper":"_1He01","headingSignUpWrapper":"_Q8vqd","heading":"_1uPaO","headingLarge":"_2FsLd","headingMedium":"_nGXA9","headingSmall":"_2rpwF","description":"_25vb9","headerText":"_1Ny9J","letterImage":"_2hr3R","tablewrapper":"_1-RPw","rowText":"_1LXyO","textTransform":"_3kFQS","lightColor":"_3Ghgw","avatarClassName":"_2qO_X","tooltipText":"_151u_","tooltip":"_-LQNH","importModalBodyContainer":"_25xUk","dividerColor":"_2HZv9","w100":"_3vGmU","downloadTemplateContainer":"_3-Xu_","downloadTemplateDescContainer":"_tLw43","labelContainer":"_7TYUZ","downlTempHeader":"__CZpe","downlTempDescription":"_19jEe","downloadTemplateButton":"_1qXtq","fileUploaderContainer":"_1YVz2","colGap":"_3vnY5","deActivateModalContainer":"_28H9H","backdrop":"_1ky1x","errorText":"_26_if","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn"};
6928
6761
 
6929
6762
  var BulkUploadModal = function BulkUploadModal(props) {
6930
6763
  var isOpenImportUsersModal = props.isOpenImportUsersModal,
@@ -6993,7 +6826,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
6993
6826
  file: doc
6994
6827
  });
6995
6828
  });
6996
- var _temp = _forTo(docs, function (i) {
6829
+ var _temp2 = _forTo(docs, function (i) {
6997
6830
  return Promise.resolve(dispatch(uploadBulkUsersFile(docs[i]))).then(function (res) {
6998
6831
  return Promise.resolve(dispatch(validateUploadedFile(res.user_file_name)).then(function (validatedRes) {
6999
6832
  if (validatedRes.data.status) {
@@ -7033,7 +6866,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
7033
6866
  })).then(function () {});
7034
6867
  });
7035
6868
  });
7036
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
6869
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
7037
6870
  } catch (e) {
7038
6871
  return Promise.reject(e);
7039
6872
  }
@@ -7208,6 +7041,7 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
7208
7041
  setOpenImportUsersModal(false);
7209
7042
  handleImportPagenavigation(jobId);
7210
7043
  };
7044
+
7211
7045
  var handleDownloadRecords = function handleDownloadRecords(type) {
7212
7046
  try {
7213
7047
  setDownlStatus(true);
@@ -8233,6 +8067,7 @@ var DropdownBtn = function DropdownBtn(props) {
8233
8067
  if (val.disable) return false;
8234
8068
  if (val.handler && typeof val.handler === 'function') val.handler();
8235
8069
  };
8070
+
8236
8071
  var prevOpen = React__default.useRef(open);
8237
8072
  React__default.useEffect(function () {
8238
8073
  if (prevOpen.current === true && open === false) {
@@ -8347,10 +8182,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8347
8182
  selected = props.selected,
8348
8183
  _props$handleSingleCh = props.handleSingleCheckBoxClick,
8349
8184
  handleSingleCheckBoxClick = _props$handleSingleCh === void 0 ? function () {} : _props$handleSingleCh,
8350
- _props$onResetPasswor = props.onResetPasswordHandler,
8351
- onResetPasswordHandler = _props$onResetPasswor === void 0 ? function () {} : _props$onResetPasswor,
8352
- _props$toggleInviteMo = props.toggleInviteModal,
8353
- toggleInviteModal = _props$toggleInviteMo === void 0 ? function () {} : _props$toggleInviteMo,
8354
8185
  orderBy = props.orderBy,
8355
8186
  order = props.order,
8356
8187
  _props$onRequestSort = props.onRequestSort,
@@ -8368,21 +8199,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8368
8199
  searchValue = props.searchValue,
8369
8200
  _props$isILadmin = props.isILadmin,
8370
8201
  isILadmin = _props$isILadmin === void 0 ? false : _props$isILadmin;
8371
- var useStyles = styles$8.makeStyles(function (theme) {
8372
- return {
8373
- tooltip: {
8374
- background: '#1F2937',
8375
- fontSize: '14px',
8376
- color: '#ffffff',
8377
- padding: '12px 16px',
8378
- borderRadius: '6px'
8379
- },
8380
- arrow: {
8381
- color: '#1F2937'
8382
- }
8383
- };
8384
- });
8385
- var classes = useStyles();
8386
8202
  var columns = [{
8387
8203
  id: 'first_name',
8388
8204
  label: 'Name',
@@ -8402,27 +8218,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8402
8218
  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
8403
8219
  }));
8404
8220
  }
8405
- }, {
8406
- id: 'first_name',
8407
- label: '',
8408
- minWidth: 60,
8409
- sortable: false,
8410
- cell: function cell(row) {
8411
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8412
- component: "div",
8413
- width: 80
8414
- }, row && row.has_visited === 0 ? /*#__PURE__*/React__default.createElement(Tooltip, {
8415
- title: "This user hasn't logged in to the platform yet",
8416
- arrow: true,
8417
- classes: {
8418
- arrow: classes.arrow,
8419
- tooltip: classes.tooltip
8420
- },
8421
- placement: "top-start"
8422
- }, /*#__PURE__*/React__default.createElement("div", {
8423
- className: clsx(styles$5.tooltipTextDiv)
8424
- }, "Invited")) : null);
8425
- }
8426
8221
  }, {
8427
8222
  id: 'emp_info__department__name',
8428
8223
  label: 'Department',
@@ -8510,21 +8305,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8510
8305
  return onEditHandler(row.id);
8511
8306
  }
8512
8307
  }];
8513
- if (row && row.has_visited && row.is_active) {
8514
- options.push({
8515
- label: 'Reset password',
8516
- handler: function handler() {
8517
- return onResetPasswordHandler(row.email);
8518
- }
8519
- });
8520
- } else if (row && row.is_active) {
8521
- options.push({
8522
- label: 'Resend invite',
8523
- handler: function handler() {
8524
- return toggleInviteModal(row.id, 'single', row.first_name, row.last_name);
8525
- }
8526
- });
8527
- }
8528
8308
  if (isILadmin) {
8529
8309
  options.push({
8530
8310
  label: 'Make primary admin',
@@ -8548,7 +8328,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8548
8328
  endIcon: null,
8549
8329
  outlinedBtn: false,
8550
8330
  className: "threedotMenuBtn",
8551
- MoreHorizIcon: true,
8552
8331
  placement: "bottom-end"
8553
8332
  }));
8554
8333
  },
@@ -8556,6 +8335,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8556
8335
  paddingLeft: '40px'
8557
8336
  }
8558
8337
  }];
8338
+
8559
8339
  return /*#__PURE__*/React__default.createElement(iuistyles.IUITable, {
8560
8340
  searchPlaceholder: "Search by name, email & department",
8561
8341
  isCheckboxTable: true,
@@ -8578,8 +8358,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8578
8358
  isDataFetching: isDataFetching,
8579
8359
  disableRowCheckbox: disableRowCheckbox,
8580
8360
  searchBoxWidth: "400px",
8581
- searchValue: searchValue,
8582
- hideTopPagination: false
8361
+ searchValue: searchValue
8583
8362
  });
8584
8363
  };
8585
8364
  var SingupRequests = function SingupRequests(props) {
@@ -8610,18 +8389,20 @@ var SingupRequests = function SingupRequests(props) {
8610
8389
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
8611
8390
  return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
8612
8391
  };
8392
+
8613
8393
  var columns = [{
8614
- id: 'first_name',
8394
+ id: 'fname',
8615
8395
  label: 'Name',
8616
8396
  minWidth: 250,
8617
8397
  sortable: true,
8618
8398
  cell: function cell(row) {
8619
8399
  var _row$profile_pic2;
8620
8400
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
8621
- firstName: row.first_name,
8622
- lastName: row.last_name,
8623
- isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
8624
- primaryText: row.first_name + ' ' + row.last_name,
8401
+ firstName: row.fname,
8402
+ lastName: row.lname,
8403
+ isLetterAvatar:
8404
+ row.profile_pic && row.profile_pic.presigned_url ? false : true,
8405
+ primaryText: row.fname + ' ' + row.lname,
8625
8406
  secondaryText: row.email,
8626
8407
  letterAvatarTextColor: "black",
8627
8408
  letterAvatarBackgroundColor: "#d3d3d3",
@@ -8630,7 +8411,7 @@ var SingupRequests = function SingupRequests(props) {
8630
8411
  }));
8631
8412
  }
8632
8413
  }, {
8633
- id: 'created_at',
8414
+ id: 'created',
8634
8415
  label: 'Requested on',
8635
8416
  minWidth: 100,
8636
8417
  sortable: true,
@@ -8640,7 +8421,7 @@ var SingupRequests = function SingupRequests(props) {
8640
8421
  width: 100
8641
8422
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
8642
8423
  className: clsx(styles$5.rowText, styles$5.textTransform)
8643
- }, formatDate(row.created_at)));
8424
+ }, formatDate(row.created)));
8644
8425
  }
8645
8426
  }, {
8646
8427
  id: 'actions',
@@ -8694,89 +8475,11 @@ var SingupRequests = function SingupRequests(props) {
8694
8475
  });
8695
8476
  };
8696
8477
 
8697
- function InfoYellowIcon(props) {
8698
- return /*#__PURE__*/React__default.createElement("svg", {
8699
- width: props.width,
8700
- height: props.height,
8701
- viewBox: "0 0 20 20",
8702
- fill: "none",
8703
- xmlns: "http://www.w3.org/2000/svg"
8704
- }, /*#__PURE__*/React__default.createElement("path", {
8705
- 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",
8706
- fill: "#CA8A04"
8707
- }), /*#__PURE__*/React__default.createElement("path", {
8708
- 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",
8709
- fill: "#CA8A04"
8710
- }), /*#__PURE__*/React__default.createElement("path", {
8711
- 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",
8712
- fill: "#CA8A04"
8713
- }));
8714
- }
8715
-
8716
- function RedWarningIcon(props) {
8717
- var _props$color = props.color,
8718
- color = _props$color === void 0 ? '#E11D48' : _props$color,
8719
- _props$size = props.size,
8720
- size = _props$size === void 0 ? '14' : _props$size;
8721
- return /*#__PURE__*/React__default.createElement("svg", {
8722
- width: size,
8723
- height: size,
8724
- viewBox: "0 0 14 14",
8725
- fill: color,
8726
- xmlns: "http://www.w3.org/2000/svg"
8727
- }, /*#__PURE__*/React__default.createElement("path", {
8728
- 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",
8729
- fill: color
8730
- }));
8731
- }
8732
-
8733
- function InviteInfoIcon() {
8734
- return /*#__PURE__*/React__default.createElement("svg", {
8735
- xmlns: "http://www.w3.org/2000/svg",
8736
- width: "20",
8737
- height: "20",
8738
- fill: "none",
8739
- viewBox: "0 0 20 20"
8740
- }, /*#__PURE__*/React__default.createElement("path", {
8741
- fill: "#CA8A04",
8742
- 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"
8743
- }), /*#__PURE__*/React__default.createElement("path", {
8744
- fill: "#CA8A04",
8745
- 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"
8746
- }));
8747
- }
8748
-
8749
8478
  var IUIToastMessageService$7 = utils.services.IUIToastMessageService;
8750
- var env$7 = utils.configs.env,
8751
- api$7 = utils.configs.api;
8752
- var UndoButton = function UndoButton(_ref) {
8753
- var onUndo = _ref.onUndo,
8754
- msg = _ref.msg;
8755
- return /*#__PURE__*/React__default.createElement("div", {
8756
- style: {
8757
- display: 'flex',
8758
- flexDirection: 'row',
8759
- width: '270px',
8760
- justifyContent: 'space-between'
8761
- }
8762
- }, /*#__PURE__*/React__default.createElement("p", {
8763
- style: {
8764
- whiteSpace: 'nowrap',
8765
- paddingTop: '8px'
8766
- }
8767
- }, msg), /*#__PURE__*/React__default.createElement("p", {
8768
- onClick: onUndo,
8769
- style: {
8770
- whiteSpace: 'nowrap',
8771
- fontWeight: '600',
8772
- fontSize: '1rem',
8773
- padding: '8px 20px 0'
8774
- }
8775
- }, "UNDO"));
8776
- };
8777
- var UserList = function UserList(_ref2) {
8778
- var config = _ref2.config,
8779
- isProfile = _ref2.isProfile;
8479
+ var env$7 = utils.configs.env;
8480
+ var UserList = function UserList(_ref) {
8481
+ var config = _ref.config,
8482
+ isProfile = _ref.isProfile;
8780
8483
  env$7.init(config, isProfile);
8781
8484
  var history = reactRouterDom.useHistory();
8782
8485
  var _useSelector = reactRedux.useSelector(function (state) {
@@ -8786,49 +8489,27 @@ var UserList = function UserList(_ref2) {
8786
8489
  isDataFetching = _useSelector.isDataFetching,
8787
8490
  deactivatedUsers = _useSelector.deactivatedUsers,
8788
8491
  tabValue = _useSelector.tabValue;
8789
- var newSelecteds = userListInfo.results;
8790
- var _React$useState = React__default.useState(''),
8791
- deactivateUser = _React$useState[0],
8792
- setDeactivateUser = _React$useState[1];
8793
- var _React$useState2 = React__default.useState(null),
8794
- defaultId = _React$useState2[0],
8795
- setDefaultId = _React$useState2[1];
8796
- var _React$useState3 = React__default.useState(1),
8797
- page = _React$useState3[0],
8798
- setPage = _React$useState3[1];
8799
- var _useState = React.useState([]),
8800
- selectedUsersNotApprover = _useState[0],
8801
- setSelectedUsersNotApprover = _useState[1];
8802
- var _useState2 = React.useState([]),
8803
- selectedUsersApprover = _useState2[0],
8804
- setSelectedUsersApprover = _useState2[1];
8492
+ var _React$useState = React__default.useState(1),
8493
+ page = _React$useState[0],
8494
+ setPage = _React$useState[1];
8495
+ var _useState = React.useState(5),
8496
+ rowsPerPage = _useState[0],
8497
+ setRowsPerPage = _useState[1];
8498
+ var _React$useState2 = React__default.useState({}),
8499
+ selected = _React$useState2[0],
8500
+ setSelected = _React$useState2[1];
8501
+ var _React$useState3 = React__default.useState('asc'),
8502
+ order = _React$useState3[0],
8503
+ setOrder = _React$useState3[1];
8504
+ var _React$useState4 = React__default.useState('first_name'),
8505
+ orderBy = _React$useState4[0],
8506
+ setOrderBy = _React$useState4[1];
8507
+ var _useState2 = React.useState(''),
8508
+ searchValue = _useState2[0],
8509
+ setSearchValue = _useState2[1];
8805
8510
  var _useState3 = React.useState(false),
8806
- isBulkDeactivateModalOpen = _useState3[0],
8807
- setIsBulkDeactivateModalOpen = _useState3[1];
8808
- var _React$useState4 = React__default.useState(''),
8809
- user = _React$useState4[0],
8810
- setUser = _React$useState4[1];
8811
- var _useState4 = React.useState(10),
8812
- rowsPerPage = _useState4[0],
8813
- setRowsPerPage = _useState4[1];
8814
- var _React$useState5 = React__default.useState({}),
8815
- selected = _React$useState5[0],
8816
- setSelected = _React$useState5[1];
8817
- var _React$useState6 = React__default.useState('asc'),
8818
- order = _React$useState6[0],
8819
- setOrder = _React$useState6[1];
8820
- var _React$useState7 = React__default.useState(false),
8821
- deactivateSingle = _React$useState7[0],
8822
- setDeactivateSingle = _React$useState7[1];
8823
- var _React$useState8 = React__default.useState('first_name'),
8824
- orderBy = _React$useState8[0],
8825
- setOrderBy = _React$useState8[1];
8826
- var _useState5 = React.useState(''),
8827
- searchValue = _useState5[0],
8828
- setSearchValue = _useState5[1];
8829
- var _useState6 = React.useState(false),
8830
- isOpenDeActivateModal = _useState6[0],
8831
- setOpenDeActivateModalFlag = _useState6[1];
8511
+ isOpenDeActivateModal = _useState3[0],
8512
+ setOpenDeActivateModalFlag = _useState3[1];
8832
8513
  var _useSelector2 = reactRedux.useSelector(function (state) {
8833
8514
  return state.common;
8834
8515
  }),
@@ -8836,140 +8517,69 @@ var UserList = function UserList(_ref2) {
8836
8517
  hasVerificationError = _useSelector2.hasVerificationError,
8837
8518
  isILadmin = _useSelector2.isILadmin,
8838
8519
  companyName = _useSelector2.companyName;
8520
+ var _useState4 = React.useState(false),
8521
+ isOpenImportUsersModal = _useState4[0],
8522
+ setOpenImportUsersModal = _useState4[1];
8523
+ var _useState5 = React.useState(false),
8524
+ isFileDownloading = _useState5[0],
8525
+ setDownlStatus = _useState5[1];
8526
+ var _useState6 = React.useState(false),
8527
+ isSortingChange = _useState6[0],
8528
+ setSortingChange = _useState6[1];
8839
8529
  var _useState7 = React.useState(false),
8840
- isOpenImportUsersModal = _useState7[0],
8841
- setOpenImportUsersModal = _useState7[1];
8530
+ isSearchingChange = _useState7[0],
8531
+ setSearchingChange = _useState7[1];
8842
8532
  var _useState8 = React.useState(false),
8843
- approveeStatus = _useState8[0],
8844
- setApproveeStatus = _useState8[1];
8533
+ isSortingChangeTemp = _useState8[0],
8534
+ setSortingChangeTemp = _useState8[1];
8845
8535
  var _useState9 = React.useState(false),
8846
- isFileDownloading = _useState9[0],
8847
- setDownlStatus = _useState9[1];
8536
+ isSearchingChangeTemp = _useState9[0],
8537
+ setSearchingChangeTemp = _useState9[1];
8848
8538
  var _useState10 = React.useState(false),
8849
- isSortingChange = _useState10[0],
8850
- setSortingChange = _useState10[1];
8851
- var _useState11 = React.useState(false),
8852
- isSearchingChange = _useState11[0],
8853
- setSearchingChange = _useState11[1];
8854
- var _useState12 = React.useState(false),
8855
- isSortingChangeTemp = _useState12[0],
8856
- setSortingChangeTemp = _useState12[1];
8539
+ isApiFetching = _useState10[0],
8540
+ setisApiFetching = _useState10[1];
8541
+
8542
+ var _React$useState5 = React__default.useState(1),
8543
+ signup_page = _React$useState5[0],
8544
+ setSignUpPage = _React$useState5[1];
8545
+ var _useState11 = React.useState(5),
8546
+ signup_rowsPerPage = _useState11[0],
8547
+ setSignUpRowsPerPage = _useState11[1];
8548
+ var _React$useState6 = React__default.useState('asc'),
8549
+ signup_order = _React$useState6[0],
8550
+ setSignUpOrder = _React$useState6[1];
8551
+ var _React$useState7 = React__default.useState('fname'),
8552
+ signup_orderBy = _React$useState7[0],
8553
+ setSignUpOrderBy = _React$useState7[1];
8554
+ var _useState12 = React.useState(''),
8555
+ signup_searchValue = _useState12[0],
8556
+ set_signup_SearchValue = _useState12[1];
8857
8557
  var _useState13 = React.useState(false),
8858
- isSearchingChangeTemp = _useState13[0],
8859
- setSearchingChangeTemp = _useState13[1];
8558
+ isSignUpSortingChange = _useState13[0],
8559
+ setSignUpSortingChange = _useState13[1];
8860
8560
  var _useState14 = React.useState(false),
8861
- isApiFetching = _useState14[0],
8862
- setisApiFetching = _useState14[1];
8863
- var _useState15 = React.useState({
8864
- value: '',
8865
- label: 'Select approver'
8866
- }),
8867
- approverRole = _useState15[0],
8868
- setApproverRole = _useState15[1];
8561
+ isSignUpSearchingChange = _useState14[0],
8562
+ setSignUpSearchingChange = _useState14[1];
8563
+ var _useState15 = React.useState(false),
8564
+ isSignUpSortingChangeTemp = _useState15[0],
8565
+ setSignUpSortingChangeTemp = _useState15[1];
8869
8566
  var _useState16 = React.useState(false),
8870
- showInviteModal = _useState16[0],
8871
- setToggleInviteModal = _useState16[1];
8872
- var _useState17 = React.useState(''),
8873
- userIds = _useState17[0],
8874
- setUserIds = _useState17[1];
8875
- var _React$useState9 = React__default.useState(false),
8876
- overlayMenu = _React$useState9[0],
8877
- setOverlayMenu = _React$useState9[1];
8878
- var _useState18 = React.useState(''),
8879
- userFirstName = _useState18[0],
8880
- setUserFirstName = _useState18[1];
8881
- var _useState19 = React.useState(''),
8882
- userLastName = _useState19[0],
8883
- setUserLastName = _useState19[1];
8884
- var _useState20 = React.useState(true),
8885
- isDisabledSubmitBtn = _useState20[0],
8886
- setIsDisabledSubmitBtn = _useState20[1];
8887
- useScrollPosition.useScrollPosition(function (_ref3) {
8888
- var prevPos = _ref3.prevPos,
8889
- currPos = _ref3.currPos;
8890
- if (prevPos.y - currPos.y > 0) {
8891
- if (currPos.y <= -275) {
8892
- setOverlayMenu(true);
8893
- }
8894
- } else {
8895
- if (currPos.y > -295) {
8896
- setOverlayMenu(false);
8897
- }
8898
- }
8899
- }, [overlayMenu]);
8900
- var scrollTo = function scrollTo(id) {
8901
- var el = document.getElementById(id);
8902
- window.scrollTo({
8903
- top: el.offsetTop,
8904
- behavior: 'smooth'
8905
- });
8906
- };
8907
- var _React$useState10 = React__default.useState(1),
8908
- signup_page = _React$useState10[0],
8909
- setSignUpPage = _React$useState10[1];
8910
- var _useState21 = React.useState(5),
8911
- signup_rowsPerPage = _useState21[0],
8912
- setSignUpRowsPerPage = _useState21[1];
8913
- var _React$useState11 = React__default.useState('asc'),
8914
- signup_order = _React$useState11[0],
8915
- setSignUpOrder = _React$useState11[1];
8916
- var _React$useState12 = React__default.useState('first_name'),
8917
- signup_orderBy = _React$useState12[0],
8918
- setSignUpOrderBy = _React$useState12[1];
8919
- var _useState22 = React.useState(''),
8920
- signup_searchValue = _useState22[0],
8921
- set_signup_SearchValue = _useState22[1];
8922
- var _useState23 = React.useState(false),
8923
- isSignUpSortingChange = _useState23[0],
8924
- setSignUpSortingChange = _useState23[1];
8925
- var _useState24 = React.useState(false),
8926
- isSignUpSearchingChange = _useState24[0],
8927
- setSignUpSearchingChange = _useState24[1];
8928
- var _useState25 = React.useState(false),
8929
- isSignUpSortingChangeTemp = _useState25[0],
8930
- setSignUpSortingChangeTemp = _useState25[1];
8931
- var _useState26 = React.useState(false),
8932
- isSignUpSearchingChangeTemp = _useState26[0],
8933
- setSignUpSearchingChangeTemp = _useState26[1];
8567
+ isSignUpSearchingChangeTemp = _useState16[0],
8568
+ setSignUpSearchingChangeTemp = _useState16[1];
8934
8569
  var _useSelector3 = reactRedux.useSelector(function (state) {
8935
8570
  return state.userList;
8936
8571
  }),
8937
8572
  signupRequestListInfo = _useSelector3.signupRequestListInfo;
8938
- var redirectToNotifications = function redirectToNotifications() {
8939
- if (config.routes.notification) {
8940
- history.push({
8941
- pathname: config.routes.notification.path
8942
- });
8943
- }
8944
- };
8945
8573
  var openDeactivateModal = function openDeactivateModal() {
8946
8574
  if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
8947
8575
  IUIToastMessageService$7.warningNotify('Select at least one user to deactivate.');
8948
8576
  return false;
8949
8577
  }
8950
- if (selectedUsersApprover.length) {
8951
- var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
8952
- var _SelectedUsersApprover = [].concat(selectedUsersApprover);
8953
- var _selected = Object.values(selected).flat();
8954
- _SelectedUsersNotApprover = _SelectedUsersNotApprover.filter(function (item) {
8955
- return _selected.includes(item.id.toString());
8956
- });
8957
- _SelectedUsersApprover = _SelectedUsersApprover.filter(function (item) {
8958
- return _selected.includes(item.id.toString());
8959
- });
8960
- setSelectedUsersNotApprover(_SelectedUsersNotApprover);
8961
- setSelectedUsersApprover(_SelectedUsersApprover);
8962
- setIsBulkDeactivateModalOpen(true);
8963
- } else {
8964
- setOpenDeActivateModalFlag(true);
8965
- }
8578
+ setOpenDeActivateModalFlag(true);
8966
8579
  };
8967
8580
  var closeDeActivateModal = function closeDeActivateModal() {
8968
8581
  setOpenDeActivateModalFlag(false);
8969
8582
  };
8970
- var closeDeActiveModal = function closeDeActiveModal() {
8971
- setIsBulkDeactivateModalOpen(false);
8972
- };
8973
8583
  var handleAddPageNavigation = function handleAddPageNavigation() {
8974
8584
  history.push(config.routes.users.add.path);
8975
8585
  };
@@ -8982,32 +8592,50 @@ var UserList = function UserList(_ref2) {
8982
8592
  var handleVerifyUserClick = function handleVerifyUserClick(userId) {
8983
8593
  history.push(config.routes.users.add.path + "?" + config.routes.users.add.queryParamKeys.verifyUserId + "=" + userId);
8984
8594
  };
8985
- var handleRejectUserClick = function handleRejectUserClick(userId) {
8986
- IUIToastMessageService$7.undoNotify( /*#__PURE__*/React__default.createElement(UndoButton, {
8987
- onUndo: function onUndo() {
8988
- return IUIToastMessageService$7.setUndoClicked(true);
8595
+ var UndoButton = function UndoButton(_ref2) {
8596
+ var msg = _ref2.msg,
8597
+ id = _ref2.id;
8598
+ return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8599
+ display: "flex",
8600
+ flexDirection: "row",
8601
+ width: "270px"
8602
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
8603
+ style: {
8604
+ whiteSpace: 'nowrap',
8605
+ paddingTop: '8px'
8606
+ }
8607
+ }, msg), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
8608
+ type: "text",
8609
+ buttonText: "UNDO",
8610
+ style: {
8611
+ color: '#FFFFFF'
8989
8612
  },
8990
- msg: "Sign-up request rejected"
8991
- }), function (res) {
8992
- if (res === false) {
8993
- dispatch(rejectUserVerification(userId)).then(function (res) {
8994
- if (res.status === true) {
8995
- dispatch(showDataFetchingStatus());
8996
- dispatch(fetchUserSignupRequests({
8997
- ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8998
- length: signup_rowsPerPage,
8999
- page: signup_page,
9000
- search: signup_searchValue.trim(),
9001
- pagename: 'company'
9002
- })).then(function () {
9003
- return dispatch(stopDataFetchingStatus());
9004
- });
9005
- }
9006
- })["catch"](function (err) {
9007
- console.log(err);
8613
+ onClick: function onClick() {
8614
+ return dispatch(undoneSignUpRejection(id));
8615
+ }
8616
+ }));
8617
+ };
8618
+ var handleRejectUserClick = function handleRejectUserClick(userId) {
8619
+ dispatch(rejectUserVerification(userId)).then(function (res) {
8620
+ var _res$data;
8621
+ console.log(res);
8622
+ IUIToastMessageService$7.undoNotify( /*#__PURE__*/React__default.createElement(UndoButton, {
8623
+ msg: (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.message) || 'Sign-up request rejected',
8624
+ id: userId
8625
+ }));
8626
+ if (res.status === true) {
8627
+ dispatch(showDataFetchingStatus());
8628
+ dispatch(fetchUserSignupRequests({
8629
+ ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8630
+ length: signup_rowsPerPage,
8631
+ page: signup_page,
8632
+ search: signup_searchValue.trim()
8633
+ })).then(function () {
8634
+ return dispatch(stopDataFetchingStatus());
9008
8635
  });
9009
8636
  }
9010
- IUIToastMessageService$7.setUndoClicked(false);
8637
+ })["catch"](function (err) {
8638
+ console.log(err);
9011
8639
  });
9012
8640
  };
9013
8641
  var handleBulkActionHistoryClick = function handleBulkActionHistoryClick() {
@@ -9020,25 +8648,12 @@ var UserList = function UserList(_ref2) {
9020
8648
  };
9021
8649
  var deselectingCheckboxHandler = function deselectingCheckboxHandler(page) {
9022
8650
  var _extends2;
9023
- var selectedId = [];
9024
- var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9025
- var _selectedUsersApprover = [].concat(selectedUsersApprover);
9026
- var _newSelecteds = newSelecteds.filter(function (n) {
8651
+ var newSelecteds = userListInfo.results.filter(function (n) {
9027
8652
  return n.is_active;
8653
+ }).map(function (obj) {
8654
+ return obj.id.toString();
9028
8655
  });
9029
- _newSelecteds.map(function (obj) {
9030
- if (selected && !Object.values(selected).flat().includes(obj.id.toString())) {
9031
- if (obj.roles.is_approver === true) {
9032
- _selectedUsersApprover.push(obj);
9033
- } else if (obj.roles.is_approver === false) {
9034
- _selectedUsersNotApprover.push(obj);
9035
- }
9036
- }
9037
- selectedId.push(obj.id.toString());
9038
- });
9039
- setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = selectedId, _extends2)));
9040
- setSelectedUsersNotApprover(_selectedUsersNotApprover);
9041
- setSelectedUsersApprover(_selectedUsersApprover);
8656
+ setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = newSelecteds, _extends2)));
9042
8657
  };
9043
8658
  var handleSelectAllClick = function handleSelectAllClick(event, page) {
9044
8659
  var _extends3;
@@ -9056,156 +8671,58 @@ var UserList = function UserList(_ref2) {
9056
8671
  setSortingChangeTemp(!isSortingChangeTemp);
9057
8672
  };
9058
8673
  var onSearchHandler = function onSearchHandler(value) {
9059
- setPage(1);
9060
8674
  setSearchValue(value);
9061
8675
  setSearchingChange(true);
9062
8676
  setSearchingChangeTemp(!isSearchingChangeTemp);
9063
8677
  };
9064
8678
  var onSignUpReqeustSearchHandler = function onSignUpReqeustSearchHandler(value) {
9065
- setPage(1);
9066
8679
  set_signup_SearchValue(value);
9067
8680
  setSignUpSearchingChange(true);
9068
8681
  setSignUpSearchingChangeTemp(!isSignUpSearchingChangeTemp);
9069
8682
  };
9070
- var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page, data) {
8683
+ var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page) {
9071
8684
  var _extends4;
9072
8685
  var selectedTemp = _extends({}, selected);
9073
8686
  if (!(page in selectedTemp)) {
9074
8687
  selectedTemp[page] = [];
9075
8688
  }
9076
8689
  var selectedIndex = selectedTemp[page].indexOf(id);
9077
- var _newSelected = [];
8690
+ var newSelected = [];
9078
8691
  if (selectedIndex === -1) {
9079
- _newSelected = _newSelected.concat(selectedTemp[page], id);
8692
+ newSelected = newSelected.concat(selectedTemp[page], id);
9080
8693
  } else if (selectedIndex === 0) {
9081
- _newSelected = _newSelected.concat(selectedTemp[page].slice(1));
8694
+ newSelected = newSelected.concat(selectedTemp[page].slice(1));
9082
8695
  } else if (selectedIndex === selectedTemp[page].length - 1) {
9083
- _newSelected = _newSelected.concat(selectedTemp[page].slice(0, -1));
8696
+ newSelected = newSelected.concat(selectedTemp[page].slice(0, -1));
9084
8697
  } else if (selectedIndex > 0) {
9085
- _newSelected = _newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
8698
+ newSelected = newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
9086
8699
  }
9087
- var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9088
- var _SelectedUsersApprover = [].concat(selectedUsersApprover);
9089
- if (Object.values(selected).flat().includes(id.toString())) {
9090
- _SelectedUsersNotApprover = selectedUsersNotApprover.filter(function (item) {
9091
- return id !== item.id.toString();
9092
- });
9093
- _SelectedUsersApprover = selectedUsersApprover.filter(function (item) {
9094
- return item.id.toString() !== id;
9095
- });
9096
- } else if (data !== null && data !== void 0 && data.roles) {
9097
- if (data.roles.is_approver === true) {
9098
- _SelectedUsersApprover.push(data);
9099
- } else if (data.roles.is_approver === false) {
9100
- _SelectedUsersNotApprover.push(data);
9101
- }
9102
- }
9103
- setSelectedUsersNotApprover(_SelectedUsersNotApprover);
9104
- setSelectedUsersApprover(_SelectedUsersApprover);
9105
- setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = _newSelected, _extends4)));
8700
+ setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = newSelected, _extends4)));
9106
8701
  };
9107
- React.useEffect(function () {
9108
- setApproverRole({
9109
- value: '',
9110
- label: 'Select approver'
9111
- });
9112
- setDefaultId(null);
9113
- setIsDisabledSubmitBtn(true);
9114
- setApproveeStatus(false);
9115
- if (deactivateSingle === true) {
9116
- api$7.get(userAddEditUrl.transferAppover() + "user_id=" + user.id + "&page=1").then(function (response) {
9117
- if (response.data["default"].id) {
9118
- setDefaultId(response.data["default"].id);
9119
- setApproverRole({
9120
- value: '',
9121
- label: response.data["default"].email
9122
- });
9123
- setIsDisabledSubmitBtn(false);
9124
- setApproveeStatus(response.data["default"].approvee_status);
9125
- }
9126
- });
9127
- }
9128
- }, [deactivateSingle]);
9129
8702
  var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
9130
8703
  setRowsPerPage(+event.target.value);
9131
8704
  setPage(1);
9132
8705
  setSelected({});
9133
- setSelectedUsersNotApprover([]);
9134
- setSelectedUsersApprover([]);
9135
8706
  setSortingChange(true);
9136
8707
  setSortingChangeTemp(!isSortingChangeTemp);
9137
8708
  };
9138
8709
  var handleActiveUser = function handleActiveUser(e, id, page) {
9139
8710
  var isActive = e.target.checked;
9140
- var _isApprover;
9141
- newSelecteds.map(function (item) {
9142
- if (item.id === id) {
9143
- _isApprover = item.roles.is_approver;
9144
- if (_isApprover === true && isActive === false) {
9145
- setDeactivateSingle(true);
9146
- setDeactivateUser(item.first_name + ' ' + item.last_name);
9147
- setUser(item);
9148
- } else {
9149
- dispatch(updateActiveStatus(e.target.checked ? 1 : 0, e.target.id, _isApprover)).then(function () {
9150
- if (!isActive) {
9151
- if (Object.values(selected).flat().includes(id.toString())) {
9152
- var _extends5;
9153
- var selectedTemp = _extends({}, selected);
9154
- var _selectedUsersApprover = [].concat(selectedUsersApprover);
9155
- var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9156
- selectedTemp[page].splice(selectedTemp[page].indexOf(id.toString()), 1);
9157
- _selectedUsersApprover = _selectedUsersApprover.filter(function (item) {
9158
- return item.id != id;
9159
- });
9160
- _selectedUsersNotApprover = _selectedUsersNotApprover.filter(function (item) {
9161
- return item.id != id;
9162
- });
9163
- setSelected(_extends({}, selected, (_extends5 = {}, _extends5[page] = selectedTemp[page], _extends5)));
9164
- setSelectedUsersApprover(_selectedUsersApprover);
9165
- setSelectedUsersNotApprover(_selectedUsersNotApprover);
9166
- }
9167
- }
9168
- });
8711
+ dispatch(updateActiveStatus(e.target.checked ? 1 : 0, e.target.id)).then(function () {
8712
+ if (!isActive) {
8713
+ if (Object.values(selected).flat().includes(id.toString())) {
8714
+ var _extends5;
8715
+ var selectedTemp = _extends({}, selected);
8716
+ selectedTemp[page].splice(selectedTemp[page].indexOf(id.toString()), 1);
8717
+ setSelected(_extends({}, selected, (_extends5 = {}, _extends5[page] = selectedTemp[page], _extends5)));
9169
8718
  }
9170
8719
  }
9171
8720
  });
9172
8721
  };
9173
- var selectApprover = function selectApprover(_ref4) {
9174
- var _value = _ref4._value;
9175
- if (_value.data.approvee_status) {
9176
- setApproveeStatus(true);
9177
- } else {
9178
- setApproveeStatus(false);
9179
- }
9180
- setDefaultId(_value.data.id);
9181
- setApproverRole(_value);
9182
- setIsDisabledSubmitBtn(false);
9183
- };
9184
- var handleDeactivateUser = function handleDeactivateUser() {
9185
- dispatch(updateActiveStatus(0, user.id, user.roles.is_approver, defaultId));
9186
- setOpenDeActivateModalFlag(false);
9187
- setDeactivateSingle(false);
9188
- setSelected({});
9189
- setSelectedUsersNotApprover([]);
9190
- setSelectedUsersApprover([]);
9191
- };
9192
8722
  var handleDeactivateUsers = function handleDeactivateUsers() {
9193
8723
  dispatch(deActivateUsers(Object.values(selected).flat()));
9194
8724
  setOpenDeActivateModalFlag(false);
9195
8725
  setSelected({});
9196
- setSelectedUsersNotApprover([]);
9197
- setSelectedUsersApprover([]);
9198
- setIsBulkDeactivateModalOpen(false);
9199
- };
9200
- var handleDeactivateSafeUsers = function handleDeactivateSafeUsers() {
9201
- var _selectedUsersNotApprover = selectedUsersNotApprover.map(function (item) {
9202
- return item.id;
9203
- });
9204
- dispatch(deActivateUsers(_selectedUsersNotApprover));
9205
- setIsBulkDeactivateModalOpen(false);
9206
- setSelected({});
9207
- setSelectedUsersNotApprover([]);
9208
- setSelectedUsersApprover([]);
9209
8726
  };
9210
8727
  var importUserHandler = function importUserHandler() {
9211
8728
  setOpenImportUsersModal(true);
@@ -9217,43 +8734,6 @@ var UserList = function UserList(_ref2) {
9217
8734
  setOpenImportUsersModal(false);
9218
8735
  handleImportPagenavigation(jobId);
9219
8736
  };
9220
- var onResetPasswordHandler = function onResetPasswordHandler(email) {
9221
- dispatch(resetPasswordForUser({
9222
- email: email
9223
- }));
9224
- };
9225
- var toggleInviteModal = function toggleInviteModal(ids, type, firstName, lastName) {
9226
- if (type === undefined) {
9227
- if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
9228
- IUIToastMessageService$7.warningNotify('Select at least one user to invite.');
9229
- return false;
9230
- }
9231
- }
9232
- setUserIds(ids);
9233
- setUserFirstName(firstName);
9234
- setUserLastName(lastName);
9235
- setToggleInviteModal(!showInviteModal);
9236
- };
9237
- var toggleInviteModalClose = function toggleInviteModalClose() {
9238
- setToggleInviteModal(!showInviteModal);
9239
- };
9240
- var onResendInviteHandler = function onResendInviteHandler() {
9241
- var userIdArr = [];
9242
- if (userIds && !isNaN(userIds)) {
9243
- userIdArr = [userIds];
9244
- } else if (Object.keys(selected).length) {
9245
- Object.values(selected).map(function (val, i) {
9246
- if (val.length) {
9247
- val.map(function (idx, i) {
9248
- userIdArr.push(idx);
9249
- });
9250
- }
9251
- });
9252
- }
9253
- setUserIds('');
9254
- dispatch(resendInviteForUser(userIdArr));
9255
- setToggleInviteModal(!showInviteModal);
9256
- };
9257
8737
  var handleExportUsers = function handleExportUsers() {
9258
8738
  try {
9259
8739
  setDownlStatus(true);
@@ -9293,9 +8773,6 @@ var UserList = function UserList(_ref2) {
9293
8773
  }, {
9294
8774
  label: 'Bulk action history',
9295
8775
  handler: handleBulkActionHistoryClick
9296
- }, {
9297
- label: 'Resend invite',
9298
- handler: toggleInviteModal
9299
8776
  }];
9300
8777
  React.useEffect(function () {
9301
8778
  var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
@@ -9307,9 +8784,6 @@ var UserList = function UserList(_ref2) {
9307
8784
  userId: userId
9308
8785
  }));
9309
8786
  };
9310
- var knowMore = function knowMore() {
9311
- window.open('https://itilite.notion.site/All-about-deactivating-users-77554de1fb494832ac7e344ca14277f0', '_blank');
9312
- };
9313
8787
  var dispatch = reactRedux.useDispatch();
9314
8788
  React.useEffect(function () {
9315
8789
  if (isTokenVerified === true) {
@@ -9323,7 +8797,6 @@ var UserList = function UserList(_ref2) {
9323
8797
  dispatch(fetchUsersList(url)).then(function () {
9324
8798
  setSearchingChange(false);
9325
8799
  setisApiFetching(false);
9326
- scrollTo('table-root');
9327
8800
  });
9328
8801
  }, 1000);
9329
8802
  return function () {
@@ -9337,8 +8810,7 @@ var UserList = function UserList(_ref2) {
9337
8810
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9338
8811
  length: signup_rowsPerPage,
9339
8812
  page: signup_page,
9340
- search: signup_searchValue.trim(),
9341
- pagename: 'company'
8813
+ search: signup_searchValue.trim()
9342
8814
  })).then(function () {
9343
8815
  setSignUpSearchingChange(false);
9344
8816
  setisApiFetching(false);
@@ -9350,7 +8822,6 @@ var UserList = function UserList(_ref2) {
9350
8822
  }
9351
8823
  if (isSortingChange) {
9352
8824
  setisApiFetching(true);
9353
- scrollTo('table-root');
9354
8825
  dispatch(fetchUsersList(url)).then(function () {
9355
8826
  setisApiFetching(false);
9356
8827
  setSortingChange(false);
@@ -9365,8 +8836,7 @@ var UserList = function UserList(_ref2) {
9365
8836
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9366
8837
  length: signup_rowsPerPage,
9367
8838
  page: signup_page,
9368
- search: signup_searchValue.trim(),
9369
- pagename: 'company'
8839
+ search: signup_searchValue.trim()
9370
8840
  })).then(function () {
9371
8841
  setisApiFetching(false);
9372
8842
  setSignUpSortingChange(false);
@@ -9382,8 +8852,7 @@ var UserList = function UserList(_ref2) {
9382
8852
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9383
8853
  length: signup_rowsPerPage,
9384
8854
  page: signup_page,
9385
- search: signup_searchValue.trim(),
9386
- pagename: 'company'
8855
+ search: signup_searchValue.trim()
9387
8856
  })).then(function () {
9388
8857
  return dispatch(stopDataFetchingStatus());
9389
8858
  });
@@ -9391,89 +8860,15 @@ var UserList = function UserList(_ref2) {
9391
8860
  }
9392
8861
  }
9393
8862
  }, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
9394
- var topRightButtons = function topRightButtons() {
9395
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9396
- component: "div",
9397
- className: styles$5.buttonWrapper,
9398
- display: "flex",
9399
- justifyContent: "space-between",
9400
- alignItems: "center",
9401
- alignSelf: "flex-start"
9402
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9403
- component: "div",
9404
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9405
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9406
- buttonText: "Export all users",
9407
- type: "outlined",
9408
- startIcon: /*#__PURE__*/React__default.createElement(BulkDownloadIcon, {
9409
- width: "22",
9410
- height: "22"
9411
- }),
9412
- onClick: handleExportUsers
9413
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9414
- component: "div",
9415
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9416
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIDropdownButton, {
9417
- buttonText: "Bulk actions",
9418
- type: "outlined",
9419
- menuListInfo: BulkUploadInfo
9420
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9421
- component: "div",
9422
- className: "pageHeader--button-single button-right"
9423
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9424
- buttonText: "Add user",
9425
- type: "contained",
9426
- startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
9427
- width: "9",
9428
- height: "9",
9429
- color: "white"
9430
- }),
9431
- onClick: handleAddPageNavigation
9432
- })));
9433
- };
9434
8863
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9435
8864
  component: "div",
9436
8865
  className: styles$5.UUIUserManagementList
9437
- }, overlayMenu ? /*#__PURE__*/React__default.createElement(core.Box, {
9438
- className: styles$5.scrollOverlayMenu
9439
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9440
- component: "div",
9441
- className: clsx(styles$5.pageHeader)
9442
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9443
- component: "div",
9444
- display: "flex",
9445
- justifyContent: "space-between",
9446
- alignItems: "center",
9447
- flexWrap: "wrap",
9448
- style: {
9449
- gap: '1rem'
9450
- }
9451
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9452
- component: "div",
9453
- display: "flex",
9454
- flexDirection: "column",
9455
- style: {
9456
- gap: '0.5rem'
9457
- }
9458
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUISearch, {
9459
- placeholder: "Search by name, email & department",
9460
- value: searchValue,
9461
- onChangeHandler: function onChangeHandler(e) {
9462
- return onSearchHandler(e.target.value);
9463
- },
9464
- className: styles$5.overlaysearch
9465
- })), topRightButtons()), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9466
- component: "div",
9467
- display: "flex",
9468
- justifyContent: "space-between",
9469
- alignItems: "center"
9470
- }))) : '', !hasVerificationError ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBackdrop, {
8866
+ }, !hasVerificationError ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBackdrop, {
9471
8867
  open: isFileDownloading || isApiFetching,
9472
8868
  className: styles$5.backdrop
9473
8869
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUICircularProgress, {
9474
8870
  color: "inherit"
9475
8871
  })), isDataFetching ? /*#__PURE__*/React__default.createElement(SkeletonLoader, null) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9476
- id: "table-root",
9477
8872
  component: "div",
9478
8873
  className: clsx(styles$5.pageHeader)
9479
8874
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
@@ -9498,7 +8893,44 @@ var UserList = function UserList(_ref2) {
9498
8893
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9499
8894
  variant: "h3",
9500
8895
  className: clsx(styles$5.heading, styles$5.headingLarge)
9501
- }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), topRightButtons()), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8896
+ }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8897
+ component: "div",
8898
+ className: styles$5.buttonWrapper,
8899
+ display: "flex",
8900
+ justifyContent: "space-between",
8901
+ alignItems: "center",
8902
+ alignSelf: "flex-start"
8903
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8904
+ component: "div",
8905
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
8906
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
8907
+ buttonText: "Export all users",
8908
+ type: "outlined",
8909
+ startIcon: /*#__PURE__*/React__default.createElement(BulkDownloadIcon, {
8910
+ width: "22",
8911
+ height: "22"
8912
+ }),
8913
+ onClick: handleExportUsers
8914
+ })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8915
+ component: "div",
8916
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
8917
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIDropdownButton, {
8918
+ buttonText: "Bulk actions",
8919
+ type: "outlined",
8920
+ menuListInfo: BulkUploadInfo
8921
+ })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8922
+ component: "div",
8923
+ className: "pageHeader--button-single button-right"
8924
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
8925
+ buttonText: "Add user",
8926
+ type: "contained",
8927
+ startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
8928
+ width: "9",
8929
+ height: "9",
8930
+ color: "white"
8931
+ }),
8932
+ onClick: handleAddPageNavigation
8933
+ })))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9502
8934
  component: "div",
9503
8935
  display: "flex",
9504
8936
  justifyContent: "space-between",
@@ -9543,9 +8975,7 @@ var UserList = function UserList(_ref2) {
9543
8975
  disableRowCheckbox: deactivatedUsers,
9544
8976
  searchValue: searchValue,
9545
8977
  isILadmin: isILadmin,
9546
- onPrimaryAdminHandler: onPrimaryAdminHandler,
9547
- onResetPasswordHandler: onResetPasswordHandler,
9548
- toggleInviteModal: toggleInviteModal
8978
+ onPrimaryAdminHandler: onPrimaryAdminHandler
9549
8979
  }))
9550
8980
  }, {
9551
8981
  label: /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, "Sign-up requests", ' ', /*#__PURE__*/React__default.createElement(TabLabelCount, {
@@ -9561,10 +8991,7 @@ var UserList = function UserList(_ref2) {
9561
8991
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9562
8992
  variant: "body2",
9563
8993
  className: clsx(styles$5.description)
9564
- }, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in", ' ', /*#__PURE__*/React__default.createElement("span", {
9565
- onClick: redirectToNotifications,
9566
- className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
9567
- }, "Notifications"))), /*#__PURE__*/React__default.createElement(SingupRequests, {
8994
+ }, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in Notifications.")), /*#__PURE__*/React__default.createElement(SingupRequests, {
9568
8995
  data: signupRequestListInfo,
9569
8996
  handleChangeRowsPerPage: function handleChangeRowsPerPage(event) {
9570
8997
  setSignUpRowsPerPage(+event.target.value);
@@ -9596,54 +9023,6 @@ var UserList = function UserList(_ref2) {
9596
9023
  }))
9597
9024
  }]
9598
9025
  }))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9599
- isOpen: deactivateSingle,
9600
- closeHandler: function closeHandler() {
9601
- setDeactivateSingle(false);
9602
- },
9603
- cancelLabel: "Cancel",
9604
- submitLabel: "Deactivate",
9605
- submitHandler: handleDeactivateUser,
9606
- headerText: "Deactivate this user?",
9607
- width: "400px",
9608
- subHanderText: "",
9609
- submitBtnClass: styles$5.deactivateBtn,
9610
- isDisabledSubmitBtn: isDisabledSubmitBtn,
9611
- modalClass: "deactivateSingleModal",
9612
- modalBodyStyle: {
9613
- overflowY: 'unset'
9614
- }
9615
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9616
- className: clsx(styles$5.deactivateSingle, 'iui__mb-16')
9617
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9618
- className: styles$5.deactivateAlert
9619
- }, /*#__PURE__*/React__default.createElement(InfoYellowIcon, {
9620
- width: "9",
9621
- height: "9"
9622
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9623
- variant: "body2"
9624
- }, /*#__PURE__*/React__default.createElement("b", null, deactivateUser), " is linked with following role. You can deactivate only once you transfer the role to another user. The changes will reflect subsequently.", ' ', /*#__PURE__*/React__default.createElement("span", {
9625
- onClick: knowMore,
9626
- className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
9627
- }, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9628
- className: "iui__mt-15"
9629
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
9630
- isMove: true,
9631
- additional: {
9632
- page: 1,
9633
- product: 'travel',
9634
- userId: user.id
9635
- },
9636
- label: "Transfer approver role to",
9637
- value: approverRole,
9638
- onValueChange: selectApprover,
9639
- loadOption: transferRoleOptions,
9640
- disableText: "Please get in touch with your administrator to change this value.",
9641
- customLoadingText: "No results found"
9642
- }), approveeStatus && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9643
- className: "iui__d-flex iui__align-items-baseline iui__mr-5"
9644
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(RedWarningIcon, null)), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9645
- className: "iui__font--para-normal iui__font--color-black500 iui__mt-5 iui__ml-5"
9646
- }, "The user you're deactivating is the approver of the user you're transferring the role to. If you continue, this user will become a self-approver"))))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9647
9026
  isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
9648
9027
  closeHandler: closeDeActivateModal,
9649
9028
  cancelLabel: "Cancel",
@@ -9669,124 +9048,7 @@ var UserList = function UserList(_ref2) {
9669
9048
  className: styles$5.headerText
9670
9049
  }, 'Are you sure you want to deactivate ' + Object.values(selected).flat().length.toString() + (Object.values(selected).flat().length === 1 ? ' user ?' : ' users ?')), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9671
9050
  className: styles$5.description
9672
- }, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9673
- isOpen: isBulkDeactivateModalOpen,
9674
- closeHandler: closeDeActiveModal,
9675
- cancelLabel: "Cancel",
9676
- submitLabel: "Deactivate safe users",
9677
- isDisabledSubmitBtn: !((selectedUsersNotApprover === null || selectedUsersNotApprover === void 0 ? void 0 : selectedUsersNotApprover.length) > 0),
9678
- submitBtnClass: clsx(styles$5.deactivateSubmitBtn),
9679
- customButtonLabel: "Deactivate all users",
9680
- customButtonHandler: handleDeactivateUsers,
9681
- submitHandler: handleDeactivateSafeUsers,
9682
- width: "640px",
9683
- customButtonClass: clsx(styles$5.deactivateCustomButtonClass),
9684
- headerText: "Deactivate users?",
9685
- modalBodyStyle: {
9686
- maxHeight: 'calc(100vh - 50vh)'
9687
- }
9688
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9689
- className: clsx(styles$5.deactivateAlert, styles$5.warningSvg)
9690
- }, /*#__PURE__*/React__default.createElement(RedWarningIcon, {
9691
- color: "#9A6700",
9692
- size: "14"
9693
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9694
- variant: "body2"
9695
- }, "Some users are linked with approval roles. Deactivating these users will result in missing roles and approvers. Deactivate these users individually and transfer their roles to avoid missing roles. The changes will reflect subsequently.", ' ', /*#__PURE__*/React__default.createElement("span", {
9696
- onClick: knowMore,
9697
- className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
9698
- }, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9699
- className: "iui__my-15"
9700
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9701
- className: "iui__font--para-large iui__font--weight-medium"
9702
- }, "Users with roles"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9703
- className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
9704
- }, "Deactivating these users will affect the associated approval rules."), (selectedUsersApprover === null || selectedUsersApprover === void 0 ? void 0 : selectedUsersApprover.length) && selectedUsersApprover.map(function (item, index) {
9705
- var _item$data;
9706
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9707
- key: index,
9708
- className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
9709
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
9710
- firstName: item.first_name,
9711
- lastName: item.last_name,
9712
- isLetterAvatar: "true",
9713
- primaryText: item.first_name + ' ' + item.last_name,
9714
- secondaryText: item.email,
9715
- letterAvatarTextColor: "black",
9716
- letterAvatarBackgroundColor: "#d3d3d3",
9717
- profilePath: (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.profile_pic
9718
- }), /*#__PURE__*/React__default.createElement(RedWarningIcon, {
9719
- color: "#9A6700",
9720
- size: "14"
9721
- }));
9722
- })), selectedUsersNotApprover !== null && selectedUsersNotApprover !== void 0 && selectedUsersNotApprover.length ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement("hr", {
9723
- style: {
9724
- borderColor: '#E5E9ED'
9725
- }
9726
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9727
- className: "iui__my-15"
9728
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9729
- className: "iui__font--para-large iui__font--weight-medium"
9730
- }, "Safe users"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9731
- className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
9732
- }, "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) {
9733
- var _item$data2;
9734
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9735
- key: index,
9736
- className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
9737
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
9738
- firstName: item.first_name,
9739
- lastName: item.last_name,
9740
- isLetterAvatar: "true",
9741
- primaryText: item.first_name + ' ' + item.last_name,
9742
- secondaryText: item.email,
9743
- letterAvatarTextColor: "black",
9744
- letterAvatarBackgroundColor: "#d3d3d3",
9745
- profilePath: (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.profile_pic
9746
- }));
9747
- }))) : null), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9748
- isOpen: showInviteModal,
9749
- closeHandler: function closeHandler() {
9750
- return toggleInviteModalClose();
9751
- },
9752
- cancelLabel: "Cancel",
9753
- headerText: "Resend Invites?",
9754
- submitLabel: "Send",
9755
- submitHandler: function submitHandler() {
9756
- return onResendInviteHandler();
9757
- },
9758
- width: "400px",
9759
- modalBodyStyle: {
9760
- padding: '0px'
9761
- },
9762
- footerStyle: {
9763
- justifyContent: 'center'
9764
- }
9765
- }, /*#__PURE__*/React__default.createElement("div", {
9766
- style: {
9767
- display: 'flex',
9768
- padding: '16px',
9769
- margin: '8px 24px',
9770
- border: '1px solid #FDE047',
9771
- background: '#FEFCE8',
9772
- borderRadius: '5px'
9773
- }
9774
- }, /*#__PURE__*/React__default.createElement("div", {
9775
- style: {
9776
- marginRight: '5px'
9777
- }
9778
- }, /*#__PURE__*/React__default.createElement(InviteInfoIcon, null)), /*#__PURE__*/React__default.createElement("div", {
9779
- style: {
9780
- fontSize: '14px',
9781
- color: '#374151'
9782
- }
9783
- }, "This invitation will be sent to", ' ', /*#__PURE__*/React__default.createElement("span", {
9784
- style: {
9785
- fontSize: '14px',
9786
- color: '#374151',
9787
- fontWeight: 'bold'
9788
- }
9789
- }, userFirstName != null ? userFirstName + " " + userLastName : 'selected users'), ", who have not logged into the platform."))), /*#__PURE__*/React__default.createElement(BulkUploadModal, {
9051
+ }, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(BulkUploadModal, {
9790
9052
  isOpenImportUsersModal: isOpenImportUsersModal,
9791
9053
  closeImportUsersModal: closeImportUsersModal,
9792
9054
  closeImportModal: closeImportModal
@@ -9795,8 +9057,8 @@ var UserList = function UserList(_ref2) {
9795
9057
  errMsg: hasVerificationError
9796
9058
  }));
9797
9059
  };
9798
- var TabLabelCount = function TabLabelCount(_ref5) {
9799
- var count = _ref5.count;
9060
+ var TabLabelCount = function TabLabelCount(_ref3) {
9061
+ var count = _ref3.count;
9800
9062
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9801
9063
  className: styles$5.TabLabelCount
9802
9064
  }, " ", count, " ");
@@ -9871,12 +9133,11 @@ function Header(props) {
9871
9133
  })));
9872
9134
  }
9873
9135
 
9874
- 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"};
9136
+ var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV","tableContainer":"_3xdGF"};
9875
9137
 
9876
9138
  function Listview(_ref) {
9877
9139
  var data = _ref.data,
9878
9140
  name = _ref.name,
9879
- tableName = _ref.tableName,
9880
9141
  handleEditDialog = _ref.handleEditDialog,
9881
9142
  handleDeleteDialog = _ref.handleDeleteDialog,
9882
9143
  orderBy = _ref.orderBy,
@@ -9889,87 +9150,21 @@ function Listview(_ref) {
9889
9150
  handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
9890
9151
  page = _ref.page,
9891
9152
  rowsPerPage = _ref.rowsPerPage;
9892
- var deptHeadDetails = function deptHeadDetails(data) {
9893
- var _data$dept_head_detai;
9894
- 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) {
9895
- return data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name;
9896
- }
9897
- };
9898
9153
  var columns = [{
9899
9154
  id: 'name',
9900
9155
  label: name,
9901
- width: '40%',
9902
- sortable: true,
9903
- cell: function cell(row) {
9904
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9905
- component: "div"
9906
- }, row.name);
9907
- }
9908
- }, {
9909
- id: 'no_of_users',
9910
- label: 'Number of users',
9911
- width: '40%',
9912
- sortable: true,
9913
- cell: function cell(row) {
9914
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9915
- component: "div"
9916
- }, row.no_of_users);
9917
- }
9918
- }, {
9919
- id: 'actions',
9920
- label: 'Actions',
9921
- width: '20%',
9922
- cell: function cell(row) {
9923
- return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9924
- display: "flex"
9925
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9926
- buttonText: "Edit",
9927
- className: styles$7.buttonWidth,
9928
- onClick: function onClick() {
9929
- return handleEditDialog(row);
9930
- }
9931
- }), row.no_of_users > 0 ? /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9932
- buttonText: "Delete",
9933
- className: styles$7.buttonWidth,
9934
- onClick: function onClick() {
9935
- return handleDeleteDialog(row, true);
9936
- }
9937
- }) : /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9938
- buttonText: "Delete",
9939
- className: styles$7.buttonWidth,
9940
- onClick: function onClick() {
9941
- return handleDeleteDialog(row, false);
9942
- }
9943
- }));
9944
- }
9945
- }];
9946
- var departmentColumns = [{
9947
- id: 'name',
9948
- label: name,
9949
- width: '30%',
9156
+ width: '45%',
9950
9157
  sortable: true,
9951
9158
  cell: function cell(row) {
9952
9159
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9953
9160
  component: "div"
9954
9161
  }, row.name);
9955
9162
  }
9956
- }, {
9957
- id: 'department_head',
9958
- label: 'Department head',
9959
- width: '30%',
9960
- sortable: true,
9961
- cell: function cell(row) {
9962
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9963
- component: "div"
9964
- }, deptHeadDetails(row)), row.is_default_dept_head && /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9965
- className: clsx(styles$7.rowText, styles$7.textTransform, styles$7.lightColor)
9966
- }, "Assigned by default"));
9967
- }
9968
9163
  }, {
9969
9164
  id: 'no_of_users',
9970
9165
  label: 'Number of users',
9971
9166
  width: '45%',
9972
- sortable: false,
9167
+ sortable: true,
9973
9168
  cell: function cell(row) {
9974
9169
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9975
9170
  component: "div"
@@ -9978,7 +9173,7 @@ function Listview(_ref) {
9978
9173
  }, {
9979
9174
  id: 'actions',
9980
9175
  label: 'Actions',
9981
- width: '15%',
9176
+ width: '10%',
9982
9177
  cell: function cell(row) {
9983
9178
  return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9984
9179
  display: "flex"
@@ -10011,7 +9206,7 @@ function Listview(_ref) {
10011
9206
  hasFilter: true,
10012
9207
  isCheckboxTable: false,
10013
9208
  count: data.count,
10014
- columns: tableName === 'department' ? departmentColumns : columns,
9209
+ columns: columns,
10015
9210
  rows: data.results,
10016
9211
  page: page,
10017
9212
  handleChangePage: handleChangePage,
@@ -10068,43 +9263,16 @@ function EditPanelDialog(_ref) {
10068
9263
  var isOpen = _ref.isOpen,
10069
9264
  closeHandler = _ref.closeHandler,
10070
9265
  onValueChange = _ref.onValueChange,
10071
- _submitHandler = _ref.submitHandler,
9266
+ submitHandler = _ref.submitHandler,
10072
9267
  isError = _ref.isError,
10073
9268
  name = _ref.name,
10074
9269
  isDisabledSubmitBtn = _ref.isDisabledSubmitBtn,
10075
- validation = _ref.validation,
10076
- rowData = _ref.rowData,
10077
- tableName = _ref.tableName,
10078
- config = _ref.config;
9270
+ validation = _ref.validation;
10079
9271
  var _useSelector = reactRedux.useSelector(function (state) {
10080
9272
  return state.userPanel;
10081
9273
  }),
10082
9274
  dialogData = _useSelector.dialogData;
10083
- var deptHeadDetails = function deptHeadDetails(data) {
10084
- var _data$dept_head_detai;
10085
- 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) {
10086
- setHead({
10087
- value: data.dept_head_details[0].id,
10088
- label: data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name
10089
- });
10090
- }
10091
- };
10092
- var _useState = React.useState({
10093
- value: '',
10094
- label: 'Select'
10095
- }),
10096
- head = _useState[0],
10097
- setHead = _useState[1];
10098
- React.useEffect(function () {
10099
- deptHeadDetails(rowData);
10100
- }, [rowData]);
10101
- var history = reactRouterDom.useHistory();
10102
- var handleAddPageNavigation = function handleAddPageNavigation() {
10103
- history.push({
10104
- pathname: config.routes.users.add.path,
10105
- state: rowData
10106
- });
10107
- };
9275
+
10108
9276
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
10109
9277
  isDisabledSubmitBtn: isDisabledSubmitBtn,
10110
9278
  isOpen: isOpen,
@@ -10112,60 +9280,27 @@ function EditPanelDialog(_ref) {
10112
9280
  headerText: "Edit " + name.toLowerCase(),
10113
9281
  cancelLabel: (_dialogData$labels = dialogData.labels) === null || _dialogData$labels === void 0 ? void 0 : _dialogData$labels.cancelLabel,
10114
9282
  submitLabel: (_dialogData$labels2 = dialogData.labels) === null || _dialogData$labels2 === void 0 ? void 0 : _dialogData$labels2.submitLabel,
10115
- submitHandler: function submitHandler() {
10116
- return _submitHandler(head);
10117
- },
10118
- width: tableName === 'department' ? '400px' : '365px',
9283
+ submitHandler: submitHandler,
9284
+ width: "365px",
10119
9285
  hideCloseIcon: false,
10120
9286
  modalBodyStyle: {
10121
- overflowY: 'visible'
9287
+ maxHeight: '400px',
9288
+ overflow: 'auto',
9289
+ margin: '0px'
10122
9290
  },
10123
9291
  footerStyle: {
10124
9292
  justifyContent: 'end'
10125
9293
  }
10126
- }, tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10127
- display: "flex",
10128
- justifyContent: "center",
10129
- alignItems: "center",
10130
- flexDirection: "column",
10131
- style: {
10132
- marginBottom: '30px'
10133
- }
10134
9294
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9295
+ component: "div",
10135
9296
  display: "flex",
10136
9297
  justifyContent: "center",
10137
9298
  alignItems: "center",
10138
9299
  flexDirection: "column",
10139
- className: styles$7.baseAlert
10140
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10141
- className: styles$7.alertDescContainer
10142
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10143
- className: styles$7.iconLayout,
10144
- style: {
10145
- paddingTop: '4px'
10146
- }
10147
- }, /*#__PURE__*/React__default.createElement(BoldInfoIcon, {
10148
- color: "#CA8A04",
10149
- width: "25",
10150
- height: "20",
10151
- className: styles$7.iconStyle
10152
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
10153
- 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.",
10154
- style: {
10155
- fontWeight: 'normal'
10156
- }
10157
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
10158
- buttonText: "Add user",
10159
- type: "text",
10160
- startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
10161
- width: "9",
10162
- height: "9",
10163
- color: "#EC5D25"
10164
- }),
10165
- onClick: handleAddPageNavigation,
10166
- className: styles$7.addUserButton
10167
- }))), /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
10168
- label: name + " name",
9300
+ padding: "8px 24px"
9301
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
9302
+ label: name + " name"
9303
+ ,
10169
9304
  name: "name",
10170
9305
  defaultValue: dialogData.data.name,
10171
9306
  onValueChange: onValueChange,
@@ -10173,49 +9308,7 @@ function EditPanelDialog(_ref) {
10173
9308
  isError: isError,
10174
9309
  validation: validation,
10175
9310
  errorMsg: "Please enter " + name.toLowerCase() + " name.",
10176
- required: true,
10177
- style: tableName === 'department' && {
10178
- width: '350px'
10179
- }
10180
- }), tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10181
- className: "iui__mt-15",
10182
- style: {
10183
- width: '100%'
10184
- }
10185
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
10186
- label: "Department head",
10187
- name: "name",
10188
- defaultValue: head.label,
10189
- placeholder: "",
10190
- readOnly: true,
10191
- style: {
10192
- width: '350px'
10193
- }
10194
- })), tableName === 'department' && rowData.no_of_users > 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10195
- className: "iui__mt-15",
10196
- style: {
10197
- width: '100%'
10198
- }
10199
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
10200
- noResultsText: true,
10201
- isMove: true,
10202
- additional: {
10203
- page: 1,
10204
- departmentId: rowData.id
10205
- },
10206
- placeHolderCheck: head !== undefined && head.value === '',
10207
- label: "Department head",
10208
- value: head,
10209
- onValueChange: function onValueChange(_ref2) {
10210
- var _value = _ref2._value;
10211
- return setHead(_value);
10212
- },
10213
- loadOption: departmentHeadOptions,
10214
- disableText: "Please get in touch with your administrator to change this value.",
10215
- customLoadingText: "No users found in this department",
10216
- customLoadingTextStyle: {
10217
- color: '#374151'
10218
- }
9311
+ required: true
10219
9312
  })));
10220
9313
  }
10221
9314
 
@@ -10394,15 +9487,12 @@ var UserPanel = function UserPanel(_ref) {
10394
9487
  var _useState13 = React.useState(false),
10395
9488
  isSortingChangeTemp = _useState13[0],
10396
9489
  setSortingChangeTemp = _useState13[1];
10397
- var _useState14 = React.useState([]),
10398
- rowData = _useState14[0],
10399
- setRowData = _useState14[1];
10400
- var _useState15 = React.useState(1),
10401
- page = _useState15[0],
10402
- setPage = _useState15[1];
10403
- var _useState16 = React.useState(5),
10404
- rowsPerPage = _useState16[0],
10405
- setRowsPerPage = _useState16[1];
9490
+ var _useState14 = React.useState(1),
9491
+ page = _useState14[0],
9492
+ setPage = _useState14[1];
9493
+ var _useState15 = React.useState(5),
9494
+ rowsPerPage = _useState15[0],
9495
+ setRowsPerPage = _useState15[1];
10406
9496
  var orderingParam = orderBy;
10407
9497
  var _useSelector = reactRedux.useSelector(function (state) {
10408
9498
  return state.userPanel;
@@ -10415,25 +9505,18 @@ var UserPanel = function UserPanel(_ref) {
10415
9505
  }),
10416
9506
  isTokenVerified = _useSelector2.isTokenVerified,
10417
9507
  hasVerificationError = _useSelector2.hasVerificationError;
9508
+
10418
9509
  var onValueChange = function onValueChange(_ref2) {
10419
9510
  var _value = _ref2._value;
10420
9511
  var validatedValue = _value.replace(/\s+/g, ' ').trim();
10421
9512
  setDataList(validatedValue);
10422
9513
  };
10423
- var _useState17 = React.useState(70),
10424
- maxLengthForModal = _useState17[0],
10425
- setMaxLengthForModal = _useState17[1];
10426
- React.useEffect(function () {
10427
- if (title === 'Business unit') {
10428
- setMaxLengthForModal(150);
10429
- }
10430
- }, []);
10431
9514
  var validation = {
10432
9515
  regexOnChange: /^[(A-Z)(a-z)(0-9)&'\-_.,/: ]*$/,
10433
9516
  regexOnBlur: null,
10434
9517
  maxLimit: '',
10435
9518
  minLimit: '',
10436
- maxLength: maxLengthForModal,
9519
+ maxLength: 70,
10437
9520
  minLength: 0
10438
9521
  };
10439
9522
  React.useEffect(function () {
@@ -10506,7 +9589,6 @@ var UserPanel = function UserPanel(_ref) {
10506
9589
  submitLabel: 'Save'
10507
9590
  }, '', data));
10508
9591
  setDataList(data.name);
10509
- setRowData(data);
10510
9592
  setEditModal(true);
10511
9593
  };
10512
9594
  var closeEditDialog = function closeEditDialog() {
@@ -10521,12 +9603,6 @@ var UserPanel = function UserPanel(_ref) {
10521
9603
  var payload = {
10522
9604
  names: [dataList]
10523
9605
  };
10524
- if (tableName === 'department') {
10525
- payload = {
10526
- name: dataList,
10527
- department_head_id: null
10528
- };
10529
- }
10530
9606
  var message = title + " added successfully.";
10531
9607
  handleApiCall(addRecord, payload, message, 'add');
10532
9608
  } else {
@@ -10540,12 +9616,10 @@ var UserPanel = function UserPanel(_ref) {
10540
9616
  var message = title + " deleted successfully.";
10541
9617
  handleApiCall(deleteRecord, payload, message, 'delete');
10542
9618
  };
10543
- var handleApiCall = function handleApiCall(dispatchFun, payload, message, type, optionalParams) {
10544
- if (optionalParams === void 0) {
10545
- optionalParams = null;
10546
- }
9619
+
9620
+ var handleApiCall = function handleApiCall(dispatchFun, payload, message, type) {
10547
9621
  dispatch(userPanelShowLoader());
10548
- dispatch(dispatchFun(tableName, payload, getApiData(), optionalParams)).then(function (res) {
9622
+ dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
10549
9623
  IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
10550
9624
  dispatch(userPanelStopLoader());
10551
9625
  if (type === 'delete') {
@@ -10587,14 +9661,8 @@ var UserPanel = function UserPanel(_ref) {
10587
9661
  name: dataList
10588
9662
  }]
10589
9663
  };
10590
- if (tableName === 'department') {
10591
- payload = {
10592
- name: dataList,
10593
- department_head_id: data.value === '' || rowData.is_default_dept_head && rowData.dept_head === data.value ? null : data.value
10594
- };
10595
- }
10596
9664
  var message = title + " updated successfully.";
10597
- handleApiCall(editRecord, payload, message, 'edit', dialogData.data.id);
9665
+ handleApiCall(editRecord, payload, message, 'edit');
10598
9666
  setErrorEdit(false);
10599
9667
  } else {
10600
9668
  setErrorEdit(true);
@@ -10701,10 +9769,7 @@ var UserPanel = function UserPanel(_ref) {
10701
9769
  submitHandler: handleEditPanel,
10702
9770
  isError: errorEdit,
10703
9771
  isDisabledSubmitBtn: loading,
10704
- validation: validation,
10705
- rowData: rowData,
10706
- tableName: tableName,
10707
- config: config
9772
+ validation: validation
10708
9773
  })) : /*#__PURE__*/React__default.createElement(VerificationError, {
10709
9774
  config: config
10710
9775
  }));