@itilite/iui-user-management 0.4.920 → 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,46 +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
- console.log(response.next);
754
- return {
755
- options: mappedValue,
756
- hasMore: !!response.next,
757
- additional: {
758
- page: page + 1,
759
- departmentId: departmentId
760
- }
761
- };
762
- });
763
- }, function () {
764
- return {
765
- options: [],
766
- hasMore: false,
767
- additional: {
768
- page: 1,
769
- departmentId: departmentId
770
- }
771
- };
772
- }));
773
- } catch (e) {
774
- return Promise.reject(e);
775
- }
776
- };
777
693
 
778
694
  var UserRole = function UserRole(_ref) {
779
695
  var _ref$list = _ref.list,
@@ -852,6 +768,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
852
768
  if (userTags.length) {
853
769
  res.user_tags = userTags;
854
770
  }
771
+
855
772
  if (payload.productAccess.travel) {
856
773
  var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
857
774
  res.approvers.travel = [];
@@ -863,12 +780,14 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
863
780
  });
864
781
  }
865
782
  }
783
+
866
784
  if (payload.travelFYI && payload.travelFYI.value) {
867
785
  res.approvers.travel.push({
868
786
  email: payload.travelFYI.value,
869
787
  sequence: 'fyi'
870
788
  });
871
789
  }
790
+
872
791
  res.user_travel_info = {
873
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,
874
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,
@@ -907,6 +826,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
907
826
  res.files = [];
908
827
  }
909
828
  }
829
+
910
830
  if (payload.productAccess.expense) {
911
831
  res.approvers.expense = [];
912
832
  for (var _key2 in payload.expenseApproversInput) {
@@ -917,6 +837,7 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
917
837
  });
918
838
  }
919
839
  }
840
+
920
841
  if (payload.expenseFYI && payload.expenseFYI.value) {
921
842
  res.approvers.expense.push({
922
843
  email: payload.expenseFYI.value,
@@ -1024,6 +945,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1024
945
  });
1025
946
  }
1026
947
  }
948
+
1027
949
  if (payload.travelFYI && payload.travelFYI.value) {
1028
950
  res.fields.approvers.travel.push({
1029
951
  email: payload.travelFYI.value,
@@ -1100,6 +1022,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1100
1022
  res.fields.user_travel_info.redress_number = payload.secureTravelInputInfo.redress_number || null;
1101
1023
  }
1102
1024
  }
1025
+
1103
1026
  if (payload.productAccess.expense) {
1104
1027
  if (!env$1.isProfilePage()) {
1105
1028
  res.fields.approvers.expense = [];
@@ -1111,6 +1034,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1111
1034
  });
1112
1035
  }
1113
1036
  }
1037
+
1114
1038
  if (payload.expenseFYI && payload.expenseFYI.value) {
1115
1039
  res.fields.approvers.expense.push({
1116
1040
  email: payload.expenseFYI.value,
@@ -1242,19 +1166,10 @@ var updateTabValue = function updateTabValue(tabId) {
1242
1166
  payload: tabId
1243
1167
  };
1244
1168
  };
1245
- var updateActiveStatus = function updateActiveStatus(activateVal, id, roleTransfer, newApproverUserId) {
1246
- if (roleTransfer === void 0) {
1247
- roleTransfer = false;
1248
- }
1249
- var _payload = {
1250
- role_transfer: roleTransfer
1251
- };
1252
- if (roleTransfer) {
1253
- _payload.new_approver_user_id = newApproverUserId;
1254
- }
1169
+ var updateActiveStatus = function updateActiveStatus(activateVal, id) {
1255
1170
  return function (dispatch) {
1256
1171
  return new Promise(function (resolve, reject) {
1257
- 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) {
1258
1173
  dispatch(setUserActiveStatus({
1259
1174
  is_active: activateVal !== 0,
1260
1175
  id: id
@@ -1351,6 +1266,7 @@ var fetchRenderFileds = function fetchRenderFileds() {
1351
1266
  var _res$data;
1352
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.');
1353
1268
  dispatch(stopLoader());
1269
+ reject();
1354
1270
  }
1355
1271
  })["catch"](function (err) {
1356
1272
  reject(err);
@@ -1363,7 +1279,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
1363
1279
  return new Promise(function (resolve, reject) {
1364
1280
  api$2.get(userAddEditUrl.countryCode()).then(function (res) {
1365
1281
  dispatch(setCountryCodes(res.data.country_code_details));
1366
- resolve(res.data.country_code_details);
1282
+ resolve('success');
1367
1283
  })["catch"](function (err) {
1368
1284
  reject(err);
1369
1285
  })["finally"](function () {});
@@ -1522,9 +1438,11 @@ var createUser = function createUser(payload) {
1522
1438
  } else {
1523
1439
  if (res.data.errors && typeof res.data.errors === 'object') {
1524
1440
  reject(res.data.errors);
1441
+ return;
1525
1442
  } else if (!Object.keys(res.data.errors).length) {
1526
1443
  IUIToastMessageService$1.warningNotify(res.data.message);
1527
1444
  }
1445
+ reject();
1528
1446
  }
1529
1447
  })["catch"](function (err) {
1530
1448
  var _err$response6;
@@ -1570,13 +1488,17 @@ var uploadSingleDocumnet = function uploadSingleDocumnet(payload) {
1570
1488
  });
1571
1489
  };
1572
1490
  };
1491
+
1573
1492
  var uploadFileToS3 = function uploadFileToS3(presignedPostData, file) {
1574
1493
  return new Promise(function (resolve, reject) {
1575
1494
  var formData = new FormData();
1495
+
1576
1496
  Object.keys(presignedPostData.fields).forEach(function (key) {
1577
1497
  formData.append(key, presignedPostData.fields[key]);
1578
1498
  });
1499
+
1579
1500
  formData.append('file', file);
1501
+
1580
1502
  axios.post(presignedPostData.url, formData, {
1581
1503
  headers: {
1582
1504
  'Content-Type': 'multipart/form-data'
@@ -1640,48 +1562,6 @@ var undoneSignUpRejection = function undoneSignUpRejection(userId) {
1640
1562
  });
1641
1563
  };
1642
1564
  };
1643
- var resetPasswordForUser = function resetPasswordForUser(data) {
1644
- return function (dispatch) {
1645
- return new Promise(function (resolve, reject) {
1646
- api$2.post("" + userAddEditUrl.resetPasswordForUserApi(), {
1647
- email: data.email
1648
- }).then(function (res) {
1649
- 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.");
1650
- resolve();
1651
- })["catch"](function (err) {
1652
- var _err$response9, _err$response9$data;
1653
- 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)) {
1654
- var _err$response10, _err$response10$data, _err$response10$data$;
1655
- 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]);
1656
- reject(err);
1657
- return;
1658
- }
1659
- reject(err);
1660
- });
1661
- });
1662
- };
1663
- };
1664
- var resendInviteForUser = function resendInviteForUser(data) {
1665
- return function (dispatch) {
1666
- return new Promise(function (resolve, reject) {
1667
- api$2.post(userAddEditUrl.resendInviteForUserApi(), {
1668
- user_ids: data
1669
- }).then(function (res) {
1670
- IUIToastMessageService$1.sNotify(res.data.message);
1671
- resolve();
1672
- })["catch"](function (err) {
1673
- var _err$response11, _err$response11$data;
1674
- 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)) {
1675
- var _err$response12, _err$response12$data, _err$response12$data$;
1676
- 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]);
1677
- reject(err);
1678
- return;
1679
- }
1680
- reject(err);
1681
- });
1682
- });
1683
- };
1684
- };
1685
1565
  var updateUser = function updateUser(payload, userId, inputChangeLog) {
1686
1566
  return function (dispatch) {
1687
1567
  return new Promise(function (resolve, reject) {
@@ -1818,7 +1698,7 @@ var verifyUserInfo = function verifyUserInfo(userId) {
1818
1698
  var submitAddModalData = function submitAddModalData(tableName, data) {
1819
1699
  return function (dispatch) {
1820
1700
  return new Promise(function (resolve, reject) {
1821
- 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) {
1822
1702
  resolve(res);
1823
1703
  })["catch"](function (err) {
1824
1704
  var _err$response17, _err$response17$data;
@@ -1854,7 +1734,6 @@ var OPEN_DIALOG = 'OPEN_DIALOG';
1854
1734
  var CLOSE_DIALOG = 'CLOSE_DIALOG';
1855
1735
  var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
1856
1736
  var UNASSIGNED_USERS = 'Not assigned';
1857
- var FETCH_DEPARTMENT_USERS_DATA = 'FETCH_DEPARTMENT_USERS_DATA';
1858
1737
 
1859
1738
  var api$3 = utils.configs.api;
1860
1739
  var IUIToastMessageService$2 = utils.services.IUIToastMessageService;
@@ -1901,17 +1780,18 @@ var getUserPanalData = function getUserPanalData(params) {
1901
1780
  });
1902
1781
  };
1903
1782
  };
1783
+
1904
1784
  var addRecord = function addRecord(tableName, data, getParam) {
1905
1785
  return function (dispatch) {
1906
1786
  return new Promise(function (resolve, reject) {
1907
- 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) {
1908
1788
  dispatch(getUserPanalData(getParam));
1909
1789
  dispatch(closeDialog());
1910
1790
  resolve(res);
1911
1791
  })["catch"](function (err) {
1912
- var _err$response3, _err$response3$data;
1792
+ var _err$response2, _err$response2$data;
1913
1793
  dispatch(userPanelStopLoader());
1914
- 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.');
1915
1795
  });
1916
1796
  });
1917
1797
  };
@@ -1925,37 +1805,25 @@ var deleteRecord = function deleteRecord(tableName, id, getParam) {
1925
1805
  dispatch(userPanelStopLoader());
1926
1806
  resolve();
1927
1807
  })["catch"](function (err) {
1928
- var _err$response4, _err$response4$data;
1929
- 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.');
1930
1810
  dispatch(userPanelStopLoader());
1931
1811
  });
1932
1812
  });
1933
1813
  };
1934
1814
  };
1935
- var editRecord = function editRecord(tableName, data, getParam, optionalParams) {
1815
+ var editRecord = function editRecord(tableName, data, getParam) {
1936
1816
  return function (dispatch) {
1937
1817
  return new Promise(function (resolve, reject) {
1938
- if (tableName === 'department') {
1939
- api$3.put(departmentUrl.departmentUrl() + "/" + optionalParams, data).then(function (res) {
1940
- dispatch(getUserPanalData(getParam));
1941
- dispatch(closeDialog());
1942
- resolve();
1943
- })["catch"](function (err) {
1944
- var _err$response5, _err$response5$data;
1945
- dispatch(userPanelStopLoader());
1946
- 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.');
1947
- });
1948
- } else {
1949
- api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
1950
- dispatch(getUserPanalData(getParam));
1951
- dispatch(closeDialog());
1952
- resolve();
1953
- })["catch"](function (err) {
1954
- var _err$response6, _err$response6$data;
1955
- dispatch(userPanelStopLoader());
1956
- 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.');
1957
- });
1958
- }
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
+ });
1959
1827
  });
1960
1828
  };
1961
1829
  };
@@ -1967,8 +1835,8 @@ var moveRecord = function moveRecord(tableName, data, getParam) {
1967
1835
  dispatch(closeDialog());
1968
1836
  resolve(res);
1969
1837
  })["catch"](function (err) {
1970
- var _err$response7, _err$response7$data;
1971
- 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.');
1972
1840
  });
1973
1841
  });
1974
1842
  };
@@ -2456,6 +2324,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2456
2324
  setOpenEditAproverModalFlag(false);
2457
2325
  });
2458
2326
  };
2327
+
2459
2328
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
2460
2329
  container: true,
2461
2330
  className: (styles.headingPadding)
@@ -2603,7 +2472,8 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2603
2472
  headerText: "Edit approver field",
2604
2473
  cancelLabel: "Cancel",
2605
2474
  submitLabel: "Save",
2606
- submitHandler: handleEditAproverLabel,
2475
+ submitHandler: handleEditAproverLabel
2476
+ ,
2607
2477
  width: "420px",
