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