@itilite/iui-user-management 0.3.12 → 0.3.14
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 +5 -0
- package/dist/index.js +73 -31
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +73 -31
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/dist/style.css.map +0 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
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, IUIDropdownButton } 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
|
+
import axios from 'axios';
|
|
4
5
|
import AddIcon$1 from '@material-ui/icons/Add';
|
|
5
6
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
6
|
-
import axios from 'axios';
|
|
7
7
|
import { useDispatch, useSelector, Provider } from 'react-redux';
|
|
8
8
|
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
|
9
9
|
import thunk from 'redux-thunk';
|
|
@@ -158,24 +158,52 @@ function _catch(body, recover) {
|
|
|
158
158
|
|
|
159
159
|
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"};
|
|
160
160
|
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
function toVal(mix) {
|
|
162
|
+
var k,
|
|
163
|
+
y,
|
|
164
|
+
str = '';
|
|
165
|
+
|
|
166
|
+
if (typeof mix === 'string' || typeof mix === 'number') {
|
|
167
|
+
str += mix;
|
|
168
|
+
} else if (typeof mix === 'object') {
|
|
169
|
+
if (Array.isArray(mix)) {
|
|
170
|
+
for (k = 0; k < mix.length; k++) {
|
|
171
|
+
if (mix[k]) {
|
|
172
|
+
if (y = toVal(mix[k])) {
|
|
173
|
+
str && (str += ' ');
|
|
174
|
+
str += y;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
for (k in mix) {
|
|
180
|
+
if (mix[k]) {
|
|
181
|
+
str && (str += ' ');
|
|
182
|
+
str += k;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
169
186
|
}
|
|
170
|
-
|
|
187
|
+
|
|
188
|
+
return str;
|
|
171
189
|
}
|
|
172
190
|
|
|
173
191
|
function clsx() {
|
|
174
|
-
|
|
175
|
-
|
|
192
|
+
var i = 0,
|
|
193
|
+
tmp,
|
|
194
|
+
x,
|
|
195
|
+
str = '';
|
|
196
|
+
|
|
197
|
+
while (i < arguments.length) {
|
|
198
|
+
if (tmp = arguments[i++]) {
|
|
199
|
+
if (x = toVal(tmp)) {
|
|
200
|
+
str && (str += ' ');
|
|
201
|
+
str += x;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
176
204
|
}
|
|
177
205
|
|
|
178
|
-
return
|
|
206
|
+
return str;
|
|
179
207
|
}
|
|
180
208
|
|
|
181
209
|
var GetInputType = React.forwardRef(function (props, ref) {
|
|
@@ -467,6 +495,7 @@ var userPanelUrl = {
|
|
|
467
495
|
}
|
|
468
496
|
};
|
|
469
497
|
|
|
498
|
+
var IUILocalStorageService$1 = services.IUILocalStorageService;
|
|
470
499
|
var api = configs.api;
|
|
471
500
|
var NAoptionConfig = {
|
|
472
501
|
option: {
|
|
@@ -711,7 +740,12 @@ var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
|
711
740
|
try {
|
|
712
741
|
return Promise.resolve(_catch(function () {
|
|
713
742
|
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
714
|
-
|
|
743
|
+
var token = IUILocalStorageService$1.getAccessToken();
|
|
744
|
+
return Promise.resolve(axios.get(url, {
|
|
745
|
+
headers: {
|
|
746
|
+
Authorization: 'Bearer ' + token
|
|
747
|
+
}
|
|
748
|
+
}).then(function (res) {
|
|
715
749
|
return res.data;
|
|
716
750
|
})).then(function (response) {
|
|
717
751
|
return Promise.resolve(response.results.map(function (item) {
|
|
@@ -783,12 +817,12 @@ var SET_STATIC_FIELDS_VISIBILITY = 'SET_STATIC_FIELDS_VISIBILITY';
|
|
|
783
817
|
var SET_PAYMENT_DETAILS = 'SET_PAYMENT_DETAILS';
|
|
784
818
|
|
|
785
819
|
var env$1 = configs.env;
|
|
786
|
-
var IUILocalStorageService$
|
|
820
|
+
var IUILocalStorageService$2 = services.IUILocalStorageService;
|
|
787
821
|
var formatCreateUserPayload = function formatCreateUserPayload(payload) {
|
|
788
822
|
var _payload$employeeInfo, _payload$employeeInfo2, _payload$employeeInfo3, _payload$employeeInfo4, _payload$employeeInfo5, _payload$employeeInfo6, _payload$employeeInfo7, _payload$employeeInfo8, _payload$employeeInfo9, _payload$employeeInfo10;
|
|
789
823
|
|
|
790
824
|
var res = {
|
|
791
|
-
company_id: +IUILocalStorageService$
|
|
825
|
+
company_id: +IUILocalStorageService$2.getCompanyId(),
|
|
792
826
|
first_name: payload.personalInfoInput.first_name,
|
|
793
827
|
last_name: payload.personalInfoInput.last_name,
|
|
794
828
|
email: payload.personalInfoInput.email,
|
|
@@ -1166,7 +1200,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
|
|
|
1166
1200
|
|
|
1167
1201
|
var api$1 = configs.api;
|
|
1168
1202
|
var IUIToastMessageService = services.IUIToastMessageService,
|
|
1169
|
-
IUILocalStorageService$
|
|
1203
|
+
IUILocalStorageService$3 = services.IUILocalStorageService;
|
|
1170
1204
|
var showLoader = function showLoader() {
|
|
1171
1205
|
return {
|
|
1172
1206
|
type: SHOW_LOADER
|
|
@@ -1537,7 +1571,7 @@ var deletePaymentCard = function deletePaymentCard(payload) {
|
|
|
1537
1571
|
dispatch(showLoader());
|
|
1538
1572
|
axios["delete"](userAddEditUrl.deletePaymentCard(payload.pmId, payload.vendorId), {
|
|
1539
1573
|
headers: {
|
|
1540
|
-
Authorization: 'Bearer ' + IUILocalStorageService$
|
|
1574
|
+
Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
|
|
1541
1575
|
}
|
|
1542
1576
|
}).then(function (res) {
|
|
1543
1577
|
if (res.data.status) {
|
|
@@ -1570,7 +1604,7 @@ var setDefaultPaymentCard = function setDefaultPaymentCard(payload) {
|
|
|
1570
1604
|
dispatch(showLoader());
|
|
1571
1605
|
axios.put(userAddEditUrl.setDefaultCard(), payload, {
|
|
1572
1606
|
headers: {
|
|
1573
|
-
Authorization: 'Bearer ' + IUILocalStorageService$
|
|
1607
|
+
Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
|
|
1574
1608
|
}
|
|
1575
1609
|
}).then(function (res) {
|
|
1576
1610
|
if (res.data.status) {
|
|
@@ -1786,6 +1820,7 @@ var STOP_LOADER$2 = 'STOP_LOADER';
|
|
|
1786
1820
|
var OPEN_DIALOG = 'OPEN_DIALOG';
|
|
1787
1821
|
var CLOSE_DIALOG = 'CLOSE_DIALOG';
|
|
1788
1822
|
var FETCH_USERPANEL_DATA = 'FETCH_USERPANEL_DATA';
|
|
1823
|
+
var UNASSIGNED_USERS = 'Not assigned';
|
|
1789
1824
|
|
|
1790
1825
|
var api$3 = configs.api;
|
|
1791
1826
|
var IUIToastMessageService$2 = services.IUIToastMessageService;
|
|
@@ -1904,7 +1939,7 @@ var SET_VERIFICATION_ERROR = 'SET_VERIFICATION_ERROR';
|
|
|
1904
1939
|
var api$4 = configs.api,
|
|
1905
1940
|
env$2 = configs.env;
|
|
1906
1941
|
var common = utilUrls.common;
|
|
1907
|
-
var IUILocalStorageService$
|
|
1942
|
+
var IUILocalStorageService$4 = services.IUILocalStorageService;
|
|
1908
1943
|
var setTokenResponse = function setTokenResponse(payload) {
|
|
1909
1944
|
return {
|
|
1910
1945
|
type: VERIFY_ACCESS_TOKEN,
|
|
@@ -1926,7 +1961,7 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1926
1961
|
return new Promise(function (resolve, reject) {
|
|
1927
1962
|
dispatch(setVerificationError(false));
|
|
1928
1963
|
api$4.post(common.verifyToken(), {
|
|
1929
|
-
client_id: +IUILocalStorageService$
|
|
1964
|
+
client_id: +IUILocalStorageService$4.getClientId() || null,
|
|
1930
1965
|
product: env$2.isExpense() ? 'expense' : 'travel'
|
|
1931
1966
|
}).then(function (res) {
|
|
1932
1967
|
if (res.data.status === true) {
|
|
@@ -1937,14 +1972,14 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1937
1972
|
}
|
|
1938
1973
|
|
|
1939
1974
|
if (env$2.isProfilePage()) {
|
|
1940
|
-
IUILocalStorageService$
|
|
1975
|
+
IUILocalStorageService$4.setCompanyId(res.data.company);
|
|
1941
1976
|
dispatch(setTokenResponse(res.data));
|
|
1942
1977
|
dispatch(setVerificationError(false));
|
|
1943
1978
|
|
|
1944
1979
|
if (env$2.isExpense()) {
|
|
1945
|
-
IUILocalStorageService$
|
|
1980
|
+
IUILocalStorageService$4.setRole('submitter');
|
|
1946
1981
|
} else {
|
|
1947
|
-
IUILocalStorageService$
|
|
1982
|
+
IUILocalStorageService$4.setRole('traveler');
|
|
1948
1983
|
}
|
|
1949
1984
|
|
|
1950
1985
|
resolve();
|
|
@@ -1952,8 +1987,8 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
|
|
|
1952
1987
|
} else {
|
|
1953
1988
|
for (var index = 0; index < res.data.applicable_role.length; index++) {
|
|
1954
1989
|
if (roleCanAccess.includes(res.data.applicable_role[index])) {
|
|
1955
|
-
IUILocalStorageService$
|
|
1956
|
-
IUILocalStorageService$
|
|
1990
|
+
IUILocalStorageService$4.setCompanyId(res.data.company);
|
|
1991
|
+
IUILocalStorageService$4.setRole(res.data.applicable_role[index]);
|
|
1957
1992
|
dispatch(setTokenResponse(res.data));
|
|
1958
1993
|
dispatch(setVerificationError(false));
|
|
1959
1994
|
resolve();
|
|
@@ -2108,7 +2143,7 @@ var editCustomFieldLabel = function editCustomFieldLabel(payload) {
|
|
|
2108
2143
|
};
|
|
2109
2144
|
};
|
|
2110
2145
|
|
|
2111
|
-
var IUILocalStorageService$
|
|
2146
|
+
var IUILocalStorageService$5 = services.IUILocalStorageService;
|
|
2112
2147
|
var env$3 = configs.env;
|
|
2113
2148
|
|
|
2114
2149
|
var CreditCard = function CreditCard(_ref) {
|
|
@@ -2176,7 +2211,7 @@ var CreditCard = function CreditCard(_ref) {
|
|
|
2176
2211
|
var AddCard = function AddCard(_ref2) {
|
|
2177
2212
|
var pg = _ref2.pg;
|
|
2178
2213
|
|
|
2179
|
-
var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$
|
|
2214
|
+
var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$5.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
|
|
2180
2215
|
|
|
2181
2216
|
var handleAddCard = function handleAddCard() {
|
|
2182
2217
|
window.location.assign(_url);
|
|
@@ -4105,6 +4140,12 @@ var reducer$2 = function reducer(state, action) {
|
|
|
4105
4140
|
switch (action.type) {
|
|
4106
4141
|
case FETCH_USERPANEL_DATA:
|
|
4107
4142
|
{
|
|
4143
|
+
action.payload.previous === null && action.payload.results.unshift({
|
|
4144
|
+
code: UNASSIGNED_USERS,
|
|
4145
|
+
company: 4,
|
|
4146
|
+
name: UNASSIGNED_USERS,
|
|
4147
|
+
no_of_users: action.payload.unassigned_users
|
|
4148
|
+
});
|
|
4108
4149
|
return _extends({}, state, {
|
|
4109
4150
|
userPanelData: action.payload
|
|
4110
4151
|
});
|
|
@@ -9215,7 +9256,7 @@ function Header(props) {
|
|
|
9215
9256
|
})));
|
|
9216
9257
|
}
|
|
9217
9258
|
|
|
9218
|
-
var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV"};
|
|
9259
|
+
var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sidebar__navlinks":"_29KVG","sidebar__navlinks-title":"_2Eg7m","MuiListItem-button":"_3yWwI","Mui-selected":"_3Ou88","buttonWidth":"_13tv0","onBoardText":"_HUoW-","iconStyle":"_3k0Fb","iconLayout":"_v3GT2","baseAlert":"_12zY5","headingWrapper":"_20Qv9","pageHeader":"_36au5","description":"_tULrl","headerText":"_3W_ZV","tableContainer":"_3xdGF"};
|
|
9219
9260
|
|
|
9220
9261
|
function Listview(_ref) {
|
|
9221
9262
|
var data = _ref.data,
|
|
@@ -9257,7 +9298,7 @@ function Listview(_ref) {
|
|
|
9257
9298
|
label: 'Actions',
|
|
9258
9299
|
width: '10%',
|
|
9259
9300
|
cell: function cell(row) {
|
|
9260
|
-
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
9301
|
+
return row.code !== UNASSIGNED_USERS && /*#__PURE__*/React.createElement(IUIBox, {
|
|
9261
9302
|
display: "flex"
|
|
9262
9303
|
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
9263
9304
|
buttonText: "Edit",
|
|
@@ -9281,7 +9322,8 @@ function Listview(_ref) {
|
|
|
9281
9322
|
}
|
|
9282
9323
|
}];
|
|
9283
9324
|
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9284
|
-
p: 3
|
|
9325
|
+
p: 3,
|
|
9326
|
+
className: data !== null && data !== void 0 && data.results && data.results.length > 0 && data.results[0].code === UNASSIGNED_USERS ? styles$7.tableContainer : ''
|
|
9285
9327
|
}, /*#__PURE__*/React.createElement(IUITable, {
|
|
9286
9328
|
searchHide: true,
|
|
9287
9329
|
hasFilter: true,
|