2608
2478
  modalBodyStyle: {
2609
2479
  maxHeight: '600px',
@@ -3057,8 +2927,8 @@ var workInfo = [{
3057
2927
  validation: {
3058
2928
  regexOnChange: null,
3059
2929
  regexOnBlur: [{
3060
- regex: /^[(A-Z)(a-z)(0-9)\-_& ]*$/,
3061
- message: "Only alphabets, numbers, - and _ & are allowed."
2930
+ regex: /^[(A-Z)(a-z)(0-9)\-& ]*$/,
2931
+ message: "Only alphabets, numbers and - & are allowed."
3062
2932
  }],
3063
2933
  maxLimit: '',
3064
2934
  minLimit: '',
@@ -3146,8 +3016,8 @@ var workInfo = [{
3146
3016
  validation: {
3147
3017
  regexOnChange: null,
3148
3018
  regexOnBlur: [{
3149
- regex: /^[A-Za-z0-9 \-_.,&'()\/]*$/,
3150
- message: "Only alphabets, numbers & special characters . & ' ( ) _ - , / are allowed."
3019
+ regex: /^[A-Za-z0-9 \-.,&'()\/]*$/,
3020
+ message: "Only alphabets, numbers & special characters . & ' ( ) - , / are allowed."
3151
3021
  }, {
3152
3022
  regex: /^[a-zA-Z]/,
3153
3023
  message: 'Designation should start with alphabets'
@@ -3158,6 +3028,31 @@ var workInfo = [{
3158
3028
  minLength: 0
3159
3029
  },
3160
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
3161
3056
  }, {
3162
3057
  id: 9,
3163
3058
  label: 'Base location',
@@ -3993,6 +3888,7 @@ var reducer$1 = function reducer(state, action) {
3993
3888
  _userListInfo.results[i].is_active = action.payload.is_active;
3994
3889
  }
3995
3890
  });
3891
+
3996
3892
  var _deactivatedUsers = _userListInfo.results.length > 0 ? _userListInfo.results.filter(function (val) {
3997
3893
  return !val.is_active;
3998
3894
  }).map(function (obj) {
@@ -4015,6 +3911,7 @@ var reducer$1 = function reducer(state, action) {
4015
3911
  }
4016
3912
  });
4017
3913
  });
3914
+
4018
3915
  var _deactivatedUsers2 = _userListInfo2.results.length > 0 ? _userListInfo2.results.filter(function (val) {
4019
3916
  return !val.is_active;
4020
3917
  }).map(function (obj) {
@@ -4068,7 +3965,6 @@ var initialState$2 = {
4068
3965
  previous: null,
4069
3966
  results: []
4070
3967
  },
4071
- deptUsers: [],
4072
3968
  loading: false
4073
3969
  };
4074
3970
  var reducer$2 = function reducer(state, action) {
@@ -4138,12 +4034,6 @@ var reducer$2 = function reducer(state, action) {
4138
4034
  loading: false
4139
4035
  });
4140
4036
  }
4141
- case FETCH_DEPARTMENT_USERS_DATA:
4142
- {
4143
- return _extends({}, state, {
4144
- deptUsers: action.payload
4145
- });
4146
- }
4147
4037
  default:
4148
4038
  return state;
4149
4039
  }
@@ -4330,7 +4220,8 @@ var rootReducer = redux.combineReducers({
4330
4220
  customFields: reducer$5
4331
4221
  });
4332
4222
 
4333
- var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)));
4223
+ var store = redux.createStore(rootReducer, reduxDevtoolsExtension.composeWithDevTools(redux.applyMiddleware(thunk)
4224
+ ));
4334
4225
 
4335
4226
  function withStore(Component) {
4336
4227
  function WrappedComponent(props) {
@@ -4873,7 +4764,8 @@ function AddPanelDialog(_ref) {
4873
4764
  flexDirection: "column",
4874
4765
  padding: "8px 20px"
4875
4766
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
4876
- label: name + " name",
4767
+ label: name + " name"
4768
+ ,
4877
4769
  name: "name",
4878
4770
  defaultValue: "",
4879
4771
  onValueChange: onValueChange,
@@ -4922,7 +4814,6 @@ var UserAddEdit = function UserAddEdit(props) {
4922
4814
  isILadmin = _useSelector2.isILadmin,
4923
4815
  companyName = _useSelector2.companyName;
4924
4816
  var history = reactRouterDom.useHistory();
4925
- var location = reactRouterDom.useLocation();
4926
4817
  var _useState = React.useState({
4927
4818
  travel: false,
4928
4819
  expense: false
@@ -4958,32 +4849,8 @@ var UserAddEdit = function UserAddEdit(props) {
4958
4849
  }
4959
4850
  setProductAccess(_productAccess);
4960
4851
  };
4961
- var _useState2 = React.useState(''),
4962
- newCountryCode = _useState2[0],
4963
- setNewCountryCode = _useState2[1];
4964
- var _useState3 = React.useState(),
4965
- countryDialCode = _useState3[0],
4966
- setCountryDialCode = _useState3[1];
4967
- var _useState4 = React.useState([]),
4968
- countryContactCode = _useState4[0],
4969
- setCountryContactCode = _useState4[1];
4970
- React.useEffect(function () {
4971
- var countryObject = countryContactCode.find(function (t) {
4972
- return t.dial_code === countryDialCode;
4973
- });
4974
- console.log('countryObject', countryDialCode, countryObject);
4975
- if (countryObject) {
4976
- setPersonalInfoInput(_extends({}, personalInfoInput, {
4977
- country_code: countryObject.code
4978
- }));
4979
- }
4980
- }, [countryDialCode]);
4981
- React.useEffect(function () {
4982
- var extractedNumber = newCountryCode.substring(1);
4983
- var convertedNumber = parseInt(extractedNumber);
4984
- setCountryDialCode(convertedNumber);
4985
- }, [newCountryCode]);
4986
- var _useState5 = React.useState({
4852
+
4853
+ var _useState2 = React.useState({
4987
4854
  first_name: '',
4988
4855
  last_name: '',
4989
4856
  email: '',
@@ -4994,9 +4861,9 @@ var UserAddEdit = function UserAddEdit(props) {
4994
4861
  contact_country_code: '',
4995
4862
  profile_pic: []
4996
4863
  }),
4997
- personalInfoInput = _useState5[0],
4998
- setPersonalInfoInput = _useState5[1];
4999
- var _useState6 = React.useState({
4864
+ personalInfoInput = _useState2[0],
4865
+ setPersonalInfoInput = _useState2[1];
4866
+ var _useState3 = React.useState({
5000
4867
  emp_level: {
5001
4868
  value: '',
5002
4869
  label: 'Select employee level'
@@ -5016,72 +4883,62 @@ var UserAddEdit = function UserAddEdit(props) {
5016
4883
  },
5017
4884
  designation: '',
5018
4885
  base_location: '',
5019
- manager_id: {
5020
- value: '',
5021
- label: 'Select Manager'
5022
- },
5023
- skip_manager_id: {
5024
- value: '',
5025
- label: 'Select Manager'
5026
- },
5027
4886
  currency: {
5028
4887
  value: defaultCurrency,
5029
4888
  label: defaultCurrency
5030
4889
  }
5031
4890
  }),
5032
- employeeInfoInput = _useState6[0],
5033
- setEmployeeInfoInput = _useState6[1];
5034
- var _useState7 = React.useState({
4891
+ employeeInfoInput = _useState3[0],
4892
+ setEmployeeInfoInput = _useState3[1];
4893
+ var _useState4 = React.useState({
5035
4894
  emp_level: 0,
5036
4895
  entity: 0,
5037
4896
  business_unit: 0,
5038
4897
  department: 0,
5039
- currency: 0,
5040
- manager_id: 0,
5041
- skip_manager_id: 0
4898
+ currency: 0
5042
4899
  }),
5043
- cacheForAsyncDropdown = _useState7[0],
5044
- clearCacheForAsyncDropdown = _useState7[1];
5045
- var _useState8 = React.useState({}),
5046
- userTagType = _useState8[0],
5047
- setUserTagType = _useState8[1];
5048
- var _useState9 = React.useState(false),
5049
- scroll = _useState9[0],
5050
- setScroll = _useState9[1];
5051
- var _useState10 = React.useState({}),
5052
- customFieldsInput = _useState10[0],
5053
- setCustomFieldsInput = _useState10[1];
5054
- var _useState11 = React.useState('traveler'),
5055
- travelRole = _useState11[0],
5056
- setTravelRole = _useState11[1];
5057
- var _useState12 = React.useState({}),
5058
- travelApproversInput = _useState12[0],
5059
- setTravelApproversInput = _useState12[1];
5060
- 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({
5061
4918
  value: '',
5062
4919
  label: 'Select approver'
5063
4920
  }),
5064
- travelFYI = _useState13[0],
5065
- setTravelFYI = _useState13[1];
5066
- var _useState14 = React.useState([]),
5067
- membershipInfoInput = _useState14[0],
5068
- setMembershipInfoInput = _useState14[1];
5069
- var _useState15 = React.useState([]),
5070
- removedMembershipInfoInput = _useState15[0],
5071
- setRemovedMembershipInfoInput = _useState15[1];
5072
- 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({
5073
4930
  flight_seat_preference: '',
5074
4931
  meal_preference: ''
5075
4932
  }),
5076
- travelPreferenceInfo = _useState16[0],
5077
- settravelPreferenceInfo = _useState16[1];
5078
- var _useState17 = React.useState({
4933
+ travelPreferenceInfo = _useState13[0],
4934
+ settravelPreferenceInfo = _useState13[1];
4935
+ var _useState14 = React.useState({
5079
4936
  trusted_traveller: '',
5080
4937
  redress_number: ''
5081
4938
  }),
5082
- secureTravelInputInfo = _useState17[0],
5083
- setSecureTravelInputInfo = _useState17[1];
5084
- var _useState18 = React.useState({
4939
+ secureTravelInputInfo = _useState14[0],
4940
+ setSecureTravelInputInfo = _useState14[1];
4941
+ var _useState15 = React.useState({
5085
4942
  passport_issue_country: {
5086
4943
  value: '',
5087
4944
  label: 'Select country'
@@ -5096,39 +4953,39 @@ var UserAddEdit = function UserAddEdit(props) {
5096
4953
  passport_photo: [],
5097
4954
  travel_docs: []
5098
4955
  }),
5099
- passportInfoInput = _useState18[0],
5100
- setPassportInfoInput = _useState18[1];
5101
- var _useState19 = React.useState([]),
5102
- filesForDelete = _useState19[0],
5103
- setFilesForDelete = _useState19[1];
5104
- var _useState20 = React.useState([]),
5105
- profilePicDelete = _useState20[0],
5106
- setProfilePicDelete = _useState20[1];
5107
- var _useState21 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
5108
- isAdditionalInfoExpanded = _useState21[0],
5109
- setAdditionalInfoFlag = _useState21[1];
5110
- var _useState22 = React.useState('submitter'),
5111
- expenseRole = _useState22[0],
5112
- setExpenseRole = _useState22[1];
5113
- var _useState23 = React.useState({}),
5114
- expenseApproversInput = _useState23[0],
5115
- setExpenseApproversInput = _useState23[1];
5116
- 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({
5117
4974
  value: '',
5118
4975
  label: 'Select approver'
5119
4976
  }),
5120
- expenseFYI = _useState24[0],
5121
- setExpenseFYI = _useState24[1];
4977
+ expenseFYI = _useState21[0],
4978
+ setExpenseFYI = _useState21[1];
5122
4979
  var asyncSelectRefs = React.useRef({
5123
4980
  emp_level: React.useRef(null),
5124
4981
  entity: React.useRef(null),
5125
4982
  business_unit: React.useRef(null),
5126
4983
  department: React.useRef(null)
5127
4984
  });
5128
- var _useState25 = React.useState([]),
5129
- errorArray = _useState25[0],
5130
- setErrorArray = _useState25[1];
5131
- var _useState26 = React.useState({
4985
+ var _useState22 = React.useState([]),
4986
+ errorArray = _useState22[0],
4987
+ setErrorArray = _useState22[1];
4988
+ var _useState23 = React.useState({
5132
4989
  first_name: '',
5133
4990
  last_name: '',
5134
4991
  email: '',
@@ -5158,9 +5015,9 @@ var UserAddEdit = function UserAddEdit(props) {
5158
5015
  userTagType: '',
5159
5016
  profile_pic: ''
5160
5017
  }),
5161
- errorMsgs = _useState26[0],
5162
- setErrorMsgs = _useState26[1];
5163
- var _useState27 = React.useState({
5018
+ errorMsgs = _useState23[0],
5019
+ setErrorMsgs = _useState23[1];
5020
+ var _useState24 = React.useState({
5164
5021
  first_name: false,
5165
5022
  last_name: false,
5166
5023
  email: false,
@@ -5187,14 +5044,11 @@ var UserAddEdit = function UserAddEdit(props) {
5187
5044
  userTagType: false,
5188
5045
  profile_pic: false
5189
5046
  }),
5190
- inputChangeLog = _useState27[0],
5191
- updateInputChangeLog = _useState27[1];
5192
- var _useState28 = React.useState([]),
5193
- uploadedFiles = _useState28[0],
5194
- setUploadedFiles = _useState28[1];
5195
- var _useState29 = React.useState(70),
5196
- maxLengthForModal = _useState29[0],
5197
- setMaxLengthForModal = _useState29[1];
5047
+ inputChangeLog = _useState24[0],
5048
+ updateInputChangeLog = _useState24[1];
5049
+ var _useState25 = React.useState([]),
5050
+ uploadedFiles = _useState25[0],
5051
+ setUploadedFiles = _useState25[1];
5198
5052
  var defaultAddModalData = {
5199
5053
  isOpen: false,
5200
5054
  isError: false,
@@ -5207,41 +5061,25 @@ var UserAddEdit = function UserAddEdit(props) {
5207
5061
  regexOnBlur: null,
5208
5062
  maxLimit: '',
5209
5063
  minLimit: '',
5210
- maxLength: maxLengthForModal,
5064
+ maxLength: 70,
5211
5065
  minLength: 0
5212
5066
  };
5213
- var _useState30 = React.useState(defaultAddModalData),
5214
- addModalData = _useState30[0],
5215
- setAddModalData = _useState30[1];
5067
+ var _useState26 = React.useState(defaultAddModalData),
5068
+ addModalData = _useState26[0],
5069
+ setAddModalData = _useState26[1];
5216
5070
  var onAddModalClose = function onAddModalClose() {
5217
5071
  setAddModalData(_extends({}, defaultAddModalData));
5218
5072
  };
5219
- React.useEffect(function () {
5220
- var _location$state, _location$state2;
5221
- 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) {
5222
- var _location$state3, _location$state4;
5223
- setEmployeeInfoInput(_extends({}, employeeInfoInput, {
5224
- department: {
5225
- value: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.id,
5226
- label: location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.name
5227
- }
5228
- }));
5229
- }
5230
- }, []);
5231
5073
  var onModalOpen = function onModalOpen(e, id) {
5232
5074
  var title = '';
5233
5075
  if (id === 'entity') {
5234
5076
  title = 'Entity';
5235
- setMaxLengthForModal(70);
5236
5077
  } else if (id === 'department') {
5237
5078
  title = 'Department';
5238
- setMaxLengthForModal(70);
5239
5079
  } else if (id === 'business_unit') {
5240
- setMaxLengthForModal(150);
5241
5080
  title = 'Business unit';
5242
5081
  } else if (id === 'employee_level') {
5243
5082
  title = 'Employee level';
5244
- setMaxLengthForModal(70);
5245
5083
  }
5246
5084
  setAddModalData(_extends({}, addModalData, {
5247
5085
  isOpen: true,
@@ -5257,42 +5095,23 @@ var UserAddEdit = function UserAddEdit(props) {
5257
5095
  }));
5258
5096
  } else {
5259
5097
  dispatch(showLoader());
5260
- var dataObj;
5261
- if (addModalData.id === 'department') {
5262
- dataObj = {
5263
- name: validatedValue,
5264
- department_head_id: null
5265
- };
5266
- } else {
5267
- dataObj = {
5268
- names: [validatedValue]
5269
- };
5270
- }
5271
- dispatch(submitAddModalData(addModalData.id, dataObj)).then(function (res) {
5272
- var _extends4;
5098
+ dispatch(submitAddModalData(addModalData.id, {
5099
+ names: [validatedValue]
5100
+ })).then(function (res) {
5101
+ var _extends2;
5273
5102
  setAddModalData(_extends({}, addModalData, {
5274
5103
  isOpen: false
5275
5104
  }));
5276
5105
  IUIToastMessageService$4.sNotify(addModalData.title + " added successfully.");
5277
5106
  var tempKey = addModalData.id === 'employee_level' ? 'emp_level' : addModalData.id;
5278
- if (addModalData.id === 'department') {
5279
- var _extends2;
5280
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
5281
- value: res.data.result.id,
5282
- label: res.data.result.name
5283
- }, _extends2)));
5284
- } else {
5285
- var _extends3;
5286
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends3 = {}, _extends3[tempKey] = {
5287
- value: res.data.value,
5288
- label: res.data.label
5289
- }, _extends3)));
5290
- }
5291
- 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)));
5292
5111
  asyncSelectRefs.current[tempKey].current.blur();
5293
5112
  clearCacheForAsyncDropdown(function (prevState) {
5294
- var _extends5;
5295
- return _extends({}, prevState, (_extends5 = {}, _extends5[tempKey] = prevState[tempKey] + 1, _extends5));
5113
+ var _extends3;
5114
+ return _extends({}, prevState, (_extends3 = {}, _extends3[tempKey] = prevState[tempKey] + 1, _extends3));
5296
5115
  });
5297
5116
  dispatch(stopLoader());
5298
5117
  });
@@ -5309,10 +5128,10 @@ var UserAddEdit = function UserAddEdit(props) {
5309
5128
  };
5310
5129
  var onPersonalInfoChange = function onPersonalInfoChange(args) {
5311
5130
  try {
5312
- var _temp5 = function _temp5() {
5131
+ var _temp6 = function _temp6() {
5313
5132
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5314
- var _extends6;
5315
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends6 = {}, _extends6[_name] = true, _extends6)));
5133
+ var _extends4;
5134
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[_name] = true, _extends4)));
5316
5135
  }
5317
5136
  };
5318
5137
  var _name = args._name,
@@ -5323,7 +5142,7 @@ var UserAddEdit = function UserAddEdit(props) {
5323
5142
  _errorMsg = _args$_errorMsg === void 0 ? '' : _args$_errorMsg,
5324
5143
  _args$_obj = args._obj,
5325
5144
  _obj = _args$_obj === void 0 ? {} : _args$_obj;
5326
- var _temp4 = function () {
5145
+ var _temp7 = function () {
5327
5146
  if (_name === 'contact_number') {
5328
5147
  setPersonalInfoInput(_extends({}, personalInfoInput, {
5329
5148
  contact_number: _value.trim(),
@@ -5334,14 +5153,14 @@ var UserAddEdit = function UserAddEdit(props) {
5334
5153
  updateError('country_code', _isError, _errorMsg);
5335
5154
  updateError('contact_country_code', _isError, _errorMsg);
5336
5155
  } else {
5337
- var _temp3 = function _temp3() {
5338
- var _extends7;
5339
- 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)));
5340
5159
  updateError(_name, _isError, _errorMsg);
5341
5160
  };
5342
- var _temp2 = function () {
5161
+ var _temp9 = function () {
5343
5162
  if (_name === 'profile_pic') {
5344
- var _temp = function () {
5163
+ var _temp10 = function () {
5345
5164
  if (_obj.isUpload) {
5346
5165
  return Promise.resolve(uploadDocs(_value, _name)).then(function (docsData) {
5347
5166
  _value = _value.map(function (_val) {
@@ -5372,29 +5191,28 @@ var UserAddEdit = function UserAddEdit(props) {
5372
5191
  setProfilePicDelete([].concat(profilePicDelete, _deletedFiles));
5373
5192
  }
5374
5193
  }();
5375
- if (_temp && _temp.then) return _temp.then(function () {});
5194
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
5376
5195
  }
5377
5196
  }();
5378
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
5197
+ return _temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9);
5379
5198
  }
5380
5199
  }();
5381
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
5200
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
5382
5201
  } catch (e) {
5383
5202
  return Promise.reject(e);
5384
5203
  }
5385
5204
  };
5386
5205
  var onEmployeeInfoChange = function onEmployeeInfoChange(args) {
5387
- var _extends8;
5206
+ var _extends6;
5388
5207
  var _name = args._name,
5389
5208
  _value = args._value,
5390
5209
  _isError = args._isError,
5391
5210
  _errorMsg = args._errorMsg;
5392
- console.log(_name, _value);
5393
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
5211
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends6 = {}, _extends6[_name] = _value, _extends6)));
5394
5212
  updateError(_name, _isError, _errorMsg);
5395
5213
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5396
- var _extends9;
5397
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends9 = {}, _extends9[_name] = true, _extends9)));
5214
+ var _extends7;
5215
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends7 = {}, _extends7[_name] = true, _extends7)));
5398
5216
  }
5399
5217
  };
5400
5218
  var getUserTagTypeId = function getUserTagTypeId(name) {
@@ -5404,9 +5222,9 @@ var UserAddEdit = function UserAddEdit(props) {
5404
5222
  return tag.id;
5405
5223
  };
5406
5224
  var onUserTagTypeChange = function onUserTagTypeChange(args) {
5407
- var _extends10;
5225
+ var _extends8;
5408
5226
  var e = args._event;
5409
- 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)));
5410
5228
  if (Object.hasOwnProperty.call(inputChangeLog, 'userTagType')) {
5411
5229
  updateInputChangeLog(_extends({}, inputChangeLog, {
5412
5230
  userTagType: true
@@ -5414,27 +5232,30 @@ var UserAddEdit = function UserAddEdit(props) {
5414
5232
  }
5415
5233
  };
5416
5234
  var onCustomFieldsChange = function onCustomFieldsChange(_ref2) {
5417
- var _extends11;
5235
+ var _extends9;
5418
5236
  var _name = _ref2._name,
5419
5237
  _value = _ref2._value;
5420
- setCustomFieldsInput(_extends({}, customFieldsInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5238
+ setCustomFieldsInput(_extends({}, customFieldsInput, (_extends9 = {}, _extends9[_name] = _value, _extends9)));
5421
5239
  };
5422
5240
  var onTravelApproversInputChange = function onTravelApproversInputChange(_ref3) {
5423
- var _extends12;
5241
+ var _extends10;
5424
5242
  var _name = _ref3._name,
5425
5243
  _value = _ref3._value;
5426
- console.log(_name, _value, 'travel');
5427
- setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5244
+ setTravelApproversInput(_extends({}, travelApproversInput, (_extends10 = {}, _extends10[_name] = _value, _extends10)));
5428
5245
  };
5429
5246
  var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
5430
- var _extends13;
5247
+ var _extends11;
5431
5248
  var _name = _ref4._name,
5432
5249
  _value = _ref4._value;
5433
- setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
5250
+ setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5434
5251
  };
5435
5252
  var onMemInfoInputChange = function onMemInfoInputChange(index, key, val) {
5436
5253
  var _membershipInfoInput = [].concat(membershipInfoInput);
5437
- _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
+ }
5438
5259
  _membershipInfoInput[index].isEditMode = isEditMode;
5439
5260
  setMembershipInfoInput(_membershipInfoInput);
5440
5261
  };
@@ -5464,39 +5285,39 @@ var UserAddEdit = function UserAddEdit(props) {
5464
5285
  setMembershipInfoInput(_membershipInfoInputTemp);
5465
5286
  };
5466
5287
  var travelPreferenceOnChange = function travelPreferenceOnChange(args) {
5467
- var _extends14;
5288
+ var _extends12;
5468
5289
  var _name = args._name,
5469
5290
  _value = args._value,
5470
5291
  _isError = args._isError,
5471
5292
  _errorMsg = args._errorMsg;
5472
- settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
5293
+ settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5473
5294
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5474
- var _extends15;
5475
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
5295
+ var _extends13;
5296
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends13 = {}, _extends13[_name] = true, _extends13)));
5476
5297
  }
5477
5298
  updateError(_name, _isError, _errorMsg);
5478
5299
  };
5479
5300
  var onSecureTraveelerInfoInputChange = function onSecureTraveelerInfoInputChange(args) {
5480
- var _extends16;
5301
+ var _extends14;
5481
5302
  var _name = args._name,
5482
5303
  _value = args._value,
5483
5304
  _isError = args._isError,
5484
5305
  _errorMsg = args._errorMsg;
5485
- setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
5306
+ setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
5486
5307
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5487
- var _extends17;
5488
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
5308
+ var _extends15;
5309
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
5489
5310
  }
5490
5311
  updateError(_name, _isError, _errorMsg);
5491
5312
  };
5492
5313
  var onPassportInfoInputChange = function onPassportInfoInputChange(args) {
5493
5314
  try {
5494
- var _temp8 = function _temp8() {
5495
- var _extends18;
5496
- 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)));
5497
5318
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5498
- var _extends19;
5499
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends19 = {}, _extends19[_name] = true, _extends19)));
5319
+ var _extends17;
5320
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
5500
5321
  }
5501
5322
  updateError(_name, _isError, _errorMsg);
5502
5323
  };
@@ -5534,9 +5355,9 @@ var UserAddEdit = function UserAddEdit(props) {
5534
5355
  }
5535
5356
  return Promise.resolve();
5536
5357
  }
5537
- var _temp7 = function () {
5358
+ var _temp15 = function () {
5538
5359
  if (_name === 'passport_photo' || _name === 'travel_docs') {
5539
- var _temp6 = function () {
5360
+ var _temp16 = function () {
5540
5361
  if (_obj.isUpload) {
5541
5362
  var checkAlreadyUploadedFiles = uploadedFiles.filter(function (_file) {
5542
5363
  if (_name === 'passport_photo') {
@@ -5580,10 +5401,10 @@ var UserAddEdit = function UserAddEdit(props) {
5580
5401
  setFilesForDelete([].concat(filesForDelete, _deletedFiles));
5581
5402
  }
5582
5403
  }();
5583
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
5404
+ if (_temp16 && _temp16.then) return _temp16.then(function () {});
5584
5405
  }
5585
5406
  }();
5586
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
5407
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
5587
5408
  } catch (e) {
5588
5409
  return Promise.reject(e);
5589
5410
  }
@@ -5602,8 +5423,8 @@ var UserAddEdit = function UserAddEdit(props) {
5602
5423
  return _errorArray;
5603
5424
  });
5604
5425
  setErrorMsgs(function (prevState) {
5605
- var _extends20;
5606
- return _extends({}, prevState, (_extends20 = {}, _extends20[_name] = _errorMsg, _extends20));
5426
+ var _extends18;
5427
+ return _extends({}, prevState, (_extends18 = {}, _extends18[_name] = _errorMsg, _extends18));
5607
5428
  });
5608
5429
  };
5609
5430
  var dispatch = reactRedux.useDispatch();
@@ -5635,8 +5456,6 @@ var UserAddEdit = function UserAddEdit(props) {
5635
5456
  }
5636
5457
  }));
5637
5458
  dispatch(fetchCountryCodes()).then(function (_res) {
5638
- setCountryContactCode(_res);
5639
- console.log('this is new', _res);
5640
5459
  if (isEditMode) {
5641
5460
  if (!isProfile && !editUserId) return false;
5642
5461
  dispatch(setStaticFieldsVisibility({
@@ -5679,20 +5498,6 @@ var UserAddEdit = function UserAddEdit(props) {
5679
5498
  value: '',
5680
5499
  label: 'Select employee level'
5681
5500
  },
5682
- manager_id: res.employee_info.manager ? {
5683
- value: res.employee_info.manager,
5684
- label: res.employee_info.manager
5685
- } : {
5686
- value: '',
5687
- label: 'Select Manager'
5688
- },
5689
- skip_manager_id: res.employee_info.skip_manager ? {
5690
- value: res.employee_info.skip_manager,
5691
- label: res.employee_info.skip_manager
5692
- } : {
5693
- value: '',
5694
- label: 'Select Manager'
5695
- },
5696
5501
  employee_id: res.employee_info.employee_id || '',
5697
5502
  entity: res.employee_info.entity ? {
5698
5503
  value: res.employee_info.entity.id,
@@ -5878,6 +5683,7 @@ var UserAddEdit = function UserAddEdit(props) {
5878
5683
  required: true
5879
5684
  }
5880
5685
  }));
5686
+
5881
5687
  var _productAccess = _extends({}, productAccess);
5882
5688
  renderFields.products.forEach(function (product) {
5883
5689
  _productAccess[product.name] = true;
@@ -5925,7 +5731,7 @@ var UserAddEdit = function UserAddEdit(props) {
5925
5731
  }, [renderFields.expenseApprovers]);
5926
5732
  var uploadDocs = function uploadDocs(docToUpload, type) {
5927
5733
  try {
5928
- var _temp10 = function _temp10() {
5734
+ var _temp19 = function _temp19() {
5929
5735
  setUploadedFiles([].concat(uploadedFiles, data));
5930
5736
  dispatch(stopLoader());
5931
5737
  return data;
@@ -5941,12 +5747,12 @@ var UserAddEdit = function UserAddEdit(props) {
5941
5747
  userID: editUserId
5942
5748
  });
5943
5749
  });
5944
- var _temp9 = _forTo(docs, function (i) {
5750
+ var _temp20 = _forTo(docs, function (i) {
5945
5751
  return Promise.resolve(dispatch(uploadSingleDocumnet(docs[i]))).then(function (res) {
5946
5752
  data.push(res);
5947
5753
  });
5948
5754
  });
5949
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9));
5755
+ return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
5950
5756
  } catch (e) {
5951
5757
  return Promise.reject(e);
5952
5758
  }
@@ -5958,13 +5764,6 @@ var UserAddEdit = function UserAddEdit(props) {
5958
5764
  IUIToastMessageService$4.warningNotify(checkAnyError);
5959
5765
  return Promise.resolve();
5960
5766
  }
5961
- console.log(employeeInfoInput, 'data');
5962
- if (employeeInfoInput.manager_id.value !== '') {
5963
- employeeInfoInput.manager_id = employeeInfoInput.manager.value;
5964
- }
5965
- if (employeeInfoInput.skip_manager_id.value !== '') {
5966
- employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
5967
- }
5968
5767
  var payload = {
5969
5768
  personalInfoInput: personalInfoInput,
5970
5769
  employeeInfoInput: employeeInfoInput,
@@ -6022,7 +5821,6 @@ var UserAddEdit = function UserAddEdit(props) {
6022
5821
  }
6023
5822
  }
6024
5823
  for (var _key in employeeInfo) {
6025
- console.log('key', _key);
6026
5824
  if (Object.hasOwnProperty.call(employeeInfo, _key)) {
6027
5825
  if (employeeInfo[_key] === false && employeeInfoInput[_key] !== undefined && (typeof employeeInfoInput[_key] === 'string' && !employeeInfoInput[_key] || typeof employeeInfoInput[_key] === 'object' && !employeeInfoInput[_key].value) && fieldsVisibility.employee_info[_key] !== 2) {
6028
5826
  _isError = true;
@@ -6082,7 +5880,8 @@ var UserAddEdit = function UserAddEdit(props) {
6082
5880
  }
6083
5881
  _errorMsgs.passport_issue_date = '';
6084
5882
  }
6085
- 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) {
6086
5885
  _isError = true;
6087
5886
  if (_errorArray.indexOf('passport_photo') === -1) {
6088
5887
  _errorArray.push('passport_photo');
@@ -6094,7 +5893,8 @@ var UserAddEdit = function UserAddEdit(props) {
6094
5893
  }
6095
5894
  _errorMsgs.passport_photo = '';
6096
5895
  }
6097
- 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) {
6098
5898
  _isError = true;
6099
5899
  if (_errorArray.indexOf('travel_docs') === -1) {
6100
5900
  _errorArray.push('travel_docs');
@@ -6110,60 +5910,58 @@ var UserAddEdit = function UserAddEdit(props) {
6110
5910
  if (_isError) {
6111
5911
  setErrorArray(_errorArray);
6112
5912
  setErrorMsgs(_errorMsgs);
6113
- var _loop = function _loop() {
5913
+ for (var _key3 in _errorMsgs) {
6114
5914
  if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
6115
5915
  if (_errorMsgs[_key3]) {
6116
- if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
6117
- setAdditionalInfoFlag('open');
6118
- }
6119
- var el = document.getElementById(_key3 === 'country_code' || _key3 === 'contact_country_code' ? 'contact_number' : _key3);
6120
- if (el) {
6121
- setTimeout(function () {
6122
- el.scrollIntoView({
6123
- behavior: 'smooth',
6124
- block: 'center'
6125
- });
6126
- }, 500);
6127
- return "break";
6128
- }
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;
6129
5932
  }
6130
5933
  }
6131
- };
6132
- for (var _key3 in _errorMsgs) {
6133
- var _ret = _loop();
6134
- if (_ret === "break") break;
6135
5934
  }
5935
+ return Promise.resolve();
6136
5936
  }
6137
- if (!_isError) {
6138
- if (isEditMode && editUserId || isProfile) {
6139
- dispatch(showLoader());
6140
- dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
6141
- if (isProfile) {
6142
- var _config$routes, _config$routes$profil, _config$routes$profil2;
6143
- (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);
6144
- } else {
6145
- var _config$routes2, _config$routes2$users, _config$routes2$users2;
6146
- (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;
6147
5951
  }
6148
- setFilesForDelete([]);
6149
- setProfilePicDelete([]);
6150
- })["catch"](function (err) {
6151
- if (typeof err === 'object') {
6152
- if (err.country_code) {
6153
- err.contact_number = err.country_code;
6154
- }
6155
- if (err.contact_country_code) {
6156
- err.contact_number = err.contact_country_code;
6157
- }
6158
- if (err.passport) {
6159
- err.passport_photo = _extends({}, err.passport);
6160
- delete err.passport;
6161
- }
6162
- setErrorArray(Object.keys(err));
6163
- setErrorMsgs(err);
6164
- var _loop2 = function _loop2() {
6165
- if (Object.hasOwnProperty.call(err, _key4)) {
6166
- 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 () {
6167
5965
  if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
6168
5966
  setAdditionalInfoFlag('open');
6169
5967
  }
@@ -6177,43 +5975,42 @@ var UserAddEdit = function UserAddEdit(props) {
6177
5975
  }, 500);
6178
5976
  return "break";
6179
5977
  }
6180
- }
5978
+ }();
5979
+ if (_ret2 === "break") break;
6181
5980
  }
6182
- };
6183
- for (var _key4 in err) {
6184
- var _ret2 = _loop2();
6185
- if (_ret2 === "break") break;
6186
5981
  }
6187
- } else if (typeof err === 'string') {
6188
- IUIToastMessageService$4.warningNotify(err);
6189
- } else {
6190
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6191
5982
  }
6192
- })["finally"](function () {
6193
- dispatch(stopLoader());
6194
- });
6195
- } else {
6196
- dispatch(showLoader());
6197
- dispatch(createUser(payload)).then(function (res) {
6198
- var _config$routes3, _config$routes3$users, _config$routes3$users2;
6199
- (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);
6200
- })["catch"](function (err) {
6201
- if (typeof err === 'object') {
6202
- if (err.country_code) {
6203
- err.contact_number = err.country_code;
6204
- }
6205
- if (err.contact_country_code) {
6206
- err.contact_number = err.contact_country_code;
6207
- }
6208
- if (err.passport) {
6209
- err.passport_photo = _extends({}, err.passport);
6210
- delete err.passport;
6211
- }
6212
- setErrorArray(Object.keys(err));
6213
- setErrorMsgs(err);
6214
- var _loop3 = function _loop3() {
6215
- if (Object.hasOwnProperty.call(err, _key5)) {
6216
- 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 () {
6217
6014
  if (_key5 in passportInfoInput || _key5 in travelPreferenceInfo || _key5 in secureTravelInputInfo) {
6218
6015
  setAdditionalInfoFlag('open');
6219
6016
  }
@@ -6227,22 +6024,19 @@ var UserAddEdit = function UserAddEdit(props) {
6227
6024
  }, 500);
6228
6025
  return "break";
6229
6026
  }
6230
- }
6027
+ }();
6028
+ if (_ret3 === "break") break;
6231
6029
  }
6232
- };
6233
- for (var _key5 in err) {
6234
- var _ret3 = _loop3();
6235
- if (_ret3 === "break") break;
6236
6030
  }
6237
- } else if (typeof err === 'string') {
6238
- IUIToastMessageService$4.warningNotify(err);
6239
- } else {
6240
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6241
6031
  }
6242
- })["finally"](function () {
6243
- dispatch(stopLoader());
6244
- });
6245
- }
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
+ });
6246
6040
  }
6247
6041
  return Promise.resolve();
6248
6042
  } catch (e) {
@@ -6258,7 +6052,8 @@ var UserAddEdit = function UserAddEdit(props) {
6258
6052
  window.location.href = config.routes.profile.redirectUrl.cancel;
6259
6053
  }
6260
6054
  }
6261
- } else {
6055
+ }
6056
+ else {
6262
6057
  var _config$routes4, _config$routes4$users, _config$routes4$users2;
6263
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);
6264
6059
  }
@@ -6280,14 +6075,18 @@ var UserAddEdit = function UserAddEdit(props) {
6280
6075
  if (verifyUserId) {
6281
6076
  dispatch(showLoader());
6282
6077
  dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
6283
- console.log('this is response', res);
6284
- setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
6285
6078
  setPersonalInfoInput(function (prevState) {
6286
6079
  return _extends({}, prevState, {
6287
- first_name: res.first_name,
6288
- last_name: res.last_name,
6080
+ first_name: res.fname,
6081
+ last_name: res.lname,
6289
6082
  email: res.email,
6290
- 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
+
6291
6090
  gender: function () {
6292
6091
  if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
6293
6092
  }()
@@ -6332,6 +6131,7 @@ var UserAddEdit = function UserAddEdit(props) {
6332
6131
  }()
6333
6132
  });
6334
6133
  });
6134
+
6335
6135
  if (res.client_admin) {
6336
6136
  setTravelApproversInput(function (prevState) {
6337
6137
  var nextState = _extends({}, prevState);
@@ -6365,6 +6165,7 @@ var UserAddEdit = function UserAddEdit(props) {
6365
6165
  });
6366
6166
  }
6367
6167
  };
6168
+
6368
6169
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
6369
6170
  component: "div",
6370
6171
  className: styles.UUIUserManagementAddEdit
@@ -6381,7 +6182,8 @@ var UserAddEdit = function UserAddEdit(props) {
6381
6182
  className: styles.breadcrumb
6382
6183
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBreadCrumb, {
6383
6184
  breadCrumbs: [{
6384
- href: config.routes.users.list.path,
6185
+ href:
6186
+ config.routes.users.list.path,
6385
6187
  label: 'Users',
6386
6188
  hasLink: true
6387
6189
  }]
@@ -6450,9 +6252,6 @@ var UserAddEdit = function UserAddEdit(props) {
6450
6252
  if (!p.visibility) {
6451
6253
  return null;
6452
6254
  }
6453
- if (p.name === 'profile_pic' && config.env.isExpenseProduct) {
6454
- return null;
6455
- }
6456
6255
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
6457
6256
  item: true,
6458
6257
  sm: 12,
@@ -6831,13 +6630,17 @@ var uploadBulkUsersFile = function uploadBulkUsersFile(payload) {
6831
6630
  });
6832
6631
  };
6833
6632
  };
6633
+
6834
6634
  var uploadFileToS3$1 = function uploadFileToS3(presignedPostData, file) {
6835
6635
  return new Promise(function (resolve, reject) {
6836
6636
  var formData = new FormData();
6637
+
6837
6638
  Object.keys(presignedPostData.fields).forEach(function (key) {
6838
6639
  formData.append(key, presignedPostData.fields[key]);
6839
6640
  });
6641
+
6840
6642
  formData.append('file', file);
6643
+
6841
6644
  axios.post(presignedPostData.url, formData, {
6842
6645
  headers: {
6843
6646
  'Content-Type': 'multipart/form-data'
@@ -6954,7 +6757,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
6954
6757
  };
6955
6758
  };
6956
6759
 
6957
- 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"};
6958
6761
 
6959
6762
  var BulkUploadModal = function BulkUploadModal(props) {
6960
6763
  var isOpenImportUsersModal = props.isOpenImportUsersModal,
@@ -7023,7 +6826,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
7023
6826
  file: doc
7024
6827
  });
7025
6828
  });
7026
- var _temp = _forTo(docs, function (i) {
6829
+ var _temp2 = _forTo(docs, function (i) {
7027
6830
  return Promise.resolve(dispatch(uploadBulkUsersFile(docs[i]))).then(function (res) {
7028
6831
  return Promise.resolve(dispatch(validateUploadedFile(res.user_file_name)).then(function (validatedRes) {
7029
6832
  if (validatedRes.data.status) {
@@ -7063,7 +6866,7 @@ var BulkUploadModal = function BulkUploadModal(props) {
7063
6866
  })).then(function () {});
7064
6867
  });
7065
6868
  });
7066
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
6869
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
7067
6870
  } catch (e) {
7068
6871
  return Promise.reject(e);
7069
6872
  }
@@ -7238,6 +7041,7 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
7238
7041
  setOpenImportUsersModal(false);
7239
7042
  handleImportPagenavigation(jobId);
7240
7043
  };
7044
+
7241
7045
  var handleDownloadRecords = function handleDownloadRecords(type) {
7242
7046
  try {
7243
7047
  setDownlStatus(true);
@@ -8263,6 +8067,7 @@ var DropdownBtn = function DropdownBtn(props) {
8263
8067
  if (val.disable) return false;
8264
8068
  if (val.handler && typeof val.handler === 'function') val.handler();
8265
8069
  };
8070
+
8266
8071
  var prevOpen = React__default.useRef(open);
8267
8072
  React__default.useEffect(function () {
8268
8073
  if (prevOpen.current === true && open === false) {
@@ -8377,10 +8182,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8377
8182
  selected = props.selected,
8378
8183
  _props$handleSingleCh = props.handleSingleCheckBoxClick,
8379
8184
  handleSingleCheckBoxClick = _props$handleSingleCh === void 0 ? function () {} : _props$handleSingleCh,
8380
- _props$onResetPasswor = props.onResetPasswordHandler,
8381
- onResetPasswordHandler = _props$onResetPasswor === void 0 ? function () {} : _props$onResetPasswor,
8382
- _props$toggleInviteMo = props.toggleInviteModal,
8383
- toggleInviteModal = _props$toggleInviteMo === void 0 ? function () {} : _props$toggleInviteMo,
8384
8185
  orderBy = props.orderBy,
8385
8186
  order = props.order,
8386
8187
  _props$onRequestSort = props.onRequestSort,
@@ -8398,21 +8199,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8398
8199
  searchValue = props.searchValue,
8399
8200
  _props$isILadmin = props.isILadmin,
8400
8201
  isILadmin = _props$isILadmin === void 0 ? false : _props$isILadmin;
8401
- var useStyles = styles$8.makeStyles(function (theme) {
8402
- return {
8403
- tooltip: {
8404
- background: '#1F2937',
8405
- fontSize: '14px',
8406
- color: '#ffffff',
8407
- padding: '12px 16px',
8408
- borderRadius: '6px'
8409
- },
8410
- arrow: {
8411
- color: '#1F2937'
8412
- }
8413
- };
8414
- });
8415
- var classes = useStyles();
8416
8202
  var columns = [{
8417
8203
  id: 'first_name',
8418
8204
  label: 'Name',
@@ -8432,27 +8218,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8432
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
8433
8219
  }));
8434
8220
  }
8435
- }, {
8436
- id: 'first_name',
8437
- label: '',
8438
- minWidth: 60,
8439
- sortable: false,
8440
- cell: function cell(row) {
8441
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8442
- component: "div",
8443
- width: 80
8444
- }, row && row.has_visited === 0 ? /*#__PURE__*/React__default.createElement(Tooltip, {
8445
- title: "This user hasn't logged in to the platform yet",
8446
- arrow: true,
8447
- classes: {
8448
- arrow: classes.arrow,
8449
- tooltip: classes.tooltip
8450
- },
8451
- placement: "top-start"
8452
- }, /*#__PURE__*/React__default.createElement("div", {
8453
- className: clsx(styles$5.tooltipTextDiv)
8454
- }, "Invited")) : null);
8455
- }
8456
8221
  }, {
8457
8222
  id: 'emp_info__department__name',
8458
8223
  label: 'Department',
@@ -8540,21 +8305,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8540
8305
  return onEditHandler(row.id);
8541
8306
  }
8542
8307
  }];
8543
- if (row && row.has_visited && row.is_active) {
8544
- options.push({
8545
- label: 'Reset password',
8546
- handler: function handler() {
8547
- return onResetPasswordHandler(row.email);
8548
- }
8549
- });
8550
- } else if (row && row.is_active) {
8551
- options.push({
8552
- label: 'Resend invite',
8553
- handler: function handler() {
8554
- return toggleInviteModal(row.id, 'single', row.first_name, row.last_name);
8555
- }
8556
- });
8557
- }
8558
8308
  if (isILadmin) {
8559
8309
  options.push({
8560
8310
  label: 'Make primary admin',
@@ -8578,7 +8328,6 @@ var StickyHeadTable = function StickyHeadTable(props) {
8578
8328
  endIcon: null,
8579
8329
  outlinedBtn: false,
8580
8330
  className: "threedotMenuBtn",
8581
- MoreHorizIcon: true,
8582
8331
  placement: "bottom-end"
8583
8332
  }));
8584
8333
  },
@@ -8586,6 +8335,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8586
8335
  paddingLeft: '40px'
8587
8336
  }
8588
8337
  }];
8338
+
8589
8339
  return /*#__PURE__*/React__default.createElement(iuistyles.IUITable, {
8590
8340
  searchPlaceholder: "Search by name, email & department",
8591
8341
  isCheckboxTable: true,
@@ -8608,8 +8358,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8608
8358
  isDataFetching: isDataFetching,
8609
8359
  disableRowCheckbox: disableRowCheckbox,
8610
8360
  searchBoxWidth: "400px",
8611
- searchValue: searchValue,
8612
- hideTopPagination: false
8361
+ searchValue: searchValue
8613
8362
  });
8614
8363
  };
8615
8364
  var SingupRequests = function SingupRequests(props) {
@@ -8640,18 +8389,20 @@ var SingupRequests = function SingupRequests(props) {
8640
8389
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
8641
8390
  return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
8642
8391
  };
8392
+
8643
8393
  var columns = [{
8644
- id: 'first_name',
8394
+ id: 'fname',
8645
8395
  label: 'Name',
8646
8396
  minWidth: 250,
8647
8397
  sortable: true,
8648
8398
  cell: function cell(row) {
8649
8399
  var _row$profile_pic2;
8650
8400
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
8651
- firstName: row.first_name,
8652
- lastName: row.last_name,
8653
- isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
8654
- 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,
8655
8406
  secondaryText: row.email,
8656
8407
  letterAvatarTextColor: "black",
8657
8408
  letterAvatarBackgroundColor: "#d3d3d3",
@@ -8660,7 +8411,7 @@ var SingupRequests = function SingupRequests(props) {
8660
8411
  }));
8661
8412
  }
8662
8413
  }, {
8663
- id: 'created_at',
8414
+ id: 'created',
8664
8415
  label: 'Requested on',
8665
8416
  minWidth: 100,
8666
8417
  sortable: true,
@@ -8670,7 +8421,7 @@ var SingupRequests = function SingupRequests(props) {
8670
8421
  width: 100
8671
8422
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
8672
8423
  className: clsx(styles$5.rowText, styles$5.textTransform)
8673
- }, formatDate(row.created_at)));
8424
+ }, formatDate(row.created)));
8674
8425
  }
