@itilite/iui-user-management 0.1.19 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +729 -583
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +730 -584
- 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 = {
|
|
@@ -275,301 +455,20 @@ 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
|
-
var page = _ref.page,
|
|
293
|
-
tabelName = _ref.tabelName,
|
|
294
|
-
placeholder = _ref.placeholder,
|
|
295
|
-
selectCTA = _ref.selectCTA,
|
|
296
|
-
showNaOption = _ref.showNaOption;
|
|
297
|
-
|
|
298
|
-
try {
|
|
299
|
-
return Promise.resolve(_catch(function () {
|
|
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 commonLoadOptionsUM = function commonLoadOptionsUM(search, loadedOptions, _ref2) {
|
|
350
|
-
var page = _ref2.page,
|
|
351
|
-
tabelName = _ref2.tabelName,
|
|
352
|
-
placeholder = _ref2.placeholder,
|
|
353
|
-
defaultData = _ref2.defaultData;
|
|
354
|
-
|
|
355
|
-
try {
|
|
356
|
-
return Promise.resolve(_catch(function () {
|
|
357
|
-
var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
|
|
358
|
-
return Promise.resolve(api.get(url).then(function (res) {
|
|
359
|
-
return res.data;
|
|
360
|
-
})).then(function (response) {
|
|
361
|
-
var arrList = response.results.filter(function (item) {
|
|
362
|
-
return item.name !== defaultData;
|
|
363
|
-
});
|
|
364
|
-
var mappedValue = arrList.map(function (item) {
|
|
365
|
-
return {
|
|
366
|
-
value: item.id,
|
|
367
|
-
label: item.name
|
|
368
|
-
};
|
|
369
|
-
});
|
|
370
|
-
return {
|
|
371
|
-
options: mappedValue,
|
|
372
|
-
hasMore: !!response.next,
|
|
373
|
-
additional: {
|
|
374
|
-
page: page + 1,
|
|
375
|
-
tabelName: tabelName
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
});
|
|
379
|
-
}, function () {
|
|
380
|
-
return {
|
|
381
|
-
options: [],
|
|
382
|
-
hasMore: false,
|
|
383
|
-
additional: {
|
|
384
|
-
page: 1,
|
|
385
|
-
tabelName: tabelName,
|
|
386
|
-
placeholder: placeholder
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
}));
|
|
390
|
-
} catch (e) {
|
|
391
|
-
return Promise.reject(e);
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
|
|
395
|
-
var page = _ref3.page;
|
|
396
|
-
|
|
397
|
-
try {
|
|
398
|
-
return Promise.resolve(_catch(function () {
|
|
399
|
-
return Promise.resolve(api.get(userAddEditUrl.currencyCode() + "&search=" + search + "&page=" + page).then(function (res) {
|
|
400
|
-
return res.data;
|
|
401
|
-
})).then(function (response) {
|
|
402
|
-
var mappedValue = response.results.map(function (item) {
|
|
403
|
-
return {
|
|
404
|
-
value: item.currency_code,
|
|
405
|
-
label: item.currency_code
|
|
406
|
-
};
|
|
407
|
-
});
|
|
408
|
-
return {
|
|
409
|
-
options: mappedValue,
|
|
410
|
-
hasMore: !!response.next,
|
|
411
|
-
additional: {
|
|
412
|
-
page: page + 1
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
});
|
|
416
|
-
}, function () {
|
|
417
|
-
return {
|
|
418
|
-
options: [],
|
|
419
|
-
hasMore: false,
|
|
420
|
-
additional: {
|
|
421
|
-
page: 1
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
}));
|
|
425
|
-
} catch (e) {
|
|
426
|
-
return Promise.reject(e);
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
430
|
-
var page = _ref4.page,
|
|
431
|
-
product = _ref4.product,
|
|
432
|
-
userId = _ref4.userId,
|
|
433
|
-
placeholder = _ref4.placeholder;
|
|
434
|
-
|
|
435
|
-
try {
|
|
436
|
-
return Promise.resolve(_catch(function () {
|
|
437
|
-
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
438
|
-
return res.data;
|
|
439
|
-
})).then(function (response) {
|
|
440
|
-
var mappedValue = response.results.map(function (item) {
|
|
441
|
-
return {
|
|
442
|
-
value: item.approver,
|
|
443
|
-
label: item.approver
|
|
444
|
-
};
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
if (page === 1) {
|
|
448
|
-
var placeholderLbl = {
|
|
449
|
-
value: '',
|
|
450
|
-
label: placeholder
|
|
451
|
-
};
|
|
452
|
-
mappedValue.unshift(placeholderLbl);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return {
|
|
456
|
-
options: mappedValue,
|
|
457
|
-
hasMore: !!response.next,
|
|
458
|
-
additional: {
|
|
459
|
-
page: page + 1,
|
|
460
|
-
product: product,
|
|
461
|
-
userId: userId
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
});
|
|
465
|
-
}, function () {
|
|
466
|
-
return {
|
|
467
|
-
options: [],
|
|
468
|
-
hasMore: false,
|
|
469
|
-
additional: {
|
|
470
|
-
page: 1,
|
|
471
|
-
product: product,
|
|
472
|
-
userId: userId
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
}));
|
|
476
|
-
} catch (e) {
|
|
477
|
-
return Promise.reject(e);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
481
|
-
var page = _ref5.page,
|
|
482
|
-
tabelName = _ref5.tabelName;
|
|
483
|
-
|
|
484
|
-
try {
|
|
485
|
-
return Promise.resolve(_catch(function () {
|
|
486
|
-
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
487
|
-
return res.data;
|
|
488
|
-
})).then(function (response) {
|
|
489
|
-
var mappedValue = response.results.map(function (item) {
|
|
490
|
-
return {
|
|
491
|
-
value: item[tabelName],
|
|
492
|
-
label: item[tabelName]
|
|
493
|
-
};
|
|
494
|
-
});
|
|
495
|
-
return {
|
|
496
|
-
options: mappedValue,
|
|
497
|
-
hasMore: !!response.next,
|
|
498
|
-
additional: {
|
|
499
|
-
page: page + 1,
|
|
500
|
-
tabelName: tabelName
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
});
|
|
504
|
-
}, function () {
|
|
505
|
-
return {
|
|
506
|
-
options: [],
|
|
507
|
-
hasMore: false,
|
|
508
|
-
additional: {
|
|
509
|
-
page: 1,
|
|
510
|
-
tabelName: tabelName
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
}));
|
|
514
|
-
} catch (e) {
|
|
515
|
-
return Promise.reject(e);
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
519
|
-
var page = _ref6.page,
|
|
520
|
-
placeholder = _ref6.placeholder;
|
|
521
|
-
|
|
522
|
-
try {
|
|
523
|
-
return Promise.resolve(_catch(function () {
|
|
524
|
-
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
525
|
-
var token = IUILocalStorageService$1.getAccessToken();
|
|
526
|
-
return Promise.resolve(axios.get(url, {
|
|
527
|
-
headers: {
|
|
528
|
-
Authorization: 'Bearer ' + token
|
|
529
|
-
}
|
|
530
|
-
})).then(function (response) {
|
|
531
|
-
return Promise.resolve(response.data.results.map(function (item) {
|
|
532
|
-
return {
|
|
533
|
-
value: item.id,
|
|
534
|
-
label: item.name
|
|
535
|
-
};
|
|
536
|
-
})).then(function (mappedValue) {
|
|
537
|
-
if (placeholder) {
|
|
538
|
-
var placeholderLbl = {
|
|
539
|
-
value: '',
|
|
540
|
-
label: placeholder
|
|
541
|
-
};
|
|
542
|
-
mappedValue.unshift(placeholderLbl);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
return {
|
|
546
|
-
options: mappedValue,
|
|
547
|
-
hasMore: !!response.data.next,
|
|
548
|
-
additional: {
|
|
549
|
-
page: page + 1,
|
|
550
|
-
placeholder: placeholder
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
});
|
|
554
|
-
});
|
|
555
|
-
}, function () {
|
|
556
|
-
return {
|
|
557
|
-
options: [],
|
|
558
|
-
hasMore: false,
|
|
559
|
-
additional: {
|
|
560
|
-
page: 1,
|
|
561
|
-
placeholder: placeholder
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
}));
|
|
565
|
-
} catch (e) {
|
|
566
|
-
return Promise.reject(e);
|
|
567
|
-
}
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
var dob = {
|
|
571
|
-
maxDate: moment().subtract(18, 'years'),
|
|
572
|
-
minDate: moment().subtract(300, 'years')
|
|
469
|
+
var dob = {
|
|
470
|
+
maxDate: moment().subtract(18, 'years'),
|
|
471
|
+
minDate: moment().subtract(300, 'years')
|
|
573
472
|
};
|
|
574
473
|
var passportStart = {
|
|
575
474
|
maxDate: moment(),
|
|
@@ -722,7 +621,7 @@ var workInfo = [{
|
|
|
722
621
|
value: 'employee_level',
|
|
723
622
|
component: /*#__PURE__*/React.createElement(IUITypography, {
|
|
724
623
|
className: "iui__font--color-link iui__font--weight-500"
|
|
725
|
-
}, "+ Add
|
|
624
|
+
}, "+ Add Employee Level"),
|
|
726
625
|
callback: null
|
|
727
626
|
}
|
|
728
627
|
}, {
|
|
@@ -764,7 +663,7 @@ var workInfo = [{
|
|
|
764
663
|
value: 'entity',
|
|
765
664
|
component: /*#__PURE__*/React.createElement(IUITypography, {
|
|
766
665
|
className: "iui__font--color-link iui__font--weight-500"
|
|
767
|
-
}, "+ Add
|
|
666
|
+
}, "+ Add Entity"),
|
|
768
667
|
callback: null
|
|
769
668
|
}
|
|
770
669
|
}, {
|
|
@@ -786,7 +685,7 @@ var workInfo = [{
|
|
|
786
685
|
value: 'business_unit',
|
|
787
686
|
component: /*#__PURE__*/React.createElement(IUITypography, {
|
|
788
687
|
className: "iui__font--color-link iui__font--weight-500"
|
|
789
|
-
}, "+ Add
|
|
688
|
+
}, "+ Add Business Unit"),
|
|
790
689
|
callback: null
|
|
791
690
|
}
|
|
792
691
|
}, {
|
|
@@ -808,7 +707,7 @@ var workInfo = [{
|
|
|
808
707
|
value: 'department',
|
|
809
708
|
component: /*#__PURE__*/React.createElement(IUITypography, {
|
|
810
709
|
className: "iui__font--color-link iui__font--weight-500"
|
|
811
|
-
}, "+ Add
|
|
710
|
+
}, "+ Add Department"),
|
|
812
711
|
callback: null
|
|
813
712
|
}
|
|
814
713
|
}, {
|
|
@@ -1221,186 +1120,326 @@ var NAoptionConfig = {
|
|
|
1221
1120
|
},
|
|
1222
1121
|
applyFor: ['employee_level', 'department']
|
|
1223
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
|
+
};
|
|
1224
1162
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
_ref$dateFormat = _ref.dateFormat,
|
|
1234
|
-
dateFormat = _ref$dateFormat === void 0 ? 'dd MMM yyyy' : _ref$dateFormat,
|
|
1235
|
-
_ref$errorArray = _ref.errorArray,
|
|
1236
|
-
errorArray = _ref$errorArray === void 0 ? [] : _ref$errorArray,
|
|
1237
|
-
_ref$errorMsg = _ref.errorMsg,
|
|
1238
|
-
errorMsg = _ref$errorMsg === void 0 ? '' : _ref$errorMsg,
|
|
1239
|
-
_ref$showNaOption = _ref.showNaOption,
|
|
1240
|
-
showNaOption = _ref$showNaOption === void 0 ? false : _ref$showNaOption;
|
|
1163
|
+
var IUILocalStorageService$1 = services.IUILocalStorageService;
|
|
1164
|
+
var api = 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;
|
|
1241
1171
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1255
|
-
errorMsg: errorMsg,
|
|
1256
|
-
required: _p.required,
|
|
1257
|
-
readOnly: _p.readOnly,
|
|
1258
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1259
|
-
tooltipText: _p.tooltip,
|
|
1260
|
-
disableText: _p.disableText
|
|
1261
|
-
});
|
|
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
|
+
});
|
|
1262
1184
|
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
required: _p.required
|
|
1267
|
-
}), /*#__PURE__*/React.createElement(IUIDatePicker, {
|
|
1268
|
-
label: _p.label,
|
|
1269
|
-
fullWidth: _p.fullWidth,
|
|
1270
|
-
hasIcon: _p.hasIcon,
|
|
1271
|
-
size: _p.size,
|
|
1272
|
-
name: _p.name,
|
|
1273
|
-
id: _p.name,
|
|
1274
|
-
dateValue: inputState[_p.name],
|
|
1275
|
-
customHandler: customHandler,
|
|
1276
|
-
displayDateType: dateFormat,
|
|
1277
|
-
placeholder: dateFormat.toUpperCase(),
|
|
1278
|
-
maxDate: _p.maxDate,
|
|
1279
|
-
minDate: _p.minDate,
|
|
1280
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1281
|
-
errorMsg: errorMsg,
|
|
1282
|
-
disabled: _p.readOnly,
|
|
1283
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1284
|
-
tooltipText: _p.tooltip,
|
|
1285
|
-
required: _p.required,
|
|
1286
|
-
disableText: _p.disableText
|
|
1287
|
-
}));
|
|
1185
|
+
if (showNaOption && page === 1 && NAoptionConfig.applyFor.includes(tabelName)) {
|
|
1186
|
+
mappedValue.unshift(NAoptionConfig.option);
|
|
1187
|
+
}
|
|
1288
1188
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
disableText: _p.disableText
|
|
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
|
+
};
|
|
1307
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 commonLoadOptionsUM = function commonLoadOptionsUM(search, loadedOptions, _ref2) {
|
|
1224
|
+
var page = _ref2.page,
|
|
1225
|
+
tabelName = _ref2.tabelName,
|
|
1226
|
+
placeholder = _ref2.placeholder,
|
|
1227
|
+
defaultData = _ref2.defaultData;
|
|
1308
1228
|
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1229
|
+
try {
|
|
1230
|
+
return Promise.resolve(_catch(function () {
|
|
1231
|
+
var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
|
|
1232
|
+
return Promise.resolve(api.get(url).then(function (res) {
|
|
1233
|
+
return res.data;
|
|
1234
|
+
})).then(function (response) {
|
|
1235
|
+
var arrList = response.results.filter(function (item) {
|
|
1236
|
+
return item.name !== defaultData;
|
|
1237
|
+
});
|
|
1238
|
+
var mappedValue = arrList.map(function (item) {
|
|
1239
|
+
return {
|
|
1240
|
+
value: item.id,
|
|
1241
|
+
label: item.name
|
|
1242
|
+
};
|
|
1243
|
+
});
|
|
1244
|
+
return {
|
|
1245
|
+
options: mappedValue,
|
|
1246
|
+
hasMore: !!response.next,
|
|
1247
|
+
additional: {
|
|
1248
|
+
page: page + 1,
|
|
1249
|
+
tabelName: tabelName
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
});
|
|
1253
|
+
}, function () {
|
|
1254
|
+
return {
|
|
1255
|
+
options: [],
|
|
1256
|
+
hasMore: false,
|
|
1257
|
+
additional: {
|
|
1258
|
+
page: 1,
|
|
1259
|
+
tabelName: tabelName,
|
|
1260
|
+
placeholder: placeholder
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
}));
|
|
1264
|
+
} catch (e) {
|
|
1265
|
+
return Promise.reject(e);
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
|
|
1269
|
+
var page = _ref3.page;
|
|
1328
1270
|
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1271
|
+
try {
|
|
1272
|
+
return Promise.resolve(_catch(function () {
|
|
1273
|
+
return Promise.resolve(api.get(userAddEditUrl.currencyCode() + "&search=" + search + "&page=" + page).then(function (res) {
|
|
1274
|
+
return res.data;
|
|
1275
|
+
})).then(function (response) {
|
|
1276
|
+
var mappedValue = response.results.map(function (item) {
|
|
1277
|
+
return {
|
|
1278
|
+
value: item.currency_code,
|
|
1279
|
+
label: item.currency_code
|
|
1280
|
+
};
|
|
1281
|
+
});
|
|
1282
|
+
return {
|
|
1283
|
+
options: mappedValue,
|
|
1284
|
+
hasMore: !!response.next,
|
|
1285
|
+
additional: {
|
|
1286
|
+
page: page + 1
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1340
1289
|
});
|
|
1290
|
+
}, function () {
|
|
1291
|
+
return {
|
|
1292
|
+
options: [],
|
|
1293
|
+
hasMore: false,
|
|
1294
|
+
additional: {
|
|
1295
|
+
page: 1
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
}));
|
|
1299
|
+
} catch (e) {
|
|
1300
|
+
return Promise.reject(e);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
|
|
1304
|
+
var page = _ref4.page,
|
|
1305
|
+
product = _ref4.product,
|
|
1306
|
+
userId = _ref4.userId,
|
|
1307
|
+
placeholder = _ref4.placeholder;
|
|
1341
1308
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
name: _p.name,
|
|
1354
|
-
id: _p.name,
|
|
1355
|
-
customHandler: customHandler,
|
|
1356
|
-
value: inputState[_p.name],
|
|
1357
|
-
maxFiles: _p.maxNoFiles,
|
|
1358
|
-
maxFileSize: _p.fileSize,
|
|
1359
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1360
|
-
errorMsg: errorMsg,
|
|
1361
|
-
readOnly: _p.readOnly,
|
|
1362
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1363
|
-
tooltipText: _p.tooltip,
|
|
1364
|
-
disableText: _p.disableText,
|
|
1365
|
-
buttonType: _p.buttonType
|
|
1366
|
-
}));
|
|
1309
|
+
try {
|
|
1310
|
+
return Promise.resolve(_catch(function () {
|
|
1311
|
+
return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
|
|
1312
|
+
return res.data;
|
|
1313
|
+
})).then(function (response) {
|
|
1314
|
+
var mappedValue = response.results.map(function (item) {
|
|
1315
|
+
return {
|
|
1316
|
+
value: item.approver,
|
|
1317
|
+
label: item.approver
|
|
1318
|
+
};
|
|
1319
|
+
});
|
|
1367
1320
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1321
|
+
if (page === 1) {
|
|
1322
|
+
var placeholderLbl = {
|
|
1323
|
+
value: '',
|
|
1324
|
+
label: placeholder
|
|
1325
|
+
};
|
|
1326
|
+
mappedValue.unshift(placeholderLbl);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
return {
|
|
1330
|
+
options: mappedValue,
|
|
1331
|
+
hasMore: !!response.next,
|
|
1332
|
+
additional: {
|
|
1333
|
+
page: page + 1,
|
|
1334
|
+
product: product,
|
|
1335
|
+
userId: userId
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
});
|
|
1339
|
+
}, function () {
|
|
1340
|
+
return {
|
|
1341
|
+
options: [],
|
|
1342
|
+
hasMore: false,
|
|
1343
|
+
additional: {
|
|
1344
|
+
page: 1,
|
|
1345
|
+
product: product,
|
|
1346
|
+
userId: userId
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
}));
|
|
1350
|
+
} catch (e) {
|
|
1351
|
+
return Promise.reject(e);
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
|
|
1355
|
+
var page = _ref5.page,
|
|
1356
|
+
tabelName = _ref5.tabelName;
|
|
1357
|
+
|
|
1358
|
+
try {
|
|
1359
|
+
return Promise.resolve(_catch(function () {
|
|
1360
|
+
return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
|
|
1361
|
+
return res.data;
|
|
1362
|
+
})).then(function (response) {
|
|
1363
|
+
var mappedValue = response.results.map(function (item) {
|
|
1364
|
+
return {
|
|
1365
|
+
value: item[tabelName],
|
|
1366
|
+
label: item[tabelName]
|
|
1367
|
+
};
|
|
1368
|
+
});
|
|
1369
|
+
return {
|
|
1370
|
+
options: mappedValue,
|
|
1371
|
+
hasMore: !!response.next,
|
|
1372
|
+
additional: {
|
|
1373
|
+
page: page + 1,
|
|
1374
|
+
tabelName: tabelName
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
});
|
|
1378
|
+
}, function () {
|
|
1379
|
+
return {
|
|
1380
|
+
options: [],
|
|
1381
|
+
hasMore: false,
|
|
1371
1382
|
additional: {
|
|
1372
1383
|
page: 1,
|
|
1373
|
-
tabelName:
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
name: _p.name,
|
|
1385
|
-
customSelectHandler: customHandler,
|
|
1386
|
-
inputType: _p.inputType,
|
|
1387
|
-
loadOption: _p.loadOption,
|
|
1388
|
-
isError: errorArray.indexOf(_p.name) !== -1,
|
|
1389
|
-
errorMsg: errorMsg,
|
|
1390
|
-
required: _p.required,
|
|
1391
|
-
readOnly: _p.readOnly,
|
|
1392
|
-
placeHolderCheck: inputState[_p.name] !== undefined && inputState[_p.name].value === '',
|
|
1393
|
-
hasInfoIcon: !!_p.tooltip,
|
|
1394
|
-
tooltipText: _p.tooltip,
|
|
1395
|
-
disableText: _p.disableText,
|
|
1396
|
-
selectCTA: _p.selectCTA,
|
|
1397
|
-
clearCache: _p.clearCache
|
|
1398
|
-
});
|
|
1384
|
+
tabelName: tabelName
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
}));
|
|
1388
|
+
} catch (e) {
|
|
1389
|
+
return Promise.reject(e);
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
|
|
1393
|
+
var page = _ref6.page,
|
|
1394
|
+
placeholder = _ref6.placeholder;
|
|
1399
1395
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1396
|
+
try {
|
|
1397
|
+
return Promise.resolve(_catch(function () {
|
|
1398
|
+
var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
|
|
1399
|
+
var token = IUILocalStorageService$1.getAccessToken();
|
|
1400
|
+
return Promise.resolve(axios.get(url, {
|
|
1401
|
+
headers: {
|
|
1402
|
+
Authorization: 'Bearer ' + token
|
|
1403
|
+
}
|
|
1404
|
+
})).then(function (response) {
|
|
1405
|
+
return Promise.resolve(response.data.results.map(function (item) {
|
|
1406
|
+
return {
|
|
1407
|
+
value: item.id,
|
|
1408
|
+
label: item.name
|
|
1409
|
+
};
|
|
1410
|
+
})).then(function (mappedValue) {
|
|
1411
|
+
if (placeholder) {
|
|
1412
|
+
var placeholderLbl = {
|
|
1413
|
+
value: '',
|
|
1414
|
+
label: placeholder
|
|
1415
|
+
};
|
|
1416
|
+
mappedValue.unshift(placeholderLbl);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
return {
|
|
1420
|
+
options: mappedValue,
|
|
1421
|
+
hasMore: !!response.data.next,
|
|
1422
|
+
additional: {
|
|
1423
|
+
page: page + 1,
|
|
1424
|
+
placeholder: placeholder
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
});
|
|
1428
|
+
});
|
|
1429
|
+
}, function () {
|
|
1430
|
+
return {
|
|
1431
|
+
options: [],
|
|
1432
|
+
hasMore: false,
|
|
1433
|
+
additional: {
|
|
1434
|
+
page: 1,
|
|
1435
|
+
placeholder: placeholder
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
}));
|
|
1439
|
+
} catch (e) {
|
|
1440
|
+
return Promise.reject(e);
|
|
1402
1441
|
}
|
|
1403
|
-
}
|
|
1442
|
+
};
|
|
1404
1443
|
|
|
1405
1444
|
var UserRole = function UserRole(_ref) {
|
|
1406
1445
|
var _ref$list = _ref.list,
|
|
@@ -2461,98 +2500,85 @@ var closeDialog = function closeDialog() {
|
|
|
2461
2500
|
type: CLOSE_DIALOG
|
|
2462
2501
|
};
|
|
2463
2502
|
};
|
|
2464
|
-
var
|
|
2465
|
-
return function (dispatch) {
|
|
2466
|
-
return new Promise(function (resolve, reject) {
|
|
2467
|
-
api$3.get(userPanelUrl.getPaginationUnit(tableName, length, page)).then(function (res) {
|
|
2468
|
-
dispatch({
|
|
2469
|
-
type: FETCH_USERPANEL_DATA,
|
|
2470
|
-
payload: res.data
|
|
2471
|
-
});
|
|
2472
|
-
dispatch(userPanelStopLoader());
|
|
2473
|
-
resolve();
|
|
2474
|
-
})["catch"](function () {
|
|
2475
|
-
dispatch(userPanelStopLoader());
|
|
2476
|
-
});
|
|
2477
|
-
});
|
|
2478
|
-
};
|
|
2479
|
-
};
|
|
2480
|
-
var getUserPanalData = function getUserPanalData(tableName, length) {
|
|
2503
|
+
var getUserPanalData = function getUserPanalData(params) {
|
|
2481
2504
|
return function (dispatch) {
|
|
2482
2505
|
return new Promise(function (resolve, reject) {
|
|
2483
|
-
api$3.get(userPanelUrl.
|
|
2506
|
+
api$3.get(userPanelUrl.getPaginationUnit(params.tableName, params.rowsPerPage, params.page, params.orderingParam)).then(function (res) {
|
|
2484
2507
|
dispatch({
|
|
2485
2508
|
type: FETCH_USERPANEL_DATA,
|
|
2486
2509
|
payload: res.data
|
|
2487
2510
|
});
|
|
2488
2511
|
dispatch(userPanelStopLoader());
|
|
2489
2512
|
resolve();
|
|
2490
|
-
})["catch"](function () {
|
|
2513
|
+
})["catch"](function (err) {
|
|
2514
|
+
var _err$response, _err$response$data;
|
|
2515
|
+
|
|
2491
2516
|
dispatch(userPanelStopLoader());
|
|
2517
|
+
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.');
|
|
2492
2518
|
});
|
|
2493
2519
|
});
|
|
2494
2520
|
};
|
|
2495
2521
|
};
|
|
2496
|
-
var addRecord = function addRecord(tableName, data) {
|
|
2522
|
+
var addRecord = function addRecord(tableName, data, getParam) {
|
|
2497
2523
|
return function (dispatch) {
|
|
2498
2524
|
return new Promise(function (resolve, reject) {
|
|
2499
2525
|
api$3.post(userPanelUrl.addUnit(tableName), data).then(function (res) {
|
|
2500
|
-
dispatch(getUserPanalData(
|
|
2526
|
+
dispatch(getUserPanalData(getParam));
|
|
2501
2527
|
dispatch(closeDialog());
|
|
2502
2528
|
resolve(res);
|
|
2503
2529
|
})["catch"](function (err) {
|
|
2504
|
-
var _err$
|
|
2530
|
+
var _err$response2, _err$response2$data;
|
|
2505
2531
|
|
|
2506
2532
|
dispatch(userPanelStopLoader());
|
|
2507
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2533
|
+
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.');
|
|
2508
2534
|
});
|
|
2509
2535
|
});
|
|
2510
2536
|
};
|
|
2511
2537
|
};
|
|
2512
|
-
var deleteRecord = function deleteRecord(tableName, id) {
|
|
2538
|
+
var deleteRecord = function deleteRecord(tableName, id, getParam) {
|
|
2513
2539
|
return function (dispatch) {
|
|
2514
2540
|
return new Promise(function (resolve, reject) {
|
|
2515
2541
|
api$3.post(userPanelUrl.deleteUnit(tableName), id).then(function (res) {
|
|
2516
|
-
dispatch(
|
|
2542
|
+
dispatch(getUserPanalData(getParam));
|
|
2517
2543
|
dispatch(closeDialog());
|
|
2518
2544
|
dispatch(userPanelStopLoader());
|
|
2519
2545
|
resolve();
|
|
2520
2546
|
})["catch"](function (err) {
|
|
2521
|
-
var _err$
|
|
2547
|
+
var _err$response3, _err$response3$data;
|
|
2522
2548
|
|
|
2523
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2549
|
+
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.');
|
|
2524
2550
|
dispatch(userPanelStopLoader());
|
|
2525
2551
|
});
|
|
2526
2552
|
});
|
|
2527
2553
|
};
|
|
2528
2554
|
};
|
|
2529
|
-
var editRecord = function editRecord(tableName, data) {
|
|
2555
|
+
var editRecord = function editRecord(tableName, data, getParam) {
|
|
2530
2556
|
return function (dispatch) {
|
|
2531
2557
|
return new Promise(function (resolve, reject) {
|
|
2532
2558
|
api$3.post(userPanelUrl.editUnit(tableName), data).then(function (res) {
|
|
2533
|
-
dispatch(
|
|
2559
|
+
dispatch(getUserPanalData(getParam));
|
|
2534
2560
|
dispatch(closeDialog());
|
|
2535
2561
|
resolve();
|
|
2536
2562
|
})["catch"](function (err) {
|
|
2537
|
-
var _err$
|
|
2563
|
+
var _err$response4, _err$response4$data;
|
|
2538
2564
|
|
|
2539
2565
|
dispatch(userPanelStopLoader());
|
|
2540
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2566
|
+
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.');
|
|
2541
2567
|
});
|
|
2542
2568
|
});
|
|
2543
2569
|
};
|
|
2544
2570
|
};
|
|
2545
|
-
var moveRecord = function moveRecord(tableName, data) {
|
|
2571
|
+
var moveRecord = function moveRecord(tableName, data, getParam) {
|
|
2546
2572
|
return function (dispatch) {
|
|
2547
2573
|
return new Promise(function (resolve, reject) {
|
|
2548
2574
|
api$3.post(userPanelUrl.moveUnit(tableName), data).then(function (res) {
|
|
2549
|
-
dispatch(getUserPanalData(
|
|
2575
|
+
dispatch(getUserPanalData(getParam));
|
|
2550
2576
|
dispatch(closeDialog());
|
|
2551
2577
|
resolve(res);
|
|
2552
2578
|
})["catch"](function (err) {
|
|
2553
|
-
var _err$
|
|
2579
|
+
var _err$response5, _err$response5$data;
|
|
2554
2580
|
|
|
2555
|
-
IUIToastMessageService$2.warningNotify((err === null || err === void 0 ? void 0 : (_err$
|
|
2581
|
+
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.');
|
|
2556
2582
|
});
|
|
2557
2583
|
});
|
|
2558
2584
|
};
|
|
@@ -3503,7 +3529,9 @@ var initialState = {
|
|
|
3503
3529
|
secureTravelInfo: secureTravelInfo,
|
|
3504
3530
|
disableText: '',
|
|
3505
3531
|
travelRoles: travelConstants.roles,
|
|
3506
|
-
expenseRoles: expenseConstants.roles
|
|
3532
|
+
expenseRoles: expenseConstants.roles,
|
|
3533
|
+
travelConstants: travelConstants,
|
|
3534
|
+
expenseConstants: expenseConstants
|
|
3507
3535
|
},
|
|
3508
3536
|
dropdownList: dropdownList,
|
|
3509
3537
|
maxTravelApprovers: 10,
|
|
@@ -3538,6 +3566,10 @@ var reducer = function reducer(state, action) {
|
|
|
3538
3566
|
{
|
|
3539
3567
|
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;
|
|
3540
3568
|
|
|
3569
|
+
if (!action.payload.labels) {
|
|
3570
|
+
action.payload.labels = userAddPageFormLabels;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3541
3573
|
var renderFields = _extends({}, state.renderFields);
|
|
3542
3574
|
|
|
3543
3575
|
var _action$payload$visib = action.payload.visibility,
|
|
@@ -3548,14 +3580,36 @@ var reducer = function reducer(state, action) {
|
|
|
3548
3580
|
userPersonalInfoOptionalFields = _action$payload$optio.user_personal_info,
|
|
3549
3581
|
employeeInfoOptionalFields = _action$payload$optio.employee_info,
|
|
3550
3582
|
userTravelInfoOptionalFields = _action$payload$optio.user_travel_info;
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3583
|
+
var _action$payload$label = action.payload.labels,
|
|
3584
|
+
userPersonalInfoLabels = _action$payload$label.user_personal_info,
|
|
3585
|
+
employeeInfoLabels = _action$payload$label.employee_info,
|
|
3586
|
+
userTravelInfoLabels = _action$payload$label.user_travel_info,
|
|
3587
|
+
productLabels = _action$payload$label.products,
|
|
3588
|
+
travelFYIlabel = _action$payload$label.travel_fyi_approver,
|
|
3589
|
+
expenseFYIlabel = _action$payload$label.expense_fyi_approver;
|
|
3590
|
+
renderFields.personalInfo = setFieldsDisplayAtt(renderFields.personalInfo, userPersonalInfo, userPersonalInfoOptionalFields, userPersonalInfoLabels);
|
|
3591
|
+
renderFields.workInfo = setFieldsDisplayAtt(renderFields.workInfo, employeeInfo, employeeInfoOptionalFields, employeeInfoLabels);
|
|
3592
|
+
renderFields.passportInfo = setFieldsDisplayAtt(renderFields.passportInfo, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3593
|
+
renderFields.travelPreference = setFieldsDisplayAtt(renderFields.travelPreference, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3594
|
+
renderFields.secureTravelInfo = setFieldsDisplayAtt(renderFields.secureTravelInfo, userTravelInfo, userTravelInfoOptionalFields, userTravelInfoLabels);
|
|
3556
3595
|
renderFields.products = renderFields.products.filter(function (product) {
|
|
3557
3596
|
return action.payload.products.includes(product.name);
|
|
3597
|
+
}).map(function (product) {
|
|
3598
|
+
if (productLabels && Object.hasOwnProperty.call(productLabels, product.name)) {
|
|
3599
|
+
product.label = productLabels[product.name];
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
return product;
|
|
3558
3603
|
});
|
|
3604
|
+
|
|
3605
|
+
if (travelFYIlabel) {
|
|
3606
|
+
renderFields.travelConstants.FYILabel = travelFYIlabel;
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
if (expenseFYIlabel) {
|
|
3610
|
+
renderFields.expenseConstants.FYILabel = expenseFYIlabel;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3559
3613
|
renderFields.custom_attributes = action.payload.custom_attributes;
|
|
3560
3614
|
|
|
3561
3615
|
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) {
|
|
@@ -3812,7 +3866,7 @@ var reducer = function reducer(state, action) {
|
|
|
3812
3866
|
}
|
|
3813
3867
|
};
|
|
3814
3868
|
|
|
3815
|
-
var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj, optionalObj) {
|
|
3869
|
+
var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj, optionalObj, labelsObj) {
|
|
3816
3870
|
return objToLoop.map(function (p) {
|
|
3817
3871
|
var key = p.name;
|
|
3818
3872
|
|
|
@@ -3838,6 +3892,10 @@ var setFieldsDisplayAtt = function setFieldsDisplayAtt(objToLoop, visibilityObj,
|
|
|
3838
3892
|
p.required = false;
|
|
3839
3893
|
}
|
|
3840
3894
|
|
|
3895
|
+
if (labelsObj && Object.hasOwnProperty.call(labelsObj, p.name)) {
|
|
3896
|
+
p.label = labelsObj[p.name];
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3841
3899
|
return p;
|
|
3842
3900
|
});
|
|
3843
3901
|
};
|
|
@@ -5091,11 +5149,16 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5091
5149
|
} else if (id === 'department') {
|
|
5092
5150
|
title = 'Department';
|
|
5093
5151
|
} else if (id === 'business_unit') {
|
|
5094
|
-
title = 'Business
|
|
5152
|
+
title = 'Business Unit';
|
|
5095
5153
|
} else if (id === 'employee_level') {
|
|
5096
|
-
title = 'Employee
|
|
5154
|
+
title = 'Employee Level';
|
|
5097
5155
|
}
|
|
5098
5156
|
|
|
5157
|
+
console.log(_extends({}, addModalData, {
|
|
5158
|
+
isOpen: true,
|
|
5159
|
+
title: title,
|
|
5160
|
+
id: id
|
|
5161
|
+
}));
|
|
5099
5162
|
setAddModalData(_extends({}, addModalData, {
|
|
5100
5163
|
isOpen: true,
|
|
5101
5164
|
title: title,
|
|
@@ -5117,6 +5180,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5117
5180
|
})).then(function (res) {
|
|
5118
5181
|
var _extends2;
|
|
5119
5182
|
|
|
5183
|
+
console.log(res, "success add " + addModalData.title + " response");
|
|
5120
5184
|
setAddModalData(_extends({}, addModalData, {
|
|
5121
5185
|
isOpen: false
|
|
5122
5186
|
}));
|
|
@@ -5126,9 +5190,11 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5126
5190
|
value: res.data.value,
|
|
5127
5191
|
label: res.data.label
|
|
5128
5192
|
}, _extends2)));
|
|
5193
|
+
console.log('Set new value', res.data.label);
|
|
5129
5194
|
clearCacheForAsyncDropdown(function (prevState) {
|
|
5130
5195
|
var _extends3;
|
|
5131
5196
|
|
|
5197
|
+
console.log('ClearCache function called');
|
|
5132
5198
|
return _extends({}, prevState, (_extends3 = {}, _extends3[tempKey] = prevState[tempKey] + 1, _extends3));
|
|
5133
5199
|
});
|
|
5134
5200
|
dispatch(stopLoader());
|
|
@@ -5391,7 +5457,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5391
5457
|
if ((_name === 'passport_photo' || _name === 'travel_docs') && _obj.openFile === true) {
|
|
5392
5458
|
if (_obj.file.isExistingFile) {
|
|
5393
5459
|
var link = document.createElement('a');
|
|
5394
|
-
link.setAttribute('
|
|
5460
|
+
link.setAttribute('download', _obj.file.name);
|
|
5395
5461
|
link.href = _obj.file.presigned_url;
|
|
5396
5462
|
document.body.appendChild(link);
|
|
5397
5463
|
link.click();
|
|
@@ -5405,7 +5471,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
5405
5471
|
})).then(function (res) {
|
|
5406
5472
|
dispatch(stopLoader());
|
|
5407
5473
|
var link = document.createElement('a');
|
|
5408
|
-
link.setAttribute('
|
|
5474
|
+
link.setAttribute('download', _obj.file.returned_file_name);
|
|
5409
5475
|
link.href = res.data.presigned_url;
|
|
5410
5476
|
document.body.appendChild(link);
|
|
5411
5477
|
link.click();
|
|
@@ -6592,7 +6658,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6592
6658
|
className: styles.dividerColor
|
|
6593
6659
|
}), productAccess && productAccess.travel && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(TravelExpenseFields, {
|
|
6594
6660
|
fieldsInfo: renderFields.travelApprovers,
|
|
6595
|
-
travelConstants: travelConstants,
|
|
6661
|
+
travelConstants: renderFields.travelConstants,
|
|
6596
6662
|
type: "travel",
|
|
6597
6663
|
addFields: function addFields() {
|
|
6598
6664
|
return dispatch(addTravelApproverField());
|
|
@@ -6630,7 +6696,7 @@ var UserAddEdit = function UserAddEdit(props) {
|
|
|
6630
6696
|
className: styles.dividerColor
|
|
6631
6697
|
}), productAccess && productAccess.expense && /*#__PURE__*/React.createElement(TravelExpenseFields, {
|
|
6632
6698
|
fieldsInfo: renderFields.expenseApprovers,
|
|
6633
|
-
travelConstants: expenseConstants,
|
|
6699
|
+
travelConstants: renderFields.expenseConstants,
|
|
6634
6700
|
type: "expense",
|
|
6635
6701
|
addFields: function addFields() {
|
|
6636
6702
|
return dispatch(addExpenseApproverField());
|
|
@@ -8927,9 +8993,13 @@ var index$2 = withStore(UserList);
|
|
|
8927
8993
|
|
|
8928
8994
|
function Header(props) {
|
|
8929
8995
|
var HeaderButton = props.HeaderButton,
|
|
8930
|
-
name = props.name,
|
|
8931
|
-
|
|
8932
|
-
|
|
8996
|
+
_props$name = props.name,
|
|
8997
|
+
name = _props$name === void 0 ? '' : _props$name,
|
|
8998
|
+
_props$headingName = props.headingName,
|
|
8999
|
+
headingName = _props$headingName === void 0 ? '' : _props$headingName,
|
|
9000
|
+
_props$subHeading = props.subHeading,
|
|
9001
|
+
subHeading = _props$subHeading === void 0 ? '' : _props$subHeading,
|
|
9002
|
+
loading = props.loading;
|
|
8933
9003
|
|
|
8934
9004
|
var _useSelector = useSelector(function (state) {
|
|
8935
9005
|
return state.common;
|
|
@@ -8962,7 +9032,7 @@ function Header(props) {
|
|
|
8962
9032
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
8963
9033
|
variant: "h3",
|
|
8964
9034
|
className: clsx(styles$5.heading, styles$5.headingLarge)
|
|
8965
|
-
}, isILadmin === 1 && companyName + " - ",
|
|
9035
|
+
}, isILadmin === 1 && companyName !== null && companyName + " - ", ' ', headingName)), /*#__PURE__*/React.createElement(IUIBox, {
|
|
8966
9036
|
component: "div",
|
|
8967
9037
|
className: styles$5.headingWrapper
|
|
8968
9038
|
}, /*#__PURE__*/React.createElement(IUITypography, {
|
|
@@ -8979,6 +9049,7 @@ function Header(props) {
|
|
|
8979
9049
|
component: "div",
|
|
8980
9050
|
className: "pageHeader--button-single button-right"
|
|
8981
9051
|
}, /*#__PURE__*/React.createElement(IUIButton, {
|
|
9052
|
+
disabled: loading,
|
|
8982
9053
|
type: "contained",
|
|
8983
9054
|
buttonText: "+ Add " + name.toLowerCase(),
|
|
8984
9055
|
onClick: HeaderButton
|
|
@@ -8995,31 +9066,18 @@ var styles$7 = {"sidebar__container":"_1EFxC","sidebar__wrapper":"_3Mk3_","sideb
|
|
|
8995
9066
|
function Listview(_ref) {
|
|
8996
9067
|
var data = _ref.data,
|
|
8997
9068
|
name = _ref.name,
|
|
8998
|
-
tableName = _ref.tableName,
|
|
8999
9069
|
handleEditDialog = _ref.handleEditDialog,
|
|
9000
|
-
handleDeleteDialog = _ref.handleDeleteDialog
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
var handleChangePage = function handleChangePage(e, newPage) {
|
|
9012
|
-
setPage(newPage);
|
|
9013
|
-
};
|
|
9014
|
-
|
|
9015
|
-
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
9016
|
-
setRowsPerPage(+event.target.value);
|
|
9017
|
-
setPage(1);
|
|
9018
|
-
};
|
|
9019
|
-
|
|
9020
|
-
useEffect(function () {
|
|
9021
|
-
dispatch(getUserPanalOnPageChange(tableName, rowsPerPage, page));
|
|
9022
|
-
}, [rowsPerPage, page]);
|
|
9070
|
+
handleDeleteDialog = _ref.handleDeleteDialog,
|
|
9071
|
+
orderBy = _ref.orderBy,
|
|
9072
|
+
order = _ref.order,
|
|
9073
|
+
_ref$onRequestSort = _ref.onRequestSort,
|
|
9074
|
+
onRequestSort = _ref$onRequestSort === void 0 ? function () {} : _ref$onRequestSort,
|
|
9075
|
+
_ref$handleChangeRows = _ref.handleChangeRowsPerPage,
|
|
9076
|
+
handleChangeRowsPerPage = _ref$handleChangeRows === void 0 ? function () {} : _ref$handleChangeRows,
|
|
9077
|
+
_ref$handleChangePage = _ref.handleChangePage,
|
|
9078
|
+
handleChangePage = _ref$handleChangePage === void 0 ? function () {} : _ref$handleChangePage,
|
|
9079
|
+
page = _ref.page,
|
|
9080
|
+
rowsPerPage = _ref.rowsPerPage;
|
|
9023
9081
|
var columns = [{
|
|
9024
9082
|
id: 'name',
|
|
9025
9083
|
label: name,
|
|
@@ -9034,6 +9092,7 @@ function Listview(_ref) {
|
|
|
9034
9092
|
id: 'no_of_users',
|
|
9035
9093
|
label: 'Number of users',
|
|
9036
9094
|
width: '45%',
|
|
9095
|
+
sortable: true,
|
|
9037
9096
|
cell: function cell(row) {
|
|
9038
9097
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
9039
9098
|
component: "div"
|
|
@@ -9070,16 +9129,19 @@ function Listview(_ref) {
|
|
|
9070
9129
|
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIBox, {
|
|
9071
9130
|
p: 3
|
|
9072
9131
|
}, /*#__PURE__*/React.createElement(IUITable, {
|
|
9073
|
-
hasFilter: false,
|
|
9074
|
-
isCheckboxTable: false,
|
|
9075
9132
|
searchHide: true,
|
|
9133
|
+
hasFilter: true,
|
|
9134
|
+
isCheckboxTable: false,
|
|
9076
9135
|
count: data.count,
|
|
9077
9136
|
columns: columns,
|
|
9078
9137
|
rows: data.results,
|
|
9079
9138
|
page: page,
|
|
9080
9139
|
handleChangePage: handleChangePage,
|
|
9081
9140
|
handleChangeRowsPerPage: handleChangeRowsPerPage,
|
|
9082
|
-
rowsPerPage: rowsPerPage
|
|
9141
|
+
rowsPerPage: rowsPerPage,
|
|
9142
|
+
orderBy: orderBy,
|
|
9143
|
+
order: order,
|
|
9144
|
+
onRequestSort: onRequestSort
|
|
9083
9145
|
})));
|
|
9084
9146
|
}
|
|
9085
9147
|
|
|
@@ -9361,6 +9423,32 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9361
9423
|
alertModal = _useState11[0],
|
|
9362
9424
|
setAlertModal = _useState11[1];
|
|
9363
9425
|
|
|
9426
|
+
var _React$useState = React.useState('asc'),
|
|
9427
|
+
order = _React$useState[0],
|
|
9428
|
+
setOrder = _React$useState[1];
|
|
9429
|
+
|
|
9430
|
+
var _React$useState2 = React.useState('name'),
|
|
9431
|
+
orderBy = _React$useState2[0],
|
|
9432
|
+
setOrderBy = _React$useState2[1];
|
|
9433
|
+
|
|
9434
|
+
var _useState12 = useState(false),
|
|
9435
|
+
isSortingChange = _useState12[0],
|
|
9436
|
+
setSortingChange = _useState12[1];
|
|
9437
|
+
|
|
9438
|
+
var _useState13 = useState(false),
|
|
9439
|
+
isSortingChangeTemp = _useState13[0],
|
|
9440
|
+
setSortingChangeTemp = _useState13[1];
|
|
9441
|
+
|
|
9442
|
+
var _useState14 = useState(1),
|
|
9443
|
+
page = _useState14[0],
|
|
9444
|
+
setPage = _useState14[1];
|
|
9445
|
+
|
|
9446
|
+
var _useState15 = useState(5),
|
|
9447
|
+
rowsPerPage = _useState15[0],
|
|
9448
|
+
setRowsPerPage = _useState15[1];
|
|
9449
|
+
|
|
9450
|
+
var orderingParam = orderBy;
|
|
9451
|
+
|
|
9364
9452
|
var _useSelector = useSelector(function (state) {
|
|
9365
9453
|
return state.userPanel;
|
|
9366
9454
|
}),
|
|
@@ -9390,16 +9478,37 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9390
9478
|
useEffect(function () {
|
|
9391
9479
|
var roleCanAccess = ['travel_itilite_admin', 'travel_admin', 'expense_itilite_admin', 'expense_admin'];
|
|
9392
9480
|
dispatch(verifyAccessToken(roleCanAccess));
|
|
9481
|
+
window.scrollTo(0, 0);
|
|
9393
9482
|
}, []);
|
|
9394
9483
|
useEffect(function () {
|
|
9395
9484
|
dispatch(userPanelShowLoader());
|
|
9396
9485
|
|
|
9397
9486
|
if (isTokenVerified) {
|
|
9398
|
-
|
|
9399
|
-
return dispatch(userPanelStopLoader());
|
|
9400
|
-
});
|
|
9487
|
+
calApiPanelList();
|
|
9401
9488
|
}
|
|
9402
|
-
}, [isTokenVerified]);
|
|
9489
|
+
}, [isTokenVerified, isSortingChangeTemp]);
|
|
9490
|
+
|
|
9491
|
+
var calApiPanelList = function calApiPanelList() {
|
|
9492
|
+
dispatch(getUserPanalData(getApiData())).then(function () {
|
|
9493
|
+
return dispatch(userPanelStopLoader());
|
|
9494
|
+
})["finally"](function () {
|
|
9495
|
+
if (isSortingChange) {
|
|
9496
|
+
setSortingChange(false);
|
|
9497
|
+
}
|
|
9498
|
+
});
|
|
9499
|
+
};
|
|
9500
|
+
|
|
9501
|
+
var getApiData = function getApiData() {
|
|
9502
|
+
orderingParam = order === 'asc' ? orderBy : '-' + orderBy;
|
|
9503
|
+
var urlData = {
|
|
9504
|
+
tableName: tableName,
|
|
9505
|
+
rowsPerPage: rowsPerPage,
|
|
9506
|
+
page: page,
|
|
9507
|
+
orderingParam: orderingParam
|
|
9508
|
+
};
|
|
9509
|
+
return urlData;
|
|
9510
|
+
};
|
|
9511
|
+
|
|
9403
9512
|
useEffect(function () {
|
|
9404
9513
|
var arrList = userPanelData.results.filter(function (item) {
|
|
9405
9514
|
return item.name !== dialogData.data.name;
|
|
@@ -9458,48 +9567,61 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9458
9567
|
var handleAddUserPanel = function handleAddUserPanel() {
|
|
9459
9568
|
if (dataList) {
|
|
9460
9569
|
setErrorAdd(false);
|
|
9461
|
-
|
|
9462
|
-
dispatch(addRecord(tableName, {
|
|
9570
|
+
var payload = {
|
|
9463
9571
|
names: [dataList]
|
|
9464
|
-
}
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
dispatch(userPanelStopLoader());
|
|
9468
|
-
setDataList('');
|
|
9469
|
-
});
|
|
9572
|
+
};
|
|
9573
|
+
var message = title + " added successfully.";
|
|
9574
|
+
handleApiCall(addRecord, payload, message, 'add');
|
|
9470
9575
|
} else {
|
|
9471
9576
|
setErrorAdd(true);
|
|
9472
9577
|
}
|
|
9473
9578
|
};
|
|
9474
9579
|
|
|
9475
|
-
var handleDeletePanel = function handleDeletePanel(
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9580
|
+
var handleDeletePanel = function handleDeletePanel() {
|
|
9581
|
+
var payload = {
|
|
9582
|
+
row_ids: [dialogData.data.id]
|
|
9583
|
+
};
|
|
9584
|
+
var message = title + " deleted successfully.";
|
|
9585
|
+
handleApiCall(deleteRecord, payload, message, 'delete');
|
|
9586
|
+
};
|
|
9587
|
+
|
|
9588
|
+
var handleApiCall = function handleApiCall(dispatchFun, payload, message, type) {
|
|
9589
|
+
dispatch(userPanelShowLoader());
|
|
9590
|
+
dispatch(dispatchFun(tableName, payload, getApiData())).then(function (res) {
|
|
9591
|
+
IUIToastMessageService$8.sNotify(type === 'move' ? res.data.message : "" + message);
|
|
9592
|
+
dispatch(userPanelStopLoader());
|
|
9593
|
+
|
|
9594
|
+
if (type === 'delete') {
|
|
9483
9595
|
closeDeleteModal();
|
|
9484
|
-
}
|
|
9485
|
-
|
|
9596
|
+
}
|
|
9597
|
+
|
|
9598
|
+
if (type === 'add') {
|
|
9599
|
+
closeDeActivateModal();
|
|
9600
|
+
setDataList('');
|
|
9601
|
+
}
|
|
9602
|
+
|
|
9603
|
+
if (type === 'move') {
|
|
9604
|
+
setMoveModal(false);
|
|
9605
|
+
dispatch(closeDialog());
|
|
9606
|
+
setSelectValue('');
|
|
9607
|
+
}
|
|
9608
|
+
|
|
9609
|
+
if (type === 'edit') {
|
|
9610
|
+
closeEditDialog();
|
|
9611
|
+
setDataList('');
|
|
9612
|
+
}
|
|
9613
|
+
});
|
|
9486
9614
|
};
|
|
9487
9615
|
|
|
9488
9616
|
var handleMovePanel = function handleMovePanel() {
|
|
9489
9617
|
if (selectValue) {
|
|
9490
|
-
|
|
9491
|
-
dispatch(userPanelShowLoader());
|
|
9492
|
-
dispatch(moveRecord(tableName, {
|
|
9618
|
+
var payload = {
|
|
9493
9619
|
table_name: tableName,
|
|
9494
9620
|
from: dialogData.data.name,
|
|
9495
9621
|
to: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
9496
|
-
}
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
dispatch(closeDialog());
|
|
9500
|
-
dispatch(userPanelStopLoader());
|
|
9501
|
-
setSelectValue('');
|
|
9502
|
-
});
|
|
9622
|
+
};
|
|
9623
|
+
handleApiCall(moveRecord, payload, 'message', 'move');
|
|
9624
|
+
setErrorMove(false);
|
|
9503
9625
|
} else {
|
|
9504
9626
|
setErrorMove(true);
|
|
9505
9627
|
}
|
|
@@ -9507,19 +9629,15 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9507
9629
|
|
|
9508
9630
|
var handleEditPanel = function handleEditPanel(data) {
|
|
9509
9631
|
if (dataList) {
|
|
9510
|
-
|
|
9511
|
-
dispatch(userPanelShowLoader());
|
|
9512
|
-
dispatch(editRecord(tableName, {
|
|
9632
|
+
var payload = {
|
|
9513
9633
|
rows: [{
|
|
9514
9634
|
id: dialogData.data.id,
|
|
9515
9635
|
name: dataList
|
|
9516
9636
|
}]
|
|
9517
|
-
}
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
setDataList('');
|
|
9522
|
-
});
|
|
9637
|
+
};
|
|
9638
|
+
var message = title + " updated successfully.";
|
|
9639
|
+
handleApiCall(editRecord, payload, message, 'edit');
|
|
9640
|
+
setErrorEdit(false);
|
|
9523
9641
|
} else {
|
|
9524
9642
|
setErrorEdit(true);
|
|
9525
9643
|
}
|
|
@@ -9543,21 +9661,49 @@ var UserPanel = function UserPanel(_ref) {
|
|
|
9543
9661
|
setAlertModal(false);
|
|
9544
9662
|
};
|
|
9545
9663
|
|
|
9664
|
+
var onRequestSort = function onRequestSort(event, property) {
|
|
9665
|
+
var isAsc = orderBy === property && order === 'asc';
|
|
9666
|
+
setOrder(isAsc ? 'desc' : 'asc');
|
|
9667
|
+
setOrderBy(property);
|
|
9668
|
+
setSortingChange(true);
|
|
9669
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9670
|
+
};
|
|
9671
|
+
|
|
9672
|
+
var handleChangePage = function handleChangePage(e, newPage) {
|
|
9673
|
+
setPage(newPage);
|
|
9674
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9675
|
+
};
|
|
9676
|
+
|
|
9677
|
+
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
9678
|
+
setRowsPerPage(+event.target.value);
|
|
9679
|
+
setPage(1);
|
|
9680
|
+
setSortingChange(true);
|
|
9681
|
+
setSortingChangeTemp(!isSortingChangeTemp);
|
|
9682
|
+
};
|
|
9683
|
+
|
|
9546
9684
|
return /*#__PURE__*/React.createElement(IUIBox, {
|
|
9547
9685
|
component: "div",
|
|
9548
9686
|
className: styles$5.UUIUserManagementList
|
|
9549
|
-
}, hasVerificationError === false ? /*#__PURE__*/React.createElement(Fragment$1, null,
|
|
9687
|
+
}, hasVerificationError === false ? /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(Header, {
|
|
9550
9688
|
name: title,
|
|
9551
9689
|
headingName: headingName,
|
|
9552
9690
|
subHeading: subHeading,
|
|
9553
|
-
HeaderButton: addDialog
|
|
9554
|
-
|
|
9691
|
+
HeaderButton: addDialog,
|
|
9692
|
+
loading: loading
|
|
9693
|
+
}), loading ? /*#__PURE__*/React.createElement(SkeletonLoader, null) : /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(Listview, {
|
|
9555
9694
|
data: userPanelData,
|
|
9556
9695
|
name: title,
|
|
9557
9696
|
tableName: tableName,
|
|
9558
9697
|
handleEditDialog: openEditDialog,
|
|
9559
9698
|
handleDeleteDialog: openDeleteModal,
|
|
9560
|
-
closeDeActivateModal: closeDeActivateModal
|
|
9699
|
+
closeDeActivateModal: closeDeActivateModal,
|
|
9700
|
+
orderBy: orderBy,
|
|
9701
|
+
order: order,
|
|
9702
|
+
onRequestSort: onRequestSort,
|
|
9703
|
+
handleChangePage: handleChangePage,
|
|
9704
|
+
handleChangeRowsPerPage: handleChangeRowsPerPage,
|
|
9705
|
+
rowsPerPage: rowsPerPage,
|
|
9706
|
+
page: page
|
|
9561
9707
|
})), /*#__PURE__*/React.createElement(AddPanelDialog, {
|
|
9562
9708
|
name: title,
|
|
9563
9709
|
isOpen: addModal,
|