@itilite/iui-user-management 0.2.0 → 0.2.1
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.js +120 -22
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +120 -22
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -405,6 +405,9 @@ var userAddEditUrl = {
|
|
|
405
405
|
},
|
|
406
406
|
airlineList: function airlineList() {
|
|
407
407
|
return "https://serviceearth.iltech.in/api/v1/paginated/airline/";
|
|
408
|
+
},
|
|
409
|
+
rejectUserVerification: function rejectUserVerification(userId) {
|
|
410
|
+
return "api/v1/onboarding/user-signup-reject/" + userId;
|
|
408
411
|
}
|
|
409
412
|
};
|
|
410
413
|
var userListUrl = {
|
|
@@ -1220,6 +1223,51 @@ var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref)
|
|
|
1220
1223
|
return Promise.reject(e);
|
|
1221
1224
|
}
|
|
1222
1225
|
};
|
|
1226
|
+
var commonLoadOptionsUM = function commonLoadOptionsUM(search, loadedOptions, _ref2) {
|
|
1227
|
+
var page = _ref2.page,
|
|
1228
|
+
tabelName = _ref2.tabelName,
|
|
1229
|
+
placeholder = _ref2.placeholder,
|
|
1230
|
+
defaultData = _ref2.defaultData;
|
|
1231
|
+
|
|
1232
|
+
try {
|
|
1233
|
+
return Promise.resolve(_catch(function () {
|
|
1234
|
+
var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
|
|
1235
|
+
return Promise.resolve(api.get(url).then(function (res) {
|
|
1236
|
+
return res.data;
|
|
1237
|
+
})).then(function (response) {
|
|
1238
|
+
var arrList = response.results.filter(function (item) {
|
|
1239
|
+
return item.name !== defaultData;
|
|
1240
|
+
});
|
|
1241
|
+
var mappedValue = arrList.map(function (item) {
|
|
1242
|
+
return {
|
|
1243
|
+
value: item.id,
|
|
1244
|
+
label: item.name
|
|
1245
|
+
};
|
|
1246
|
+
});
|
|
1247
|
+
return {
|
|
1248
|
+
options: mappedValue,
|
|
1249
|
+
hasMore: !!response.next,
|
|
1250
|
+
additional: {
|
|
1251
|
+
page: page + 1,
|
|
1252
|
+
tabelName: tabelName
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
});
|
|
1256
|
+
}, function () {
|
|
1257
|
+
return {
|
|
1258
|
+
options: [],
|
|
1259
|
+
hasMore: false,
|
|
1260
|
+
additional: {
|
|
1261
|
+
page: 1,
|
|
1262
|
+
tabelName: tabelName,
|
|
1263
|
+
placeholder: placeholder
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
}));
|
|
1267
|
+
} catch (e) {
|
|
1268
|
+
return Promise.reject(e);
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1223
1271
|
var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
|
|
1224
1272
|
var page = _ref3.page;
|
|
1225
1273
|
|
|
@@ -1924,12 +1972,12 @@ var addTravelApproverField = function addTravelApproverField() {
|
|
|
1924
1972
|
return new Promise(function (resolve, reject) {
|
|
1925
1973
|
var _travelApprovers = getState().userAddEdit.renderFields.travelApprovers;
|
|
1926
1974
|
var sNo = _travelApprovers.length + 1;
|
|
1927
|
-
var label = "Travel
|
|
1975
|
+
var label = "Travel approver " + sNo;
|
|
1928
1976
|
|
|
1929
1977
|
_travelApprovers.forEach(function (approver) {
|
|
1930
1978
|
if (approver.label === label) {
|
|
1931
1979
|
sNo++;
|
|
1932
|
-
label = "Travel
|
|
1980
|
+
label = "Travel approver " + sNo;
|
|
1933
1981
|
}
|
|
1934
1982
|
});
|
|
1935
1983
|
|
|
@@ -1968,12 +2016,12 @@ var addExpenseApproverField = function addExpenseApproverField() {
|
|
|
1968
2016
|
return new Promise(function (resolve, reject) {
|
|
1969
2017
|
var _expenseApprovers = getState().userAddEdit.renderFields.expenseApprovers;
|
|
1970
2018
|
var sNo = _expenseApprovers.length + 1;
|
|
1971
|
-
var label = "Expense
|
|
2019
|
+
var label = "Expense approver " + sNo;
|
|
1972
2020
|
|
|
1973
2021
|
_expenseApprovers.forEach(function (approver) {
|
|
1974
2022
|
if (approver.label === label) {
|
|
1975
2023
|
sNo++;
|
|
1976
|
-
label = "Expense
|
|
2024
|
+
label = "Expense approver " + sNo;
|
|
1977
2025
|
}
|
|
1978
2026
|
});
|
|
1979
2027
|
|
|
@@ -2285,6 +2333,33 @@ var submitAddModalData = function submitAddModalData(tableName, data) {
|
|
|
2285
2333
|
});
|
|
2286
2334
|
};
|
|
2287
2335
|
};
|
|
2336
|
+
var rejectUserVerification = function rejectUserVerification(userId) {
|
|
2337
|
+
return function (dispatch) {
|
|
2338
|
+
return new Promise(function (resolve, reject) {
|
|
2339
|
+
api$1.get(userAddEditUrl.rejectUserVerification(userId)).then(function (res) {
|
|
2340
|
+
console.log(res);
|
|
2341
|
+
|
|
2342
|
+
if (res.data.status === true) {
|
|
2343
|
+
var _res$data5;
|
|
2344
|
+
|
|
2345
|
+
IUIToastMessageService.sNotify((res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.message) || 'User rejected successfully.');
|
|
2346
|
+
resolve(res.data);
|
|
2347
|
+
} else {
|
|
2348
|
+
var _res$data6;
|
|
2349
|
+
|
|
2350
|
+
IUIToastMessageService.warningNotify((res === null || res === void 0 ? void 0 : (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.message) || 'Opps, Unable to reject user.');
|
|
2351
|
+
reject(res);
|
|
2352
|
+
}
|
|
2353
|
+
})["catch"](function (err) {
|
|
2354
|
+
var _err$response11, _err$response11$data;
|
|
2355
|
+
|
|
2356
|
+
console.log(err);
|
|
2357
|
+
IUIToastMessageService.warningNotify((err === null || err === void 0 ? void 0 : (_err$response11 = err.response) === null || _err$response11 === void 0 ? void 0 : (_err$response11$data = _err$response11.data) === null || _err$response11$data === void 0 ? void 0 : _err$response11$data.message) || 'Opps, Unable to reject user.');
|
|
2358
|
+
reject(err);
|
|
2359
|
+
});
|
|
2360
|
+
});
|
|
2361
|
+
};
|
|
2362
|
+
};
|
|
2288
2363
|
|
|
2289
2364
|
var SHOW_LOADER$1 = 'SHOW_LOADER';
|
|
2290
2365
|
var STOP_LOADER$1 = 'STOP_LOADER';
|
|
@@ -2752,8 +2827,10 @@ var CreditCard = function CreditCard(_ref) {
|
|
|
2752
2827
|
var AddCard = function AddCard(_ref2) {
|
|
2753
2828
|
var pg = _ref2.pg;
|
|
2754
2829
|
|
|
2830
|
+
var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$5.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
|
|
2831
|
+
|
|
2755
2832
|
var handleAddCard = function handleAddCard() {
|
|
2756
|
-
window.location.assign(
|
|
2833
|
+
window.location.assign(_url);
|
|
2757
2834
|
};
|
|
2758
2835
|
|
|
2759
2836
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2954,13 +3031,13 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
2954
3031
|
var rgx = null;
|
|
2955
3032
|
|
|
2956
3033
|
if (type === 'travel') {
|
|
2957
|
-
rgx = /^(travel
|
|
3034
|
+
rgx = /^(travel approver)( )[0-9]*$/i;
|
|
2958
3035
|
} else {
|
|
2959
|
-
rgx = /^(expense
|
|
3036
|
+
rgx = /^(expense approver)( )[0-9]*$/i;
|
|
2960
3037
|
}
|
|
2961
3038
|
|
|
2962
|
-
if (editedLabel.approvers[i].label.match(rgx) && editedLabel.approvers[i].label.toLowerCase() !== type.toLowerCase() + "
|
|
2963
|
-
_errMsg[editedLabel.approvers[i].indexAt] = "Can't update '" + (type === 'travel' ? 'Travel' : 'Expense') + "
|
|
3039
|
+
if (editedLabel.approvers[i].label.match(rgx) && editedLabel.approvers[i].label.toLowerCase() !== type.toLowerCase() + " approver " + (editedLabel.approvers[i].indexAt + 1)) {
|
|
3040
|
+
_errMsg[editedLabel.approvers[i].indexAt] = "Can't update '" + (type === 'travel' ? 'Travel' : 'Expense') + " approver " + (editedLabel.approvers[i].indexAt + 1) + "' to '" + editedLabel.approvers[i].label + "'";
|
|
2964
3041
|
|
|
2965
3042
|
if (!hasError) {
|
|
2966
3043
|
hasError = true;
|
|
@@ -3075,10 +3152,10 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
3075
3152
|
return null;
|
|
3076
3153
|
}
|
|
3077
3154
|
|
|
3078
|
-
if (p.label.toLowerCase() === type + "
|
|
3155
|
+
if (p.label.toLowerCase() === type + " approver " + (i + 1)) {
|
|
3079
3156
|
p.secondaryLabel = '';
|
|
3080
3157
|
} else {
|
|
3081
|
-
p.secondaryLabel = type + "
|
|
3158
|
+
p.secondaryLabel = type + " approver " + (i + 1);
|
|
3082
3159
|
}
|
|
3083
3160
|
|
|
3084
3161
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
|
|
@@ -3194,7 +3271,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
|
|
|
3194
3271
|
className: styles.fieldMargin
|
|
3195
3272
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
|
|
3196
3273
|
defaultValue: p.label,
|
|
3197
|
-
label: (type === 'travel' ? 'Travel' : 'Expense') + "
|
|
3274
|
+
label: (type === 'travel' ? 'Travel' : 'Expense') + " approver " + (i + 1),
|
|
3198
3275
|
className: styles.inputWidth,
|
|
3199
3276
|
id: type + '_' + p.sequence,
|
|
3200
3277
|
name: type + '_' + p.sequence,
|
|
@@ -5880,7 +5957,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5880
5957
|
userTagType: userTagType
|
|
5881
5958
|
};
|
|
5882
5959
|
|
|
5883
|
-
if (verifyUserId) {
|
|
5960
|
+
if (verifyUserId && isILadmin) {
|
|
5884
5961
|
payload.verifyUserId = verifyUserId;
|
|
5885
5962
|
}
|
|
5886
5963
|
|
|
@@ -6200,10 +6277,10 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6200
6277
|
window.location.href = config.routes.profile.redirectUrl.cancel;
|
|
6201
6278
|
}
|
|
6202
6279
|
}
|
|
6203
|
-
} else if (verifyUserId) {
|
|
6280
|
+
} else if (verifyUserId && isILadmin) {
|
|
6204
6281
|
var _config$routes4, _config$routes4$signu, _config$routes4$signu2;
|
|
6205
6282
|
|
|
6206
|
-
(config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$signu = _config$routes4.signupRequest) === null || _config$routes4$signu === void 0 ? void 0 : (_config$routes4$signu2 = _config$routes4$signu.list) === null || _config$routes4$signu2 === void 0 ? void 0 : _config$routes4$signu2.path) &&
|
|
6283
|
+
(config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$signu = _config$routes4.signupRequest) === null || _config$routes4$signu === void 0 ? void 0 : (_config$routes4$signu2 = _config$routes4$signu.list) === null || _config$routes4$signu2 === void 0 ? void 0 : _config$routes4$signu2.path) && window.location.assign(config.routes.signupRequest.list.path);
|
|
6207
6284
|
} else {
|
|
6208
6285
|
var _config$routes5, _config$routes5$users, _config$routes5$users2;
|
|
6209
6286
|
|
|
@@ -6228,7 +6305,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6228
6305
|
};
|
|
6229
6306
|
|
|
6230
6307
|
var getUserInfoForVerification = function getUserInfoForVerification() {
|
|
6231
|
-
if (verifyUserId) {
|
|
6308
|
+
if (verifyUserId && isILadmin) {
|
|
6232
6309
|
dispatch(showLoader());
|
|
6233
6310
|
dispatch(verifyUserInfo(verifyUserId)).then(function (res) {
|
|
6234
6311
|
setPersonalInfoInput(function (prevState) {
|
|
@@ -6330,6 +6407,19 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6330
6407
|
}
|
|
6331
6408
|
};
|
|
6332
6409
|
|
|
6410
|
+
var handleSignUpRequestRejection = function handleSignUpRequestRejection() {
|
|
6411
|
+
if (verifyUserId && isILadmin) {
|
|
6412
|
+
dispatch(showLoader());
|
|
6413
|
+
dispatch(rejectUserVerification(verifyUserId)).then(function (res) {
|
|
6414
|
+
setTimeout(function () {
|
|
6415
|
+
window.location.assign(config.routes.signupRequest.list.path);
|
|
6416
|
+
}, 1500);
|
|
6417
|
+
})["finally"](function () {
|
|
6418
|
+
dispatch(stopLoader());
|
|
6419
|
+
});
|
|
6420
|
+
}
|
|
6421
|
+
};
|
|
6422
|
+
|
|
6333
6423
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6334
6424
|
component: "div",
|
|
6335
6425
|
className: styles.UUIUserManagementAddEdit
|
|
@@ -6346,7 +6436,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6346
6436
|
className: styles.breadcrumb
|
|
6347
6437
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIBreadCrumb, {
|
|
6348
6438
|
breadCrumbs: [{
|
|
6349
|
-
href: verifyUserId ? config.routes.signupRequest.list.path : config.routes.users.list.path,
|
|
6439
|
+
href: verifyUserId && isILadmin ? config.routes.signupRequest.list.path : config.routes.users.list.path,
|
|
6350
6440
|
label: 'Users',
|
|
6351
6441
|
hasLink: true
|
|
6352
6442
|
}]
|
|
@@ -6381,7 +6471,14 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6381
6471
|
type: "contained",
|
|
6382
6472
|
onClick: formSubmitHandler,
|
|
6383
6473
|
disabled: isPageLoading || productAccess.travel === false && productAccess.expense === false || !!doesFormHasError()
|
|
6384
|
-
}))
|
|
6474
|
+
})), verifyUserId && isILadmin ? /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6475
|
+
component: "div",
|
|
6476
|
+
className: clsx(styles.buttonSingle, styles.buttonLeft)
|
|
6477
|
+
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
6478
|
+
buttonText: "Reject",
|
|
6479
|
+
type: "outlined",
|
|
6480
|
+
onClick: handleSignUpRequestRejection
|
|
6481
|
+
})) : null))), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
6385
6482
|
component: "div",
|
|
6386
6483
|
marginTop: "8rem",
|
|
6387
6484
|
flexDirection: "column"
|
|
@@ -9223,7 +9320,7 @@ function MoveUserDialog(_ref) {
|
|
|
9223
9320
|
name: name,
|
|
9224
9321
|
isMove: isMove,
|
|
9225
9322
|
customSelectHandler: customSelectHandler,
|
|
9226
|
-
loadOption:
|
|
9323
|
+
loadOption: commonLoadOptionsUM,
|
|
9227
9324
|
isError: isError,
|
|
9228
9325
|
errorMsg: "Please select " + (name === null || name === void 0 ? void 0 : name.toLowerCase()) + ".",
|
|
9229
9326
|
placeHolderCheck: name !== undefined && name === ''
|
|
@@ -9536,9 +9633,10 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9536
9633
|
var handleEditPanel = function handleEditPanel(data) {
|
|
9537
9634
|
if (dataList) {
|
|
9538
9635
|
var payload = {
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9636
|
+
rows: [{
|
|
9637
|
+
id: dialogData.data.id,
|
|
9638
|
+
name: dataList
|
|
9639
|
+
}]
|
|
9542
9640
|
};
|
|
9543
9641
|
var message = title + " updated successfully.";
|
|
9544
9642
|
handleApiCall(editRecord, payload, message, 'edit');
|