8675
8426
  }, {
8676
8427
  id: 'actions',
@@ -8724,89 +8475,11 @@ var SingupRequests = function SingupRequests(props) {
8724
8475
  });
8725
8476
  };
8726
8477
 
8727
- function InfoYellowIcon(props) {
8728
- return /*#__PURE__*/React__default.createElement("svg", {
8729
- width: props.width,
8730
- height: props.height,
8731
- viewBox: "0 0 20 20",
8732
- fill: "none",
8733
- xmlns: "http://www.w3.org/2000/svg"
8734
- }, /*#__PURE__*/React__default.createElement("path", {
8735
- 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",
8736
- fill: "#CA8A04"
8737
- }), /*#__PURE__*/React__default.createElement("path", {
8738
- 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",
8739
- fill: "#CA8A04"
8740
- }), /*#__PURE__*/React__default.createElement("path", {
8741
- 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",
8742
- fill: "#CA8A04"
8743
- }));
8744
- }
8745
-
8746
- function RedWarningIcon(props) {
8747
- var _props$color = props.color,
8748
- color = _props$color === void 0 ? '#E11D48' : _props$color,
8749
- _props$size = props.size,
8750
- size = _props$size === void 0 ? '14' : _props$size;
8751
- return /*#__PURE__*/React__default.createElement("svg", {
8752
- width: size,
8753
- height: size,
8754
- viewBox: "0 0 14 14",
8755
- fill: color,
8756
- xmlns: "http://www.w3.org/2000/svg"
8757
- }, /*#__PURE__*/React__default.createElement("path", {
8758
- 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",
8759
- fill: color
8760
- }));
8761
- }
8762
-
8763
- function InviteInfoIcon() {
8764
- return /*#__PURE__*/React__default.createElement("svg", {
8765
- xmlns: "http://www.w3.org/2000/svg",
8766
- width: "20",
8767
- height: "20",
8768
- fill: "none",
8769
- viewBox: "0 0 20 20"
8770
- }, /*#__PURE__*/React__default.createElement("path", {
8771
- fill: "#CA8A04",
8772
- 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"
8773
- }), /*#__PURE__*/React__default.createElement("path", {
8774
- fill: "#CA8A04",
8775
- 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"
8776
- }));
8777
- }
8778
-
8779
8478
  var IUIToastMessageService$7 = utils.services.IUIToastMessageService;
