@itilite/iui-user-management 1.2.0 → 1.3.1

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.
@@ -1,4 +1,4 @@
1
- import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
1
+ import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUISearch, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
2
2
  import React, { useState, useEffect, useRef, Fragment as Fragment$1 } from 'react';
3
3
  import { configs, services, utilUrls } from '@itilite/utils';
4
4
  import axios from 'axios';
@@ -9,13 +9,14 @@ import { combineReducers, createStore, applyMiddleware } from 'redux';
9
9
  import thunk from 'redux-thunk';
10
10
  import moment from 'moment';
11
11
  import { composeWithDevTools } from 'redux-devtools-extension';
12
- import { useHistory } from 'react-router-dom';
12
+ import { useHistory, useLocation } from 'react-router-dom';
13
13
  import { withStyles, makeStyles } from '@material-ui/core/styles';
14
14
  import Tooltip from '@material-ui/core/Tooltip';
15
15
  import Switch from '@material-ui/core/Switch';
16
16
  import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
17
17
  import Button from '@material-ui/core/Button';
18
- import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography } from '@material-ui/core';
18
+ import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography, Box } from '@material-ui/core';
19
+ import { useScrollPosition } from '@n8tb1t/use-scroll-position';
19
20
 
20
21
  function _extends() {
21
22
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -455,6 +456,14 @@ var userPanelUrl = {
455
456
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
456
457
  }
457
458
  };
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
+ };
458
467
 
459
468
  var api = configs.api;
460
469
  var NAoptionConfig = {
@@ -683,6 +692,46 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
683
692
  return Promise.reject(e);
684
693
  }
685
694
  };
695
+ var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions, _ref6) {
696
+ var page = _ref6.page,
697
+ departmentId = _ref6.departmentId;
698
+ try {
699
+ return Promise.resolve(_catch(function () {
700
+ return Promise.resolve(api.get(departmentUrl.getDepartmentHead(departmentId, page) + "&search=" + search).then(function (res) {
701
+ return res.data;
702
+ })).then(function (response) {
703
+ var mappedValue = response.results.map(function (item) {
704
+ return {
705
+ value: item.id,
706
+ label: item.first_name + ' ' + item.last_name,
707
+ type: 'detailed',
708
+ data: item
709
+ };
710
+ });
711
+ console.log(response.next);
712
+ return {
713
+ options: mappedValue,
714
+ hasMore: !!response.next,
715
+ additional: {
716
+ page: page + 1,
717
+ departmentId: departmentId
718
+ }
719
+ };
720
+ });
721
+ }, function () {
722
+ return {
723
+ options: [],
724
+ hasMore: false,
725
+ additional: {
726
+ page: 1,
727
+ departmentId: departmentId
728
+ }
729
+ };
730
+ }));
731
+ } catch (e) {
732
+ return Promise.reject(e);
733
+ }
734
+ };
686
735
 
687
736
  var UserRole = function UserRole(_ref) {
688
737
  var _ref$list = _ref.list,
@@ -1718,7 +1767,7 @@ var verifyUserInfo = function verifyUserInfo(userId) {
1718
1767
  var submitAddModalData = function submitAddModalData(tableName, data) {
1719
1768
  return function (dispatch) {
1720
1769
  return new Promise(function (resolve, reject) {
1721
- api$2.post(userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
1770
+ api$2.post(tableName === 'department' ? departmentUrl.departmentUrl() : userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
1722
1771
  resolve(res);
1723
1772
  })["catch"](function (err) {
1724
1773
  var _err$response17, _err$response17$data;
@@ -1754,6 +1803,7 @@ var OPEN_DIALOG = 'OPEN_DIALOG';
1754
1803
  var CLOSE_DIALOG = 'CLOSE_DIALOG';
1755
1804
  var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
1756
1805
  var UNASSIGNED_USERS = 'Not assigned';
1806
+ var FETCH_DEPARTMENT_USERS_DATA = 'FETCH_DEPARTMENT_USERS_DATA';
1757
1807
 
1758
1808
  var api$3 = configs.api;
1759
1809
  var IUIToastMessageService$2 = services.IUIToastMessageService;
@@ -1803,14 +1853,14 @@ var getUserPanalData = function getUserPanalData(params) {
1803
1853
  var addRecord = function addRecord(tableName, data, getParam) {
1804
1854
  return function (dispatch) {
1805
1855
  return new Promise(function (resolve, reject) {
1806
- api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
1856
+ api$3.post(tableName === 'department' ? departmentUrl.departmentUrl() : userPanelUrl.addUnit(tableName), data).then(function (res) {
1807
1857
  dispatch(getUserPanalData(getParam));
1808
1858
  dispatch(closeDialog());
1809
1859
  resolve(res);
1810
1860
  })["catch"](function (err) {
1811
- var _err$response2, _err$response2$data;
1861
+ var _err$response3, _err$response3$data;
1812
1862
  dispatch(userPanelStopLoader());
1813
- 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.');
1863
+ 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.');
1814
1864
  });
1815
1865
  });
1816
1866
  };
@@ -1824,25 +1874,37 @@ var deleteRecord = function deleteRecord(tableName, id, getParam) {
1824
1874
  dispatch(userPanelStopLoader());
1825
1875
  resolve();
1826
1876
  })["catch"](function (err) {
1827
- var _err$response3, _err$response3$data;
1828
- 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.');
1877
+ var _err$response4, _err$response4$data;
1878
+ 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.');
1829
1879
  dispatch(userPanelStopLoader());
1830
1880
  });
1831
1881
  });
1832
1882
  };
1833
1883
  };
1834
- var editRecord = function editRecord(tableName, data, getParam) {
1884
+ var editRecord = function editRecord(tableName, data, getParam, optionalParams) {
1835
1885
  return function (dispatch) {
1836
1886
  return new Promise(function (resolve, reject) {
1837
- api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
1838
- dispatch(getUserPanalData(getParam));
1839
- dispatch(closeDialog());
1840
- resolve();
1841
- })["catch"](function (err) {
1842
- var _err$response4, _err$response4$data;
1843
- dispatch(userPanelStopLoader());
1844
- 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.');
1845
- });
1887
+ if (tableName === 'department') {
1888
+ api$3.put(departmentUrl.departmentUrl() + "/" + optionalParams, data).then(function (res) {
1889
+ dispatch(getUserPanalData(getParam));
1890
+ dispatch(closeDialog());
1891
+ resolve();
1892
+ })["catch"](function (err) {
1893
+ var _err$response5, _err$response5$data;
1894
+ dispatch(userPanelStopLoader());
1895
+ 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.');
1896
+ });
1897
+ } else {
1898
+ api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
1899
+ dispatch(getUserPanalData(getParam));
1900
+ dispatch(closeDialog());
1901
+ resolve();
1902
+ })["catch"](function (err) {
1903
+ var _err$response6, _err$response6$data;
1904
+ dispatch(userPanelStopLoader());
1905
+ 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.');
1906
+ });
1907
+ }
1846
1908
  });
1847
1909
  };
1848
1910
  };
@@ -1854,8 +1916,8 @@ var moveRecord = function moveRecord(tableName, data, getParam) {
1854
1916
  dispatch(closeDialog());
1855
1917
  resolve(res);
1856
1918
  })["catch"](function (err) {
1857
- var _err$response5, _err$response5$data;
1858
- 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.');
1919
+ var _err$response7, _err$response7$data;
1920
+ 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.');
1859
1921
  });
1860
1922
  });
