@itilite/iui-user-management 0.1.11 → 0.1.13

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.
@@ -1,10 +1,10 @@
1
1
  import { IUITypography, IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, 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';
4
5
  import moment from 'moment';
5
6
  import AddIcon$1 from '@material-ui/icons/Add';
6
7
  import DeleteIcon from '@material-ui/icons/Delete';
7
- import axios from 'axios';
8
8
  import { useDispatch, useSelector, Provider } from 'react-redux';
9
9
  import { combineReducers, createStore, applyMiddleware } from 'redux';
10
10
  import thunk from 'redux-thunk';
@@ -283,6 +283,7 @@ var userPanelUrl = {
283
283
  }
284
284
  };
285
285
 
286
+ var IUILocalStorageService$1 = services.IUILocalStorageService;
286
287
  var api = configs.api;
287
288
  var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
288
289
  var page = _ref.page,
@@ -467,28 +468,40 @@ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
467
468
  };
468
469
  var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
469
470
  var page = _ref6.page,
470
- tabelName = _ref6.tabelName;
471
+ placeholder = _ref6.placeholder;
471
472
 
472
473
  try {
473
474
  return Promise.resolve(_catch(function () {
474
475
  var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
475
- return Promise.resolve(api.get(url).then(function (res) {
476
- return res.data;
476
+ var token = IUILocalStorageService$1.getAccessToken();
477
+ return Promise.resolve(axios.get(url, {
478
+ headers: {
479
+ Authorization: 'Bearer ' + token
480
+ }
477
481
  })).then(function (response) {
478
- var mappedValue = response.results.map(function (item) {
482
+ return Promise.resolve(response.data.results.map(function (item) {
479
483
  return {
480
484
  value: item.id,
481
485
  label: item.name
482
486
  };
483
- });
484
- return {
485
- options: mappedValue,
486
- hasMore: !!response.next,
487
- additional: {
488
- page: page + 1,
489
- tabelName: tabelName
487
+ })).then(function (mappedValue) {
488
+ if (placeholder) {
489
+ var placeholderLbl = {
490
+ value: '',
491
+ label: placeholder
492
+ };
493
+ mappedValue.unshift(placeholderLbl);
490
494
  }
491
- };
495
+
496
+ return {
497
+ options: mappedValue,
498
+ hasMore: !!response.data.next,
499
+ additional: {
500
+ page: page + 1,
501
+ placeholder: placeholder
502
+ }
503
+ };
504
+ });
492
505
  });
493
506
  }, function () {
494
507
  return {
@@ -496,7 +509,7 @@ var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
496
509
  hasMore: false,
497
510
  additional: {
498
511
  page: 1,
499
- tabelName: tabelName
512
+ placeholder: placeholder
500
513
  }
501
514
  };
502
515
  }));
@@ -1367,12 +1380,12 @@ var SET_STATIC_FIELDS_VISIBILITY = 'SET_STATIC_FIELDS_VISIBILITY';
1367
1380
  var SET_PAYMENT_DETAILS = 'SET_PAYMENT_DETAILS';
1368
1381
 
1369
1382
  var env$1 = configs.env;
1370
- var IUILocalStorageService$1 = services.IUILocalStorageService;
1383
+ var IUILocalStorageService$2 = services.IUILocalStorageService;
1371
1384
  var formatCreateUserPayload = function formatCreateUserPayload(payload) {
1372
1385
  var _payload$employeeInfo, _payload$employeeInfo2, _payload$employeeInfo3, _payload$employeeInfo4, _payload$employeeInfo5, _payload$employeeInfo6, _payload$employeeInfo7, _payload$employeeInfo8, _payload$employeeInfo9, _payload$employeeInfo10;
1373
1386
 
1374
1387
  var res = {
1375
- company_id: +IUILocalStorageService$1.getCompanyId(),
1388
+ company_id: +IUILocalStorageService$2.getCompanyId(),
1376
1389
  first_name: payload.personalInfoInput.first_name,
1377
1390
  last_name: payload.personalInfoInput.last_name,
1378
1391
  email: payload.personalInfoInput.email,
@@ -1748,7 +1761,7 @@ var formatUpdateUserPayload = function formatUpdateUserPayload(payload, inputCha
1748
1761
 
1749
1762
  var api$1 = configs.api;
1750
1763
  var IUIToastMessageService = services.IUIToastMessageService,
1751
- IUILocalStorageService$2 = services.IUILocalStorageService;
1764
+ IUILocalStorageService$3 = services.IUILocalStorageService;
1752
1765
  var showLoader = function showLoader() {
1753
1766
  return {
1754
1767
  type: SHOW_LOADER
@@ -2119,7 +2132,7 @@ var deletePaymentCard = function deletePaymentCard(payload) {
2119
2132
  dispatch(showLoader());
2120
2133
  axios["delete"](userAddEditUrl.deletePaymentCard(payload.pmId, payload.vendorId), {
2121
2134
  headers: {
2122
- Authorization: 'Bearer ' + IUILocalStorageService$2.getAccessToken()
2135
+ Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
2123
2136
  }
2124
2137
  }).then(function (res) {
2125
2138
  if (res.data.status) {
@@ -2152,7 +2165,7 @@ var setDefaultPaymentCard = function setDefaultPaymentCard(payload) {
2152
2165
  dispatch(showLoader());
2153
2166
  axios.put(userAddEditUrl.setDefaultCard(), payload, {
2154
2167
  headers: {
2155
- Authorization: 'Bearer ' + IUILocalStorageService$2.getAccessToken()
2168
+ Authorization: 'Bearer ' + IUILocalStorageService$3.getAccessToken()
2156
2169
  }
2157
2170
  }).then(function (res) {
2158
2171
  if (res.data.status) {
@@ -2472,7 +2485,7 @@ var SET_VERIFICATION_ERROR = 'SET_VERIFICATION_ERROR';
2472
2485
  var api$4 = configs.api,
2473
2486
  env$2 = configs.env;
2474
2487
  var common = utilUrls.common;
2475
- var IUILocalStorageService$3 = services.IUILocalStorageService;
2488
+ var IUILocalStorageService$4 = services.IUILocalStorageService;
2476
2489
  var setTokenResponse = function setTokenResponse(payload) {
2477
2490
  return {
2478
2491
  type: VERIFY_ACCESS_TOKEN,
@@ -2494,7 +2507,7 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
2494
2507
  return new Promise(function (resolve, reject) {
2495
2508
  dispatch(setVerificationError(false));
2496
2509
  api$4.post(common.verifyToken(), {
2497
- client_id: +IUILocalStorageService$3.getClientId() || null,
2510
+ client_id: +IUILocalStorageService$4.getClientId() || null,
2498
2511
  product: env$2.isExpense() ? 'expense' : 'travel'
2499
2512
  }).then(function (res) {
2500
2513
  if (res.data.status === true) {
@@ -2505,14 +2518,14 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
2505
2518
  }
2506
2519
 
2507
2520
  if (env$2.isProfilePage()) {
2508
- IUILocalStorageService$3.setCompanyId(res.data.company);
2521
+ IUILocalStorageService$4.setCompanyId(res.data.company);
2509
2522
  dispatch(setTokenResponse(res.data));
2510
2523
  dispatch(setVerificationError(false));
2511
2524
 
2512
2525
  if (env$2.isExpense()) {
2513
- IUILocalStorageService$3.setRole('submitter');
2526
+ IUILocalStorageService$4.setRole('submitter');
2514
2527
  } else {
2515
- IUILocalStorageService$3.setRole('traveler');
2528
+ IUILocalStorageService$4.setRole('traveler');
2516
2529
  }
2517
2530
 
2518
2531
  resolve();
@@ -2520,8 +2533,8 @@ var verifyAccessToken = function verifyAccessToken(roleCanAccess) {
2520
2533
  } else {
2521
2534
  for (var index = 0; index < res.data.applicable_role.length; index++) {
2522
2535
  if (roleCanAccess.includes(res.data.applicable_role[index])) {
2523
- IUILocalStorageService$3.setCompanyId(res.data.company);
2524
- IUILocalStorageService$3.setRole(res.data.applicable_role[index]);
2536
+ IUILocalStorageService$4.setCompanyId(res.data.company);
2537
+ IUILocalStorageService$4.setRole(res.data.applicable_role[index]);
2525
2538
  dispatch(setTokenResponse(res.data));
2526
2539
  dispatch(setVerificationError(false));
2527
2540
  resolve();
@@ -2638,7 +2651,7 @@ var editCustomFieldLabel = function editCustomFieldLabel(payload) {
2638
2651
  };
2639
2652
  };
2640
2653
 
2641
- var IUILocalStorageService$4 = services.IUILocalStorageService;
2654
+ var IUILocalStorageService$5 = services.IUILocalStorageService;
2642
2655
  var env$3 = configs.env;
2643
2656
 
2644
2657
  var CreditCard = function CreditCard(_ref) {
@@ -2707,7 +2720,7 @@ var AddCard = function AddCard(_ref2) {
2707
2720
  var pg = _ref2.pg;
2708
2721
 
2709
2722
  var handleAddCard = function handleAddCard() {
2710
- window.location.assign(env$3.getPaymentUrl() + "/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2723
+ window.location.assign(env$3.getPaymentUrl() + "/api/v1/auth/" + IUILocalStorageService$5.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2711
2724
  };
2712
2725
 
2713
2726
  return /*#__PURE__*/React.createElement("div", {
@@ -4392,19 +4405,17 @@ var AdditionalInfo = function AdditionalInfo(_ref) {
4392
4405
  title: 'Membership number',
4393
4406
  label: "Airline name",
4394
4407
  additional: {
4395
- page: 1,
4396
- tabelName: 'employee_level',
4397
- placeholder: "Enter airline name"
4408
+ page: 1
4398
4409
  },
4399
4410
  value: {
4400
4411
  value: val.name,
4401
- label: val.name
4412
+ label: val.name ? val.name : 'Enter airline name'
4402
4413
  },
4403
4414
  customSelectHandler: function customSelectHandler(_name, _value) {
4404
4415
  return onMemInfoInputChange(index, 'name', _value);
4405
4416
  },
4406
4417
  loadOption: airlineOptionsfn,
4407
- placeholder: "Enter airline name"
4418
+ placeHolderCheck: !val.name
4408
4419
  }) : /*#__PURE__*/React.createElement(IUIInput, {
4409
4420
  label: "Hotel name",
4410
4421
  placeholder: "Enter hotel name",