@itilite/iui-user-management 0.1.18 → 0.2.0
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 +680 -543
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +681 -544
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var iuistyles = require('@itilite/iuistyles');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var React__default = _interopDefault(React);
|
|
6
6
|
var utils = require('@itilite/utils');
|
|
7
|
-
var axios = _interopDefault(require('axios'));
|
|
8
7
|
var moment = _interopDefault(require('moment'));
|
|
8
|
+
var axios = _interopDefault(require('axios'));
|
|
9
9
|
var AddIcon$1 = _interopDefault(require('@material-ui/icons/Add'));
|
|
10
10
|
var DeleteIcon = _interopDefault(require('@material-ui/icons/Delete'));
|
|
11
11
|
var reactRedux = require('react-redux');
|
|
@@ -181,6 +181,186 @@ function clsx() {
|
|
|
181
181
|
return n;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
function GetInputType(_ref) {
|
|
185
|
+
var _p = _ref._p,
|
|
186
|
+
_ref$inputState = _ref.inputState,
|
|
187
|
+
inputState = _ref$inputState === void 0 ? {} : _ref$inputState,
|
|
188
|
+
_ref$customHandler = _ref.customHandler,
|
|
189
|
+
customHandler = _ref$customHandler === void 0 ? function () {} : _ref$customHandler,
|
|
190
|
+
_ref$dropdownList = _ref.dropdownList,
|
|
191
|
+
dropdownList = _ref$dropdownList === void 0 ? {} : _ref$dropdownList,
|
|
192
|
+
_ref$dateFormat = _ref.dateFormat,
|
|
193
|
+
dateFormat = _ref$dateFormat === void 0 ? 'dd MMM yyyy' : _ref$dateFormat,
|
|
194
|
+
_ref$errorArray = _ref.errorArray,
|
|
195
|
+
errorArray = _ref$errorArray === void 0 ? [] : _ref$errorArray,
|
|
196
|
+
_ref$errorMsg = _ref.errorMsg,
|
|
197
|
+
errorMsg = _ref$errorMsg === void 0 ? '' : _ref$errorMsg,
|
|
198
|
+
_ref$showNaOption = _ref.showNaOption,
|
|
199
|
+
showNaOption = _ref$showNaOption === void 0 ? false : _ref$showNaOption;
|
|
200
|
+
|
|
201
|
+
switch (_p.type) {
|
|
202
|
+
case 'input':
|
|
203
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIInput, {
|
|
204
|
+
label: _p.label,
|
|
205
|
+
secondaryLabel: _p.secondaryLabel,
|
|
206
|
+
fullWidth: _p.fullWidth,
|
|
207
|
+
name: _p.name,
|
|
208
|
+
id: _p.name,
|
|
209
|
+
defaultValue: inputState[_p.name],
|
|
210
|
+
customHandler: customHandler,
|
|
211
|
+
placeholder: _p.placeholder,
|
|
212
|
+
validation: _p.validation,
|
|
213
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
214
|
+
errorMsg: errorMsg,
|
|
215
|
+
required: _p.required,
|
|
216
|
+
readOnly: _p.readOnly,
|
|
217
|
+
hasInfoIcon: !!_p.tooltip,
|
|
218
|
+
tooltipText: _p.tooltip,
|
|
219
|
+
disableText: _p.disableText
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
case 'datepicker':
|
|
223
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
224
|
+
label: _p.label,
|
|
225
|
+
required: _p.required
|
|
226
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIDatePicker, {
|
|
227
|
+
label: _p.label,
|
|
228
|
+
fullWidth: _p.fullWidth,
|
|
229
|
+
hasIcon: _p.hasIcon,
|
|
230
|
+
size: _p.size,
|
|
231
|
+
name: _p.name,
|
|
232
|
+
id: _p.name,
|
|
233
|
+
dateValue: inputState[_p.name],
|
|
234
|
+
customHandler: customHandler,
|
|
235
|
+
displayDateType: dateFormat,
|
|
236
|
+
placeholder: dateFormat.toUpperCase(),
|
|
237
|
+
maxDate: _p.maxDate,
|
|
238
|
+
minDate: _p.minDate,
|
|
239
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
240
|
+
errorMsg: errorMsg,
|
|
241
|
+
disabled: _p.readOnly,
|
|
242
|
+
hasInfoIcon: !!_p.tooltip,
|
|
243
|
+
tooltipText: _p.tooltip,
|
|
244
|
+
required: _p.required,
|
|
245
|
+
disableText: _p.disableText
|
|
246
|
+
}));
|
|
247
|
+
|
|
248
|
+
case 'select':
|
|
249
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUISelect, {
|
|
250
|
+
label: _p.label,
|
|
251
|
+
fullWidth: _p.fullWidth,
|
|
252
|
+
list: dropdownList[_p.name],
|
|
253
|
+
valueKey: "name",
|
|
254
|
+
required: _p.required,
|
|
255
|
+
name: _p.name,
|
|
256
|
+
id: _p.name,
|
|
257
|
+
value: inputState[_p.name],
|
|
258
|
+
customSelectHandler: customHandler,
|
|
259
|
+
menuItemTitle: _p.placeholder,
|
|
260
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
261
|
+
errorMsg: errorMsg,
|
|
262
|
+
readOnly: _p.readOnly,
|
|
263
|
+
hasInfoIcon: !!_p.tooltip,
|
|
264
|
+
tooltipText: _p.tooltip,
|
|
265
|
+
disableText: _p.disableText
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
case 'phone':
|
|
269
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
270
|
+
label: _p.label,
|
|
271
|
+
required: _p.required
|
|
272
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIPhone, {
|
|
273
|
+
list: dropdownList[_p.name],
|
|
274
|
+
name: _p.name,
|
|
275
|
+
id: _p.name,
|
|
276
|
+
value: inputState[_p.name],
|
|
277
|
+
required: _p.required,
|
|
278
|
+
selectedCountryOverride: inputState.country_code,
|
|
279
|
+
customHandler: customHandler,
|
|
280
|
+
validation: _p.validation,
|
|
281
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
282
|
+
errorMsg: errorMsg,
|
|
283
|
+
readOnly: _p.readOnly,
|
|
284
|
+
hasInfoIcon: !!_p.tooltip,
|
|
285
|
+
tooltipText: _p.tooltip
|
|
286
|
+
}));
|
|
287
|
+
|
|
288
|
+
case 'checkbox':
|
|
289
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUICheckboxButton, {
|
|
290
|
+
label: _p.label,
|
|
291
|
+
isCheckbox: true,
|
|
292
|
+
customHandler: customHandler,
|
|
293
|
+
checkboxFlag: inputState[_p.name],
|
|
294
|
+
disabled: _p.readOnly,
|
|
295
|
+
hasInfoIcon: !!_p.tooltip,
|
|
296
|
+
tooltipText: _p.tooltip,
|
|
297
|
+
id: _p.name,
|
|
298
|
+
disableText: _p.disableText
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
case 'file':
|
|
302
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, null, /*#__PURE__*/React__default.createElement(iuistyles.IUILabel, {
|
|
303
|
+
label: _p.label,
|
|
304
|
+
required: _p.required,
|
|
305
|
+
description: _p.description,
|
|
306
|
+
hasInfoIcon: !!_p.tooltip,
|
|
307
|
+
tooltipText: _p.tooltip
|
|
308
|
+
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIFileUpload, {
|
|
309
|
+
multiple: _p.multiple,
|
|
310
|
+
title: _p.title,
|
|
311
|
+
fileType: _p.fileType,
|
|
312
|
+
name: _p.name,
|
|
313
|
+
id: _p.name,
|
|
314
|
+
customHandler: customHandler,
|
|
315
|
+
value: inputState[_p.name],
|
|
316
|
+
maxFiles: _p.maxNoFiles,
|
|
317
|
+
maxFileSize: _p.fileSize,
|
|
318
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
319
|
+
errorMsg: errorMsg,
|
|
320
|
+
readOnly: _p.readOnly,
|
|
321
|
+
hasInfoIcon: !!_p.tooltip,
|
|
322
|
+
tooltipText: _p.tooltip,
|
|
323
|
+
disableText: _p.disableText,
|
|
324
|
+
buttonType: _p.buttonType
|
|
325
|
+
}));
|
|
326
|
+
|
|
327
|
+
case 'async_select':
|
|
328
|
+
return /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
|
|
329
|
+
id: _p.name,
|
|
330
|
+
additional: {
|
|
331
|
+
page: 1,
|
|
332
|
+
tabelName: _p.tabelName,
|
|
333
|
+
product: _p.product,
|
|
334
|
+
placeholder: _p.placeholder,
|
|
335
|
+
userId: _p.editUserId,
|
|
336
|
+
selectCTA: _p.selectCTA,
|
|
337
|
+
showNaOption: showNaOption
|
|
338
|
+
},
|
|
339
|
+
label: _p.label,
|
|
340
|
+
secondaryLabel: _p.secondaryLabel,
|
|
341
|
+
title: _p.title,
|
|
342
|
+
value: inputState[_p.name],
|
|
343
|
+
name: _p.name,
|
|
344
|
+
customSelectHandler: customHandler,
|
|
345
|
+
inputType: _p.inputType,
|
|
346
|
+
loadOption: _p.loadOption,
|
|
347
|
+
isError: errorArray.indexOf(_p.name) !== -1,
|
|
348
|
+
errorMsg: errorMsg,
|
|
349
|
+
required: _p.required,
|
|
350
|
+
readOnly: _p.readOnly,
|
|
351
|
+
placeHolderCheck: inputState[_p.name] !== undefined && inputState[_p.name].value === '',
|
|
352
|
+
hasInfoIcon: !!_p.tooltip,
|
|
353
|
+
tooltipText: _p.tooltip,
|
|
354
|
+
disableText: _p.disableText,
|
|
355
|
+
selectCTA: _p.selectCTA,
|
|
356
|
+
clearCache: _p.clearCache
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
default:
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
184
364
|
var env = utils.configs.env;
|
|
185
365
|
var IUILocalStorageService = utils.services.IUILocalStorageService;
|
|
186
366
|
var userAddEditUrl = {
|
|
@@ -275,264 +455,28 @@ var userPanelUrl = {
|
|
|
275
455
|
deleteUnit: function deleteUnit(tableName) {
|
|
276
456
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?action=delete&table=" + tableName;
|
|
277
457
|
},
|
|
278
|
-
getUnit: function getUnit(tableName, length) {
|
|
279
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length;
|
|
458
|
+
getUnit: function getUnit(tableName, length, sort) {
|
|
459
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&order=" + sort;
|
|
280
460
|
},
|
|
281
|
-
getPaginationUnit: function getPaginationUnit(tableName, length, page) {
|
|
282
|
-
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page;
|
|
461
|
+
getPaginationUnit: function getPaginationUnit(tableName, length, page, sort) {
|
|
462
|
+
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&order=" + sort;
|
|
283
463
|
},
|
|
284
464
|
moveUnit: function moveUnit() {
|
|
285
465
|
return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
|
|
286
466
|
}
|
|
287
467
|
};
|
|
288
468
|
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
|
|
301
|
-
return Promise.resolve(api.get(url).then(function (res) {
|
|
302
|
-
return res.data;
|
|
303
|
-
})).then(function (response) {
|
|
304
|
-
var mappedValue = response.results.map(function (item) {
|
|
305
|
-
return {
|
|
306
|
-
value: item.id,
|
|
307
|
-
label: item.name
|
|
308
|
-
};
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
if (showNaOption && page === 1 && NAoptionConfig.applyFor.includes(tabelName)) {
|
|
312
|
-
mappedValue.unshift(NAoptionConfig.option);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (response.next === null && selectCTA) {
|
|
316
|
-
mappedValue.push({
|
|
317
|
-
value: selectCTA.value,
|
|
318
|
-
label: ''
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return {
|
|
323
|
-
options: mappedValue,
|
|
324
|
-
hasMore: !!response.next,
|
|
325
|
-
additional: {
|
|
326
|
-
page: page + 1,
|
|
327
|
-
tabelName: tabelName,
|
|
328
|
-
placeholder: placeholder,
|
|
329
|
-
selectCTA: selectCTA
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
});
|
|
333
|
-
}, function () {
|
|
334
|
-
return {
|
|
335
|
-
options: [],
|
|
336
|
-
hasMore: false,
|
|
337
|
-
additional: {
|
|
338
|
-
page: 1,
|
|
339
|
-
tabelName: tabelName,
|
|
340
|
-
placeholder: placeholder,
|
|
341
|
-
selectCTA: selectCTA
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
}));
|
|
345
|
-
} catch (e) {
|
|
346
|
-
return Promise.reject(e);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
|
|
350
|
-
var page = _ref3.page;
|
|
351
|
-
|
|
352
|
-
try {
|
|
353
|
-
return Promise.resolve(_catch(function () {
|
|
354
|
-
return Promise.resolve(api.get(userAddEditUrl.currencyCode() + "&search=" + search + "&page=" + page).then(function (res) {
|
|
355
|
-
return res.data;
|
|
356
|
-
})).then(function (response) {
|
|
357
|
-
var mappedValue = response.results.map(function (item) {
|
|
358
|
-
return {
|
|
359
|
-
value: item.currency_code,
|
|
360
|
-
label: item.currency_code
|
|
361
|
-
};
|
|
362
|
-
});
|
|
363
|
-
return {
|
|
364
|
-
options: mappedValue,
|
|
365
|
-
hasMore: !!response.next,
|
|
366
|
-
additional: {
|
|
367
|
-
page: page + 1
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
});
|
|
371
|
-
}, function () {
|
|
372
|
-
return {
|
|
373
|
-
options: [],
|
|
374
|
-
hasMore: false,
|
|
375
|
-
additional: {
|
|
376
|
-
page: 1
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
}));
|
|
380
|
-
} catch (e) {
|
|
381
|
-
return Promise.reject(e);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
385
|
-
var page = _ref4.page,
|
|
386
|
-
product = _ref4.product,
|
|
387
|
-
userId = _ref4.userId,
|
|
388
|
-
placeholder = _ref4.placeholder;
|
|
389
|
-
|
|
390
|
-
try {
|
|
391
|
-
return Promise.resolve(_catch(function () {
|
|
392
|
-
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
393
|
-
return res.data;
|
|
394
|
-
})).then(function (response) {
|
|
395
|
-
var mappedValue = response.results.map(function (item) {
|
|
396
|
-
return {
|
|
397
|
-
value: item.approver,
|
|
398
|
-
label: item.approver
|
|
399
|
-
};
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
if (page === 1) {
|
|
403
|
-
var placeholderLbl = {
|
|
404
|
-
value: '',
|
|
405
|
-
label: placeholder
|
|
406
|
-
};
|
|
407
|
-
mappedValue.unshift(placeholderLbl);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return {
|
|
411
|
-
options: mappedValue,
|
|
412
|
-
hasMore: !!response.next,
|
|
413
|
-
additional: {
|
|
414
|
-
page: page + 1,
|
|
415
|
-
product: product,
|
|
416
|
-
userId: userId
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
});
|
|
420
|
-
}, function () {
|
|
421
|
-
return {
|
|
422
|
-
options: [],
|
|
423
|
-
hasMore: false,
|
|
424
|
-
additional: {
|
|
425
|
-
page: 1,
|
|
426
|
-
product: product,
|
|
427
|
-
userId: userId
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
}));
|
|
431
|
-
} catch (e) {
|
|
432
|
-
return Promise.reject(e);
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
436
|
-
var page = _ref5.page,
|
|
437
|
-
tabelName = _ref5.tabelName;
|
|
438
|
-
|
|
439
|
-
try {
|
|
440
|
-
return Promise.resolve(_catch(function () {
|
|
441
|
-
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
442
|
-
return res.data;
|
|
443
|
-
})).then(function (response) {
|
|
444
|
-
var mappedValue = response.results.map(function (item) {
|
|
445
|
-
return {
|
|
446
|
-
value: item[tabelName],
|
|
447
|
-
label: item[tabelName]
|
|
448
|
-
};
|
|
449
|
-
});
|
|
450
|
-
return {
|
|
451
|
-
options: mappedValue,
|
|
452
|
-
hasMore: !!response.next,
|
|
453
|
-
additional: {
|
|
454
|
-
page: page + 1,
|
|
455
|
-
tabelName: tabelName
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
});
|
|
459
|
-
}, function () {
|
|
460
|
-
return {
|
|
461
|
-
options: [],
|
|
462
|
-
hasMore: false,
|
|
463
|
-
additional: {
|
|
464
|
-
page: 1,
|
|
465
|
-
tabelName: tabelName
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
}));
|
|
469
|
-
} catch (e) {
|
|
470
|
-
return Promise.reject(e);
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
474
|
-
var page = _ref6.page,
|
|
475
|
-
placeholder = _ref6.placeholder;
|
|
476
|
-
|
|
477
|
-
try {
|
|
478
|
-
return Promise.resolve(_catch(function () {
|
|
479
|
-
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
480
|
-
var token = IUILocalStorageService$1.getAccessToken();
|
|
481
|
-
return Promise.resolve(axios.get(url, {
|
|
482
|
-
headers: {
|
|
483
|
-
Authorization: 'Bearer ' + token
|
|
484
|
-
}
|
|
485
|
-
})).then(function (response) {
|
|
486
|
-
return Promise.resolve(response.data.results.map(function (item) {
|
|
487
|
-
return {
|
|
488
|
-
value: item.id,
|
|
489
|
-
label: item.name
|
|
490
|
-
};
|
|
491
|
-
})).then(function (mappedValue) {
|
|
492
|
-
if (placeholder) {
|
|
493
|
-
var placeholderLbl = {
|
|
494
|
-
value: '',
|
|
495
|
-
label: placeholder
|
|
496
|
-
};
|
|
497
|
-
mappedValue.unshift(placeholderLbl);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
return {
|
|
501
|
-
options: mappedValue,
|
|
502
|
-
hasMore: !!response.data.next,
|
|
503
|
-
additional: {
|
|
504
|
-
page: page + 1,
|
|
505
|
-
placeholder: placeholder
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
}, function () {
|
|
511
|
-
return {
|
|
512
|
-
options: [],
|
|
513
|
-
hasMore: false,
|
|
514
|
-
additional: {
|
|
515
|
-
page: 1,
|
|
516
|
-
placeholder: placeholder
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
}));
|
|
520
|
-
} catch (e) {
|
|
521
|
-
return Promise.reject(e);
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
var dob = {
|
|
526
|
-
maxDate: moment().subtract(18, 'years'),
|
|
527
|
-
minDate: moment().subtract(300, 'years')
|
|
528
|
-
};
|
|
529
|
-
var passportStart = {
|
|
530
|
-
maxDate: moment(),
|
|
531
|
-
minDate: moment().subtract(100, 'years')
|
|
532
|
-
};
|
|
533
|
-
var passportEnd = {
|
|
534
|
-
maxDate: moment().add(18, 'years'),
|
|
535
|
-
minDate: moment()
|
|
469
|
+
var dob = {
|
|
470
|
+
maxDate: moment().subtract(18, 'years'),
|
|
471
|
+
minDate: moment().subtract(300, 'years')
|
|
472
|
+
};
|
|
473
|
+
var passportStart = {
|
|
474
|
+
maxDate: moment(),
|
|
475
|
+
minDate: moment().subtract(100, 'years')
|
|
476
|
+
};
|
|
477
|
+
var passportEnd = {
|
|
478
|
+
maxDate: moment().add(18, 'years'),
|
|
479
|
+
minDate: moment()
|
|
536
480
|
};
|
|
537
481
|
|
|
538
482
|
var personalInfo = [{
|
|
@@ -1176,186 +1120,281 @@ var NAoptionConfig = {
|
|
|
1176
1120
|
},
|
|
1177
1121
|
applyFor: ['employee_level', 'department']
|
|
1178
1122
|
};
|
|
1123
|
+
var userAddPageFormLabels = {
|
|
1124
|
+
user_personal_info: {
|
|
1125
|
+
first_name: 'First and middle name',
|
|
1126
|
+
last_name: 'Last name',
|
|
1127
|
+
email: 'Email address',
|
|
1128
|
+
contact_number: 'Phone number',
|
|
1129
|
+
dob: 'Date of birth',
|
|
1130
|
+
gender: 'Gender',
|
|
1131
|
+
profile_pic: 'Profile photo'
|
|
1132
|
+
},
|
|
1133
|
+
employee_info: {
|
|
1134
|
+
emp_level: 'Employee level',
|
|
1135
|
+
employee_id: 'Employee ID',
|
|
1136
|
+
entity: 'Entity',
|
|
1137
|
+
business_unit: 'Business unit',
|
|
1138
|
+
department: 'Department',
|
|
1139
|
+
designation: 'Designation',
|
|
1140
|
+
base_location: 'Base location',
|
|
1141
|
+
currency: 'Default currency'
|
|
1142
|
+
},
|
|
1143
|
+
user_travel_info: {
|
|
1144
|
+
nationality: 'Nationality',
|
|
1145
|
+
passport_number: 'Passport number',
|
|
1146
|
+
passport_expiry_date: 'Date of expiry',
|
|
1147
|
+
passport_issue_country: 'Passport issuing country',
|
|
1148
|
+
passport_issue_date: 'Date of issue',
|
|
1149
|
+
passport_photo: 'Photo of passport',
|
|
1150
|
+
travel_docs: 'Travel documents',
|
|
1151
|
+
flight_seat_preference: 'Flight seat preference',
|
|
1152
|
+
meal_preference: 'Meals preference',
|
|
1153
|
+
trusted_traveller: 'Known traveler number',
|
|
1154
|
+
redress_number: 'Redress number'
|
|
1155
|
+
},
|
|
1156
|
+
products: {
|
|
1157
|
+
travel: 'Travel',
|
|
1158
|
+
expense: 'Expense'
|
|
1159
|
+
},
|
|
1160
|
+
travel_fyi_approver: 'FYI approver'
|
|
1161
|
+
};
|
|
1179
1162
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
_ref$dateFormat = _ref.dateFormat,
|
|
1189
|
-
dateFormat = _ref$dateFormat === void 0 ? 'dd MMM yyyy' : _ref$dateFormat,
|
|
1190
|
-
_ref$errorArray = _ref.errorArray,
|
|
1191
|
-
errorArray = _ref$errorArray === void 0 ? [] : _ref$errorArray,
|
|
1192
|
-
_ref$errorMsg = _ref.errorMsg,
|
|
1193
|
-
errorMsg = _ref$errorMsg === void 0 ? '' : _ref$errorMsg,
|
|
1194
|
-
_ref$showNaOption = _ref.showNaOption,
|
|
1195
|
-
showNaOption = _ref$showNaOption === void 0 ? false : _ref$showNaOption;
|
|
1163
|
+
var IUILocalStorageService$1 = utils.services.IUILocalStorageService;
|
|
1164
|
+
var api = utils.configs.api;
|
|
1165
|
+
var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
|
|
1166
|
+
var page = _ref.page,
|
|
1167
|
+
tabelName = _ref.tabelName,
|
|
1168
|
+
placeholder = _ref.placeholder,
|
|
1169
|
+
selectCTA = _ref.selectCTA,
|
|
1170
|
+
showNaOption = _ref.showNaOption;
|
|
1196
1171
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1172
|
+
try {
|
|
1173
|
+
return Promise.resolve(_catch(function () {
|
|
1174
|
+
var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
|
|
1175
|
+
return Promise.resolve(api.get(url).then(function (res) {
|
|
1176
|
+
return res.data;
|
|
1177
|
+
})).then(function (response) {
|
|
1178
|
+
var mappedValue = response.results.map(function (item) {
|
|
1179
|
+
return {
|
|
1180
|
+
value: item.id,
|
|
1181
|
+
label: item.name
|
|
1182
|
+
};
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
if (showNaOption && page === 1 && NAoptionConfig.applyFor.includes(tabelName)) {
|
|
1186
|
+
mappedValue.unshift(NAoptionConfig.option);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
if (response.next === null && selectCTA) {
|
|
1190
|
+
mappedValue.push({
|
|
1191
|
+
value: selectCTA.value,
|
|
1192
|
+
label: ''
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
return {
|
|
1197
|
+
options: mappedValue,
|
|
1198
|
+
hasMore: !!response.next,
|
|
1199
|
+
additional: {
|
|
1200
|
+
page: page + 1,
|
|
1201
|
+
tabelName: tabelName,
|
|
1202
|
+
placeholder: placeholder,
|
|
1203
|
+
selectCTA: selectCTA
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1216
1206
|
});
|
|
1207
|
+
}, function () {
|
|
1208
|
+
return {
|
|
1209
|
+
options: [],
|
|
1210
|
+
hasMore: false,
|
|
1211
|
+
additional: {
|
|
1212
|
+
page: 1,
|
|
1213
|
+
tabelName: tabelName,
|
|
1214
|
+
placeholder: placeholder,
|
|
1215
|
+
selectCTA: selectCTA
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
}));
|
|
1219
|
+
} catch (e) {
|
|
1220
|
+
return Promise.reject(e);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
|
|
1224
|
+
var page = _ref3.page;
|
|
1217
1225
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
})
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1226
|
+
try {
|
|
1227
|
+
return Promise.resolve(_catch(function () {
|
|
1228
|
+
return Promise.resolve(api.get(userAddEditUrl.currencyCode() + "&search=" + search + "&page=" + page).then(function (res) {
|
|
1229
|
+
return res.data;
|
|
1230
|
+
})).then(function (response) {
|
|
1231
|
+
var mappedValue = response.results.map(function (item) {
|
|
1232
|
+
return {
|
|
1233
|
+
value: item.currency_code,
|
|
1234
|
+
label: item.currency_code
|
|
1235
|
+
};
|
|
1236
|
+
});
|
|
1237
|
+
return {
|
|
1238
|
+
options: mappedValue,
|
|
1239
|
+
hasMore: !!response.next,
|
|
1240
|
+
additional: {
|
|
1241
|
+
page: page + 1
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
});
|
|
1245
|
+
}, function () {
|
|
1246
|
+
return {
|
|
1247
|
+
options: [],
|
|
1248
|
+
hasMore: false,
|
|
1249
|
+
additional: {
|
|
1250
|
+
page: 1
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
}));
|
|
1254
|
+
} catch (e) {
|
|
1255
|
+
return Promise.reject(e);
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
1259
|
+
var page = _ref4.page,
|
|
1260
|
+
product = _ref4.product,
|
|
1261
|
+
userId = _ref4.userId,
|
|
1262
|
+
placeholder = _ref4.placeholder;
|
|
1243
1263
|
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1264
|
+
try {
|
|
1265
|
+
return Promise.resolve(_catch(function () {
|
|
1266
|
+
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
1267
|
+
return res.data;
|
|
1268
|
+
})).then(function (response) {
|
|
1269
|
+
var mappedValue = response.results.map(function (item) {
|
|
1270
|
+
return {
|
|
1271
|
+
value: item.approver,
|
|
1272
|
+
label: item.approver
|
|
1273
|
+
};
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
if (page === 1) {
|
|
1277
|
+
var placeholderLbl = {
|
|
1278
|
+
value: '',
|
|
1279
|
+
label: placeholder
|
|
1280
|
+
};
|
|
1281
|
+
mappedValue.unshift(placeholderLbl);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
return {
|
|
1285
|
+
options: mappedValue,
|
|
1286
|
+
hasMore: !!response.next,
|
|
1287
|
+
additional: {
|
|
1288
|
+
page: page + 1,
|
|
1289
|
+
product: product,
|
|
1290
|
+
userId: userId
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1262
1293
|
});
|
|
1294
|
+
}, function () {
|
|
1295
|
+
return {
|
|
1296
|
+
options: [],
|
|
1297
|
+
hasMore: false,
|
|
1298
|
+
additional: {
|
|
1299
|
+
page: 1,
|
|
1300
|
+
product: product,
|
|
1301
|
+
userId: userId
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
}));
|
|
1305
|
+
} catch (e) {
|
|
1306
|
+
return Promise.reject(e);
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
1310
|
+
var page = _ref5.page,
|
|
1311
|
+
tabelName = _ref5.tabelName;
|
|
1263
1312
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
})
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1313
|
+
try {
|
|
1314
|
+
return Promise.resolve(_catch(function () {
|
|
1315
|
+
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
1316
|
+
return res.data;
|
|
1317
|
+
})).then(function (response) {
|
|
1318
|
+
var mappedValue = response.results.map(function (item) {
|
|
1319
|
+
return {
|
|
1320
|
+
value: item[tabelName],
|
|
1321
|
+
label: item[tabelName]
|
|
1322
|
+
};
|
|
1323
|
+
});
|
|
1324
|
+
return {
|
|
1325
|
+
options: mappedValue,
|
|
1326
|
+
hasMore: !!response.next,
|
|
1327
|
+
additional: {
|
|
1328
|
+
page: page + 1,
|
|
1329
|
+
tabelName: tabelName
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
});
|
|
1333
|
+
}, function () {
|
|
1334
|
+
return {
|
|
1335
|
+
options: [],
|
|
1336
|
+
hasMore: false,
|
|
1337
|
+
additional: {
|
|
1338
|
+
page: 1,
|
|
1339
|
+
tabelName: tabelName
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
}));
|
|
1343
|
+
} catch (e) {
|
|
1344
|
+
return Promise.reject(e);
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
1348
|
+
var page = _ref6.page,
|
|
1349
|
+
placeholder = _ref6.placeholder;
|
|
1350
|
+
|
|
1351
|
+
try {
|
|
1352
|
+
return Promise.resolve(_catch(function () {
|
|
1353
|
+
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
1354
|
+
var token = IUILocalStorageService$1.getAccessToken();
|
|
1355
|
+
return Promise.resolve(axios.get(url, {
|
|
1356
|
+
headers: {
|
|
1357
|
+
Authorization: 'Bearer ' + token
|
|
1358
|
+
}
|
|
1359
|
+
})).then(function (response) {
|
|
1360
|
+
return Promise.resolve(response.data.results.map(function (item) {
|
|
1361
|
+
return {
|
|
1362
|
+
value: item.id,
|
|
1363
|
+
label: item.name
|
|
1364
|
+
};
|
|
1365
|
+
})).then(function (mappedValue) {
|
|
1366
|
+
if (placeholder) {
|
|
1367
|
+
var placeholderLbl = {
|
|
1368
|
+
value: '',
|
|
1369
|
+
label: placeholder
|
|
1370
|
+
};
|
|
1371
|
+
mappedValue.unshift(placeholderLbl);
|
|
1372
|
+
}
|
|
1283
1373
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
id: _p.name,
|
|
1294
|
-
disableText: _p.disableText
|
|
1374
|
+
return {
|
|
1375
|
+
options: mappedValue,
|
|
1376
|
+
hasMore: !!response.data.next,
|
|
1377
|
+
additional: {
|
|
1378
|
+
page: page + 1,
|
|
1379
|
+
placeholder: placeholder
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
});
|
|
1295
1383
|
});
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
required: _p.required,
|
|
1301
|
-
description: _p.description,
|
|
1302
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1303
|
-
tooltipText: _p.tooltip
|
|
1304
|
-
}), /*#__PURE__*/React__default.createElement(iuistyles.IUIFileUpload, {
|
|
1305
|
-
multiple: _p.multiple,
|
|
1306
|
-
title: _p.title,
|
|
1307
|
-
fileType: _p.fileType,
|
|
1308
|
-
name: _p.name,
|
|
1309
|
-
id: _p.name,
|
|
1310
|
-
customHandler: customHandler,
|
|
1311
|
-
value: inputState[_p.name],
|
|
1312
|
-
maxFiles: _p.maxNoFiles,
|
|
1313
|
-
maxFileSize: _p.fileSize,
|
|
1314
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1315
|
-
errorMsg: errorMsg,
|
|
1316
|
-
readOnly: _p.readOnly,
|
|
1317
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1318
|
-
tooltipText: _p.tooltip,
|
|
1319
|
-
disableText: _p.disableText,
|
|
1320
|
-
buttonType: _p.buttonType
|
|
1321
|
-
}));
|
|
1322
|
-
|
|
1323
|
-
case 'async_select':
|
|
1324
|
-
return /*#__PURE__*/React__default.createElement(iuistyles.IUIAsyncSelect, {
|
|
1325
|
-
id: _p.name,
|
|
1384
|
+
}, function () {
|
|
1385
|
+
return {
|
|
1386
|
+
options: [],
|
|
1387
|
+
hasMore: false,
|
|
1326
1388
|
additional: {
|
|
1327
1389
|
page: 1,
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
},
|
|
1335
|
-
label: _p.label,
|
|
1336
|
-
secondaryLabel: _p.secondaryLabel,
|
|
1337
|
-
title: _p.title,
|
|
1338
|
-
value: inputState[_p.name],
|
|
1339
|
-
name: _p.name,
|
|
1340
|
-
customSelectHandler: customHandler,
|
|
1341
|
-
inputType: _p.inputType,
|
|
1342
|
-
loadOption: _p.loadOption,
|
|
1343
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1344
|
-
errorMsg: errorMsg,
|
|
1345
|
-
required: _p.required,
|
|
1346
|
-
readOnly: _p.readOnly,
|
|
1347
|
-
placeHolderCheck: inputState[_p.name] !== undefined && inputState[_p.name].value === '',
|
|
1348
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1349
|
-
tooltipText: _p.tooltip,
|
|
1350
|
-
disableText: _p.disableText,
|
|
1351
|
-
selectCTA: _p.selectCTA,
|
|
1352
|
-
clearCache: _p.clearCache
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
default:
|
|
1356
|
-
return null;
|
|
1390
|
+
placeholder: placeholder
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
}));
|
|
1394
|
+
} catch (e) {
|
|
1395
|
+
return Promise.reject(e);
|
|
1357
1396
|
}
|
|
1358
|
-
}
|
|
1397
|
+
};
|
|
1359
1398
|
|
|
1360
1399
|
var UserRole = function UserRole(_ref) {
|
|
1361
1400
|
var _ref$list = _ref.list,
|
|
@@ -2389,98 +2428,85 @@ var closeDialog = function closeDialog() {
|
|
|
2389
2428
|
type: CLOSE_DIALOG
|
|
2390
2429
|
};
|
|
2391
2430
|
};
|
|
2392
|
-
var
|
|
2393
|
-
return function (dispatch) {
|
|
2394
|
-
return new Promise(function (resolve, reject) {
|
|
2395
|
-
api$3.get(userPanelUrl.getPaginationUnit(tableName, length, page)).then(function (res) {
|
|
2396
|
-
dispatch({
|
|
2397
|
-
type: FETCH_USERPANEL_DATA,
|
|
2398
|
-
payload: res.data
|
|
2399
|
-
});
|
|
2400
|
-
dispatch(userPanelStopLoader());
|
|
2401
|
-
resolve();
|
|
2402
|
-
})["catch"](function () {
|
|
2403
|
-
dispatch(userPanelStopLoader());
|
|
2404
|
-
});
|
|
2405
|
-
});
|
|
2406
|
-
};
|
|
2407
|
-
};
|
|
2408
|
-
var getUserPanalData = function getUserPanalData(tableName, length) {
|
|
2431
|
+
var getUserPanalData = function getUserPanalData(params) {
|
|
2409
2432
|
return function (dispatch) {
|
|
2410
2433
|
return new Promise(function (resolve, reject) {
|
|
2411
|
-
api$3.get(userPanelUrl.
|
|
2434
|
+
api$3.get(userPanelUrl.getPaginationUnit(params.tableName, params.rowsPerPage, params.page, params.orderingParam)).then(function (res) {
|
|
2412
2435
|
dispatch({
|
|
2413
2436
|
type: FETCH_USERPANEL_DATA,
|
|
2414
2437
|
payload: res.data
|
|
2415
2438
|
});
|
|
2416
2439
|
dispatch(userPanelStopLoader());
|
|
2417
2440
|
resolve();
|
|
2418
|
-
})["catch"](function () {
|
|
2441
|
+
})["catch"](function (err) {
|
|
2442
|
+
var _err$response, _err$response$data;
|
|
2443
|
+
|
|
2419
2444
|
dispatch(userPanelStopLoader());
|
|
2445
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.message) || 'Opps, Something went wrong.');
|
|
2420
2446
|
});
|
|
2421
2447
|
});
|
|
2422
2448
|
};
|
|
2423
2449
|
};
|
|
2424
|
-
var addRecord = function addRecord(tableName, data) {
|
|
2450
|
+
var addRecord = function addRecord(tableName, data, getParam) {
|
|
2425
2451
|
return function (dispatch) {
|
|
2426
2452
|
return new Promise(function (resolve, reject) {
|
|
2427
2453
|
api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
2428
|
-
dispatch(getUserPanalData(
|
|
2454
|
+
dispatch(getUserPanalData(getParam));
|
|
2429
2455
|
dispatch(closeDialog());
|
|
2430
2456
|
resolve(res);
|
|
2431
2457
|
})["catch"](function (err) {
|
|
2432
|
-
var _err$
|
|
2458
|
+
var _err$response2, _err$response2$data;
|
|
2433
2459
|
|
|
2434
2460
|
dispatch(userPanelStopLoader());
|
|
2435
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2461
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.message) || 'Opps, Something went wrong.');
|
|
2436
2462
|
});
|
|
2437
2463
|
});
|
|
2438
2464
|
};
|
|
2439
2465
|
};
|
|
2440
|
-
var deleteRecord = function deleteRecord(tableName, id) {
|
|
2466
|
+
var deleteRecord = function deleteRecord(tableName, id, getParam) {
|
|
2441
2467
|
return function (dispatch) {
|
|
2442
2468
|
return new Promise(function (resolve, reject) {
|
|
2443
2469
|
api$3.post(userPanelUrl.deleteUnit(tableName), id).then(function (res) {
|
|
2444
|
-
dispatch(
|
|
2470
|
+
dispatch(getUserPanalData(getParam));
|
|
2445
2471
|
dispatch(closeDialog());
|
|
2446
2472
|
dispatch(userPanelStopLoader());
|
|
2447
2473
|
resolve();
|
|
2448
2474
|
})["catch"](function (err) {
|
|
2449
|
-
var _err$
|
|
2475
|
+
var _err$response3, _err$response3$data;
|
|
2450
2476
|
|
|
2451
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2477
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response3 = err.response) === null || _err$response3 === void 0 ? void 0 : (_err$response3$data = _err$response3.data) === null || _err$response3$data === void 0 ? void 0 : _err$response3$data.message) || 'Opps, Something went wrong.');
|
|
2452
2478
|
dispatch(userPanelStopLoader());
|
|
2453
2479
|
});
|
|
2454
2480
|
});
|
|
2455
2481
|
};
|
|
2456
2482
|
};
|
|
2457
|
-
var editRecord = function editRecord(tableName, data) {
|
|
2483
|
+
var editRecord = function editRecord(tableName, data, getParam) {
|
|
2458
2484
|
return function (dispatch) {
|
|
2459
2485
|
return new Promise(function (resolve, reject) {
|
|
2460
2486
|
api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
|
|
2461
|
-
dispatch(
|
|
2487
|
+
dispatch(getUserPanalData(getParam));
|
|
2462
2488
|
dispatch(closeDialog());
|
|
2463
2489
|
resolve();
|
|
2464
2490
|
})["catch"](function (err) {
|
|
2465
|
-
var _err$
|
|
2491
|
+
var _err$response4, _err$response4$data;
|
|
2466
2492
|
|
|
2467
2493
|
dispatch(userPanelStopLoader());
|
|
2468
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2494
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response4 = err.response) === null || _err$response4 === void 0 ? void 0 : (_err$response4$data = _err$response4.data) === null || _err$response4$data === void 0 ? void 0 : _err$response4$data.message) || 'Opps, Something went wrong.');
|
|
2469
2495
|
});
|
|
2470
2496
|
});
|
|
2471
2497
|
};
|
|
2472
2498
|
};
|
|
2473
|
-
var moveRecord = function moveRecord(tableName, data) {
|
|
2499
|
+
var moveRecord = function moveRecord(tableName, data, getParam) {
|
|
2474
2500
|
return function (dispatch) {
|
|
2475
2501
|
return new Promise(function (resolve, reject) {
|
|
2476
2502
|
api$3.post(userPanelUrl.moveUnit(tableName), data).then(function (res) {
|
|
2477
|
-
dispatch(getUserPanalData(
|
|
2503
|
+
dispatch(getUserPanalData(getParam));
|
|
2478
2504
|
dispatch(closeDialog());
|
|
2479
2505
|
resolve(res);
|
|
2480
2506
|
})["catch"](function (err) {
|
|
2481
|
-
var _err$
|
|
2507
|
+
var _err$response5, _err$response5$data;
|
|
2482
2508
|
|
|
2483
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2509
|
+
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$response5 = err.response) === null || _err$response5 === void 0 ? void 0 : (_err$response5$data = _err$response5.data) === null || _err$response5$data === void 0 ? void 0 : _err$response5$data.message) || 'Opps, Something went wrong.');
|
|
2484
2510
|
});
|
|
2485
2511
|
});
|
|
2486
2512
|
};
|
|
@@ -3429,7 +3455,9 @@ var initialState = {
|
|
|
3429
3455
|
secureTravelInfo: secureTravelInfo,
|
|
3430
3456
|
disableText: '',
|
|
3431
3457
|
travelRoles: travelConstants.roles,
|
|
3432
|
-
expenseRoles: expenseConstants.roles
|
|
3458
|
+
expenseRoles: expenseConstants.roles,
|
|
3459
|
+
travelConstants: travelConstants,
|
|
3460
|
+
expenseConstants: expenseConstants
|
|
3433
3461
|
},
|
|
3434
3462
|
dropdownList: dropdownList,
|
|
3435
3463
|
maxTravelApprovers: 10,
|
|
@@ -3464,6 +3492,10 @@ var reducer = function reducer(state, action) {
|
|
|
3464
3492
|
{
|
|
3465
3493
|
var _action$payload, _action$payload$appro, _action$payload$appro2, _action$payload2, _action$payload2$appr, _action$payload2$appr2, _action$payload3, _action$payload3$trav, _action$payload4, _action$payload4$expe, _action$payload5, _action$payload5$flig, _action$payload6, _action$payload6$meal, _action$payload7;
|
|
3466
3494
|
|
|
3495
|
+
if (!action.payload.labels) {
|
|
3496
|
+
action.payload.labels = userAddPageFormLabels;
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3467
3499
|
var renderFields = _extends({}, state.renderFields);
|
|
3468
3500
|
|
|
3469
3501
|
var _action$payload$visib = action.payload.visibility,
|
|
@@ -3474,14 +3506,36 @@ var reducer = function reducer(state, action) {
|
|
|
3474
3506
|
userPersonalInfoOptionalFields = _action$payload$optio.user_personal_info,
|
|
3475
3507
|
employeeInfoOptionalFields = _action$payload$optio.employee_info,
|
|
3476
3508
|
userTravelInfoOptionalFields = _action$payload$optio.user_travel_info;
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3509
|
+
var _action$payload$label = action.payload.labels,
|
|
3510
|
+
userPersonalInfoLabels = _action$payload$label.user_personal_info,
|
|
3511
|
+
employeeInfoLabels = _action$payload$label.employee_info,
|
|
3512
|
+
userTravelInfoLabels = _action$payload$label.user_travel_info,
|
|
3513
|
+
productLabels = _action$payload$label.products,
|
|
3514
|
+
travelFYIlabel = _action$payload$label.travel_fyi_approver,
|
|
3515
|
+
expenseFYIlabel = _action$payload$label.expense_fyi_approver;
|
|
3516
|
+
renderFields.personalInfo = setFieldsDisplayAtt(renderFields.personalInfo, userPersonalInfo, userPersonalInfoOptionalFields, userPersonalInfoLabels);
|
|
3517
|
+
renderFields.workInfo = setFieldsDisplayAtt(renderFields.workInfo, employeeInfo, employeeInfoOptionalFields, employeeInfoLabels);
|
|
3518
|
+
renderFields.passportInfo = setFieldsDisplayAtt(renderFields.passportInfo, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3519
|
+
renderFields.travelPreference = setFieldsDisplayAtt(renderFields.travelPreference, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3520
|
+
renderFields.secureTravelInfo = setFieldsDisplayAtt(renderFields.secureTravelInfo, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3482
3521
|
renderFields.products = renderFields.products.filter(function (product) {
|
|
3483
3522
|
return action.payload.products.includes(product.name);
|
|
3523
|
+
}).map(function (product) {
|
|
3524
|
+
if (productLabels && Object.hasOwnProperty.call(productLabels, product.name)) {
|
|
3525
|
+
product.label = productLabels[product.name];
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
return product;
|
|
3484
3529
|
});
|
|
3530
|
+
|
|
3531
|
+
if (travelFYIlabel) {
|
|
3532
|
+
renderFields.travelConstants.FYILabel = travelFYIlabel;
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
if (expenseFYIlabel) {
|
|
3536
|
+
renderFields.expenseConstants.FYILabel = expenseFYIlabel;
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3485
3539
|
renderFields.custom_attributes = action.payload.custom_attributes;
|
|
3486
3540
|
|
|
3487
3541
|
if (action !== null && action !== void 0 && (_action$payload = action.payload) !== null && _action$payload !== void 0 && (_action$payload$appro = _action$payload.approvers) !== null && _action$payload$appro !== void 0 && (_action$payload$appro2 = _action$payload$appro.travel) !== null && _action$payload$appro2 !== void 0 && _action$payload$appro2.length) {
|
|
@@ -3738,7 +3792,7 @@ var reducer = function reducer(state, action) {
|
|
|
3738
3792
|
}
|
|
3739
3793
|
};
|
|
3740
3794
|
|
|
3741
|
-
var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj, optionalObj) {
|
|
3795
|
+
var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj, optionalObj, labelsObj) {
|
|
3742
3796
|
return objToLoop.map(function (p) {
|
|
3743
3797
|
var key = p.name;
|
|
3744
3798
|
|
|
@@ -3764,6 +3818,10 @@ var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj,
|
|
|
3764
3818
|
p.required = false;
|
|
3765
3819
|
}
|
|
3766
3820
|
|
|
3821
|
+
if (labelsObj && Object.hasOwnProperty.call(labelsObj, p.name)) {
|
|
3822
|
+
p.label = labelsObj[p.name];
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3767
3825
|
return p;
|
|
3768
3826
|
});
|
|
3769
3827
|
};
|
|
@@ -6506,7 +6564,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6506
6564
|
className: styles.dividerColor
|
|
6507
6565
|
}), productAccess && productAccess.travel && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(TravelExpenseFields, {
|
|
6508
6566
|
fieldsInfo: renderFields.travelApprovers,
|
|
6509
|
-
travelConstants: travelConstants,
|
|
6567
|
+
travelConstants: renderFields.travelConstants,
|
|
6510
6568
|
type: "travel",
|
|
6511
6569
|
addFields: function addFields() {
|
|
6512
6570
|
return dispatch(addTravelApproverField());
|
|
@@ -6544,7 +6602,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6544
6602
|
className: styles.dividerColor
|
|
6545
6603
|
}), productAccess && productAccess.expense && /*#__PURE__*/React__default.createElement(TravelExpenseFields, {
|
|
6546
6604
|
fieldsInfo: renderFields.expenseApprovers,
|
|
6547
|
-
travelConstants: expenseConstants,
|
|
6605
|
+
travelConstants: renderFields.expenseConstants,
|
|
6548
6606
|
type: "expense",
|
|
6549
6607
|
addFields: function addFields() {
|
|
6550
6608
|
return dispatch(addExpenseApproverField());
|
|
@@ -8841,9 +8899,13 @@ var index$2 = withStore(UserList);
|
|
|
8841
8899
|
|
|
8842
8900
|
function Header(props) {
|
|
8843
8901
|
var HeaderButton = props.HeaderButton,
|
|
8844
|
-
name = props.name,
|
|
8845
|
-
|
|
8846
|
-
|
|
8902
|
+
_props$name = props.name,
|
|
8903
|
+
name = _props$name === void 0 ? '' : _props$name,
|
|
8904
|
+
_props$headingName = props.headingName,
|
|
8905
|
+
headingName = _props$headingName === void 0 ? '' : _props$headingName,
|
|
8906
|
+
_props$subHeading = props.subHeading,
|
|
8907
|
+
subHeading = _props$subHeading === void 0 ? '' : _props$subHeading,
|
|
8908
|
+
loading = props.loading;
|
|
8847
8909
|
|
|
8848
8910
|
var _useSelector = reactRedux.useSelector(function (state) {
|
|
8849
8911
|
return state.common;
|
|
@@ -8876,7 +8938,7 @@ function Header(props) {
|
|
|
8876
8938
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
8877
8939
|
variant: "h3",
|
|
8878
8940
|
className: clsx(styles$5.heading, styles$5.headingLarge)
|
|
8879
|
-
}, isILadmin === 1 && companyName + " - ",
|
|
8941
|
+
}, isILadmin === 1 && companyName !== null && companyName + " - ", ' ', headingName)), /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8880
8942
|
component: "div",
|
|
8881
8943
|
className: styles$5.headingWrapper
|
|
8882
8944
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITypography, {
|
|
@@ -8893,6 +8955,7 @@ function Header(props) {
|
|
|
8893
8955
|
component: "div",
|
|
8894
8956
|
className: "pageHeader--button-single button-right"
|
|
8895
8957
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUIButton, {
|
|
8958
|
+
disabled: loading,
|
|
8896
8959
|
type: "contained",
|
|
8897
8960
|
buttonText: "+ Add " + name.toLowerCase(),
|
|
8898
8961
|
onClick: HeaderButton
|
|
@@ -8909,31 +8972,18 @@ var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sideb
|
|
|
8909
8972
|
function Listview(_ref) {
|
|
8910
8973
|
var data = _ref.data,
|
|
8911
8974
|
name = _ref.name,
|
|
8912
|
-
tableName = _ref.tableName,
|
|
8913
8975
|
handleEditDialog = _ref.handleEditDialog,
|
|
8914
|
-
handleDeleteDialog = _ref.handleDeleteDialog
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
var handleChangePage = function handleChangePage(e, newPage) {
|
|
8926
|
-
setPage(newPage);
|
|
8927
|
-
};
|
|
8928
|
-
|
|
8929
|
-
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
8930
|
-
setRowsPerPage(+event.target.value);
|
|
8931
|
-
setPage(1);
|
|
8932
|
-
};
|
|
8933
|
-
|
|
8934
|
-
React.useEffect(function () {
|
|
8935
|
-
dispatch(getUserPanalOnPageChange(tableName, rowsPerPage, page));
|
|
8936
|
-
}, [rowsPerPage, page]);
|
|
8976
|
+
handleDeleteDialog = _ref.handleDeleteDialog,
|
|
8977
|
+
orderBy = _ref.orderBy,
|
|
8978
|
+
order = _ref.order,
|
|
8979
|
+
_ref$onRequestSort = _ref.onRequestSort,
|
|
8980
|
+
onRequestSort = _ref$onRequestSort === void 0 ? function () {} : _ref$onRequestSort,
|
|
8981
|
+
_ref$handleChangeRows = _ref.handleChangeRowsPerPage,
|
|
8982
|
+
handleChangeRowsPerPage = _ref$handleChangeRows === void 0 ? function () {} : _ref$handleChangeRows,
|
|
8983
|
+
_ref$handleChangePage = _ref.handleChangePage,
|
|
8984
|
+
handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
|
|
8985
|
+
page = _ref.page,
|
|
8986
|
+
rowsPerPage = _ref.rowsPerPage;
|
|
8937
8987
|
var columns = [{
|
|
8938
8988
|
id: 'name',
|
|
8939
8989
|
label: name,
|
|
@@ -8948,6 +8998,7 @@ function Listview(_ref) {
|
|
|
8948
8998
|
id: 'no_of_users',
|
|
8949
8999
|
label: 'Number of users',
|
|
8950
9000
|
width: '45%',
|
|
9001
|
+
sortable: true,
|
|
8951
9002
|
cell: function cell(row) {
|
|
8952
9003
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8953
9004
|
component: "div"
|
|
@@ -8984,16 +9035,19 @@ function Listview(_ref) {
|
|
|
8984
9035
|
return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
8985
9036
|
p: 3
|
|
8986
9037
|
}, /*#__PURE__*/React__default.createElement(iuistyles.IUITable, {
|
|
8987
|
-
hasFilter: false,
|
|
8988
|
-
isCheckboxTable: false,
|
|
8989
9038
|
searchHide: true,
|
|
9039
|
+
hasFilter: true,
|
|
9040
|
+
isCheckboxTable: false,
|
|
8990
9041
|
count: data.count,
|
|
8991
9042
|
columns: columns,
|
|
8992
9043
|
rows: data.results,
|
|
8993
9044
|
page: page,
|
|
8994
9045
|
handleChangePage: handleChangePage,
|
|
8995
9046
|
handleChangeRowsPerPage: handleChangeRowsPerPage,
|
|
8996
|
-
rowsPerPage: rowsPerPage
|
|
9047
|
+
rowsPerPage: rowsPerPage,
|
|
9048
|
+
orderBy: orderBy,
|
|
9049
|
+
order: order,
|
|
9050
|
+
onRequestSort: onRequestSort
|
|
8997
9051
|
})));
|
|
8998
9052
|
}
|
|
8999
9053
|
|
|
@@ -9275,6 +9329,32 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9275
9329
|
alertModal = _useState11[0],
|
|
9276
9330
|
setAlertModal = _useState11[1];
|
|
9277
9331
|
|
|
9332
|
+
var _React$useState = React__default.useState('asc'),
|
|
9333
|
+
order = _React$useState[0],
|
|
9334
|
+
setOrder = _React$useState[1];
|
|
9335
|
+
|
|
9336
|
+
var _React$useState2 = React__default.useState('name'),
|
|
9337
|
+
orderBy = _React$useState2[0],
|
|
9338
|
+
setOrderBy = _React$useState2[1];
|
|
9339
|
+
|
|
9340
|
+
var _useState12 = React.useState(false),
|
|
9341
|
+
isSortingChange = _useState12[0],
|
|
9342
|
+
setSortingChange = _useState12[1];
|
|
9343
|
+
|
|
9344
|
+
var _useState13 = React.useState(false),
|
|
9345
|
+
isSortingChangeTemp = _useState13[0],
|
|
9346
|
+
setSortingChangeTemp = _useState13[1];
|
|
9347
|
+
|
|
9348
|
+
var _useState14 = React.useState(1),
|
|
9349
|
+
page = _useState14[0],
|
|
9350
|
+
setPage = _useState14[1];
|
|
9351
|
+
|
|
9352
|
+
var _useState15 = React.useState(5),
|
|
9353
|
+
rowsPerPage = _useState15[0],
|
|
9354
|
+
setRowsPerPage = _useState15[1];
|
|
9355
|
+
|
|
9356
|
+
var orderingParam = orderBy;
|
|
9357
|
+
|
|
9278
9358
|
var _useSelector = reactRedux.useSelector(function (state) {
|
|
9279
9359
|
return state.userPanel;
|
|
9280
9360
|
}),
|
|
@@ -9304,16 +9384,37 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9304
9384
|
React.useEffect(function () {
|
|
9305
9385
|
var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
|
|
9306
9386
|
dispatch(verifyAccessToken(roleCanAccess));
|
|
9387
|
+
window.scrollTo(0, 0);
|
|
9307
9388
|
}, []);
|
|
9308
9389
|
React.useEffect(function () {
|
|
9309
9390
|
dispatch(userPanelShowLoader());
|
|
9310
9391
|
|
|
9311
9392
|
if (isTokenVerified) {
|
|
9312
|
-
|
|
9313
|
-
return dispatch(userPanelStopLoader());
|
|
9314
|
-
});
|
|
9393
|
+
calApiPanelList();
|
|
9315
9394
|
}
|
|
9316
|
-
}, [isTokenVerified]);
|
|
9395
|
+
}, [isTokenVerified, isSortingChangeTemp]);
|
|
9396
|
+
|
|
9397
|
+
var calApiPanelList = function calApiPanelList() {
|
|
9398
|
+
dispatch(getUserPanalData(getApiData())).then(function () {
|
|
9399
|
+
return dispatch(userPanelStopLoader());
|
|
9400
|
+
})["finally"](function () {
|
|
9401
|
+
if (isSortingChange) {
|
|
9402
|
+
setSortingChange(false);
|
|
9403
|
+
}
|
|
9404
|
+
});
|
|
9405
|
+
};
|
|
9406
|
+
|
|
9407
|
+
var getApiData = function getApiData() {
|
|
9408
|
+
orderingParam = order === 'asc' ? orderBy : '-' + orderBy;
|
|
9409
|
+
var urlData = {
|
|
9410
|
+
tableName: tableName,
|
|
9411
|
+
rowsPerPage: rowsPerPage,
|
|
9412
|
+
page: page,
|
|
9413
|
+
orderingParam: orderingParam
|
|
9414
|
+
};
|
|
9415
|
+
return urlData;
|
|
9416
|
+
};
|
|
9417
|
+
|
|
9317
9418
|
React.useEffect(function () {
|
|
9318
9419
|
var arrList = userPanelData.results.filter(function (item) {
|
|
9319
9420
|
return item.name !== dialogData.data.name;
|
|
@@ -9372,48 +9473,61 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9372
9473
|
var handleAddUserPanel = function handleAddUserPanel() {
|
|
9373
9474
|
if (dataList) {
|
|
9374
9475
|
setErrorAdd(false);
|
|
9375
|
-
|
|
9376
|
-
dispatch(addRecord(tableName, {
|
|
9476
|
+
var payload = {
|
|
9377
9477
|
names: [dataList]
|
|
9378
|
-
}
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
dispatch(userPanelStopLoader());
|
|
9382
|
-
setDataList('');
|
|
9383
|
-
});
|
|
9478
|
+
};
|
|
9479
|
+
var message = title + " added successfully.";
|
|
9480
|
+
handleApiCall(addRecord, payload, message, 'add');
|
|
9384
9481
|
} else {
|
|
9385
9482
|
setErrorAdd(true);
|
|
9386
9483
|
}
|
|
9387
9484
|
};
|
|
9388
9485
|
|
|
9389
|
-
var handleDeletePanel = function handleDeletePanel(
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9486
|
+
var handleDeletePanel = function handleDeletePanel() {
|
|
9487
|
+
var payload = {
|
|
9488
|
+
row_ids: [dialogData.data.id]
|
|
9489
|
+
};
|
|
9490
|
+
var message = title + " deleted successfully.";
|
|
9491
|
+
handleApiCall(deleteRecord, payload, message, 'delete');
|
|
9492
|
+
};
|
|
9493
|
+
|
|
9494
|
+
var handleApiCall = function handleApiCall(dispatchFun, payload, message, type) {
|
|
9495
|
+
dispatch(userPanelShowLoader());
|
|
9496
|
+
dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
|
|
9497
|
+
IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
|
|
9498
|
+
dispatch(userPanelStopLoader());
|
|
9499
|
+
|
|
9500
|
+
if (type === 'delete') {
|
|
9397
9501
|
closeDeleteModal();
|
|
9398
|
-
}
|
|
9399
|
-
|
|
9502
|
+
}
|
|
9503
|
+
|
|
9504
|
+
if (type === 'add') {
|
|
9505
|
+
closeDeActivateModal();
|
|
9506
|
+
setDataList('');
|
|
9507
|
+
}
|
|
9508
|
+
|
|
9509
|
+
if (type === 'move') {
|
|
9510
|
+
setMoveModal(false);
|
|
9511
|
+
dispatch(closeDialog());
|
|
9512
|
+
setSelectValue('');
|
|
9513
|
+
}
|
|
9514
|
+
|
|
9515
|
+
if (type === 'edit') {
|
|
9516
|
+
closeEditDialog();
|
|
9517
|
+
setDataList('');
|
|
9518
|
+
}
|
|
9519
|
+
});
|
|
9400
9520
|
};
|
|
9401
9521
|
|
|
9402
9522
|
var handleMovePanel = function handleMovePanel() {
|
|
9403
9523
|
if (selectValue) {
|
|
9404
|
-
|
|
9405
|
-
dispatch(userPanelShowLoader());
|
|
9406
|
-
dispatch(moveRecord(tableName, {
|
|
9524
|
+
var payload = {
|
|
9407
9525
|
table_name: tableName,
|
|
9408
9526
|
from: dialogData.data.name,
|
|
9409
9527
|
to: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
9410
|
-
}
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
dispatch(closeDialog());
|
|
9414
|
-
dispatch(userPanelStopLoader());
|
|
9415
|
-
setSelectValue('');
|
|
9416
|
-
});
|
|
9528
|
+
};
|
|
9529
|
+
handleApiCall(moveRecord, payload, 'message', 'move');
|
|
9530
|
+
setErrorMove(false);
|
|
9417
9531
|
} else {
|
|
9418
9532
|
setErrorMove(true);
|
|
9419
9533
|
}
|
|
@@ -9421,19 +9535,14 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9421
9535
|
|
|
9422
9536
|
var handleEditPanel = function handleEditPanel(data) {
|
|
9423
9537
|
if (dataList) {
|
|
9538
|
+
var payload = {
|
|
9539
|
+
table_name: tableName,
|
|
9540
|
+
from: dialogData.data.name,
|
|
9541
|
+
to: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
9542
|
+
};
|
|
9543
|
+
var message = title + " updated successfully.";
|
|
9544
|
+
handleApiCall(editRecord, payload, message, 'edit');
|
|
9424
9545
|
setErrorEdit(false);
|
|
9425
|
-
dispatch(userPanelShowLoader());
|
|
9426
|
-
dispatch(editRecord(tableName, {
|
|
9427
|
-
rows: [{
|
|
9428
|
-
id: dialogData.data.id,
|
|
9429
|
-
name: dataList
|
|
9430
|
-
}]
|
|
9431
|
-
})).then(function (res) {
|
|
9432
|
-
dispatch(userPanelStopLoader());
|
|
9433
|
-
IUIToastMessageService$8.sNotify(title + " updated successfully.");
|
|
9434
|
-
closeEditDialog();
|
|
9435
|
-
setDataList('');
|
|
9436
|
-
});
|
|
9437
9546
|
} else {
|
|
9438
9547
|
setErrorEdit(true);
|
|
9439
9548
|
}
|
|
@@ -9457,21 +9566,49 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9457
9566
|
setAlertModal(false);
|
|
9458
9567
|
};
|
|
9459
9568
|
|
|
9569
|
+
var onRequestSort = function onRequestSort(event, property) {
|
|
9570
|
+
var isAsc = orderBy === property && order === 'asc';
|
|
9571
|
+
setOrder(isAsc ? 'desc' : 'asc');
|
|
9572
|
+
setOrderBy(property);
|
|
9573
|
+
setSortingChange(true);
|
|
9574
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9575
|
+
};
|
|
9576
|
+
|
|
9577
|
+
var handleChangePage = function handleChangePage(e, newPage) {
|
|
9578
|
+
setPage(newPage);
|
|
9579
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9580
|
+
};
|
|
9581
|
+
|
|
9582
|
+
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
9583
|
+
setRowsPerPage(+event.target.value);
|
|
9584
|
+
setPage(1);
|
|
9585
|
+
setSortingChange(true);
|
|
9586
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9587
|
+
};
|
|
9588
|
+
|
|
9460
9589
|
return /*#__PURE__*/React__default.createElement(iuistyles.IUIBox, {
|
|
9461
9590
|
component: "div",
|
|
9462
9591
|
className: styles$5.UUIUserManagementList
|
|
9463
|
-
}, hasVerificationError === false ? /*#__PURE__*/React__default.createElement(React.Fragment, null,
|
|
9592
|
+
}, hasVerificationError === false ? /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Header, {
|
|
9464
9593
|
name: title,
|
|
9465
9594
|
headingName: headingName,
|
|
9466
9595
|
subHeading: subHeading,
|
|
9467
|
-
HeaderButton: addDialog
|
|
9468
|
-
|
|
9596
|
+
HeaderButton: addDialog,
|
|
9597
|
+
loading: loading
|
|
9598
|
+
}), loading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, null) : /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Listview, {
|
|
9469
9599
|
data: userPanelData,
|
|
9470
9600
|
name: title,
|
|
9471
9601
|
tableName: tableName,
|
|
9472
9602
|
handleEditDialog: openEditDialog,
|
|
9473
9603
|
handleDeleteDialog: openDeleteModal,
|
|
9474
|
-
closeDeActivateModal: closeDeActivateModal
|
|
9604
|
+
closeDeActivateModal: closeDeActivateModal,
|
|
9605
|
+
orderBy: orderBy,
|
|
9606
|
+
order: order,
|
|
9607
|
+
onRequestSort: onRequestSort,
|
|
9608
|
+
handleChangePage: handleChangePage,
|
|
9609
|
+
handleChangeRowsPerPage: handleChangeRowsPerPage,
|
|
9610
|
+
rowsPerPage: rowsPerPage,
|
|
9611
|
+
page: page
|
|
9475
9612
|
})), /*#__PURE__*/React__default.createElement(AddPanelDialog, {
|
|
9476
9613
|
name: title,
|
|
9477
9614
|
isOpen: addModal,
|