8780
- var env$7 = utils.configs.env,
8781
- api$7 = utils.configs.api;
8782
- var UndoButton = function UndoButton(_ref) {
8783
- var onUndo = _ref.onUndo,
8784
- msg = _ref.msg;
8785
- return /*#__PURE__*/React__default.createElement("div", {
8786
- style: {
8787
- display: 'flex',
8788
- flexDirection: 'row',
8789
- width: '270px',
8790
- justifyContent: 'space-between'
8791
- }
8792
- }, /*#__PURE__*/React__default.createElement("p", {
8793
- style: {
8794
- whiteSpace: 'nowrap',
8795
- paddingTop: '8px'
8796
- }
8797
- }, msg), /*#__PURE__*/React__default.createElement("p", {
8798
- onClick: onUndo,
8799
- style: {
8800
- whiteSpace: 'nowrap',
8801
- fontWeight: '600',
8802
- fontSize: '1rem',
8803
- padding: '8px 20px 0'
8804
- }
8805
- }, "UNDO"));
8806
- };
8807
- var UserList = function UserList(_ref2) {
8808
- var config = _ref2.config,
8809
- 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;
8810
8483
  env$7.init(config, isProfile);
8811
8484
  var history = reactRouterDom.useHistory();
8812
8485
  var _useSelector = reactRedux.useSelector(function (state) {
@@ -8816,49 +8489,27 @@ var UserList = function UserList(_ref2) {
8816
8489
  isDataFetching = _useSelector.isDataFetching,
8817
8490
  deactivatedUsers = _useSelector.deactivatedUsers,
8818
8491
  tabValue = _useSelector.tabValue;
8819
- var newSelecteds = userListInfo.results;
8820
- var _React$useState = React__default.useState(''),
8821
- deactivateUser = _React$useState[0],
8822
- setDeactivateUser = _React$useState[1];
8823
- var _React$useState2 = React__default.useState(null),
8824
- defaultId = _React$useState2[0],
8825
- setDefaultId = _React$useState2[1];
8826
- var _React$useState3 = React__default.useState(1),
8827
- page = _React$useState3[0],
8828
- setPage = _React$useState3[1];
8829
- var _useState = React.useState([]),
8830
- selectedUsersNotApprover = _useState[0],
8831
- setSelectedUsersNotApprover = _useState[1];
8832
- var _useState2 = React.useState([]),
8833
- selectedUsersApprover = _useState2[0],
8834
- 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];
8835
8510
  var _useState3 = React.useState(false),
8836
- isBulkDeactivateModalOpen = _useState3[0],
8837
- setIsBulkDeactivateModalOpen = _useState3[1];
8838
- var _React$useState4 = React__default.useState(''),
8839
- user = _React$useState4[0],
8840
- setUser = _React$useState4[1];
8841
- var _useState4 = React.useState(10),
8842
- rowsPerPage = _useState4[0],
8843
- setRowsPerPage = _useState4[1];
8844
- var _React$useState5 = React__default.useState({}),
8845
- selected = _React$useState5[0],
8846
- setSelected = _React$useState5[1];
8847
- var _React$useState6 = React__default.useState('asc'),
8848
- order = _React$useState6[0],
8849
- setOrder = _React$useState6[1];
8850
- var _React$useState7 = React__default.useState(false),
8851
- deactivateSingle = _React$useState7[0],
8852
- setDeactivateSingle = _React$useState7[1];
8853
- var _React$useState8 = React__default.useState('first_name'),
8854
- orderBy = _React$useState8[0],
8855
- setOrderBy = _React$useState8[1];
8856
- var _useState5 = React.useState(''),
8857
- searchValue = _useState5[0],
8858
- setSearchValue = _useState5[1];
8859
- var _useState6 = React.useState(false),
8860
- isOpenDeActivateModal = _useState6[0],
8861
- setOpenDeActivateModalFlag = _useState6[1];
8511
+ isOpenDeActivateModal = _useState3[0],
8512
+ setOpenDeActivateModalFlag = _useState3[1];
8862
8513
  var _useSelector2 = reactRedux.useSelector(function (state) {
8863
8514
  return state.common;
8864
8515
  }),
@@ -8866,140 +8517,69 @@ var UserList = function UserList(_ref2) {
8866
8517
  hasVerificationError = _useSelector2.hasVerificationError,
8867
8518
  isILadmin = _useSelector2.isILadmin,
8868
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];
8869
8529
  var _useState7 = React.useState(false),
8870
- isOpenImportUsersModal = _useState7[0],
8871
- setOpenImportUsersModal = _useState7[1];
8530
+ isSearchingChange = _useState7[0],
8531
+ setSearchingChange = _useState7[1];
8872
8532
  var _useState8 = React.useState(false),
8873
- approveeStatus = _useState8[0],
8874
- setApproveeStatus = _useState8[1];
8533
+ isSortingChangeTemp = _useState8[0],
8534
+ setSortingChangeTemp = _useState8[1];
8875
8535
  var _useState9 = React.useState(false),
8876
- isFileDownloading = _useState9[0],
8877
- setDownlStatus = _useState9[1];
8536
+ isSearchingChangeTemp = _useState9[0],
8537
+ setSearchingChangeTemp = _useState9[1];
8878
8538
  var _useState10 = React.useState(false),
8879
- isSortingChange = _useState10[0],
8880
- setSortingChange = _useState10[1];
8881
- var _useState11 = React.useState(false),
8882
- isSearchingChange = _useState11[0],
8883
- setSearchingChange = _useState11[1];
8884
- var _useState12 = React.useState(false),
8885
- isSortingChangeTemp = _useState12[0],
8886
- 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];
8887
8557
  var _useState13 = React.useState(false),
8888
- isSearchingChangeTemp = _useState13[0],
8889
- setSearchingChangeTemp = _useState13[1];
8558
+ isSignUpSortingChange = _useState13[0],
8559
+ setSignUpSortingChange = _useState13[1];
8890
8560
  var _useState14 = React.useState(false),
8891
- isApiFetching = _useState14[0],
8892
- setisApiFetching = _useState14[1];
8893
- var _useState15 = React.useState({
8894
- value: '',
8895
- label: 'Select approver'
8896
- }),
8897
- approverRole = _useState15[0],
8898
- 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];
8899
8566
  var _useState16 = React.useState(false),
8900
- showInviteModal = _useState16[0],
8901
- setToggleInviteModal = _useState16[1];
8902
- var _useState17 = React.useState(''),
8903
- userIds = _useState17[0],
8904
- setUserIds = _useState17[1];
8905
- var _React$useState9 = React__default.useState(false),
8906
- overlayMenu = _React$useState9[0],
8907
- setOverlayMenu = _React$useState9[1];
8908
- var _useState18 = React.useState(''),
8909
- userFirstName = _useState18[0],
8910
- setUserFirstName = _useState18[1];
8911
- var _useState19 = React.useState(''),
8912
- userLastName = _useState19[0],
8913
- setUserLastName = _useState19[1];
8914
- var _useState20 = React.useState(true),
8915
- isDisabledSubmitBtn = _useState20[0],
8916
- setIsDisabledSubmitBtn = _useState20[1];
8917
- useScrollPosition.useScrollPosition(function (_ref3) {
8918
- var prevPos = _ref3.prevPos,
8919
- currPos = _ref3.currPos;
8920
- if (prevPos.y - currPos.y > 0) {
8921
- if (currPos.y <= -275) {
8922
- setOverlayMenu(true);
8923
- }
8924
- } else {
8925
- if (currPos.y > -295) {
8926
- setOverlayMenu(false);
8927
- }
8928
- }
8929
- }, [overlayMenu]);
8930
- var scrollTo = function scrollTo(id) {
8931
- var el = document.getElementById(id);
8932
- window.scrollTo({
8933
- top: el.offsetTop,
8934
- behavior: 'smooth'
8935
- });
8936
- };
8937
- var _React$useState10 = React__default.useState(1),
8938
- signup_page = _React$useState10[0],
8939
- setSignUpPage = _React$useState10[1];
8940
- var _useState21 = React.useState(5),
8941
- signup_rowsPerPage = _useState21[0],
8942
- setSignUpRowsPerPage = _useState21[1];
8943
- var _React$useState11 = React__default.useState('asc'),
8944
- signup_order = _React$useState11[0],
8945
- setSignUpOrder = _React$useState11[1];
8946
- var _React$useState12 = React__default.useState('first_name'),
8947
- signup_orderBy = _React$useState12[0],
8948
- setSignUpOrderBy = _React$useState12[1];
8949
- var _useState22 = React.useState(''),
8950
- signup_searchValue = _useState22[0],
8951
- set_signup_SearchValue = _useState22[1];
8952
- var _useState23 = React.useState(false),
8953
- isSignUpSortingChange = _useState23[0],
8954
- setSignUpSortingChange = _useState23[1];
8955
- var _useState24 = React.useState(false),
8956
- isSignUpSearchingChange = _useState24[0],
8957
- setSignUpSearchingChange = _useState24[1];
8958
- var _useState25 = React.useState(false),
8959
- isSignUpSortingChangeTemp = _useState25[0],
8960
- setSignUpSortingChangeTemp = _useState25[1];
8961
- var _useState26 = React.useState(false),
8962
- isSignUpSearchingChangeTemp = _useState26[0],
8963
- setSignUpSearchingChangeTemp = _useState26[1];
8567
+ isSignUpSearchingChangeTemp = _useState16[0],
8568
+ setSignUpSearchingChangeTemp = _useState16[1];
8964
8569
  var _useSelector3 = reactRedux.useSelector(function (state) {
8965
8570
  return state.userList;
8966
8571
  }),
8967
8572
  signupRequestListInfo = _useSelector3.signupRequestListInfo;
8968
- var redirectToNotifications = function redirectToNotifications() {
8969
- if (config.routes.notification) {
8970
- history.push({
8971
- pathname: config.routes.notification.path
8972
- });
8973
- }
8974
- };
8975
8573
  var openDeactivateModal = function openDeactivateModal() {
8976
8574
  if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
8977
8575
  IUIToastMessageService$7.warningNotify('Select at least one user to deactivate.');
8978
8576
  return false;
8979
8577
  }
8980
- if (selectedUsersApprover.length) {
8981
- var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
8982
- var _SelectedUsersApprover = [].concat(selectedUsersApprover);
8983
- var _selected = Object.values(selected).flat();
8984
- _SelectedUsersNotApprover = _SelectedUsersNotApprover.filter(function (item) {
8985
- return _selected.includes(item.id.toString());
8986
- });
8987
- _SelectedUsersApprover = _SelectedUsersApprover.filter(function (item) {
8988
- return _selected.includes(item.id.toString());
8989
- });
8990
- setSelectedUsersNotApprover(_SelectedUsersNotApprover);
8991
- setSelectedUsersApprover(_SelectedUsersApprover);
8992
- setIsBulkDeactivateModalOpen(true);
8993
- } else {
8994
- setOpenDeActivateModalFlag(true);
8995
- }
8578
+ setOpenDeActivateModalFlag(true);
8996
8579
  };