1861
1923
  };
@@ -3955,6 +4017,7 @@ var initialState$2 = {
3955
4017
  previous: null,
3956
4018
  results: []
3957
4019
  },
4020
+ deptUsers: [],
3958
4021
  loading: false
3959
4022
  };
3960
4023
  var reducer$2 = function reducer(state, action) {
@@ -4024,6 +4087,12 @@ var reducer$2 = function reducer(state, action) {
4024
4087
  loading: false
4025
4088
  });
4026
4089
  }
4090
+ case FETCH_DEPARTMENT_USERS_DATA:
4091
+ {
4092
+ return _extends({}, state, {
4093
+ deptUsers: action.payload
4094
+ });
4095
+ }
4027
4096
  default:
4028
4097
  return state;
4029
4098
  }
@@ -4802,6 +4871,7 @@ var UserAddEdit = function UserAddEdit(props) {
4802
4871
  isILadmin = _useSelector2.isILadmin,
4803
4872
  companyName = _useSelector2.companyName;
4804
4873
  var history = useHistory();
4874
+ var location = useLocation();
4805
4875
  var _useState = useState({
4806
4876
  travel: false,
4807
4877
  expense: false
@@ -5057,6 +5127,18 @@ var UserAddEdit = function UserAddEdit(props) {
5057
5127
  var onAddModalClose = function onAddModalClose() {
5058
5128
  setAddModalData(_extends({}, defaultAddModalData));
5059
5129
  };
5130
+ useEffect(function () {
5131
+ var _location$state, _location$state2;
5132
+ 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) {
5133
+ var _location$state3, _location$state4;
5134
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, {
5135
+ department: {
5136
+ value: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.id,
5137
+ label: location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.name
5138
+ }
5139
+ }));
5140
+ }
5141
+ }, []);
5060
5142
  var onModalOpen = function onModalOpen(e, id) {
5061
5143
  var title = '';
5062
5144
  if (id === 'entity') {
@@ -5082,24 +5164,42 @@ var UserAddEdit = function UserAddEdit(props) {
5082
5164
  }));
5083
5165
  } else {
5084
5166
  dispatch(showLoader());
5085
- dispatch(submitAddModalData(addModalData.id, {
5086
- names: [validatedValue]
5087
- })).then(function (res) {
5088
- var _extends2, _extends3;
5167
+ var dataObj;
5168
+ if (addModalData.id === 'department') {
5169
+ dataObj = {
5170
+ name: validatedValue,
5171
+ department_head_id: null
5172
+ };
5173
+ } else {
5174
+ dataObj = {
5175
+ names: [validatedValue]
5176
+ };
5177
+ }
5178
+ dispatch(submitAddModalData(addModalData.id, dataObj)).then(function (res) {
5179
+ var _extends4;
5089
5180
  setAddModalData(_extends({}, addModalData, {
5090
5181
  isOpen: false
5091
5182
  }));
5092
5183
  IUIToastMessageService$4.sNotify(addModalData.title + " added successfully.");
5093
5184
  var tempKey = addModalData.id === 'employee_level' ? 'emp_level' : addModalData.id;
5094
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
5095
- value: res.data.value,
5096
- label: res.data.label
5097
- }, _extends2)));
5098
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends3 = {}, _extends3[tempKey] = true, _extends3)));
5185
+ if (addModalData.id === 'department') {
5186
+ var _extends2;
5187
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends2 = {}, _extends2[tempKey] = {
5188
+ value: res.data.result.id,
5189
+ label: res.data.result.name
5190
+ }, _extends2)));
5191
+ } else {
5192
+ var _extends3;
5193
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends3 = {}, _extends3[tempKey] = {
5194
+ value: res.data.value,
5195
+ label: res.data.label
5196
+ }, _extends3)));
5197
+ }
5198
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends4 = {}, _extends4[tempKey] = true, _extends4)));
5099
5199
  asyncSelectRefs.current[tempKey].current.blur();
5100
5200
  clearCacheForAsyncDropdown(function (prevState) {
5101
- var _extends4;
5102
- return _extends({}, prevState, (_extends4 = {}, _extends4[tempKey] = prevState[tempKey] + 1, _extends4));
5201
+ var _extends5;
5202
+ return _extends({}, prevState, (_extends5 = {}, _extends5[tempKey] = prevState[tempKey] + 1, _extends5));
5103
5203
  });
5104
5204
  dispatch(stopLoader());
5105
5205
  });
@@ -5118,8 +5218,8 @@ var UserAddEdit = function UserAddEdit(props) {
5118
5218
  try {
5119
5219
  var _temp6 = function _temp6() {
5120
5220
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5121
- var _extends5;
5122
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends5 = {}, _extends5[_name] = true, _extends5)));
5221
+ var _extends6;
5222
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends6 = {}, _extends6[_name] = true, _extends6)));
5123
5223
  }
5124
5224
  };
5125
5225
  var _name = args._name,
@@ -5142,8 +5242,8 @@ var UserAddEdit = function UserAddEdit(props) {
5142
5242
  updateError('contact_country_code', _isError, _errorMsg);
5143
5243
  } else {
5144
5244
  var _temp8 = function _temp8() {
5145
- var _extends6;
5146
- setPersonalInfoInput(_extends({}, personalInfoInput, (_extends6 = {}, _extends6[_name] = _value, _extends6)));
5245
+ var _extends7;
5246
+ setPersonalInfoInput(_extends({}, personalInfoInput, (_extends7 = {}, _extends7[_name] = _value, _extends7)));
5147
5247
  updateError(_name, _isError, _errorMsg);
5148
5248
  };
5149
5249
  var _temp9 = function () {
@@ -5191,7 +5291,7 @@ var UserAddEdit = function UserAddEdit(props) {
5191
5291
  }
5192
5292
  };
5193
5293
  var onEmployeeInfoChange = function onEmployeeInfoChange(args) {
5194
- var _extends7;
5294
+ var _extends8;
5195
5295
  var _name = args._name,
5196
5296
  _value = args._value,
5197
5297
  _isError = args._isError,
@@ -5200,11 +5300,11 @@ var UserAddEdit = function UserAddEdit(props) {
5200
5300
  _name: _name,
5201
5301
  _value: _value
5202
5302
  });
5203
- setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends7 = {}, _extends7[_name] = _value, _extends7)));
5303
+ setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
5204
5304
  updateError(_name, _isError, _errorMsg);
