@itilite/iui-user-management 0.4.65 → 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 +4 -0
- package/dist/index.js +380 -746
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +381 -747
- 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.cards) {
|
|
880
|
-
var splitRole = payload.cardsRole.split(":");
|
|
881
|
-
var cardsUsmRole = splitRole[2];
|
|
882
|
-
product.cards = 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+cards';
|
|
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.cards) {
|
|
990
|
-
return 'expense+cards';
|
|
991
|
-
} else if (payload.productAccess.travel && payload.productAccess.cards) {
|
|
992
|
-
return 'travel+cards';
|
|
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.cards) {
|
|
1008
|
-
var splitRole = payload.cardsRole.split(":");
|
|
1009
|
-
var cardsUsmRole = splitRole[2];
|
|
1010
|
-
roles.cards = 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: 'Cards',
|
|
3261
|
-
name: 'cards',
|
|
3262
|
-
type: 'checkbox',
|
|
3263
|
-
disableText: 'Only Card admin can change this access.'
|
|
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 own and use card that are issued to them',
|
|
3442
|
-
value: '',
|
|
3443
|
-
name: '',
|
|
3444
|
-
type: 'radio',
|
|
3445
|
-
isAssigned: false,
|
|
3446
|
-
fullWidth: false,
|
|
3447
|
-
visibility: true,
|
|
3448
|
-
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3449
|
-
}, {
|
|
3450
|
-
id: 2,
|
|
3451
|
-
label: 'Card admin',
|
|
3452
|
-
description: 'Can issue card to others and can manage all card and transactions across the company.',
|
|
3453
|
-
value: '',
|
|
3454
|
-
name: '',
|
|
3455
|
-
type: 'radio',
|
|
3456
|
-
isAssigned: false,
|
|
3457
|
-
fullWidth: false,
|
|
3458
|
-
visibility: true,
|
|
3459
|
-
disableText: 'Please get in touch with your administrator to change this value.'
|
|
3460
|
-
}]
|
|
3461
|
-
};
|
|
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: 'Select at least one additional product if opting for card.',
|
|
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,71 +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
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5011
|
-
container: true,
|
|
5012
|
-
className: (styles.headingPadding)
|
|
5013
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5014
|
-
variant: "h3",
|
|
5015
|
-
className: clsx(styles.heading, styles.headingMedium)
|
|
5016
|
-
}, cardsConstants.heading)), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
5017
|
-
className: styles.dividerColor
|
|
5018
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5019
|
-
container: true,
|
|
5020
|
-
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5021
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5022
|
-
item: true,
|
|
5023
|
-
sm: 12,
|
|
5024
|
-
md: 4
|
|
5025
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
5026
|
-
label: cardsConstants.roleHeading,
|
|
5027
|
-
headerType: true,
|
|
5028
|
-
description: cardsConstants.roleDescription
|
|
5029
|
-
})), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5030
|
-
item: true,
|
|
5031
|
-
sm: 12,
|
|
5032
|
-
md: 8,
|
|
5033
|
-
lg: 8,
|
|
5034
|
-
xl: 6
|
|
5035
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5036
|
-
container: true,
|
|
5037
|
-
className: styles.formFieldsWrapper
|
|
5038
|
-
}, isProfile ? /*#__PURE__*/React__default.createElement(UserRole, {
|
|
5039
|
-
list: roles,
|
|
5040
|
-
value: roleValue
|
|
5041
|
-
}) : /*#__PURE__*/React__default.createElement(iuistyles.IUIRadio, {
|
|
5042
|
-
list: roles,
|
|
5043
|
-
value: roleValue,
|
|
5044
|
-
onValueChange: onRoleChange,
|
|
5045
|
-
disabled: cardsAdmin ? false : true
|
|
5046
|
-
})), !cardsAdmin && !isProfile && /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
5047
|
-
item: true,
|
|
5048
|
-
sm: 12,
|
|
5049
|
-
md: 12,
|
|
5050
|
-
lg: 12,
|
|
5051
|
-
style: {
|
|
5052
|
-
marginTop: "24px"
|
|
5053
|
-
}
|
|
5054
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
5055
|
-
variant: "body2",
|
|
5056
|
-
component: "span",
|
|
5057
|
-
className: styles.errorTextCls
|
|
5058
|
-
}, "Only Card admin can change the roles")))));
|
|
5059
|
-
};
|
|
5060
|
-
|
|
5061
|
-
var IUIToastMessageService$4 = utils.services.IUIToastMessageService,
|
|
5062
|
-
IUILocalStorageService$5 = utils.services.IUILocalStorageService;
|
|
4859
|
+
var IUIToastMessageService$4 = utils.services.IUIToastMessageService;
|
|
5063
4860
|
var env$4 = utils.configs.env;
|
|
5064
4861
|
var UserAddEdit = function UserAddEdit(props) {
|
|
5065
4862
|
var isEditMode = props.isEditMode,
|
|
@@ -5067,8 +4864,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5067
4864
|
config = props.config,
|
|
5068
4865
|
_props$isProfile = props.isProfile,
|
|
5069
4866
|
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5070
|
-
console.log("isProfile", isProfile);
|
|
5071
|
-
console.log("isEditMode", isEditMode);
|
|
5072
4867
|
env$4.init(config, isProfile);
|
|
5073
4868
|
var queryParams = new URLSearchParams(window.location.search);
|
|
5074
4869
|
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
@@ -5088,10 +4883,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5088
4883
|
isRendered = _useSelector.isRendered,
|
|
5089
4884
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
5090
4885
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
5091
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5092
|
-
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5093
|
-
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5094
|
-
cardsDetails = _useSelector.cardsDetails;
|
|
4886
|
+
maxMembershipInput = _useSelector.maxMembershipInput;
|
|
5095
4887
|
var _useSelector2 = reactRedux.useSelector(function (state) {
|
|
5096
4888
|
return state.common;
|
|
5097
4889
|
}),
|
|
@@ -5104,8 +4896,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5104
4896
|
var location = reactRouterDom.useLocation();
|
|
5105
4897
|
var _useState = React.useState({
|
|
5106
4898
|
travel: false,
|
|
5107
|
-
expense: false
|
|
5108
|
-
cards: false
|
|
4899
|
+
expense: false
|
|
5109
4900
|
}),
|
|
5110
4901
|
productAccess = _useState[0],
|
|
5111
4902
|
setProductAccess = _useState[1];
|
|
@@ -5116,13 +4907,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5116
4907
|
errorMsgs.products = '';
|
|
5117
4908
|
var _productAccess = _extends({}, productAccess);
|
|
5118
4909
|
_productAccess[value] = !_productAccess[value];
|
|
5119
|
-
if (_productAccess.travel === false && _productAccess.expense === false
|
|
4910
|
+
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5120
4911
|
var _errorArray = [].concat(errorArray);
|
|
5121
4912
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
5122
4913
|
if (_errorArray.indexOf('products') === -1) {
|
|
5123
4914
|
_errorArray.push('products');
|
|
5124
4915
|
}
|
|
5125
|
-
_errorMsgs.products = ErrorMessages.
|
|
4916
|
+
_errorMsgs.products = ErrorMessages.products;
|
|
5126
4917
|
setErrorArray(_errorArray);
|
|
5127
4918
|
setErrorMsgs(_errorMsgs);
|
|
5128
4919
|
var el = document.getElementById('products');
|
|
@@ -5132,22 +4923,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5132
4923
|
block: 'center'
|
|
5133
4924
|
});
|
|
5134
4925
|
}
|
|
5135
|
-
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.cards === 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
|
-
}
|
|
5151
4926
|
} else {
|
|
5152
4927
|
setErrorArray(errorArray);
|
|
5153
4928
|
setErrorMsgs(errorMsgs);
|
|
@@ -5163,155 +4938,18 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5163
4938
|
var _useState4 = React.useState([]),
|
|
5164
4939
|
countryContactCode = _useState4[0],
|
|
5165
4940
|
setCountryContactCode = _useState4[1];
|
|
5166
|
-
var
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
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
|
-
};
|
|
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];
|
|
5315
4953
|
React.useEffect(function () {
|
|
5316
4954
|
var countryObject = countryContactCode.find(function (t) {
|
|
5317
4955
|
return t.dial_code === countryDialCode;
|
|
@@ -5327,7 +4965,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5327
4965
|
var convertedNumber = parseInt(extractedNumber);
|
|
5328
4966
|
setCountryDialCode(convertedNumber);
|
|
5329
4967
|
}, [newCountryCode]);
|
|
5330
|
-
var
|
|
4968
|
+
var _useState7 = React.useState({
|
|
5331
4969
|
first_name: '',
|
|
5332
4970
|
last_name: '',
|
|
5333
4971
|
email: '',
|
|
@@ -5338,9 +4976,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5338
4976
|
contact_country_code: '',
|
|
5339
4977
|
profile_pic: []
|
|
5340
4978
|
}),
|
|
5341
|
-
personalInfoInput =
|
|
5342
|
-
setPersonalInfoInput =
|
|
5343
|
-
var
|
|
4979
|
+
personalInfoInput = _useState7[0],
|
|
4980
|
+
setPersonalInfoInput = _useState7[1];
|
|
4981
|
+
var _useState8 = React.useState({
|
|
5344
4982
|
emp_level: {
|
|
5345
4983
|
value: '',
|
|
5346
4984
|
label: 'Select employee level'
|
|
@@ -5373,9 +5011,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5373
5011
|
label: defaultCurrency
|
|
5374
5012
|
}
|
|
5375
5013
|
}),
|
|
5376
|
-
employeeInfoInput =
|
|
5377
|
-
setEmployeeInfoInput =
|
|
5378
|
-
var
|
|
5014
|
+
employeeInfoInput = _useState8[0],
|
|
5015
|
+
setEmployeeInfoInput = _useState8[1];
|
|
5016
|
+
var _useState9 = React.useState({
|
|
5379
5017
|
emp_level: 0,
|
|
5380
5018
|
entity: 0,
|
|
5381
5019
|
business_unit: 0,
|
|
@@ -5384,48 +5022,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5384
5022
|
manager_id: 0,
|
|
5385
5023
|
skip_manager_id: 0
|
|
5386
5024
|
}),
|
|
5387
|
-
cacheForAsyncDropdown =
|
|
5388
|
-
clearCacheForAsyncDropdown =
|
|
5389
|
-
var _useState8 = React.useState({}),
|
|
5390
|
-
userTagType = _useState8[0],
|
|
5391
|
-
setUserTagType = _useState8[1];
|
|
5392
|
-
var _useState9 = React.useState(false),
|
|
5393
|
-
scroll = _useState9[0],
|
|
5394
|
-
setScroll = _useState9[1];
|
|
5025
|
+
cacheForAsyncDropdown = _useState9[0],
|
|
5026
|
+
clearCacheForAsyncDropdown = _useState9[1];
|
|
5395
5027
|
var _useState10 = React.useState({}),
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
var _useState11 = React.useState(
|
|
5399
|
-
|
|
5400
|
-
|
|
5028
|
+
userTagType = _useState10[0],
|
|
5029
|
+
setUserTagType = _useState10[1];
|
|
5030
|
+
var _useState11 = React.useState(false),
|
|
5031
|
+
scroll = _useState11[0],
|
|
5032
|
+
setScroll = _useState11[1];
|
|
5401
5033
|
var _useState12 = React.useState({}),
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
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({
|
|
5405
5043
|
value: '',
|
|
5406
5044
|
label: 'Select approver'
|
|
5407
5045
|
}),
|
|
5408
|
-
travelFYI =
|
|
5409
|
-
setTravelFYI =
|
|
5410
|
-
var
|
|
5411
|
-
membershipInfoInput =
|
|
5412
|
-
setMembershipInfoInput =
|
|
5413
|
-
var
|
|
5414
|
-
removedMembershipInfoInput =
|
|
5415
|
-
setRemovedMembershipInfoInput =
|
|
5416
|
-
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({
|
|
5417
5055
|
flight_seat_preference: '',
|
|
5418
5056
|
meal_preference: ''
|
|
5419
5057
|
}),
|
|
5420
|
-
travelPreferenceInfo =
|
|
5421
|
-
settravelPreferenceInfo =
|
|
5422
|
-
var
|
|
5058
|
+
travelPreferenceInfo = _useState18[0],
|
|
5059
|
+
settravelPreferenceInfo = _useState18[1];
|
|
5060
|
+
var _useState19 = React.useState({
|
|
5423
5061
|
trusted_traveller: '',
|
|
5424
5062
|
redress_number: ''
|
|
5425
5063
|
}),
|
|
5426
|
-
secureTravelInputInfo =
|
|
5427
|
-
setSecureTravelInputInfo =
|
|
5428
|
-
var
|
|
5064
|
+
secureTravelInputInfo = _useState19[0],
|
|
5065
|
+
setSecureTravelInputInfo = _useState19[1];
|
|
5066
|
+
var _useState20 = React.useState({
|
|
5429
5067
|
passport_issue_country: {
|
|
5430
5068
|
value: '',
|
|
5431
5069
|
label: 'Select country'
|
|
@@ -5440,77 +5078,39 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5440
5078
|
passport_photo: [],
|
|
5441
5079
|
travel_docs: []
|
|
5442
5080
|
}),
|
|
5443
|
-
passportInfoInput =
|
|
5444
|
-
setPassportInfoInput =
|
|
5445
|
-
var
|
|
5446
|
-
filesForDelete =
|
|
5447
|
-
setFilesForDelete =
|
|
5448
|
-
var
|
|
5449
|
-
profilePicDelete =
|
|
5450
|
-
setProfilePicDelete =
|
|
5451
|
-
var
|
|
5452
|
-
isAdditionalInfoExpanded =
|
|
5453
|
-
setAdditionalInfoFlag =
|
|
5454
|
-
var
|
|
5455
|
-
expenseRole =
|
|
5456
|
-
setExpenseRole =
|
|
5457
|
-
var
|
|
5458
|
-
expenseApproversInput =
|
|
5459
|
-
setExpenseApproversInput =
|
|
5460
|
-
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({
|
|
5461
5099
|
value: '',
|
|
5462
5100
|
label: 'Select approver'
|
|
5463
5101
|
}),
|
|
5464
|
-
expenseFYI =
|
|
5465
|
-
setExpenseFYI =
|
|
5466
|
-
var _useState25 = React.useState(''),
|
|
5467
|
-
cardsRole = _useState25[0],
|
|
5468
|
-
setCardsRole = _useState25[1];
|
|
5469
|
-
console.log("cardsRole123", cardsRole);
|
|
5470
|
-
React.useEffect(function () {
|
|
5471
|
-
if (productAccess.cards === false) {
|
|
5472
|
-
setCardsRole('');
|
|
5473
|
-
}
|
|
5474
|
-
}, [productAccess.cards]);
|
|
5475
|
-
React.useEffect(function () {
|
|
5476
|
-
if (isCardsDetailsRendered && !isProfile && productAccess.cards) {
|
|
5477
|
-
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5478
|
-
return role.isAssigned;
|
|
5479
|
-
});
|
|
5480
|
-
if (selectedRole) {
|
|
5481
|
-
setCardsRole(selectedRole.value);
|
|
5482
|
-
} else {
|
|
5483
|
-
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5484
|
-
var splitRoleVal = role.value.split(":");
|
|
5485
|
-
return splitRoleVal[2] === 'card-holder';
|
|
5486
|
-
});
|
|
5487
|
-
if (defaultRole) {
|
|
5488
|
-
setCardsRole(defaultRole.value);
|
|
5489
|
-
}
|
|
5490
|
-
}
|
|
5491
|
-
} else if (isCardsDetailsRendered && isProfile && productAccess.cards) {
|
|
5492
|
-
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5493
|
-
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5494
|
-
var role = _step.value;
|
|
5495
|
-
var splitRoleVal = role.value.split(":");
|
|
5496
|
-
var profileRole = splitRoleVal[2];
|
|
5497
|
-
if (profileRole === targetRole) {
|
|
5498
|
-
setCardsRole(role.value);
|
|
5499
|
-
break;
|
|
5500
|
-
}
|
|
5501
|
-
}
|
|
5502
|
-
}
|
|
5503
|
-
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.cards, isCardsAdmin]);
|
|
5102
|
+
expenseFYI = _useState26[0],
|
|
5103
|
+
setExpenseFYI = _useState26[1];
|
|
5504
5104
|
var asyncSelectRefs = React.useRef({
|
|
5505
5105
|
emp_level: React.useRef(null),
|
|
5506
5106
|
entity: React.useRef(null),
|
|
5507
5107
|
business_unit: React.useRef(null),
|
|
5508
5108
|
department: React.useRef(null)
|
|
5509
5109
|
});
|
|
5510
|
-
var
|
|
5511
|
-
errorArray =
|
|
5512
|
-
setErrorArray =
|
|
5513
|
-
var
|
|
5110
|
+
var _useState27 = React.useState([]),
|
|
5111
|
+
errorArray = _useState27[0],
|
|
5112
|
+
setErrorArray = _useState27[1];
|
|
5113
|
+
var _useState28 = React.useState({
|
|
5514
5114
|
first_name: '',
|
|
5515
5115
|
last_name: '',
|
|
5516
5116
|
email: '',
|
|
@@ -5540,9 +5140,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5540
5140
|
userTagType: '',
|
|
5541
5141
|
profile_pic: ''
|
|
5542
5142
|
}),
|
|
5543
|
-
errorMsgs =
|
|
5544
|
-
setErrorMsgs =
|
|
5545
|
-
var
|
|
5143
|
+
errorMsgs = _useState28[0],
|
|
5144
|
+
setErrorMsgs = _useState28[1];
|
|
5145
|
+
var _useState29 = React.useState({
|
|
5546
5146
|
first_name: false,
|
|
5547
5147
|
last_name: false,
|
|
5548
5148
|
email: false,
|
|
@@ -5569,14 +5169,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5569
5169
|
userTagType: false,
|
|
5570
5170
|
profile_pic: false
|
|
5571
5171
|
}),
|
|
5572
|
-
inputChangeLog =
|
|
5573
|
-
updateInputChangeLog =
|
|
5574
|
-
var
|
|
5575
|
-
uploadedFiles =
|
|
5576
|
-
setUploadedFiles =
|
|
5577
|
-
var
|
|
5578
|
-
maxLengthForModal =
|
|
5579
|
-
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];
|
|
5580
5180
|
var defaultAddModalData = {
|
|
5581
5181
|
isOpen: false,
|
|
5582
5182
|
isError: false,
|
|
@@ -5592,9 +5192,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5592
5192
|
maxLength: maxLengthForModal,
|
|
5593
5193
|
minLength: 0
|
|
5594
5194
|
};
|
|
5595
|
-
var
|
|
5596
|
-
addModalData =
|
|
5597
|
-
setAddModalData =
|
|
5195
|
+
var _useState32 = React.useState(defaultAddModalData),
|
|
5196
|
+
addModalData = _useState32[0],
|
|
5197
|
+
setAddModalData = _useState32[1];
|
|
5598
5198
|
var onAddModalClose = function onAddModalClose() {
|
|
5599
5199
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5600
5200
|
};
|
|
@@ -6005,11 +5605,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6005
5605
|
}, [isTokenVerified]);
|
|
6006
5606
|
React.useEffect(function () {
|
|
6007
5607
|
if (isRendered === true) {
|
|
6008
|
-
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6009
|
-
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'cards') {
|
|
6010
|
-
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6011
|
-
}
|
|
6012
|
-
});
|
|
6013
5608
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
6014
5609
|
country_code: countryCode
|
|
6015
5610
|
}));
|
|
@@ -6131,8 +5726,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6131
5726
|
var products = res.user_product.split('+');
|
|
6132
5727
|
setProductAccess({
|
|
6133
5728
|
travel: products.includes('travel'),
|
|
6134
|
-
expense: products.includes('expense')
|
|
6135
|
-
cards: products.includes('cards')
|
|
5729
|
+
expense: products.includes('expense')
|
|
6136
5730
|
});
|
|
6137
5731
|
if (products.includes('travel')) {
|
|
6138
5732
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -6349,9 +5943,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6349
5943
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
6350
5944
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
6351
5945
|
}
|
|
6352
|
-
var cardsPayload = {
|
|
6353
|
-
"roles": [cardsRole]
|
|
6354
|
-
};
|
|
6355
5946
|
var payload = {
|
|
6356
5947
|
personalInfoInput: personalInfoInput,
|
|
6357
5948
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -6370,9 +5961,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6370
5961
|
uploadedFiles: uploadedFiles,
|
|
6371
5962
|
filesForDelete: filesForDelete,
|
|
6372
5963
|
profilePicDelete: profilePicDelete,
|
|
6373
|
-
userTagType: userTagType
|
|
6374
|
-
cardsRole: cardsRole,
|
|
6375
|
-
isCardsAdmin: isCardsAdmin
|
|
5964
|
+
userTagType: userTagType
|
|
6376
5965
|
};
|
|
6377
5966
|
if (verifyUserId) {
|
|
6378
5967
|
payload.verifyUserId = verifyUserId;
|
|
@@ -6498,7 +6087,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6498
6087
|
if (_isError) {
|
|
6499
6088
|
setErrorArray(_errorArray);
|
|
6500
6089
|
setErrorMsgs(_errorMsgs);
|
|
6501
|
-
var
|
|
6090
|
+
var _loop = function _loop() {
|
|
6502
6091
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6503
6092
|
if (_errorMsgs[_key3]) {
|
|
6504
6093
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6518,109 +6107,115 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6518
6107
|
}
|
|
6519
6108
|
};
|
|
6520
6109
|
for (var _key3 in _errorMsgs) {
|
|
6521
|
-
if (
|
|
6110
|
+
if (_loop()) break;
|
|
6522
6111
|
}
|
|
6523
6112
|
}
|
|
6524
|
-
var cardApiflag = false;
|
|
6525
|
-
if (productAccess.cards === false || isCardsAdmin === false) {
|
|
6526
|
-
cardApiflag = false;
|
|
6527
|
-
} else {
|
|
6528
|
-
cardApiflag = true;
|
|
6529
|
-
}
|
|
6530
6113
|
if (!_isError) {
|
|
6531
6114
|
if (isEditMode && editUserId || isProfile) {
|
|
6532
6115
|
dispatch(showLoader());
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
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;
|
|
6540
6130
|
}
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
updateUserApiCall(payload, inputChangeLog);
|
|
6544
|
-
} else {
|
|
6545
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6131
|
+
if (err.contact_country_code) {
|
|
6132
|
+
err.contact_number = err.contact_country_code;
|
|
6546
6133
|
}
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
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
|
+
});
|
|
6555
6170
|
} else {
|
|
6556
6171
|
dispatch(showLoader());
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
headers: {
|
|
6565
|
-
'Content-Type': 'application/json',
|
|
6566
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6567
|
-
}
|
|
6568
|
-
}).then(function (response) {
|
|
6569
|
-
if (response.status !== 200) {
|
|
6570
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6571
|
-
}
|
|
6572
|
-
})["catch"](function (error) {
|
|
6573
|
-
console.log("errorrr", error);
|
|
6574
|
-
});
|
|
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;
|
|
6575
6179
|
}
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
el.scrollIntoView({
|
|
6601
|
-
behavior: 'smooth',
|
|
6602
|
-
block: 'center'
|
|
6603
|
-
});
|
|
6604
|
-
}, 500);
|
|
6605
|
-
return 1;
|
|
6606
|
-
}
|
|
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;
|
|
6607
6204
|
}
|
|
6608
6205
|
}
|
|
6609
|
-
};
|
|
6610
|
-
for (var _key4 in err) {
|
|
6611
|
-
if (_loop4()) break;
|
|
6612
6206
|
}
|
|
6613
|
-
}
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6207
|
+
};
|
|
6208
|
+
for (var _key5 in err) {
|
|
6209
|
+
if (_loop3()) break;
|
|
6617
6210
|
}
|
|
6618
|
-
}
|
|
6619
|
-
|
|
6620
|
-
}
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
}
|
|
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
|
+
});
|
|
6624
6219
|
}
|
|
6625
6220
|
}
|
|
6626
6221
|
return Promise.resolve();
|
|
@@ -6638,8 +6233,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6638
6233
|
}
|
|
6639
6234
|
}
|
|
6640
6235
|
} else {
|
|
6641
|
-
var _config$
|
|
6642
|
-
(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);
|
|
6643
6238
|
}
|
|
6644
6239
|
};
|
|
6645
6240
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6936,6 +6531,74 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6936
6531
|
item: true,
|
|
6937
6532
|
sm: 12,
|
|
6938
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
|
|
6939
6602
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
6940
6603
|
label: "Product access",
|
|
6941
6604
|
description: isProfile ? '' : 'Select at least one product',
|
|
@@ -6952,9 +6615,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6952
6615
|
className: styles.productContainerGap
|
|
6953
6616
|
}, renderFields.products.map(function (p, i) {
|
|
6954
6617
|
p.readOnly = isProfile;
|
|
6955
|
-
if (p.id === 3 && !isCardsAdmin) {
|
|
6956
|
-
p.readOnly = true;
|
|
6957
|
-
}
|
|
6958
6618
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
6959
6619
|
item: true,
|
|
6960
6620
|
sm: 12,
|
|
@@ -7047,19 +6707,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
7047
6707
|
isProfile: isProfile,
|
|
7048
6708
|
editUserId: editUserId,
|
|
7049
6709
|
roles: renderFields.expenseRoles
|
|
7050
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
|
|
7051
|
-
className: styles.dividerColor
|
|
7052
|
-
}), isCardsDetailsRendered && productAccess && productAccess.cards && /*#__PURE__*/React__default.createElement(CardsField, {
|
|
7053
|
-
cardsConstants: cardsDetails.cardsConstants,
|
|
7054
|
-
type: "cards",
|
|
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
6710
|
}))) : /*#__PURE__*/React__default.createElement(VerificationError, {
|
|
7064
6711
|
config: config,
|
|
7065
6712
|
errMsg: hasVerificationError
|
|
@@ -8868,7 +8515,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8868
8515
|
cell: function cell(row) {
|
|
8869
8516
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8870
8517
|
component: "div"
|
|
8871
|
-
}, 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, {
|
|
8872
8519
|
component: "div",
|
|
8873
8520
|
display: "flex"
|
|
8874
8521
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8881,7 +8528,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8881
8528
|
style: {
|
|
8882
8529
|
whiteSpace: 'nowrap'
|
|
8883
8530
|
}
|
|
8884
|
-
}, "\xA0" + row.products[0].role))
|
|
8531
|
+
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8885
8532
|
component: "div",
|
|
8886
8533
|
display: "flex"
|
|
8887
8534
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8894,20 +8541,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8894
8541
|
style: {
|
|
8895
8542
|
whiteSpace: 'nowrap'
|
|
8896
8543
|
}
|
|
8897
|
-
}, "\xA0" + row.products[1].role))
|
|
8898
|
-
component: "div",
|
|
8899
|
-
display: "flex"
|
|
8900
|
-
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8901
|
-
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8902
|
-
style: {
|
|
8903
|
-
whiteSpace: 'nowrap'
|
|
8904
|
-
}
|
|
8905
|
-
}, row.products[2].name + ' / '), /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8906
|
-
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8907
|
-
style: {
|
|
8908
|
-
whiteSpace: 'nowrap'
|
|
8909
|
-
}
|
|
8910
|
-
}, "\xA0" + row.products[2].role))) : '');
|
|
8544
|
+
}, "\xA0" + row.products[1].role))) : '');
|
|
8911
8545
|
}
|
|
8912
8546
|
}, {
|
|
8913
8547
|
id: 'status',
|