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