8997
8580
  var closeDeActivateModal = function closeDeActivateModal() {
8998
8581
  setOpenDeActivateModalFlag(false);
8999
8582
  };
9000
- var closeDeActiveModal = function closeDeActiveModal() {
9001
- setIsBulkDeactivateModalOpen(false);
9002
- };
9003
8583
  var handleAddPageNavigation = function handleAddPageNavigation() {
9004
8584
  history.push(config.routes.users.add.path);
9005
8585
  };
@@ -9012,23 +8592,44 @@ var UserList = function UserList(_ref2) {
9012
8592
  var handleVerifyUserClick = function handleVerifyUserClick(userId) {
9013
8593
  history.push(config.routes.users.add.path + "?" + config.routes.users.add.queryParamKeys.verifyUserId + "=" + userId);
9014
8594
  };
8595
+ var UndoButton = function UndoButton(_ref2) {
8596
+ var msg = _ref2.msg,
8597
+ id = _ref2.id;
8598
+ return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
8599
+ display: "flex",
8600
+ flexDirection: "row",
8601
+ width: "270px"
8602
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
8603
+ style: {
8604
+ whiteSpace: 'nowrap',
8605
+ paddingTop: '8px'
8606
+ }
8607
+ }, msg), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
8608
+ type: "text",
8609
+ buttonText: "UNDO",
8610
+ style: {
8611
+ color: '#FFFFFF'
8612
+ },
8613
+ onClick: function onClick() {
8614
+ return dispatch(undoneSignUpRejection(id));
8615
+ }
8616
+ }));
8617
+ };
9015
8618
  var handleRejectUserClick = function handleRejectUserClick(userId) {
9016
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
+ }));
9017
8626
  if (res.status === true) {
9018
- var _res$data;
9019
- IUIToastMessageService$7.undoNotify( /*#__PURE__*/React__default.createElement(UndoButton, {
9020
- onUndo: function onUndo() {
9021
- return dispatch(undoneSignUpRejection(userId));
9022
- },
9023
- 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'
9024
- }));
9025
8627
  dispatch(showDataFetchingStatus());
9026
8628
  dispatch(fetchUserSignupRequests({
9027
8629
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9028
8630
  length: signup_rowsPerPage,
9029
8631
  page: signup_page,
9030
- search: signup_searchValue.trim(),
9031
- pagename: 'company'
8632
+ search: signup_searchValue.trim()
9032
8633
  })).then(function () {
9033
8634
  return dispatch(stopDataFetchingStatus());
9034
8635
  });
@@ -9047,25 +8648,12 @@ var UserList = function UserList(_ref2) {
9047
8648
  };
9048
8649
  var deselectingCheckboxHandler = function deselectingCheckboxHandler(page) {
9049
8650
  var _extends2;
9050
- var selectedId = [];
9051
- var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9052
- var _selectedUsersApprover = [].concat(selectedUsersApprover);
9053
- var _newSelecteds = newSelecteds.filter(function (n) {
8651
+ var newSelecteds = userListInfo.results.filter(function (n) {
9054
8652
  return n.is_active;
8653
+ }).map(function (obj) {
8654
+ return obj.id.toString();
9055
8655
  });
9056
- _newSelecteds.map(function (obj) {
9057
- if (selected && !Object.values(selected).flat().includes(obj.id.toString())) {
9058
- if (obj.roles.is_approver === true) {
9059
- _selectedUsersApprover.push(obj);
9060
- } else if (obj.roles.is_approver === false) {
9061
- _selectedUsersNotApprover.push(obj);
9062
- }
9063
- }
9064
- selectedId.push(obj.id.toString());
9065
- });
9066
- setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = selectedId, _extends2)));
9067
- setSelectedUsersNotApprover(_selectedUsersNotApprover);
9068
- setSelectedUsersApprover(_selectedUsersApprover);
8656
+ setSelected(_extends({}, selected, (_extends2 = {}, _extends2[page] = newSelecteds, _extends2)));
9069
8657
  };
