@itilite/iui-user-management 0.4.52 → 0.4.54
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 +4 -0
- package/dist/index.js +630 -221
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +630 -221
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -35,6 +35,37 @@ function _extends() {
|
|
|
35
35
|
};
|
|
36
36
|
return _extends.apply(this, arguments);
|
|
37
37
|
}
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
39
|
+
if (!o) return;
|
|
40
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
41
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
42
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
43
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
44
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
45
|
+
}
|
|
46
|
+
function _arrayLikeToArray(arr, len) {
|
|
47
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
48
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
49
|
+
return arr2;
|
|
50
|
+
}
|
|
51
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
52
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
53
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
54
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
55
|
+
if (it) o = it;
|
|
56
|
+
var i = 0;
|
|
57
|
+
return function () {
|
|
58
|
+
if (i >= o.length) return {
|
|
59
|
+
done: true
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
done: false,
|
|
63
|
+
value: o[i++]
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
|
+
}
|
|
38
69
|
|
|
39
70
|
var _Pact = /*#__PURE__*/function () {
|
|
40
71
|
function _Pact() {}
|
|
@@ -392,6 +423,12 @@ var userAddEditUrl = {
|
|
|
392
423
|
},
|
|
393
424
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
394
425
|
return "api/v1/onboarding/user-signup-reject/" + userId + "?action=undo";
|
|
426
|
+
},
|
|
427
|
+
cardsEditUserDetails: function cardsEditUserDetails(userId) {
|
|
428
|
+
return env.getCardsapiURL() + "/card/authorization/user/" + userId;
|
|
429
|
+
},
|
|
430
|
+
cardsAddUsersDetails: function cardsAddUsersDetails() {
|
|
431
|
+
return env.getCardsapiURL() + "/card/authorization/company/" + IUILocalStorageService.getCompanyId() + "/roles";
|
|
395
432
|
}
|
|
396
433
|
};
|
|
397
434
|
var userListUrl = {
|
|
@@ -750,7 +787,6 @@ var departmentHeadOptions = function departmentHeadOptions(search, loadedOptions
|
|
|
750
787
|
data: item
|
|
751
788
|
};
|
|
752
789
|
});
|
|
753
|
-
console.log(response.next);
|
|
754
790
|
return {
|
|
755
791
|
options: mappedValue,
|
|
756
792
|
hasMore: !!response.next,
|
|
@@ -795,6 +831,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
795
831
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
796
832
|
var STOP_LOADER = 'STOP_LOADER';
|
|
797
833
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
834
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
798
835
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
799
836
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
800
837
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -839,9 +876,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
839
876
|
if (payload.productAccess.expense) {
|
|
840
877
|
product.expense = payload.expenseRole || null;
|
|
841
878
|
}
|
|
879
|
+
if (payload.productAccess.cards) {
|
|
880
|
+
var splitRole = payload.cardsRole.split(":");
|
|
881
|
+
var cardsUsmRole = splitRole[2];
|
|
882
|
+
product.cards = cardsUsmRole || null;
|
|
883
|
+
}
|
|
842
884
|
return product;
|
|
843
885
|
}(),
|
|
844
|
-
approvers: {}
|
|
886
|
+
approvers: {},
|
|
887
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
845
888
|
};
|
|
846
889
|
var userTags = [];
|
|
847
890
|
for (var key in payload.userTagType) {
|
|
@@ -933,13 +976,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
933
976
|
var res = {
|
|
934
977
|
fields: {
|
|
935
978
|
user_personal_info: {},
|
|
936
|
-
employee_info: {}
|
|
979
|
+
employee_info: {},
|
|
980
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
937
981
|
}
|
|
938
982
|
};
|
|
939
983
|
if (!env$1.isProfilePage()) {
|
|
940
984
|
res.fields.product = function () {
|
|
941
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
985
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.cards) {
|
|
986
|
+
return 'expense+travel+cards';
|
|
987
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
942
988
|
return 'expense+travel';
|
|
989
|
+
} else if (payload.productAccess.expense && payload.productAccess.cards) {
|
|
990
|
+
return 'expense+cards';
|
|
991
|
+
} else if (payload.productAccess.travel && payload.productAccess.cards) {
|
|
992
|
+
return 'travel+cards';
|
|
943
993
|
} else if (payload.productAccess.travel) {
|
|
944
994
|
return 'travel';
|
|
945
995
|
} else {
|
|
@@ -954,6 +1004,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
954
1004
|
if (payload.productAccess.expense) {
|
|
955
1005
|
roles.expense = payload.expenseRole;
|
|
956
1006
|
}
|
|
1007
|
+
if (payload.productAccess.cards) {
|
|
1008
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1009
|
+
var cardsUsmRole = splitRole[2];
|
|
1010
|
+
roles.cards = cardsUsmRole;
|
|
1011
|
+
}
|
|
957
1012
|
return roles;
|
|
958
1013
|
}();
|
|
959
1014
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -1292,6 +1347,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1292
1347
|
payload: payload
|
|
1293
1348
|
};
|
|
1294
1349
|
};
|
|
1350
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1351
|
+
return {
|
|
1352
|
+
type: SET_CARDS_DETAILS,
|
|
1353
|
+
payload: payload
|
|
1354
|
+
};
|
|
1355
|
+
};
|
|
1295
1356
|
var setCustomField = function setCustomField(payload) {
|
|
1296
1357
|
return {
|
|
1297
1358
|
type: SET_CUSTOM_FIELD,
|
|
@@ -1363,7 +1424,7 @@ var fetchCountryCodes = function fetchCountryCodes() {
|
|
|
1363
1424
|
return new Promise(function (resolve, reject) {
|
|
1364
1425
|
api$2.get(userAddEditUrl.countryCode()).then(function (res) {
|
|
1365
1426
|
dispatch(setCountryCodes(res.data.country_code_details));
|
|
1366
|
-
resolve(
|
|
1427
|
+
resolve(res.data.country_code_details);
|
|
1367
1428
|
})["catch"](function (err) {
|
|
1368
1429
|
reject(err);
|
|
1369
1430
|
})["finally"](function () {});
|
|
@@ -3194,6 +3255,12 @@ var products = [{
|
|
|
3194
3255
|
name: 'expense',
|
|
3195
3256
|
type: 'checkbox',
|
|
3196
3257
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3258
|
+
}, {
|
|
3259
|
+
id: 3,
|
|
3260
|
+
label: 'Cards',
|
|
3261
|
+
name: 'cards',
|
|
3262
|
+
type: 'checkbox',
|
|
3263
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3197
3264
|
}];
|
|
3198
3265
|
var dropdownList = {
|
|
3199
3266
|
gender: [{
|
|
@@ -3364,6 +3431,34 @@ var expenseConstants = {
|
|
|
3364
3431
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3365
3432
|
}]
|
|
3366
3433
|
};
|
|
3434
|
+
var cardsConstants = {
|
|
3435
|
+
heading: 'Card specific information',
|
|
3436
|
+
roleHeading: 'Card role',
|
|
3437
|
+
roleDescription: 'Roles allow users to only access relevant features and functionalities',
|
|
3438
|
+
roles: [{
|
|
3439
|
+
id: 1,
|
|
3440
|
+
label: 'Card holder',
|
|
3441
|
+
description: 'Can own and use cards that are issued to them',
|
|
3442
|
+
value: '',
|
|
3443
|
+
name: '',
|
|
3444
|
+
type: 'radio',
|
|
3445
|
+
isAssigned: false,
|
|
3446
|
+
fullWidth: false,
|
|
3447
|
+
visibility: true,
|
|
3448
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3449
|
+
}, {
|
|
3450
|
+
id: 2,
|
|
3451
|
+
label: 'Card admin',
|
|
3452
|
+
description: 'Can issue cards to others and can manage all cards and transactions across the company.',
|
|
3453
|
+
value: '',
|
|
3454
|
+
name: '',
|
|
3455
|
+
type: 'radio',
|
|
3456
|
+
isAssigned: false,
|
|
3457
|
+
fullWidth: false,
|
|
3458
|
+
visibility: true,
|
|
3459
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3460
|
+
}]
|
|
3461
|
+
};
|
|
3367
3462
|
var passportInfo = [{
|
|
3368
3463
|
id: 1,
|
|
3369
3464
|
label: 'Passport issuing country',
|
|
@@ -3593,6 +3688,12 @@ var initialState = {
|
|
|
3593
3688
|
travelConstants: travelConstants,
|
|
3594
3689
|
expenseConstants: expenseConstants
|
|
3595
3690
|
},
|
|
3691
|
+
isCardsDetailsRendered: false,
|
|
3692
|
+
isCardsAdmin: false,
|
|
3693
|
+
cardsDetails: {
|
|
3694
|
+
cardsRoles: cardsConstants.roles,
|
|
3695
|
+
cardsConstants: cardsConstants
|
|
3696
|
+
},
|
|
3596
3697
|
dropdownList: dropdownList,
|
|
3597
3698
|
maxTravelApprovers: 10,
|
|
3598
3699
|
maxExpenseApprovers: 10,
|
|
@@ -3759,11 +3860,37 @@ var reducer = function reducer(state, action) {
|
|
|
3759
3860
|
isRendered: true
|
|
3760
3861
|
});
|
|
3761
3862
|
}
|
|
3863
|
+
case SET_CARDS_DETAILS:
|
|
3864
|
+
{
|
|
3865
|
+
var _action$payload8, _action$payload8$role, _action$payload9;
|
|
3866
|
+
var cardsDetails = _extends({}, state.cardsDetails);
|
|
3867
|
+
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) {
|
|
3868
|
+
cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
|
|
3869
|
+
return {
|
|
3870
|
+
id: role.id,
|
|
3871
|
+
label: role.name,
|
|
3872
|
+
description: role.description,
|
|
3873
|
+
value: role.value,
|
|
3874
|
+
isAssigned: role.is_assigned,
|
|
3875
|
+
name: role.value,
|
|
3876
|
+
type: 'radio',
|
|
3877
|
+
fullWidth: false,
|
|
3878
|
+
visibility: true,
|
|
3879
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3880
|
+
};
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3883
|
+
return _extends({}, state, {
|
|
3884
|
+
cardsDetails: cardsDetails,
|
|
3885
|
+
isCardsDetailsRendered: true,
|
|
3886
|
+
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
|
|
3887
|
+
});
|
|
3888
|
+
}
|
|
3762
3889
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3763
3890
|
{
|
|
3764
3891
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3765
|
-
var _action$
|
|
3766
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3892
|
+
var _action$payload10;
|
|
3893
|
+
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]) {
|
|
3767
3894
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3768
3895
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3769
3896
|
}
|
|
@@ -4816,7 +4943,8 @@ var ErrorMessages = {
|
|
|
4816
4943
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4817
4944
|
passport_photo: 'Please attach passport photo.',
|
|
4818
4945
|
travel_docs: 'Please attach travel docs.',
|
|
4819
|
-
|
|
4946
|
+
only_cards_products: 'Select at least one additional product if opting for cards.',
|
|
4947
|
+
none_products: 'Select at least one product. If opting for cards, please choose at least one additional product.'
|
|
4820
4948
|
};
|
|
4821
4949
|
|
|
4822
4950
|
function AddPanelDialog(_ref) {
|
|
@@ -4866,7 +4994,56 @@ function AddPanelDialog(_ref) {
|
|
|
4866
4994
|
})));
|
|
4867
4995
|
}
|
|
4868
4996
|
|
|
4869
|
-
var
|
|
4997
|
+
var CardsField = function CardsField(props) {
|
|
4998
|
+
var cardsConstants = props.cardsConstants,
|
|
4999
|
+
_props$onRoleChange = props.onRoleChange,
|
|
5000
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
5001
|
+
_props$roleValue = props.roleValue,
|
|
5002
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
5003
|
+
_props$isProfile = props.isProfile,
|
|
5004
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5005
|
+
_props$roles = props.roles,
|
|
5006
|
+
roles = _props$roles === void 0 ? [] : _props$roles;
|
|
5007
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5008
|
+
container: true,
|
|
5009
|
+
className: (styles.headingPadding)
|
|
5010
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5011
|
+
variant: "h3",
|
|
5012
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5013
|
+
}, cardsConstants.heading)), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
5014
|
+
className: styles.dividerColor
|
|
5015
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5016
|
+
container: true,
|
|
5017
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5018
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5019
|
+
item: true,
|
|
5020
|
+
sm: 12,
|
|
5021
|
+
md: 4
|
|
5022
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
5023
|
+
label: cardsConstants.roleHeading,
|
|
5024
|
+
headerType: true,
|
|
5025
|
+
description: cardsConstants.roleDescription
|
|
5026
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5027
|
+
item: true,
|
|
5028
|
+
sm: 12,
|
|
5029
|
+
md: 8,
|
|
5030
|
+
lg: 8,
|
|
5031
|
+
xl: 6
|
|
5032
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5033
|
+
container: true,
|
|
5034
|
+
className: styles.formFieldsWrapper
|
|
5035
|
+
}, isProfile ? /*#__PURE__*/React__default.createElement(UserRole, {
|
|
5036
|
+
list: roles,
|
|
5037
|
+
value: roleValue
|
|
5038
|
+
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIRadio, {
|
|
5039
|
+
list: roles,
|
|
5040
|
+
value: roleValue,
|
|
5041
|
+
onValueChange: onRoleChange
|
|
5042
|
+
})))));
|
|
5043
|
+
};
|
|
5044
|
+
|
|
5045
|
+
var IUIToastMessageService$4 = utils.services.IUIToastMessageService,
|
|
5046
|
+
IUILocalStorageService$5 = utils.services.IUILocalStorageService;
|
|
4870
5047
|
var env$4 = utils.configs.env;
|
|
4871
5048
|
var UserAddEdit = function UserAddEdit(props) {
|
|
4872
5049
|
var isEditMode = props.isEditMode,
|
|
@@ -4874,6 +5051,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4874
5051
|
config = props.config,
|
|
4875
5052
|
_props$isProfile = props.isProfile,
|
|
4876
5053
|
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5054
|
+
console.log("isProfile", isProfile);
|
|
5055
|
+
console.log("isEditMode", isEditMode);
|
|
4877
5056
|
env$4.init(config, isProfile);
|
|
4878
5057
|
var queryParams = new URLSearchParams(window.location.search);
|
|
4879
5058
|
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
@@ -4893,7 +5072,12 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4893
5072
|
isRendered = _useSelector.isRendered,
|
|
4894
5073
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
4895
5074
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
4896
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5075
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5076
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5077
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5078
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
5079
|
+
console.log("isCardsAdmin", isCardsAdmin);
|
|
5080
|
+
console.log("cardsDetails", cardsDetails);
|
|
4897
5081
|
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
4898
5082
|
return state.common;
|
|
4899
5083
|
}),
|
|
@@ -4902,11 +5086,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4902
5086
|
hasVerificationError = _useSelector2.hasVerificationError,
|
|
4903
5087
|
isILadmin = _useSelector2.isILadmin,
|
|
4904
5088
|
companyName = _useSelector2.companyName;
|
|
5089
|
+
console.log("id", id);
|
|
4905
5090
|
var history = reactRouterDom.useHistory();
|
|
4906
5091
|
var location = reactRouterDom.useLocation();
|
|
4907
5092
|
var _useState = React.useState({
|
|
4908
5093
|
travel: false,
|
|
4909
|
-
expense: false
|
|
5094
|
+
expense: false,
|
|
5095
|
+
cards: false
|
|
4910
5096
|
}),
|
|
4911
5097
|
productAccess = _useState[0],
|
|
4912
5098
|
setProductAccess = _useState[1];
|
|
@@ -4917,13 +5103,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4917
5103
|
errorMsgs.products = '';
|
|
4918
5104
|
var _productAccess = _extends({}, productAccess);
|
|
4919
5105
|
_productAccess[value] = !_productAccess[value];
|
|
4920
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5106
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.cards === true) {
|
|
4921
5107
|
var _errorArray = [].concat(errorArray);
|
|
4922
5108
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4923
5109
|
if (_errorArray.indexOf('products') === -1) {
|
|
4924
5110
|
_errorArray.push('products');
|
|
4925
5111
|
}
|
|
4926
|
-
_errorMsgs.products = ErrorMessages.
|
|
5112
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4927
5113
|
setErrorArray(_errorArray);
|
|
4928
5114
|
setErrorMsgs(_errorMsgs);
|
|
4929
5115
|
var el = document.getElementById('products');
|
|
@@ -4933,13 +5119,202 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4933
5119
|
block: 'center'
|
|
4934
5120
|
});
|
|
4935
5121
|
}
|
|
5122
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.cards === false) {
|
|
5123
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5124
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5125
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5126
|
+
_errorArray2.push('products');
|
|
5127
|
+
}
|
|
5128
|
+
_errorMsgs2.products = ErrorMessages.none_products;
|
|
5129
|
+
setErrorArray(_errorArray2);
|
|
5130
|
+
setErrorMsgs(_errorMsgs2);
|
|
5131
|
+
var _el = document.getElementById('products');
|
|
5132
|
+
if (_el) {
|
|
5133
|
+
_el.scrollIntoView({
|
|
5134
|
+
behavior: 'smooth',
|
|
5135
|
+
block: 'center'
|
|
5136
|
+
});
|
|
5137
|
+
}
|
|
4936
5138
|
} else {
|
|
4937
5139
|
setErrorArray(errorArray);
|
|
4938
5140
|
setErrorMsgs(errorMsgs);
|
|
4939
5141
|
}
|
|
4940
5142
|
setProductAccess(_productAccess);
|
|
4941
5143
|
};
|
|
4942
|
-
var _useState2 = React.useState(
|
|
5144
|
+
var _useState2 = React.useState(''),
|
|
5145
|
+
newCountryCode = _useState2[0],
|
|
5146
|
+
setNewCountryCode = _useState2[1];
|
|
5147
|
+
var _useState3 = React.useState(),
|
|
5148
|
+
countryDialCode = _useState3[0],
|
|
5149
|
+
setCountryDialCode = _useState3[1];
|
|
5150
|
+
var _useState4 = React.useState([]),
|
|
5151
|
+
countryContactCode = _useState4[0],
|
|
5152
|
+
setCountryContactCode = _useState4[1];
|
|
5153
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5154
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5155
|
+
if (isProfile) {
|
|
5156
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5157
|
+
(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);
|
|
5158
|
+
} else {
|
|
5159
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5160
|
+
(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);
|
|
5161
|
+
}
|
|
5162
|
+
setFilesForDelete([]);
|
|
5163
|
+
setProfilePicDelete([]);
|
|
5164
|
+
})["catch"](function (err) {
|
|
5165
|
+
if (typeof err === 'object') {
|
|
5166
|
+
if (err.country_code) {
|
|
5167
|
+
err.contact_number = err.country_code;
|
|
5168
|
+
}
|
|
5169
|
+
if (err.contact_country_code) {
|
|
5170
|
+
err.contact_number = err.contact_country_code;
|
|
5171
|
+
}
|
|
5172
|
+
if (err.passport) {
|
|
5173
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5174
|
+
delete err.passport;
|
|
5175
|
+
}
|
|
5176
|
+
setErrorArray(Object.keys(err));
|
|
5177
|
+
setErrorMsgs(err);
|
|
5178
|
+
var _loop = function _loop() {
|
|
5179
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5180
|
+
if (err[key]) {
|
|
5181
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5182
|
+
setAdditionalInfoFlag('open');
|
|
5183
|
+
}
|
|
5184
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5185
|
+
if (el) {
|
|
5186
|
+
setTimeout(function () {
|
|
5187
|
+
el.scrollIntoView({
|
|
5188
|
+
behavior: 'smooth',
|
|
5189
|
+
block: 'center'
|
|
5190
|
+
});
|
|
5191
|
+
}, 500);
|
|
5192
|
+
return 1;
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5196
|
+
};
|
|
5197
|
+
for (var key in err) {
|
|
5198
|
+
if (_loop()) break;
|
|
5199
|
+
}
|
|
5200
|
+
} else if (typeof err === 'string') {
|
|
5201
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5202
|
+
} else {
|
|
5203
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5204
|
+
}
|
|
5205
|
+
})["finally"](function () {
|
|
5206
|
+
dispatch(stopLoader());
|
|
5207
|
+
});
|
|
5208
|
+
};
|
|
5209
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5210
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5211
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5212
|
+
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) {
|
|
5213
|
+
history.push({
|
|
5214
|
+
pathname: config.routes.users.list.path
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5217
|
+
})["catch"](function (err) {
|
|
5218
|
+
if (typeof err === 'object') {
|
|
5219
|
+
if (err.country_code) {
|
|
5220
|
+
err.contact_number = err.country_code;
|
|
5221
|
+
}
|
|
5222
|
+
if (err.contact_country_code) {
|
|
5223
|
+
err.contact_number = err.contact_country_code;
|
|
5224
|
+
}
|
|
5225
|
+
if (err.passport) {
|
|
5226
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5227
|
+
delete err.passport;
|
|
5228
|
+
}
|
|
5229
|
+
setErrorArray(Object.keys(err));
|
|
5230
|
+
setErrorMsgs(err);
|
|
5231
|
+
var _loop2 = function _loop2() {
|
|
5232
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5233
|
+
if (err[key]) {
|
|
5234
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5235
|
+
setAdditionalInfoFlag('open');
|
|
5236
|
+
}
|
|
5237
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5238
|
+
if (el) {
|
|
5239
|
+
setTimeout(function () {
|
|
5240
|
+
el.scrollIntoView({
|
|
5241
|
+
behavior: 'smooth',
|
|
5242
|
+
block: 'center'
|
|
5243
|
+
});
|
|
5244
|
+
}, 500);
|
|
5245
|
+
return 1;
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
for (var key in err) {
|
|
5251
|
+
if (_loop2()) break;
|
|
5252
|
+
}
|
|
5253
|
+
} else if (typeof err === 'string') {
|
|
5254
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5255
|
+
} else {
|
|
5256
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5257
|
+
}
|
|
5258
|
+
})["finally"](function () {
|
|
5259
|
+
dispatch(stopLoader());
|
|
5260
|
+
});
|
|
5261
|
+
};
|
|
5262
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5263
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5264
|
+
method: 'GET',
|
|
5265
|
+
headers: {
|
|
5266
|
+
'Content-Type': 'application/json',
|
|
5267
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5268
|
+
}
|
|
5269
|
+
}).then(function (response) {
|
|
5270
|
+
return response.json();
|
|
5271
|
+
}).then(function (res) {
|
|
5272
|
+
var _res$roles;
|
|
5273
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5274
|
+
dispatch(setCardsDetails(res));
|
|
5275
|
+
} else {
|
|
5276
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5277
|
+
}
|
|
5278
|
+
})["catch"](function (error) {
|
|
5279
|
+
console.log("errorrr", error);
|
|
5280
|
+
});
|
|
5281
|
+
};
|
|
5282
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5283
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5284
|
+
method: 'GET',
|
|
5285
|
+
headers: {
|
|
5286
|
+
'Content-Type': 'application/json',
|
|
5287
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5288
|
+
}
|
|
5289
|
+
}).then(function (response) {
|
|
5290
|
+
return response.json();
|
|
5291
|
+
}).then(function (res) {
|
|
5292
|
+
var _res$roles2;
|
|
5293
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5294
|
+
dispatch(setCardsDetails(res));
|
|
5295
|
+
} else {
|
|
5296
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5297
|
+
}
|
|
5298
|
+
})["catch"](function (error) {
|
|
5299
|
+
console.log("errorrr", error);
|
|
5300
|
+
});
|
|
5301
|
+
};
|
|
5302
|
+
React.useEffect(function () {
|
|
5303
|
+
var countryObject = countryContactCode.find(function (t) {
|
|
5304
|
+
return t.dial_code === countryDialCode;
|
|
5305
|
+
});
|
|
5306
|
+
if (countryObject) {
|
|
5307
|
+
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5308
|
+
country_code: countryObject.code
|
|
5309
|
+
}));
|
|
5310
|
+
}
|
|
5311
|
+
}, [countryDialCode]);
|
|
5312
|
+
React.useEffect(function () {
|
|
5313
|
+
var extractedNumber = newCountryCode.substring(1);
|
|
5314
|
+
var convertedNumber = parseInt(extractedNumber);
|
|
5315
|
+
setCountryDialCode(convertedNumber);
|
|
5316
|
+
}, [newCountryCode]);
|
|
5317
|
+
var _useState5 = React.useState({
|
|
4943
5318
|
first_name: '',
|
|
4944
5319
|
last_name: '',
|
|
4945
5320
|
email: '',
|
|
@@ -4950,9 +5325,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4950
5325
|
contact_country_code: '',
|
|
4951
5326
|
profile_pic: []
|
|
4952
5327
|
}),
|
|
4953
|
-
personalInfoInput =
|
|
4954
|
-
setPersonalInfoInput =
|
|
4955
|
-
var
|
|
5328
|
+
personalInfoInput = _useState5[0],
|
|
5329
|
+
setPersonalInfoInput = _useState5[1];
|
|
5330
|
+
var _useState6 = React.useState({
|
|
4956
5331
|
emp_level: {
|
|
4957
5332
|
value: '',
|
|
4958
5333
|
label: 'Select employee level'
|
|
@@ -4985,9 +5360,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4985
5360
|
label: defaultCurrency
|
|
4986
5361
|
}
|
|
4987
5362
|
}),
|
|
4988
|
-
employeeInfoInput =
|
|
4989
|
-
setEmployeeInfoInput =
|
|
4990
|
-
var
|
|
5363
|
+
employeeInfoInput = _useState6[0],
|
|
5364
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5365
|
+
var _useState7 = React.useState({
|
|
4991
5366
|
emp_level: 0,
|
|
4992
5367
|
entity: 0,
|
|
4993
5368
|
business_unit: 0,
|
|
@@ -4996,48 +5371,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4996
5371
|
manager_id: 0,
|
|
4997
5372
|
skip_manager_id: 0
|
|
4998
5373
|
}),
|
|
4999
|
-
cacheForAsyncDropdown =
|
|
5000
|
-
clearCacheForAsyncDropdown =
|
|
5001
|
-
var
|
|
5002
|
-
userTagType =
|
|
5003
|
-
setUserTagType =
|
|
5004
|
-
var
|
|
5005
|
-
scroll =
|
|
5006
|
-
setScroll =
|
|
5007
|
-
var
|
|
5008
|
-
customFieldsInput =
|
|
5009
|
-
setCustomFieldsInput =
|
|
5010
|
-
var
|
|
5011
|
-
travelRole =
|
|
5012
|
-
setTravelRole =
|
|
5013
|
-
var
|
|
5014
|
-
travelApproversInput =
|
|
5015
|
-
setTravelApproversInput =
|
|
5016
|
-
var
|
|
5374
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5375
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5376
|
+
var _useState8 = React.useState({}),
|
|
5377
|
+
userTagType = _useState8[0],
|
|
5378
|
+
setUserTagType = _useState8[1];
|
|
5379
|
+
var _useState9 = React.useState(false),
|
|
5380
|
+
scroll = _useState9[0],
|
|
5381
|
+
setScroll = _useState9[1];
|
|
5382
|
+
var _useState10 = React.useState({}),
|
|
5383
|
+
customFieldsInput = _useState10[0],
|
|
5384
|
+
setCustomFieldsInput = _useState10[1];
|
|
5385
|
+
var _useState11 = React.useState('traveler'),
|
|
5386
|
+
travelRole = _useState11[0],
|
|
5387
|
+
setTravelRole = _useState11[1];
|
|
5388
|
+
var _useState12 = React.useState({}),
|
|
5389
|
+
travelApproversInput = _useState12[0],
|
|
5390
|
+
setTravelApproversInput = _useState12[1];
|
|
5391
|
+
var _useState13 = React.useState({
|
|
5017
5392
|
value: '',
|
|
5018
5393
|
label: 'Select approver'
|
|
5019
5394
|
}),
|
|
5020
|
-
travelFYI =
|
|
5021
|
-
setTravelFYI =
|
|
5022
|
-
var
|
|
5023
|
-
membershipInfoInput =
|
|
5024
|
-
setMembershipInfoInput =
|
|
5025
|
-
var
|
|
5026
|
-
removedMembershipInfoInput =
|
|
5027
|
-
setRemovedMembershipInfoInput =
|
|
5028
|
-
var
|
|
5395
|
+
travelFYI = _useState13[0],
|
|
5396
|
+
setTravelFYI = _useState13[1];
|
|
5397
|
+
var _useState14 = React.useState([]),
|
|
5398
|
+
membershipInfoInput = _useState14[0],
|
|
5399
|
+
setMembershipInfoInput = _useState14[1];
|
|
5400
|
+
var _useState15 = React.useState([]),
|
|
5401
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5402
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5403
|
+
var _useState16 = React.useState({
|
|
5029
5404
|
flight_seat_preference: '',
|
|
5030
5405
|
meal_preference: ''
|
|
5031
5406
|
}),
|
|
5032
|
-
travelPreferenceInfo =
|
|
5033
|
-
settravelPreferenceInfo =
|
|
5034
|
-
var
|
|
5407
|
+
travelPreferenceInfo = _useState16[0],
|
|
5408
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5409
|
+
var _useState17 = React.useState({
|
|
5035
5410
|
trusted_traveller: '',
|
|
5036
5411
|
redress_number: ''
|
|
5037
5412
|
}),
|
|
5038
|
-
secureTravelInputInfo =
|
|
5039
|
-
setSecureTravelInputInfo =
|
|
5040
|
-
var
|
|
5413
|
+
secureTravelInputInfo = _useState17[0],
|
|
5414
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5415
|
+
var _useState18 = React.useState({
|
|
5041
5416
|
passport_issue_country: {
|
|
5042
5417
|
value: '',
|
|
5043
5418
|
label: 'Select country'
|
|
@@ -5052,39 +5427,94 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5052
5427
|
passport_photo: [],
|
|
5053
5428
|
travel_docs: []
|
|
5054
5429
|
}),
|
|
5055
|
-
passportInfoInput =
|
|
5056
|
-
setPassportInfoInput =
|
|
5057
|
-
var
|
|
5058
|
-
filesForDelete =
|
|
5059
|
-
setFilesForDelete =
|
|
5060
|
-
var
|
|
5061
|
-
profilePicDelete =
|
|
5062
|
-
setProfilePicDelete =
|
|
5063
|
-
var
|
|
5064
|
-
isAdditionalInfoExpanded =
|
|
5065
|
-
setAdditionalInfoFlag =
|
|
5066
|
-
var
|
|
5067
|
-
expenseRole =
|
|
5068
|
-
setExpenseRole =
|
|
5069
|
-
var
|
|
5070
|
-
expenseApproversInput =
|
|
5071
|
-
setExpenseApproversInput =
|
|
5072
|
-
var
|
|
5430
|
+
passportInfoInput = _useState18[0],
|
|
5431
|
+
setPassportInfoInput = _useState18[1];
|
|
5432
|
+
var _useState19 = React.useState([]),
|
|
5433
|
+
filesForDelete = _useState19[0],
|
|
5434
|
+
setFilesForDelete = _useState19[1];
|
|
5435
|
+
var _useState20 = React.useState([]),
|
|
5436
|
+
profilePicDelete = _useState20[0],
|
|
5437
|
+
setProfilePicDelete = _useState20[1];
|
|
5438
|
+
var _useState21 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5439
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5440
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5441
|
+
var _useState22 = React.useState('submitter'),
|
|
5442
|
+
expenseRole = _useState22[0],
|
|
5443
|
+
setExpenseRole = _useState22[1];
|
|
5444
|
+
var _useState23 = React.useState({}),
|
|
5445
|
+
expenseApproversInput = _useState23[0],
|
|
5446
|
+
setExpenseApproversInput = _useState23[1];
|
|
5447
|
+
var _useState24 = React.useState({
|
|
5073
5448
|
value: '',
|
|
5074
5449
|
label: 'Select approver'
|
|
5075
5450
|
}),
|
|
5076
|
-
expenseFYI =
|
|
5077
|
-
setExpenseFYI =
|
|
5451
|
+
expenseFYI = _useState24[0],
|
|
5452
|
+
setExpenseFYI = _useState24[1];
|
|
5453
|
+
var _useState25 = React.useState(''),
|
|
5454
|
+
cardsRole = _useState25[0],
|
|
5455
|
+
setCardsRole = _useState25[1];
|
|
5456
|
+
var _useState26 = React.useState(false),
|
|
5457
|
+
cardsErrorMsg = _useState26[0],
|
|
5458
|
+
setCardsErrorMsg = _useState26[1];
|
|
5459
|
+
console.log("cardsRole123", cardsRole);
|
|
5460
|
+
console.log("cardsErrorMsg", cardsErrorMsg);
|
|
5461
|
+
React.useEffect(function () {
|
|
5462
|
+
if (isCardsAdmin === false && cardsRole.includes("card_admin")) {
|
|
5463
|
+
setCardsErrorMsg(true);
|
|
5464
|
+
IUIToastMessageService$4.warningNotify("You are not authorized person to make someone admin");
|
|
5465
|
+
} else {
|
|
5466
|
+
setCardsErrorMsg(false);
|
|
5467
|
+
}
|
|
5468
|
+
}, [cardsRole]);
|
|
5469
|
+
React.useEffect(function () {
|
|
5470
|
+
if (productAccess.cards === false) {
|
|
5471
|
+
setCardsRole('');
|
|
5472
|
+
} else {
|
|
5473
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5474
|
+
var role = _step.value;
|
|
5475
|
+
var splitRoleval = role.value.split(":");
|
|
5476
|
+
var defaultRole = splitRoleval[2];
|
|
5477
|
+
if (defaultRole === 'card_holder') {
|
|
5478
|
+
setCardsRole(role.value);
|
|
5479
|
+
break;
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
}, [productAccess.cards]);
|
|
5484
|
+
React.useEffect(function () {
|
|
5485
|
+
if (isCardsDetailsRendered) {
|
|
5486
|
+
var selectedRole = null;
|
|
5487
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step2; !(_step2 = _iterator2()).done;) {
|
|
5488
|
+
var _role = _step2.value;
|
|
5489
|
+
if (_role.isAssigned) {
|
|
5490
|
+
setCardsRole(_role.value);
|
|
5491
|
+
selectedRole = _role.value;
|
|
5492
|
+
break;
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
if (selectedRole === null) {
|
|
5496
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step3; !(_step3 = _iterator3()).done;) {
|
|
5497
|
+
var role = _step3.value;
|
|
5498
|
+
var splitRoleval = role.value.split(":");
|
|
5499
|
+
var defaultRole = splitRoleval[2];
|
|
5500
|
+
if (defaultRole === 'card_holder') {
|
|
5501
|
+
setCardsRole(role.value);
|
|
5502
|
+
break;
|
|
5503
|
+
}
|
|
5504
|
+
}
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
}, [isCardsDetailsRendered, cardsDetails]);
|
|
5078
5508
|
var asyncSelectRefs = React.useRef({
|
|
5079
5509
|
emp_level: React.useRef(null),
|
|
5080
5510
|
entity: React.useRef(null),
|
|
5081
5511
|
business_unit: React.useRef(null),
|
|
5082
5512
|
department: React.useRef(null)
|
|
5083
5513
|
});
|
|
5084
|
-
var
|
|
5085
|
-
errorArray =
|
|
5086
|
-
setErrorArray =
|
|
5087
|
-
var
|
|
5514
|
+
var _useState27 = React.useState([]),
|
|
5515
|
+
errorArray = _useState27[0],
|
|
5516
|
+
setErrorArray = _useState27[1];
|
|
5517
|
+
var _useState28 = React.useState({
|
|
5088
5518
|
first_name: '',
|
|
5089
5519
|
last_name: '',
|
|
5090
5520
|
email: '',
|
|
@@ -5114,9 +5544,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5114
5544
|
userTagType: '',
|
|
5115
5545
|
profile_pic: ''
|
|
5116
5546
|
}),
|
|
5117
|
-
errorMsgs =
|
|
5118
|
-
setErrorMsgs =
|
|
5119
|
-
var
|
|
5547
|
+
errorMsgs = _useState28[0],
|
|
5548
|
+
setErrorMsgs = _useState28[1];
|
|
5549
|
+
var _useState29 = React.useState({
|
|
5120
5550
|
first_name: false,
|
|
5121
5551
|
last_name: false,
|
|
5122
5552
|
email: false,
|
|
@@ -5143,14 +5573,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5143
5573
|
userTagType: false,
|
|
5144
5574
|
profile_pic: false
|
|
5145
5575
|
}),
|
|
5146
|
-
inputChangeLog =
|
|
5147
|
-
updateInputChangeLog =
|
|
5148
|
-
var
|
|
5149
|
-
uploadedFiles =
|
|
5150
|
-
setUploadedFiles =
|
|
5151
|
-
var
|
|
5152
|
-
maxLengthForModal =
|
|
5153
|
-
setMaxLengthForModal =
|
|
5576
|
+
inputChangeLog = _useState29[0],
|
|
5577
|
+
updateInputChangeLog = _useState29[1];
|
|
5578
|
+
var _useState30 = React.useState([]),
|
|
5579
|
+
uploadedFiles = _useState30[0],
|
|
5580
|
+
setUploadedFiles = _useState30[1];
|
|
5581
|
+
var _useState31 = React.useState(70),
|
|
5582
|
+
maxLengthForModal = _useState31[0],
|
|
5583
|
+
setMaxLengthForModal = _useState31[1];
|
|
5154
5584
|
var defaultAddModalData = {
|
|
5155
5585
|
isOpen: false,
|
|
5156
5586
|
isError: false,
|
|
@@ -5166,9 +5596,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5166
5596
|
maxLength: maxLengthForModal,
|
|
5167
5597
|
minLength: 0
|
|
5168
5598
|
};
|
|
5169
|
-
var
|
|
5170
|
-
addModalData =
|
|
5171
|
-
setAddModalData =
|
|
5599
|
+
var _useState32 = React.useState(defaultAddModalData),
|
|
5600
|
+
addModalData = _useState32[0],
|
|
5601
|
+
setAddModalData = _useState32[1];
|
|
5172
5602
|
var onAddModalClose = function onAddModalClose() {
|
|
5173
5603
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5174
5604
|
};
|
|
@@ -5345,7 +5775,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5345
5775
|
_value = args._value,
|
|
5346
5776
|
_isError = args._isError,
|
|
5347
5777
|
_errorMsg = args._errorMsg;
|
|
5348
|
-
console.log(_name, _value);
|
|
5349
5778
|
setEmployeeInfoInput(_extends({}, employeeInfoInput, (_extends8 = {}, _extends8[_name] = _value, _extends8)));
|
|
5350
5779
|
updateError(_name, _isError, _errorMsg);
|
|
5351
5780
|
if (Object.hasOwnProperty.call(inputChangeLog, _name)) {
|
|
@@ -5379,7 +5808,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5379
5808
|
var _extends12;
|
|
5380
5809
|
var _name = _ref3._name,
|
|
5381
5810
|
_value = _ref3._value;
|
|
5382
|
-
console.log(_name, _value, 'travel');
|
|
5383
5811
|
setTravelApproversInput(_extends({}, travelApproversInput, (_extends12 = {}, _extends12[_name] = _value, _extends12)));
|
|
5384
5812
|
};
|
|
5385
5813
|
var onExpenseApproversInputChange = function onExpenseApproversInputChange(_ref4) {
|
|
@@ -5577,6 +6005,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5577
6005
|
React.useEffect(function () {
|
|
5578
6006
|
if (isTokenVerified === true) {
|
|
5579
6007
|
dispatch(fetchRenderFileds());
|
|
6008
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
5580
6009
|
}
|
|
5581
6010
|
}, [isTokenVerified]);
|
|
5582
6011
|
React.useEffect(function () {
|
|
@@ -5591,6 +6020,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5591
6020
|
}
|
|
5592
6021
|
}));
|
|
5593
6022
|
dispatch(fetchCountryCodes()).then(function (_res) {
|
|
6023
|
+
setCountryContactCode(_res);
|
|
5594
6024
|
if (isEditMode) {
|
|
5595
6025
|
if (!isProfile && !editUserId) return false;
|
|
5596
6026
|
dispatch(setStaticFieldsVisibility({
|
|
@@ -5701,7 +6131,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5701
6131
|
var products = res.user_product.split('+');
|
|
5702
6132
|
setProductAccess({
|
|
5703
6133
|
travel: products.includes('travel'),
|
|
5704
|
-
expense: products.includes('expense')
|
|
6134
|
+
expense: products.includes('expense'),
|
|
6135
|
+
cards: products.includes('cards')
|
|
5705
6136
|
});
|
|
5706
6137
|
if (products.includes('travel')) {
|
|
5707
6138
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5912,13 +6343,15 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5912
6343
|
IUIToastMessageService$4.warningNotify(checkAnyError);
|
|
5913
6344
|
return Promise.resolve();
|
|
5914
6345
|
}
|
|
5915
|
-
console.log(employeeInfoInput, 'data');
|
|
5916
6346
|
if (employeeInfoInput.manager_id.value !== '') {
|
|
5917
6347
|
employeeInfoInput.manager_id = employeeInfoInput.manager.value;
|
|
5918
6348
|
}
|
|
5919
6349
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
5920
6350
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
5921
6351
|
}
|
|
6352
|
+
var cardsPayload = {
|
|
6353
|
+
"roles": [cardsRole]
|
|
6354
|
+
};
|
|
5922
6355
|
var payload = {
|
|
5923
6356
|
personalInfoInput: personalInfoInput,
|
|
5924
6357
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5937,7 +6370,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5937
6370
|
uploadedFiles: uploadedFiles,
|
|
5938
6371
|
filesForDelete: filesForDelete,
|
|
5939
6372
|
profilePicDelete: profilePicDelete,
|
|
5940
|
-
userTagType: userTagType
|
|
6373
|
+
userTagType: userTagType,
|
|
6374
|
+
cardsRole: cardsRole,
|
|
6375
|
+
isCardsAdmin: isCardsAdmin
|
|
5941
6376
|
};
|
|
5942
6377
|
if (verifyUserId) {
|
|
5943
6378
|
payload.verifyUserId = verifyUserId;
|
|
@@ -5949,6 +6384,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5949
6384
|
employeeInfo = optionalFields.employee_info,
|
|
5950
6385
|
userTravelInfo = optionalFields.user_travel_info;
|
|
5951
6386
|
var allMandatoryFields = ['first_name', 'last_name', 'email'];
|
|
6387
|
+
if (cardsErrorMsg) {
|
|
6388
|
+
_isError = true;
|
|
6389
|
+
}
|
|
5952
6390
|
allMandatoryFields.forEach(function (key, index) {
|
|
5953
6391
|
if (personalInfoInput[key] === '') {
|
|
5954
6392
|
_isError = true;
|
|
@@ -5976,11 +6414,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5976
6414
|
}
|
|
5977
6415
|
}
|
|
5978
6416
|
for (var _key in employeeInfo) {
|
|
5979
|
-
console.log('key', _key);
|
|
5980
6417
|
if (Object.hasOwnProperty.call(employeeInfo, _key)) {
|
|
5981
|
-
|
|
5982
|
-
console.log('employeeInfo0000', (_employeeInfoInput$_k = employeeInfoInput[_key]) === null || _employeeInfoInput$_k === void 0 ? void 0 : _employeeInfoInput$_k.value, 'sajkdhjasj');
|
|
5983
|
-
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) {
|
|
6418
|
+
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) {
|
|
5984
6419
|
_isError = true;
|
|
5985
6420
|
if (_errorArray.indexOf(_key) === -1) _errorArray.push(_key);
|
|
5986
6421
|
_errorMsgs[_key] = ErrorMessages[_key];
|
|
@@ -6066,7 +6501,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6066
6501
|
if (_isError) {
|
|
6067
6502
|
setErrorArray(_errorArray);
|
|
6068
6503
|
setErrorMsgs(_errorMsgs);
|
|
6069
|
-
var
|
|
6504
|
+
var _loop3 = function _loop3() {
|
|
6070
6505
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6071
6506
|
if (_errorMsgs[_key3]) {
|
|
6072
6507
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6086,115 +6521,64 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6086
6521
|
}
|
|
6087
6522
|
};
|
|
6088
6523
|
for (var _key3 in _errorMsgs) {
|
|
6089
|
-
if (
|
|
6524
|
+
if (_loop3()) break;
|
|
6090
6525
|
}
|
|
6091
6526
|
}
|
|
6527
|
+
var cardApiflag = false;
|
|
6528
|
+
if (productAccess.cards === false) {
|
|
6529
|
+
cardApiflag = false;
|
|
6530
|
+
} else {
|
|
6531
|
+
cardApiflag = true;
|
|
6532
|
+
}
|
|
6092
6533
|
if (!_isError) {
|
|
6093
6534
|
if (isEditMode && editUserId || isProfile) {
|
|
6094
6535
|
dispatch(showLoader());
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
}
|
|
6103
|
-
setFilesForDelete([]);
|
|
6104
|
-
setProfilePicDelete([]);
|
|
6105
|
-
})["catch"](function (err) {
|
|
6106
|
-
if (typeof err === 'object') {
|
|
6107
|
-
if (err.country_code) {
|
|
6108
|
-
err.contact_number = err.country_code;
|
|
6109
|
-
}
|
|
6110
|
-
if (err.contact_country_code) {
|
|
6111
|
-
err.contact_number = err.contact_country_code;
|
|
6536
|
+
if (cardApiflag) {
|
|
6537
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6538
|
+
method: 'POST',
|
|
6539
|
+
body: JSON.stringify(cardsPayload),
|
|
6540
|
+
headers: {
|
|
6541
|
+
'Content-Type': 'application/json',
|
|
6542
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6112
6543
|
}
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
}
|
|
6117
|
-
|
|
6118
|
-
setErrorMsgs(err);
|
|
6119
|
-
var _loop2 = function _loop2() {
|
|
6120
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6121
|
-
if (err[_key4]) {
|
|
6122
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6123
|
-
setAdditionalInfoFlag('open');
|
|
6124
|
-
}
|
|
6125
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6126
|
-
if (el) {
|
|
6127
|
-
setTimeout(function () {
|
|
6128
|
-
el.scrollIntoView({
|
|
6129
|
-
behavior: 'smooth',
|
|
6130
|
-
block: 'center'
|
|
6131
|
-
});
|
|
6132
|
-
}, 500);
|
|
6133
|
-
return 1;
|
|
6134
|
-
}
|
|
6135
|
-
}
|
|
6136
|
-
}
|
|
6137
|
-
};
|
|
6138
|
-
for (var _key4 in err) {
|
|
6139
|
-
if (_loop2()) break;
|
|
6544
|
+
}).then(function (response) {
|
|
6545
|
+
if (response.status === 200) {
|
|
6546
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6547
|
+
} else {
|
|
6548
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6140
6549
|
}
|
|
6141
|
-
}
|
|
6142
|
-
|
|
6143
|
-
}
|
|
6144
|
-
|
|
6145
|
-
}
|
|
6146
|
-
}
|
|
6147
|
-
|
|
6148
|
-
}
|
|
6550
|
+
})["catch"](function (error) {
|
|
6551
|
+
console.log("errorrr", error);
|
|
6552
|
+
})["finally"](function () {
|
|
6553
|
+
dispatch(stopLoader());
|
|
6554
|
+
});
|
|
6555
|
+
} else {
|
|
6556
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6557
|
+
}
|
|
6149
6558
|
} else {
|
|
6150
6559
|
dispatch(showLoader());
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
}
|
|
6159
|
-
if (err.contact_country_code) {
|
|
6160
|
-
err.contact_number = err.contact_country_code;
|
|
6161
|
-
}
|
|
6162
|
-
if (err.passport) {
|
|
6163
|
-
err.passport_photo = _extends({}, err.passport);
|
|
6164
|
-
delete err.passport;
|
|
6560
|
+
if (cardApiflag === true) {
|
|
6561
|
+
fetch(userAddEditUrl.cardsEditUserDetails(isEditMode ? editUserId : id), {
|
|
6562
|
+
method: 'POST',
|
|
6563
|
+
body: JSON.stringify(cardsPayload),
|
|
6564
|
+
headers: {
|
|
6565
|
+
'Content-Type': 'application/json',
|
|
6566
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6165
6567
|
}
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
if (_key5 in passportInfoInput || _key5 in travelPreferenceInfo || _key5 in secureTravelInputInfo) {
|
|
6172
|
-
setAdditionalInfoFlag('open');
|
|
6173
|
-
}
|
|
6174
|
-
var el = document.getElementById(_key5 === 'country_code' || _key5 === 'contact_country_code' ? 'contact_number' : _key5);
|
|
6175
|
-
if (el) {
|
|
6176
|
-
setTimeout(function () {
|
|
6177
|
-
el.scrollIntoView({
|
|
6178
|
-
behavior: 'smooth',
|
|
6179
|
-
block: 'center'
|
|
6180
|
-
});
|
|
6181
|
-
}, 500);
|
|
6182
|
-
return 1;
|
|
6183
|
-
}
|
|
6184
|
-
}
|
|
6185
|
-
}
|
|
6186
|
-
};
|
|
6187
|
-
for (var _key5 in err) {
|
|
6188
|
-
if (_loop3()) break;
|
|
6568
|
+
}).then(function (response) {
|
|
6569
|
+
if (response.status === 200) {
|
|
6570
|
+
createUserApiCall(payload);
|
|
6571
|
+
} else {
|
|
6572
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6189
6573
|
}
|
|
6190
|
-
}
|
|
6191
|
-
|
|
6192
|
-
}
|
|
6193
|
-
|
|
6194
|
-
}
|
|
6195
|
-
}
|
|
6196
|
-
|
|
6197
|
-
}
|
|
6574
|
+
})["catch"](function (error) {
|
|
6575
|
+
console.log("errorrr", error);
|
|
6576
|
+
})["finally"](function () {
|
|
6577
|
+
dispatch(stopLoader());
|
|
6578
|
+
});
|
|
6579
|
+
} else {
|
|
6580
|
+
createUserApiCall(payload);
|
|
6581
|
+
}
|
|
6198
6582
|
}
|
|
6199
6583
|
}
|
|
6200
6584
|
return Promise.resolve();
|
|
@@ -6233,17 +6617,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6233
6617
|
if (verifyUserId) {
|
|
6234
6618
|
dispatch(showLoader());
|
|
6235
6619
|
dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
|
|
6620
|
+
setNewCountryCode(res === null || res === void 0 ? void 0 : res.country_contact_code);
|
|
6236
6621
|
setPersonalInfoInput(function (prevState) {
|
|
6237
6622
|
return _extends({}, prevState, {
|
|
6238
|
-
first_name: res.
|
|
6239
|
-
last_name: res.
|
|
6623
|
+
first_name: res.first_name,
|
|
6624
|
+
last_name: res.last_name,
|
|
6240
6625
|
email: res.email,
|
|
6241
|
-
contact_number: res.
|
|
6242
|
-
dob: function () {
|
|
6243
|
-
var dt = new Date(res.dob);
|
|
6244
|
-
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
6245
|
-
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
6246
|
-
}(),
|
|
6626
|
+
contact_number: res === null || res === void 0 ? void 0 : res.contact_number,
|
|
6247
6627
|
gender: function () {
|
|
6248
6628
|
if (res.gender === 'male') return 'Male';else if (res.gender === 'female') return 'Female';else if (res.gender === 'others') return 'Others';else return '';
|
|
6249
6629
|
}()
|
|
@@ -6516,7 +6896,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6516
6896
|
md: 4
|
|
6517
6897
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
6518
6898
|
label: "Product access",
|
|
6519
|
-
description: isProfile ? '' : '
|
|
6899
|
+
description: isProfile ? '' : 'Please select a product. Cards are available along with at least one additional product.',
|
|
6520
6900
|
headerType: true,
|
|
6521
6901
|
required: true
|
|
6522
6902
|
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
@@ -6622,6 +7002,19 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6622
7002
|
isProfile: isProfile,
|
|
6623
7003
|
editUserId: editUserId,
|
|
6624
7004
|
roles: renderFields.expenseRoles
|
|
7005
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
7006
|
+
className: styles.dividerColor
|
|
7007
|
+
}), isCardsDetailsRendered && productAccess && productAccess.cards && /*#__PURE__*/React__default.createElement(CardsField, {
|
|
7008
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7009
|
+
type: "cards",
|
|
7010
|
+
isProfile: isProfile,
|
|
7011
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7012
|
+
var _value = _ref7._value;
|
|
7013
|
+
return setCardsRole(_value);
|
|
7014
|
+
},
|
|
7015
|
+
roleValue: cardsRole,
|
|
7016
|
+
roles: cardsDetails.cardsRoles,
|
|
7017
|
+
cardsAdmin: isCardsAdmin
|
|
6625
7018
|
}))) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
6626
7019
|
config: config,
|
|
6627
7020
|
errMsg: hasVerificationError
|
|
@@ -8430,7 +8823,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8430
8823
|
cell: function cell(row) {
|
|
8431
8824
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8432
8825
|
component: "div"
|
|
8433
|
-
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8826
|
+
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, row.products[0].role !== "Card Holder" ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8434
8827
|
component: "div",
|
|
8435
8828
|
display: "flex"
|
|
8436
8829
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8443,7 +8836,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8443
8836
|
style: {
|
|
8444
8837
|
whiteSpace: 'nowrap'
|
|
8445
8838
|
}
|
|
8446
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8839
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && row.products[1].role !== "Card Holder" && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8447
8840
|
component: "div",
|
|
8448
8841
|
display: "flex"
|
|
8449
8842
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8456,7 +8849,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8456
8849
|
style: {
|
|
8457
8850
|
whiteSpace: 'nowrap'
|
|
8458
8851
|
}
|
|
8459
|
-
}, "\xA0" + row.products[1].role))
|
|
8852
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && row.products[2].role !== "Card Holder" && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8853
|
+
component: "div",
|
|
8854
|
+
display: "flex"
|
|
8855
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8856
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8857
|
+
style: {
|
|
8858
|
+
whiteSpace: 'nowrap'
|
|
8859
|
+
}
|
|
8860
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8861
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8862
|
+
style: {
|
|
8863
|
+
whiteSpace: 'nowrap'
|
|
8864
|
+
}
|
|
8865
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8460
8866
|
}
|
|
8461
8867
|
}, {
|
|
8462
8868
|
id: 'status',
|
|
@@ -8597,17 +9003,17 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8597
9003
|
return dt.getDate() + " " + months[dt.getMonth()] + " " + dt.getFullYear();
|
|
8598
9004
|
};
|
|
8599
9005
|
var columns = [{
|
|
8600
|
-
id: '
|
|
9006
|
+
id: 'first_name',
|
|
8601
9007
|
label: 'Name',
|
|
8602
9008
|
minWidth: 250,
|
|
8603
9009
|
sortable: true,
|
|
8604
9010
|
cell: function cell(row) {
|
|
8605
9011
|
var _row$profile_pic2;
|
|
8606
9012
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIProfileBox, {
|
|
8607
|
-
firstName: row.
|
|
8608
|
-
lastName: row.
|
|
9013
|
+
firstName: row.first_name,
|
|
9014
|
+
lastName: row.last_name,
|
|
8609
9015
|
isLetterAvatar: row.profile_pic && row.profile_pic.presigned_url ? false : true,
|
|
8610
|
-
primaryText: row.
|
|
9016
|
+
primaryText: row.first_name + ' ' + row.last_name,
|
|
8611
9017
|
secondaryText: row.email,
|
|
8612
9018
|
letterAvatarTextColor: "black",
|
|
8613
9019
|
letterAvatarBackgroundColor: "#d3d3d3",
|
|
@@ -8616,7 +9022,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8616
9022
|
}));
|
|
8617
9023
|
}
|
|
8618
9024
|
}, {
|
|
8619
|
-
id: '
|
|
9025
|
+
id: 'created_at',
|
|
8620
9026
|
label: 'Requested on',
|
|
8621
9027
|
minWidth: 100,
|
|
8622
9028
|
sortable: true,
|
|
@@ -8626,7 +9032,7 @@ var SingupRequests = function SingupRequests(props) {
|
|
|
8626
9032
|
width: 100
|
|
8627
9033
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8628
9034
|
className: clsx(styles$5.rowText, styles$5.textTransform)
|
|
8629
|
-
}, formatDate(row.
|
|
9035
|
+
}, formatDate(row.created_at)));
|
|
8630
9036
|
}
|
|
8631
9037
|
}, {
|
|
8632
9038
|
id: 'actions',
|
|
@@ -8899,7 +9305,7 @@ var UserList = function UserList(_ref2) {
|
|
|
8899
9305
|
var _React$useState11 = React__default.useState('asc'),
|
|
8900
9306
|
signup_order = _React$useState11[0],
|
|
8901
9307
|
setSignUpOrder = _React$useState11[1];
|
|
8902
|
-
var _React$useState12 = React__default.useState('
|
|
9308
|
+
var _React$useState12 = React__default.useState('first_name'),
|
|
8903
9309
|
signup_orderBy = _React$useState12[0],
|
|
8904
9310
|
setSignUpOrderBy = _React$useState12[1];
|
|
8905
9311
|
var _useState22 = React.useState(''),
|
|
@@ -8922,7 +9328,11 @@ var UserList = function UserList(_ref2) {
|
|
|
8922
9328
|
}),
|
|
8923
9329
|
signupRequestListInfo = _useSelector3.signupRequestListInfo;
|
|
8924
9330
|
var redirectToNotifications = function redirectToNotifications() {
|
|
8925
|
-
|
|
9331
|
+
if (config.routes.notification) {
|
|
9332
|
+
history.push({
|
|
9333
|
+
pathname: config.routes.notification.path
|
|
9334
|
+
});
|
|
9335
|
+
}
|
|
8926
9336
|
};
|
|
8927
9337
|
var openDeactivateModal = function openDeactivateModal() {
|
|
8928
9338
|
if (Object.values(selected).flat().length === 0 || Object.values(selected).flat() === undefined) {
|
|
@@ -9544,7 +9954,7 @@ var UserList = function UserList(_ref2) {
|
|
|
9544
9954
|
variant: "body2",
|
|
9545
9955
|
className: clsx(styles$5.description)
|
|
9546
9956
|
}, "Verify and add users to allow them to start using ITILITE. Set up preferences for receiving sign up request updates in", ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
9547
|
-
onClick:
|
|
9957
|
+
onClick: redirectToNotifications,
|
|
9548
9958
|
className: clsx(config.routes.notification && 'iui__cursor-pointer iui__border--bottom_solid_black500-1')
|
|
9549
9959
|
}, "Notifications"))), /*#__PURE__*/React__default.createElement(SingupRequests, {
|
|
9550
9960
|
data: signupRequestListInfo,
|
|
@@ -10082,7 +10492,6 @@ function EditPanelDialog(_ref) {
|
|
|
10082
10492
|
}, [rowData]);
|
|
10083
10493
|
var history = reactRouterDom.useHistory();
|
|
10084
10494
|
var handleAddPageNavigation = function handleAddPageNavigation() {
|
|
10085
|
-
console.log(rowData);
|
|
10086
10495
|
history.push({
|
|
10087
10496
|
pathname: config.routes.users.add.path,
|
|
10088
10497
|
state: rowData
|