@itilite/iui-user-management 0.4.67 → 0.4.68
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 +2 -6
- package/dist/index.js +751 -380
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +752 -381
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -35,125 +35,161 @@ function _extends() {
|
|
|
35
35
|
};
|
|
36
36
|
return _extends.apply(this, arguments);
|
|
37
37
|
}
|
|
38
|
+
function _readOnlyError(name) {
|
|
39
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
40
|
+
}
|
|
41
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
42
|
+
if (!o) return;
|
|
43
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
44
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
45
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
46
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
47
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
48
|
+
}
|
|
49
|
+
function _arrayLikeToArray(arr, len) {
|
|
50
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
51
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
52
|
+
return arr2;
|
|
53
|
+
}
|
|
54
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
55
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
56
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
57
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
58
|
+
if (it) o = it;
|
|
59
|
+
var i = 0;
|
|
60
|
+
return function () {
|
|
61
|
+
if (i >= o.length) return {
|
|
62
|
+
done: true
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
done: false,
|
|
66
|
+
value: o[i++]
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
38
72
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})();
|
|
76
|
-
|
|
77
|
-
// Settles a pact synchronously
|
|
73
|
+
var _Pact = /*#__PURE__*/function () {
|
|
74
|
+
function _Pact() {}
|
|
75
|
+
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
|
76
|
+
var result = new _Pact();
|
|
77
|
+
var state = this.s;
|
|
78
|
+
if (state) {
|
|
79
|
+
var callback = state & 1 ? onFulfilled : onRejected;
|
|
80
|
+
if (callback) {
|
|
81
|
+
try {
|
|
82
|
+
_settle(result, 1, callback(this.v));
|
|
83
|
+
} catch (e) {
|
|
84
|
+
_settle(result, 2, e);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
} else {
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
this.o = function (_this) {
|
|
92
|
+
try {
|
|
93
|
+
var value = _this.v;
|
|
94
|
+
if (_this.s & 1) {
|
|
95
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
|
96
|
+
} else if (onRejected) {
|
|
97
|
+
_settle(result, 1, onRejected(value));
|
|
98
|
+
} else {
|
|
99
|
+
_settle(result, 2, value);
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
_settle(result, 2, e);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return result;
|
|
106
|
+
};
|
|
107
|
+
return _Pact;
|
|
108
|
+
}();
|
|
78
109
|
function _settle(pact, state, value) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
if (!pact.s) {
|
|
111
|
+
if (value instanceof _Pact) {
|
|
112
|
+
if (value.s) {
|
|
113
|
+
if (state & 1) {
|
|
114
|
+
state = value.s;
|
|
115
|
+
}
|
|
116
|
+
value = value.v;
|
|
117
|
+
} else {
|
|
118
|
+
value.o = _settle.bind(null, pact, state);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (value && value.then) {
|
|
123
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
pact.s = state;
|
|
127
|
+
pact.v = value;
|
|
128
|
+
var observer = pact.o;
|
|
129
|
+
if (observer) {
|
|
130
|
+
observer(pact);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
102
133
|
}
|
|
103
|
-
|
|
104
134
|
function _isSettledPact(thenable) {
|
|
105
|
-
|
|
135
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
|
106
136
|
}
|
|
107
|
-
|
|
108
|
-
// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
|
|
109
137
|
function _forTo(array, body, check) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
var i = -1,
|
|
139
|
+
pact,
|
|
140
|
+
reject;
|
|
141
|
+
function _cycle(result) {
|
|
142
|
+
try {
|
|
143
|
+
while (++i < array.length && (!check || !check())) {
|
|
144
|
+
result = body(i);
|
|
145
|
+
if (result && result.then) {
|
|
146
|
+
if (_isSettledPact(result)) {
|
|
147
|
+
result = result.v;
|
|
148
|
+
} else {
|
|
149
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (pact) {
|
|
155
|
+
_settle(pact, 1, result);
|
|
156
|
+
} else {
|
|
157
|
+
pact = result;
|
|
158
|
+
}
|
|
159
|
+
} catch (e) {
|
|
160
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
_cycle();
|
|
164
|
+
return pact;
|
|
135
165
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
140
|
-
|
|
141
|
-
// Asynchronously call a function and send errors to recovery continuation
|
|
166
|
+
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
|
|
167
|
+
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
142
168
|
function _catch(body, recover) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
try {
|
|
170
|
+
var result = body();
|
|
171
|
+
} catch (e) {
|
|
172
|
+
return recover(e);
|
|
173
|
+
}
|
|
174
|
+
if (result && result.then) {
|
|
175
|
+
return result.then(void 0, recover);
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
152
178
|
}
|
|
153
179
|
|
|
154
|
-
var styles = {"UUIUserManagementAddEdit":"_3n-WG","pageHeader":"_3qWcA","buttonWrapper":"_1IP9P","scrolled":"_m8f96","headingButtonWrapper":"_w9z7b","headingButtonWrapperProfile":"_12Wd9","hintText":"_ySdbZ","heading":"_2Y1Aw","headingLarge":"_2K1NF","headingMedium":"_RUuAz","headingSmall":"_23Dye","additionalInfoContainer":"_1Suhw","additionalInfoTitle":"_56iJF","titleContainer":"_H5nfl","expandIconAlign":"_3F4i0","detailsContainer":"_2G0LW","formWrapper":"_2fPRc","sectionWrapper":"_37Gqp","margin":"_2Sdl7","minGridWidth":"_2D7iu","firstRowMargin":"_1BozG","firstChildMargin":"_2C3Mb","paddingTop":"_DBPjV","backGrdColorOnHover":"_5oE6H","fieldMargin":"_RCWjq","productContainerGap":"_tuCbi","
|
|
180
|
+
var styles = {"UUIUserManagementAddEdit":"_3n-WG","pageHeader":"_3qWcA","buttonWrapper":"_1IP9P","scrolled":"_m8f96","headingButtonWrapper":"_w9z7b","headingButtonWrapperProfile":"_12Wd9","hintText":"_ySdbZ","heading":"_2Y1Aw","headingLarge":"_2K1NF","headingMedium":"_RUuAz","headingSmall":"_23Dye","additionalInfoContainer":"_1Suhw","additionalInfoTitle":"_56iJF","titleContainer":"_H5nfl","expandIconAlign":"_3F4i0","detailsContainer":"_2G0LW","formWrapper":"_2fPRc","sectionWrapper":"_37Gqp","margin":"_2Sdl7","minGridWidth":"_2D7iu","firstRowMargin":"_1BozG","firstChildMargin":"_2C3Mb","paddingTop":"_DBPjV","backGrdColorOnHover":"_5oE6H","fieldMargin":"_RCWjq","productContainerGap":"_tuCbi","containerWidth":"_1oWos","productItemBroder":"_T0Hcd","headingPadding":"_2MFfQ","emptyFieldContainer":"_3VWtw","emptyFieldDescription":"_2jC5u","rowGap":"_1NJFY","formTitle":"_GAKk2","formDescription":"_3TZ6Z","themeLink":"_eJ_1B","dashedLine":"_3ZOs1","dividerColor":"_2pxEJ","errorTextCls":"_27eth","backdrop":"_Pm0Au","inputWidth":"_ajB82"};
|
|
155
181
|
|
|
156
|
-
function r(e)
|
|
182
|
+
function r(e) {
|
|
183
|
+
var t,
|
|
184
|
+
f,
|
|
185
|
+
n = "";
|
|
186
|
+
if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
187
|
+
return n;
|
|
188
|
+
}
|
|
189
|
+
function clsx() {
|
|
190
|
+
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
191
|
+
return n;
|
|
192
|
+
}
|
|
157
193
|
|
|
158
194
|
var GetInputType = React__default.forwardRef(function (props, ref) {
|
|
159
195
|
var _p = props._p,
|
|
@@ -390,6 +426,12 @@ var userAddEditUrl = {
|
|
|
390
426
|
},
|
|
391
427
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
392
428
|
return "api/v1/onboarding/user-signup-reject/" + userId + "?action=undo";
|
|
429
|
+
},
|
|
430
|
+
cardsEditUserDetails: function cardsEditUserDetails(userId) {
|
|
431
|
+
return env.getCardsapiURL() + "/card/authorization/user/" + userId;
|
|
432
|
+
},
|
|
433
|
+
cardsAddUsersDetails: function cardsAddUsersDetails() {
|
|
434
|
+
return env.getCardsapiURL() + "/card/authorization/company/" + IUILocalStorageService.getCompanyId() + "/roles";
|
|
393
435
|
}
|
|
394
436
|
};
|
|
395
437
|
var userListUrl = {
|
|
@@ -648,7 +690,8 @@ var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _r
|
|
|
648
690
|
var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
649
691
|
var page = _ref5.page,
|
|
650
692
|
product = _ref5.product,
|
|
651
|
-
userId = _ref5.userId
|
|
693
|
+
userId = _ref5.userId,
|
|
694
|
+
placeholder = _ref5.placeholder;
|
|
652
695
|
try {
|
|
653
696
|
return Promise.resolve(_catch(function () {
|
|
654
697
|
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
@@ -662,7 +705,13 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
|
662
705
|
data: item.approver
|
|
663
706
|
};
|
|
664
707
|
});
|
|
665
|
-
|
|
708
|
+
if (page === 1) {
|
|
709
|
+
var placeholderLbl = {
|
|
710
|
+
value: '',
|
|
711
|
+
label: placeholder
|
|
712
|
+
};
|
|
713
|
+
mappedValue.unshift(placeholderLbl);
|
|
714
|
+
}
|
|
666
715
|
return {
|
|
667
716
|
options: mappedValue,
|
|
668
717
|
hasMore: !!response.next,
|
|
@@ -785,6 +834,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
785
834
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
786
835
|
var STOP_LOADER = 'STOP_LOADER';
|
|
787
836
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
837
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
788
838
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
789
839
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
790
840
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -829,9 +879,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
829
879
|
if (payload.productAccess.expense) {
|
|
830
880
|
product.expense = payload.expenseRole || null;
|
|
831
881
|
}
|
|
882
|
+
if (payload.productAccess.card) {
|
|
883
|
+
var splitRole = payload.cardsRole.split(":");
|
|
884
|
+
var cardsUsmRole = splitRole[2];
|
|
885
|
+
product.card = cardsUsmRole || null;
|
|
886
|
+
}
|
|
832
887
|
return product;
|
|
833
888
|
}(),
|
|
834
|
-
approvers: {}
|
|
889
|
+
approvers: {},
|
|
890
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
835
891
|
};
|
|
836
892
|
var userTags = [];
|
|
837
893
|
for (var key in payload.userTagType) {
|
|
@@ -923,13 +979,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
923
979
|
var res = {
|
|
924
980
|
fields: {
|
|
925
981
|
user_personal_info: {},
|
|
926
|
-
employee_info: {}
|
|
982
|
+
employee_info: {},
|
|
983
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
927
984
|
}
|
|
928
985
|
};
|
|
929
986
|
if (!env$1.isProfilePage()) {
|
|
930
987
|
res.fields.product = function () {
|
|
931
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
988
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.card) {
|
|
989
|
+
return 'expense+travel+card';
|
|
990
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
932
991
|
return 'expense+travel';
|
|
992
|
+
} else if (payload.productAccess.expense && payload.productAccess.card) {
|
|
993
|
+
return 'expense+card';
|
|
994
|
+
} else if (payload.productAccess.travel && payload.productAccess.card) {
|
|
995
|
+
return 'travel+card';
|
|
933
996
|
} else if (payload.productAccess.travel) {
|
|
934
997
|
return 'travel';
|
|
935
998
|
} else {
|
|
@@ -944,6 +1007,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
944
1007
|
if (payload.productAccess.expense) {
|
|
945
1008
|
roles.expense = payload.expenseRole;
|
|
946
1009
|
}
|
|
1010
|
+
if (payload.productAccess.card) {
|
|
1011
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1012
|
+
var cardsUsmRole = splitRole[2];
|
|
1013
|
+
roles.card = cardsUsmRole;
|
|
1014
|
+
}
|
|
947
1015
|
return roles;
|
|
948
1016
|
}();
|
|
949
1017
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -1282,6 +1350,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1282
1350
|
payload: payload
|
|
1283
1351
|
};
|
|
1284
1352
|
};
|
|
1353
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1354
|
+
return {
|
|
1355
|
+
type: SET_CARDS_DETAILS,
|
|
1356
|
+
payload: payload
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1285
1359
|
var setCustomField = function setCustomField(payload) {
|
|
1286
1360
|
return {
|
|
1287
1361
|
type: SET_CUSTOM_FIELD,
|
|
@@ -3184,6 +3258,12 @@ var products = [{
|
|
|
3184
3258
|
name: 'expense',
|
|
3185
3259
|
type: 'checkbox',
|
|
3186
3260
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3261
|
+
}, {
|
|
3262
|
+
id: 3,
|
|
3263
|
+
label: 'Card',
|
|
3264
|
+
name: 'card',
|
|
3265
|
+
type: 'checkbox',
|
|
3266
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3187
3267
|
}];
|
|
3188
3268
|
var dropdownList = {
|
|
3189
3269
|
gender: [{
|
|
@@ -3354,6 +3434,34 @@ var expenseConstants = {
|
|
|
3354
3434
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3355
3435
|
}]
|
|
3356
3436
|
};
|
|
3437
|
+
var cardsConstants = {
|
|
3438
|
+
heading: 'Card specific information',
|
|
3439
|
+
roleHeading: 'Card role',
|
|
3440
|
+
roleDescription: 'Roles allow users to only access relevant features and functionalities',
|
|
3441
|
+
roles: [{
|
|
3442
|
+
id: 1,
|
|
3443
|
+
label: 'Card holder',
|
|
3444
|
+
description: 'Can view own cards and transactions.',
|
|
3445
|
+
value: '',
|
|
3446
|
+
name: '',
|
|
3447
|
+
type: 'radio',
|
|
3448
|
+
isAssigned: false,
|
|
3449
|
+
fullWidth: false,
|
|
3450
|
+
visibility: true,
|
|
3451
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3452
|
+
}, {
|
|
3453
|
+
id: 2,
|
|
3454
|
+
label: 'Card admin',
|
|
3455
|
+
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.',
|
|
3456
|
+
value: '',
|
|
3457
|
+
name: '',
|
|
3458
|
+
type: 'radio',
|
|
3459
|
+
isAssigned: false,
|
|
3460
|
+
fullWidth: false,
|
|
3461
|
+
visibility: true,
|
|
3462
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3463
|
+
}]
|
|
3464
|
+
};
|
|
3357
3465
|
var passportInfo = [{
|
|
3358
3466
|
id: 1,
|
|
3359
3467
|
label: 'Passport issuing country',
|
|
@@ -3583,6 +3691,12 @@ var initialState = {
|
|
|
3583
3691
|
travelConstants: travelConstants,
|
|
3584
3692
|
expenseConstants: expenseConstants
|
|
3585
3693
|
},
|
|
3694
|
+
isCardsDetailsRendered: false,
|
|
3695
|
+
isCardsAdmin: false,
|
|
3696
|
+
cardsDetails: {
|
|
3697
|
+
cardsRoles: cardsConstants.roles,
|
|
3698
|
+
cardsConstants: cardsConstants
|
|
3699
|
+
},
|
|
3586
3700
|
dropdownList: dropdownList,
|
|
3587
3701
|
maxTravelApprovers: 10,
|
|
3588
3702
|
maxExpenseApprovers: 10,
|
|
@@ -3749,11 +3863,37 @@ var reducer = function reducer(state, action) {
|
|
|
3749
3863
|
isRendered: true
|
|
3750
3864
|
});
|
|
3751
3865
|
}
|
|
3866
|
+
case SET_CARDS_DETAILS:
|
|
3867
|
+
{
|
|
3868
|
+
var _action$payload8, _action$payload8$role, _action$payload9;
|
|
3869
|
+
var cardsDetails = _extends({}, state.cardsDetails);
|
|
3870
|
+
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) {
|
|
3871
|
+
cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
|
|
3872
|
+
return {
|
|
3873
|
+
id: role.id,
|
|
3874
|
+
label: role.name,
|
|
3875
|
+
description: role.description,
|
|
3876
|
+
value: role.value,
|
|
3877
|
+
isAssigned: role.is_assigned,
|
|
3878
|
+
name: role.value,
|
|
3879
|
+
type: 'radio',
|
|
3880
|
+
fullWidth: false,
|
|
3881
|
+
visibility: true,
|
|
3882
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3883
|
+
};
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
return _extends({}, state, {
|
|
3887
|
+
cardsDetails: cardsDetails,
|
|
3888
|
+
isCardsDetailsRendered: true,
|
|
3889
|
+
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
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3752
3892
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3753
3893
|
{
|
|
3754
3894
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3755
|
-
var _action$
|
|
3756
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3895
|
+
var _action$payload10;
|
|
3896
|
+
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]) {
|
|
3757
3897
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3758
3898
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3759
3899
|
}
|
|
@@ -4806,7 +4946,9 @@ var ErrorMessages = {
|
|
|
4806
4946
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4807
4947
|
passport_photo: 'Please attach passport photo.',
|
|
4808
4948
|
travel_docs: 'Please attach travel docs.',
|
|
4809
|
-
products: 'Please select atleast one product access.'
|
|
4949
|
+
products: 'Please select atleast one product access.',
|
|
4950
|
+
only_cards_products: 'Currently, Card cannot be selected as a standalone option. Please add at least one more product.',
|
|
4951
|
+
none_products: 'Select at least one product. If opting for card, please choose at least one additional product.'
|
|
4810
4952
|
};
|
|
4811
4953
|
|
|
4812
4954
|
function AddPanelDialog(_ref) {
|
|
@@ -4856,7 +4998,73 @@ function AddPanelDialog(_ref) {
|
|
|
4856
4998
|
})));
|
|
4857
4999
|
}
|
|
4858
5000
|
|
|
4859
|
-
var
|
|
5001
|
+
var CardsField = function CardsField(props) {
|
|
5002
|
+
var cardsConstants = props.cardsConstants,
|
|
5003
|
+
_props$onRoleChange = props.onRoleChange,
|
|
5004
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
5005
|
+
_props$roleValue = props.roleValue,
|
|
5006
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
5007
|
+
_props$isProfile = props.isProfile,
|
|
5008
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5009
|
+
_props$roles = props.roles,
|
|
5010
|
+
roles = _props$roles === void 0 ? [] : _props$roles,
|
|
5011
|
+
_props$cardsAdmin = props.cardsAdmin,
|
|
5012
|
+
cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
|
|
5013
|
+
editUserId = props.editUserId,
|
|
5014
|
+
loggedInUserId = props.loggedInUserId;
|
|
5015
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5016
|
+
container: true,
|
|
5017
|
+
className: (styles.headingPadding)
|
|
5018
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5019
|
+
variant: "h3",
|
|
5020
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5021
|
+
}, cardsConstants.heading)), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
5022
|
+
className: styles.dividerColor
|
|
5023
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5024
|
+
container: true,
|
|
5025
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5026
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5027
|
+
item: true,
|
|
5028
|
+
sm: 12,
|
|
5029
|
+
md: 4
|
|
5030
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
5031
|
+
label: cardsConstants.roleHeading,
|
|
5032
|
+
headerType: true,
|
|
5033
|
+
description: cardsConstants.roleDescription
|
|
5034
|
+
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5035
|
+
item: true,
|
|
5036
|
+
sm: 12,
|
|
5037
|
+
md: 8,
|
|
5038
|
+
lg: 8,
|
|
5039
|
+
xl: 6
|
|
5040
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5041
|
+
container: true,
|
|
5042
|
+
className: styles.formFieldsWrapper
|
|
5043
|
+
}, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React__default.createElement(UserRole, {
|
|
5044
|
+
list: roles,
|
|
5045
|
+
value: roleValue
|
|
5046
|
+
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIRadio, {
|
|
5047
|
+
list: roles,
|
|
5048
|
+
value: roleValue,
|
|
5049
|
+
onValueChange: onRoleChange,
|
|
5050
|
+
disabled: cardsAdmin ? false : true
|
|
5051
|
+
})), !cardsAdmin && !isProfile && /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5052
|
+
item: true,
|
|
5053
|
+
sm: 12,
|
|
5054
|
+
md: 12,
|
|
5055
|
+
lg: 12,
|
|
5056
|
+
style: {
|
|
5057
|
+
marginTop: "24px"
|
|
5058
|
+
}
|
|
5059
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5060
|
+
variant: "body2",
|
|
5061
|
+
component: "span",
|
|
5062
|
+
className: styles.errorTextCls
|
|
5063
|
+
}, 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.")))));
|
|
5064
|
+
};
|
|
5065
|
+
|
|
5066
|
+
var IUIToastMessageService$4 = utils.services.IUIToastMessageService,
|
|
5067
|
+
IUILocalStorageService$5 = utils.services.IUILocalStorageService;
|
|
4860
5068
|
var env$4 = utils.configs.env;
|
|
4861
5069
|
var UserAddEdit = function UserAddEdit(props) {
|
|
4862
5070
|
var isEditMode = props.isEditMode,
|
|
@@ -4883,7 +5091,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4883
5091
|
isRendered = _useSelector.isRendered,
|
|
4884
5092
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
4885
5093
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
4886
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5094
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5095
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5096
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5097
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
4887
5098
|
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
4888
5099
|
return state.common;
|
|
4889
5100
|
}),
|
|
@@ -4896,7 +5107,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4896
5107
|
var location = reactRouterDom.useLocation();
|
|
4897
5108
|
var _useState = React.useState({
|
|
4898
5109
|
travel: false,
|
|
4899
|
-
expense: false
|
|
5110
|
+
expense: false,
|
|
5111
|
+
card: false
|
|
4900
5112
|
}),
|
|
4901
5113
|
productAccess = _useState[0],
|
|
4902
5114
|
setProductAccess = _useState[1];
|
|
@@ -4907,13 +5119,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4907
5119
|
errorMsgs.products = '';
|
|
4908
5120
|
var _productAccess = _extends({}, productAccess);
|
|
4909
5121
|
_productAccess[value] = !_productAccess[value];
|
|
4910
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5122
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === true) {
|
|
4911
5123
|
var _errorArray = [].concat(errorArray);
|
|
4912
5124
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4913
5125
|
if (_errorArray.indexOf('products') === -1) {
|
|
4914
5126
|
_errorArray.push('products');
|
|
4915
5127
|
}
|
|
4916
|
-
_errorMsgs.products = ErrorMessages.
|
|
5128
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4917
5129
|
setErrorArray(_errorArray);
|
|
4918
5130
|
setErrorMsgs(_errorMsgs);
|
|
4919
5131
|
var el = document.getElementById('products');
|
|
@@ -4923,6 +5135,22 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4923
5135
|
block: 'center'
|
|
4924
5136
|
});
|
|
4925
5137
|
}
|
|
5138
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5139
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5140
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5141
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5142
|
+
_errorArray2.push('products');
|
|
5143
|
+
}
|
|
5144
|
+
_errorMsgs2.products = ErrorMessages.products;
|
|
5145
|
+
setErrorArray(_errorArray2);
|
|
5146
|
+
setErrorMsgs(_errorMsgs2);
|
|
5147
|
+
var _el = document.getElementById('products');
|
|
5148
|
+
if (_el) {
|
|
5149
|
+
_el.scrollIntoView({
|
|
5150
|
+
behavior: 'smooth',
|
|
5151
|
+
block: 'center'
|
|
5152
|
+
});
|
|
5153
|
+
}
|
|
4926
5154
|
} else {
|
|
4927
5155
|
setErrorArray(errorArray);
|
|
4928
5156
|
setErrorMsgs(errorMsgs);
|
|
@@ -4938,18 +5166,155 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4938
5166
|
var _useState4 = React.useState([]),
|
|
4939
5167
|
countryContactCode = _useState4[0],
|
|
4940
5168
|
setCountryContactCode = _useState4[1];
|
|
4941
|
-
var
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
5169
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5170
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5171
|
+
if (isProfile) {
|
|
5172
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5173
|
+
(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);
|
|
5174
|
+
} else {
|
|
5175
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5176
|
+
(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);
|
|
5177
|
+
}
|
|
5178
|
+
setFilesForDelete([]);
|
|
5179
|
+
setProfilePicDelete([]);
|
|
5180
|
+
})["catch"](function (err) {
|
|
5181
|
+
if (typeof err === 'object') {
|
|
5182
|
+
if (err.country_code) {
|
|
5183
|
+
err.contact_number = err.country_code;
|
|
5184
|
+
}
|
|
5185
|
+
if (err.contact_country_code) {
|
|
5186
|
+
err.contact_number = err.contact_country_code;
|
|
5187
|
+
}
|
|
5188
|
+
if (err.passport) {
|
|
5189
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5190
|
+
delete err.passport;
|
|
5191
|
+
}
|
|
5192
|
+
setErrorArray(Object.keys(err));
|
|
5193
|
+
setErrorMsgs(err);
|
|
5194
|
+
var _loop = function _loop() {
|
|
5195
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5196
|
+
if (err[key]) {
|
|
5197
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5198
|
+
setAdditionalInfoFlag('open');
|
|
5199
|
+
}
|
|
5200
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5201
|
+
if (el) {
|
|
5202
|
+
setTimeout(function () {
|
|
5203
|
+
el.scrollIntoView({
|
|
5204
|
+
behavior: 'smooth',
|
|
5205
|
+
block: 'center'
|
|
5206
|
+
});
|
|
5207
|
+
}, 500);
|
|
5208
|
+
return 1;
|
|
5209
|
+
}
|
|
5210
|
+
}
|
|
5211
|
+
}
|
|
5212
|
+
};
|
|
5213
|
+
for (var key in err) {
|
|
5214
|
+
if (_loop()) break;
|
|
5215
|
+
}
|
|
5216
|
+
} else if (typeof err === 'string') {
|
|
5217
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5218
|
+
} else {
|
|
5219
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5220
|
+
}
|
|
5221
|
+
})["finally"](function () {
|
|
5222
|
+
dispatch(stopLoader());
|
|
5223
|
+
});
|
|
5224
|
+
};
|
|
5225
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5226
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5227
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5228
|
+
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) {
|
|
5229
|
+
history.push({
|
|
5230
|
+
pathname: config.routes.users.list.path
|
|
5231
|
+
});
|
|
5232
|
+
}
|
|
5233
|
+
})["catch"](function (err) {
|
|
5234
|
+
if (typeof err === 'object') {
|
|
5235
|
+
if (err.country_code) {
|
|
5236
|
+
err.contact_number = err.country_code;
|
|
5237
|
+
}
|
|
5238
|
+
if (err.contact_country_code) {
|
|
5239
|
+
err.contact_number = err.contact_country_code;
|
|
5240
|
+
}
|
|
5241
|
+
if (err.passport) {
|
|
5242
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5243
|
+
delete err.passport;
|
|
5244
|
+
}
|
|
5245
|
+
setErrorArray(Object.keys(err));
|
|
5246
|
+
setErrorMsgs(err);
|
|
5247
|
+
var _loop2 = function _loop2() {
|
|
5248
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5249
|
+
if (err[key]) {
|
|
5250
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5251
|
+
setAdditionalInfoFlag('open');
|
|
5252
|
+
}
|
|
5253
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5254
|
+
if (el) {
|
|
5255
|
+
setTimeout(function () {
|
|
5256
|
+
el.scrollIntoView({
|
|
5257
|
+
behavior: 'smooth',
|
|
5258
|
+
block: 'center'
|
|
5259
|
+
});
|
|
5260
|
+
}, 500);
|
|
5261
|
+
return 1;
|
|
5262
|
+
}
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
};
|
|
5266
|
+
for (var key in err) {
|
|
5267
|
+
if (_loop2()) break;
|
|
5268
|
+
}
|
|
5269
|
+
} else if (typeof err === 'string') {
|
|
5270
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5271
|
+
} else {
|
|
5272
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5273
|
+
}
|
|
5274
|
+
})["finally"](function () {
|
|
5275
|
+
dispatch(stopLoader());
|
|
5276
|
+
});
|
|
5277
|
+
};
|
|
5278
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5279
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5280
|
+
method: 'GET',
|
|
5281
|
+
headers: {
|
|
5282
|
+
'Content-Type': 'application/json',
|
|
5283
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5284
|
+
}
|
|
5285
|
+
}).then(function (response) {
|
|
5286
|
+
return response.json();
|
|
5287
|
+
}).then(function (res) {
|
|
5288
|
+
var _res$roles;
|
|
5289
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5290
|
+
dispatch(setCardsDetails(res));
|
|
5291
|
+
} else {
|
|
5292
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5293
|
+
}
|
|
5294
|
+
})["catch"](function (error) {
|
|
5295
|
+
console.log("errorrr", error);
|
|
5296
|
+
});
|
|
5297
|
+
};
|
|
5298
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5299
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5300
|
+
method: 'GET',
|
|
5301
|
+
headers: {
|
|
5302
|
+
'Content-Type': 'application/json',
|
|
5303
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5304
|
+
}
|
|
5305
|
+
}).then(function (response) {
|
|
5306
|
+
return response.json();
|
|
5307
|
+
}).then(function (res) {
|
|
5308
|
+
var _res$roles2;
|
|
5309
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5310
|
+
dispatch(setCardsDetails(res));
|
|
5311
|
+
} else {
|
|
5312
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5313
|
+
}
|
|
5314
|
+
})["catch"](function (error) {
|
|
5315
|
+
console.log("errorrr", error);
|
|
5316
|
+
});
|
|
5317
|
+
};
|
|
4953
5318
|
React.useEffect(function () {
|
|
4954
5319
|
var countryObject = countryContactCode.find(function (t) {
|
|
4955
5320
|
return t.dial_code === countryDialCode;
|
|
@@ -4965,7 +5330,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4965
5330
|
var convertedNumber = parseInt(extractedNumber);
|
|
4966
5331
|
setCountryDialCode(convertedNumber);
|
|
4967
5332
|
}, [newCountryCode]);
|
|
4968
|
-
var
|
|
5333
|
+
var _useState5 = React.useState({
|
|
4969
5334
|
first_name: '',
|
|
4970
5335
|
last_name: '',
|
|
4971
5336
|
email: '',
|
|
@@ -4976,9 +5341,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4976
5341
|
contact_country_code: '',
|
|
4977
5342
|
profile_pic: []
|
|
4978
5343
|
}),
|
|
4979
|
-
personalInfoInput =
|
|
4980
|
-
setPersonalInfoInput =
|
|
4981
|
-
var
|
|
5344
|
+
personalInfoInput = _useState5[0],
|
|
5345
|
+
setPersonalInfoInput = _useState5[1];
|
|
5346
|
+
var _useState6 = React.useState({
|
|
4982
5347
|
emp_level: {
|
|
4983
5348
|
value: '',
|
|
4984
5349
|
label: 'Select employee level'
|
|
@@ -5011,9 +5376,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5011
5376
|
label: defaultCurrency
|
|
5012
5377
|
}
|
|
5013
5378
|
}),
|
|
5014
|
-
employeeInfoInput =
|
|
5015
|
-
setEmployeeInfoInput =
|
|
5016
|
-
var
|
|
5379
|
+
employeeInfoInput = _useState6[0],
|
|
5380
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5381
|
+
var _useState7 = React.useState({
|
|
5017
5382
|
emp_level: 0,
|
|
5018
5383
|
entity: 0,
|
|
5019
5384
|
business_unit: 0,
|
|
@@ -5022,48 +5387,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5022
5387
|
manager_id: 0,
|
|
5023
5388
|
skip_manager_id: 0
|
|
5024
5389
|
}),
|
|
5025
|
-
cacheForAsyncDropdown =
|
|
5026
|
-
clearCacheForAsyncDropdown =
|
|
5390
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5391
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5392
|
+
var _useState8 = React.useState({}),
|
|
5393
|
+
userTagType = _useState8[0],
|
|
5394
|
+
setUserTagType = _useState8[1];
|
|
5395
|
+
var _useState9 = React.useState(false),
|
|
5396
|
+
scroll = _useState9[0],
|
|
5397
|
+
setScroll = _useState9[1];
|
|
5027
5398
|
var _useState10 = React.useState({}),
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
var _useState11 = React.useState(
|
|
5031
|
-
|
|
5032
|
-
|
|
5399
|
+
customFieldsInput = _useState10[0],
|
|
5400
|
+
setCustomFieldsInput = _useState10[1];
|
|
5401
|
+
var _useState11 = React.useState('traveler'),
|
|
5402
|
+
travelRole = _useState11[0],
|
|
5403
|
+
setTravelRole = _useState11[1];
|
|
5033
5404
|
var _useState12 = React.useState({}),
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
var _useState13 = React.useState(
|
|
5037
|
-
travelRole = _useState13[0],
|
|
5038
|
-
setTravelRole = _useState13[1];
|
|
5039
|
-
var _useState14 = React.useState({}),
|
|
5040
|
-
travelApproversInput = _useState14[0],
|
|
5041
|
-
setTravelApproversInput = _useState14[1];
|
|
5042
|
-
var _useState15 = React.useState({
|
|
5405
|
+
travelApproversInput = _useState12[0],
|
|
5406
|
+
setTravelApproversInput = _useState12[1];
|
|
5407
|
+
var _useState13 = React.useState({
|
|
5043
5408
|
value: '',
|
|
5044
5409
|
label: 'Select approver'
|
|
5045
5410
|
}),
|
|
5046
|
-
travelFYI =
|
|
5047
|
-
setTravelFYI =
|
|
5048
|
-
var
|
|
5049
|
-
membershipInfoInput =
|
|
5050
|
-
setMembershipInfoInput =
|
|
5051
|
-
var
|
|
5052
|
-
removedMembershipInfoInput =
|
|
5053
|
-
setRemovedMembershipInfoInput =
|
|
5054
|
-
var
|
|
5411
|
+
travelFYI = _useState13[0],
|
|
5412
|
+
setTravelFYI = _useState13[1];
|
|
5413
|
+
var _useState14 = React.useState([]),
|
|
5414
|
+
membershipInfoInput = _useState14[0],
|
|
5415
|
+
setMembershipInfoInput = _useState14[1];
|
|
5416
|
+
var _useState15 = React.useState([]),
|
|
5417
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5418
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5419
|
+
var _useState16 = React.useState({
|
|
5055
5420
|
flight_seat_preference: '',
|
|
5056
5421
|
meal_preference: ''
|
|
5057
5422
|
}),
|
|
5058
|
-
travelPreferenceInfo =
|
|
5059
|
-
settravelPreferenceInfo =
|
|
5060
|
-
var
|
|
5423
|
+
travelPreferenceInfo = _useState16[0],
|
|
5424
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5425
|
+
var _useState17 = React.useState({
|
|
5061
5426
|
trusted_traveller: '',
|
|
5062
5427
|
redress_number: ''
|
|
5063
5428
|
}),
|
|
5064
|
-
secureTravelInputInfo =
|
|
5065
|
-
setSecureTravelInputInfo =
|
|
5066
|
-
var
|
|
5429
|
+
secureTravelInputInfo = _useState17[0],
|
|
5430
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5431
|
+
var _useState18 = React.useState({
|
|
5067
5432
|
passport_issue_country: {
|
|
5068
5433
|
value: '',
|
|
5069
5434
|
label: 'Select country'
|
|
@@ -5078,39 +5443,76 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5078
5443
|
passport_photo: [],
|
|
5079
5444
|
travel_docs: []
|
|
5080
5445
|
}),
|
|
5081
|
-
passportInfoInput =
|
|
5082
|
-
setPassportInfoInput =
|
|
5083
|
-
var
|
|
5084
|
-
filesForDelete =
|
|
5085
|
-
setFilesForDelete =
|
|
5086
|
-
var
|
|
5087
|
-
profilePicDelete =
|
|
5088
|
-
setProfilePicDelete =
|
|
5089
|
-
var
|
|
5090
|
-
isAdditionalInfoExpanded =
|
|
5091
|
-
setAdditionalInfoFlag =
|
|
5092
|
-
var
|
|
5093
|
-
expenseRole =
|
|
5094
|
-
setExpenseRole =
|
|
5095
|
-
var
|
|
5096
|
-
expenseApproversInput =
|
|
5097
|
-
setExpenseApproversInput =
|
|
5098
|
-
var
|
|
5446
|
+
passportInfoInput = _useState18[0],
|
|
5447
|
+
setPassportInfoInput = _useState18[1];
|
|
5448
|
+
var _useState19 = React.useState([]),
|
|
5449
|
+
filesForDelete = _useState19[0],
|
|
5450
|
+
setFilesForDelete = _useState19[1];
|
|
5451
|
+
var _useState20 = React.useState([]),
|
|
5452
|
+
profilePicDelete = _useState20[0],
|
|
5453
|
+
setProfilePicDelete = _useState20[1];
|
|
5454
|
+
var _useState21 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5455
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5456
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5457
|
+
var _useState22 = React.useState('submitter'),
|
|
5458
|
+
expenseRole = _useState22[0],
|
|
5459
|
+
setExpenseRole = _useState22[1];
|
|
5460
|
+
var _useState23 = React.useState({}),
|
|
5461
|
+
expenseApproversInput = _useState23[0],
|
|
5462
|
+
setExpenseApproversInput = _useState23[1];
|
|
5463
|
+
var _useState24 = React.useState({
|
|
5099
5464
|
value: '',
|
|
5100
5465
|
label: 'Select approver'
|
|
5101
5466
|
}),
|
|
5102
|
-
expenseFYI =
|
|
5103
|
-
setExpenseFYI =
|
|
5467
|
+
expenseFYI = _useState24[0],
|
|
5468
|
+
setExpenseFYI = _useState24[1];
|
|
5469
|
+
var _useState25 = React.useState(''),
|
|
5470
|
+
cardsRole = _useState25[0],
|
|
5471
|
+
setCardsRole = _useState25[1];
|
|
5472
|
+
React.useEffect(function () {
|
|
5473
|
+
if (productAccess.card === false) {
|
|
5474
|
+
setCardsRole('');
|
|
5475
|
+
}
|
|
5476
|
+
}, [productAccess.card]);
|
|
5477
|
+
React.useEffect(function () {
|
|
5478
|
+
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5479
|
+
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5480
|
+
return role.isAssigned;
|
|
5481
|
+
});
|
|
5482
|
+
if (selectedRole) {
|
|
5483
|
+
setCardsRole(selectedRole.value);
|
|
5484
|
+
} else {
|
|
5485
|
+
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5486
|
+
var splitRoleVal = role.value.split(':');
|
|
5487
|
+
return splitRoleVal[2] === 'card-holder';
|
|
5488
|
+
});
|
|
5489
|
+
if (defaultRole) {
|
|
5490
|
+
setCardsRole(defaultRole.value);
|
|
5491
|
+
}
|
|
5492
|
+
}
|
|
5493
|
+
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5494
|
+
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5495
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5496
|
+
var role = _step.value;
|
|
5497
|
+
var splitRoleVal = role.value.split(':');
|
|
5498
|
+
var profileRole = splitRoleVal[2];
|
|
5499
|
+
if (profileRole === targetRole) {
|
|
5500
|
+
setCardsRole(role.value);
|
|
5501
|
+
break;
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
}
|
|
5505
|
+
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
5104
5506
|
var asyncSelectRefs = React.useRef({
|
|
5105
5507
|
emp_level: React.useRef(null),
|
|
5106
5508
|
entity: React.useRef(null),
|
|
5107
5509
|
business_unit: React.useRef(null),
|
|
5108
5510
|
department: React.useRef(null)
|
|
5109
5511
|
});
|
|
5110
|
-
var
|
|
5111
|
-
errorArray =
|
|
5112
|
-
setErrorArray =
|
|
5113
|
-
var
|
|
5512
|
+
var _useState26 = React.useState([]),
|
|
5513
|
+
errorArray = _useState26[0],
|
|
5514
|
+
setErrorArray = _useState26[1];
|
|
5515
|
+
var _useState27 = React.useState({
|
|
5114
5516
|
first_name: '',
|
|
5115
5517
|
last_name: '',
|
|
5116
5518
|
email: '',
|
|
@@ -5140,9 +5542,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5140
5542
|
userTagType: '',
|
|
5141
5543
|
profile_pic: ''
|
|
5142
5544
|
}),
|
|
5143
|
-
errorMsgs =
|
|
5144
|
-
setErrorMsgs =
|
|
5145
|
-
var
|
|
5545
|
+
errorMsgs = _useState27[0],
|
|
5546
|
+
setErrorMsgs = _useState27[1];
|
|
5547
|
+
var _useState28 = React.useState({
|
|
5146
5548
|
first_name: false,
|
|
5147
5549
|
last_name: false,
|
|
5148
5550
|
email: false,
|
|
@@ -5169,14 +5571,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5169
5571
|
userTagType: false,
|
|
5170
5572
|
profile_pic: false
|
|
5171
5573
|
}),
|
|
5172
|
-
inputChangeLog =
|
|
5173
|
-
updateInputChangeLog =
|
|
5174
|
-
var
|
|
5175
|
-
uploadedFiles =
|
|
5176
|
-
setUploadedFiles =
|
|
5177
|
-
var
|
|
5178
|
-
maxLengthForModal =
|
|
5179
|
-
setMaxLengthForModal =
|
|
5574
|
+
inputChangeLog = _useState28[0],
|
|
5575
|
+
updateInputChangeLog = _useState28[1];
|
|
5576
|
+
var _useState29 = React.useState([]),
|
|
5577
|
+
uploadedFiles = _useState29[0],
|
|
5578
|
+
setUploadedFiles = _useState29[1];
|
|
5579
|
+
var _useState30 = React.useState(70),
|
|
5580
|
+
maxLengthForModal = _useState30[0],
|
|
5581
|
+
setMaxLengthForModal = _useState30[1];
|
|
5180
5582
|
var defaultAddModalData = {
|
|
5181
5583
|
isOpen: false,
|
|
5182
5584
|
isError: false,
|
|
@@ -5192,9 +5594,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5192
5594
|
maxLength: maxLengthForModal,
|
|
5193
5595
|
minLength: 0
|
|
5194
5596
|
};
|
|
5195
|
-
var
|
|
5196
|
-
addModalData =
|
|
5197
|
-
setAddModalData =
|
|
5597
|
+
var _useState31 = React.useState(defaultAddModalData),
|
|
5598
|
+
addModalData = _useState31[0],
|
|
5599
|
+
setAddModalData = _useState31[1];
|
|
5198
5600
|
var onAddModalClose = function onAddModalClose() {
|
|
5199
5601
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5200
5602
|
};
|
|
@@ -5605,6 +6007,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5605
6007
|
}, [isTokenVerified]);
|
|
5606
6008
|
React.useEffect(function () {
|
|
5607
6009
|
if (isRendered === true) {
|
|
6010
|
+
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6011
|
+
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6012
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6013
|
+
}
|
|
6014
|
+
});
|
|
5608
6015
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5609
6016
|
country_code: countryCode
|
|
5610
6017
|
}));
|
|
@@ -5726,7 +6133,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5726
6133
|
var products = res.user_product.split('+');
|
|
5727
6134
|
setProductAccess({
|
|
5728
6135
|
travel: products.includes('travel'),
|
|
5729
|
-
expense: products.includes('expense')
|
|
6136
|
+
expense: products.includes('expense'),
|
|
6137
|
+
card: products.includes('card')
|
|
5730
6138
|
});
|
|
5731
6139
|
if (products.includes('travel')) {
|
|
5732
6140
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5943,6 +6351,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5943
6351
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
5944
6352
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
5945
6353
|
}
|
|
6354
|
+
var cardsPayload = {
|
|
6355
|
+
"roles": [cardsRole]
|
|
6356
|
+
};
|
|
5946
6357
|
var payload = {
|
|
5947
6358
|
personalInfoInput: personalInfoInput,
|
|
5948
6359
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5961,7 +6372,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5961
6372
|
uploadedFiles: uploadedFiles,
|
|
5962
6373
|
filesForDelete: filesForDelete,
|
|
5963
6374
|
profilePicDelete: profilePicDelete,
|
|
5964
|
-
userTagType: userTagType
|
|
6375
|
+
userTagType: userTagType,
|
|
6376
|
+
cardsRole: cardsRole,
|
|
6377
|
+
isCardsAdmin: isCardsAdmin
|
|
5965
6378
|
};
|
|
5966
6379
|
if (verifyUserId) {
|
|
5967
6380
|
payload.verifyUserId = verifyUserId;
|
|
@@ -6087,7 +6500,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6087
6500
|
if (_isError) {
|
|
6088
6501
|
setErrorArray(_errorArray);
|
|
6089
6502
|
setErrorMsgs(_errorMsgs);
|
|
6090
|
-
var
|
|
6503
|
+
var _loop3 = function _loop3() {
|
|
6091
6504
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6092
6505
|
if (_errorMsgs[_key3]) {
|
|
6093
6506
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6107,115 +6520,109 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6107
6520
|
}
|
|
6108
6521
|
};
|
|
6109
6522
|
for (var _key3 in _errorMsgs) {
|
|
6110
|
-
if (
|
|
6523
|
+
if (_loop3()) break;
|
|
6111
6524
|
}
|
|
6112
6525
|
}
|
|
6526
|
+
var cardApiflag = false;
|
|
6527
|
+
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6528
|
+
false, _readOnlyError("cardApiflag");
|
|
6529
|
+
} else {
|
|
6530
|
+
true, _readOnlyError("cardApiflag");
|
|
6531
|
+
}
|
|
6113
6532
|
if (!_isError) {
|
|
6114
6533
|
if (isEditMode && editUserId || isProfile) {
|
|
6115
6534
|
dispatch(showLoader());
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
}
|
|
6124
|
-
setFilesForDelete([]);
|
|
6125
|
-
setProfilePicDelete([]);
|
|
6126
|
-
})["catch"](function (err) {
|
|
6127
|
-
if (typeof err === 'object') {
|
|
6128
|
-
if (err.country_code) {
|
|
6129
|
-
err.contact_number = err.country_code;
|
|
6535
|
+
if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6536
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6537
|
+
method: 'POST',
|
|
6538
|
+
body: JSON.stringify(cardsPayload),
|
|
6539
|
+
headers: {
|
|
6540
|
+
'Content-Type': 'application/json',
|
|
6541
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6130
6542
|
}
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
delete err.passport;
|
|
6137
|
-
}
|
|
6138
|
-
setErrorArray(Object.keys(err));
|
|
6139
|
-
setErrorMsgs(err);
|
|
6140
|
-
var _loop2 = function _loop2() {
|
|
6141
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6142
|
-
if (err[_key4]) {
|
|
6143
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6144
|
-
setAdditionalInfoFlag('open');
|
|
6145
|
-
}
|
|
6146
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6147
|
-
if (el) {
|
|
6148
|
-
setTimeout(function () {
|
|
6149
|
-
el.scrollIntoView({
|
|
6150
|
-
behavior: 'smooth',
|
|
6151
|
-
block: 'center'
|
|
6152
|
-
});
|
|
6153
|
-
}, 500);
|
|
6154
|
-
return 1;
|
|
6155
|
-
}
|
|
6156
|
-
}
|
|
6157
|
-
}
|
|
6158
|
-
};
|
|
6159
|
-
for (var _key4 in err) {
|
|
6160
|
-
if (_loop2()) break;
|
|
6543
|
+
}).then(function (response) {
|
|
6544
|
+
if (response.status === 200) {
|
|
6545
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6546
|
+
} else {
|
|
6547
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6161
6548
|
}
|
|
6162
|
-
}
|
|
6163
|
-
|
|
6164
|
-
}
|
|
6165
|
-
|
|
6166
|
-
}
|
|
6167
|
-
}
|
|
6168
|
-
|
|
6169
|
-
}
|
|
6549
|
+
})["catch"](function (error) {
|
|
6550
|
+
console.log("errorrr", error);
|
|
6551
|
+
})["finally"](function () {
|
|
6552
|
+
dispatch(stopLoader());
|
|
6553
|
+
});
|
|
6554
|
+
} else {
|
|
6555
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6556
|
+
}
|
|
6170
6557
|
} else {
|
|
6171
6558
|
dispatch(showLoader());
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6559
|
+
if (cardApiflag === true) {
|
|
6560
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6561
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6562
|
+
if (res !== null && res !== void 0 && res.user_id) {
|
|
6563
|
+
fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
|
|
6564
|
+
method: 'POST',
|
|
6565
|
+
body: JSON.stringify(cardsPayload),
|
|
6566
|
+
headers: {
|
|
6567
|
+
'Content-Type': 'application/json',
|
|
6568
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6569
|
+
}
|
|
6570
|
+
}).then(function (response) {
|
|
6571
|
+
if (response.status !== 200) {
|
|
6572
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6573
|
+
}
|
|
6574
|
+
})["catch"](function (error) {
|
|
6575
|
+
console.log("errorrr", error);
|
|
6576
|
+
});
|
|
6186
6577
|
}
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
if (
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6578
|
+
(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);
|
|
6579
|
+
})["catch"](function (err) {
|
|
6580
|
+
if (typeof err === 'object') {
|
|
6581
|
+
if (err.country_code) {
|
|
6582
|
+
err.contact_number = err.country_code;
|
|
6583
|
+
}
|
|
6584
|
+
if (err.contact_country_code) {
|
|
6585
|
+
err.contact_number = err.contact_country_code;
|
|
6586
|
+
}
|
|
6587
|
+
if (err.passport) {
|
|
6588
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6589
|
+
delete err.passport;
|
|
6590
|
+
}
|
|
6591
|
+
setErrorArray(Object.keys(err));
|
|
6592
|
+
setErrorMsgs(err);
|
|
6593
|
+
var _loop4 = function _loop4() {
|
|
6594
|
+
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6595
|
+
if (err[_key4]) {
|
|
6596
|
+
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6597
|
+
setAdditionalInfoFlag('open');
|
|
6598
|
+
}
|
|
6599
|
+
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6600
|
+
if (el) {
|
|
6601
|
+
setTimeout(function () {
|
|
6602
|
+
el.scrollIntoView({
|
|
6603
|
+
behavior: 'smooth',
|
|
6604
|
+
block: 'center'
|
|
6605
|
+
});
|
|
6606
|
+
}, 500);
|
|
6607
|
+
return 1;
|
|
6608
|
+
}
|
|
6204
6609
|
}
|
|
6205
6610
|
}
|
|
6611
|
+
};
|
|
6612
|
+
for (var _key4 in err) {
|
|
6613
|
+
if (_loop4()) break;
|
|
6206
6614
|
}
|
|
6207
|
-
}
|
|
6208
|
-
|
|
6209
|
-
|
|
6615
|
+
} else if (typeof err === 'string') {
|
|
6616
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6617
|
+
} else {
|
|
6618
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6210
6619
|
}
|
|
6211
|
-
}
|
|
6212
|
-
|
|
6213
|
-
}
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
}
|
|
6217
|
-
dispatch(stopLoader());
|
|
6218
|
-
});
|
|
6620
|
+
})["finally"](function () {
|
|
6621
|
+
dispatch(stopLoader());
|
|
6622
|
+
});
|
|
6623
|
+
} else {
|
|
6624
|
+
createUserApiCall(payload);
|
|
6625
|
+
}
|
|
6219
6626
|
}
|
|
6220
6627
|
}
|
|
6221
6628
|
return Promise.resolve();
|
|
@@ -6233,8 +6640,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6233
6640
|
}
|
|
6234
6641
|
}
|
|
6235
6642
|
} else {
|
|
6236
|
-
var _config$
|
|
6237
|
-
(config === null || config === void 0 ? void 0 : (_config$
|
|
6643
|
+
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6644
|
+
(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);
|
|
6238
6645
|
}
|
|
6239
6646
|
};
|
|
6240
6647
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6531,74 +6938,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6531
6938
|
item: true,
|
|
6532
6939
|
sm: 12,
|
|
6533
6940
|
md: 4
|
|
6534
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
6535
|
-
label: "Delegation access",
|
|
6536
|
-
description: isProfile ? '' : 'Authorise another user to access your account. The delegated user will have full access to your account. Read more.',
|
|
6537
|
-
headerType: true,
|
|
6538
|
-
hasInfoIcon: true,
|
|
6539
|
-
tooltipText: "test tooltip"
|
|
6540
|
-
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6541
|
-
item: true,
|
|
6542
|
-
sm: 12,
|
|
6543
|
-
md: 8,
|
|
6544
|
-
lg: 8,
|
|
6545
|
-
xl: 6
|
|
6546
|
-
}, isDelegatesPresent ? /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6547
|
-
className: styles.accessDelegationContainer
|
|
6548
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncMultiSelect, {
|
|
6549
|
-
id: 'asyncSelect',
|
|
6550
|
-
additional: {
|
|
6551
|
-
page: 1,
|
|
6552
|
-
product: 'travel',
|
|
6553
|
-
userId: editUserId,
|
|
6554
|
-
placeholder: 'Select approver'
|
|
6555
|
-
},
|
|
6556
|
-
placeHolderCheck: travelFYI !== undefined && travelFYI.value === '',
|
|
6557
|
-
value: travelFYI.label === 'Select approver' ? '' : travelFYI,
|
|
6558
|
-
customSelectHandler: function customSelectHandler(selectedOption) {
|
|
6559
|
-
setTravelFYI(selectedOption);
|
|
6560
|
-
},
|
|
6561
|
-
loadOption: approversOptions,
|
|
6562
|
-
readOnly: isProfile,
|
|
6563
|
-
isMulti: true,
|
|
6564
|
-
label: 'Users',
|
|
6565
|
-
name: '',
|
|
6566
|
-
inputType: true,
|
|
6567
|
-
disableText: 'disabled',
|
|
6568
|
-
validation: validation,
|
|
6569
|
-
isAccessDelegation: true
|
|
6570
|
-
})) : /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6571
|
-
container: true,
|
|
6572
|
-
className: styles.accessDelegationContainer
|
|
6573
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6574
|
-
className: styles.emptyFieldContainer
|
|
6575
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
6576
|
-
className: styles.emptyFieldDescription
|
|
6577
|
-
}, "No Delegates added."), !isProfile && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6578
|
-
className: styles.emptyFieldBtnContainer
|
|
6579
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
6580
|
-
buttonText: "Add delegate",
|
|
6581
|
-
type: "text",
|
|
6582
|
-
startIcon: /*#__PURE__*/React__default.createElement(AddIcon, {
|
|
6583
|
-
width: "10",
|
|
6584
|
-
height: "10",
|
|
6585
|
-
color: "#EC5D25"
|
|
6586
|
-
}),
|
|
6587
|
-
className: styles.paddingTop,
|
|
6588
|
-
onClick: function onClick() {
|
|
6589
|
-
return setIsDelegatesPresent(function (prev) {
|
|
6590
|
-
return !prev;
|
|
6591
|
-
});
|
|
6592
|
-
}
|
|
6593
|
-
})))))), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
6594
|
-
className: styles.dividerColor
|
|
6595
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6596
|
-
container: true,
|
|
6597
|
-
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
6598
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6599
|
-
item: true,
|
|
6600
|
-
sm: 12,
|
|
6601
|
-
md: 4
|
|
6602
6941
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
6603
6942
|
label: "Product access",
|
|
6604
6943
|
description: isProfile ? '' : 'Select at least one product',
|
|
@@ -6615,6 +6954,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6615
6954
|
className: styles.productContainerGap
|
|
6616
6955
|
}, renderFields.products.map(function (p, i) {
|
|
6617
6956
|
p.readOnly = isProfile;
|
|
6957
|
+
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6958
|
+
p.readOnly = true;
|
|
6959
|
+
p.disableText = "Only card admin can change this access.";
|
|
6960
|
+
}
|
|
6618
6961
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6619
6962
|
item: true,
|
|
6620
6963
|
sm: 12,
|
|
@@ -6707,6 +7050,21 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6707
7050
|
isProfile: isProfile,
|
|
6708
7051
|
editUserId: editUserId,
|
|
6709
7052
|
roles: renderFields.expenseRoles
|
|
7053
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
7054
|
+
className: styles.dividerColor
|
|
7055
|
+
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React__default.createElement(CardsField, {
|
|
7056
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7057
|
+
type: "card",
|
|
7058
|
+
isProfile: isProfile,
|
|
7059
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7060
|
+
var _value = _ref7._value;
|
|
7061
|
+
return setCardsRole(_value);
|
|
7062
|
+
},
|
|
7063
|
+
roleValue: cardsRole,
|
|
7064
|
+
roles: cardsDetails.cardsRoles,
|
|
7065
|
+
cardsAdmin: isCardsAdmin,
|
|
7066
|
+
editUserId: editUserId,
|
|
7067
|
+
loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
|
|
6710
7068
|
}))) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
6711
7069
|
config: config,
|
|
6712
7070
|
errMsg: hasVerificationError
|
|
@@ -8515,7 +8873,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8515
8873
|
cell: function cell(row) {
|
|
8516
8874
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8517
8875
|
component: "div"
|
|
8518
|
-
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8876
|
+
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !row.products[0].role.toLowerCase().includes("holder") ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8519
8877
|
component: "div",
|
|
8520
8878
|
display: "flex"
|
|
8521
8879
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8528,7 +8886,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8528
8886
|
style: {
|
|
8529
8887
|
whiteSpace: 'nowrap'
|
|
8530
8888
|
}
|
|
8531
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8889
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && !row.products[1].role.toLowerCase().includes("holder") && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8532
8890
|
component: "div",
|
|
8533
8891
|
display: "flex"
|
|
8534
8892
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8541,7 +8899,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8541
8899
|
style: {
|
|
8542
8900
|
whiteSpace: 'nowrap'
|
|
8543
8901
|
}
|
|
8544
|
-
}, "\xA0" + row.products[1].role)))
|
|
8902
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && !row.products[2].role.toLowerCase().includes("holder") && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8903
|
+
component: "div",
|
|
8904
|
+
display: "flex"
|
|
8905
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8906
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8907
|
+
style: {
|
|
8908
|
+
whiteSpace: 'nowrap'
|
|
8909
|
+
}
|
|
8910
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8911
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8912
|
+
style: {
|
|
8913
|
+
whiteSpace: 'nowrap'
|
|
8914
|
+
}
|
|
8915
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8545
8916
|
}
|
|
8546
8917
|
}, {
|
|
8547
8918
|
id: 'status',
|