5205
5305
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5206
- var _extends8;
5207
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends8 = {}, _extends8[_name] = true, _extends8)));
5306
+ var _extends9;
5307
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends9 = {}, _extends9[_name] = true, _extends9)));
5208
5308
  }
5209
5309
  };
5210
5310
  var getUserTagTypeId = function getUserTagTypeId(name) {
@@ -5214,9 +5314,9 @@ var UserAddEdit = function UserAddEdit(props) {
5214
5314
  return tag.id;
5215
5315
  };
5216
5316
  var onUserTagTypeChange = function onUserTagTypeChange(args) {
5217
- var _extends9;
5317
+ var _extends10;
5218
5318
  var e = args._event;
5219
- setUserTagType(_extends({}, userTagType, (_extends9 = {}, _extends9[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends9)));
5319
+ setUserTagType(_extends({}, userTagType, (_extends10 = {}, _extends10[e.target.name] = userTagType[e.target.name] ? false : getUserTagTypeId(e.target.name), _extends10)));
5220
5320
  if (Object.hasOwnProperty.call(inputChangeLog, 'userTagType')) {
5221
5321
  updateInputChangeLog(_extends({}, inputChangeLog, {
5222
5322
  userTagType: true
@@ -5224,22 +5324,23 @@ var UserAddEdit = function UserAddEdit(props) {
5224
5324
  }
5225
5325
  };
5226
5326
  var onCustomFieldsChange = function onCustomFieldsChange(_ref2) {
5227
- var _extends10;
5327
+ var _extends11;
5228
5328
  var _name = _ref2._name,
5229
5329
  _value = _ref2._value;
5230
- setCustomFieldsInput(_extends({}, customFieldsInput, (_extends10 = {}, _extends10[_name] = _value, _extends10)));
5330
+ setCustomFieldsInput(_extends({}, customFieldsInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5231
5331
  };
5232
5332
  var onTravelApproversInputChange = function onTravelApproversInputChange(_ref3) {
5233
- var _extends11;
5333
+ var _extends12;
5234
5334
  var _name = _ref3._name,
5235
5335
  _value = _ref3._value;
5236
- setTravelApproversInput(_extends({}, travelApproversInput, (_extends11 = {}, _extends11[_name] = _value, _extends11)));
5336
+ console.log(_name, _value, 'travel');
5337
+ setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5237
5338
  };
5238
5339
  var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
5239
- var _extends12;
5340
+ var _extends13;
5240
5341
  var _name = _ref4._name,
5241
5342
  _value = _ref4._value;
5242
- setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
5343
+ setExpenseApproversInput(_extends({}, expenseApproversInput, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
5243
5344
  };
5244
5345
  var onMemInfoInputChange = function onMemInfoInputChange(index, key, val) {
5245
5346
  var _membershipInfoInput = [].concat(membershipInfoInput);
@@ -5273,39 +5374,39 @@ var UserAddEdit = function UserAddEdit(props) {
5273
5374
  setMembershipInfoInput(_membershipInfoInputTemp);
5274
5375
  };
5275
5376
  var travelPreferenceOnChange = function travelPreferenceOnChange(args) {
5276
- var _extends13;
5377
+ var _extends14;
5277
5378
  var _name = args._name,
5278
5379
  _value = args._value,
5279
5380
  _isError = args._isError,
5280
5381
  _errorMsg = args._errorMsg;
5281
- settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends13 = {}, _extends13[_name] = _value, _extends13)));
5382
+ settravelPreferenceInfo(_extends({}, travelPreferenceInfo, (_extends14 = {}, _extends14[_name] = _value, _extends14)));
5282
5383
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5283
- var _extends14;
5284
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends14 = {}, _extends14[_name] = true, _extends14)));
5384
+ var _extends15;
5385
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends15 = {}, _extends15[_name] = true, _extends15)));
5285
5386
  }
5286
5387
  updateError(_name, _isError, _errorMsg);
5287
5388
  };
5288
5389
  var onSecureTraveelerInfoInputChange = function onSecureTraveelerInfoInputChange(args) {
5289
- var _extends15;
5390
+ var _extends16;
5290
5391
  var _name = args._name,
5291
5392
  _value = args._value,
5292
5393
  _isError = args._isError,
5293
5394
  _errorMsg = args._errorMsg;
5294
- setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends15 = {}, _extends15[_name] = _value, _extends15)));
5395
+ setSecureTravelInputInfo(_extends({}, secureTravelInputInfo, (_extends16 = {}, _extends16[_name] = _value, _extends16)));
5295
5396
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5296
- var _extends16;
5297
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends16 = {}, _extends16[_name] = true, _extends16)));
5397
+ var _extends17;
5398
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends17 = {}, _extends17[_name] = true, _extends17)));
5298
5399
  }
5299
5400
  updateError(_name, _isError, _errorMsg);
5300
5401
  };
5301
5402
  var onPassportInfoInputChange = function onPassportInfoInputChange(args) {
5302
5403
  try {
5303
5404
  var _temp14 = function _temp14() {
5304
- var _extends17;
5305
- setPassportInfoInput(_extends({}, passportInfoInput, (_extends17 = {}, _extends17[_name] = _value, _extends17)));
5405
+ var _extends18;
5406
+ setPassportInfoInput(_extends({}, passportInfoInput, (_extends18 = {}, _extends18[_name] = _value, _extends18)));
5306
5407
  if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
5307
- var _extends18;
5308
- updateInputChangeLog(_extends({}, inputChangeLog, (_extends18 = {}, _extends18[_name] = true, _extends18)));
5408
+ var _extends19;
5409
+ updateInputChangeLog(_extends({}, inputChangeLog, (_extends19 = {}, _extends19[_name] = true, _extends19)));
5309
5410
  }
5310
5411
  updateError(_name, _isError, _errorMsg);
5311
5412
  };
@@ -5411,8 +5512,8 @@ var UserAddEdit = function UserAddEdit(props) {
5411
5512
  return _errorArray;
5412
5513
  });
5413
5514
  setErrorMsgs(function (prevState) {
5414
- var _extends19;
5415
- return _extends({}, prevState, (_extends19 = {}, _extends19[_name] = _errorMsg, _extends19));
5515
+ var _extends20;
5516
+ return _extends({}, prevState, (_extends20 = {}, _extends20[_name] = _errorMsg, _extends20));
5416
5517
  });
5417
5518
  };
5418
5519
  var dispatch = useDispatch();
@@ -6738,7 +6839,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
6738
6839
  };
6739
6840
  };
6740
6841
 
6741
- 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"};
6842
+ 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_","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","departmentHeadText":"_3pOsV","deactivateBtn":"_2v6e4","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn"};
6742
6843
 
6743
6844
  var BulkUploadModal = function BulkUploadModal(props) {
6744
6845
  var isOpenImportUsersModal = props.isOpenImportUsersModal,
@@ -8391,7 +8492,8 @@ var StickyHeadTable = function StickyHeadTable(props) {
8391
8492
  isDataFetching: isDataFetching,
8392
8493
  disableRowCheckbox: disableRowCheckbox,
8393
8494
  searchBoxWidth: "400px",
8394
- searchValue: searchValue
8495
+ searchValue: searchValue,
8496
+ hideTopPagination: false
8395
8497
  });