9070
8658
  var handleSelectAllClick = function handleSelectAllClick(event, page) {
9071
8659
  var _extends3;
@@ -9092,145 +8680,49 @@ var UserList = function UserList(_ref2) {
9092
8680
  setSignUpSearchingChange(true);
9093
8681
  setSignUpSearchingChangeTemp(!isSignUpSearchingChangeTemp);
9094
8682
  };
9095
- var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page, data) {
8683
+ var handleSingleCheckBoxClick = function handleSingleCheckBoxClick(event, id, page) {
9096
8684
  var _extends4;
9097
8685
  var selectedTemp = _extends({}, selected);
9098
8686
  if (!(page in selectedTemp)) {
9099
8687
  selectedTemp[page] = [];
9100
8688
  }
9101
8689
  var selectedIndex = selectedTemp[page].indexOf(id);
9102
- var _newSelected = [];
8690
+ var newSelected = [];
9103
8691
  if (selectedIndex === -1) {
9104
- _newSelected = _newSelected.concat(selectedTemp[page], id);
8692
+ newSelected = newSelected.concat(selectedTemp[page], id);
9105
8693
  } else if (selectedIndex === 0) {
9106
- _newSelected = _newSelected.concat(selectedTemp[page].slice(1));
8694
+ newSelected = newSelected.concat(selectedTemp[page].slice(1));
9107
8695
  } else if (selectedIndex === selectedTemp[page].length - 1) {
9108
- _newSelected = _newSelected.concat(selectedTemp[page].slice(0, -1));
8696
+ newSelected = newSelected.concat(selectedTemp[page].slice(0, -1));
9109
8697
  } else if (selectedIndex > 0) {
9110
- _newSelected = _newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
9111
- }
9112
- var _SelectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9113
- var _SelectedUsersApprover = [].concat(selectedUsersApprover);
9114
- if (Object.values(selected).flat().includes(id.toString())) {
9115
- _SelectedUsersNotApprover = selectedUsersNotApprover.filter(function (item) {
9116
- return id !== item.id.toString();
9117
- });
9118
- _SelectedUsersApprover = selectedUsersApprover.filter(function (item) {
9119
- return item.id.toString() !== id;
9120
- });
9121
- } else if (data !== null && data !== void 0 && data.roles) {
9122
- if (data.roles.is_approver === true) {
9123
- _SelectedUsersApprover.push(data);
9124
- } else if (data.roles.is_approver === false) {
9125
- _SelectedUsersNotApprover.push(data);
9126
- }
8698
+ newSelected = newSelected.concat(selectedTemp[page].slice(0, selectedIndex), selectedTemp[page].slice(selectedIndex + 1));
9127
8699
  }
9128
- setSelectedUsersNotApprover(_SelectedUsersNotApprover);
9129
- setSelectedUsersApprover(_SelectedUsersApprover);
9130
- setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = _newSelected, _extends4)));
8700
+ setSelected(_extends({}, selected, (_extends4 = {}, _extends4[page] = newSelected, _extends4)));
9131
8701
  };
9132
- React.useEffect(function () {
9133
- setApproverRole({
9134
- value: '',
9135
- label: 'Select approver'
9136
- });
9137
- setDefaultId(null);
9138
- setIsDisabledSubmitBtn(true);
9139
- setApproveeStatus(false);
9140
- if (deactivateSingle === true) {
9141
- api$7.get(userAddEditUrl.transferAppover() + "user_id=" + user.id + "&page=1").then(function (response) {
9142
- if (response.data["default"].id) {
9143
- setDefaultId(response.data["default"].id);
9144
- setApproverRole({
9145
- value: '',
9146
- label: response.data["default"].email
9147
- });
9148
- setIsDisabledSubmitBtn(false);
9149
- setApproveeStatus(response.data["default"].approvee_status);
9150
- }
9151
- });
9152
- }
9153
- }, [deactivateSingle]);
9154
8702
  var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
9155
8703
  setRowsPerPage(+event.target.value);
9156
8704
  setPage(1);
9157
8705
  setSelected({});
9158
- setSelectedUsersNotApprover([]);
9159
- setSelectedUsersApprover([]);
9160
8706
  setSortingChange(true);
9161
8707
  setSortingChangeTemp(!isSortingChangeTemp);
9162
8708
  };
9163
8709
  var handleActiveUser = function handleActiveUser(e, id, page) {
9164
8710
  var isActive = e.target.checked;
9165
- var _isApprover;
9166
- newSelecteds.map(function (item) {
9167
- if (item.id === id) {
9168
- _isApprover = item.roles.is_approver;
9169
- if (_isApprover === true && isActive === false) {
9170
- setDeactivateSingle(true);
9171
- setDeactivateUser(item.first_name + ' ' + item.last_name);
9172
- setUser(item);
9173
- } else {
9174
- dispatch(updateActiveStatus(e.target.checked ? 1 : 0, e.target.id, _isApprover)).then(function () {
9175
- if (!isActive) {
9176
- if (Object.values(selected).flat().includes(id.toString())) {
9177
- var _extends5;
9178
- var selectedTemp = _extends({}, selected);
9179
- var _selectedUsersApprover = [].concat(selectedUsersApprover);
9180
- var _selectedUsersNotApprover = [].concat(selectedUsersNotApprover);
9181
- selectedTemp[page].splice(selectedTemp[page].indexOf(id.toString()), 1);
9182
- _selectedUsersApprover = _selectedUsersApprover.filter(function (item) {
9183
- return item.id != id;
9184
- });
9185
- _selectedUsersNotApprover = _selectedUsersNotApprover.filter(function (item) {
9186
- return item.id != id;
9187
- });
9188
- setSelected(_extends({}, selected, (_extends5 = {}, _extends5[page] = selectedTemp[page], _extends5)));
9189
- setSelectedUsersApprover(_selectedUsersApprover);
9190
- setSelectedUsersNotApprover(_selectedUsersNotApprover);
9191
- }
9192
- }
9193
- });
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)));
9194
8718
  }
9195
8719
  }
9196
8720
  });
9197
8721
  };
9198
- var selectApprover = function selectApprover(_ref4) {
9199
- var _value = _ref4._value;
9200
- if (_value.data.approvee_status) {
9201
- setApproveeStatus(true);
9202
- } else {
9203
- setApproveeStatus(false);
9204
- }
9205
- setDefaultId(_value.data.id);
9206
- setApproverRole(_value);
9207
- setIsDisabledSubmitBtn(false);
9208
- };
9209
- var handleDeactivateUser = function handleDeactivateUser() {
9210
- dispatch(updateActiveStatus(0, user.id, user.roles.is_approver, defaultId));
9211
- setOpenDeActivateModalFlag(false);
9212
- setDeactivateSingle(false);
9213
- setSelected({});
9214
- setSelectedUsersNotApprover([]);
9215
- setSelectedUsersApprover([]);
9216
- };
9217
8722
  var handleDeactivateUsers = function handleDeactivateUsers() {
9218
8723
  dispatch(deActivateUsers(Object.values(selected).flat()));
9219
8724
  setOpenDeActivateModalFlag(false);
9220
8725
  setSelected({});
9221
- setSelectedUsersNotApprover([]);
9222
- setSelectedUsersApprover([]);
9223
- setIsBulkDeactivateModalOpen(false);
9224
- };
9225
- var handleDeactivateSafeUsers = function handleDeactivateSafeUsers() {
9226
- var _selectedUsersNotApprover = selectedUsersNotApprover.map(function (item) {
9227
- return item.id;
9228
- });
9229
- dispatch(deActivateUsers(_selectedUsersNotApprover));
9230
- setIsBulkDeactivateModalOpen(false);
9231
- setSelected({});
9232
- setSelectedUsersNotApprover([]);
9233
- setSelectedUsersApprover([]);
9234
8726
  };
9235
8727
  var importUserHandler = function importUserHandler() {
9236
8728
  setOpenImportUsersModal(true);
@@ -9242,43 +8734,6 @@ var UserList = function UserList(_ref2) {
9242
8734
  setOpenImportUsersModal(false);
9243
8735
  handleImportPagenavigation(jobId);
9244
8736
  };
9245
- var onResetPasswordHandler = function onResetPasswordHandler(email) {
9246
- dispatch(resetPasswordForUser({
9247
- email: email
9248
- }));
9249
- };
9250
- var toggleInviteModal = function toggleInviteModal(ids, type, firstName, lastName) {
9251
- if (type === undefined) {
9252
- if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
9253
- IUIToastMessageService$7.warningNotify('Select at least one user to invite.');
9254
- return false;
9255
- }
9256
- }
9257
- setUserIds(ids);
9258
- setUserFirstName(firstName);
9259
- setUserLastName(lastName);
9260
- setToggleInviteModal(!showInviteModal);
9261
- };
9262
- var toggleInviteModalClose = function toggleInviteModalClose() {
9263
- setToggleInviteModal(!showInviteModal);
9264
- };
9265
- var onResendInviteHandler = function onResendInviteHandler() {
9266
- var userIdArr = [];
9267
- if (userIds && !isNaN(userIds)) {
9268
- userIdArr = [userIds];
9269
- } else if (Object.keys(selected).length) {
9270
- Object.values(selected).map(function (val, i) {
9271
- if (val.length) {
9272
- val.map(function (idx, i) {
9273
- userIdArr.push(idx);
9274
- });
9275
- }
9276
- });
9277
- }
9278
- setUserIds('');
9279
- dispatch(resendInviteForUser(userIdArr));
9280
- setToggleInviteModal(!showInviteModal);
9281
- };
9282
8737
  var handleExportUsers = function handleExportUsers() {
9283
8738
  try {
9284
8739
  setDownlStatus(true);
@@ -9318,9 +8773,6 @@ var UserList = function UserList(_ref2) {
9318
8773
  }, {
9319
8774
  label: 'Bulk action history',
9320
8775
  handler: handleBulkActionHistoryClick
9321
- }, {
9322
- label: 'Resend invite',
9323
- handler: toggleInviteModal
9324
8776
  }];
9325
8777
  React.useEffect(function () {
9326
8778
  var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
@@ -9332,9 +8784,6 @@ var UserList = function UserList(_ref2) {
9332
8784
  userId: userId
9333
8785
  }));
9334
8786
  };
9335
- var knowMore = function knowMore() {
9336
- window.open('https://itilite.notion.site/All-about-deactivating-users-77554de1fb494832ac7e344ca14277f0', '_blank');
9337
- };
9338
8787
  var dispatch = reactRedux.useDispatch();
