@itilite/iui-user-management 0.4.66 → 0.4.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +6 -2
- package/dist/index.js +380 -749
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +381 -750
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -35,158 +35,125 @@ function _extends() {
|
|
|
35
35
|
};
|
|
36
36
|
return _extends.apply(this, arguments);
|
|
37
37
|
}
|
|
38
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
39
|
-
if (!o) return;
|
|
40
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
41
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
42
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
43
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
44
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
45
|
-
}
|
|
46
|
-
function _arrayLikeToArray(arr, len) {
|
|
47
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
48
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
49
|
-
return arr2;
|
|
50
|
-
}
|
|
51
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
52
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
53
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
54
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
55
|
-
if (it) o = it;
|
|
56
|
-
var i = 0;
|
|
57
|
-
return function () {
|
|
58
|
-
if (i >= o.length) return {
|
|
59
|
-
done: true
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
done: false,
|
|
63
|
-
value: o[i++]
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
|
-
}
|
|
69
38
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
39
|
+
// A type of promise-like that resolves synchronously and supports only one observer
|
|
40
|
+
const _Pact = /*#__PURE__*/(function() {
|
|
41
|
+
function _Pact() {}
|
|
42
|
+
_Pact.prototype.then = function(onFulfilled, onRejected) {
|
|
43
|
+
const result = new _Pact();
|
|
44
|
+
const state = this.s;
|
|
45
|
+
if (state) {
|
|
46
|
+
const callback = state & 1 ? onFulfilled : onRejected;
|
|
47
|
+
if (callback) {
|
|
48
|
+
try {
|
|
49
|
+
_settle(result, 1, callback(this.v));
|
|
50
|
+
} catch (e) {
|
|
51
|
+
_settle(result, 2, e);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
} else {
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
this.o = function(_this) {
|
|
59
|
+
try {
|
|
60
|
+
const value = _this.v;
|
|
61
|
+
if (_this.s & 1) {
|
|
62
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
|
63
|
+
} else if (onRejected) {
|
|
64
|
+
_settle(result, 1, onRejected(value));
|
|
65
|
+
} else {
|
|
66
|
+
_settle(result, 2, value);
|
|
67
|
+
}
|
|
68
|
+
} catch (e) {
|
|
69
|
+
_settle(result, 2, e);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return result;
|
|
73
|
+
};
|
|
74
|
+
return _Pact;
|
|
75
|
+
})();
|
|
76
|
+
|
|
77
|
+
// Settles a pact synchronously
|
|
106
78
|
function _settle(pact, state, value) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
79
|
+
if (!pact.s) {
|
|
80
|
+
if (value instanceof _Pact) {
|
|
81
|
+
if (value.s) {
|
|
82
|
+
if (state & 1) {
|
|
83
|
+
state = value.s;
|
|
84
|
+
}
|
|
85
|
+
value = value.v;
|
|
86
|
+
} else {
|
|
87
|
+
value.o = _settle.bind(null, pact, state);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (value && value.then) {
|
|
92
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
pact.s = state;
|
|
96
|
+
pact.v = value;
|
|
97
|
+
const observer = pact.o;
|
|
98
|
+
if (observer) {
|
|
99
|
+
observer(pact);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
130
102
|
}
|
|
103
|
+
|
|
131
104
|
function _isSettledPact(thenable) {
|
|
132
|
-
|
|
105
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
|
133
106
|
}
|
|
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)
|
|
134
109
|
function _forTo(array, body, check) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_cycle();
|
|
161
|
-
return pact;
|
|
110
|
+
var i = -1, pact, reject;
|
|
111
|
+
function _cycle(result) {
|
|
112
|
+
try {
|
|
113
|
+
while (++i < array.length && (!check || !check())) {
|
|
114
|
+
result = body(i);
|
|
115
|
+
if (result && result.then) {
|
|
116
|
+
if (_isSettledPact(result)) {
|
|
117
|
+
result = result.v;
|
|
118
|
+
} else {
|
|
119
|
+
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (pact) {
|
|
125
|
+
_settle(pact, 1, result);
|
|
126
|
+
} else {
|
|
127
|
+
pact = result;
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
_settle(pact || (pact = new _Pact()), 2, e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
_cycle();
|
|
134
|
+
return pact;
|
|
162
135
|
}
|
|
163
|
-
|
|
164
|
-
|
|
136
|
+
|
|
137
|
+
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
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
|
|
165
142
|
function _catch(body, recover) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
143
|
+
try {
|
|
144
|
+
var result = body();
|
|
145
|
+
} catch(e) {
|
|
146
|
+
return recover(e);
|
|
147
|
+
}
|
|
148
|
+
if (result && result.then) {
|
|
149
|
+
return result.then(void 0, recover);
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
175
152
|
}
|
|
176
153
|
|
|
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"};
|
|
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","accessDelegationContainer":"_2x-2f","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"};
|
|
178
155
|
|
|
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
|
-
}
|
|
156
|
+
function r(e){var t,f,n="";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);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
190
157
|
|
|
191
158
|
var GetInputType = React__default.forwardRef(function (props, ref) {
|
|
192
159
|
var _p = props._p,
|
|
@@ -423,12 +390,6 @@ var userAddEditUrl = {
|
|
|
423
390
|
},
|
|
424
391
|
undoRejectUserVerification: function undoRejectUserVerification(userId) {
|
|
425
392
|
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";
|
|
432
393
|
}
|
|
433
394
|
};
|
|
434
395
|
var userListUrl = {
|
|
@@ -687,8 +648,7 @@ var transferRoleOptions = function transferRoleOptions(search, loadedOptions, _r
|
|
|
687
648
|
var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
688
649
|
var page = _ref5.page,
|
|
689
650
|
product = _ref5.product,
|
|
690
|
-
userId = _ref5.userId
|
|
691
|
-
placeholder = _ref5.placeholder;
|
|
651
|
+
userId = _ref5.userId;
|
|
692
652
|
try {
|
|
693
653
|
return Promise.resolve(_catch(function () {
|
|
694
654
|
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
@@ -702,13 +662,7 @@ var approversOptions = function approversOptions(search, loadedOptions, _ref5) {
|
|
|
702
662
|
data: item.approver
|
|
703
663
|
};
|
|
704
664
|
});
|
|
705
|
-
|
|
706
|
-
var placeholderLbl = {
|
|
707
|
-
value: '',
|
|
708
|
-
label: placeholder
|
|
709
|
-
};
|
|
710
|
-
mappedValue.unshift(placeholderLbl);
|
|
711
|
-
}
|
|
665
|
+
console.log("AAA", mappedValue);
|
|
712
666
|
return {
|
|
713
667
|
options: mappedValue,
|
|
714
668
|
hasMore: !!response.next,
|
|
@@ -831,7 +785,6 @@ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expi
|
|
|
831
785
|
var SHOW_LOADER = 'SHOW_LOADER';
|
|
832
786
|
var STOP_LOADER = 'STOP_LOADER';
|
|
833
787
|
var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
|
|
834
|
-
var SET_CARDS_DETAILS = 'SET_CARDS_DETAILS';
|
|
835
788
|
var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
|
|
836
789
|
var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
|
|
837
790
|
var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
|
|
@@ -876,15 +829,9 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
|
876
829
|
if (payload.productAccess.expense) {
|
|
877
830
|
product.expense = payload.expenseRole || null;
|
|
878
831
|
}
|
|
879
|
-
if (payload.productAccess.card) {
|
|
880
|
-
var splitRole = payload.cardsRole.split(":");
|
|
881
|
-
var cardsUsmRole = splitRole[2];
|
|
882
|
-
product.card = cardsUsmRole || null;
|
|
883
|
-
}
|
|
884
832
|
return product;
|
|
885
833
|
}(),
|
|
886
|
-
approvers: {}
|
|
887
|
-
requested_user_is_admin: payload.isCardsAdmin
|
|
834
|
+
approvers: {}
|
|
888
835
|
};
|
|
889
836
|
var userTags = [];
|
|
890
837
|
for (var key in payload.userTagType) {
|
|
@@ -976,20 +923,13 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
976
923
|
var res = {
|
|
977
924
|
fields: {
|
|
978
925
|
user_personal_info: {},
|
|
979
|
-
employee_info: {}
|
|
980
|
-
requested_user_is_admin: payload.isCardsAdmin
|
|
926
|
+
employee_info: {}
|
|
981
927
|
}
|
|
982
928
|
};
|
|
983
929
|
if (!env$1.isProfilePage()) {
|
|
984
930
|
res.fields.product = function () {
|
|
985
|
-
if (payload.productAccess.travel && payload.productAccess.expense
|
|
986
|
-
return 'expense+travel+card';
|
|
987
|
-
} else if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
931
|
+
if (payload.productAccess.travel && payload.productAccess.expense) {
|
|
988
932
|
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';
|
|
993
933
|
} else if (payload.productAccess.travel) {
|
|
994
934
|
return 'travel';
|
|
995
935
|
} else {
|
|
@@ -1004,11 +944,6 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1004
944
|
if (payload.productAccess.expense) {
|
|
1005
945
|
roles.expense = payload.expenseRole;
|
|
1006
946
|
}
|
|
1007
|
-
if (payload.productAccess.card) {
|
|
1008
|
-
var splitRole = payload.cardsRole.split(":");
|
|
1009
|
-
var cardsUsmRole = splitRole[2];
|
|
1010
|
-
roles.card = cardsUsmRole;
|
|
1011
|
-
}
|
|
1012
947
|
return roles;
|
|
1013
948
|
}();
|
|
1014
949
|
res.fields.custom_attributes = payload.customFieldsInput;
|
|
@@ -1347,12 +1282,6 @@ var setRenderFields = function setRenderFields(payload) {
|
|
|
1347
1282
|
payload: payload
|
|
1348
1283
|
};
|
|
1349
1284
|
};
|
|
1350
|
-
var setCardsDetails = function setCardsDetails(payload) {
|
|
1351
|
-
return {
|
|
1352
|
-
type: SET_CARDS_DETAILS,
|
|
1353
|
-
payload: payload
|
|
1354
|
-
};
|
|
1355
|
-
};
|
|
1356
1285
|
var setCustomField = function setCustomField(payload) {
|
|
1357
1286
|
return {
|
|
1358
1287
|
type: SET_CUSTOM_FIELD,
|
|
@@ -3255,12 +3184,6 @@ var products = [{
|
|
|
3255
3184
|
name: 'expense',
|
|
3256
3185
|
type: 'checkbox',
|
|
3257
3186
|
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.'
|
|
3264
3187
|
}];
|
|
3265
3188
|
var dropdownList = {
|
|
3266
3189
|
gender: [{
|
|
@@ -3431,34 +3354,6 @@ var expenseConstants = {
|
|
|
3431
3354
|
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3432
3355
|
}]
|
|
3433
3356
|
};
|
|
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
|
-
};
|
|
3462
3357
|
var passportInfo = [{
|
|
3463
3358
|
id: 1,
|
|
3464
3359
|
label: 'Passport issuing country',
|
|
@@ -3688,12 +3583,6 @@ var initialState = {
|
|
|
3688
3583
|
travelConstants: travelConstants,
|
|
3689
3584
|
expenseConstants: expenseConstants
|
|
3690
3585
|
},
|
|
3691
|
-
isCardsDetailsRendered: false,
|
|
3692
|
-
isCardsAdmin: false,
|
|
3693
|
-
cardsDetails: {
|
|
3694
|
-
cardsRoles: cardsConstants.roles,
|
|
3695
|
-
cardsConstants: cardsConstants
|
|
3696
|
-
},
|
|
3697
3586
|
dropdownList: dropdownList,
|
|
3698
3587
|
maxTravelApprovers: 10,
|
|
3699
3588
|
maxExpenseApprovers: 10,
|
|
@@ -3860,37 +3749,11 @@ var reducer = function reducer(state, action) {
|
|
|
3860
3749
|
isRendered: true
|
|
3861
3750
|
});
|
|
3862
3751
|
}
|
|
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
|
-
}
|
|
3889
3752
|
case SET_STATIC_FIELDS_VISIBILITY:
|
|
3890
3753
|
{
|
|
3891
3754
|
var _personalInfo = state.renderFields.personalInfo.map(function (input) {
|
|
3892
|
-
var _action$
|
|
3893
|
-
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$
|
|
3755
|
+
var _action$payload8;
|
|
3756
|
+
if (action !== null && action !== void 0 && action.payload && Object.hasOwnProperty.call(action.payload, input.name) && action !== null && action !== void 0 && (_action$payload8 = action.payload) !== null && _action$payload8 !== void 0 && _action$payload8[input.name]) {
|
|
3894
3757
|
if (Object.hasOwnProperty.call(action.payload[input.name], 'readOnly')) {
|
|
3895
3758
|
input.readOnly = action.payload[input.name].readOnly;
|
|
3896
3759
|
}
|
|
@@ -4943,9 +4806,7 @@ var ErrorMessages = {
|
|
|
4943
4806
|
passport_expiry_date: 'Please enter passport expiry date.',
|
|
4944
4807
|
passport_photo: 'Please attach passport photo.',
|
|
4945
4808
|
travel_docs: 'Please attach travel docs.',
|
|
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.'
|
|
4809
|
+
products: 'Please select atleast one product access.'
|
|
4949
4810
|
};
|
|
4950
4811
|
|
|
4951
4812
|
function AddPanelDialog(_ref) {
|
|
@@ -4995,72 +4856,7 @@ function AddPanelDialog(_ref) {
|
|
|
4995
4856
|
})));
|
|
4996
4857
|
}
|
|
4997
4858
|
|
|
4998
|
-
var
|
|
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
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5012
|
-
container: true,
|
|
5013
|
-
className: (styles.headingPadding)
|
|
5014
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5015
|
-
variant: "h3",
|
|
5016
|
-
className: clsx(styles.heading, styles.headingMedium)
|
|
5017
|
-
}, cardsConstants.heading)), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
5018
|
-
className: styles.dividerColor
|
|
5019
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5020
|
-
container: true,
|
|
5021
|
-
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5022
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5023
|
-
item: true,
|
|
5024
|
-
sm: 12,
|
|
5025
|
-
md: 4
|
|
5026
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
5027
|
-
label: cardsConstants.roleHeading,
|
|
5028
|
-
headerType: true,
|
|
5029
|
-
description: cardsConstants.roleDescription
|
|
5030
|
-
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5031
|
-
item: true,
|
|
5032
|
-
sm: 12,
|
|
5033
|
-
md: 8,
|
|
5034
|
-
lg: 8,
|
|
5035
|
-
xl: 6
|
|
5036
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5037
|
-
container: true,
|
|
5038
|
-
className: styles.formFieldsWrapper
|
|
5039
|
-
}, isProfile ? /*#__PURE__*/React__default.createElement(UserRole, {
|
|
5040
|
-
list: roles,
|
|
5041
|
-
value: roleValue
|
|
5042
|
-
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIRadio, {
|
|
5043
|
-
list: roles,
|
|
5044
|
-
value: roleValue,
|
|
5045
|
-
onValueChange: onRoleChange,
|
|
5046
|
-
disabled: cardsAdmin ? false : true
|
|
5047
|
-
})), !cardsAdmin && !isProfile && /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5048
|
-
item: true,
|
|
5049
|
-
sm: 12,
|
|
5050
|
-
md: 12,
|
|
5051
|
-
lg: 12,
|
|
5052
|
-
style: {
|
|
5053
|
-
marginTop: "24px"
|
|
5054
|
-
}
|
|
5055
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5056
|
-
variant: "body2",
|
|
5057
|
-
component: "span",
|
|
5058
|
-
className: styles.errorTextCls
|
|
5059
|
-
}, 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.")))));
|
|
5060
|
-
};
|
|
5061
|
-
|
|
5062
|
-
var IUIToastMessageService$4 = utils.services.IUIToastMessageService,
|
|
5063
|
-
IUILocalStorageService$5 = utils.services.IUILocalStorageService;
|
|
4859
|
+
var IUIToastMessageService$4 = utils.services.IUIToastMessageService;
|
|
5064
4860
|
var env$4 = utils.configs.env;
|
|
5065
4861
|
var UserAddEdit = function UserAddEdit(props) {
|
|
5066
4862
|
var isEditMode = props.isEditMode,
|
|
@@ -5068,8 +4864,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5068
4864
|
config = props.config,
|
|
5069
4865
|
_props$isProfile = props.isProfile,
|
|
5070
4866
|
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5071
|
-
console.log("isProfile", isProfile);
|
|
5072
|
-
console.log("isEditMode", isEditMode);
|
|
5073
4867
|
env$4.init(config, isProfile);
|
|
5074
4868
|
var queryParams = new URLSearchParams(window.location.search);
|
|
5075
4869
|
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
@@ -5089,10 +4883,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5089
4883
|
isRendered = _useSelector.isRendered,
|
|
5090
4884
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
5091
4885
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
5092
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5093
|
-
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5094
|
-
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5095
|
-
cardsDetails = _useSelector.cardsDetails;
|
|
4886
|
+
maxMembershipInput = _useSelector.maxMembershipInput;
|
|
5096
4887
|
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
5097
4888
|
return state.common;
|
|
5098
4889
|
}),
|
|
@@ -5105,8 +4896,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5105
4896
|
var location = reactRouterDom.useLocation();
|
|
5106
4897
|
var _useState = React.useState({
|
|
5107
4898
|
travel: false,
|
|
5108
|
-
expense: false
|
|
5109
|
-
card: false
|
|
4899
|
+
expense: false
|
|
5110
4900
|
}),
|
|
5111
4901
|
productAccess = _useState[0],
|
|
5112
4902
|
setProductAccess = _useState[1];
|
|
@@ -5117,13 +4907,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5117
4907
|
errorMsgs.products = '';
|
|
5118
4908
|
var _productAccess = _extends({}, productAccess);
|
|
5119
4909
|
_productAccess[value] = !_productAccess[value];
|
|
5120
|
-
if (_productAccess.travel === false && _productAccess.expense === false
|
|
4910
|
+
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5121
4911
|
var _errorArray = [].concat(errorArray);
|
|
5122
4912
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
5123
4913
|
if (_errorArray.indexOf('products') === -1) {
|
|
5124
4914
|
_errorArray.push('products');
|
|
5125
4915
|
}
|
|
5126
|
-
_errorMsgs.products = ErrorMessages.
|
|
4916
|
+
_errorMsgs.products = ErrorMessages.products;
|
|
5127
4917
|
setErrorArray(_errorArray);
|
|
5128
4918
|
setErrorMsgs(_errorMsgs);
|
|
5129
4919
|
var el = document.getElementById('products');
|
|
@@ -5133,22 +4923,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5133
4923
|
block: 'center'
|
|
5134
4924
|
});
|
|
5135
4925
|
}
|
|
5136
|
-
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.card === false) {
|
|
5137
|
-
var _errorArray2 = [].concat(errorArray);
|
|
5138
|
-
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5139
|
-
if (_errorArray2.indexOf('products') === -1) {
|
|
5140
|
-
_errorArray2.push('products');
|
|
5141
|
-
}
|
|
5142
|
-
_errorMsgs2.products = ErrorMessages.products;
|
|
5143
|
-
setErrorArray(_errorArray2);
|
|
5144
|
-
setErrorMsgs(_errorMsgs2);
|
|
5145
|
-
var _el = document.getElementById('products');
|
|
5146
|
-
if (_el) {
|
|
5147
|
-
_el.scrollIntoView({
|
|
5148
|
-
behavior: 'smooth',
|
|
5149
|
-
block: 'center'
|
|
5150
|
-
});
|
|
5151
|
-
}
|
|
5152
4926
|
} else {
|
|
5153
4927
|
setErrorArray(errorArray);
|
|
5154
4928
|
setErrorMsgs(errorMsgs);
|
|
@@ -5164,155 +4938,18 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5164
4938
|
var _useState4 = React.useState([]),
|
|
5165
4939
|
countryContactCode = _useState4[0],
|
|
5166
4940
|
setCountryContactCode = _useState4[1];
|
|
5167
|
-
var
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
if (typeof err === 'object') {
|
|
5180
|
-
if (err.country_code) {
|
|
5181
|
-
err.contact_number = err.country_code;
|
|
5182
|
-
}
|
|
5183
|
-
if (err.contact_country_code) {
|
|
5184
|
-
err.contact_number = err.contact_country_code;
|
|
5185
|
-
}
|
|
5186
|
-
if (err.passport) {
|
|
5187
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5188
|
-
delete err.passport;
|
|
5189
|
-
}
|
|
5190
|
-
setErrorArray(Object.keys(err));
|
|
5191
|
-
setErrorMsgs(err);
|
|
5192
|
-
var _loop = function _loop() {
|
|
5193
|
-
if (Object.hasOwnProperty.call(err, key)) {
|
|
5194
|
-
if (err[key]) {
|
|
5195
|
-
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5196
|
-
setAdditionalInfoFlag('open');
|
|
5197
|
-
}
|
|
5198
|
-
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5199
|
-
if (el) {
|
|
5200
|
-
setTimeout(function () {
|
|
5201
|
-
el.scrollIntoView({
|
|
5202
|
-
behavior: 'smooth',
|
|
5203
|
-
block: 'center'
|
|
5204
|
-
});
|
|
5205
|
-
}, 500);
|
|
5206
|
-
return 1;
|
|
5207
|
-
}
|
|
5208
|
-
}
|
|
5209
|
-
}
|
|
5210
|
-
};
|
|
5211
|
-
for (var key in err) {
|
|
5212
|
-
if (_loop()) break;
|
|
5213
|
-
}
|
|
5214
|
-
} else if (typeof err === 'string') {
|
|
5215
|
-
IUIToastMessageService$4.warningNotify(err);
|
|
5216
|
-
} else {
|
|
5217
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5218
|
-
}
|
|
5219
|
-
})["finally"](function () {
|
|
5220
|
-
dispatch(stopLoader());
|
|
5221
|
-
});
|
|
5222
|
-
};
|
|
5223
|
-
var createUserApiCall = function createUserApiCall(payload) {
|
|
5224
|
-
dispatch(createUser(payload)).then(function (res) {
|
|
5225
|
-
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5226
|
-
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) {
|
|
5227
|
-
history.push({
|
|
5228
|
-
pathname: config.routes.users.list.path
|
|
5229
|
-
});
|
|
5230
|
-
}
|
|
5231
|
-
})["catch"](function (err) {
|
|
5232
|
-
if (typeof err === 'object') {
|
|
5233
|
-
if (err.country_code) {
|
|
5234
|
-
err.contact_number = err.country_code;
|
|
5235
|
-
}
|
|
5236
|
-
if (err.contact_country_code) {
|
|
5237
|
-
err.contact_number = err.contact_country_code;
|
|
5238
|
-
}
|
|
5239
|
-
if (err.passport) {
|
|
5240
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5241
|
-
delete err.passport;
|
|
5242
|
-
}
|
|
5243
|
-
setErrorArray(Object.keys(err));
|
|
5244
|
-
setErrorMsgs(err);
|
|
5245
|
-
var _loop2 = function _loop2() {
|
|
5246
|
-
if (Object.hasOwnProperty.call(err, key)) {
|
|
5247
|
-
if (err[key]) {
|
|
5248
|
-
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5249
|
-
setAdditionalInfoFlag('open');
|
|
5250
|
-
}
|
|
5251
|
-
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5252
|
-
if (el) {
|
|
5253
|
-
setTimeout(function () {
|
|
5254
|
-
el.scrollIntoView({
|
|
5255
|
-
behavior: 'smooth',
|
|
5256
|
-
block: 'center'
|
|
5257
|
-
});
|
|
5258
|
-
}, 500);
|
|
5259
|
-
return 1;
|
|
5260
|
-
}
|
|
5261
|
-
}
|
|
5262
|
-
}
|
|
5263
|
-
};
|
|
5264
|
-
for (var key in err) {
|
|
5265
|
-
if (_loop2()) break;
|
|
5266
|
-
}
|
|
5267
|
-
} else if (typeof err === 'string') {
|
|
5268
|
-
IUIToastMessageService$4.warningNotify(err);
|
|
5269
|
-
} else {
|
|
5270
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5271
|
-
}
|
|
5272
|
-
})["finally"](function () {
|
|
5273
|
-
dispatch(stopLoader());
|
|
5274
|
-
});
|
|
5275
|
-
};
|
|
5276
|
-
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5277
|
-
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5278
|
-
method: 'GET',
|
|
5279
|
-
headers: {
|
|
5280
|
-
'Content-Type': 'application/json',
|
|
5281
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5282
|
-
}
|
|
5283
|
-
}).then(function (response) {
|
|
5284
|
-
return response.json();
|
|
5285
|
-
}).then(function (res) {
|
|
5286
|
-
var _res$roles;
|
|
5287
|
-
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5288
|
-
dispatch(setCardsDetails(res));
|
|
5289
|
-
} else {
|
|
5290
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5291
|
-
}
|
|
5292
|
-
})["catch"](function (error) {
|
|
5293
|
-
console.log("errorrr", error);
|
|
5294
|
-
});
|
|
5295
|
-
};
|
|
5296
|
-
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5297
|
-
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5298
|
-
method: 'GET',
|
|
5299
|
-
headers: {
|
|
5300
|
-
'Content-Type': 'application/json',
|
|
5301
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5302
|
-
}
|
|
5303
|
-
}).then(function (response) {
|
|
5304
|
-
return response.json();
|
|
5305
|
-
}).then(function (res) {
|
|
5306
|
-
var _res$roles2;
|
|
5307
|
-
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5308
|
-
dispatch(setCardsDetails(res));
|
|
5309
|
-
} else {
|
|
5310
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5311
|
-
}
|
|
5312
|
-
})["catch"](function (error) {
|
|
5313
|
-
console.log("errorrr", error);
|
|
5314
|
-
});
|
|
5315
|
-
};
|
|
4941
|
+
var _useState5 = React.useState({
|
|
4942
|
+
errorMsg: '',
|
|
4943
|
+
errorIds: [],
|
|
4944
|
+
countryIds: {},
|
|
4945
|
+
cityIds: {},
|
|
4946
|
+
regionIds: {},
|
|
4947
|
+
searchText: ''
|
|
4948
|
+
}),
|
|
4949
|
+
validation = _useState5[0];
|
|
4950
|
+
var _useState6 = React.useState(false),
|
|
4951
|
+
isDelegatesPresent = _useState6[0],
|
|
4952
|
+
setIsDelegatesPresent = _useState6[1];
|
|
5316
4953
|
React.useEffect(function () {
|
|
5317
4954
|
var countryObject = countryContactCode.find(function (t) {
|
|
5318
4955
|
return t.dial_code === countryDialCode;
|
|
@@ -5328,7 +4965,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5328
4965
|
var convertedNumber = parseInt(extractedNumber);
|
|
5329
4966
|
setCountryDialCode(convertedNumber);
|
|
5330
4967
|
}, [newCountryCode]);
|
|
5331
|
-
var
|
|
4968
|
+
var _useState7 = React.useState({
|
|
5332
4969
|
first_name: '',
|
|
5333
4970
|
last_name: '',
|
|
5334
4971
|
email: '',
|
|
@@ -5339,9 +4976,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5339
4976
|
contact_country_code: '',
|
|
5340
4977
|
profile_pic: []
|
|
5341
4978
|
}),
|
|
5342
|
-
personalInfoInput =
|
|
5343
|
-
setPersonalInfoInput =
|
|
5344
|
-
var
|
|
4979
|
+
personalInfoInput = _useState7[0],
|
|
4980
|
+
setPersonalInfoInput = _useState7[1];
|
|
4981
|
+
var _useState8 = React.useState({
|
|
5345
4982
|
emp_level: {
|
|
5346
4983
|
value: '',
|
|
5347
4984
|
label: 'Select employee level'
|
|
@@ -5374,9 +5011,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5374
5011
|
label: defaultCurrency
|
|
5375
5012
|
}
|
|
5376
5013
|
}),
|
|
5377
|
-
employeeInfoInput =
|
|
5378
|
-
setEmployeeInfoInput =
|
|
5379
|
-
var
|
|
5014
|
+
employeeInfoInput = _useState8[0],
|
|
5015
|
+
setEmployeeInfoInput = _useState8[1];
|
|
5016
|
+
var _useState9 = React.useState({
|
|
5380
5017
|
emp_level: 0,
|
|
5381
5018
|
entity: 0,
|
|
5382
5019
|
business_unit: 0,
|
|
@@ -5385,48 +5022,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5385
5022
|
manager_id: 0,
|
|
5386
5023
|
skip_manager_id: 0
|
|
5387
5024
|
}),
|
|
5388
|
-
cacheForAsyncDropdown =
|
|
5389
|
-
clearCacheForAsyncDropdown =
|
|
5390
|
-
var _useState8 = React.useState({}),
|
|
5391
|
-
userTagType = _useState8[0],
|
|
5392
|
-
setUserTagType = _useState8[1];
|
|
5393
|
-
var _useState9 = React.useState(false),
|
|
5394
|
-
scroll = _useState9[0],
|
|
5395
|
-
setScroll = _useState9[1];
|
|
5025
|
+
cacheForAsyncDropdown = _useState9[0],
|
|
5026
|
+
clearCacheForAsyncDropdown = _useState9[1];
|
|
5396
5027
|
var _useState10 = React.useState({}),
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
var _useState11 = React.useState(
|
|
5400
|
-
|
|
5401
|
-
|
|
5028
|
+
userTagType = _useState10[0],
|
|
5029
|
+
setUserTagType = _useState10[1];
|
|
5030
|
+
var _useState11 = React.useState(false),
|
|
5031
|
+
scroll = _useState11[0],
|
|
5032
|
+
setScroll = _useState11[1];
|
|
5402
5033
|
var _useState12 = React.useState({}),
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
var _useState13 = React.useState(
|
|
5034
|
+
customFieldsInput = _useState12[0],
|
|
5035
|
+
setCustomFieldsInput = _useState12[1];
|
|
5036
|
+
var _useState13 = React.useState('traveler'),
|
|
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({
|
|
5406
5043
|
value: '',
|
|
5407
5044
|
label: 'Select approver'
|
|
5408
5045
|
}),
|
|
5409
|
-
travelFYI =
|
|
5410
|
-
setTravelFYI =
|
|
5411
|
-
var
|
|
5412
|
-
membershipInfoInput =
|
|
5413
|
-
setMembershipInfoInput =
|
|
5414
|
-
var
|
|
5415
|
-
removedMembershipInfoInput =
|
|
5416
|
-
setRemovedMembershipInfoInput =
|
|
5417
|
-
var
|
|
5046
|
+
travelFYI = _useState15[0],
|
|
5047
|
+
setTravelFYI = _useState15[1];
|
|
5048
|
+
var _useState16 = React.useState([]),
|
|
5049
|
+
membershipInfoInput = _useState16[0],
|
|
5050
|
+
setMembershipInfoInput = _useState16[1];
|
|
5051
|
+
var _useState17 = React.useState([]),
|
|
5052
|
+
removedMembershipInfoInput = _useState17[0],
|
|
5053
|
+
setRemovedMembershipInfoInput = _useState17[1];
|
|
5054
|
+
var _useState18 = React.useState({
|
|
5418
5055
|
flight_seat_preference: '',
|
|
5419
5056
|
meal_preference: ''
|
|
5420
5057
|
}),
|
|
5421
|
-
travelPreferenceInfo =
|
|
5422
|
-
settravelPreferenceInfo =
|
|
5423
|
-
var
|
|
5058
|
+
travelPreferenceInfo = _useState18[0],
|
|
5059
|
+
settravelPreferenceInfo = _useState18[1];
|
|
5060
|
+
var _useState19 = React.useState({
|
|
5424
5061
|
trusted_traveller: '',
|
|
5425
5062
|
redress_number: ''
|
|
5426
5063
|
}),
|
|
5427
|
-
secureTravelInputInfo =
|
|
5428
|
-
setSecureTravelInputInfo =
|
|
5429
|
-
var
|
|
5064
|
+
secureTravelInputInfo = _useState19[0],
|
|
5065
|
+
setSecureTravelInputInfo = _useState19[1];
|
|
5066
|
+
var _useState20 = React.useState({
|
|
5430
5067
|
passport_issue_country: {
|
|
5431
5068
|
value: '',
|
|
5432
5069
|
label: 'Select country'
|
|
@@ -5441,77 +5078,39 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5441
5078
|
passport_photo: [],
|
|
5442
5079
|
travel_docs: []
|
|
5443
5080
|
}),
|
|
5444
|
-
passportInfoInput =
|
|
5445
|
-
setPassportInfoInput =
|
|
5446
|
-
var
|
|
5447
|
-
filesForDelete =
|
|
5448
|
-
setFilesForDelete =
|
|
5449
|
-
var
|
|
5450
|
-
profilePicDelete =
|
|
5451
|
-
setProfilePicDelete =
|
|
5452
|
-
var
|
|
5453
|
-
isAdditionalInfoExpanded =
|
|
5454
|
-
setAdditionalInfoFlag =
|
|
5455
|
-
var
|
|
5456
|
-
expenseRole =
|
|
5457
|
-
setExpenseRole =
|
|
5458
|
-
var
|
|
5459
|
-
expenseApproversInput =
|
|
5460
|
-
setExpenseApproversInput =
|
|
5461
|
-
var
|
|
5081
|
+
passportInfoInput = _useState20[0],
|
|
5082
|
+
setPassportInfoInput = _useState20[1];
|
|
5083
|
+
var _useState21 = React.useState([]),
|
|
5084
|
+
filesForDelete = _useState21[0],
|
|
5085
|
+
setFilesForDelete = _useState21[1];
|
|
5086
|
+
var _useState22 = React.useState([]),
|
|
5087
|
+
profilePicDelete = _useState22[0],
|
|
5088
|
+
setProfilePicDelete = _useState22[1];
|
|
5089
|
+
var _useState23 = React.useState(config.env.isTravelProduct && isProfile ? 'open' : ''),
|
|
5090
|
+
isAdditionalInfoExpanded = _useState23[0],
|
|
5091
|
+
setAdditionalInfoFlag = _useState23[1];
|
|
5092
|
+
var _useState24 = React.useState('submitter'),
|
|
5093
|
+
expenseRole = _useState24[0],
|
|
5094
|
+
setExpenseRole = _useState24[1];
|
|
5095
|
+
var _useState25 = React.useState({}),
|
|
5096
|
+
expenseApproversInput = _useState25[0],
|
|
5097
|
+
setExpenseApproversInput = _useState25[1];
|
|
5098
|
+
var _useState26 = React.useState({
|
|
5462
5099
|
value: '',
|
|
5463
5100
|
label: 'Select approver'
|
|
5464
5101
|
}),
|
|
5465
|
-
expenseFYI =
|
|
5466
|
-
setExpenseFYI =
|
|
5467
|
-
var _useState25 = React.useState(''),
|
|
5468
|
-
cardsRole = _useState25[0],
|
|
5469
|
-
setCardsRole = _useState25[1];
|
|
5470
|
-
console.log("cardsRole123", cardsRole);
|
|
5471
|
-
React.useEffect(function () {
|
|
5472
|
-
if (productAccess.card === false) {
|
|
5473
|
-
setCardsRole('');
|
|
5474
|
-
}
|
|
5475
|
-
}, [productAccess.card]);
|
|
5476
|
-
React.useEffect(function () {
|
|
5477
|
-
if (isCardsDetailsRendered && !isProfile && productAccess.card) {
|
|
5478
|
-
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5479
|
-
return role.isAssigned;
|
|
5480
|
-
});
|
|
5481
|
-
if (selectedRole) {
|
|
5482
|
-
setCardsRole(selectedRole.value);
|
|
5483
|
-
} else {
|
|
5484
|
-
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5485
|
-
var splitRoleVal = role.value.split(":");
|
|
5486
|
-
return splitRoleVal[2] === 'card-holder';
|
|
5487
|
-
});
|
|
5488
|
-
if (defaultRole) {
|
|
5489
|
-
setCardsRole(defaultRole.value);
|
|
5490
|
-
}
|
|
5491
|
-
}
|
|
5492
|
-
} else if (isCardsDetailsRendered && isProfile && productAccess.card) {
|
|
5493
|
-
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5494
|
-
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5495
|
-
var role = _step.value;
|
|
5496
|
-
var splitRoleVal = role.value.split(":");
|
|
5497
|
-
var profileRole = splitRoleVal[2];
|
|
5498
|
-
if (profileRole === targetRole) {
|
|
5499
|
-
setCardsRole(role.value);
|
|
5500
|
-
break;
|
|
5501
|
-
}
|
|
5502
|
-
}
|
|
5503
|
-
}
|
|
5504
|
-
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.card, isCardsAdmin]);
|
|
5102
|
+
expenseFYI = _useState26[0],
|
|
5103
|
+
setExpenseFYI = _useState26[1];
|
|
5505
5104
|
var asyncSelectRefs = React.useRef({
|
|
5506
5105
|
emp_level: React.useRef(null),
|
|
5507
5106
|
entity: React.useRef(null),
|
|
5508
5107
|
business_unit: React.useRef(null),
|
|
5509
5108
|
department: React.useRef(null)
|
|
5510
5109
|
});
|
|
5511
|
-
var
|
|
5512
|
-
errorArray =
|
|
5513
|
-
setErrorArray =
|
|
5514
|
-
var
|
|
5110
|
+
var _useState27 = React.useState([]),
|
|
5111
|
+
errorArray = _useState27[0],
|
|
5112
|
+
setErrorArray = _useState27[1];
|
|
5113
|
+
var _useState28 = React.useState({
|
|
5515
5114
|
first_name: '',
|
|
5516
5115
|
last_name: '',
|
|
5517
5116
|
email: '',
|
|
@@ -5541,9 +5140,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5541
5140
|
userTagType: '',
|
|
5542
5141
|
profile_pic: ''
|
|
5543
5142
|
}),
|
|
5544
|
-
errorMsgs =
|
|
5545
|
-
setErrorMsgs =
|
|
5546
|
-
var
|
|
5143
|
+
errorMsgs = _useState28[0],
|
|
5144
|
+
setErrorMsgs = _useState28[1];
|
|
5145
|
+
var _useState29 = React.useState({
|
|
5547
5146
|
first_name: false,
|
|
5548
5147
|
last_name: false,
|
|
5549
5148
|
email: false,
|
|
@@ -5570,14 +5169,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5570
5169
|
userTagType: false,
|
|
5571
5170
|
profile_pic: false
|
|
5572
5171
|
}),
|
|
5573
|
-
inputChangeLog =
|
|
5574
|
-
updateInputChangeLog =
|
|
5575
|
-
var
|
|
5576
|
-
uploadedFiles =
|
|
5577
|
-
setUploadedFiles =
|
|
5578
|
-
var
|
|
5579
|
-
maxLengthForModal =
|
|
5580
|
-
setMaxLengthForModal =
|
|
5172
|
+
inputChangeLog = _useState29[0],
|
|
5173
|
+
updateInputChangeLog = _useState29[1];
|
|
5174
|
+
var _useState30 = React.useState([]),
|
|
5175
|
+
uploadedFiles = _useState30[0],
|
|
5176
|
+
setUploadedFiles = _useState30[1];
|
|
5177
|
+
var _useState31 = React.useState(70),
|
|
5178
|
+
maxLengthForModal = _useState31[0],
|
|
5179
|
+
setMaxLengthForModal = _useState31[1];
|
|
5581
5180
|
var defaultAddModalData = {
|
|
5582
5181
|
isOpen: false,
|
|
5583
5182
|
isError: false,
|
|
@@ -5593,9 +5192,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5593
5192
|
maxLength: maxLengthForModal,
|
|
5594
5193
|
minLength: 0
|
|
5595
5194
|
};
|
|
5596
|
-
var
|
|
5597
|
-
addModalData =
|
|
5598
|
-
setAddModalData =
|
|
5195
|
+
var _useState32 = React.useState(defaultAddModalData),
|
|
5196
|
+
addModalData = _useState32[0],
|
|
5197
|
+
setAddModalData = _useState32[1];
|
|
5599
5198
|
var onAddModalClose = function onAddModalClose() {
|
|
5600
5199
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5601
5200
|
};
|
|
@@ -6006,11 +5605,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6006
5605
|
}, [isTokenVerified]);
|
|
6007
5606
|
React.useEffect(function () {
|
|
6008
5607
|
if (isRendered === true) {
|
|
6009
|
-
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6010
|
-
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
|
|
6011
|
-
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6012
|
-
}
|
|
6013
|
-
});
|
|
6014
5608
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
6015
5609
|
country_code: countryCode
|
|
6016
5610
|
}));
|
|
@@ -6132,8 +5726,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6132
5726
|
var products = res.user_product.split('+');
|
|
6133
5727
|
setProductAccess({
|
|
6134
5728
|
travel: products.includes('travel'),
|
|
6135
|
-
expense: products.includes('expense')
|
|
6136
|
-
card: products.includes('card')
|
|
5729
|
+
expense: products.includes('expense')
|
|
6137
5730
|
});
|
|
6138
5731
|
if (products.includes('travel')) {
|
|
6139
5732
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -6350,9 +5943,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6350
5943
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
6351
5944
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
6352
5945
|
}
|
|
6353
|
-
var cardsPayload = {
|
|
6354
|
-
"roles": [cardsRole]
|
|
6355
|
-
};
|
|
6356
5946
|
var payload = {
|
|
6357
5947
|
personalInfoInput: personalInfoInput,
|
|
6358
5948
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -6371,9 +5961,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6371
5961
|
uploadedFiles: uploadedFiles,
|
|
6372
5962
|
filesForDelete: filesForDelete,
|
|
6373
5963
|
profilePicDelete: profilePicDelete,
|
|
6374
|
-
userTagType: userTagType
|
|
6375
|
-
cardsRole: cardsRole,
|
|
6376
|
-
isCardsAdmin: isCardsAdmin
|
|
5964
|
+
userTagType: userTagType
|
|
6377
5965
|
};
|
|
6378
5966
|
if (verifyUserId) {
|
|
6379
5967
|
payload.verifyUserId = verifyUserId;
|
|
@@ -6499,7 +6087,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6499
6087
|
if (_isError) {
|
|
6500
6088
|
setErrorArray(_errorArray);
|
|
6501
6089
|
setErrorMsgs(_errorMsgs);
|
|
6502
|
-
var
|
|
6090
|
+
var _loop = function _loop() {
|
|
6503
6091
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6504
6092
|
if (_errorMsgs[_key3]) {
|
|
6505
6093
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6519,109 +6107,115 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6519
6107
|
}
|
|
6520
6108
|
};
|
|
6521
6109
|
for (var _key3 in _errorMsgs) {
|
|
6522
|
-
if (
|
|
6110
|
+
if (_loop()) break;
|
|
6523
6111
|
}
|
|
6524
6112
|
}
|
|
6525
|
-
var cardApiflag = false;
|
|
6526
|
-
if (productAccess.card === false || isCardsAdmin === false) {
|
|
6527
|
-
cardApiflag = false;
|
|
6528
|
-
} else {
|
|
6529
|
-
cardApiflag = true;
|
|
6530
|
-
}
|
|
6531
6113
|
if (!_isError) {
|
|
6532
6114
|
if (isEditMode && editUserId || isProfile) {
|
|
6533
6115
|
dispatch(showLoader());
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6116
|
+
dispatch(updateUser(payload, isProfile ? id : editUserId, inputChangeLog)).then(function (res) {
|
|
6117
|
+
if (isProfile) {
|
|
6118
|
+
var _config$routes, _config$routes$profil, _config$routes$profil2;
|
|
6119
|
+
(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);
|
|
6120
|
+
} else {
|
|
6121
|
+
var _config$routes2, _config$routes2$users, _config$routes2$users2;
|
|
6122
|
+
(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);
|
|
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;
|
|
6541
6130
|
}
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
updateUserApiCall(payload, inputChangeLog);
|
|
6545
|
-
} else {
|
|
6546
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6131
|
+
if (err.contact_country_code) {
|
|
6132
|
+
err.contact_number = err.contact_country_code;
|
|
6547
6133
|
}
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6134
|
+
if (err.passport) {
|
|
6135
|
+
err.passport_photo = _extends({}, err.passport);
|
|
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;
|
|
6161
|
+
}
|
|
6162
|
+
} else if (typeof err === 'string') {
|
|
6163
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6164
|
+
} else {
|
|
6165
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6166
|
+
}
|
|
6167
|
+
})["finally"](function () {
|
|
6168
|
+
dispatch(stopLoader());
|
|
6169
|
+
});
|
|
6556
6170
|
} else {
|
|
6557
6171
|
dispatch(showLoader());
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
headers: {
|
|
6566
|
-
'Content-Type': 'application/json',
|
|
6567
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6568
|
-
}
|
|
6569
|
-
}).then(function (response) {
|
|
6570
|
-
if (response.status !== 200) {
|
|
6571
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6572
|
-
}
|
|
6573
|
-
})["catch"](function (error) {
|
|
6574
|
-
console.log("errorrr", error);
|
|
6575
|
-
});
|
|
6172
|
+
dispatch(createUser(payload)).then(function (res) {
|
|
6173
|
+
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
6174
|
+
(config === null || config === void 0 ? void 0 : (_config$routes3 = config.routes) === null || _config$routes3 === void 0 ? void 0 : (_config$routes3$users = _config$routes3.users) === null || _config$routes3$users === void 0 ? void 0 : (_config$routes3$users2 = _config$routes3$users.list) === null || _config$routes3$users2 === void 0 ? void 0 : _config$routes3$users2.path) && history.push(config.routes.users.list.path);
|
|
6175
|
+
})["catch"](function (err) {
|
|
6176
|
+
if (typeof err === 'object') {
|
|
6177
|
+
if (err.country_code) {
|
|
6178
|
+
err.contact_number = err.country_code;
|
|
6576
6179
|
}
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
el.scrollIntoView({
|
|
6602
|
-
behavior: 'smooth',
|
|
6603
|
-
block: 'center'
|
|
6604
|
-
});
|
|
6605
|
-
}, 500);
|
|
6606
|
-
return 1;
|
|
6607
|
-
}
|
|
6180
|
+
if (err.contact_country_code) {
|
|
6181
|
+
err.contact_number = err.contact_country_code;
|
|
6182
|
+
}
|
|
6183
|
+
if (err.passport) {
|
|
6184
|
+
err.passport_photo = _extends({}, err.passport);
|
|
6185
|
+
delete err.passport;
|
|
6186
|
+
}
|
|
6187
|
+
setErrorArray(Object.keys(err));
|
|
6188
|
+
setErrorMsgs(err);
|
|
6189
|
+
var _loop3 = function _loop3() {
|
|
6190
|
+
if (Object.hasOwnProperty.call(err, _key5)) {
|
|
6191
|
+
if (err[_key5]) {
|
|
6192
|
+
if (_key5 in passportInfoInput || _key5 in travelPreferenceInfo || _key5 in secureTravelInputInfo) {
|
|
6193
|
+
setAdditionalInfoFlag('open');
|
|
6194
|
+
}
|
|
6195
|
+
var el = document.getElementById(_key5 === 'country_code' || _key5 === 'contact_country_code' ? 'contact_number' : _key5);
|
|
6196
|
+
if (el) {
|
|
6197
|
+
setTimeout(function () {
|
|
6198
|
+
el.scrollIntoView({
|
|
6199
|
+
behavior: 'smooth',
|
|
6200
|
+
block: 'center'
|
|
6201
|
+
});
|
|
6202
|
+
}, 500);
|
|
6203
|
+
return 1;
|
|
6608
6204
|
}
|
|
6609
6205
|
}
|
|
6610
|
-
};
|
|
6611
|
-
for (var _key4 in err) {
|
|
6612
|
-
if (_loop4()) break;
|
|
6613
6206
|
}
|
|
6614
|
-
}
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6207
|
+
};
|
|
6208
|
+
for (var _key5 in err) {
|
|
6209
|
+
if (_loop3()) break;
|
|
6618
6210
|
}
|
|
6619
|
-
}
|
|
6620
|
-
|
|
6621
|
-
}
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
}
|
|
6211
|
+
} else if (typeof err === 'string') {
|
|
6212
|
+
IUIToastMessageService$4.warningNotify(err);
|
|
6213
|
+
} else {
|
|
6214
|
+
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6215
|
+
}
|
|
6216
|
+
})["finally"](function () {
|
|
6217
|
+
dispatch(stopLoader());
|
|
6218
|
+
});
|
|
6625
6219
|
}
|
|
6626
6220
|
}
|
|
6627
6221
|
return Promise.resolve();
|
|
@@ -6639,8 +6233,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6639
6233
|
}
|
|
6640
6234
|
}
|
|
6641
6235
|
} else {
|
|
6642
|
-
var _config$
|
|
6643
|
-
(config === null || config === void 0 ? void 0 : (_config$
|
|
6236
|
+
var _config$routes4, _config$routes4$users, _config$routes4$users2;
|
|
6237
|
+
(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);
|
|
6644
6238
|
}
|
|
6645
6239
|
};
|
|
6646
6240
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6937,6 +6531,74 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6937
6531
|
item: true,
|
|
6938
6532
|
sm: 12,
|
|
6939
6533
|
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
|
|
6940
6602
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
6941
6603
|
label: "Product access",
|
|
6942
6604
|
description: isProfile ? '' : 'Select at least one product',
|
|
@@ -6953,10 +6615,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6953
6615
|
className: styles.productContainerGap
|
|
6954
6616
|
}, renderFields.products.map(function (p, i) {
|
|
6955
6617
|
p.readOnly = isProfile;
|
|
6956
|
-
if (p.id === 3 && !isCardsAdmin && !isProfile) {
|
|
6957
|
-
p.readOnly = true;
|
|
6958
|
-
p.disableText = "Only card admin can change this access.";
|
|
6959
|
-
}
|
|
6960
6618
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6961
6619
|
item: true,
|
|
6962
6620
|
sm: 12,
|
|
@@ -7049,20 +6707,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
7049
6707
|
isProfile: isProfile,
|
|
7050
6708
|
editUserId: editUserId,
|
|
7051
6709
|
roles: renderFields.expenseRoles
|
|
7052
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
7053
|
-
className: styles.dividerColor
|
|
7054
|
-
}), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React__default.createElement(CardsField, {
|
|
7055
|
-
cardsConstants: cardsDetails.cardsConstants,
|
|
7056
|
-
type: "card",
|
|
7057
|
-
isProfile: isProfile,
|
|
7058
|
-
onRoleChange: function onRoleChange(_ref7) {
|
|
7059
|
-
var _value = _ref7._value;
|
|
7060
|
-
return setCardsRole(_value);
|
|
7061
|
-
},
|
|
7062
|
-
roleValue: cardsRole,
|
|
7063
|
-
roles: cardsDetails.cardsRoles,
|
|
7064
|
-
cardsAdmin: isCardsAdmin,
|
|
7065
|
-
editUserId: editUserId
|
|
7066
6710
|
}))) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
7067
6711
|
config: config,
|
|
7068
6712
|
errMsg: hasVerificationError
|
|
@@ -8871,7 +8515,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8871
8515
|
cell: function cell(row) {
|
|
8872
8516
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8873
8517
|
component: "div"
|
|
8874
|
-
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null,
|
|
8518
|
+
}, row.products.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8875
8519
|
component: "div",
|
|
8876
8520
|
display: "flex"
|
|
8877
8521
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8884,7 +8528,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8884
8528
|
style: {
|
|
8885
8529
|
whiteSpace: 'nowrap'
|
|
8886
8530
|
}
|
|
8887
|
-
}, "\xA0" + row.products[0].role))
|
|
8531
|
+
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8888
8532
|
component: "div",
|
|
8889
8533
|
display: "flex"
|
|
8890
8534
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8897,20 +8541,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8897
8541
|
style: {
|
|
8898
8542
|
whiteSpace: 'nowrap'
|
|
8899
8543
|
}
|
|
8900
|
-
}, "\xA0" + row.products[1].role))
|
|
8901
|
-
component: "div",
|
|
8902
|
-
display: "flex"
|
|
8903
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8904
|
-
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8905
|
-
style: {
|
|
8906
|
-
whiteSpace: 'nowrap'
|
|
8907
|
-
}
|
|
8908
|
-
}, row.products[2].name + ' / '), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8909
|
-
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8910
|
-
style: {
|
|
8911
|
-
whiteSpace: 'nowrap'
|
|
8912
|
-
}
|
|
8913
|
-
}, "\xA0" + row.products[2].role))) : '');
|
|
8544
|
+
}, "\xA0" + row.products[1].role))) : '');
|
|
8914
8545
|
}
|
|
8915
8546
|
}, {
|
|
8916
8547
|
id: 'status',
|