8396
8498
  };
8397
8499
  var SingupRequests = function SingupRequests(props) {
@@ -8522,6 +8624,25 @@ function InviteInfoIcon() {
8522
8624
  }));
8523
8625
  }
8524
8626
 
8627
+ function InfoYellowIcon(props) {
8628
+ return /*#__PURE__*/React.createElement("svg", {
8629
+ width: props.width,
8630
+ height: props.height,
8631
+ viewBox: "0 0 20 20",
8632
+ fill: "none",
8633
+ xmlns: "http://www.w3.org/2000/svg"
8634
+ }, /*#__PURE__*/React.createElement("path", {
8635
+ 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",
8636
+ fill: "#CA8A04"
8637
+ }), /*#__PURE__*/React.createElement("path", {
8638
+ 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",
8639
+ fill: "#CA8A04"
8640
+ }), /*#__PURE__*/React.createElement("path", {
8641
+ 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",
8642
+ fill: "#CA8A04"
8643
+ }));
8644
+ }
8645
+
8525
8646
  var IUIToastMessageService$7 = services.IUIToastMessageService;
8526
8647
  var env$7 = configs.env;
8527
8648
  var UndoButton = function UndoButton(_ref) {
@@ -8564,7 +8685,7 @@ var UserList = function UserList(_ref2) {
8564
8685
  var _React$useState = React.useState(1),
8565
8686
  page = _React$useState[0],
8566
8687
  setPage = _React$useState[1];
8567
- var _useState = useState(5),
8688
+ var _useState = useState(10),
8568
8689
  rowsPerPage = _useState[0],
8569
8690
  setRowsPerPage = _useState[1];
8570
8691
  var _React$useState2 = React.useState({}),
@@ -8573,9 +8694,12 @@ var UserList = function UserList(_ref2) {
8573
8694
  var _React$useState3 = React.useState('asc'),
8574
8695
  order = _React$useState3[0],
8575
8696
  setOrder = _React$useState3[1];
8576
- var _React$useState4 = React.useState('first_name'),
8577
- orderBy = _React$useState4[0],
8578
- setOrderBy = _React$useState4[1];
8697
+ var _React$useState4 = React.useState(false),
8698
+ deactivateSingle = _React$useState4[0],
8699
+ setDeactivateSingle = _React$useState4[1];
8700
+ var _React$useState5 = React.useState('first_name'),
8701
+ orderBy = _React$useState5[0],
8702
+ setOrderBy = _React$useState5[1];
8579
8703
  var _useState2 = useState(''),
8580
8704
  searchValue = _useState2[0],
8581
8705
  setSearchValue = _useState2[1];
@@ -8610,39 +8734,68 @@ var UserList = function UserList(_ref2) {
8610
8734
  var _useState10 = useState(false),
8611
8735
  isApiFetching = _useState10[0],
8612
8736
  setisApiFetching = _useState10[1];
8613
- var _useState11 = useState(false),
8614
- showInviteModal = _useState11[0],
8615
- setToggleInviteModal = _useState11[1];
8616
- var _useState12 = useState(''),
8617
- userIds = _useState12[0],
8618
- setUserIds = _useState12[1];
8619
- var _React$useState5 = React.useState(1),
8620
- signup_page = _React$useState5[0],
8621
- setSignUpPage = _React$useState5[1];
8622
- var _useState13 = useState(5),
8623
- signup_rowsPerPage = _useState13[0],
8624
- setSignUpRowsPerPage = _useState13[1];
8625
- var _React$useState6 = React.useState('asc'),
8626
- signup_order = _React$useState6[0],
8627
- setSignUpOrder = _React$useState6[1];
8628
- var _React$useState7 = React.useState('fname'),
8629
- signup_orderBy = _React$useState7[0],
8630
- setSignUpOrderBy = _React$useState7[1];
8631
- var _useState14 = useState(''),
8632
- signup_searchValue = _useState14[0],
8633
- set_signup_SearchValue = _useState14[1];
8634
- var _useState15 = useState(false),
8635
- isSignUpSortingChange = _useState15[0],
8636
- setSignUpSortingChange = _useState15[1];
8737
+ var _useState11 = useState({
8738
+ value: '',
8739
+ label: 'Select approver'
8740
+ }),
8741
+ travelFYI = _useState11[0],
8742
+ setTravelFYI = _useState11[1];
8743
+ var _useState12 = useState(false),
8744
+ showInviteModal = _useState12[0],
8745
+ setToggleInviteModal = _useState12[1];
8746
+ var _useState13 = useState(''),
8747
+ userIds = _useState13[0],
8748
+ setUserIds = _useState13[1];
8749
+ var _React$useState6 = React.useState(false),
8750
+ overlayMenu = _React$useState6[0],
8751
+ setOverlayMenu = _React$useState6[1];
8752
+ useScrollPosition(function (_ref3) {
8753
+ var prevPos = _ref3.prevPos,
8754
+ currPos = _ref3.currPos;
8755
+ if (prevPos.y - currPos.y > 0) {
8756
+ if (currPos.y <= -275) {
8757
+ setOverlayMenu(true);
8758
+ }
8759
+ } else {
8760
+ if (currPos.y > -295) {
8761
+ setOverlayMenu(false);
8762
+ }
8763
+ }
8764
+ }, [overlayMenu]);
8765
+ var scrollTo = function scrollTo(id) {
8766
+ var el = document.getElementById(id);
8767
+ window.scrollTo({
8768
+ top: el.offsetTop,
8769
+ behavior: 'smooth'
8770
+ });
8771
+ };
8772
+ var _React$useState7 = React.useState(1),
8773
+ signup_page = _React$useState7[0],
8774
+ setSignUpPage = _React$useState7[1];
8775
+ var _useState14 = useState(5),
8776
+ signup_rowsPerPage = _useState14[0],
8777
+ setSignUpRowsPerPage = _useState14[1];
8778
+ var _React$useState8 = React.useState('asc'),
8779
+ signup_order = _React$useState8[0],
8780
+ setSignUpOrder = _React$useState8[1];
8781
+ var _React$useState9 = React.useState('fname'),
8782
+ signup_orderBy = _React$useState9[0],
8783
+ setSignUpOrderBy = _React$useState9[1];
8784
+ var _useState15 = useState(''),
8785
+ signup_searchValue = _useState15[0],
8786
+ set_signup_SearchValue = _useState15[1];
8637
8787
  var _useState16 = useState(false),
8638
- isSignUpSearchingChange = _useState16[0],
8639
- setSignUpSearchingChange = _useState16[1];
8788
+ isSignUpSortingChange = _useState16[0],
8789
+ setSignUpSortingChange = _useState16[1];
8640
8790
  var _useState17 = useState(false),
8641
- isSignUpSortingChangeTemp = _useState17[0],
8642
- setSignUpSortingChangeTemp = _useState17[1];
8791
+ isSignUpSearchingChange = _useState17[0],
8792
+ setSignUpSearchingChange = _useState17[1];
8643
8793
  var _useState18 = useState(false),
8644
- isSignUpSearchingChangeTemp = _useState18[0],
8645
- setSignUpSearchingChangeTemp = _useState18[1];
8794
+ isSignUpSortingChangeTemp = _useState18[0],
8795
+ setSignUpSortingChangeTemp = _useState18[1];
8796
+ var _useState19 = useState(false),
8797
+ isSignUpSearchingChangeTemp = _useState19[0],
8798
+ setSignUpSearchingChangeTemp = _useState19[1];
8646
8799
  var _useSelector3 = useSelector(function (state) {
8647
8800
  return state.userList;
8648
8801
  }),
@@ -8887,6 +9040,7 @@ var UserList = function UserList(_ref2) {
8887
9040
  dispatch(fetchUsersList(url)).then(function () {
8888
9041
  setSearchingChange(false);
8889
9042
  setisApiFetching(false);
9043
+ scrollTo('table-root');
8890
9044
  });
8891
9045
  }, 1000);
8892
9046
  return function () {
@@ -8913,6 +9067,7 @@ var UserList = function UserList(_ref2) {
8913
9067
  }
8914
9068
  if (isSortingChange) {
8915
9069
  setisApiFetching(true);
9070
+ scrollTo('table-root');
8916
9071
  dispatch(fetchUsersList(url)).then(function () {
8917
9072
  setisApiFetching(false);
8918
9073
  setSortingChange(false);
@@ -8953,15 +9108,89 @@ var UserList = function UserList(_ref2) {
8953
9108
  }
8954
9109
  }
8955
9110
  }, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
9111
+ var topRightButtons = function topRightButtons() {
9112
+ return /*#__PURE__*/React.createElement(IUIBox, {
9113
+ component: "div",
9114
+ className: styles$5.buttonWrapper,
9115
+ display: "flex",
9116
+ justifyContent: "space-between",
9117
+ alignItems: "center",
9118
+ alignSelf: "flex-start"
9119
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9120
+ component: "div",
9121
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9122
+ }, /*#__PURE__*/React.createElement(IUIButton, {
9123
+ buttonText: "Export all users",
9124
+ type: "outlined",
9125
+ startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
9126
+ width: "22",
9127
+ height: "22"
9128
+ }),
9129
+ onClick: handleExportUsers
9130
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9131
+ component: "div",
9132
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9133
+ }, /*#__PURE__*/React.createElement(IUIDropdownButton, {
9134
+ buttonText: "Bulk actions",
9135
+ type: "outlined",
9136
+ menuListInfo: BulkUploadInfo
9137
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9138
+ component: "div",
9139
+ className: "pageHeader--button-single button-right"
9140
+ }, /*#__PURE__*/React.createElement(IUIButton, {
9141
+ buttonText: "Add user",
9142
+ type: "contained",
9143
+ startIcon: /*#__PURE__*/React.createElement(AddIcon, {
9144
+ width: "9",
9145
+ height: "9",
9146
+ color: "white"
9147
+ }),
9148
+ onClick: handleAddPageNavigation
9149
+ })));
9150
+ };
8956
9151
  return /*#__PURE__*/React.createElement(IUIBox, {
8957
9152
  component: "div",
8958
9153
  className: styles$5.UUIUserManagementList
8959
- }, !hasVerificationError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBackdrop, {
9154
+ }, overlayMenu ? /*#__PURE__*/React.createElement(Box, {
9155
+ className: styles$5.scrollOverlayMenu
9156
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9157
+ component: "div",
9158
+ className: clsx(styles$5.pageHeader)
9159
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9160
+ component: "div",
9161
+ display: "flex",
9162
+ justifyContent: "space-between",
9163
+ alignItems: "center",
9164
+ flexWrap: "wrap",
9165
+ style: {
9166
+ gap: '1rem'
9167
+ }
9168
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9169
+ component: "div",
9170
+ display: "flex",
9171
+ flexDirection: "column",
9172
+ style: {
9173
+ gap: '0.5rem'
9174
+ }
9175
+ }, /*#__PURE__*/React.createElement(IUISearch, {
9176
+ placeholder: "Search by name, email & department",
9177
+ value: searchValue,
9178
+ onChangeHandler: function onChangeHandler(e) {
9179
+ return onSearchHandler(e.target.value);
9180
+ },
9181
+ className: styles$5.overlaysearch
9182
+ })), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
9183
+ component: "div",
9184
+ display: "flex",
9185
+ justifyContent: "space-between",
9186
+ alignItems: "center"
9187
+ }))) : '', !hasVerificationError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBackdrop, {
8960
9188
  open: isFileDownloading || isApiFetching,
8961
9189
  className: styles$5.backdrop
8962
9190
  }, /*#__PURE__*/React.createElement(IUICircularProgress, {
8963
9191
  color: "inherit"
8964
9192
  })), isDataFetching ? /*#__PURE__*/React.createElement(SkeletonLoader, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
9193
+ id: "table-root",
8965
9194
  component: "div",
8966
9195
  className: clsx(styles$5.pageHeader)
8967
9196
  }, /*#__PURE__*/React.createElement(IUIBox, {
@@ -8986,44 +9215,7 @@ var UserList = function UserList(_ref2) {
8986
9215
  }, /*#__PURE__*/React.createElement(IUITypography, {
8987
9216
  variant: "h3",
8988
9217
  className: clsx(styles$5.heading, styles$5.headingLarge)
8989
- }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), /*#__PURE__*/React.createElement(IUIBox, {
8990
- component: "div",
8991
- className: styles$5.buttonWrapper,
8992
- display: "flex",
8993
- justifyContent: "space-between",
8994
- alignItems: "center",
8995
- alignSelf: "flex-start"
8996
- }, /*#__PURE__*/React.createElement(IUIBox, {
8997
- component: "div",
8998
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
8999
- }, /*#__PURE__*/React.createElement(IUIButton, {
9000
- buttonText: "Export all users",
9001
- type: "outlined",
9002
- startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
9003
- width: "22",
9004
- height: "22"
9005
- }),
9006
- onClick: handleExportUsers
9007
- })), /*#__PURE__*/React.createElement(IUIBox, {
9008
- component: "div",
9009
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9010
- }, /*#__PURE__*/React.createElement(IUIDropdownButton, {
9011
- buttonText: "Bulk actions",
9012
- type: "outlined",
9013
- menuListInfo: BulkUploadInfo
9014
- })), /*#__PURE__*/React.createElement(IUIBox, {
9015
- component: "div",
9016
- className: "pageHeader--button-single button-right"
9017
- }, /*#__PURE__*/React.createElement(IUIButton, {
9018
- buttonText: "Add user",
9019
- type: "contained",
9020
- startIcon: /*#__PURE__*/React.createElement(AddIcon, {
9021
- width: "9",
9022
- height: "9",
9023
- color: "white"
9024
- }),
9025
- onClick: handleAddPageNavigation
9026
- })))), /*#__PURE__*/React.createElement(IUIBox, {
9218
+ }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
9027
9219
  component: "div",
9028
9220
  display: "flex",
9029
9221
  justifyContent: "space-between",
@@ -9118,6 +9310,82 @@ var UserList = function UserList(_ref2) {
9118
9310
  }))
