@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.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.cards) {
|
|
877
|
-
var splitRole = payload.cardsRole.split(":");
|
|
878
|
-
var cardsUsmRole = splitRole[2];
|
|
879
|
-
product.cards = 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+cards';
|
|
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.cards) {
|
|
987
|
-
return 'expense+cards';
|
|
988
|
-
} else if (payload.productAccess.travel && payload.productAccess.cards) {
|
|
989
|
-
return 'travel+cards';
|
|
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.cards) {
|
|
1005
|
-
var splitRole = payload.cardsRole.split(":");
|
|
1006
|
-
var cardsUsmRole = splitRole[2];
|
|
1007
|
-
roles.cards = 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: 'Cards',
|
|
3258
|
-
name: 'cards',
|
|
3259
|
-
type: 'checkbox',
|
|
3260
|
-
disableText: 'Only Card admin can change this access.'
|
|
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 own and use card that are issued to them',
|
|
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: 'Can issue card to others and can manage all card and transactions across the company.',
|
|
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: 'Select at least one additional product if opting for card.',
|
|
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,71 +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
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5008
|
-
container: true,
|
|
5009
|
-
className: (styles.headingPadding)
|
|
5010
|
-
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5011
|
-
variant: "h3",
|
|
5012
|
-
className: clsx(styles.heading, styles.headingMedium)
|
|
5013
|
-
}, cardsConstants.heading)), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
5014
|
-
className: styles.dividerColor
|
|
5015
|
-
}), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5016
|
-
container: true,
|
|
5017
|
-
className: clsx(styles.product_info, styles.sectionWrapper)
|
|
5018
|
-
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5019
|
-
item: true,
|
|
5020
|
-
sm: 12,
|
|
5021
|
-
md: 4
|
|
5022
|
-
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
5023
|
-
label: cardsConstants.roleHeading,
|
|
5024
|
-
headerType: true,
|
|
5025
|
-
description: cardsConstants.roleDescription
|
|
5026
|
-
})), /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5027
|
-
item: true,
|
|
5028
|
-
sm: 12,
|
|
5029
|
-
md: 8,
|
|
5030
|
-
lg: 8,
|
|
5031
|
-
xl: 6
|
|
5032
|
-
}, /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5033
|
-
container: true,
|
|
5034
|
-
className: styles.formFieldsWrapper
|
|
5035
|
-
}, isProfile ? /*#__PURE__*/React.createElement(UserRole, {
|
|
5036
|
-
list: roles,
|
|
5037
|
-
value: roleValue
|
|
5038
|
-
}) : /*#__PURE__*/React.createElement(IUIRadio, {
|
|
5039
|
-
list: roles,
|
|
5040
|
-
value: roleValue,
|
|
5041
|
-
onValueChange: onRoleChange,
|
|
5042
|
-
disabled: cardsAdmin ? false : true
|
|
5043
|
-
})), !cardsAdmin && !isProfile && /*#__PURE__*/React.createElement(IUIGrid, {
|
|
5044
|
-
item: true,
|
|
5045
|
-
sm: 12,
|
|
5046
|
-
md: 12,
|
|
5047
|
-
lg: 12,
|
|
5048
|
-
style: {
|
|
5049
|
-
marginTop: "24px"
|
|
5050
|
-
}
|
|
5051
|
-
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
5052
|
-
variant: "body2",
|
|
5053
|
-
component: "span",
|
|
5054
|
-
className: styles.errorTextCls
|
|
5055
|
-
}, "Only Card admin can change the roles")))));
|
|
5056
|
-
};
|
|
5057
|
-
|
|
5058
|
-
var IUIToastMessageService$4 = services.IUIToastMessageService,
|
|
5059
|
-
IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
4856
|
+
var IUIToastMessageService$4 = services.IUIToastMessageService;
|
|
5060
4857
|
var env$4 = configs.env;
|
|
5061
4858
|
var UserAddEdit = function UserAddEdit(props) {
|
|
5062
4859
|
var isEditMode = props.isEditMode,
|
|
@@ -5064,8 +4861,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5064
4861
|
config = props.config,
|
|
5065
4862
|
_props$isProfile = props.isProfile,
|
|
5066
4863
|
isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
|
|
5067
|
-
console.log("isProfile", isProfile);
|
|
5068
|
-
console.log("isEditMode", isEditMode);
|
|
5069
4864
|
env$4.init(config, isProfile);
|
|
5070
4865
|
var queryParams = new URLSearchParams(window.location.search);
|
|
5071
4866
|
var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
|
|
@@ -5085,10 +4880,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5085
4880
|
isRendered = _useSelector.isRendered,
|
|
5086
4881
|
maxTravelApprovers = _useSelector.maxTravelApprovers,
|
|
5087
4882
|
maxExpenseApprovers = _useSelector.maxExpenseApprovers,
|
|
5088
|
-
maxMembershipInput = _useSelector.maxMembershipInput
|
|
5089
|
-
isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
|
|
5090
|
-
isCardsAdmin = _useSelector.isCardsAdmin,
|
|
5091
|
-
cardsDetails = _useSelector.cardsDetails;
|
|
4883
|
+
maxMembershipInput = _useSelector.maxMembershipInput;
|
|
5092
4884
|
var _useSelector2 = useSelector(function (state) {
|
|
5093
4885
|
return state.common;
|
|
5094
4886
|
}),
|
|
@@ -5101,8 +4893,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5101
4893
|
var location = useLocation();
|
|
5102
4894
|
var _useState = useState({
|
|
5103
4895
|
travel: false,
|
|
5104
|
-
expense: false
|
|
5105
|
-
cards: false
|
|
4896
|
+
expense: false
|
|
5106
4897
|
}),
|
|
5107
4898
|
productAccess = _useState[0],
|
|
5108
4899
|
setProductAccess = _useState[1];
|
|
@@ -5113,13 +4904,13 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5113
4904
|
errorMsgs.products = '';
|
|
5114
4905
|
var _productAccess = _extends({}, productAccess);
|
|
5115
4906
|
_productAccess[value] = !_productAccess[value];
|
|
5116
|
-
if (_productAccess.travel === false && _productAccess.expense === false
|
|
4907
|
+
if (_productAccess.travel === false && _productAccess.expense === false) {
|
|
5117
4908
|
var _errorArray = [].concat(errorArray);
|
|
5118
4909
|
var _errorMsgs = _extends({}, errorMsgs);
|
|
5119
4910
|
if (_errorArray.indexOf('products') === -1) {
|
|
5120
4911
|
_errorArray.push('products');
|
|
5121
4912
|
}
|
|
5122
|
-
_errorMsgs.products = ErrorMessages.
|
|
4913
|
+
_errorMsgs.products = ErrorMessages.products;
|
|
5123
4914
|
setErrorArray(_errorArray);
|
|
5124
4915
|
setErrorMsgs(_errorMsgs);
|
|
5125
4916
|
var el = document.getElementById('products');
|
|
@@ -5129,22 +4920,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5129
4920
|
block: 'center'
|
|
5130
4921
|
});
|
|
5131
4922
|
}
|
|
5132
|
-
} else if (_productAccess.travel === false && _productAccess.expense === false && _productAccess.cards === false) {
|
|
5133
|
-
var _errorArray2 = [].concat(errorArray);
|
|
5134
|
-
var _errorMsgs2 = _extends({}, errorMsgs);
|
|
5135
|
-
if (_errorArray2.indexOf('products') === -1) {
|
|
5136
|
-
_errorArray2.push('products');
|
|
5137
|
-
}
|
|
5138
|
-
_errorMsgs2.products = ErrorMessages.products;
|
|
5139
|
-
setErrorArray(_errorArray2);
|
|
5140
|
-
setErrorMsgs(_errorMsgs2);
|
|
5141
|
-
var _el = document.getElementById('products');
|
|
5142
|
-
if (_el) {
|
|
5143
|
-
_el.scrollIntoView({
|
|
5144
|
-
behavior: 'smooth',
|
|
5145
|
-
block: 'center'
|
|
5146
|
-
});
|
|
5147
|
-
}
|
|
5148
4923
|
} else {
|
|
5149
4924
|
setErrorArray(errorArray);
|
|
5150
4925
|
setErrorMsgs(errorMsgs);
|
|
@@ -5160,155 +4935,18 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5160
4935
|
var _useState4 = useState([]),
|
|
5161
4936
|
countryContactCode = _useState4[0],
|
|
5162
4937
|
setCountryContactCode = _useState4[1];
|
|
5163
|
-
var
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
if (typeof err === 'object') {
|
|
5176
|
-
if (err.country_code) {
|
|
5177
|
-
err.contact_number = err.country_code;
|
|
5178
|
-
}
|
|
5179
|
-
if (err.contact_country_code) {
|
|
5180
|
-
err.contact_number = err.contact_country_code;
|
|
5181
|
-
}
|
|
5182
|
-
if (err.passport) {
|
|
5183
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5184
|
-
delete err.passport;
|
|
5185
|
-
}
|
|
5186
|
-
setErrorArray(Object.keys(err));
|
|
5187
|
-
setErrorMsgs(err);
|
|
5188
|
-
var _loop = function _loop() {
|
|
5189
|
-
if (Object.hasOwnProperty.call(err, key)) {
|
|
5190
|
-
if (err[key]) {
|
|
5191
|
-
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5192
|
-
setAdditionalInfoFlag('open');
|
|
5193
|
-
}
|
|
5194
|
-
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5195
|
-
if (el) {
|
|
5196
|
-
setTimeout(function () {
|
|
5197
|
-
el.scrollIntoView({
|
|
5198
|
-
behavior: 'smooth',
|
|
5199
|
-
block: 'center'
|
|
5200
|
-
});
|
|
5201
|
-
}, 500);
|
|
5202
|
-
return 1;
|
|
5203
|
-
}
|
|
5204
|
-
}
|
|
5205
|
-
}
|
|
5206
|
-
};
|
|
5207
|
-
for (var key in err) {
|
|
5208
|
-
if (_loop()) break;
|
|
5209
|
-
}
|
|
5210
|
-
} else if (typeof err === 'string') {
|
|
5211
|
-
IUIToastMessageService$4.warningNotify(err);
|
|
5212
|
-
} else {
|
|
5213
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5214
|
-
}
|
|
5215
|
-
})["finally"](function () {
|
|
5216
|
-
dispatch(stopLoader());
|
|
5217
|
-
});
|
|
5218
|
-
};
|
|
5219
|
-
var createUserApiCall = function createUserApiCall(payload) {
|
|
5220
|
-
dispatch(createUser(payload)).then(function (res) {
|
|
5221
|
-
var _config$routes3, _config$routes3$users, _config$routes3$users2;
|
|
5222
|
-
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) {
|
|
5223
|
-
history.push({
|
|
5224
|
-
pathname: config.routes.users.list.path
|
|
5225
|
-
});
|
|
5226
|
-
}
|
|
5227
|
-
})["catch"](function (err) {
|
|
5228
|
-
if (typeof err === 'object') {
|
|
5229
|
-
if (err.country_code) {
|
|
5230
|
-
err.contact_number = err.country_code;
|
|
5231
|
-
}
|
|
5232
|
-
if (err.contact_country_code) {
|
|
5233
|
-
err.contact_number = err.contact_country_code;
|
|
5234
|
-
}
|
|
5235
|
-
if (err.passport) {
|
|
5236
|
-
err.passport_photo = _extends({}, err.passport);
|
|
5237
|
-
delete err.passport;
|
|
5238
|
-
}
|
|
5239
|
-
setErrorArray(Object.keys(err));
|
|
5240
|
-
setErrorMsgs(err);
|
|
5241
|
-
var _loop2 = function _loop2() {
|
|
5242
|
-
if (Object.hasOwnProperty.call(err, key)) {
|
|
5243
|
-
if (err[key]) {
|
|
5244
|
-
if (key in passportInfoInput || key in travelPreferenceInfo || key in secureTravelInputInfo) {
|
|
5245
|
-
setAdditionalInfoFlag('open');
|
|
5246
|
-
}
|
|
5247
|
-
var el = document.getElementById(key === 'country_code' || key === 'contact_country_code' ? 'contact_number' : key);
|
|
5248
|
-
if (el) {
|
|
5249
|
-
setTimeout(function () {
|
|
5250
|
-
el.scrollIntoView({
|
|
5251
|
-
behavior: 'smooth',
|
|
5252
|
-
block: 'center'
|
|
5253
|
-
});
|
|
5254
|
-
}, 500);
|
|
5255
|
-
return 1;
|
|
5256
|
-
}
|
|
5257
|
-
}
|
|
5258
|
-
}
|
|
5259
|
-
};
|
|
5260
|
-
for (var key in err) {
|
|
5261
|
-
if (_loop2()) break;
|
|
5262
|
-
}
|
|
5263
|
-
} else if (typeof err === 'string') {
|
|
5264
|
-
IUIToastMessageService$4.warningNotify(err);
|
|
5265
|
-
} else {
|
|
5266
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5267
|
-
}
|
|
5268
|
-
})["finally"](function () {
|
|
5269
|
-
dispatch(stopLoader());
|
|
5270
|
-
});
|
|
5271
|
-
};
|
|
5272
|
-
var fetchEditUserCardsDetails = function fetchEditUserCardsDetails(editUserId) {
|
|
5273
|
-
fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
|
|
5274
|
-
method: 'GET',
|
|
5275
|
-
headers: {
|
|
5276
|
-
'Content-Type': 'application/json',
|
|
5277
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5278
|
-
}
|
|
5279
|
-
}).then(function (response) {
|
|
5280
|
-
return response.json();
|
|
5281
|
-
}).then(function (res) {
|
|
5282
|
-
var _res$roles;
|
|
5283
|
-
if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
|
|
5284
|
-
dispatch(setCardsDetails(res));
|
|
5285
|
-
} else {
|
|
5286
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5287
|
-
}
|
|
5288
|
-
})["catch"](function (error) {
|
|
5289
|
-
console.log("errorrr", error);
|
|
5290
|
-
});
|
|
5291
|
-
};
|
|
5292
|
-
var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
|
|
5293
|
-
fetch(userAddEditUrl.cardsAddUsersDetails(), {
|
|
5294
|
-
method: 'GET',
|
|
5295
|
-
headers: {
|
|
5296
|
-
'Content-Type': 'application/json',
|
|
5297
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
5298
|
-
}
|
|
5299
|
-
}).then(function (response) {
|
|
5300
|
-
return response.json();
|
|
5301
|
-
}).then(function (res) {
|
|
5302
|
-
var _res$roles2;
|
|
5303
|
-
if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
|
|
5304
|
-
dispatch(setCardsDetails(res));
|
|
5305
|
-
} else {
|
|
5306
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
5307
|
-
}
|
|
5308
|
-
})["catch"](function (error) {
|
|
5309
|
-
console.log("errorrr", error);
|
|
5310
|
-
});
|
|
5311
|
-
};
|
|
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];
|
|
5312
4950
|
useEffect(function () {
|
|
5313
4951
|
var countryObject = countryContactCode.find(function (t) {
|
|
5314
4952
|
return t.dial_code === countryDialCode;
|
|
@@ -5324,7 +4962,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5324
4962
|
var convertedNumber = parseInt(extractedNumber);
|
|
5325
4963
|
setCountryDialCode(convertedNumber);
|
|
5326
4964
|
}, [newCountryCode]);
|
|
5327
|
-
var
|
|
4965
|
+
var _useState7 = useState({
|
|
5328
4966
|
first_name: '',
|
|
5329
4967
|
last_name: '',
|
|
5330
4968
|
email: '',
|
|
@@ -5335,9 +4973,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5335
4973
|
contact_country_code: '',
|
|
5336
4974
|
profile_pic: []
|
|
5337
4975
|
}),
|
|
5338
|
-
personalInfoInput =
|
|
5339
|
-
setPersonalInfoInput =
|
|
5340
|
-
var
|
|
4976
|
+
personalInfoInput = _useState7[0],
|
|
4977
|
+
setPersonalInfoInput = _useState7[1];
|
|
4978
|
+
var _useState8 = useState({
|
|
5341
4979
|
emp_level: {
|
|
5342
4980
|
value: '',
|
|
5343
4981
|
label: 'Select employee level'
|
|
@@ -5370,9 +5008,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5370
5008
|
label: defaultCurrency
|
|
5371
5009
|
}
|
|
5372
5010
|
}),
|
|
5373
|
-
employeeInfoInput =
|
|
5374
|
-
setEmployeeInfoInput =
|
|
5375
|
-
var
|
|
5011
|
+
employeeInfoInput = _useState8[0],
|
|
5012
|
+
setEmployeeInfoInput = _useState8[1];
|
|
5013
|
+
var _useState9 = useState({
|
|
5376
5014
|
emp_level: 0,
|
|
5377
5015
|
entity: 0,
|
|
5378
5016
|
business_unit: 0,
|
|
@@ -5381,48 +5019,48 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5381
5019
|
manager_id: 0,
|
|
5382
5020
|
skip_manager_id: 0
|
|
5383
5021
|
}),
|
|
5384
|
-
cacheForAsyncDropdown =
|
|
5385
|
-
clearCacheForAsyncDropdown =
|
|
5386
|
-
var _useState8 = useState({}),
|
|
5387
|
-
userTagType = _useState8[0],
|
|
5388
|
-
setUserTagType = _useState8[1];
|
|
5389
|
-
var _useState9 = useState(false),
|
|
5390
|
-
scroll = _useState9[0],
|
|
5391
|
-
setScroll = _useState9[1];
|
|
5022
|
+
cacheForAsyncDropdown = _useState9[0],
|
|
5023
|
+
clearCacheForAsyncDropdown = _useState9[1];
|
|
5392
5024
|
var _useState10 = useState({}),
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
var _useState11 = useState(
|
|
5396
|
-
|
|
5397
|
-
|
|
5025
|
+
userTagType = _useState10[0],
|
|
5026
|
+
setUserTagType = _useState10[1];
|
|
5027
|
+
var _useState11 = useState(false),
|
|
5028
|
+
scroll = _useState11[0],
|
|
5029
|
+
setScroll = _useState11[1];
|
|
5398
5030
|
var _useState12 = useState({}),
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
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({
|
|
5402
5040
|
value: '',
|
|
5403
5041
|
label: 'Select approver'
|
|
5404
5042
|
}),
|
|
5405
|
-
travelFYI =
|
|
5406
|
-
setTravelFYI =
|
|
5407
|
-
var
|
|
5408
|
-
membershipInfoInput =
|
|
5409
|
-
setMembershipInfoInput =
|
|
5410
|
-
var
|
|
5411
|
-
removedMembershipInfoInput =
|
|
5412
|
-
setRemovedMembershipInfoInput =
|
|
5413
|
-
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({
|
|
5414
5052
|
flight_seat_preference: '',
|
|
5415
5053
|
meal_preference: ''
|
|
5416
5054
|
}),
|
|
5417
|
-
travelPreferenceInfo =
|
|
5418
|
-
settravelPreferenceInfo =
|
|
5419
|
-
var
|
|
5055
|
+
travelPreferenceInfo = _useState18[0],
|
|
5056
|
+
settravelPreferenceInfo = _useState18[1];
|
|
5057
|
+
var _useState19 = useState({
|
|
5420
5058
|
trusted_traveller: '',
|
|
5421
5059
|
redress_number: ''
|
|
5422
5060
|
}),
|
|
5423
|
-
secureTravelInputInfo =
|
|
5424
|
-
setSecureTravelInputInfo =
|
|
5425
|
-
var
|
|
5061
|
+
secureTravelInputInfo = _useState19[0],
|
|
5062
|
+
setSecureTravelInputInfo = _useState19[1];
|
|
5063
|
+
var _useState20 = useState({
|
|
5426
5064
|
passport_issue_country: {
|
|
5427
5065
|
value: '',
|
|
5428
5066
|
label: 'Select country'
|
|
@@ -5437,77 +5075,39 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5437
5075
|
passport_photo: [],
|
|
5438
5076
|
travel_docs: []
|
|
5439
5077
|
}),
|
|
5440
|
-
passportInfoInput =
|
|
5441
|
-
setPassportInfoInput =
|
|
5442
|
-
var
|
|
5443
|
-
filesForDelete =
|
|
5444
|
-
setFilesForDelete =
|
|
5445
|
-
var
|
|
5446
|
-
profilePicDelete =
|
|
5447
|
-
setProfilePicDelete =
|
|
5448
|
-
var
|
|
5449
|
-
isAdditionalInfoExpanded =
|
|
5450
|
-
setAdditionalInfoFlag =
|
|
5451
|
-
var
|
|
5452
|
-
expenseRole =
|
|
5453
|
-
setExpenseRole =
|
|
5454
|
-
var
|
|
5455
|
-
expenseApproversInput =
|
|
5456
|
-
setExpenseApproversInput =
|
|
5457
|
-
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({
|
|
5458
5096
|
value: '',
|
|
5459
5097
|
label: 'Select approver'
|
|
5460
5098
|
}),
|
|
5461
|
-
expenseFYI =
|
|
5462
|
-
setExpenseFYI =
|
|
5463
|
-
var _useState25 = useState(''),
|
|
5464
|
-
cardsRole = _useState25[0],
|
|
5465
|
-
setCardsRole = _useState25[1];
|
|
5466
|
-
console.log("cardsRole123", cardsRole);
|
|
5467
|
-
useEffect(function () {
|
|
5468
|
-
if (productAccess.cards === false) {
|
|
5469
|
-
setCardsRole('');
|
|
5470
|
-
}
|
|
5471
|
-
}, [productAccess.cards]);
|
|
5472
|
-
useEffect(function () {
|
|
5473
|
-
if (isCardsDetailsRendered && !isProfile && productAccess.cards) {
|
|
5474
|
-
var selectedRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5475
|
-
return role.isAssigned;
|
|
5476
|
-
});
|
|
5477
|
-
if (selectedRole) {
|
|
5478
|
-
setCardsRole(selectedRole.value);
|
|
5479
|
-
} else {
|
|
5480
|
-
var defaultRole = cardsDetails.cardsRoles.find(function (role) {
|
|
5481
|
-
var splitRoleVal = role.value.split(":");
|
|
5482
|
-
return splitRoleVal[2] === 'card-holder';
|
|
5483
|
-
});
|
|
5484
|
-
if (defaultRole) {
|
|
5485
|
-
setCardsRole(defaultRole.value);
|
|
5486
|
-
}
|
|
5487
|
-
}
|
|
5488
|
-
} else if (isCardsDetailsRendered && isProfile && productAccess.cards) {
|
|
5489
|
-
var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
|
|
5490
|
-
for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
|
|
5491
|
-
var role = _step.value;
|
|
5492
|
-
var splitRoleVal = role.value.split(":");
|
|
5493
|
-
var profileRole = splitRoleVal[2];
|
|
5494
|
-
if (profileRole === targetRole) {
|
|
5495
|
-
setCardsRole(role.value);
|
|
5496
|
-
break;
|
|
5497
|
-
}
|
|
5498
|
-
}
|
|
5499
|
-
}
|
|
5500
|
-
}, [isCardsDetailsRendered, cardsDetails, isProfile, productAccess.cards, isCardsAdmin]);
|
|
5099
|
+
expenseFYI = _useState26[0],
|
|
5100
|
+
setExpenseFYI = _useState26[1];
|
|
5501
5101
|
var asyncSelectRefs = useRef({
|
|
5502
5102
|
emp_level: useRef(null),
|
|
5503
5103
|
entity: useRef(null),
|
|
5504
5104
|
business_unit: useRef(null),
|
|
5505
5105
|
department: useRef(null)
|
|
5506
5106
|
});
|
|
5507
|
-
var
|
|
5508
|
-
errorArray =
|
|
5509
|
-
setErrorArray =
|
|
5510
|
-
var
|
|
5107
|
+
var _useState27 = useState([]),
|
|
5108
|
+
errorArray = _useState27[0],
|
|
5109
|
+
setErrorArray = _useState27[1];
|
|
5110
|
+
var _useState28 = useState({
|
|
5511
5111
|
first_name: '',
|
|
5512
5112
|
last_name: '',
|
|
5513
5113
|
email: '',
|
|
@@ -5537,9 +5137,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5537
5137
|
userTagType: '',
|
|
5538
5138
|
profile_pic: ''
|
|
5539
5139
|
}),
|
|
5540
|
-
errorMsgs =
|
|
5541
|
-
setErrorMsgs =
|
|
5542
|
-
var
|
|
5140
|
+
errorMsgs = _useState28[0],
|
|
5141
|
+
setErrorMsgs = _useState28[1];
|
|
5142
|
+
var _useState29 = useState({
|
|
5543
5143
|
first_name: false,
|
|
5544
5144
|
last_name: false,
|
|
5545
5145
|
email: false,
|
|
@@ -5566,14 +5166,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5566
5166
|
userTagType: false,
|
|
5567
5167
|
profile_pic: false
|
|
5568
5168
|
}),
|
|
5569
|
-
inputChangeLog =
|
|
5570
|
-
updateInputChangeLog =
|
|
5571
|
-
var
|
|
5572
|
-
uploadedFiles =
|
|
5573
|
-
setUploadedFiles =
|
|
5574
|
-
var
|
|
5575
|
-
maxLengthForModal =
|
|
5576
|
-
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];
|
|
5577
5177
|
var defaultAddModalData = {
|
|
5578
5178
|
isOpen: false,
|
|
5579
5179
|
isError: false,
|
|
@@ -5589,9 +5189,9 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5589
5189
|
maxLength: maxLengthForModal,
|
|
5590
5190
|
minLength: 0
|
|
5591
5191
|
};
|
|
5592
|
-
var
|
|
5593
|
-
addModalData =
|
|
5594
|
-
setAddModalData =
|
|
5192
|
+
var _useState32 = useState(defaultAddModalData),
|
|
5193
|
+
addModalData = _useState32[0],
|
|
5194
|
+
setAddModalData = _useState32[1];
|
|
5595
5195
|
var onAddModalClose = function onAddModalClose() {
|
|
5596
5196
|
setAddModalData(_extends({}, defaultAddModalData));
|
|
5597
5197
|
};
|
|
@@ -6002,11 +5602,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6002
5602
|
}, [isTokenVerified]);
|
|
6003
5603
|
useEffect(function () {
|
|
6004
5604
|
if (isRendered === true) {
|
|
6005
|
-
renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
|
|
6006
|
-
if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'cards') {
|
|
6007
|
-
editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
|
|
6008
|
-
}
|
|
6009
|
-
});
|
|
6010
5605
|
setPersonalInfoInput(_extends({}, personalInfoInput, {
|
|
6011
5606
|
country_code: countryCode
|
|
6012
5607
|
}));
|
|
@@ -6128,8 +5723,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6128
5723
|
var products = res.user_product.split('+');
|
|
6129
5724
|
setProductAccess({
|
|
6130
5725
|
travel: products.includes('travel'),
|
|
6131
|
-
expense: products.includes('expense')
|
|
6132
|
-
cards: products.includes('cards')
|
|
5726
|
+
expense: products.includes('expense')
|
|
6133
5727
|
});
|
|
6134
5728
|
if (products.includes('travel')) {
|
|
6135
5729
|
var _res$travel_info, _res$travel_info2, _res$travel_info3, _res$travel_info4, _res$travel_info5, _res$travel_info6;
|
|
@@ -6346,9 +5940,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6346
5940
|
if (employeeInfoInput.skip_manager_id.value !== '') {
|
|
6347
5941
|
employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
|
|
6348
5942
|
}
|
|
6349
|
-
var cardsPayload = {
|
|
6350
|
-
"roles": [cardsRole]
|
|
6351
|
-
};
|
|
6352
5943
|
var payload = {
|
|
6353
5944
|
personalInfoInput: personalInfoInput,
|
|
6354
5945
|
employeeInfoInput: employeeInfoInput,
|
|
@@ -6367,9 +5958,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6367
5958
|
uploadedFiles: uploadedFiles,
|
|
6368
5959
|
filesForDelete: filesForDelete,
|
|
6369
5960
|
profilePicDelete: profilePicDelete,
|
|
6370
|
-
userTagType: userTagType
|
|
6371
|
-
cardsRole: cardsRole,
|
|
6372
|
-
isCardsAdmin: isCardsAdmin
|
|
5961
|
+
userTagType: userTagType
|
|
6373
5962
|
};
|
|
6374
5963
|
if (verifyUserId) {
|
|
6375
5964
|
payload.verifyUserId = verifyUserId;
|
|
@@ -6495,7 +6084,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6495
6084
|
if (_isError) {
|
|
6496
6085
|
setErrorArray(_errorArray);
|
|
6497
6086
|
setErrorMsgs(_errorMsgs);
|
|
6498
|
-
var
|
|
6087
|
+
var _loop = function _loop() {
|
|
6499
6088
|
if (Object.hasOwnProperty.call(_errorMsgs, _key3)) {
|
|
6500
6089
|
if (_errorMsgs[_key3]) {
|
|
6501
6090
|
if (_key3 in passportInfoInput || _key3 in travelPreferenceInfo || _key3 in secureTravelInputInfo) {
|
|
@@ -6515,109 +6104,115 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6515
6104
|
}
|
|
6516
6105
|
};
|
|
6517
6106
|
for (var _key3 in _errorMsgs) {
|
|
6518
|
-
if (
|
|
6107
|
+
if (_loop()) break;
|
|
6519
6108
|
}
|
|
6520
6109
|
}
|
|
6521
|
-
var cardApiflag = false;
|
|
6522
|
-
if (productAccess.cards === false || isCardsAdmin === false) {
|
|
6523
|
-
cardApiflag = false;
|
|
6524
|
-
} else {
|
|
6525
|
-
cardApiflag = true;
|
|
6526
|
-
}
|
|
6527
6110
|
if (!_isError) {
|
|
6528
6111
|
if (isEditMode && editUserId || isProfile) {
|
|
6529
6112
|
dispatch(showLoader());
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
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;
|
|
6537
6127
|
}
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
updateUserApiCall(payload, inputChangeLog);
|
|
6541
|
-
} else {
|
|
6542
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6128
|
+
if (err.contact_country_code) {
|
|
6129
|
+
err.contact_number = err.contact_country_code;
|
|
6543
6130
|
}
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
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
|
+
});
|
|
6552
6167
|
} else {
|
|
6553
6168
|
dispatch(showLoader());
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
headers: {
|
|
6562
|
-
'Content-Type': 'application/json',
|
|
6563
|
-
'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
|
|
6564
|
-
}
|
|
6565
|
-
}).then(function (response) {
|
|
6566
|
-
if (response.status !== 200) {
|
|
6567
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6568
|
-
}
|
|
6569
|
-
})["catch"](function (error) {
|
|
6570
|
-
console.log("errorrr", error);
|
|
6571
|
-
});
|
|
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;
|
|
6572
6176
|
}
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
el.scrollIntoView({
|
|
6598
|
-
behavior: 'smooth',
|
|
6599
|
-
block: 'center'
|
|
6600
|
-
});
|
|
6601
|
-
}, 500);
|
|
6602
|
-
return 1;
|
|
6603
|
-
}
|
|
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;
|
|
6604
6201
|
}
|
|
6605
6202
|
}
|
|
6606
|
-
};
|
|
6607
|
-
for (var _key4 in err) {
|
|
6608
|
-
if (_loop4()) break;
|
|
6609
6203
|
}
|
|
6610
|
-
}
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
|
|
6204
|
+
};
|
|
6205
|
+
for (var _key5 in err) {
|
|
6206
|
+
if (_loop3()) break;
|
|
6614
6207
|
}
|
|
6615
|
-
}
|
|
6616
|
-
|
|
6617
|
-
}
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
}
|
|
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
|
+
});
|
|
6621
6216
|
}
|
|
6622
6217
|
}
|
|
6623
6218
|
return Promise.resolve();
|
|
@@ -6635,8 +6230,8 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6635
6230
|
}
|
|
6636
6231
|
}
|
|
6637
6232
|
} else {
|
|
6638
|
-
var _config$
|
|
6639
|
-
(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);
|
|
6640
6235
|
}
|
|
6641
6236
|
};
|
|
6642
6237
|
var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {
|
|
@@ -6933,6 +6528,74 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6933
6528
|
item: true,
|
|
6934
6529
|
sm: 12,
|
|
6935
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
|
|
6936
6599
|
}, /*#__PURE__*/React.createElement(IUILabel, {
|
|
6937
6600
|
label: "Product access",
|
|
6938
6601
|
description: isProfile ? '' : 'Select at least one product',
|
|
@@ -6949,9 +6612,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6949
6612
|
className: styles.productContainerGap
|
|
6950
6613
|
}, renderFields.products.map(function (p, i) {
|
|
6951
6614
|
p.readOnly = isProfile;
|
|
6952
|
-
if (p.id === 3 && !isCardsAdmin) {
|
|
6953
|
-
p.readOnly = true;
|
|
6954
|
-
}
|
|
6955
6615
|
return /*#__PURE__*/React.createElement(IUIGrid, {
|
|
6956
6616
|
item: true,
|
|
6957
6617
|
sm: 12,
|
|
@@ -7044,19 +6704,6 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
7044
6704
|
isProfile: isProfile,
|
|
7045
6705
|
editUserId: editUserId,
|
|
7046
6706
|
roles: renderFields.expenseRoles
|
|
7047
|
-
}), /*#__PURE__*/React.createElement(IUIDivider, {
|
|
7048
|
-
className: styles.dividerColor
|
|
7049
|
-
}), isCardsDetailsRendered && productAccess && productAccess.cards && /*#__PURE__*/React.createElement(CardsField, {
|
|
7050
|
-
cardsConstants: cardsDetails.cardsConstants,
|
|
7051
|
-
type: "cards",
|
|
7052
|
-
isProfile: isProfile,
|
|
7053
|
-
onRoleChange: function onRoleChange(_ref7) {
|
|
7054
|
-
var _value = _ref7._value;
|
|
7055
|
-
return setCardsRole(_value);
|
|
7056
|
-
},
|
|
7057
|
-
roleValue: cardsRole,
|
|
7058
|
-
roles: cardsDetails.cardsRoles,
|
|
7059
|
-
cardsAdmin: isCardsAdmin
|
|
7060
6707
|
}))) : /*#__PURE__*/React.createElement(VerificationError, {
|
|
7061
6708
|
config: config,
|
|
7062
6709
|
errMsg: hasVerificationError
|
|
@@ -8865,7 +8512,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8865
8512
|
cell: function cell(row) {
|
|
8866
8513
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
8867
8514
|
component: "div"
|
|
8868
|
-
}, 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, {
|
|
8869
8516
|
component: "div",
|
|
8870
8517
|
display: "flex"
|
|
8871
8518
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8878,7 +8525,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8878
8525
|
style: {
|
|
8879
8526
|
whiteSpace: 'nowrap'
|
|
8880
8527
|
}
|
|
8881
|
-
}, "\xA0" + row.products[0].role))
|
|
8528
|
+
}, "\xA0" + row.products[0].role)), row.products[1] && /*#__PURE__*/React.createElement(IUIBox, {
|
|
8882
8529
|
component: "div",
|
|
8883
8530
|
display: "flex"
|
|
8884
8531
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8891,20 +8538,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
|
|
|
8891
8538
|
style: {
|
|
8892
8539
|
whiteSpace: 'nowrap'
|
|
8893
8540
|
}
|
|
8894
|
-
}, "\xA0" + row.products[1].role))
|
|
8895
|
-
component: "div",
|
|
8896
|
-
display: "flex"
|
|
8897
|
-
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8898
|
-
className: clsx(styles$5.rowText, styles$5.textTransform, styles$5.lightColor),
|
|
8899
|
-
style: {
|
|
8900
|
-
whiteSpace: 'nowrap'
|
|
8901
|
-
}
|
|
8902
|
-
}, row.products[2].name + ' / '), /*#__PURE__*/React.createElement(IUITypography, {
|
|
8903
|
-
className: clsx(styles$5.rowText, styles$5.textTransform),
|
|
8904
|
-
style: {
|
|
8905
|
-
whiteSpace: 'nowrap'
|
|
8906
|
-
}
|
|
8907
|
-
}, "\xA0" + row.products[2].role))) : '');
|
|
8541
|
+
}, "\xA0" + row.products[1].role))) : '');
|
|
8908
8542
|
}
|
|
8909
8543
|
}, {
|
|
8910
8544
|
id: 'status',
|