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