9119
9311
  }]
9120
9312
  }))), /*#__PURE__*/React.createElement(IUIModal, {
9313
+ isOpen: deactivateSingle,
9314
+ closeHandler: function closeHandler() {
9315
+ setDeactivateSingle(false);
9316
+ },
9317
+ cancelLabel: "Cancel",
9318
+ submitLabel: "Deactivate",
9319
+ submitHandler: handleDeactivateUsers,
9320
+ headerText: "Deactivate this user?",
9321
+ width: "400px",
9322
+ subHanderText: "",
9323
+ submitBtnClass: styles$5.deactivateBtn,
9324
+ isDisabledSubmitBtn: true
9325
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9326
+ className: styles$5.deactivateSingle
9327
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9328
+ className: styles$5.deactivateAlert
9329
+ }, /*#__PURE__*/React.createElement(InfoYellowIcon, {
9330
+ width: "9",
9331
+ height: "9"
9332
+ }), /*#__PURE__*/React.createElement(IUITypography, null, /*#__PURE__*/React.createElement("b", null, "Anvesh Dunna"), " is linked with multiple roles. You can deactivate them only once you transfer the roles to another user.")), /*#__PURE__*/React.createElement(IUIBox, {
9333
+ className: "iui__mb-15 iui__mt-15"
9334
+ }, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
9335
+ isMove: true,
9336
+ additional: {
9337
+ page: 1,
9338
+ product: 'travel',
9339
+ placeholder: 'Select a user'
9340
+ },
9341
+ placeHolderCheck: travelFYI !== undefined && travelFYI.value === '',
9342
+ label: "Transfer admin role to",
9343
+ value: travelFYI,
9344
+ onValueChange: function onValueChange(_ref4) {
9345
+ var _value = _ref4._value;
9346
+ return setTravelFYI(_value);
9347
+ },
9348
+ loadOption: approversOptions,
9349
+ disableText: "Please get in touch with your administrator to change this value."
9350
+ })), /*#__PURE__*/React.createElement(IUITypography, {
9351
+ className: clsx('iui__mb-5', styles$5.departmentHeadText)
9352
+ }, "Anvesh Dunna is the department head for: Product Design."), /*#__PURE__*/React.createElement(IUIBox, {
9353
+ className: "iui__mb-15"
9354
+ }, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
9355
+ isMove: true,
9356
+ additional: {
9357
+ page: 1,
9358
+ product: 'travel',
9359
+ placeholder: 'Select a user'
9360
+ },
9361
+ placeHolderCheck: travelFYI !== undefined && travelFYI.value === '',
9362
+ label: "Transfer department head role to",
9363
+ value: travelFYI,
9364
+ onValueChange: function onValueChange(_ref5) {
9365
+ var _value = _ref5._value;
9366
+ return setTravelFYI(_value);
9367
+ },
9368
+ loadOption: approversOptions,
9369
+ disableText: "Please get in touch with your administrator to change this value."
9370
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9371
+ className: "iui__mb-15"
9372
+ }, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
9373
+ isMove: true,
9374
+ additional: {
9375
+ page: 1,
9376
+ product: 'travel',
9377
+ placeholder: 'Select a user'
9378
+ },
9379
+ placeHolderCheck: travelFYI !== undefined && travelFYI.value === '',
9380
+ label: "Transfer approver role to",
9381
+ value: travelFYI,
9382
+ onValueChange: function onValueChange(_ref6) {
9383
+ var _value = _ref6._value;
9384
+ return setTravelFYI(_value);
9385
+ },
9386
+ loadOption: approversOptions,
9387
+ disableText: "Please get in touch with your administrator to change this value."
9388
+ })))), /*#__PURE__*/React.createElement(IUIModal, {
9121
9389
  isOpen: Object.values(selected).flat().length > 0 && isOpenDeActivateModal,
9122
9390
  closeHandler: closeDeActivateModal,
9123
9391
  cancelLabel: "Cancel",
@@ -9186,8 +9454,8 @@ var UserList = function UserList(_ref2) {
9186
9454
  errMsg: hasVerificationError
9187
9455
  }));