9339
8788
  React.useEffect(function () {
9340
8789
  if (isTokenVerified === true) {
@@ -9348,7 +8797,6 @@ var UserList = function UserList(_ref2) {
9348
8797
  dispatch(fetchUsersList(url)).then(function () {
9349
8798
  setSearchingChange(false);
9350
8799
  setisApiFetching(false);
9351
- scrollTo('table-root');
9352
8800
  });
9353
8801
  }, 1000);
9354
8802
  return function () {
@@ -9362,8 +8810,7 @@ var UserList = function UserList(_ref2) {
9362
8810
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9363
8811
  length: signup_rowsPerPage,
9364
8812
  page: signup_page,
9365
- search: signup_searchValue.trim(),
9366
- pagename: 'company'
8813
+ search: signup_searchValue.trim()
9367
8814
  })).then(function () {
9368
8815
  setSignUpSearchingChange(false);
9369
8816
  setisApiFetching(false);
@@ -9375,7 +8822,6 @@ var UserList = function UserList(_ref2) {
9375
8822
  }
9376
8823
  if (isSortingChange) {
9377
8824
  setisApiFetching(true);
9378
- scrollTo('table-root');
9379
8825
  dispatch(fetchUsersList(url)).then(function () {
9380
8826
  setisApiFetching(false);
9381
8827
  setSortingChange(false);
@@ -9390,8 +8836,7 @@ var UserList = function UserList(_ref2) {
9390
8836
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9391
8837
  length: signup_rowsPerPage,
9392
8838
  page: signup_page,
9393
- search: signup_searchValue.trim(),
9394
- pagename: 'company'
8839
+ search: signup_searchValue.trim()
9395
8840
  })).then(function () {
9396
8841
  setisApiFetching(false);
9397
8842
  setSignUpSortingChange(false);
@@ -9407,8 +8852,7 @@ var UserList = function UserList(_ref2) {
9407
8852
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
9408
8853
  length: signup_rowsPerPage,
9409
8854
  page: signup_page,
9410
- search: signup_searchValue.trim(),
9411
- pagename: 'company'
8855
+ search: signup_searchValue.trim()
9412
8856
  })).then(function () {
9413
8857
  return dispatch(stopDataFetchingStatus());
9414
8858
  });
@@ -9416,89 +8860,15 @@ var UserList = function UserList(_ref2) {
9416
8860
  }
9417
8861
  }
9418
8862
  }, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
9419
- var topRightButtons = function topRightButtons() {
9420
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9421
- component: "div",
9422
- className: styles$5.buttonWrapper,
9423
- display: "flex",
9424
- justifyContent: "space-between",
9425
- alignItems: "center",
9426
- alignSelf: "flex-start"
9427
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9428
- component: "div",
9429
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9430
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9431
- buttonText: "Export all users",
9432
- type: "outlined",
9433
- startIcon: /*#__PURE__*/React__default.createElement(BulkDownloadIcon, {
9434
- width: "22",
9435
- height: "22"
9436
- }),
9437
- onClick: handleExportUsers
9438
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9439
- component: "div",
9440
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9441
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIDropdownButton, {
9442
- buttonText: "Bulk actions",
9443
- type: "outlined",
9444
- menuListInfo: BulkUploadInfo
9445
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9446
- component: "div",
9447
- className: "pageHeader--button-single button-right"
9448
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9449
- buttonText: "Add user",
9450
- type: "contained",
9451
- startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
9452
- width: "9",
9453
- height: "9",
9454
- color: "white"
9455
- }),
9456
- onClick: handleAddPageNavigation
9457
- })));
9458
- };
9459
8863
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9460
8864
  component: "div",
9461
8865
  className: styles$5.UUIUserManagementList
9462
- }, overlayMenu ? /*#__PURE__*/React__default.createElement(core.Box, {
9463
- className: styles$5.scrollOverlayMenu
9464
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9465
- component: "div",
9466
- className: clsx(styles$5.pageHeader)
9467
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9468
- component: "div",
9469
- display: "flex",
9470
- justifyContent: "space-between",
9471
- alignItems: "center",
9472
- flexWrap: "wrap",
9473
- style: {
9474
- gap: '1rem'
9475
- }
9476
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9477
- component: "div",
9478
- display: "flex",
9479
- flexDirection: "column",
9480
- style: {
9481
- gap: '0.5rem'
9482
- }
9483
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUISearch, {
9484
- placeholder: "Search by name, email & department",
9485
- value: searchValue,
9486
- onChangeHandler: function onChangeHandler(e) {
9487
- return onSearchHandler(e.target.value);
9488
- },
9489
- className: styles$5.overlaysearch
9490
- })), topRightButtons()), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9491
- component: "div",
9492
- display: "flex",
9493
- justifyContent: "space-between",
9494
- alignItems: "center"
9495
- }))) : '', !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, {
9496
8867
  open: isFileDownloading || isApiFetching,
9497
8868
  className: styles$5.backdrop
9498
8869
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUICircularProgress, {
9499
8870
  color: "inherit"
9500
8871
  })), isDataFetching ? /*#__PURE__*/React__default.createElement(SkeletonLoader, null) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9501
- id: "table-root",
9502
8872
  component: "div",
9503
8873
  className: clsx(styles$5.pageHeader)
9504
8874
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
@@ -9523,7 +8893,44 @@ var UserList = function UserList(_ref2) {
9523
8893
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9524
8894
  variant: "h3",
9525
8895
  className: clsx(styles$5.heading, styles$5.headingLarge)
9526
- }, 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, {
9527
8934
  component: "div",
9528
8935
  display: "flex",
9529
8936
  justifyContent: "space-between",
@@ -9568,9 +8975,7 @@ var UserList = function UserList(_ref2) {
9568
8975
  disableRowCheckbox: deactivatedUsers,
9569
8976
  searchValue: searchValue,
9570
8977
  isILadmin: isILadmin,
9571
- onPrimaryAdminHandler: onPrimaryAdminHandler,
9572
- onResetPasswordHandler: onResetPasswordHandler,
9573
- toggleInviteModal: toggleInviteModal
8978
+ onPrimaryAdminHandler: onPrimaryAdminHandler
9574
8979
  }))
9575
8980
  }, {
9576
8981
  label: /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, "Sign-up requests", ' ', /*#__PURE__*/React__default.createElement(TabLabelCount, {
@@ -9586,10 +8991,7 @@ var UserList = function UserList(_ref2) {
9586
8991
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9587
8992
  variant: "body2",
9588
8993
  className: clsx(styles$5.description)
9589
- }, "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", {
9590
- onClick: redirectToNotifications,
9591
- className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
9592
- }, "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, {
9593
8995
  data: signupRequestListInfo,
9594
8996
  handleChangeRowsPerPage: function handleChangeRowsPerPage(event) {
9595
8997
  setSignUpRowsPerPage(+event.target.value);
@@ -9621,54 +9023,6 @@ var UserList = function UserList(_ref2) {
9621
9023
  }))
9622
9024
  }]
9623
9025
  }))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9624
- isOpen: deactivateSingle,
9625
- closeHandler: function closeHandler() {
9626
- setDeactivateSingle(false);
9627
- },
9628
- cancelLabel: "Cancel",
9629
- submitLabel: "Deactivate",
9630
- submitHandler: handleDeactivateUser,
9631
- headerText: "Deactivate this user?",
9632
- width: "400px",
9633
- subHanderText: "",
9634
- submitBtnClass: styles$5.deactivateBtn,
9635
- isDisabledSubmitBtn: isDisabledSubmitBtn,
9636
- modalClass: "deactivateSingleModal",
9637
- modalBodyStyle: {
9638
- overflowY: 'unset'
9639
- }
9640
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9641
- className: clsx(styles$5.deactivateSingle, 'iui__mb-16')
9642
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9643
- className: styles$5.deactivateAlert
9644
- }, /*#__PURE__*/React__default.createElement(InfoYellowIcon, {
9645
- width: "9",
9646
- height: "9"
9647
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9648
- variant: "body2"
9649
- }, /*#__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", {
9650
- onClick: knowMore,
9651
- className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
9652
- }, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9653
- className: "iui__mt-15"
9654
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
9655
- isMove: true,
9656
- additional: {
9657
- page: 1,
9658
- product: 'travel',
9659
- userId: user.id
9660
- },
9661
- label: "Transfer approver role to",
9662
- value: approverRole,
9663
- onValueChange: selectApprover,
9664
- loadOption: transferRoleOptions,
9665
- disableText: "Please get in touch with your administrator to change this value.",
9666
- customLoadingText: "No results found"
9667
- }), approveeStatus && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9668
- className: "iui__d-flex iui__align-items-baseline iui__mr-5"
9669
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(RedWarningIcon, null)), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9670
- className: "iui__font--para-normal iui__font--color-black500 iui__mt-5 iui__ml-5"
9671
- }, "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, {
9672
9026
  isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
9673
9027
  closeHandler: closeDeActivateModal,
9674
9028
  cancelLabel: "Cancel",
@@ -9694,124 +9048,7 @@ var UserList = function UserList(_ref2) {
9694
9048
  className: styles$5.headerText
9695
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, {
9696
9050
  className: styles$5.description
9697
- }, "The", ' ', Object.values(selected).flat().length === 1 ? ' user ' : ' users ', "won\u2019t be able to access itilite platform"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9698
- isOpen: isBulkDeactivateModalOpen,
9699
- closeHandler: closeDeActiveModal,
9700
- cancelLabel: "Cancel",
9701
- submitLabel: "Deactivate safe users",
9702
- isDisabledSubmitBtn: !((selectedUsersNotApprover === null || selectedUsersNotApprover === void 0 ? void 0 : selectedUsersNotApprover.length) > 0),
9703
- submitBtnClass: clsx(styles$5.deactivateSubmitBtn),
9704
- customButtonLabel: "Deactivate all users",
9705
- customButtonHandler: handleDeactivateUsers,
9706
- submitHandler: handleDeactivateSafeUsers,
9707
- width: "640px",
9708
- customButtonClass: clsx(styles$5.deactivateCustomButtonClass),
9709
- headerText: "Deactivate users?",
9710
- modalBodyStyle: {
9711
- maxHeight: 'calc(100vh - 50vh)'
9712
- }
9713
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9714
- className: clsx(styles$5.deactivateAlert, styles$5.warningSvg)
9715
- }, /*#__PURE__*/React__default.createElement(RedWarningIcon, {
9716
- color: "#9A6700",
9717
- size: "14"
9718
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9719
- variant: "body2"
9720
- }, "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", {
9721
- onClick: knowMore,
9722
- className: "iui__cursor-pointer iui__border--bottom_solid_black500-1"
9723
- }, "Know more"))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9724
- className: "iui__my-15"
9725
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9726
- className: "iui__font--para-large iui__font--weight-medium"
9727
- }, "Users with roles"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9728
- className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
9729
- }, "Deactivating these users will affect the associated approval rules."), (selectedUsersApprover === null || selectedUsersApprover === void 0 ? void 0 : selectedUsersApprover.length) && selectedUsersApprover.map(function (item, index) {
9730
- var _item$data;
9731
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9732
- key: index,
9733
- className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
9734
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
9735
- firstName: item.first_name,
9736
- lastName: item.last_name,
9737
- isLetterAvatar: "true",
9738
- primaryText: item.first_name + ' ' + item.last_name,
9739
- secondaryText: item.email,
9740
- letterAvatarTextColor: "black",
9741
- letterAvatarBackgroundColor: "#d3d3d3",
9742
- profilePath: (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.profile_pic
9743
- }), /*#__PURE__*/React__default.createElement(RedWarningIcon, {
9744
- color: "#9A6700",
9745
- size: "14"
9746
- }));
9747
- })), selectedUsersNotApprover !== null && selectedUsersNotApprover !== void 0 && selectedUsersNotApprover.length ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement("hr", {
9748
- style: {
9749
- borderColor: '#E5E9ED'
9750
- }
9751
- }), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9752
- className: "iui__my-15"
9753
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9754
- className: "iui__font--para-large iui__font--weight-medium"
9755
- }, "Safe users"), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9756
- className: "iui__font--color-black500 iui__font--size-sm iui__mt-2"
9757
- }, "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) {
9758
- var _item$data2;
9759
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9760
- key: index,
9761
- className: "iui__d-flex iui__justify-content-spaceBetween iui__align-items-center iui__mt-10"
9762
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
9763
- firstName: item.first_name,
9764
- lastName: item.last_name,
9765
- isLetterAvatar: "true",
9766
- primaryText: item.first_name + ' ' + item.last_name,
9767
- secondaryText: item.email,
9768
- letterAvatarTextColor: "black",
9769
- letterAvatarBackgroundColor: "#d3d3d3",
9770
- profilePath: (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.profile_pic
9771
- }));
9772
- }))) : null), /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
9773
- isOpen: showInviteModal,
9774
- closeHandler: function closeHandler() {
9775
- return toggleInviteModalClose();
9776
- },
9777
- cancelLabel: "Cancel",
9778
- headerText: "Resend Invites?",
9779
- submitLabel: "Send",
9780
- submitHandler: function submitHandler() {
9781
- return onResendInviteHandler();
9782
- },
9783
- width: "400px",
9784
- modalBodyStyle: {
9785
- padding: '0px'
9786
- },
9787
- footerStyle: {
9788
- justifyContent: 'center'
9789
- }
9790
- }, /*#__PURE__*/React__default.createElement("div", {
9791
- style: {
9792
- display: 'flex',
9793
- padding: '16px',
9794
- margin: '8px 24px',
9795
- border: '1px solid #FDE047',
9796
- background: '#FEFCE8',
9797
- borderRadius: '5px'
9798
- }
9799
- }, /*#__PURE__*/React__default.createElement("div", {
9800
- style: {
9801
- marginRight: '5px'
9802
- }
9803
- }, /*#__PURE__*/React__default.createElement(InviteInfoIcon, null)), /*#__PURE__*/React__default.createElement("div", {
9804
- style: {
9805
- fontSize: '14px',
9806
- color: '#374151'
9807
- }
9808
- }, "This invitation will be sent to", ' ', /*#__PURE__*/React__default.createElement("span", {
9809
- style: {
9810
- fontSize: '14px',
9811
- color: '#374151',
9812
- fontWeight: 'bold'
9813
- }
9814
- }, 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, {
9815
9052
  isOpenImportUsersModal: isOpenImportUsersModal,
9816
9053
  closeImportUsersModal: closeImportUsersModal,
9817
9054
  closeImportModal: closeImportModal
@@ -9820,8 +9057,8 @@ var UserList = function UserList(_ref2) {
9820
9057
  errMsg: hasVerificationError
9821
9058
  }));
9822
9059
  };
9823
- var TabLabelCount = function TabLabelCount(_ref5) {
9824
- var count = _ref5.count;
9060
+ var TabLabelCount = function TabLabelCount(_ref3) {
9061
+ var count = _ref3.count;
9825
9062
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9826
9063
  className: styles$5.TabLabelCount
9827
9064
  }, " ", count, " ");
@@ -9896,12 +9133,11 @@ function Header(props) {
9896
9133
  })));
9897
9134
  }
9898
9135
 
9899
- 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"};
9900
9137
 
