@itilite/iui-user-management 1.3.15 → 1.4.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.
- package/dist/index.css +6 -2
- package/dist/index.js +678 -219
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +678 -219
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.modern.js
CHANGED
|
@@ -32,6 +32,37 @@ function _extends() {
|
|
|
32
32
|
};
|
|
33
33
|
return _extends.apply(this, arguments);
|
|
34
34
|
}
|
|
35
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
36
|
+
if (!o) return;
|
|
37
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
38
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
40
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
41
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
42
|
+
}
|
|
43
|
+
function _arrayLikeToArray(arr, len) {
|
|
44
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
45
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
46
|
+
return arr2;
|
|
47
|
+
}
|
|
48
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
49
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
50
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
51
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
52
|
+
if (it) o = it;
|
|
53
|
+
var i = 0;
|
|
54
|
+
return function () {
|
|
55
|
+
if (i >= o.length) return {
|
|
56
|
+
done: true
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
done: false,
|
|
60
|
+
value: o[i++]
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
65
|
+
}
|
|
35
66
|
|
|
36
67
|
var _Pact = /*#__PURE__*/function () {
|
|
37
68
|
function _Pact() {}
|
|
@@ -389,6 +420,12 @@ var userAddEditUrl = {
|
|
|
389
420
|
},
|
|
390
421
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
391
422
|
return "api/v1/onboarding/user-signup-reject/" + userId + "?action=undo";
|
|
423
|
+
},
|
|
424
|
+
cardsEditUserDetails: function cardsEditUserDetails(userId) {
|
|
425
|
+
return env.getCardsapiURL() + "/card/authorization/user/" + userId;
|
|
426
|
+
},
|
|
427
|
+
cardsAddUsersDetails: function cardsAddUsersDetails() {
|
|
428
|
+
return env.getCardsapiURL() + "/card/authorization/company/" + IUILocalStorageService.getCompanyId() + "/roles";
|
|
392
429
|
}
|
|
393
430
|
};
|
|
394
431
|
var userListUrl = {
|
|
@@ -747,7 +784,6 @@ var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions
|
|
|
747
784
|
data: item
|
|
748
785
|
};
|
|
749
786
|
});
|
|
750
|
-
console.log(response.next);
|
|
751
787
|
return {
|
|
752
788
|
options: mappedValue,
|
|
753
789
|
hasMore: !!response.next,
|
|
@@ -792,6 +828,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
792
828
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
793
829
|
var STOP_LOADER = 'STOP_LOADER';
|
|
794
830
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
831
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
795
832
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
796
833
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
797
834
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -836,9 +873,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
836
873
|
if (payload.productAccess.expense) {
|
|
837
874
|
product.expense = payload.expenseRole || null;
|
|
838
875
|
}
|
|
876
|
+
if (payload.productAccess.card) {
|
|
877
|
+
var splitRole = payload.cardsRole.split(":");
|
|
878
|
+
var cardsUsmRole = splitRole[2];
|
|
879
|
+
product.card = cardsUsmRole || null;
|
|
880
|
+
}
|
|
839
881
|
return product;
|
|
840
882
|
}(),
|
|
841
|
-
approvers: {}
|
|
883
|
+
approvers: {},
|
|
884
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
842
885
|
};
|
|
843
886
|
var userTags = [];
|
|
844
887
|
for (var key in payload.userTagType) {
|
|
@@ -930,13 +973,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
930
973
|
var res = {
|
|
931
974
|
fields: {
|
|
932
975
|
user_personal_info: {},
|
|
933
|
-
employee_info: {}
|
|
976
|
+
employee_info: {},
|
|
977
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
934
978
|
}
|
|
935
979
|
};
|
|
936
980
|
if (!env$1.isProfilePage()) {
|
|
937
981
|
res.fields.product = function () {
|
|
938
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
982
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.card) {
|
|
983
|
+
return 'expense+travel+card';
|
|
984
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
939
985
|
return 'expense+travel';
|
|
986
|
+
} else if (payload.productAccess.expense && payload.productAccess.card) {
|
|
987
|
+
return 'expense+card';
|
|
988
|
+
} else if (payload.productAccess.travel && payload.productAccess.card) {
|
|
989
|
+
return 'travel+card';
|
|
940
990
|
} else if (payload.productAccess.travel) {
|
|
941
991
|
return 'travel';
|
|
942
992
|
} else {
|
|
@@ -951,6 +1001,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
951
1001
|
if (payload.productAccess.expense) {
|
|
952
1002
|
roles.expense = payload.expenseRole;
|
|
953
1003
|
}
|
|
1004
|
+
if (payload.productAccess.card) {
|
|
1005
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1006
|
+
var cardsUsmRole = splitRole[2];
|
|
1007
|
+
roles.card = cardsUsmRole;
|
|
1008
|
+
}
|
|
954
1009
|
return roles;
|
|
955
1010
|
}();
|
|
956
1011
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -1289,6 +1344,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1289
1344
|
payload: payload
|
|
1290
1345
|
};
|
|
1291
1346
|
};
|
|
1347
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1348
|
+
return {
|
|
1349
|
+
type: SET_CARDS_DETAILS,
|
|
1350
|
+
payload: payload
|
|
1351
|
+
};
|
|
1352
|
+
};
|
|
1292
1353
|
var setCustomField = function setCustomField(payload) {
|
|
1293
1354
|
return {
|
|
1294
1355
|
type: SET_CUSTOM_FIELD,
|
|
@@ -1360,7 +1421,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
|
|
|
1360
1421
|
return new Promise(function (resolve, reject) {
|
|
1361
1422
|
api$2.get(userAddEditUrl.countryCode()).then(function (res) {
|
|
1362
1423
|
dispatch(setCountryCodes(res.data.country_code_details));
|
|
1363
|
-
resolve(
|
|
1424
|
+
resolve(res.data.country_code_details);
|
|
1364
1425
|
})["catch"](function (err) {
|
|
1365
1426
|
reject(err);
|
|
1366
1427
|
})["finally"](function () {});
|
|
@@ -3191,6 +3252,12 @@ var products = [{
|
|
|
3191
3252
|
name: 'expense',
|
|
3192
3253
|
type: 'checkbox',
|
|
3193
3254
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3255
|
+
}, {
|
|
3256
|
+
id: 3,
|
|
3257
|
+
label: 'Card',
|
|
3258
|
+
name: 'card',
|
|
3259
|
+
type: 'checkbox',
|
|
3260
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3194
3261
|
}];
|
|
3195
3262
|
var dropdownList = {
|
|
3196
3263
|
gender: [{
|
|
@@ -3361,6 +3428,34 @@ var expenseConstants = {
|
|
|
3361
3428
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3362
3429
|
}]
|
|
3363
3430
|
};
|
|
3431
|
+
var cardsConstants = {
|
|
3432
|
+
heading: 'Card specific information',
|
|
3433
|
+
roleHeading: 'Card role',
|
|
3434
|
+
roleDescription: 'Roles allow users to only access relevant features and functionalities',
|
|
3435
|
+
roles: [{
|
|
3436
|
+
id: 1,
|
|
3437
|
+
label: 'Card holder',
|
|
3438
|
+
description: 'Can view own cards and transactions.',
|
|
3439
|
+
value: '',
|
|
3440
|
+
name: '',
|
|
3441
|
+
type: 'radio',
|
|
3442
|
+
isAssigned: false,
|
|
3443
|
+
fullWidth: false,
|
|
3444
|
+
visibility: true,
|
|
3445
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3446
|
+
}, {
|
|
3447
|
+
id: 2,
|
|
3448
|
+
label: 'Card admin',
|
|
3449
|
+
description: 'Has full administrative access to the card program. Can issue cards, set card limits, add users, has visibility into all transactions, statements and balances.',
|
|
3450
|
+
value: '',
|
|
3451
|
+
name: '',
|
|
3452
|
+
type: 'radio',
|
|
3453
|
+
isAssigned: false,
|
|
3454
|
+
fullWidth: false,
|
|
3455
|
+
visibility: true,
|
|
3456
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3457
|
+
}]
|
|
3458
|
+
};
|
|
3364
3459
|
var passportInfo = [{
|
|
3365
3460
|
id: 1,
|
|
3366
3461
|
label: 'Passport issuing country',
|
|
@@ -3590,6 +3685,12 @@ var initialState = {
|
|
|
3590
3685
|
travelConstants: travelConstants,
|
|
3591
3686
|
expenseConstants: expenseConstants
|
|
3592
3687
|
},
|
|
3688
|
+
isCardsDetailsRendered: false,
|
|
3689
|
+
isCardsAdmin: false,
|
|
3690
|
+
cardsDetails: {
|
|
3691
|
+
cardsRoles: cardsConstants.roles,
|
|
3692
|
+
cardsConstants: cardsConstants
|
|
3693
|
+
},
|
|
3593
3694
|
dropdownList: dropdownList,
|
|
3594
3695
|
maxTravelApprovers: 10,
|
|
3595
3696
|
maxExpenseApprovers: 10,
|
|
@@ -3756,11 +3857,37 @@ var reducer = function reducer(state, action) {
|
|
|
3756
3857
|
isRendered: true
|
|
3757
3858
|
});
|
|
3758
3859
|
}
|
|
3860
|
+
case SET_CARDS_DETAILS:
|
|
3861
|
+
{
|
|
3862
|
+
var _action$payload8, _action$payload8$role, _action$payload9;
|
|
3863
|
+
var cardsDetails = _extends({}, state.cardsDetails);
|
|
3864
|
+
if (action !== null && action !== void 0 && (_action$payload8 = action.payload) !== null && _action$payload8 !== void 0 && (_action$payload8$role = _action$payload8.roles) !== null && _action$payload8$role !== void 0 && _action$payload8$role.length) {
|
|
3865
|
+
cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
|
|
3866
|
+
return {
|
|
3867
|
+
id: role.id,
|
|
3868
|
+
label: role.name,
|
|
3869
|
+
description: role.description,
|
|
3870
|
+
value: role.value,
|
|
3871
|
+
isAssigned: role.is_assigned,
|
|
3872
|
+
name: role.value,
|
|
3873
|
+
type: 'radio',
|
|
3874
|
+
fullWidth: false,
|
|
3875
|
+
visibility: true,
|
|
3876
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3877
|
+
};
|
|
3878
|
+
});
|
|
3879
|
+
}
|
|
3880
|
+
return _extends({}, state, {
|
|
3881
|
+
cardsDetails: cardsDetails,
|
|
3882
|
+
isCardsDetailsRendered: true,
|
|
3883
|
+
isCardsAdmin: action === null || action === void 0 ? void 0 : (_action$payload9 = action.payload) === null || _action$payload9 === void 0 ? void 0 : _action$payload9.requested_user_is_admin
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3759
3886
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3760
3887
|
{
|
|
3761
3888
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3762
|
-
var _action$
|
|
3763
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3889
|
+
var _action$payload10;
|
|
3890
|
+
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$payload10 = action.payload) !== null && _action$payload10 !== void 0 && _action$payload10[input.name]) {
|
|
3764
3891
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3765
3892
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3766
3893
|
}
|
|
@@ -4813,7 +4940,9 @@ var ErrorMessages = {
|
|
|
4813
4940
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4814
4941
|
passport_photo: 'Please attach passport photo.',
|
|
4815
4942
|
travel_docs: 'Please attach travel docs.',
|
|
4816
|
-
products: 'Please select atleast one product access.'
|
|
4943
|
+
products: 'Please select atleast one product access.',
|
|
4944
|
+
only_cards_products: 'Currently, Card cannot be selected as a standalone option. Please add at least one more product.',
|
|
4945
|
+
none_products: 'Select at least one product. If opting for card, please choose at least one additional product.'
|
|
4817
4946
|
};
|
|
4818
4947
|
|
|
4819
4948
|
function AddPanelDialog(_ref) {
|
|
@@ -4863,7 +4992,73 @@ function AddPanelDialog(_ref) {
|
|
|
4863
4992
|
})));
|
|
4864
4993
|
}
|
|
4865
4994
|
|
|
4866
|
-
var
|
|
4995
|
+
var CardsField = function CardsField(props) {
|
|
4996
|
+
var cardsConstants = props.cardsConstants,
|
|
4997
|
+
_props$onRoleChange = props.onRoleChange,
|
|
4998
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
4999
|
+
_props$roleValue = props.roleValue,
|
|
5000
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
5001
|
+
_props$isProfile = props.isProfile,
|
|
5002
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5003
|
+
_props$roles = props.roles,
|
|
5004
|
+
roles = _props$roles === void 0 ? [] : _props$roles,
|
|
5005
|
+
_props$cardsAdmin = props.cardsAdmin,
|
|
5006
|
+
cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
|
|
5007
|
+
editUserId = props.editUserId,
|
|
5008
|
+
loggedInUserId = props.loggedInUserId;
|
|
5009
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5010
|
+
container: true,
|
|
5011
|
+
className: (styles.headingPadding)
|
|
5012
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5013
|
+
variant: "h3",
|
|
5014
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5015
|
+
}, cardsConstants.heading)), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
5016
|
+
className: styles.dividerColor
|
|
5017
|
+
}), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5018
|
+
container: true,
|
|
5019
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5020
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5021
|
+
item: true,
|
|
5022
|
+
sm: 12,
|
|
5023
|
+
md: 4
|
|
5024
|
+
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
5025
|
+
label: cardsConstants.roleHeading,
|
|
5026
|
+
headerType: true,
|
|
5027
|
+
description: cardsConstants.roleDescription
|
|
5028
|
+
})), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5029
|
+
item: true,
|
|
5030
|
+
sm: 12,
|
|
5031
|
+
md: 8,
|
|
5032
|
+
lg: 8,
|
|
5033
|
+
xl: 6
|
|
5034
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5035
|
+
container: true,
|
|
5036
|
+
className: styles.formFieldsWrapper
|
|
5037
|
+
}, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React.createElement(UserRole, {
|
|
5038
|
+
list: roles,
|
|
5039
|
+
value: roleValue
|
|
5040
|
+
}) : /*#__PURE__*/React.createElement(IUIRadio, {
|
|
5041
|
+
list: roles,
|
|
5042
|
+
value: roleValue,
|
|
5043
|
+
onValueChange: onRoleChange,
|
|
5044
|
+
disabled: cardsAdmin ? false : true
|
|
5045
|
+
})), !cardsAdmin && !isProfile && /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5046
|
+
item: true,
|
|
5047
|
+
sm: 12,
|
|
5048
|
+
md: 12,
|
|
5049
|
+
lg: 12,
|
|
5050
|
+
style: {
|
|
5051
|
+
marginTop: "24px"
|
|
5052
|
+
}
|
|
5053
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5054
|
+
variant: "body2",
|
|
5055
|
+
component: "span",
|
|
5056
|
+
className: styles.errorTextCls
|
|
5057
|
+
}, editUserId ? "Only Card admin can change the Card role." : "Only Card admin can change card roles. By default this user will have Card Holder role.")))));
|
|
5058
|
+
};
|
|
5059
|
+
|
|
5060
|
+
var IUIToastMessageService$4 = services.IUIToastMessageService,
|
|
5061
|
+
IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
4867
5062
|
var env$4 = configs.env;
|
|
4868
5063
|
var UserAddEdit = function UserAddEdit(props) {
|
|
4869
5064
|
var isEditMode = props.isEditMode,
|
|
@@ -4890,7 +5085,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4890
5085
|
isRendered = _useSelector.isRendered,
|
|
4891
5086
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
4892
5087
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
4893
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5088
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5089
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5090
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5091
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
4894
5092
|
var _useSelector2 = useSelector(function (state) {
|
|
4895
5093
|
return state.common;
|
|
4896
5094
|
}),
|
|
@@ -4903,7 +5101,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4903
5101
|
var location = useLocation();
|
|
4904
5102
|
var _useState = useState({
|
|
4905
5103
|
travel: false,
|
|
4906
|
-
expense: false
|
|
5104
|
+
expense: false,
|
|
5105
|
+
card: false
|
|
4907
5106
|
}),
|
|
4908
5107
|
productAccess = _useState[0],
|
|
4909
5108
|
setProductAccess = _useState[1];
|
|
@@ -4914,13 +5113,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4914
5113
|
errorMsgs.products = '';
|
|
4915
5114
|
var _productAccess = _extends({}, productAccess);
|
|
4916
5115
|
_productAccess[value] = !_productAccess[value];
|
|
4917
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5116
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === true) {
|
|
4918
5117
|
var _errorArray = [].concat(errorArray);
|
|
4919
5118
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4920
5119
|
if (_errorArray.indexOf('products') === -1) {
|
|
4921
5120
|
_errorArray.push('products');
|
|
4922
5121
|
}
|
|
4923
|
-
_errorMsgs.products = ErrorMessages.
|
|
5122
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4924
5123
|
setErrorArray(_errorArray);
|
|
4925
5124
|
setErrorMsgs(_errorMsgs);
|
|
4926
5125
|
var el = document.getElementById('products');
|
|
@@ -4930,13 +5129,202 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4930
5129
|
block: 'center'
|
|
4931
5130
|
});
|
|
4932
5131
|
}
|
|
5132
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5133
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5134
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5135
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5136
|
+
_errorArray2.push('products');
|
|
5137
|
+
}
|
|
5138
|
+
_errorMsgs2.products = ErrorMessages.products;
|
|
5139
|
+
setErrorArray(_errorArray2);
|
|
5140
|
+
setErrorMsgs(_errorMsgs2);
|
|
5141
|
+
var _el = document.getElementById('products');
|
|
5142
|
+
if (_el) {
|
|
5143
|
+
_el.scrollIntoView({
|
|
5144
|
+
behavior: 'smooth',
|
|
5145
|
+
block: 'center'
|
|
5146
|
+
});
|
|
5147
|
+
}
|
|
4933
5148
|
} else {
|
|
4934
5149
|
setErrorArray(errorArray);
|
|
4935
5150
|
setErrorMsgs(errorMsgs);
|
|
4936
5151
|
}
|
|
4937
5152
|
setProductAccess(_productAccess);
|
|
4938
5153
|
};
|
|
4939
|
-
var _useState2 = useState(
|
|
5154
|
+
var _useState2 = useState(''),
|
|
5155
|
+
newCountryCode = _useState2[0],
|
|
5156
|
+
setNewCountryCode = _useState2[1];
|
|
5157
|
+
var _useState3 = useState(),
|
|
5158
|
+
countryDialCode = _useState3[0],
|
|
5159
|
+
setCountryDialCode = _useState3[1];
|
|
5160
|
+
var _useState4 = useState([]),
|
|
5161
|
+
countryContactCode = _useState4[0],
|
|
5162
|
+
setCountryContactCode = _useState4[1];
|
|
5163
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5164
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5165
|
+
if (isProfile) {
|
|
5166
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5167
|
+
(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);
|
|
5168
|
+
} else {
|
|
5169
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5170
|
+
(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);
|
|
5171
|
+
}
|
|
5172
|
+
setFilesForDelete([]);
|
|
5173
|
+
setProfilePicDelete([]);
|
|
5174
|
+
})["catch"](function (err) {
|
|
5175
|
+
if (typeof err === 'object') {
|
|
5176
|
+
if (err.country_code) {
|
|
5177
|
+
err.contact_number = err.country_code;
|
|
5178
|
+
}
|
|
5179
|
+
if (err.contact_country_code) {
|
|
5180
|
+
err.contact_number = err.contact_country_code;
|
|
5181
|
+
}
|
|
5182
|
+
if (err.passport) {
|
|
5183
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5184
|
+
delete err.passport;
|
|
5185
|
+
}
|
|
5186
|
+
setErrorArray(Object.keys(err));
|
|
5187
|
+
setErrorMsgs(err);
|
|
5188
|
+
var _loop = function _loop() {
|
|
5189
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5190
|
+
if (err[key]) {
|
|
5191
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5192
|
+
setAdditionalInfoFlag('open');
|
|
5193
|
+
}
|
|
5194
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5195
|
+
if (el) {
|
|
5196
|
+
setTimeout(function () {
|
|
5197
|
+
el.scrollIntoView({
|
|
5198
|
+
behavior: 'smooth',
|
|
5199
|
+
block: 'center'
|
|
5200
|
+
});
|
|
5201
|
+
}, 500);
|
|
5202
|
+
return 1;
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
for (var key in err) {
|
|
5208
|
+
if (_loop()) break;
|
|
5209
|
+
}
|
|
5210
|
+
} else if (typeof err === 'string') {
|
|
5211
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5212
|
+
} else {
|
|
5213
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5214
|
+
}
|
|
5215
|
+
})["finally"](function () {
|
|
5216
|
+
dispatch(stopLoader());
|
|
5217
|
+
});
|
|
5218
|
+
};
|
|
5219
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5220
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5221
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5222
|
+
if (config !== null && config !== void 0 && (_config$routes3 = config.routes) !== null && _config$routes3 !== void 0 && (_config$routes3$users = _config$routes3.users) !== null && _config$routes3$users !== void 0 && (_config$routes3$users2 = _config$routes3$users.list) !== null && _config$routes3$users2 !== void 0 && _config$routes3$users2.path) {
|
|
5223
|
+
history.push({
|
|
5224
|
+
pathname: config.routes.users.list.path
|
|
5225
|
+
});
|
|
5226
|
+
}
|
|
5227
|
+
})["catch"](function (err) {
|
|
5228
|
+
if (typeof err === 'object') {
|
|
5229
|
+
if (err.country_code) {
|
|
5230
|
+
err.contact_number = err.country_code;
|
|
5231
|
+
}
|
|
5232
|
+
if (err.contact_country_code) {
|
|
5233
|
+
err.contact_number = err.contact_country_code;
|
|
5234
|
+
}
|
|
5235
|
+
if (err.passport) {
|
|
5236
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5237
|
+
delete err.passport;
|
|
5238
|
+
}
|
|
5239
|
+
setErrorArray(Object.keys(err));
|
|
5240
|
+
setErrorMsgs(err);
|
|
5241
|
+
var _loop2 = function _loop2() {
|
|
5242
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5243
|
+
if (err[key]) {
|
|
5244
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5245
|
+
setAdditionalInfoFlag('open');
|
|
5246
|
+
}
|
|
5247
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5248
|
+
if (el) {
|
|
5249
|
+
setTimeout(function () {
|
|
5250
|
+
el.scrollIntoView({
|
|
5251
|
+
behavior: 'smooth',
|
|
5252
|
+
block: 'center'
|
|
5253
|
+
});
|
|
5254
|
+
}, 500);
|
|
5255
|
+
return 1;
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
};
|
|
5260
|
+
for (var key in err) {
|
|
5261
|
+
if (_loop2()) break;
|
|
5262
|
+
}
|
|
5263
|
+
} else if (typeof err === 'string') {
|
|
5264
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5265
|
+
} else {
|
|
5266
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5267
|
+
}
|
|
5268
|
+
})["finally"](function () {
|
|
5269
|
+
dispatch(stopLoader());
|
|
5270
|
+
});
|
|
5271
|
+
};
|
|
5272
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5273
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5274
|
+
method: 'GET',
|
|
5275
|
+
headers: {
|
|
5276
|
+
'Content-Type': 'application/json',
|
|
5277
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5278
|
+
}
|
|
5279
|
+
}).then(function (response) {
|
|
5280
|
+
return response.json();
|
|
5281
|
+
}).then(function (res) {
|
|
5282
|
+
var _res$roles;
|
|
5283
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5284
|
+
dispatch(setCardsDetails(res));
|
|
5285
|
+
} else {
|
|
5286
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5287
|
+
}
|
|
5288
|
+
})["catch"](function (error) {
|
|
5289
|
+
console.log("errorrr", error);
|
|
5290
|
+
});
|
|
5291
|
+
};
|
|
5292
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5293
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5294
|
+
method: 'GET',
|
|
5295
|
+
headers: {
|
|
5296
|
+
'Content-Type': 'application/json',
|
|
5297
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5298
|
+
}
|
|
5299
|
+
}).then(function (response) {
|
|
5300
|
+
return response.json();
|
|
5301
|
+
}).then(function (res) {
|
|
5302
|
+
var _res$roles2;
|
|
5303
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5304
|
+
dispatch(setCardsDetails(res));
|
|
5305
|
+
} else {
|
|
5306
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5307
|
+
}
|
|
5308
|
+
})["catch"](function (error) {
|
|
5309
|
+
console.log("errorrr", error);
|
|
5310
|
+
});
|
|
5311
|
+
};
|
|
5312
|
+
useEffect(function () {
|
|
5313
|
+
var countryObject = countryContactCode.find(function (t) {
|
|
5314
|
+
return t.dial_code === countryDialCode;
|
|
5315
|
+
});
|
|
5316
|
+
if (countryObject) {
|
|
5317
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5318
|
+
country_code: countryObject.code
|
|
5319
|
+
}));
|
|
5320
|
+
}
|
|
5321
|
+
}, [countryDialCode]);
|
|
5322
|
+
useEffect(function () {
|
|
5323
|
+
var extractedNumber = newCountryCode.substring(1);
|
|
5324
|
+
var convertedNumber = parseInt(extractedNumber);
|
|
5325
|
+
setCountryDialCode(convertedNumber);
|
|
5326
|
+
}, [newCountryCode]);
|
|
5327
|
+
var _useState5 = useState({
|
|
4940
5328
|
first_name: '',
|
|
4941
5329
|
last_name: '',
|
|
4942
5330
|
email: '',
|
|
@@ -4947,9 +5335,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4947
5335
|
contact_country_code: '',
|
|
4948
5336
|
profile_pic: []
|
|
4949
5337
|
}),
|
|
4950
|
-
personalInfoInput =
|
|
4951
|
-
setPersonalInfoInput =
|
|
4952
|
-
var
|
|
5338
|
+
personalInfoInput = _useState5[0],
|
|
5339
|
+
setPersonalInfoInput = _useState5[1];
|
|
5340
|
+
var _useState6 = useState({
|
|
4953
5341
|
emp_level: {
|
|
4954
5342
|
value: '',
|
|
4955
5343
|
label: 'Select employee level'
|
|
@@ -4982,9 +5370,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4982
5370
|
label: defaultCurrency
|
|
4983
5371
|
}
|
|
4984
5372
|
}),
|
|
4985
|
-
employeeInfoInput =
|
|
4986
|
-
setEmployeeInfoInput =
|
|
4987
|
-
var
|
|
5373
|
+
employeeInfoInput = _useState6[0],
|
|
5374
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5375
|
+
var _useState7 = useState({
|
|
4988
5376
|
emp_level: 0,
|
|
4989
5377
|
entity: 0,
|
|
4990
5378
|
business_unit: 0,
|
|
@@ -4993,48 +5381,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4993
5381
|
manager_id: 0,
|
|
4994
5382
|
skip_manager_id: 0
|
|
4995
5383
|
}),
|
|
4996
|
-
cacheForAsyncDropdown =
|
|
4997
|
-
clearCacheForAsyncDropdown =
|
|
4998
|
-
var
|
|
4999
|
-
userTagType =
|
|
5000
|
-
setUserTagType =
|
|
5001
|
-
var
|
|
5002
|
-
scroll =
|
|
5003
|
-
setScroll =
|
|
5004
|
-
var
|
|
5005
|
-
customFieldsInput =
|
|
5006
|
-
setCustomFieldsInput =
|
|
5007
|
-
var
|
|
5008
|
-
travelRole =
|
|
5009
|
-
setTravelRole =
|
|
5010
|
-
var
|
|
5011
|
-
travelApproversInput =
|
|
5012
|
-
setTravelApproversInput =
|
|
5013
|
-
var
|
|
5384
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5385
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5386
|
+
var _useState8 = useState({}),
|
|
5387
|
+
userTagType = _useState8[0],
|
|
5388
|
+
setUserTagType = _useState8[1];
|
|
5389
|
+
var _useState9 = useState(false),
|
|
5390
|
+
scroll = _useState9[0],
|
|
5391
|
+
setScroll = _useState9[1];
|
|
5392
|
+
var _useState10 = useState({}),
|
|
5393
|
+
customFieldsInput = _useState10[0],
|
|
5394
|
+
setCustomFieldsInput = _useState10[1];
|
|
5395
|
+
var _useState11 = useState('traveler'),
|
|
5396
|
+
travelRole = _useState11[0],
|
|
5397
|
+
setTravelRole = _useState11[1];
|
|
5398
|
+
var _useState12 = useState({}),
|
|
5399
|
+
travelApproversInput = _useState12[0],
|
|
5400
|
+
setTravelApproversInput = _useState12[1];
|
|
5401
|
+
var _useState13 = useState({
|
|
5014
5402
|
value: '',
|
|
5015
5403
|
label: 'Select approver'
|
|
5016
5404
|
}),
|
|
5017
|
-
travelFYI =
|
|
5018
|
-
setTravelFYI =
|
|
5019
|
-
var
|
|
5020
|
-
membershipInfoInput =
|
|
5021
|
-
setMembershipInfoInput =
|
|
5022
|
-
var
|
|
5023
|
-
removedMembershipInfoInput =
|
|
5024
|
-
setRemovedMembershipInfoInput =
|
|
5025
|
-
var
|
|
5405
|
+
travelFYI = _useState13[0],
|
|
5406
|
+
setTravelFYI = _useState13[1];
|
|
5407
|
+
var _useState14 = useState([]),
|
|
5408
|
+
membershipInfoInput = _useState14[0],
|
|
5409
|
+
setMembershipInfoInput = _useState14[1];
|
|
5410
|
+
var _useState15 = useState([]),
|
|
5411
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5412
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5413
|
+
var _useState16 = useState({
|
|
5026
5414
|
flight_seat_preference: '',
|
|
5027
5415
|
meal_preference: ''
|
|
5028
5416
|
}),
|
|
5029
|
-
travelPreferenceInfo =
|
|
5030
|
-
settravelPreferenceInfo =
|
|
5031
|
-
var
|
|
5417
|
+
travelPreferenceInfo = _useState16[0],
|
|
5418
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5419
|
+
var _useState17 = useState({
|
|
5032
5420
|
trusted_traveller: '',
|
|
5033
5421
|
redress_number: ''
|
|
5034
5422
|
}),
|
|
5035
|
-
secureTravelInputInfo =
|
|
5036
|
-
setSecureTravelInputInfo =
|
|
5037
|
-
var
|
|
5423
|
+
secureTravelInputInfo = _useState17[0],
|
|
5424
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5425
|
+
var _useState18 = useState({
|
|
5038
5426
|
passport_issue_country: {
|
|
5039
5427
|
value: '',
|
|
5040
5428
|
label: 'Select country'
|
|
@@ -5049,39 +5437,76 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5049
5437
|
passport_photo: [],
|
|
5050
5438
|
travel_docs: []
|
|
5051
5439
|
}),
|
|
5052
|
-
passportInfoInput =
|
|
5053
|
-
setPassportInfoInput =
|
|
5054
|
-
var
|
|
5055
|
-
filesForDelete =
|
|
5056
|
-
setFilesForDelete =
|
|
5057
|
-
var
|
|
5058
|
-
profilePicDelete =
|
|
5059
|
-
setProfilePicDelete =
|
|
5060
|
-
var
|
|
5061
|
-
isAdditionalInfoExpanded =
|
|
5062
|
-
setAdditionalInfoFlag =
|
|
5063
|
-
var
|
|
5064
|
-
expenseRole =
|
|
5065
|
-
setExpenseRole =
|
|
5066
|
-
var
|
|
5067
|
-
expenseApproversInput =
|
|
5068
|
-
setExpenseApproversInput =
|
|
5069
|
-
var
|
|
5440
|
+
passportInfoInput = _useState18[0],
|
|
5441
|
+
setPassportInfoInput = _useState18[1];
|
|
5442
|
+
var _useState19 = useState([]),
|
|
5443
|
+
filesForDelete = _useState19[0],
|
|
5444
|
+
setFilesForDelete = _useState19[1];
|
|
5445
|
+
var _useState20 = useState([]),
|
|
5446
|
+
profilePicDelete = _useState20[0],
|
|
5447
|
+
setProfilePicDelete = _useState20[1];
|
|
5448
|
+
var _useState21 = useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5449
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5450
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5451
|
+
var _useState22 = useState('submitter'),
|
|
5452
|
+
expenseRole = _useState22[0],
|
|
5453
|
+
setExpenseRole = _useState22[1];
|
|
5454
|
+
var _useState23 = useState({}),
|
|
5455
|
+
expenseApproversInput = _useState23[0],
|
|
5456
|
+
setExpenseApproversInput = _useState23[1];
|
|
5457
|
+
var _useState24 = useState({
|
|
5070
5458
|
value: '',
|
|
5071
5459
|
label: 'Select approver'
|
|
5072
5460
|
}),
|
|
5073
|
-
expenseFYI =
|
|
5074
|
-
setExpenseFYI =
|
|
5461
|
+
expenseFYI = _useState24[0],
|
|
5462
|
+
setExpenseFYI = _useState24[1];
|
|
5463
|
+
var _useState25 = useState(''),
|
|
5464
|
+
cardsRole = _useState25[0],
|
|
5465
|
+
setCardsRole = _useState25[1];
|
|
5466
|
+
useEffect(function () {
|
|
5467
|
+
if (productAccess.card === false) {
|
|
5468
|
+
setCardsRole('');
|
|
5469
|
+
}
|
|
5470
|
+
}, [productAccess.card]);
|
|
5471
|
+
useEffect(function () {
|
|
5472
|
+
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5473
|
+
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5474
|
+
return role.isAssigned;
|
|
5475
|
+
});
|
|
5476
|
+
if (selectedRole) {
|
|
5477
|
+
setCardsRole(selectedRole.value);
|
|
5478
|
+
} else {
|
|
5479
|
+
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5480
|
+
var splitRoleVal = role.value.split(':');
|
|
5481
|
+
return splitRoleVal[2] === 'card-holder';
|
|
5482
|
+
});
|
|
5483
|
+
if (defaultRole) {
|
|
5484
|
+
setCardsRole(defaultRole.value);
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5488
|
+
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5489
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5490
|
+
var role = _step.value;
|
|
5491
|
+
var splitRoleVal = role.value.split(':');
|
|
5492
|
+
var profileRole = splitRoleVal[2];
|
|
5493
|
+
if (profileRole === targetRole) {
|
|
5494
|
+
setCardsRole(role.value);
|
|
5495
|
+
break;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
5075
5500
|
var asyncSelectRefs = useRef({
|
|
5076
5501
|
emp_level: useRef(null),
|
|
5077
5502
|
entity: useRef(null),
|
|
5078
5503
|
business_unit: useRef(null),
|
|
5079
5504
|
department: useRef(null)
|
|
5080
5505
|
});
|
|
5081
|
-
var
|
|
5082
|
-
errorArray =
|
|
5083
|
-
setErrorArray =
|
|
5084
|
-
var
|
|
5506
|
+
var _useState26 = useState([]),
|
|
5507
|
+
errorArray = _useState26[0],
|
|
5508
|
+
setErrorArray = _useState26[1];
|
|
5509
|
+
var _useState27 = useState({
|
|
5085
5510
|
first_name: '',
|
|
5086
5511
|
last_name: '',
|
|
5087
5512
|
email: '',
|
|
@@ -5111,9 +5536,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5111
5536
|
userTagType: '',
|
|
5112
5537
|
profile_pic: ''
|
|
5113
5538
|
}),
|
|
5114
|
-
errorMsgs =
|
|
5115
|
-
setErrorMsgs =
|
|
5116
|
-
var
|
|
5539
|
+
errorMsgs = _useState27[0],
|
|
5540
|
+
setErrorMsgs = _useState27[1];
|
|
5541
|
+
var _useState28 = useState({
|
|
5117
5542
|
first_name: false,
|
|
5118
5543
|
last_name: false,
|
|
5119
5544
|
email: false,
|
|
@@ -5140,14 +5565,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5140
5565
|
userTagType: false,
|
|
5141
5566
|
profile_pic: false
|
|
5142
5567
|
}),
|
|
5143
|
-
inputChangeLog =
|
|
5144
|
-
updateInputChangeLog =
|
|
5145
|
-
var
|
|
5146
|
-
uploadedFiles =
|
|
5147
|
-
setUploadedFiles =
|
|
5148
|
-
var
|
|
5149
|
-
maxLengthForModal =
|
|
5150
|
-
setMaxLengthForModal =
|
|
5568
|
+
inputChangeLog = _useState28[0],
|
|
5569
|
+
updateInputChangeLog = _useState28[1];
|
|
5570
|
+
var _useState29 = useState([]),
|
|
5571
|
+
uploadedFiles = _useState29[0],
|
|
5572
|
+
setUploadedFiles = _useState29[1];
|
|
5573
|
+
var _useState30 = useState(70),
|
|
5574
|
+
maxLengthForModal = _useState30[0],
|
|
5575
|
+
setMaxLengthForModal = _useState30[1];
|
|
5151
5576
|
var defaultAddModalData = {
|
|
5152
5577
|
isOpen: false,
|
|
5153
5578
|
isError: false,
|
|
@@ -5163,9 +5588,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5163
5588
|
maxLength: maxLengthForModal,
|
|
5164
5589
|
minLength: 0
|
|
5165
5590
|
};
|
|
5166
|
-
var
|
|
5167
|
-
addModalData =
|
|
5168
|
-
setAddModalData =
|
|
5591
|
+
var _useState31 = useState(defaultAddModalData),
|
|
5592
|
+
addModalData = _useState31[0],
|
|
5593
|
+
setAddModalData = _useState31[1];
|
|
5169
5594
|
var onAddModalClose = function onAddModalClose() {
|
|
5170
5595
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5171
5596
|
};
|
|
@@ -5342,7 +5767,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5342
5767
|
_value = args._value,
|
|
5343
5768
|
_isError = args._isError,
|
|
5344
5769
|
_errorMsg = args._errorMsg;
|
|
5345
|
-
console.log(_name, _value);
|
|
5346
5770
|
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
|
|
5347
5771
|
updateError(_name, _isError, _errorMsg);
|
|
5348
5772
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
@@ -5376,7 +5800,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5376
5800
|
var _extends12;
|
|
5377
5801
|
var _name = _ref3._name,
|
|
5378
5802
|
_value = _ref3._value;
|
|
5379
|
-
console.log(_name, _value, 'travel');
|
|
5380
5803
|
setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
|
|
5381
5804
|
};
|
|
5382
5805
|
var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
|
|
@@ -5578,6 +6001,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5578
6001
|
}, [isTokenVerified]);
|
|
5579
6002
|
useEffect(function () {
|
|
5580
6003
|
if (isRendered === true) {
|
|
6004
|
+
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6005
|
+
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6006
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6007
|
+
}
|
|
6008
|
+
});
|
|
5581
6009
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5582
6010
|
country_code: countryCode
|
|
5583
6011
|
}));
|
|
@@ -5588,6 +6016,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5588
6016
|
}
|
|
5589
6017
|
}));
|
|
5590
6018
|
dispatch(fetchCountryCodes()).then(function (_res) {
|
|
6019
|
+
setCountryContactCode(_res);
|
|
5591
6020
|
if (isEditMode) {
|
|
5592
6021
|
if (!isProfile && !editUserId) return false;
|
|
5593
6022
|
dispatch(setStaticFieldsVisibility({
|
|
@@ -5698,7 +6127,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5698
6127
|
var products = res.user_product.split('+');
|
|
5699
6128
|
setProductAccess({
|
|
5700
6129
|
travel: products.includes('travel'),
|
|
5701
|
-
expense: products.includes('expense')
|
|
6130
|
+
expense: products.includes('expense'),
|
|
6131
|
+
card: products.includes('card')
|
|
5702
6132
|
});
|
|
5703
6133
|
if (products.includes('travel')) {
|
|
5704
6134
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5909,13 +6339,15 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5909
6339
|
IUIToastMessageService$4.warningNotify(checkAnyError);
|
|
5910
6340
|
return Promise.resolve();
|
|
5911
6341
|
}
|
|
5912
|
-
console.log(employeeInfoInput, 'data');
|
|
5913
6342
|
if (employeeInfoInput.manager_id.value !== '') {
|
|
5914
6343
|
employeeInfoInput.manager_id = employeeInfoInput.manager.value;
|
|
5915
6344
|
}
|
|
5916
6345
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
5917
6346
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
5918
6347
|
}
|
|
6348
|
+
var cardsPayload = {
|
|
6349
|
+
"roles": [cardsRole]
|
|
6350
|
+
};
|
|
5919
6351
|
var payload = {
|
|
5920
6352
|
personalInfoInput: personalInfoInput,
|
|
5921
6353
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5934,7 +6366,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5934
6366
|
uploadedFiles: uploadedFiles,
|
|
5935
6367
|
filesForDelete: filesForDelete,
|
|
5936
6368
|
profilePicDelete: profilePicDelete,
|
|
5937
|
-
userTagType: userTagType
|
|
6369
|
+
userTagType: userTagType,
|
|
6370
|
+
cardsRole: cardsRole,
|
|
6371
|
+
isCardsAdmin: isCardsAdmin
|
|
5938
6372
|
};
|
|
5939
6373
|
if (verifyUserId) {
|
|
5940
6374
|
payload.verifyUserId = verifyUserId;
|
|
@@ -5973,11 +6407,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5973
6407
|
}
|
|
5974
6408
|
}
|
|
5975
6409
|
for (var _key in employeeInfo) {
|
|
5976
|
-
console.log('key', _key);
|
|
5977
6410
|
if (Object.hasOwnProperty.call(employeeInfo, _key)) {
|
|
5978
|
-
|
|
5979
|
-
console.log('employeeInfo0000', (_employeeInfoInput$_k = employeeInfoInput[_key]) === null || _employeeInfoInput$_k === void 0 ? void 0 : _employeeInfoInput$_k.value, 'sajkdhjasj');
|
|
5980
|
-
if (employeeInfo[_key] === false && employeeInfoInput[_key] !== undefined && (typeof employeeInfoInput[_key] === 'string' && !employeeInfoInput[_key] || typeof employeeInfoInput[_key] === 'object' && !employeeInfoInput[_key].value || !employeeInfoInput[_key].value) === '' && fieldsVisibility.employee_info[_key] !== 2) {
|
|
6411
|
+
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) {
|
|
5981
6412
|
_isError = true;
|
|
5982
6413
|
if (_errorArray.indexOf(_key) === -1) _errorArray.push(_key);
|
|
5983
6414
|
_errorMsgs[_key] = ErrorMessages[_key];
|
|
@@ -6063,7 +6494,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6063
6494
|
if (_isError) {
|
|
6064
6495
|
setErrorArray(_errorArray);
|
|
6065
6496
|
setErrorMsgs(_errorMsgs);
|
|
6066
|
-
var
|
|
6497
|
+
var _loop3 = function _loop3() {
|
|
6067
6498
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6068
6499
|
if (_errorMsgs[_key3]) {
|
|
6069
6500
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6083,115 +6514,109 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6083
6514
|
}
|
|
6084
6515
|
};
|
|
6085
6516
|
for (var _key3 in _errorMsgs) {
|
|
6086
|
-
if (
|
|
6517
|
+
if (_loop3()) break;
|
|
6087
6518
|
}
|
|
6088
6519
|
}
|
|
6520
|
+
var cardApiflag = false;
|
|
6521
|
+
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6522
|
+
cardApiflag = false;
|
|
6523
|
+
} else {
|
|
6524
|
+
cardApiflag = true;
|
|
6525
|
+
}
|
|
6089
6526
|
if (!_isError) {
|
|
6090
6527
|
if (isEditMode && editUserId || isProfile) {
|
|
6091
6528
|
dispatch(showLoader());
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
}
|
|
6100
|
-
setFilesForDelete([]);
|
|
6101
|
-
setProfilePicDelete([]);
|
|
6102
|
-
})["catch"](function (err) {
|
|
6103
|
-
if (typeof err === 'object') {
|
|
6104
|
-
if (err.country_code) {
|
|
6105
|
-
err.contact_number = err.country_code;
|
|
6106
|
-
}
|
|
6107
|
-
if (err.contact_country_code) {
|
|
6108
|
-
err.contact_number = err.contact_country_code;
|
|
6529
|
+
if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6530
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6531
|
+
method: 'POST',
|
|
6532
|
+
body: JSON.stringify(cardsPayload),
|
|
6533
|
+
headers: {
|
|
6534
|
+
'Content-Type': 'application/json',
|
|
6535
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6109
6536
|
}
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
}
|
|
6114
|
-
|
|
6115
|
-
setErrorMsgs(err);
|
|
6116
|
-
var _loop2 = function _loop2() {
|
|
6117
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6118
|
-
if (err[_key4]) {
|
|
6119
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6120
|
-
setAdditionalInfoFlag('open');
|
|
6121
|
-
}
|
|
6122
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6123
|
-
if (el) {
|
|
6124
|
-
setTimeout(function () {
|
|
6125
|
-
el.scrollIntoView({
|
|
6126
|
-
behavior: 'smooth',
|
|
6127
|
-
block: 'center'
|
|
6128
|
-
});
|
|
6129
|
-
}, 500);
|
|
6130
|
-
return 1;
|
|
6131
|
-
}
|
|
6132
|
-
}
|
|
6133
|
-
}
|
|
6134
|
-
};
|
|
6135
|
-
for (var _key4 in err) {
|
|
6136
|
-
if (_loop2()) break;
|
|
6537
|
+
}).then(function (response) {
|
|
6538
|
+
if (response.status === 200) {
|
|
6539
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6540
|
+
} else {
|
|
6541
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6137
6542
|
}
|
|
6138
|
-
}
|
|
6139
|
-
|
|
6140
|
-
}
|
|
6141
|
-
|
|
6142
|
-
}
|
|
6143
|
-
}
|
|
6144
|
-
|
|
6145
|
-
}
|
|
6543
|
+
})["catch"](function (error) {
|
|
6544
|
+
console.log("errorrr", error);
|
|
6545
|
+
})["finally"](function () {
|
|
6546
|
+
dispatch(stopLoader());
|
|
6547
|
+
});
|
|
6548
|
+
} else {
|
|
6549
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6550
|
+
}
|
|
6146
6551
|
} else {
|
|
6147
6552
|
dispatch(showLoader());
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6553
|
+
if (cardApiflag === true) {
|
|
6554
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6555
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6556
|
+
if (res !== null && res !== void 0 && res.user_id) {
|
|
6557
|
+
fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
|
|
6558
|
+
method: 'POST',
|
|
6559
|
+
body: JSON.stringify(cardsPayload),
|
|
6560
|
+
headers: {
|
|
6561
|
+
'Content-Type': 'application/json',
|
|
6562
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6563
|
+
}
|
|
6564
|
+
}).then(function (response) {
|
|
6565
|
+
if (response.status !== 200) {
|
|
6566
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6567
|
+
}
|
|
6568
|
+
})["catch"](function (error) {
|
|
6569
|
+
console.log("errorrr", error);
|
|
6570
|
+
});
|
|
6162
6571
|
}
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
if (
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6572
|
+
(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);
|
|
6573
|
+
})["catch"](function (err) {
|
|
6574
|
+
if (typeof err === 'object') {
|
|
6575
|
+
if (err.country_code) {
|
|
6576
|
+
err.contact_number = err.country_code;
|
|
6577
|
+
}
|
|
6578
|
+
if (err.contact_country_code) {
|
|
6579
|
+
err.contact_number = err.contact_country_code;
|
|
6580
|
+
}
|
|
6581
|
+
if (err.passport) {
|
|
6582
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6583
|
+
delete err.passport;
|
|
6584
|
+
}
|
|
6585
|
+
setErrorArray(Object.keys(err));
|
|
6586
|
+
setErrorMsgs(err);
|
|
6587
|
+
var _loop4 = function _loop4() {
|
|
6588
|
+
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6589
|
+
if (err[_key4]) {
|
|
6590
|
+
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6591
|
+
setAdditionalInfoFlag('open');
|
|
6592
|
+
}
|
|
6593
|
+
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6594
|
+
if (el) {
|
|
6595
|
+
setTimeout(function () {
|
|
6596
|
+
el.scrollIntoView({
|
|
6597
|
+
behavior: 'smooth',
|
|
6598
|
+
block: 'center'
|
|
6599
|
+
});
|
|
6600
|
+
}, 500);
|
|
6601
|
+
return 1;
|
|
6602
|
+
}
|
|
6180
6603
|
}
|
|
6181
6604
|
}
|
|
6605
|
+
};
|
|
6606
|
+
for (var _key4 in err) {
|
|
6607
|
+
if (_loop4()) break;
|
|
6182
6608
|
}
|
|
6183
|
-
}
|
|
6184
|
-
|
|
6185
|
-
|
|
6609
|
+
} else if (typeof err === 'string') {
|
|
6610
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6611
|
+
} else {
|
|
6612
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6186
6613
|
}
|
|
6187
|
-
}
|
|
6188
|
-
|
|
6189
|
-
}
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
}
|
|
6193
|
-
dispatch(stopLoader());
|
|
6194
|
-
});
|
|
6614
|
+
})["finally"](function () {
|
|
6615
|
+
dispatch(stopLoader());
|
|
6616
|
+
});
|
|
6617
|
+
} else {
|
|
6618
|
+
createUserApiCall(payload);
|
|
6619
|
+
}
|
|
6195
6620
|
}
|
|
6196
6621
|
}
|
|
6197
6622
|
return Promise.resolve();
|
|
@@ -6209,8 +6634,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6209
6634
|
}
|
|
6210
6635
|
}
|
|
6211
6636
|
} else {
|
|
6212
|
-
var _config$
|
|
6213
|
-
(config === null || config === void 0 ? void 0 : (_config$
|
|
6637
|
+
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6638
|
+
(config === null || config === void 0 ? void 0 : (_config$routes5 = config.routes) === null || _config$routes5 === void 0 ? void 0 : (_config$routes5$users = _config$routes5.users) === null || _config$routes5$users === void 0 ? void 0 : (_config$routes5$users2 = _config$routes5$users.list) === null || _config$routes5$users2 === void 0 ? void 0 : _config$routes5$users2.path) && history.push(config.routes.users.list.path);
|
|
6214
6639
|
}
|
|
6215
6640
|
};
|
|
6216
6641
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6230,17 +6655,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6230
6655
|
if (verifyUserId) {
|
|
6231
6656
|
dispatch(showLoader());
|
|
6232
6657
|
dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
|
|
6658
|
+
setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
|
|
6233
6659
|
setPersonalInfoInput(function (prevState) {
|
|
6234
6660
|
return _extends({}, prevState, {
|
|
6235
|
-
first_name: res.
|
|
6236
|
-
last_name: res.
|
|
6661
|
+
first_name: res.first_name,
|
|
6662
|
+
last_name: res.last_name,
|
|
6237
6663
|
email: res.email,
|
|
6238
|
-
contact_number: res.
|
|
6239
|
-
dob: function () {
|
|
6240
|
-
var dt = new Date(res.dob);
|
|
6241
|
-
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
6242
|
-
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
6243
|
-
}(),
|
|
6664
|
+
contact_number: res === null || res === void 0 ? void 0 : res.contact_number,
|
|
6244
6665
|
gender: function () {
|
|
6245
6666
|
if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
|
|
6246
6667
|
}()
|
|
@@ -6527,6 +6948,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6527
6948
|
className: styles.productContainerGap
|
|
6528
6949
|
}, renderFields.products.map(function (p, i) {
|
|
6529
6950
|
p.readOnly = isProfile;
|
|
6951
|
+
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6952
|
+
p.readOnly = true;
|
|
6953
|
+
p.disableText = "Only card admin can change this access.";
|
|
6954
|
+
} else if (p.id === 3 && editUserId === (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6955
|
+
p.readOnly = true;
|
|
6956
|
+
p.disableText = "You cannot update your own Card product";
|
|
6957
|
+
}
|
|
6530
6958
|
return /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6531
6959
|
item: true,
|
|
6532
6960
|
sm: 12,
|
|
@@ -6619,6 +7047,21 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6619
7047
|
isProfile: isProfile,
|
|
6620
7048
|
editUserId: editUserId,
|
|
6621
7049
|
roles: renderFields.expenseRoles
|
|
7050
|
+
}), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
7051
|
+
className: styles.dividerColor
|
|
7052
|
+
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React.createElement(CardsField, {
|
|
7053
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7054
|
+
type: "card",
|
|
7055
|
+
isProfile: isProfile,
|
|
7056
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7057
|
+
var _value = _ref7._value;
|
|
7058
|
+
return setCardsRole(_value);
|
|
7059
|
+
},
|
|
7060
|
+
roleValue: cardsRole,
|
|
7061
|
+
roles: cardsDetails.cardsRoles,
|
|
7062
|
+
cardsAdmin: isCardsAdmin,
|
|
7063
|
+
editUserId: editUserId,
|
|
7064
|
+
loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
|
|
6622
7065
|
}))) : /*#__PURE__*/React.createElement(VerificationError, {
|
|
6623
7066
|
config: config,
|
|
6624
7067
|
errMsg: hasVerificationError
|
|
@@ -8427,7 +8870,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8427
8870
|
cell: function cell(row) {
|
|
8428
8871
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8429
8872
|
component: "div"
|
|
8430
|
-
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
8873
|
+
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, !row.products[0].role.toLowerCase().includes("holder") ? /*#__PURE__*/React.createElement(IUIBox, {
|
|
8431
8874
|
component: "div",
|
|
8432
8875
|
display: "flex"
|
|
8433
8876
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8440,7 +8883,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8440
8883
|
style: {
|
|
8441
8884
|
whiteSpace: 'nowrap'
|
|
8442
8885
|
}
|
|
8443
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8886
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && !row.products[1].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8444
8887
|
component: "div",
|
|
8445
8888
|
display: "flex"
|
|
8446
8889
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8453,7 +8896,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8453
8896
|
style: {
|
|
8454
8897
|
whiteSpace: 'nowrap'
|
|
8455
8898
|
}
|
|
8456
|
-
}, "\xA0" + row.products[1].role)))
|
|
8899
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && !row.products[2].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8900
|
+
component: "div",
|
|
8901
|
+
display: "flex"
|
|
8902
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8903
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8904
|
+
style: {
|
|
8905
|
+
whiteSpace: 'nowrap'
|
|
8906
|
+
}
|
|
8907
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React.createElement(IUITypography, {
|
|
8908
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8909
|
+
style: {
|
|
8910
|
+
whiteSpace: 'nowrap'
|
|
8911
|
+
}
|
|
8912
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8457
8913
|
}
|
|
8458
8914
|
}, {
|
|
8459
8915
|
id: 'status',
|
|
@@ -8594,17 +9050,17 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8594
9050
|
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
8595
9051
|
};
|
|
8596
9052
|
var columns = [{
|
|
8597
|
-
id: '
|
|
9053
|
+
id: 'first_name',
|
|
8598
9054
|
label: 'Name',
|
|
8599
9055
|
minWidth: 250,
|
|
8600
9056
|
sortable: true,
|
|
8601
9057
|
cell: function cell(row) {
|
|
8602
9058
|
var _row$profile_pic2;
|
|
8603
9059
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIProfileBox, {
|
|
8604
|
-
firstName: row.
|
|
8605
|
-
lastName: row.
|
|
9060
|
+
firstName: row.first_name,
|
|
9061
|
+
lastName: row.last_name,
|
|
8606
9062
|
isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
|
|
8607
|
-
primaryText: row.
|
|
9063
|
+
primaryText: row.first_name + ' ' + row.last_name,
|
|
8608
9064
|
secondaryText: row.email,
|
|
8609
9065
|
letterAvatarTextColor: "black",
|
|
8610
9066
|
letterAvatarBackgroundColor: "#d3d3d3",
|
|
@@ -8613,7 +9069,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8613
9069
|
}));
|
|
8614
9070
|
}
|
|
8615
9071
|
}, {
|
|
8616
|
-
id: '
|
|
9072
|
+
id: 'created_at',
|
|
8617
9073
|
label: 'Requested on',
|
|
8618
9074
|
minWidth: 100,
|
|
8619
9075
|
sortable: true,
|
|
@@ -8623,7 +9079,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8623
9079
|
width: 100
|
|
8624
9080
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8625
9081
|
className: clsx(styles$5.rowText, styles$5.textTransform)
|
|
8626
|
-
}, formatDate(row.
|
|
9082
|
+
}, formatDate(row.created_at)));
|
|
8627
9083
|
}
|
|
8628
9084
|
}, {
|
|
8629
9085
|
id: 'actions',
|
|
@@ -8896,7 +9352,7 @@ var UserList = function UserList(_ref2) {
|
|
|
8896
9352
|
var _React$useState11 = React.useState('asc'),
|
|
8897
9353
|
signup_order = _React$useState11[0],
|
|
8898
9354
|
setSignUpOrder = _React$useState11[1];
|
|
8899
|
-
var _React$useState12 = React.useState('
|
|
9355
|
+
var _React$useState12 = React.useState('first_name'),
|
|
8900
9356
|
signup_orderBy = _React$useState12[0],
|
|
8901
9357
|
setSignUpOrderBy = _React$useState12[1];
|
|
8902
9358
|
var _useState22 = useState(''),
|
|
@@ -8919,7 +9375,11 @@ var UserList = function UserList(_ref2) {
|
|
|
8919
9375
|
}),
|
|
8920
9376
|
signupRequestListInfo = _useSelector3.signupRequestListInfo;
|
|
8921
9377
|
var redirectToNotifications = function redirectToNotifications() {
|
|
8922
|
-
|
|
9378
|
+
if (config.routes.notification) {
|
|
9379
|
+
history.push({
|
|
9380
|
+
pathname: config.routes.notification.path
|
|
9381
|
+
});
|
|
9382
|
+
}
|
|
8923
9383
|
};
|
|
8924
9384
|
var openDeactivateModal = function openDeactivateModal() {
|
|
8925
9385
|
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
@@ -9541,7 +10001,7 @@ var UserList = function UserList(_ref2) {
|
|
|
9541
10001
|
variant: "body2",
|
|
9542
10002
|
className: clsx(styles$5.description)
|
|
9543
10003
|
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in", ' ', /*#__PURE__*/React.createElement("span", {
|
|
9544
|
-
onClick:
|
|
10004
|
+
onClick: redirectToNotifications,
|
|
9545
10005
|
className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
|
|
9546
10006
|
}, "Notifications"))), /*#__PURE__*/React.createElement(SingupRequests, {
|
|
9547
10007
|
data: signupRequestListInfo,
|
|
@@ -10079,7 +10539,6 @@ function EditPanelDialog(_ref) {
|
|
|
10079
10539
|
}, [rowData]);
|
|
10080
10540
|
var history = useHistory();
|
|
10081
10541
|
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
10082
|
-
console.log(rowData);
|
|
10083
10542
|
history.push({
|
|
10084
10543
|
pathname: config.routes.users.add.path,
|
|
10085
10544
|
state: rowData
|