9188
9456
  };
9189
- var TabLabelCount = function TabLabelCount(_ref3) {
9190
- var count = _ref3.count;
9457
+ var TabLabelCount = function TabLabelCount(_ref7) {
9458
+ var count = _ref7.count;
9191
9459
  return /*#__PURE__*/React.createElement(IUIBox, {
9192
9460
  className: styles$5.TabLabelCount
9193
9461
  }, " ", count, " ");
@@ -9262,11 +9530,12 @@ function Header(props) {
9262
9530
  })));
9263
9531
  }
9264
9532
 
9265
- 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"};
9533
+ 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"};
9266
9534
 
9267
9535
  function Listview(_ref) {
9268
9536
  var data = _ref.data,
9269
9537
  name = _ref.name,
9538
+ tableName = _ref.tableName,
9270
9539
  handleEditDialog = _ref.handleEditDialog,
9271
9540
  handleDeleteDialog = _ref.handleDeleteDialog,
9272
9541
  orderBy = _ref.orderBy,
@@ -9279,16 +9548,82 @@ function Listview(_ref) {
9279
9548
  handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
9280
9549
  page = _ref.page,
9281
9550
  rowsPerPage = _ref.rowsPerPage;
9551
+ var deptHeadDetails = function deptHeadDetails(data) {
9552
+ var _data$dept_head_detai;
9553
+ 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) {
9554
+ return data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name;
9555
+ }
9556
+ };
9282
9557
  var columns = [{
9283
9558
  id: 'name',
9284
9559
  label: name,
9285
- width: '45%',
9560
+ width: '40%',
9286
9561
  sortable: true,
9287
9562
  cell: function cell(row) {
9288
9563
  return /*#__PURE__*/React.createElement(IUIBox, {
9289
9564
  component: "div"
9290
9565
  }, row.name);
9291
9566
  }
9567
+ }, {
9568
+ id: 'no_of_users',
9569
+ label: 'Number of users',
9570
+ width: '40%',
9571
+ sortable: true,
9572
+ cell: function cell(row) {
9573
+ return /*#__PURE__*/React.createElement(IUIBox, {
9574
+ component: "div"
9575
+ }, row.no_of_users);
9576
+ }
9577
+ }, {
9578
+ id: 'actions',
9579
+ label: 'Actions',
9580
+ width: '20%',
9581
+ cell: function cell(row) {
9582
+ return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React.createElement(IUIBox, {
9583
+ display: "flex"
9584
+ }, /*#__PURE__*/React.createElement(IUIButton, {
9585
+ buttonText: "Edit",
9586
+ className: styles$7.buttonWidth,
9587
+ onClick: function onClick() {
9588
+ return handleEditDialog(row);
9589
+ }
9590
+ }), row.no_of_users > 0 ? /*#__PURE__*/React.createElement(IUIButton, {
9591
+ buttonText: "Delete",
9592
+ className: styles$7.buttonWidth,
9593
+ onClick: function onClick() {
9594
+ return handleDeleteDialog(row, true);
9595
+ }
9596
+ }) : /*#__PURE__*/React.createElement(IUIButton, {
9597
+ buttonText: "Delete",
9598
+ className: styles$7.buttonWidth,
9599
+ onClick: function onClick() {
9600
+ return handleDeleteDialog(row, false);
9601
+ }
9602
+ }));
9603
+ }
9604
+ }];
9605
+ var departmentColumns = [{
9606
+ id: 'name',
9607
+ label: name,
9608
+ width: '30%',
9609
+ sortable: true,
9610
+ cell: function cell(row) {
9611
+ return /*#__PURE__*/React.createElement(IUIBox, {
9612
+ component: "div"
9613
+ }, row.name);
9614
+ }
9615
+ }, {
9616
+ id: 'department_head',
9617
+ label: 'Department head',
9618
+ width: '30%',
9619
+ sortable: true,
9620
+ cell: function cell(row) {
9621
+ return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIBox, {
9622
+ component: "div"
9623
+ }, deptHeadDetails(row)), row.is_default_dept_head && /*#__PURE__*/React.createElement(IUITypography, {
9624
+ className: clsx(styles$7.rowText, styles$7.textTransform, styles$7.lightColor)
9625
+ }, "Assigned by default"));
9626
+ }
9292
9627
  }, {
9293
9628
  id: 'no_of_users',
9294
9629
  label: 'Number of users',
@@ -9302,7 +9637,7 @@ function Listview(_ref) {
9302
9637
  }, {
9303
9638
  id: 'actions',
9304
9639
  label: 'Actions',
9305
- width: '10%',
9640
+ width: '15%',
9306
9641
  cell: function cell(row) {
9307
9642
  return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React.createElement(IUIBox, {
9308
9643
  display: "flex"
@@ -9335,7 +9670,7 @@ function Listview(_ref) {
9335
9670
  hasFilter: true,
9336
9671
  isCheckboxTable: false,
9337
9672
  count: data.count,
9338
- columns: columns,
9673
+ columns: tableName === 'department' ? departmentColumns : columns,
9339
9674
  rows: data.results,
9340
9675
  page: page,
9341
9676
  handleChangePage: handleChangePage,
@@ -9392,15 +9727,44 @@ function EditPanelDialog(_ref) {
9392
9727
  var isOpen = _ref.isOpen,
9393
9728
  closeHandler = _ref.closeHandler,
9394
9729
  onValueChange = _ref.onValueChange,
9395
- submitHandler = _ref.submitHandler,
9730
+ _submitHandler = _ref.submitHandler,
9396
9731
  isError = _ref.isError,
9397
9732
  name = _ref.name,
9398
9733
  isDisabledSubmitBtn = _ref.isDisabledSubmitBtn,
9399
- validation = _ref.validation;
9734
+ validation = _ref.validation,
9735
+ rowData = _ref.rowData,
9736
+ tableName = _ref.tableName,
9737
+ config = _ref.config;
9400
9738
  var _useSelector = useSelector(function (state) {
9401
9739
  return state.userPanel;
9402
9740
  }),
9403
9741
  dialogData = _useSelector.dialogData;
9742
+ var deptHeadDetails = function deptHeadDetails(data) {
9743
+ var _data$dept_head_detai;
9744
+ 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) {
9745
+ setHead({
9746
+ value: data.dept_head_details[0].id,
9747
+ label: data.dept_head_details[0].first_name + ' ' + data.dept_head_details[0].last_name
9748
+ });
9749
+ }
9750
+ };
9751
+ var _useState = useState({
9752
+ value: '',
9753
+ label: 'Select'
9754
+ }),
9755
+ head = _useState[0],
9756
+ setHead = _useState[1];
9757
+ useEffect(function () {
9758
+ deptHeadDetails(rowData);
9759
+ }, [rowData]);
9760
+ var history = useHistory();
9761
+ var handleAddPageNavigation = function handleAddPageNavigation() {
9762
+ console.log(rowData);
9763
+ history.push({
9764
+ pathname: config.routes.users.add.path,
9765
+ state: rowData
9766
+ });
9767
+ };
9404
9768
  return /*#__PURE__*/React.createElement(IUIModal, {
9405
9769
  isDisabledSubmitBtn: isDisabledSubmitBtn,
9406
9770
  isOpen: isOpen,
@@ -9408,25 +9772,59 @@ function EditPanelDialog(_ref) {
9408
9772
  headerText: "Edit " + name.toLowerCase(),
9409
9773
  cancelLabel: (_dialogData$labels = dialogData.labels) === null || _dialogData$labels === void 0 ? void 0 : _dialogData$labels.cancelLabel,
9410
9774
  submitLabel: (_dialogData$labels2 = dialogData.labels) === null || _dialogData$labels2 === void 0 ? void 0 : _dialogData$labels2.submitLabel,
9411
- submitHandler: submitHandler,
9412
- width: "365px",
9775
+ submitHandler: function submitHandler() {
9776
+ return _submitHandler(head);
9777
+ },
9778
+ width: tableName === 'department' ? '400px' : '365px',
9413
9779
  hideCloseIcon: false,
9414
9780
  modalBodyStyle: {
9415
- maxHeight: '400px',
9416
- overflow: 'auto',
9417
- margin: '0px'
9781
+ overflowY: 'visible'
9418
9782
  },
9419
9783
  footerStyle: {
9420
9784
  justifyContent: 'end'
9421
9785
  }
9786
+ }, tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React.createElement(IUIBox, {
9787
+ display: "flex",
9788
+ justifyContent: "center",
9789
+ alignItems: "center",
9790
+ flexDirection: "column",
9791
+ style: {
9792
+ marginBottom: '30px'
9793
+ }
9422
9794
  }, /*#__PURE__*/React.createElement(IUIBox, {
9423
- component: "div",
9424
9795
  display: "flex",
9425
9796
  justifyContent: "center",
9426
9797
  alignItems: "center",
9427
9798
  flexDirection: "column",
9428
- padding: "8px 24px"
9429
- }, /*#__PURE__*/React.createElement(IUIInput, {
9799
+ className: styles$7.baseAlert
9800
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9801
+ className: styles$7.alertDescContainer
9802
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9803
+ className: styles$7.iconLayout,
9804
+ style: {
9805
+ paddingTop: '4px'
9806
+ }
9807
+ }, /*#__PURE__*/React.createElement(BoldInfoIcon, {
9808
+ color: "#CA8A04",
9809
+ width: "25",
9810
+ height: "20",
9811
+ className: styles$7.iconStyle
9812
+ })), /*#__PURE__*/React.createElement(IUILabel, {
9813
+ 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.",
9814
+ style: {
9815
+ fontWeight: 'normal'
9816
+ }
9817
+ })), /*#__PURE__*/React.createElement(IUIButton, {
9818
+ buttonText: "Add user",
9819
+ type: "text",
9820
+ startIcon: /*#__PURE__*/React.createElement(AddIcon, {
9821
+ width: "9",
9822
+ height: "9",
9823
+ color: "#EC5D25"
9824
+ }),
9825
+ onClick: handleAddPageNavigation,
9826
+ className: styles$7.addUserButton
9827
+ }))), /*#__PURE__*/React.createElement(IUIInput, {
9430
9828
  label: name + " name",
9431
9829
  name: "name",
9432
9830
  defaultValue: dialogData.data.name,
@@ -9435,7 +9833,49 @@ function EditPanelDialog(_ref) {
9435
9833
  isError: isError,
9436
9834
  validation: validation,
9437
9835
  errorMsg: "Please enter " + name.toLowerCase() + " name.",
9438
- required: true
9836
+ required: true,
9837
+ style: tableName === 'department' && {
9838
+ width: '350px'
9839
+ }
9840
+ }), tableName === 'department' && rowData.no_of_users === 0 && /*#__PURE__*/React.createElement(IUIBox, {
9841
+ className: "iui__mt-15",
9842
+ style: {
9843
+ width: '100%'
9844
+ }
9845
+ }, /*#__PURE__*/React.createElement(IUIInput, {
9846
+ label: "Department head",
9847
+ name: "name",
9848
+ defaultValue: head.label,
9849
+ placeholder: "",
9850
+ readOnly: true,
9851
+ style: {
9852
+ width: '350px'
9853
+ }
9854
+ })), tableName === 'department' && rowData.no_of_users > 0 && /*#__PURE__*/React.createElement(IUIBox, {
9855
+ className: "iui__mt-15",
9856
+ style: {
9857
+ width: '100%'
9858
+ }
9859
+ }, /*#__PURE__*/React.createElement(IUIAsyncSelect, {
9860
+ noResultsText: true,
9861
+ isMove: true,
9862
+ additional: {
9863
+ page: 1,
9864
+ departmentId: rowData.id
9865
+ },
9866
+ placeHolderCheck: head !== undefined && head.value === '',
9867
+ label: "Department head",
9868
+ value: head,
9869
+ onValueChange: function onValueChange(_ref2) {
9870
+ var _value = _ref2._value;
9871
+ return setHead(_value);
9872
+ },
9873
+ loadOption: departmentHeadOptions,
9874
+ disableText: "Please get in touch with your administrator to change this value.",
9875
+ customLoadingText: "No users found in this department",
9876
+ customLoadingTextStyle: {
9877
+ color: '#374151'
9878
+ }
9439
9879
  })));
9440
9880
  }
9441
9881
 
@@ -9614,12 +10054,15 @@ var UserPanel = function UserPanel(_ref) {
9614
10054
  var _useState13 = useState(false),
9615
10055
  isSortingChangeTemp = _useState13[0],
9616
10056
  setSortingChangeTemp = _useState13[1];
9617
- var _useState14 = useState(1),
9618
- page = _useState14[0],
9619
- setPage = _useState14[1];
9620
- var _useState15 = useState(5),
9621
- rowsPerPage = _useState15[0],
9622
- setRowsPerPage = _useState15[1];
10057
+ var _useState14 = useState([]),
10058
+ rowData = _useState14[0],
10059
+ setRowData = _useState14[1];
10060
+ var _useState15 = useState(1),
10061
+ page = _useState15[0],
10062
+ setPage = _useState15[1];
10063
+ var _useState16 = useState(5),
10064
+ rowsPerPage = _useState16[0],
10065
+ setRowsPerPage = _useState16[1];
9623
10066
  var orderingParam = orderBy;
9624
10067
  var _useSelector = useSelector(function (state) {
9625
10068
  return state.userPanel;
@@ -9715,6 +10158,7 @@ var UserPanel = function UserPanel(_ref) {
9715
10158
  submitLabel: 'Save'
9716
10159
  }, '', data));
9717
10160
  setDataList(data.name);
10161
+ setRowData(data);
9718
10162
  setEditModal(true);
9719
10163
  };
9720
10164
  var closeEditDialog = function closeEditDialog() {
@@ -9729,6 +10173,12 @@ var UserPanel = function UserPanel(_ref) {
9729
10173
  var payload = {
9730
10174
  names: [dataList]
9731
10175
  };
10176
+ if (tableName === 'department') {
10177
+ payload = {
10178
+ name: dataList,
10179
+ department_head_id: null
10180
+ };
10181
+ }
9732
10182
  var message = title + " added successfully.";
9733
10183
  handleApiCall(addRecord, payload, message, 'add');
9734
10184
  } else {
@@ -9742,9 +10192,12 @@ var UserPanel = function UserPanel(_ref) {
9742
10192
  var message = title + " deleted successfully.";
9743
10193
  handleApiCall(deleteRecord, payload, message, 'delete');
9744
10194
  };
9745
- var handleApiCall = function handleApiCall(dispatchFun, payload, message, type) {
10195
+ var handleApiCall = function handleApiCall(dispatchFun, payload, message, type, optionalParams) {
10196
+ if (optionalParams === void 0) {
10197
+ optionalParams = null;
10198
+ }
9746
10199
  dispatch(userPanelShowLoader());
9747
- dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
10200
+ dispatch(dispatchFun(tableName, payload, getApiData(), optionalParams)).then(function (res) {
9748
10201
  IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
9749
10202
  dispatch(userPanelStopLoader());
9750
10203
  if (type === 'delete') {
@@ -9786,8 +10239,14 @@ var UserPanel = function UserPanel(_ref) {
9786
10239
  name: dataList
9787
10240
  }]
9788
10241
  };
10242
+ if (tableName === 'department') {
10243
+ payload = {
10244
+ name: dataList,
10245
+ department_head_id: data.value === '' || rowData.is_default_dept_head && rowData.dept_head === data.value ? null : data.value
10246
+ };
10247
+ }
9789
10248
  var message = title + " updated successfully.";
9790
- handleApiCall(editRecord, payload, message, 'edit');
10249
+ handleApiCall(editRecord, payload, message, 'edit', dialogData.data.id);
9791
10250
  setErrorEdit(false);
9792
10251
  } else {
9793
10252
  setErrorEdit(true);
@@ -9894,7 +10353,10 @@ var UserPanel = function UserPanel(_ref) {
9894
10353
  submitHandler: handleEditPanel,
9895
10354
  isError: errorEdit,
9896
10355
  isDisabledSubmitBtn: loading,
9897
- validation: validation
10356
+ validation: validation,
10357
+ rowData: rowData,
10358
+ tableName: tableName,
10359
+ config: config
9898
10360
  })) : /*#__PURE__*/React.createElement(VerificationError, {
9899
10361
  config: config
9900
10362
  }));