@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.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb,
|
|
1
|
+
import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUISearch, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
|
|
2
2
|
import React, { useState, useEffect, useRef, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { configs, services, utilUrls } from '@itilite/utils';
|
|
4
4
|
import axios from 'axios';
|
|
@@ -32,125 +32,161 @@ function _extends() {
|
|
|
32
32
|
};
|
|
33
33
|
return _extends.apply(this, arguments);
|
|
34
34
|
}
|
|
35
|
+
function _readOnlyError(name) {
|
|
36
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
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
|
+
}
|
|
35
69
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
// Settles a pact synchronously
|
|
70
|
+
var _Pact = /*#__PURE__*/function () {
|
|
71
|
+
function _Pact() {}
|
|
72
|
+
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
|
73
|
+
var result = new _Pact();
|
|
74
|
+
var state = this.s;
|
|
75
|
+
if (state) {
|
|
76
|
+
var callback = state & 1 ? onFulfilled : onRejected;
|
|
77
|
+
if (callback) {
|
|
78
|
+
try {
|
|
79
|
+
_settle(result, 1, callback(this.v));
|
|
80
|
+
} catch (e) {
|
|
81
|
+
_settle(result, 2, e);
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
} else {
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
this.o = function (_this) {
|
|
89
|
+
try {
|
|
90
|
+
var value = _this.v;
|
|
91
|
+
if (_this.s & 1) {
|
|
92
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
|
93
|
+
} else if (onRejected) {
|
|
94
|
+
_settle(result, 1, onRejected(value));
|
|
95
|
+
} else {
|
|
96
|
+
_settle(result, 2, value);
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {
|
|
99
|
+
_settle(result, 2, e);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
return _Pact;
|
|
105
|
+
}();
|
|
75
106
|
function _settle(pact, state, value) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
if (!pact.s) {
|
|
108
|
+
if (value instanceof _Pact) {
|
|
109
|
+
if (value.s) {
|
|
110
|
+
if (state & 1) {
|
|
111
|
+
state = value.s;
|
|
112
|
+
}
|
|
113
|
+
value = value.v;
|
|
114
|
+
} else {
|
|
115
|
+
value.o = _settle.bind(null, pact, state);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (value && value.then) {
|
|
120
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
pact.s = state;
|
|
124
|
+
pact.v = value;
|
|
125
|
+
var observer = pact.o;
|
|
126
|
+
if (observer) {
|
|
127
|
+
observer(pact);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
99
130
|
}
|
|
100
|
-
|
|
101
131
|
function _isSettledPact(thenable) {
|
|
102
|
-
|
|
132
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
|
103
133
|
}
|
|
104
|
-
|
|
105
|
-
// 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)
|
|
106
134
|
function _forTo(array, body, check) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
var i = -1,
|
|
136
|
+
pact,
|
|
137
|
+
reject;
|
|
138
|
+
function _cycle(result) {
|
|
139
|
+
try {
|
|
140
|
+
while (++i < array.length && (!check || !check())) {
|
|
141
|
+
result = body(i);
|
|
142
|
+
if (result && result.then) {
|
|
143
|
+
if (_isSettledPact(result)) {
|
|
144
|
+
result = result.v;
|
|
145
|
+
} else {
|
|
146
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (pact) {
|
|
152
|
+
_settle(pact, 1, result);
|
|
153
|
+
} else {
|
|
154
|
+
pact = result;
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
_cycle();
|
|
161
|
+
return pact;
|
|
132
162
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
137
|
-
|
|
138
|
-
// Asynchronously call a function and send errors to recovery continuation
|
|
163
|
+
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
|
|
164
|
+
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
139
165
|
function _catch(body, recover) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
try {
|
|
167
|
+
var result = body();
|
|
168
|
+
} catch (e) {
|
|
169
|
+
return recover(e);
|
|
170
|
+
}
|
|
171
|
+
if (result && result.then) {
|
|
172
|
+
return result.then(void 0, recover);
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
149
175
|
}
|
|
150
176
|
|
|
151
|
-
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","
|
|
177
|
+
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"};
|
|
152
178
|
|
|
153
|
-
function r(e)
|
|
179
|
+
function r(e) {
|
|
180
|
+
var t,
|
|
181
|
+
f,
|
|
182
|
+
n = "";
|
|
183
|
+
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);
|
|
184
|
+
return n;
|
|
185
|
+
}
|
|
186
|
+
function clsx() {
|
|
187
|
+
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
188
|
+
return n;
|
|
189
|
+
}
|
|
154
190
|
|
|
155
191
|
var GetInputType = React.forwardRef(function (props, ref) {
|
|
156
192
|
var _p = props._p,
|
|
@@ -387,6 +423,12 @@ var userAddEditUrl = {
|
|
|
387
423
|
},
|
|
388
424
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
389
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";
|
|
390
432
|
}
|
|
391
433
|
};
|
|
392
434
|
var userListUrl = {
|
|
@@ -645,7 +687,8 @@ var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _r
|
|
|
645
687
|
var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
646
688
|
var page = _ref5.page,
|
|
647
689
|
product = _ref5.product,
|
|
648
|
-
userId = _ref5.userId
|
|
690
|
+
userId = _ref5.userId,
|
|
691
|
+
placeholder = _ref5.placeholder;
|
|
649
692
|
try {
|
|
650
693
|
return Promise.resolve(_catch(function () {
|
|
651
694
|
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
@@ -659,7 +702,13 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
|
659
702
|
data: item.approver
|
|
660
703
|
};
|
|
661
704
|
});
|
|
662
|
-
|
|
705
|
+
if (page === 1) {
|
|
706
|
+
var placeholderLbl = {
|
|
707
|
+
value: '',
|
|
708
|
+
label: placeholder
|
|
709
|
+
};
|
|
710
|
+
mappedValue.unshift(placeholderLbl);
|
|
711
|
+
}
|
|
663
712
|
return {
|
|
664
713
|
options: mappedValue,
|
|
665
714
|
hasMore: !!response.next,
|
|
@@ -782,6 +831,7 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
782
831
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
783
832
|
var STOP_LOADER = 'STOP_LOADER';
|
|
784
833
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
834
|
+
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
785
835
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
786
836
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
787
837
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -826,9 +876,15 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
826
876
|
if (payload.productAccess.expense) {
|
|
827
877
|
product.expense = payload.expenseRole || null;
|
|
828
878
|
}
|
|
879
|
+
if (payload.productAccess.card) {
|
|
880
|
+
var splitRole = payload.cardsRole.split(":");
|
|
881
|
+
var cardsUsmRole = splitRole[2];
|
|
882
|
+
product.card = cardsUsmRole || null;
|
|
883
|
+
}
|
|
829
884
|
return product;
|
|
830
885
|
}(),
|
|
831
|
-
approvers: {}
|
|
886
|
+
approvers: {},
|
|
887
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
832
888
|
};
|
|
833
889
|
var userTags = [];
|
|
834
890
|
for (var key in payload.userTagType) {
|
|
@@ -920,13 +976,20 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
920
976
|
var res = {
|
|
921
977
|
fields: {
|
|
922
978
|
user_personal_info: {},
|
|
923
|
-
employee_info: {}
|
|
979
|
+
employee_info: {},
|
|
980
|
+
requested_user_is_admin: payload.isCardsAdmin
|
|
924
981
|
}
|
|
925
982
|
};
|
|
926
983
|
if (!env$1.isProfilePage()) {
|
|
927
984
|
res.fields.product = function () {
|
|
928
|
-
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
985
|
+
if (payload.productAccess.travel && payload.productAccess.expense && payload.productAccess.card) {
|
|
986
|
+
return 'expense+travel+card';
|
|
987
|
+
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
929
988
|
return 'expense+travel';
|
|
989
|
+
} else if (payload.productAccess.expense && payload.productAccess.card) {
|
|
990
|
+
return 'expense+card';
|
|
991
|
+
} else if (payload.productAccess.travel && payload.productAccess.card) {
|
|
992
|
+
return 'travel+card';
|
|
930
993
|
} else if (payload.productAccess.travel) {
|
|
931
994
|
return 'travel';
|
|
932
995
|
} else {
|
|
@@ -941,6 +1004,11 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
941
1004
|
if (payload.productAccess.expense) {
|
|
942
1005
|
roles.expense = payload.expenseRole;
|
|
943
1006
|
}
|
|
1007
|
+
if (payload.productAccess.card) {
|
|
1008
|
+
var splitRole = payload.cardsRole.split(":");
|
|
1009
|
+
var cardsUsmRole = splitRole[2];
|
|
1010
|
+
roles.card = cardsUsmRole;
|
|
1011
|
+
}
|
|
944
1012
|
return roles;
|
|
945
1013
|
}();
|
|
946
1014
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -1279,6 +1347,12 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1279
1347
|
payload: payload
|
|
1280
1348
|
};
|
|
1281
1349
|
};
|
|
1350
|
+
var setCardsDetails = function setCardsDetails(payload) {
|
|
1351
|
+
return {
|
|
1352
|
+
type: SET_CARDS_DETAILS,
|
|
1353
|
+
payload: payload
|
|
1354
|
+
};
|
|
1355
|
+
};
|
|
1282
1356
|
var setCustomField = function setCustomField(payload) {
|
|
1283
1357
|
return {
|
|
1284
1358
|
type: SET_CUSTOM_FIELD,
|
|
@@ -3181,6 +3255,12 @@ var products = [{
|
|
|
3181
3255
|
name: 'expense',
|
|
3182
3256
|
type: 'checkbox',
|
|
3183
3257
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3258
|
+
}, {
|
|
3259
|
+
id: 3,
|
|
3260
|
+
label: 'Card',
|
|
3261
|
+
name: 'card',
|
|
3262
|
+
type: 'checkbox',
|
|
3263
|
+
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3184
3264
|
}];
|
|
3185
3265
|
var dropdownList = {
|
|
3186
3266
|
gender: [{
|
|
@@ -3351,6 +3431,34 @@ var expenseConstants = {
|
|
|
3351
3431
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3352
3432
|
}]
|
|
3353
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 view own cards and transactions.',
|
|
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: 'Has full administrative access to the card program. Can issue cards, set card limits, add users, has visibility into all transactions, statements and balances.',
|
|
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
|
+
};
|
|
3354
3462
|
var passportInfo = [{
|
|
3355
3463
|
id: 1,
|
|
3356
3464
|
label: 'Passport issuing country',
|
|
@@ -3580,6 +3688,12 @@ var initialState = {
|
|
|
3580
3688
|
travelConstants: travelConstants,
|
|
3581
3689
|
expenseConstants: expenseConstants
|
|
3582
3690
|
},
|
|
3691
|
+
isCardsDetailsRendered: false,
|
|
3692
|
+
isCardsAdmin: false,
|
|
3693
|
+
cardsDetails: {
|
|
3694
|
+
cardsRoles: cardsConstants.roles,
|
|
3695
|
+
cardsConstants: cardsConstants
|
|
3696
|
+
},
|
|
3583
3697
|
dropdownList: dropdownList,
|
|
3584
3698
|
maxTravelApprovers: 10,
|
|
3585
3699
|
maxExpenseApprovers: 10,
|
|
@@ -3746,11 +3860,37 @@ var reducer = function reducer(state, action) {
|
|
|
3746
3860
|
isRendered: true
|
|
3747
3861
|
});
|
|
3748
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
|
+
}
|
|
3749
3889
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3750
3890
|
{
|
|
3751
3891
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3752
|
-
var _action$
|
|
3753
|
-
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]) {
|
|
3754
3894
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3755
3895
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3756
3896
|
}
|
|
@@ -4803,7 +4943,9 @@ var ErrorMessages = {
|
|
|
4803
4943
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4804
4944
|
passport_photo: 'Please attach passport photo.',
|
|
4805
4945
|
travel_docs: 'Please attach travel docs.',
|
|
4806
|
-
products: 'Please select atleast one product access.'
|
|
4946
|
+
products: 'Please select atleast one product access.',
|
|
4947
|
+
only_cards_products: 'Currently, Card cannot be selected as a standalone option. Please add at least one more product.',
|
|
4948
|
+
none_products: 'Select at least one product. If opting for card, please choose at least one additional product.'
|
|
4807
4949
|
};
|
|
4808
4950
|
|
|
4809
4951
|
function AddPanelDialog(_ref) {
|
|
@@ -4853,7 +4995,73 @@ function AddPanelDialog(_ref) {
|
|
|
4853
4995
|
})));
|
|
4854
4996
|
}
|
|
4855
4997
|
|
|
4856
|
-
var
|
|
4998
|
+
var CardsField = function CardsField(props) {
|
|
4999
|
+
var cardsConstants = props.cardsConstants,
|
|
5000
|
+
_props$onRoleChange = props.onRoleChange,
|
|
5001
|
+
onRoleChange = _props$onRoleChange === void 0 ? function () {} : _props$onRoleChange,
|
|
5002
|
+
_props$roleValue = props.roleValue,
|
|
5003
|
+
roleValue = _props$roleValue === void 0 ? '' : _props$roleValue,
|
|
5004
|
+
_props$isProfile = props.isProfile,
|
|
5005
|
+
isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
|
|
5006
|
+
_props$roles = props.roles,
|
|
5007
|
+
roles = _props$roles === void 0 ? [] : _props$roles,
|
|
5008
|
+
_props$cardsAdmin = props.cardsAdmin,
|
|
5009
|
+
cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
|
|
5010
|
+
editUserId = props.editUserId,
|
|
5011
|
+
loggedInUserId = props.loggedInUserId;
|
|
5012
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5013
|
+
container: true,
|
|
5014
|
+
className: (styles.headingPadding)
|
|
5015
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5016
|
+
variant: "h3",
|
|
5017
|
+
className: clsx(styles.heading, styles.headingMedium)
|
|
5018
|
+
}, cardsConstants.heading)), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
5019
|
+
className: styles.dividerColor
|
|
5020
|
+
}), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5021
|
+
container: true,
|
|
5022
|
+
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5023
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5024
|
+
item: true,
|
|
5025
|
+
sm: 12,
|
|
5026
|
+
md: 4
|
|
5027
|
+
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
5028
|
+
label: cardsConstants.roleHeading,
|
|
5029
|
+
headerType: true,
|
|
5030
|
+
description: cardsConstants.roleDescription
|
|
5031
|
+
})), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5032
|
+
item: true,
|
|
5033
|
+
sm: 12,
|
|
5034
|
+
md: 8,
|
|
5035
|
+
lg: 8,
|
|
5036
|
+
xl: 6
|
|
5037
|
+
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5038
|
+
container: true,
|
|
5039
|
+
className: styles.formFieldsWrapper
|
|
5040
|
+
}, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React.createElement(UserRole, {
|
|
5041
|
+
list: roles,
|
|
5042
|
+
value: roleValue
|
|
5043
|
+
}) : /*#__PURE__*/React.createElement(IUIRadio, {
|
|
5044
|
+
list: roles,
|
|
5045
|
+
value: roleValue,
|
|
5046
|
+
onValueChange: onRoleChange,
|
|
5047
|
+
disabled: cardsAdmin ? false : true
|
|
5048
|
+
})), !cardsAdmin && !isProfile && /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5049
|
+
item: true,
|
|
5050
|
+
sm: 12,
|
|
5051
|
+
md: 12,
|
|
5052
|
+
lg: 12,
|
|
5053
|
+
style: {
|
|
5054
|
+
marginTop: "24px"
|
|
5055
|
+
}
|
|
5056
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5057
|
+
variant: "body2",
|
|
5058
|
+
component: "span",
|
|
5059
|
+
className: styles.errorTextCls
|
|
5060
|
+
}, 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.")))));
|
|
5061
|
+
};
|
|
5062
|
+
|
|
5063
|
+
var IUIToastMessageService$4 = services.IUIToastMessageService,
|
|
5064
|
+
IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
4857
5065
|
var env$4 = configs.env;
|
|
4858
5066
|
var UserAddEdit = function UserAddEdit(props) {
|
|
4859
5067
|
var isEditMode = props.isEditMode,
|
|
@@ -4880,7 +5088,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4880
5088
|
isRendered = _useSelector.isRendered,
|
|
4881
5089
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
4882
5090
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
4883
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5091
|
+
maxMembershipInput = _useSelector.maxMembershipInput,
|
|
5092
|
+
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5093
|
+
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5094
|
+
cardsDetails = _useSelector.cardsDetails;
|
|
4884
5095
|
var _useSelector2 = useSelector(function (state) {
|
|
4885
5096
|
return state.common;
|
|
4886
5097
|
}),
|
|
@@ -4893,7 +5104,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4893
5104
|
var location = useLocation();
|
|
4894
5105
|
var _useState = useState({
|
|
4895
5106
|
travel: false,
|
|
4896
|
-
expense: false
|
|
5107
|
+
expense: false,
|
|
5108
|
+
card: false
|
|
4897
5109
|
}),
|
|
4898
5110
|
productAccess = _useState[0],
|
|
4899
5111
|
setProductAccess = _useState[1];
|
|
@@ -4904,13 +5116,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4904
5116
|
errorMsgs.products = '';
|
|
4905
5117
|
var _productAccess = _extends({}, productAccess);
|
|
4906
5118
|
_productAccess[value] = !_productAccess[value];
|
|
4907
|
-
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5119
|
+
if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === true) {
|
|
4908
5120
|
var _errorArray = [].concat(errorArray);
|
|
4909
5121
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
4910
5122
|
if (_errorArray.indexOf('products') === -1) {
|
|
4911
5123
|
_errorArray.push('products');
|
|
4912
5124
|
}
|
|
4913
|
-
_errorMsgs.products = ErrorMessages.
|
|
5125
|
+
_errorMsgs.products = ErrorMessages.only_cards_products;
|
|
4914
5126
|
setErrorArray(_errorArray);
|
|
4915
5127
|
setErrorMsgs(_errorMsgs);
|
|
4916
5128
|
var el = document.getElementById('products');
|
|
@@ -4920,6 +5132,22 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4920
5132
|
block: 'center'
|
|
4921
5133
|
});
|
|
4922
5134
|
}
|
|
5135
|
+
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5136
|
+
var _errorArray2 = [].concat(errorArray);
|
|
5137
|
+
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5138
|
+
if (_errorArray2.indexOf('products') === -1) {
|
|
5139
|
+
_errorArray2.push('products');
|
|
5140
|
+
}
|
|
5141
|
+
_errorMsgs2.products = ErrorMessages.products;
|
|
5142
|
+
setErrorArray(_errorArray2);
|
|
5143
|
+
setErrorMsgs(_errorMsgs2);
|
|
5144
|
+
var _el = document.getElementById('products');
|
|
5145
|
+
if (_el) {
|
|
5146
|
+
_el.scrollIntoView({
|
|
5147
|
+
behavior: 'smooth',
|
|
5148
|
+
block: 'center'
|
|
5149
|
+
});
|
|
5150
|
+
}
|
|
4923
5151
|
} else {
|
|
4924
5152
|
setErrorArray(errorArray);
|
|
4925
5153
|
setErrorMsgs(errorMsgs);
|
|
@@ -4935,18 +5163,155 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4935
5163
|
var _useState4 = useState([]),
|
|
4936
5164
|
countryContactCode = _useState4[0],
|
|
4937
5165
|
setCountryContactCode = _useState4[1];
|
|
4938
|
-
var
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
5166
|
+
var updateUserApiCall = function updateUserApiCall(payload, inputChangeLog) {
|
|
5167
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
5168
|
+
if (isProfile) {
|
|
5169
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
5170
|
+
(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);
|
|
5171
|
+
} else {
|
|
5172
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
5173
|
+
(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);
|
|
5174
|
+
}
|
|
5175
|
+
setFilesForDelete([]);
|
|
5176
|
+
setProfilePicDelete([]);
|
|
5177
|
+
})["catch"](function (err) {
|
|
5178
|
+
if (typeof err === 'object') {
|
|
5179
|
+
if (err.country_code) {
|
|
5180
|
+
err.contact_number = err.country_code;
|
|
5181
|
+
}
|
|
5182
|
+
if (err.contact_country_code) {
|
|
5183
|
+
err.contact_number = err.contact_country_code;
|
|
5184
|
+
}
|
|
5185
|
+
if (err.passport) {
|
|
5186
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5187
|
+
delete err.passport;
|
|
5188
|
+
}
|
|
5189
|
+
setErrorArray(Object.keys(err));
|
|
5190
|
+
setErrorMsgs(err);
|
|
5191
|
+
var _loop = function _loop() {
|
|
5192
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5193
|
+
if (err[key]) {
|
|
5194
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5195
|
+
setAdditionalInfoFlag('open');
|
|
5196
|
+
}
|
|
5197
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5198
|
+
if (el) {
|
|
5199
|
+
setTimeout(function () {
|
|
5200
|
+
el.scrollIntoView({
|
|
5201
|
+
behavior: 'smooth',
|
|
5202
|
+
block: 'center'
|
|
5203
|
+
});
|
|
5204
|
+
}, 500);
|
|
5205
|
+
return 1;
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
};
|
|
5210
|
+
for (var key in err) {
|
|
5211
|
+
if (_loop()) break;
|
|
5212
|
+
}
|
|
5213
|
+
} else if (typeof err === 'string') {
|
|
5214
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5215
|
+
} else {
|
|
5216
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5217
|
+
}
|
|
5218
|
+
})["finally"](function () {
|
|
5219
|
+
dispatch(stopLoader());
|
|
5220
|
+
});
|
|
5221
|
+
};
|
|
5222
|
+
var createUserApiCall = function createUserApiCall(payload) {
|
|
5223
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
5224
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5225
|
+
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) {
|
|
5226
|
+
history.push({
|
|
5227
|
+
pathname: config.routes.users.list.path
|
|
5228
|
+
});
|
|
5229
|
+
}
|
|
5230
|
+
})["catch"](function (err) {
|
|
5231
|
+
if (typeof err === 'object') {
|
|
5232
|
+
if (err.country_code) {
|
|
5233
|
+
err.contact_number = err.country_code;
|
|
5234
|
+
}
|
|
5235
|
+
if (err.contact_country_code) {
|
|
5236
|
+
err.contact_number = err.contact_country_code;
|
|
5237
|
+
}
|
|
5238
|
+
if (err.passport) {
|
|
5239
|
+
err.passport_photo = _extends({}, err.passport);
|
|
5240
|
+
delete err.passport;
|
|
5241
|
+
}
|
|
5242
|
+
setErrorArray(Object.keys(err));
|
|
5243
|
+
setErrorMsgs(err);
|
|
5244
|
+
var _loop2 = function _loop2() {
|
|
5245
|
+
if (Object.hasOwnProperty.call(err, key)) {
|
|
5246
|
+
if (err[key]) {
|
|
5247
|
+
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5248
|
+
setAdditionalInfoFlag('open');
|
|
5249
|
+
}
|
|
5250
|
+
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5251
|
+
if (el) {
|
|
5252
|
+
setTimeout(function () {
|
|
5253
|
+
el.scrollIntoView({
|
|
5254
|
+
behavior: 'smooth',
|
|
5255
|
+
block: 'center'
|
|
5256
|
+
});
|
|
5257
|
+
}, 500);
|
|
5258
|
+
return 1;
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
};
|
|
5263
|
+
for (var key in err) {
|
|
5264
|
+
if (_loop2()) break;
|
|
5265
|
+
}
|
|
5266
|
+
} else if (typeof err === 'string') {
|
|
5267
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
5268
|
+
} else {
|
|
5269
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5270
|
+
}
|
|
5271
|
+
})["finally"](function () {
|
|
5272
|
+
dispatch(stopLoader());
|
|
5273
|
+
});
|
|
5274
|
+
};
|
|
5275
|
+
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5276
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5277
|
+
method: 'GET',
|
|
5278
|
+
headers: {
|
|
5279
|
+
'Content-Type': 'application/json',
|
|
5280
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5281
|
+
}
|
|
5282
|
+
}).then(function (response) {
|
|
5283
|
+
return response.json();
|
|
5284
|
+
}).then(function (res) {
|
|
5285
|
+
var _res$roles;
|
|
5286
|
+
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5287
|
+
dispatch(setCardsDetails(res));
|
|
5288
|
+
} else {
|
|
5289
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5290
|
+
}
|
|
5291
|
+
})["catch"](function (error) {
|
|
5292
|
+
console.log("errorrr", error);
|
|
5293
|
+
});
|
|
5294
|
+
};
|
|
5295
|
+
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5296
|
+
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5297
|
+
method: 'GET',
|
|
5298
|
+
headers: {
|
|
5299
|
+
'Content-Type': 'application/json',
|
|
5300
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5301
|
+
}
|
|
5302
|
+
}).then(function (response) {
|
|
5303
|
+
return response.json();
|
|
5304
|
+
}).then(function (res) {
|
|
5305
|
+
var _res$roles2;
|
|
5306
|
+
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5307
|
+
dispatch(setCardsDetails(res));
|
|
5308
|
+
} else {
|
|
5309
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5310
|
+
}
|
|
5311
|
+
})["catch"](function (error) {
|
|
5312
|
+
console.log("errorrr", error);
|
|
5313
|
+
});
|
|
5314
|
+
};
|
|
4950
5315
|
useEffect(function () {
|
|
4951
5316
|
var countryObject = countryContactCode.find(function (t) {
|
|
4952
5317
|
return t.dial_code === countryDialCode;
|
|
@@ -4962,7 +5327,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4962
5327
|
var convertedNumber = parseInt(extractedNumber);
|
|
4963
5328
|
setCountryDialCode(convertedNumber);
|
|
4964
5329
|
}, [newCountryCode]);
|
|
4965
|
-
var
|
|
5330
|
+
var _useState5 = useState({
|
|
4966
5331
|
first_name: '',
|
|
4967
5332
|
last_name: '',
|
|
4968
5333
|
email: '',
|
|
@@ -4973,9 +5338,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
4973
5338
|
contact_country_code: '',
|
|
4974
5339
|
profile_pic: []
|
|
4975
5340
|
}),
|
|
4976
|
-
personalInfoInput =
|
|
4977
|
-
setPersonalInfoInput =
|
|
4978
|
-
var
|
|
5341
|
+
personalInfoInput = _useState5[0],
|
|
5342
|
+
setPersonalInfoInput = _useState5[1];
|
|
5343
|
+
var _useState6 = useState({
|
|
4979
5344
|
emp_level: {
|
|
4980
5345
|
value: '',
|
|
4981
5346
|
label: 'Select employee level'
|
|
@@ -5008,9 +5373,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5008
5373
|
label: defaultCurrency
|
|
5009
5374
|
}
|
|
5010
5375
|
}),
|
|
5011
|
-
employeeInfoInput =
|
|
5012
|
-
setEmployeeInfoInput =
|
|
5013
|
-
var
|
|
5376
|
+
employeeInfoInput = _useState6[0],
|
|
5377
|
+
setEmployeeInfoInput = _useState6[1];
|
|
5378
|
+
var _useState7 = useState({
|
|
5014
5379
|
emp_level: 0,
|
|
5015
5380
|
entity: 0,
|
|
5016
5381
|
business_unit: 0,
|
|
@@ -5019,48 +5384,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5019
5384
|
manager_id: 0,
|
|
5020
5385
|
skip_manager_id: 0
|
|
5021
5386
|
}),
|
|
5022
|
-
cacheForAsyncDropdown =
|
|
5023
|
-
clearCacheForAsyncDropdown =
|
|
5387
|
+
cacheForAsyncDropdown = _useState7[0],
|
|
5388
|
+
clearCacheForAsyncDropdown = _useState7[1];
|
|
5389
|
+
var _useState8 = useState({}),
|
|
5390
|
+
userTagType = _useState8[0],
|
|
5391
|
+
setUserTagType = _useState8[1];
|
|
5392
|
+
var _useState9 = useState(false),
|
|
5393
|
+
scroll = _useState9[0],
|
|
5394
|
+
setScroll = _useState9[1];
|
|
5024
5395
|
var _useState10 = useState({}),
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
var _useState11 = useState(
|
|
5028
|
-
|
|
5029
|
-
|
|
5396
|
+
customFieldsInput = _useState10[0],
|
|
5397
|
+
setCustomFieldsInput = _useState10[1];
|
|
5398
|
+
var _useState11 = useState('traveler'),
|
|
5399
|
+
travelRole = _useState11[0],
|
|
5400
|
+
setTravelRole = _useState11[1];
|
|
5030
5401
|
var _useState12 = useState({}),
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
var _useState13 = useState(
|
|
5034
|
-
travelRole = _useState13[0],
|
|
5035
|
-
setTravelRole = _useState13[1];
|
|
5036
|
-
var _useState14 = useState({}),
|
|
5037
|
-
travelApproversInput = _useState14[0],
|
|
5038
|
-
setTravelApproversInput = _useState14[1];
|
|
5039
|
-
var _useState15 = useState({
|
|
5402
|
+
travelApproversInput = _useState12[0],
|
|
5403
|
+
setTravelApproversInput = _useState12[1];
|
|
5404
|
+
var _useState13 = useState({
|
|
5040
5405
|
value: '',
|
|
5041
5406
|
label: 'Select approver'
|
|
5042
5407
|
}),
|
|
5043
|
-
travelFYI =
|
|
5044
|
-
setTravelFYI =
|
|
5045
|
-
var
|
|
5046
|
-
membershipInfoInput =
|
|
5047
|
-
setMembershipInfoInput =
|
|
5048
|
-
var
|
|
5049
|
-
removedMembershipInfoInput =
|
|
5050
|
-
setRemovedMembershipInfoInput =
|
|
5051
|
-
var
|
|
5408
|
+
travelFYI = _useState13[0],
|
|
5409
|
+
setTravelFYI = _useState13[1];
|
|
5410
|
+
var _useState14 = useState([]),
|
|
5411
|
+
membershipInfoInput = _useState14[0],
|
|
5412
|
+
setMembershipInfoInput = _useState14[1];
|
|
5413
|
+
var _useState15 = useState([]),
|
|
5414
|
+
removedMembershipInfoInput = _useState15[0],
|
|
5415
|
+
setRemovedMembershipInfoInput = _useState15[1];
|
|
5416
|
+
var _useState16 = useState({
|
|
5052
5417
|
flight_seat_preference: '',
|
|
5053
5418
|
meal_preference: ''
|
|
5054
5419
|
}),
|
|
5055
|
-
travelPreferenceInfo =
|
|
5056
|
-
settravelPreferenceInfo =
|
|
5057
|
-
var
|
|
5420
|
+
travelPreferenceInfo = _useState16[0],
|
|
5421
|
+
settravelPreferenceInfo = _useState16[1];
|
|
5422
|
+
var _useState17 = useState({
|
|
5058
5423
|
trusted_traveller: '',
|
|
5059
5424
|
redress_number: ''
|
|
5060
5425
|
}),
|
|
5061
|
-
secureTravelInputInfo =
|
|
5062
|
-
setSecureTravelInputInfo =
|
|
5063
|
-
var
|
|
5426
|
+
secureTravelInputInfo = _useState17[0],
|
|
5427
|
+
setSecureTravelInputInfo = _useState17[1];
|
|
5428
|
+
var _useState18 = useState({
|
|
5064
5429
|
passport_issue_country: {
|
|
5065
5430
|
value: '',
|
|
5066
5431
|
label: 'Select country'
|
|
@@ -5075,39 +5440,76 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5075
5440
|
passport_photo: [],
|
|
5076
5441
|
travel_docs: []
|
|
5077
5442
|
}),
|
|
5078
|
-
passportInfoInput =
|
|
5079
|
-
setPassportInfoInput =
|
|
5080
|
-
var
|
|
5081
|
-
filesForDelete =
|
|
5082
|
-
setFilesForDelete =
|
|
5083
|
-
var
|
|
5084
|
-
profilePicDelete =
|
|
5085
|
-
setProfilePicDelete =
|
|
5086
|
-
var
|
|
5087
|
-
isAdditionalInfoExpanded =
|
|
5088
|
-
setAdditionalInfoFlag =
|
|
5089
|
-
var
|
|
5090
|
-
expenseRole =
|
|
5091
|
-
setExpenseRole =
|
|
5092
|
-
var
|
|
5093
|
-
expenseApproversInput =
|
|
5094
|
-
setExpenseApproversInput =
|
|
5095
|
-
var
|
|
5443
|
+
passportInfoInput = _useState18[0],
|
|
5444
|
+
setPassportInfoInput = _useState18[1];
|
|
5445
|
+
var _useState19 = useState([]),
|
|
5446
|
+
filesForDelete = _useState19[0],
|
|
5447
|
+
setFilesForDelete = _useState19[1];
|
|
5448
|
+
var _useState20 = useState([]),
|
|
5449
|
+
profilePicDelete = _useState20[0],
|
|
5450
|
+
setProfilePicDelete = _useState20[1];
|
|
5451
|
+
var _useState21 = useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5452
|
+
isAdditionalInfoExpanded = _useState21[0],
|
|
5453
|
+
setAdditionalInfoFlag = _useState21[1];
|
|
5454
|
+
var _useState22 = useState('submitter'),
|
|
5455
|
+
expenseRole = _useState22[0],
|
|
5456
|
+
setExpenseRole = _useState22[1];
|
|
5457
|
+
var _useState23 = useState({}),
|
|
5458
|
+
expenseApproversInput = _useState23[0],
|
|
5459
|
+
setExpenseApproversInput = _useState23[1];
|
|
5460
|
+
var _useState24 = useState({
|
|
5096
5461
|
value: '',
|
|
5097
5462
|
label: 'Select approver'
|
|
5098
5463
|
}),
|
|
5099
|
-
expenseFYI =
|
|
5100
|
-
setExpenseFYI =
|
|
5464
|
+
expenseFYI = _useState24[0],
|
|
5465
|
+
setExpenseFYI = _useState24[1];
|
|
5466
|
+
var _useState25 = useState(''),
|
|
5467
|
+
cardsRole = _useState25[0],
|
|
5468
|
+
setCardsRole = _useState25[1];
|
|
5469
|
+
useEffect(function () {
|
|
5470
|
+
if (productAccess.card === false) {
|
|
5471
|
+
setCardsRole('');
|
|
5472
|
+
}
|
|
5473
|
+
}, [productAccess.card]);
|
|
5474
|
+
useEffect(function () {
|
|
5475
|
+
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5476
|
+
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5477
|
+
return role.isAssigned;
|
|
5478
|
+
});
|
|
5479
|
+
if (selectedRole) {
|
|
5480
|
+
setCardsRole(selectedRole.value);
|
|
5481
|
+
} else {
|
|
5482
|
+
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5483
|
+
var splitRoleVal = role.value.split(':');
|
|
5484
|
+
return splitRoleVal[2] === 'card-holder';
|
|
5485
|
+
});
|
|
5486
|
+
if (defaultRole) {
|
|
5487
|
+
setCardsRole(defaultRole.value);
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5491
|
+
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5492
|
+
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5493
|
+
var role = _step.value;
|
|
5494
|
+
var splitRoleVal = role.value.split(':');
|
|
5495
|
+
var profileRole = splitRoleVal[2];
|
|
5496
|
+
if (profileRole === targetRole) {
|
|
5497
|
+
setCardsRole(role.value);
|
|
5498
|
+
break;
|
|
5499
|
+
}
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
5101
5503
|
var asyncSelectRefs = useRef({
|
|
5102
5504
|
emp_level: useRef(null),
|
|
5103
5505
|
entity: useRef(null),
|
|
5104
5506
|
business_unit: useRef(null),
|
|
5105
5507
|
department: useRef(null)
|
|
5106
5508
|
});
|
|
5107
|
-
var
|
|
5108
|
-
errorArray =
|
|
5109
|
-
setErrorArray =
|
|
5110
|
-
var
|
|
5509
|
+
var _useState26 = useState([]),
|
|
5510
|
+
errorArray = _useState26[0],
|
|
5511
|
+
setErrorArray = _useState26[1];
|
|
5512
|
+
var _useState27 = useState({
|
|
5111
5513
|
first_name: '',
|
|
5112
5514
|
last_name: '',
|
|
5113
5515
|
email: '',
|
|
@@ -5137,9 +5539,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5137
5539
|
userTagType: '',
|
|
5138
5540
|
profile_pic: ''
|
|
5139
5541
|
}),
|
|
5140
|
-
errorMsgs =
|
|
5141
|
-
setErrorMsgs =
|
|
5142
|
-
var
|
|
5542
|
+
errorMsgs = _useState27[0],
|
|
5543
|
+
setErrorMsgs = _useState27[1];
|
|
5544
|
+
var _useState28 = useState({
|
|
5143
5545
|
first_name: false,
|
|
5144
5546
|
last_name: false,
|
|
5145
5547
|
email: false,
|
|
@@ -5166,14 +5568,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5166
5568
|
userTagType: false,
|
|
5167
5569
|
profile_pic: false
|
|
5168
5570
|
}),
|
|
5169
|
-
inputChangeLog =
|
|
5170
|
-
updateInputChangeLog =
|
|
5171
|
-
var
|
|
5172
|
-
uploadedFiles =
|
|
5173
|
-
setUploadedFiles =
|
|
5174
|
-
var
|
|
5175
|
-
maxLengthForModal =
|
|
5176
|
-
setMaxLengthForModal =
|
|
5571
|
+
inputChangeLog = _useState28[0],
|
|
5572
|
+
updateInputChangeLog = _useState28[1];
|
|
5573
|
+
var _useState29 = useState([]),
|
|
5574
|
+
uploadedFiles = _useState29[0],
|
|
5575
|
+
setUploadedFiles = _useState29[1];
|
|
5576
|
+
var _useState30 = useState(70),
|
|
5577
|
+
maxLengthForModal = _useState30[0],
|
|
5578
|
+
setMaxLengthForModal = _useState30[1];
|
|
5177
5579
|
var defaultAddModalData = {
|
|
5178
5580
|
isOpen: false,
|
|
5179
5581
|
isError: false,
|
|
@@ -5189,9 +5591,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5189
5591
|
maxLength: maxLengthForModal,
|
|
5190
5592
|
minLength: 0
|
|
5191
5593
|
};
|
|
5192
|
-
var
|
|
5193
|
-
addModalData =
|
|
5194
|
-
setAddModalData =
|
|
5594
|
+
var _useState31 = useState(defaultAddModalData),
|
|
5595
|
+
addModalData = _useState31[0],
|
|
5596
|
+
setAddModalData = _useState31[1];
|
|
5195
5597
|
var onAddModalClose = function onAddModalClose() {
|
|
5196
5598
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5197
5599
|
};
|
|
@@ -5602,6 +6004,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5602
6004
|
}, [isTokenVerified]);
|
|
5603
6005
|
useEffect(function () {
|
|
5604
6006
|
if (isRendered === true) {
|
|
6007
|
+
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6008
|
+
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6009
|
+
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6010
|
+
}
|
|
6011
|
+
});
|
|
5605
6012
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
5606
6013
|
country_code: countryCode
|
|
5607
6014
|
}));
|
|
@@ -5723,7 +6130,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5723
6130
|
var products = res.user_product.split('+');
|
|
5724
6131
|
setProductAccess({
|
|
5725
6132
|
travel: products.includes('travel'),
|
|
5726
|
-
expense: products.includes('expense')
|
|
6133
|
+
expense: products.includes('expense'),
|
|
6134
|
+
card: products.includes('card')
|
|
5727
6135
|
});
|
|
5728
6136
|
if (products.includes('travel')) {
|
|
5729
6137
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -5940,6 +6348,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5940
6348
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
5941
6349
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
5942
6350
|
}
|
|
6351
|
+
var cardsPayload = {
|
|
6352
|
+
"roles": [cardsRole]
|
|
6353
|
+
};
|
|
5943
6354
|
var payload = {
|
|
5944
6355
|
personalInfoInput: personalInfoInput,
|
|
5945
6356
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -5958,7 +6369,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5958
6369
|
uploadedFiles: uploadedFiles,
|
|
5959
6370
|
filesForDelete: filesForDelete,
|
|
5960
6371
|
profilePicDelete: profilePicDelete,
|
|
5961
|
-
userTagType: userTagType
|
|
6372
|
+
userTagType: userTagType,
|
|
6373
|
+
cardsRole: cardsRole,
|
|
6374
|
+
isCardsAdmin: isCardsAdmin
|
|
5962
6375
|
};
|
|
5963
6376
|
if (verifyUserId) {
|
|
5964
6377
|
payload.verifyUserId = verifyUserId;
|
|
@@ -6084,7 +6497,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6084
6497
|
if (_isError) {
|
|
6085
6498
|
setErrorArray(_errorArray);
|
|
6086
6499
|
setErrorMsgs(_errorMsgs);
|
|
6087
|
-
var
|
|
6500
|
+
var _loop3 = function _loop3() {
|
|
6088
6501
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6089
6502
|
if (_errorMsgs[_key3]) {
|
|
6090
6503
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6104,115 +6517,109 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6104
6517
|
}
|
|
6105
6518
|
};
|
|
6106
6519
|
for (var _key3 in _errorMsgs) {
|
|
6107
|
-
if (
|
|
6520
|
+
if (_loop3()) break;
|
|
6108
6521
|
}
|
|
6109
6522
|
}
|
|
6523
|
+
var cardApiflag = false;
|
|
6524
|
+
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6525
|
+
false, _readOnlyError("cardApiflag");
|
|
6526
|
+
} else {
|
|
6527
|
+
true, _readOnlyError("cardApiflag");
|
|
6528
|
+
}
|
|
6110
6529
|
if (!_isError) {
|
|
6111
6530
|
if (isEditMode && editUserId || isProfile) {
|
|
6112
6531
|
dispatch(showLoader());
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
}
|
|
6121
|
-
setFilesForDelete([]);
|
|
6122
|
-
setProfilePicDelete([]);
|
|
6123
|
-
})["catch"](function (err) {
|
|
6124
|
-
if (typeof err === 'object') {
|
|
6125
|
-
if (err.country_code) {
|
|
6126
|
-
err.contact_number = err.country_code;
|
|
6532
|
+
if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
|
|
6533
|
+
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
6534
|
+
method: 'POST',
|
|
6535
|
+
body: JSON.stringify(cardsPayload),
|
|
6536
|
+
headers: {
|
|
6537
|
+
'Content-Type': 'application/json',
|
|
6538
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6127
6539
|
}
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
delete err.passport;
|
|
6134
|
-
}
|
|
6135
|
-
setErrorArray(Object.keys(err));
|
|
6136
|
-
setErrorMsgs(err);
|
|
6137
|
-
var _loop2 = function _loop2() {
|
|
6138
|
-
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6139
|
-
if (err[_key4]) {
|
|
6140
|
-
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6141
|
-
setAdditionalInfoFlag('open');
|
|
6142
|
-
}
|
|
6143
|
-
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6144
|
-
if (el) {
|
|
6145
|
-
setTimeout(function () {
|
|
6146
|
-
el.scrollIntoView({
|
|
6147
|
-
behavior: 'smooth',
|
|
6148
|
-
block: 'center'
|
|
6149
|
-
});
|
|
6150
|
-
}, 500);
|
|
6151
|
-
return 1;
|
|
6152
|
-
}
|
|
6153
|
-
}
|
|
6154
|
-
}
|
|
6155
|
-
};
|
|
6156
|
-
for (var _key4 in err) {
|
|
6157
|
-
if (_loop2()) break;
|
|
6540
|
+
}).then(function (response) {
|
|
6541
|
+
if (response.status === 200) {
|
|
6542
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6543
|
+
} else {
|
|
6544
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6158
6545
|
}
|
|
6159
|
-
}
|
|
6160
|
-
|
|
6161
|
-
}
|
|
6162
|
-
|
|
6163
|
-
}
|
|
6164
|
-
}
|
|
6165
|
-
|
|
6166
|
-
}
|
|
6546
|
+
})["catch"](function (error) {
|
|
6547
|
+
console.log("errorrr", error);
|
|
6548
|
+
})["finally"](function () {
|
|
6549
|
+
dispatch(stopLoader());
|
|
6550
|
+
});
|
|
6551
|
+
} else {
|
|
6552
|
+
updateUserApiCall(payload, inputChangeLog);
|
|
6553
|
+
}
|
|
6167
6554
|
} else {
|
|
6168
6555
|
dispatch(showLoader());
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6556
|
+
if (cardApiflag === true) {
|
|
6557
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6558
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6559
|
+
if (res !== null && res !== void 0 && res.user_id) {
|
|
6560
|
+
fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
|
|
6561
|
+
method: 'POST',
|
|
6562
|
+
body: JSON.stringify(cardsPayload),
|
|
6563
|
+
headers: {
|
|
6564
|
+
'Content-Type': 'application/json',
|
|
6565
|
+
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6566
|
+
}
|
|
6567
|
+
}).then(function (response) {
|
|
6568
|
+
if (response.status !== 200) {
|
|
6569
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6570
|
+
}
|
|
6571
|
+
})["catch"](function (error) {
|
|
6572
|
+
console.log("errorrr", error);
|
|
6573
|
+
});
|
|
6183
6574
|
}
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
if (
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6575
|
+
(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);
|
|
6576
|
+
})["catch"](function (err) {
|
|
6577
|
+
if (typeof err === 'object') {
|
|
6578
|
+
if (err.country_code) {
|
|
6579
|
+
err.contact_number = err.country_code;
|
|
6580
|
+
}
|
|
6581
|
+
if (err.contact_country_code) {
|
|
6582
|
+
err.contact_number = err.contact_country_code;
|
|
6583
|
+
}
|
|
6584
|
+
if (err.passport) {
|
|
6585
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6586
|
+
delete err.passport;
|
|
6587
|
+
}
|
|
6588
|
+
setErrorArray(Object.keys(err));
|
|
6589
|
+
setErrorMsgs(err);
|
|
6590
|
+
var _loop4 = function _loop4() {
|
|
6591
|
+
if (Object.hasOwnProperty.call(err, _key4)) {
|
|
6592
|
+
if (err[_key4]) {
|
|
6593
|
+
if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
|
|
6594
|
+
setAdditionalInfoFlag('open');
|
|
6595
|
+
}
|
|
6596
|
+
var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
|
|
6597
|
+
if (el) {
|
|
6598
|
+
setTimeout(function () {
|
|
6599
|
+
el.scrollIntoView({
|
|
6600
|
+
behavior: 'smooth',
|
|
6601
|
+
block: 'center'
|
|
6602
|
+
});
|
|
6603
|
+
}, 500);
|
|
6604
|
+
return 1;
|
|
6605
|
+
}
|
|
6201
6606
|
}
|
|
6202
6607
|
}
|
|
6608
|
+
};
|
|
6609
|
+
for (var _key4 in err) {
|
|
6610
|
+
if (_loop4()) break;
|
|
6203
6611
|
}
|
|
6204
|
-
}
|
|
6205
|
-
|
|
6206
|
-
|
|
6612
|
+
} else if (typeof err === 'string') {
|
|
6613
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6614
|
+
} else {
|
|
6615
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6207
6616
|
}
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
|
-
}
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
}
|
|
6214
|
-
dispatch(stopLoader());
|
|
6215
|
-
});
|
|
6617
|
+
})["finally"](function () {
|
|
6618
|
+
dispatch(stopLoader());
|
|
6619
|
+
});
|
|
6620
|
+
} else {
|
|
6621
|
+
createUserApiCall(payload);
|
|
6622
|
+
}
|
|
6216
6623
|
}
|
|
6217
6624
|
}
|
|
6218
6625
|
return Promise.resolve();
|
|
@@ -6230,8 +6637,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6230
6637
|
}
|
|
6231
6638
|
}
|
|
6232
6639
|
} else {
|
|
6233
|
-
var _config$
|
|
6234
|
-
(config === null || config === void 0 ? void 0 : (_config$
|
|
6640
|
+
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6641
|
+
(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);
|
|
6235
6642
|
}
|
|
6236
6643
|
};
|
|
6237
6644
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6528,74 +6935,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6528
6935
|
item: true,
|
|
6529
6936
|
sm: 12,
|
|
6530
6937
|
md: 4
|
|
6531
|
-
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
6532
|
-
label: "Delegation access",
|
|
6533
|
-
description: isProfile ? '' : 'Authorise another user to access your account. The delegated user will have full access to your account. Read more.',
|
|
6534
|
-
headerType: true,
|
|
6535
|
-
hasInfoIcon: true,
|
|
6536
|
-
tooltipText: "test tooltip"
|
|
6537
|
-
})), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6538
|
-
item: true,
|
|
6539
|
-
sm: 12,
|
|
6540
|
-
md: 8,
|
|
6541
|
-
lg: 8,
|
|
6542
|
-
xl: 6
|
|
6543
|
-
}, isDelegatesPresent ? /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6544
|
-
className: styles.accessDelegationContainer
|
|
6545
|
-
}, /*#__PURE__*/React.createElement(IUIAsyncMultiSelect, {
|
|
6546
|
-
id: 'asyncSelect',
|
|
6547
|
-
additional: {
|
|
6548
|
-
page: 1,
|
|
6549
|
-
product: 'travel',
|
|
6550
|
-
userId: editUserId,
|
|
6551
|
-
placeholder: 'Select approver'
|
|
6552
|
-
},
|
|
6553
|
-
placeHolderCheck: travelFYI !== undefined && travelFYI.value === '',
|
|
6554
|
-
value: travelFYI.label === 'Select approver' ? '' : travelFYI,
|
|
6555
|
-
customSelectHandler: function customSelectHandler(selectedOption) {
|
|
6556
|
-
setTravelFYI(selectedOption);
|
|
6557
|
-
},
|
|
6558
|
-
loadOption: approversOptions,
|
|
6559
|
-
readOnly: isProfile,
|
|
6560
|
-
isMulti: true,
|
|
6561
|
-
label: 'Users',
|
|
6562
|
-
name: '',
|
|
6563
|
-
inputType: true,
|
|
6564
|
-
disableText: 'disabled',
|
|
6565
|
-
validation: validation,
|
|
6566
|
-
isAccessDelegation: true
|
|
6567
|
-
})) : /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6568
|
-
container: true,
|
|
6569
|
-
className: styles.accessDelegationContainer
|
|
6570
|
-
}, /*#__PURE__*/React.createElement(IUIBox, {
|
|
6571
|
-
className: styles.emptyFieldContainer
|
|
6572
|
-
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
6573
|
-
className: styles.emptyFieldDescription
|
|
6574
|
-
}, "No Delegates added."), !isProfile && /*#__PURE__*/React.createElement(IUIBox, {
|
|
6575
|
-
className: styles.emptyFieldBtnContainer
|
|
6576
|
-
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
6577
|
-
buttonText: "Add delegate",
|
|
6578
|
-
type: "text",
|
|
6579
|
-
startIcon: /*#__PURE__*/React.createElement(AddIcon, {
|
|
6580
|
-
width: "10",
|
|
6581
|
-
height: "10",
|
|
6582
|
-
color: "#EC5D25"
|
|
6583
|
-
}),
|
|
6584
|
-
className: styles.paddingTop,
|
|
6585
|
-
onClick: function onClick() {
|
|
6586
|
-
return setIsDelegatesPresent(function (prev) {
|
|
6587
|
-
return !prev;
|
|
6588
|
-
});
|
|
6589
|
-
}
|
|
6590
|
-
})))))), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
6591
|
-
className: styles.dividerColor
|
|
6592
|
-
}), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6593
|
-
container: true,
|
|
6594
|
-
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
6595
|
-
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6596
|
-
item: true,
|
|
6597
|
-
sm: 12,
|
|
6598
|
-
md: 4
|
|
6599
6938
|
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
6600
6939
|
label: "Product access",
|
|
6601
6940
|
description: isProfile ? '' : 'Select at least one product',
|
|
@@ -6612,6 +6951,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6612
6951
|
className: styles.productContainerGap
|
|
6613
6952
|
}, renderFields.products.map(function (p, i) {
|
|
6614
6953
|
p.readOnly = isProfile;
|
|
6954
|
+
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6955
|
+
p.readOnly = true;
|
|
6956
|
+
p.disableText = "Only card admin can change this access.";
|
|
6957
|
+
}
|
|
6615
6958
|
return /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6616
6959
|
item: true,
|
|
6617
6960
|
sm: 12,
|
|
@@ -6704,6 +7047,21 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6704
7047
|
isProfile: isProfile,
|
|
6705
7048
|
editUserId: editUserId,
|
|
6706
7049
|
roles: renderFields.expenseRoles
|
|
7050
|
+
}), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
7051
|
+
className: styles.dividerColor
|
|
7052
|
+
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React.createElement(CardsField, {
|
|
7053
|
+
cardsConstants: cardsDetails.cardsConstants,
|
|
7054
|
+
type: "card",
|
|
7055
|
+
isProfile: isProfile,
|
|
7056
|
+
onRoleChange: function onRoleChange(_ref7) {
|
|
7057
|
+
var _value = _ref7._value;
|
|
7058
|
+
return setCardsRole(_value);
|
|
7059
|
+
},
|
|
7060
|
+
roleValue: cardsRole,
|
|
7061
|
+
roles: cardsDetails.cardsRoles,
|
|
7062
|
+
cardsAdmin: isCardsAdmin,
|
|
7063
|
+
editUserId: editUserId,
|
|
7064
|
+
loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
|
|
6707
7065
|
}))) : /*#__PURE__*/React.createElement(VerificationError, {
|
|
6708
7066
|
config: config,
|
|
6709
7067
|
errMsg: hasVerificationError
|
|
@@ -8512,7 +8870,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8512
8870
|
cell: function cell(row) {
|
|
8513
8871
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8514
8872
|
component: "div"
|
|
8515
|
-
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
8873
|
+
}, row.products.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, !row.products[0].role.toLowerCase().includes("holder") ? /*#__PURE__*/React.createElement(IUIBox, {
|
|
8516
8874
|
component: "div",
|
|
8517
8875
|
display: "flex"
|
|
8518
8876
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8525,7 +8883,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8525
8883
|
style: {
|
|
8526
8884
|
whiteSpace: 'nowrap'
|
|
8527
8885
|
}
|
|
8528
|
-
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8886
|
+
}, "\xA0" + row.products[0].role)) : "", row.products[1] && !row.products[1].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8529
8887
|
component: "div",
|
|
8530
8888
|
display: "flex"
|
|
8531
8889
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8538,7 +8896,20 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8538
8896
|
style: {
|
|
8539
8897
|
whiteSpace: 'nowrap'
|
|
8540
8898
|
}
|
|
8541
|
-
}, "\xA0" + row.products[1].role)))
|
|
8899
|
+
}, "\xA0" + row.products[1].role)), row.products[2] && !row.products[2].role.toLowerCase().includes("holder") && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8900
|
+
component: "div",
|
|
8901
|
+
display: "flex"
|
|
8902
|
+
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8903
|
+
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8904
|
+
style: {
|
|
8905
|
+
whiteSpace: 'nowrap'
|
|
8906
|
+
}
|
|
8907
|
+
}, row.products[2].name + ' / '), /*#__PURE__*/React.createElement(IUITypography, {
|
|
8908
|
+
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8909
|
+
style: {
|
|
8910
|
+
whiteSpace: 'nowrap'
|
|
8911
|
+
}
|
|
8912
|
+
}, "\xA0" + row.products[2].role))) : '');
|
|
8542
8913
|
}
|
|
8543
8914
|
}, {
|
|
8544
8915
|
id: 'status',
|