@itilite/iui-user-management 0.4.41 → 0.4.42

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.
@@ -3040,6 +3040,31 @@ var workInfo = [{
3040
3040
  minLength: 0
3041
3041
  },
3042
3042
  disableText: 'Please get in touch with your administrator to change this value.'
3043
+ }, {
3044
+ id: 7,
3045
+ label: 'Manager',
3046
+ name: 'manager',
3047
+ required: false,
3048
+ type: 'async_select',
3049
+ fullWidth: false,
3050
+ visibility: true,
3051
+ readOnly: false,
3052
+ placeholder: 'Select manager',
3053
+ tabelName: 'manager',
3054
+ product: 'travel',
3055
+ loadOption: approversOptions
3056
+ }, {
3057
+ id: 8,
3058
+ label: 'Skip manager',
3059
+ name: 'skip_manager',
3060
+ required: false,
3061
+ type: 'async_select',
3062
+ fullWidth: false,
3063
+ visibility: true,
3064
+ readOnly: false,
3065
+ placeholder: 'Select manager',
3066
+ product: 'travel',
3067
+ loadOption: approversOptions
3043
3068
  }, {
3044
3069
  id: 9,
3045
3070
  label: 'Base location',
@@ -4865,6 +4890,14 @@ var UserAddEdit = function UserAddEdit(props) {
4865
4890
  },
4866
4891
  designation: '',
4867
4892
  base_location: '',
4893
+ manager: {
4894
+ value: '',
4895
+ label: 'Select Manager'
4896
+ },
4897
+ skip_manager: {
4898
+ value: '',
4899
+ label: 'Select Manager'
4900
+ },
4868
4901
  currency: {
4869
4902
  value: defaultCurrency,
4870
4903
  label: defaultCurrency
@@ -4877,7 +4910,9 @@ var UserAddEdit = function UserAddEdit(props) {
4877
4910
  entity: 0,
4878
4911
  business_unit: 0,
4879
4912
  department: 0,
4880
- currency: 0
4913
+ currency: 0,
4914
+ manager: 0,
4915
+ skip_manager: 0
4881
4916
  }),
4882
4917
  cacheForAsyncDropdown = _useState4[0],
4883
4918
  clearCacheForAsyncDropdown = _useState4[1];
@@ -5090,9 +5125,6 @@ var UserAddEdit = function UserAddEdit(props) {
5090
5125
  value: res.data.value,
5091
5126
  label: res.data.label
5092
5127
  }, _extends2)));
5093
- if (res.data) {
5094
- updateError(tempKey, null, null);
5095
- }
5096
5128
  updateInputChangeLog(_extends({}, inputChangeLog, (_extends3 = {}, _extends3[tempKey] = true, _extends3)));
5097
5129
  asyncSelectRefs.current[tempKey].current.blur();