9901
9138
  function Listview(_ref) {
9902
9139
  var data = _ref.data,
9903
9140
  name = _ref.name,
9904
- tableName = _ref.tableName,
9905
9141
  handleEditDialog = _ref.handleEditDialog,
9906
9142
  handleDeleteDialog = _ref.handleDeleteDialog,
9907
9143
  orderBy = _ref.orderBy,
@@ -9914,87 +9150,21 @@ function Listview(_ref) {
9914
9150
  handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
9915
9151
  page = _ref.page,
9916
9152
  rowsPerPage = _ref.rowsPerPage;
9917
- var deptHeadDetails = function deptHeadDetails(data) {
9918
- var _data$dept_head_detai;
9919
- 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) {
9920
- return data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name;
9921
- }
9922
- };
9923
9153
  var columns = [{
9924
9154
  id: 'name',
9925
9155
  label: name,
9926
- width: '40%',
9927
- sortable: true,
9928
- cell: function cell(row) {
9929
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9930
- component: "div"
9931
- }, row.name);
9932
- }
9933
- }, {
9934
- id: 'no_of_users',
9935
- label: 'Number of users',
9936
- width: '40%',
9937
- sortable: true,
9938
- cell: function cell(row) {
9939
- return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9940
- component: "div"
9941
- }, row.no_of_users);
9942
- }
9943
- }, {
9944
- id: 'actions',
9945
- label: 'Actions',
9946
- width: '20%',
9947
- cell: function cell(row) {
9948
- return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9949
- display: "flex"
9950
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9951
- buttonText: "Edit",
9952
- className: styles$7.buttonWidth,
9953
- onClick: function onClick() {
9954
- return handleEditDialog(row);
9955
- }
9956
- }), row.no_of_users > 0 ? /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9957
- buttonText: "Delete",
9958
- className: styles$7.buttonWidth,
9959
- onClick: function onClick() {
9960
- return handleDeleteDialog(row, true);
9961
- }
9962
- }) : /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
9963
- buttonText: "Delete",
9964
- className: styles$7.buttonWidth,
9965
- onClick: function onClick() {
9966
- return handleDeleteDialog(row, false);
9967
- }
9968
- }));
9969
- }
9970
- }];
9971
- var departmentColumns = [{
9972
- id: 'name',
9973
- label: name,
9974
- width: '30%',
9156
+ width: '45%',
9975
9157
  sortable: true,
9976
9158
  cell: function cell(row) {
9977
9159
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9978
9160
  component: "div"
9979
9161
  }, row.name);
9980
9162
  }
9981
- }, {
9982
- id: 'department_head',
9983
- label: 'Department head',
9984
- width: '30%',
9985
- sortable: true,
9986
- cell: function cell(row) {
9987
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9988
- component: "div"
9989
- }, deptHeadDetails(row)), row.is_default_dept_head && /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
9990
- className: clsx(styles$7.rowText, styles$7.textTransform, styles$7.lightColor)
9991
- }, "Assigned by default"));
9992
- }
9993
9163
  }, {
9994
9164
  id: 'no_of_users',
9995
9165
  label: 'Number of users',
9996
9166
  width: '45%',
9997
- sortable: false,
9167
+ sortable: true,
9998
9168
  cell: function cell(row) {
9999
9169
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10000
9170
  component: "div"
@@ -10003,7 +9173,7 @@ function Listview(_ref) {
10003
9173
  }, {
10004
9174
  id: 'actions',
10005
9175
  label: 'Actions',
10006
- width: '15%',
9176
+ width: '10%',
10007
9177
  cell: function cell(row) {
10008
9178
  return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10009
9179
  display: "flex"
@@ -10036,7 +9206,7 @@ function Listview(_ref) {
10036
9206
  hasFilter: true,
10037
9207
  isCheckboxTable: false,
10038
9208
  count: data.count,
10039
- columns: tableName === 'department' ? departmentColumns : columns,
9209
+ columns: columns,
10040
9210
  rows: data.results,
10041
9211
  page: page,
10042
9212
  handleChangePage: handleChangePage,
@@ -10093,44 +9263,16 @@ function EditPanelDialog(_ref) {
10093
9263
  var isOpen = _ref.isOpen,
10094
9264
  closeHandler = _ref.closeHandler,
10095
9265
  onValueChange = _ref.onValueChange,
10096
- _submitHandler = _ref.submitHandler,
9266
+ submitHandler = _ref.submitHandler,
10097
9267
  isError = _ref.isError,
10098
9268
  name = _ref.name,
10099
9269
  isDisabledSubmitBtn = _ref.isDisabledSubmitBtn,
10100
- validation = _ref.validation,
10101
- rowData = _ref.rowData,
10102
- tableName = _ref.tableName,
10103
- config = _ref.config;
9270
+ validation = _ref.validation;
10104
9271
  var _useSelector = reactRedux.useSelector(function (state) {
10105
9272
  return state.userPanel;
10106
9273
  }),
10107
9274
  dialogData = _useSelector.dialogData;
10108
- var deptHeadDetails = function deptHeadDetails(data) {
10109
- var _data$dept_head_detai;
10110
- 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) {
10111
- setHead({
10112
- value: data.dept_head_details[0].id,
10113
- label: data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name
10114
- });
10115
- }
10116
- };
10117
- var _useState = React.useState({
10118
- value: '',
10119
- label: 'Select'
10120
- }),
10121
- head = _useState[0],
10122
- setHead = _useState[1];
10123
- React.useEffect(function () {
10124
- deptHeadDetails(rowData);
10125
- }, [rowData]);
10126
- var history = reactRouterDom.useHistory();
10127
- var handleAddPageNavigation = function handleAddPageNavigation() {
10128
- console.log(rowData);
10129
- history.push({
10130
- pathname: config.routes.users.add.path,
10131
- state: rowData
10132
- });
10133
- };
9275
+
10134
9276
  return /*#__PURE__*/React__default.createElement(iuistyles.IUIModal, {
10135
9277
  isDisabledSubmitBtn: isDisabledSubmitBtn,
10136
9278
  isOpen: isOpen,
@@ -10138,60 +9280,27 @@ function EditPanelDialog(_ref) {
10138
9280
  headerText: "Edit " + name.toLowerCase(),
10139
9281
  cancelLabel: (_dialogData$labels = dialogData.labels) === null || _dialogData$labels === void 0 ? void 0 : _dialogData$labels.cancelLabel,
10140
9282
  submitLabel: (_dialogData$labels2 = dialogData.labels) === null || _dialogData$labels2 === void 0 ? void 0 : _dialogData$labels2.submitLabel,
10141
- submitHandler: function submitHandler() {
10142
- return _submitHandler(head);
10143
- },
10144
- width: tableName === 'department' ? '400px' : '365px',
9283
+ submitHandler: submitHandler,
9284
+ width: "365px",
10145
9285
  hideCloseIcon: false,
10146
9286
  modalBodyStyle: {
10147
- overflowY: 'visible'
9287
+ maxHeight: '400px',
9288
+ overflow: 'auto',
9289
+ margin: '0px'
10148
9290
  },
10149
9291
  footerStyle: {
10150
9292
  justifyContent: 'end'
10151
9293
  }
10152
- }, tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10153
- display: "flex",
10154
- justifyContent: "center",
10155
- alignItems: "center",
10156
- flexDirection: "column",
10157
- style: {
10158
- marginBottom: '30px'
10159
- }
10160
9294
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
9295
+ component: "div",
10161
9296
  display: "flex",
10162
9297
  justifyContent: "center",
10163
9298
  alignItems: "center",
10164
9299
  flexDirection: "column",
10165
- className: styles$7.baseAlert
10166
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10167
- className: styles$7.alertDescContainer
10168
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10169
- className: styles$7.iconLayout,
10170
- style: {
10171
- paddingTop: '4px'
10172
- }
10173
- }, /*#__PURE__*/React__default.createElement(BoldInfoIcon, {
10174
- color: "#CA8A04",
10175
- width: "25",
10176
- height: "20",
10177
- className: styles$7.iconStyle
10178
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
10179
- 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.",
10180
- style: {
10181
- fontWeight: 'normal'
10182
- }
10183
- })), /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
10184
- buttonText: "Add user",
10185
- type: "text",
10186
- startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
10187
- width: "9",
10188
- height: "9",
10189
- color: "#EC5D25"
10190
- }),
10191
- onClick: handleAddPageNavigation,
10192
- className: styles$7.addUserButton
10193
- }))), /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
10194
- label: name + " name",
9300
+ padding: "8px 24px"
9301
+ }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
9302
+ label: name + " name"
9303
+ ,
10195
9304
  name: "name",
10196
9305
  defaultValue: dialogData.data.name,
10197
9306
  onValueChange: onValueChange,
@@ -10199,49 +9308,7 @@ function EditPanelDialog(_ref) {
10199
9308
  isError: isError,
10200
9309
  validation: validation,
10201
9310
  errorMsg: "Please enter " + name.toLowerCase() + " name.",
10202
- required: true,
10203
- style: tableName === 'department' && {
10204
- width: '350px'
10205
- }
10206
- }), tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10207
- className: "iui__mt-15",
10208
- style: {
10209
- width: '100%'
10210
- }
10211
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
10212
- label: "Department head",
10213
- name: "name",
10214
- defaultValue: head.label,
10215
- placeholder: "",
10216
- readOnly: true,
10217
- style: {
10218
- width: '350px'
10219
- }
10220
- })), tableName === 'department' && rowData.no_of_users > 0 && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
10221
- className: "iui__mt-15",
10222
- style: {
10223
- width: '100%'
10224
- }
10225
- }, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
10226
- noResultsText: true,
10227
- isMove: true,
10228
- additional: {
10229
- page: 1,
10230
- departmentId: rowData.id
10231
- },
10232
- placeHolderCheck: head !== undefined && head.value === '',
10233
- label: "Department head",
10234
- value: head,
10235
- onValueChange: function onValueChange(_ref2) {
10236
- var _value = _ref2._value;
10237
- return setHead(_value);
10238
- },
10239
- loadOption: departmentHeadOptions,
10240
- disableText: "Please get in touch with your administrator to change this value.",
10241
- customLoadingText: "No users found in this department",
10242
- customLoadingTextStyle: {
10243
- color: '#374151'
10244
- }
9311
+ required: true
10245
9312
  })));
10246
9313
  }
10247
9314
 
@@ -10420,15 +9487,12 @@ var UserPanel = function UserPanel(_ref) {
10420
9487
  var _useState13 = React.useState(false),
10421
9488
  isSortingChangeTemp = _useState13[0],
10422
9489
  setSortingChangeTemp = _useState13[1];
10423
- var _useState14 = React.useState([]),
10424
- rowData = _useState14[0],
10425
- setRowData = _useState14[1];
10426
- var _useState15 = React.useState(1),
10427
- page = _useState15[0],
10428
- setPage = _useState15[1];
10429
- var _useState16 = React.useState(5),
10430
- rowsPerPage = _useState16[0],
10431
- 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];
10432
9496
  var orderingParam = orderBy;
10433
9497
  var _useSelector = reactRedux.useSelector(function (state) {
10434
9498
  return state.userPanel;
@@ -10441,25 +9505,18 @@ var UserPanel = function UserPanel(_ref) {
10441
9505
  }),
10442
9506
  isTokenVerified = _useSelector2.isTokenVerified,
10443
9507
  hasVerificationError = _useSelector2.hasVerificationError;
9508
+
10444
9509
  var onValueChange = function onValueChange(_ref2) {
10445
9510
  var _value = _ref2._value;
10446
9511
  var validatedValue = _value.replace(/\s+/g, ' ').trim();
10447
9512
  setDataList(validatedValue);
10448
9513
  };
10449
- var _useState17 = React.useState(70),
10450
- maxLengthForModal = _useState17[0],
10451
- setMaxLengthForModal = _useState17[1];
10452
- React.useEffect(function () {
10453
- if (title === 'Business unit') {
10454
- setMaxLengthForModal(150);
10455
- }
10456
- }, []);
10457
9514
  var validation = {
10458
9515
  regexOnChange: /^[(A-Z)(a-z)(0-9)&'\-_.,/: ]*$/,
10459
9516
  regexOnBlur: null,
10460
9517
  maxLimit: '',
10461
9518
  minLimit: '',
10462
- maxLength: maxLengthForModal,
9519
+ maxLength: 70,
10463
9520
  minLength: 0
10464
9521
  };
10465
9522
  React.useEffect(function () {
@@ -10532,7 +9589,6 @@ var UserPanel = function UserPanel(_ref) {
10532
9589
  submitLabel: 'Save'
10533
9590
  }, '', data));
10534
9591
  setDataList(data.name);
10535
- setRowData(data);
10536
9592
  setEditModal(true);
10537
9593
  };
10538
9594
  var closeEditDialog = function closeEditDialog() {
@@ -10547,12 +9603,6 @@ var UserPanel = function UserPanel(_ref) {
10547
9603
  var payload = {
10548
9604
  names: [dataList]
10549
9605
  };
10550
- if (tableName === 'department') {
10551
- payload = {
10552
- name: dataList,
10553
- department_head_id: null
10554
- };
10555
- }
10556
9606
  var message = title + " added successfully.";
10557
9607
  handleApiCall(addRecord, payload, message, 'add');
10558
9608
  } else {
@@ -10566,12 +9616,10 @@ var UserPanel = function UserPanel(_ref) {
10566
9616
  var message = title + " deleted successfully.";
10567
9617
  handleApiCall(deleteRecord, payload, message, 'delete');
10568
9618
  };
10569
- var handleApiCall = function handleApiCall(dispatchFun, payload, message, type, optionalParams) {
10570
- if (optionalParams === void 0) {
10571
- optionalParams = null;
10572
- }
9619
+
9620
+ var handleApiCall = function handleApiCall(dispatchFun, payload, message, type) {
10573
9621
  dispatch(userPanelShowLoader());
10574
- dispatch(dispatchFun(tableName, payload, getApiData(), optionalParams)).then(function (res) {
9622
+ dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
10575
9623
  IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
10576
9624
  dispatch(userPanelStopLoader());
10577
9625
  if (type === 'delete') {
@@ -10613,14 +9661,8 @@ var UserPanel = function UserPanel(_ref) {
10613
9661
  name: dataList
10614
9662
  }]
10615
9663
  };
10616
- if (tableName === 'department') {
10617
- payload = {
10618
- name: dataList,
10619
- department_head_id: data.value === '' || rowData.is_default_dept_head && rowData.dept_head === data.value ? null : data.value
10620
- };
10621
- }
10622
9664
  var message = title + " updated successfully.";
10623
- handleApiCall(editRecord, payload, message, 'edit', dialogData.data.id);
9665
+ handleApiCall(editRecord, payload, message, 'edit');
10624
9666
  setErrorEdit(false);
10625
9667
  } else {
10626
9668
  setErrorEdit(true);
@@ -10727,10 +9769,7 @@ var UserPanel = function UserPanel(_ref) {
10727
9769
  submitHandler: handleEditPanel,
10728
9770
  isError: errorEdit,
10729
9771
  isDisabledSubmitBtn: loading,
10730
- validation: validation,
10731
- rowData: rowData,
10732
- tableName: tableName,
10733
- config: config
9772
+ validation: validation
10734
9773
  })) : /*#__PURE__*/React__default.createElement(VerificationError, {
10735
9774
  config: config
10736
9775
  }));