5098
5130
  clearCacheForAsyncDropdown(function (prevState) {
@@ -5480,6 +5512,20 @@ var UserAddEdit = function UserAddEdit(props) {
5480
5512
  value: '',
5481
5513
  label: 'Select employee level'
5482
5514
  },
5515
+ manager: res.employee_info.manager ? {
5516
+ value: res.employee_info.manager,
5517
+ label: res.employee_info.manager
5518
+ } : {
5519
+ value: '',
5520
+ label: 'Select Manager'
5521
+ },
5522
+ skip_manager: res.employee_info.skip_manager ? {
5523
+ value: res.employee_info.skip_manager,
5524
+ label: res.employee_info.skip_manager
5525
+ } : {
5526
+ value: '',
5527
+ label: 'Select Manager'
5528
+ },
5483
5529
  employee_id: res.employee_info.employee_id || '',
5484
5530
  entity: res.employee_info.entity ? {
5485
5531
  value: res.employee_info.entity.id,
@@ -5745,6 +5791,14 @@ var UserAddEdit = function UserAddEdit(props) {
5745
5791
  IUIToastMessageService$4.warningNotify(checkAnyError);
5746
5792
  return Promise.resolve();
5747
5793
  }
5794
+ if (employeeInfoInput.manager.value !== '') {
5795
+ employeeInfoInput.manager_id = employeeInfoInput.manager.value;
5796
+ delete employeeInfoInput.manager;
5797
+ }
5798
+ if (employeeInfoInput.skip_manager.value !== '') {
5799
+ employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
5800
+ delete employeeInfoInput.skip_manager;
5801
+ }
5748
5802
  var payload = {
5749
5803
  personalInfoInput: personalInfoInput,
5750
5804
  employeeInfoInput: employeeInfoInput,
@@ -5912,115 +5966,116 @@ var UserAddEdit = function UserAddEdit(props) {
5912
5966
  var _ret = _loop();
5913
5967
  if (_ret === "break") break;
5914
5968
  }
5915
- return Promise.resolve();
5916
5969
  }
5917
- if (isEditMode && editUserId || isProfile) {
5918
- dispatch(showLoader());
5919
- dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
5920
- if (isProfile) {
5921
- var _config$routes, _config$routes$profil, _config$routes$profil2;
5922
- (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);
5923
- } else {
5924
- var _config$routes2, _config$routes2$users, _config$routes2$users2;
5925
- (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);
5926
- }
5927
- setFilesForDelete([]);
5928
- setProfilePicDelete([]);
5929
- })["catch"](function (err) {
5930
- if (typeof err === 'object') {
5931
- if (err.country_code) {
5932
- err.contact_number = err.country_code;
5933
- }
5934
- if (err.contact_country_code) {
5935
- err.contact_number = err.contact_country_code;
5936
- }
5937
- if (err.passport) {
5938
- err.passport_photo = _extends({}, err.passport);
5939
- delete err.passport;
5970
+ if (!_isError) {
5971
+ if (isEditMode && editUserId || isProfile) {
5972
+ dispatch(showLoader());
5973
+ dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
5974
+ if (isProfile) {
5975
+ var _config$routes, _config$routes$profil, _config$routes$profil2;
5976
+ (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);
5977
+ } else {
5978
+ var _config$routes2, _config$routes2$users, _config$routes2$users2;
5979
+ (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);
5940
5980
  }
5941
- setErrorArray(Object.keys(err));
5942
- setErrorMsgs(err);
5943
- var _loop2 = function _loop2() {
5944
- if (Object.hasOwnProperty.call(err, key)) {
5945
- if (err[key]) {
5946
- if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
5947
- setAdditionalInfoFlag('open');
5948
- }
5949
- var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
5950
- if (el) {
5951
- setTimeout(function () {
5952
- el.scrollIntoView({
5953
- behavior: 'smooth',
5954
- block: 'center'
5955
- });
5956
- }, 500);
5957
- return "break";
5981
+ setFilesForDelete([]);
5982
+ setProfilePicDelete([]);
5983
+ })["catch"](function (err) {
5984
+ if (typeof err === 'object') {
5985
+ if (err.country_code) {
5986
+ err.contact_number = err.country_code;
5987
+ }
5988
+ if (err.contact_country_code) {
5989
+ err.contact_number = err.contact_country_code;
5990
+ }
5991
+ if (err.passport) {
5992
+ err.passport_photo = _extends({}, err.passport);
5993
+ delete err.passport;
5994
+ }
5995
+ setErrorArray(Object.keys(err));
5996
+ setErrorMsgs(err);
5997
+ var _loop2 = function _loop2() {
5998
+ if (Object.hasOwnProperty.call(err, key)) {
5999
+ if (err[key]) {
6000
+ if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
6001
+ setAdditionalInfoFlag('open');
6002
+ }
6003
+ var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
6004
+ if (el) {
6005
+ setTimeout(function () {
6006
+ el.scrollIntoView({
6007
+ behavior: 'smooth',
6008
+ block: 'center'
6009
+ });
6010
+ }, 500);
6011
+ return "break";
6012
+ }
5958
6013
  }
5959
6014
  }
6015
+ };
6016
+ for (var _key4 in err) {
6017
+ var _ret2 = _loop2();
6018
+ if (_ret2 === "break") break;
5960
6019
  }
5961
- };
5962
- for (var _key4 in err) {
5963
- var _ret2 = _loop2();
5964
- if (_ret2 === "break") break;
5965
- }
5966
- } else if (typeof err === 'string') {
5967
- IUIToastMessageService$4.warningNotify(err);
5968
- } else {
5969
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5970
- }
5971
- })["finally"](function () {
5972
- dispatch(stopLoader());
5973
- });
5974
- } else {
5975
- dispatch(showLoader());
5976
- dispatch(createUser(payload)).then(function (res) {
5977
- var _config$routes3, _config$routes3$users, _config$routes3$users2;
5978
- (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);
5979
- })["catch"](function (err) {
5980
- if (typeof err === 'object') {
5981
- if (err.country_code) {
5982
- err.contact_number = err.country_code;
5983
- }
5984
- if (err.contact_country_code) {
5985
- err.contact_number = err.contact_country_code;
5986
- }
5987
- if (err.passport) {
5988
- err.passport_photo = _extends({}, err.passport);
5989
- delete err.passport;
6020
+ } else if (typeof err === 'string') {
6021
+ IUIToastMessageService$4.warningNotify(err);
6022
+ } else {
6023
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5990
6024
  }
5991
- setErrorArray(Object.keys(err));
5992
- setErrorMsgs(err);
5993
- var _loop3 = function _loop3() {
5994
- if (Object.hasOwnProperty.call(err, key)) {
5995
- if (err[key]) {
5996
- if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
5997
- setAdditionalInfoFlag('open');
5998
- }
5999
- var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
6000
- if (el) {
6001
- setTimeout(function () {
6002
- el.scrollIntoView({
6003
- behavior: 'smooth',
6004
- block: 'center'
6005
- });
6006
- }, 500);
6007
- return "break";
6025
+ })["finally"](function () {
6026
+ dispatch(stopLoader());
6027
+ });
6028
+ } else {
6029
+ dispatch(showLoader());
6030
+ dispatch(createUser(payload)).then(function (res) {
6031
+ var _config$routes3, _config$routes3$users, _config$routes3$users2;
6032
+ (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);
6033
+ })["catch"](function (err) {
6034
+ if (typeof err === 'object') {
6035
+ if (err.country_code) {
6036
+ err.contact_number = err.country_code;
6037
+ }
6038
+ if (err.contact_country_code) {
6039
+ err.contact_number = err.contact_country_code;
6040
+ }
6041
+ if (err.passport) {
6042
+ err.passport_photo = _extends({}, err.passport);
6043
+ delete err.passport;
6044
+ }
6045
+ setErrorArray(Object.keys(err));
6046
+ setErrorMsgs(err);
6047
+ var _loop3 = function _loop3() {
6048
+ if (Object.hasOwnProperty.call(err, key)) {
6049
+ if (err[key]) {
6050
+ if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
6051
+ setAdditionalInfoFlag('open');
6052
+ }
6053
+ var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
6054
+ if (el) {
6055
+ setTimeout(function () {
6056
+ el.scrollIntoView({
6057
+ behavior: 'smooth',
6058
+ block: 'center'
6059
+ });
6060
+ }, 500);
6061
+ return "break";
6062
+ }
6008
6063
  }
6009
6064
  }
6065
+ };
6066
+ for (var _key5 in err) {
6067
+ var _ret3 = _loop3();
6068
+ if (_ret3 === "break") break;
6010
6069
  }
6011
- };
6012
- for (var _key5 in err) {
6013
- var _ret3 = _loop3();
6014
- if (_ret3 === "break") break;
6070
+ } else if (typeof err === 'string') {
6071
+ IUIToastMessageService$4.warningNotify(err);
6072
+ } else {
6073
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6015
6074
  }
6016
- } else if (typeof err === 'string') {
6017
- IUIToastMessageService$4.warningNotify(err);
6018
- } else {
6019
- IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6020
- }
6021
- })["finally"](function () {
6022
- dispatch(stopLoader());
6023
- });
6075
+ })["finally"](function () {
6076
+ dispatch(stopLoader());
6077
+ });
6078
+ }
6024
6079
  }
6025
6080
  return Promise.resolve();
6026
6081
  } catch (e) {