@itilite/iui-user-management 0.2.1 → 0.2.3

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,13 +1,13 @@
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';
1
+ import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, 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 moment from 'moment';
5
4
  import axios from 'axios';
6
5
  import AddIcon$1 from '@material-ui/icons/Add';
7
6
  import DeleteIcon from '@material-ui/icons/Delete';
8
7
  import { useDispatch, useSelector, Provider } from 'react-redux';
9
8
  import { combineReducers, createStore, applyMiddleware } from 'redux';
10
9
  import thunk from 'redux-thunk';
10
+ import moment from 'moment';
11
11
  import { composeWithDevTools } from 'redux-devtools-extension';
12
12
  import { useHistory } from 'react-router-dom';
13
13
  import { withStyles } from '@material-ui/core/styles';
@@ -466,1143 +466,456 @@ var userPanelUrl = {
466
466
  }
467
467
  };
468
468
 
469
- var dob = {
470
- maxDate: moment().subtract(18, 'years'),
471
- minDate: moment().subtract(300, 'years')
469
+ var IUILocalStorageService$1 = services.IUILocalStorageService;
470
+ var api = configs.api;
471
+ var NAoptionConfig = {
472
+ option: {
473
+ label: 'Not assigned',
474
+ value: 'Not assigned'
475
+ },
476
+ applyFor: ['employee_level', 'department']
472
477
  };
473
- var passportStart = {
474
- maxDate: moment(),
475
- minDate: moment().subtract(100, 'years')
478
+ var commonLoadOptions = function commonLoadOptions(search, loadedOptions, _ref) {
479
+ var page = _ref.page,
480
+ tabelName = _ref.tabelName,
481
+ placeholder = _ref.placeholder,
482
+ selectCTA = _ref.selectCTA,
483
+ showNaOption = _ref.showNaOption;
484
+
485
+ try {
486
+ return Promise.resolve(_catch(function () {
487
+ var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
488
+ return Promise.resolve(api.get(url).then(function (res) {
489
+ return res.data;
490
+ })).then(function (response) {
491
+ var mappedValue = response.results.map(function (item) {
492
+ return {
493
+ value: item.id,
494
+ label: item.name
495
+ };
496
+ });
497
+
498
+ if (showNaOption && page === 1 && NAoptionConfig.applyFor.includes(tabelName)) {
499
+ mappedValue.unshift(NAoptionConfig.option);
500
+ }
501
+
502
+ if (response.next === null && selectCTA) {
503
+ mappedValue.push({
504
+ value: selectCTA.value,
505
+ label: ''
506
+ });
507
+ }
508
+
509
+ return {
510
+ options: mappedValue,
511
+ hasMore: !!response.next,
512
+ additional: {
513
+ page: page + 1,
514
+ tabelName: tabelName,
515
+ placeholder: placeholder,
516
+ selectCTA: selectCTA
517
+ }
518
+ };
519
+ });
520
+ }, function () {
521
+ return {
522
+ options: [],
523
+ hasMore: false,
524
+ additional: {
525
+ page: 1,
526
+ tabelName: tabelName,
527
+ placeholder: placeholder,
528
+ selectCTA: selectCTA
529
+ }
530
+ };
531
+ }));
532
+ } catch (e) {
533
+ return Promise.reject(e);
534
+ }
476
535
  };
477
- var passportEnd = {
478
- maxDate: moment().add(18, 'years'),
479
- minDate: moment()
536
+ var commonLoadOptionsUM = function commonLoadOptionsUM(search, loadedOptions, _ref2) {
537
+ var page = _ref2.page,
538
+ tabelName = _ref2.tabelName,
539
+ placeholder = _ref2.placeholder,
540
+ defaultData = _ref2.defaultData;
541
+
542
+ try {
543
+ return Promise.resolve(_catch(function () {
544
+ var url = userAddEditUrl.dropdownList() + ("?page=" + page + "&table_name=" + tabelName + "&search=" + search);
545
+ return Promise.resolve(api.get(url).then(function (res) {
546
+ return res.data;
547
+ })).then(function (response) {
548
+ var arrList = response.results.filter(function (item) {
549
+ return item.name !== defaultData;
550
+ });
551
+ var mappedValue = arrList.map(function (item) {
552
+ return {
553
+ value: item.id,
554
+ label: item.name
555
+ };
556
+ });
557
+ return {
558
+ options: mappedValue,
559
+ hasMore: !!response.next,
560
+ additional: {
561
+ page: page + 1,
562
+ tabelName: tabelName
563
+ }
564
+ };
565
+ });
566
+ }, function () {
567
+ return {
568
+ options: [],
569
+ hasMore: false,
570
+ additional: {
571
+ page: 1,
572
+ tabelName: tabelName,
573
+ placeholder: placeholder
574
+ }
575
+ };
576
+ }));
577
+ } catch (e) {
578
+ return Promise.reject(e);
579
+ }
480
580
  };
581
+ var currencyLoadOptions = function currencyLoadOptions(search, loadedOptions, _ref3) {
582
+ var page = _ref3.page;
481
583
 
482
- var personalInfo = [{
483
- id: 1,
484
- label: 'First and middle name',
485
- name: 'first_name',
486
- required: true,
487
- type: 'input',
488
- fullWidth: false,
489
- visibility: true,
490
- readOnly: false,
491
- placeholder: 'Enter first and middle name',
492
- validation: {
493
- regexOnChange: /^[a-zA-Z ]*$/,
494
- regexOnBlur: null,
495
- maxLimit: '',
496
- minLimit: '',
497
- maxLength: 100,
498
- minLength: 0
499
- },
500
- disableText: 'Please get in touch with your administrator to change this value.'
501
- }, {
502
- id: 2,
503
- label: 'Last name',
504
- name: 'last_name',
505
- required: true,
506
- type: 'input',
507
- fullWidth: false,
508
- visibility: true,
509
- readOnly: false,
510
- placeholder: 'Enter last name',
511
- validation: {
512
- regexOnChange: /^[a-zA-Z ]*$/,
513
- regexOnBlur: null,
514
- maxLimit: '',
515
- minLimit: '',
516
- maxLength: 100,
517
- minLength: 0
518
- },
519
- disableText: 'Please get in touch with your administrator to change this value.'
520
- }, {
521
- id: 3,
522
- label: 'Email address',
523
- name: 'email',
524
- required: true,
525
- type: 'input',
526
- fullWidth: false,
527
- visibility: true,
528
- readOnly: false,
529
- placeholder: 'Enter email address',
530
- validation: {
531
- regexOnChange: null,
532
- regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
533
- maxLimit: '',
534
- minLimit: '',
535
- maxLength: 100,
536
- minLength: 0
537
- },
538
- disableText: 'Please get in touch with your administrator to change this value.'
539
- }, {
540
- id: 4,
541
- label: 'Phone number',
542
- name: 'contact_number',
543
- required: true,
544
- type: 'phone',
545
- fullWidth: false,
546
- visibility: true,
547
- readOnly: false,
548
- validation: {
549
- regexOnChange: /^[\d]/,
550
- regexOnBlur: null,
551
- maxLimit: '',
552
- minLimit: '',
553
- maxLength: 100,
554
- minLength: 0
555
- },
556
- disableText: 'Please get in touch with your administrator to change this value.'
557
- }, {
558
- id: 5,
559
- label: 'Date of birth',
560
- name: 'dob',
561
- required: false,
562
- type: 'datepicker',
563
- fullWidth: false,
564
- visibility: true,
565
- readOnly: false,
566
- hasIcon: false,
567
- size: 'normal',
568
- maxDate: dob.maxDate,
569
- minDate: dob.minDate,
570
- disableText: 'Please get in touch with your administrator to change this value.'
571
- }, {
572
- id: 6,
573
- empty: true
574
- }, {
575
- id: 7,
576
- label: 'Gender',
577
- name: 'gender',
578
- required: false,
579
- type: 'select',
580
- fullWidth: false,
581
- visibility: true,
582
- readOnly: false,
583
- placeholder: 'Select gender',
584
- tooltip: 'This information will be used for flight booking purpose',
585
- disableText: 'Please get in touch with your administrator to change this value.'
586
- }, {
587
- id: 8,
588
- label: 'Profile photo',
589
- description: 'This will be displayed on your profile',
590
- name: 'profile_pic',
591
- required: false,
592
- multiple: false,
593
- fileType: 'image/png,image/jpeg,image/jpg,image/webp,image/JPG,image/JPEG',
594
- fileSize: 5,
595
- title: 'Select Profile',
596
- type: 'file',
597
- fullWidth: true,
598
- visibility: true,
599
- readOnly: false,
600
- maxNoFiles: 2,
601
- buttonType: 'profile',
602
- disableText: 'Disable text here.'
603
- }];
604
- var workInfo = [{
605
- id: 1,
606
- label: 'Employee level',
607
- name: 'emp_level',
608
- required: false,
609
- type: 'async_select',
610
- fullWidth: false,
611
- visibility: true,
612
- readOnly: false,
613
- title: 'Select employee level',
614
- inputType: false,
615
- placeholder: 'Select employee level',
616
- loadOption: commonLoadOptions,
617
- tabelName: 'employee_level',
618
- tooltip: 'This information will be used in creation of policies and approval rules',
619
- disableText: 'Please get in touch with your administrator to change this value.',
620
- selectCTA: {
621
- value: 'employee_level',
622
- component: /*#__PURE__*/React.createElement(IUITypography, {
623
- className: "iui__font--color-link iui__font--weight-500"
624
- }, "+ Add Employee Level"),
625
- callback: null
584
+ try {
585
+ return Promise.resolve(_catch(function () {
586
+ return Promise.resolve(api.get(userAddEditUrl.currencyCode() + "&search=" + search + "&page=" + page).then(function (res) {
587
+ return res.data;
588
+ })).then(function (response) {
589
+ var mappedValue = response.results.map(function (item) {
590
+ return {
591
+ value: item.currency_code,
592
+ label: item.currency_code
593
+ };
594
+ });
595
+ return {
596
+ options: mappedValue,
597
+ hasMore: !!response.next,
598
+ additional: {
599
+ page: page + 1
600
+ }
601
+ };
602
+ });
603
+ }, function () {
604
+ return {
605
+ options: [],
606
+ hasMore: false,
607
+ additional: {
608
+ page: 1
609
+ }
610
+ };
611
+ }));
612
+ } catch (e) {
613
+ return Promise.reject(e);
626
614
  }
627
- }, {
628
- id: 2,
629
- label: 'Employee ID',
630
- name: 'employee_id',
631
- required: false,
632
- type: 'input',
633
- fullWidth: false,
634
- visibility: true,
635
- readOnly: false,
636
- placeholder: 'Enter employee ID',
637
- validation: {
638
- regexOnChange: /^[A-Za-z0-9]*$/,
639
- regexOnBlur: null,
640
- maxLimit: '',
641
- minLimit: '',
642
- maxLength: 100,
643
- minLength: 0
644
- },
645
- disableText: 'Please get in touch with your administrator to change this value.'
646
- }, {
647
- id: 3,
648
- label: 'Entity',
649
- name: 'entity',
650
- required: false,
651
- type: 'async_select',
652
- fullWidth: false,
653
- visibility: true,
654
- readOnly: false,
655
- title: '',
656
- inputType: false,
657
- placeholder: 'Select entity',
658
- loadOption: commonLoadOptions,
659
- tabelName: 'entity',
660
- tooltip: 'This information will be used in creation of policies and approval rules',
661
- disableText: 'Please get in touch with your administrator to change this value.',
662
- selectCTA: {
663
- value: 'entity',
664
- component: /*#__PURE__*/React.createElement(IUITypography, {
665
- className: "iui__font--color-link iui__font--weight-500"
666
- }, "+ Add Entity"),
667
- callback: null
615
+ };
616
+ var approversOptions = function approversOptions(search, loadedOptions, _ref4) {
617
+ var page = _ref4.page,
618
+ product = _ref4.product,
619
+ userId = _ref4.userId,
620
+ placeholder = _ref4.placeholder;
621
+
622
+ try {
623
+ return Promise.resolve(_catch(function () {
624
+ return Promise.resolve(api.get(userAddEditUrl.approversSearch() + "?page=" + page + "&product=" + product + "&search=" + search + "&user_id=" + userId).then(function (res) {
625
+ return res.data;
626
+ })).then(function (response) {
627
+ var mappedValue = response.results.map(function (item) {
628
+ return {
629
+ value: item.approver,
630
+ label: item.approver
631
+ };
632
+ });
633
+
634
+ if (page === 1) {
635
+ var placeholderLbl = {
636
+ value: '',
637
+ label: placeholder
638
+ };
639
+ mappedValue.unshift(placeholderLbl);
640
+ }
641
+
642
+ return {
643
+ options: mappedValue,
644
+ hasMore: !!response.next,
645
+ additional: {
646
+ page: page + 1,
647
+ product: product,
648
+ userId: userId
649
+ }
650
+ };
651
+ });
652
+ }, function () {
653
+ return {
654
+ options: [],
655
+ hasMore: false,
656
+ additional: {
657
+ page: 1,
658
+ product: product,
659
+ userId: userId
660
+ }
661
+ };
662
+ }));
663
+ } catch (e) {
664
+ return Promise.reject(e);
668
665
  }
669
- }, {
670
- id: 4,
671
- label: 'Business unit',
672
- name: 'business_unit',
673
- required: false,
674
- type: 'async_select',
675
- fullWidth: false,
676
- visibility: true,
677
- readOnly: false,
678
- title: 'Select unit',
679
- inputType: false,
680
- placeholder: 'Select unit',
681
- tabelName: 'business_unit',
682
- loadOption: commonLoadOptions,
683
- disableText: 'Please get in touch with your administrator to change this value.',
684
- selectCTA: {
685
- value: 'business_unit',
686
- component: /*#__PURE__*/React.createElement(IUITypography, {
687
- className: "iui__font--color-link iui__font--weight-500"
688
- }, "+ Add Business Unit"),
689
- callback: null
666
+ };
667
+ var countryOptions = function countryOptions(search, loadedOptions, _ref5) {
668
+ var page = _ref5.page,
669
+ tabelName = _ref5.tabelName;
670
+
671
+ try {
672
+ return Promise.resolve(_catch(function () {
673
+ return Promise.resolve(api.get(userAddEditUrl.countryPaginated() + "&search=" + search + "&page=" + page + "&info=" + tabelName).then(function (res) {
674
+ return res.data;
675
+ })).then(function (response) {
676
+ var mappedValue = response.results.map(function (item) {
677
+ return {
678
+ value: item[tabelName],
679
+ label: item[tabelName]
680
+ };
681
+ });
682
+ return {
683
+ options: mappedValue,
684
+ hasMore: !!response.next,
685
+ additional: {
686
+ page: page + 1,
687
+ tabelName: tabelName
688
+ }
689
+ };
690
+ });
691
+ }, function () {
692
+ return {
693
+ options: [],
694
+ hasMore: false,
695
+ additional: {
696
+ page: 1,
697
+ tabelName: tabelName
698
+ }
699
+ };
700
+ }));
701
+ } catch (e) {
702
+ return Promise.reject(e);
690
703
  }
691
- }, {
692
- id: 5,
693
- label: 'Department',
694
- name: 'department',
695
- required: false,
696
- type: 'async_select',
697
- fullWidth: false,
698
- visibility: true,
699
- readOnly: false,
700
- title: 'Select department',
701
- inputType: false,
702
- placeholder: 'Select department',
703
- tabelName: 'department',
704
- loadOption: commonLoadOptions,
705
- disableText: 'Please get in touch with your administrator to change this value.',
706
- selectCTA: {
707
- value: 'department',
708
- component: /*#__PURE__*/React.createElement(IUITypography, {
709
- className: "iui__font--color-link iui__font--weight-500"
710
- }, "+ Add Department"),
711
- callback: null
704
+ };
705
+ var airlineOptionsfn = function airlineOptionsfn(search, loadedOptions, _ref6) {
706
+ var page = _ref6.page,
707
+ placeholder = _ref6.placeholder;
708
+
709
+ try {
710
+ return Promise.resolve(_catch(function () {
711
+ var url = userAddEditUrl.airlineList() + ("?page=" + page + "&search=" + search);
712
+ var token = IUILocalStorageService$1.getAccessToken();
713
+ return Promise.resolve(axios.get(url, {
714
+ headers: {
715
+ Authorization: 'Bearer ' + token
716
+ }
717
+ })).then(function (response) {
718
+ return Promise.resolve(response.data.results.map(function (item) {
719
+ return {
720
+ value: item.id,
721
+ label: item.name
722
+ };
723
+ })).then(function (mappedValue) {
724
+ if (placeholder) {
725
+ var placeholderLbl = {
726
+ value: '',
727
+ label: placeholder
728
+ };
729
+ mappedValue.unshift(placeholderLbl);
730
+ }
731
+
732
+ return {
733
+ options: mappedValue,
734
+ hasMore: !!response.data.next,
735
+ additional: {
736
+ page: page + 1,
737
+ placeholder: placeholder
738
+ }
739
+ };
740
+ });
741
+ });
742
+ }, function () {
743
+ return {
744
+ options: [],
745
+ hasMore: false,
746
+ additional: {
747
+ page: 1,
748
+ placeholder: placeholder
749
+ }
750
+ };
751
+ }));
752
+ } catch (e) {
753
+ return Promise.reject(e);
712
754
  }
713
- }, {
714
- id: 6,
715
- label: 'Designation',
716
- name: 'designation',
717
- required: false,
718
- type: 'input',
719
- fullWidth: false,
720
- visibility: true,
721
- readOnly: false,
722
- placeholder: 'Enter designation',
723
- validation: {
724
- regexOnChange: /^[A-Za-z0-9.&'()\- ]*$/,
725
- regexOnBlur: /^[a-zA-Z][a-zA-Z0-9.&'()\- ]*$/,
726
- maxLimit: '',
727
- minLimit: '',
728
- maxLength: 100,
729
- minLength: 0
730
- },
731
- disableText: 'Please get in touch with your administrator to change this value.'
732
- }, {
733
- id: 7,
734
- label: 'Base location',
735
- name: 'base_location',
736
- required: false,
737
- type: 'input',
738
- fullWidth: true,
739
- placeholder: 'Enter city',
740
- visibility: true,
741
- readOnly: false,
742
- validation: {
743
- regexOnChange: /^[A-Za-z0-9 -.&'()]*$/,
744
- regexOnBlur: null,
745
- maxLimit: '',
746
- minLimit: '',
747
- maxLength: 500,
748
- minLength: 0
749
- },
750
- disableText: 'Please get in touch with your administrator to change this value.'
751
- }, {
752
- id: 7,
753
- label: 'Default currency',
754
- name: 'currency',
755
- required: false,
756
- type: 'async_select',
757
- fullWidth: false,
758
- visibility: true,
759
- readOnly: false,
760
- inputType: false,
761
- tabelName: 'default_currency',
762
- loadOption: currencyLoadOptions,
763
- tooltip: 'This only changes the currency for this user',
764
- disableText: 'Please get in touch with your administrator to change this value.'
765
- }, {
766
- id: 8,
767
- empty: true
768
- }];
769
- var products = [{
770
- id: 1,
771
- label: 'Travel',
772
- name: 'travel',
773
- type: 'checkbox',
774
- disableText: 'Please get in touch with your administrator to change this value.'
775
- }, {
776
- id: 2,
777
- label: 'Expense',
778
- name: 'expense',
779
- type: 'checkbox',
780
- disableText: 'Please get in touch with your administrator to change this value.'
781
- }];
782
- var dropdownList = {
783
- gender: [{
784
- id: 1,
785
- name: 'Male'
786
- }, {
787
- id: 2,
788
- name: 'Female'
789
- }, {
790
- id: 3,
791
- name: 'Others'
792
- }],
793
- flight_seat_preference: [],
794
- meal_preference: [],
795
- contact_number: [],
796
- passport_issue_country: [],
797
- nationality: []
798
755
  };
799
- var travelConstants = {
800
- heading: 'Travel specific information',
801
- roleHeading: 'Travel role',
802
- roleDescription: 'Roles allow users to only access relevant features and functionalities',
803
- approverHeading: 'Travel approvers',
804
- approverDescription: 'You can add upto :maxApprovers approvers',
805
- FYILabel: 'FYI approver',
806
- FYIDescription: 'Send travel approval alerts to this email',
807
- roles: [{
808
- id: 1,
809
- label: 'Traveler',
810
- description: 'Can create trips for themselves and guests',
811
- name: 'traveler',
812
- type: 'radio',
813
- fullWidth: false,
814
- visibility: true,
815
- disableText: 'Please get in touch with your administrator to change this value.'
816
- }, {
817
- id: 2,
818
- label: 'Admin',
819
- description: 'Can administer the product, manage user access, billing details, company settings etc.',
820
- name: 'travel_admin',
821
- type: 'radio',
822
- fullWidth: false,
823
- visibility: true,
824
- disableText: 'Please get in touch with your administrator to change this value.'
825
- }, {
826
- id: 3,
827
- label: 'Finance admin',
828
- description: 'Can administer the product, manage user access, billing details, company settings etc.',
829
- name: 'travel_finance_admin',
830
- type: 'radio',
831
- fullWidth: false,
832
- visibility: true,
833
- disableText: 'Please get in touch with your administrator to change this value.'
834
- }],
835
- approvers: [{
836
- id: 1,
837
- label: 'Person 1',
838
- name: 'travel_approver',
839
- required: false,
840
- type: 'input',
841
- fullWidth: false,
842
- visibility: true,
843
- readOnly: false,
844
- placeholder: 'Select Approver',
845
- validation: {
846
- regexOnChange: null,
847
- regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
848
- maxLimit: '',
849
- minLimit: '',
850
- maxLength: 100,
851
- minLength: 0
852
- },
853
- disableText: 'Please get in touch with your administrator to change this value.'
854
- }, {
855
- id: 2,
856
- label: 'Person 2',
857
- name: 'travel_approver',
858
- required: false,
859
- type: 'input',
860
- fullWidth: false,
861
- visibility: true,
862
- readOnly: false,
863
- placeholder: 'Select Approver',
864
- validation: {
865
- regexOnChange: null,
866
- regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
867
- maxLimit: '',
868
- minLimit: '',
869
- maxLength: 100,
870
- minLength: 0
871
- },
872
- disableText: 'Please get in touch with your administrator to change this value.'
873
- }]
756
+
757
+ var UserRole = function UserRole(_ref) {
758
+ var _ref$list = _ref.list,
759
+ list = _ref$list === void 0 ? [] : _ref$list,
760
+ _ref$value = _ref.value,
761
+ value = _ref$value === void 0 ? '' : _ref$value;
762
+ var role = list.find(function (role) {
763
+ return role.name === value;
764
+ });
765
+ return /*#__PURE__*/React.createElement("div", null, role && /*#__PURE__*/React.createElement(IUILabel, {
766
+ label: role.label,
767
+ headerType: true,
768
+ description: role.description
769
+ }));
874
770
  };
875
- var expenseConstants = {
876
- heading: 'Expense specific information',
877
- roleHeading: 'Expense role',
878
- roleDescription: 'Roles allow users to only access relevant features and functionalities',
879
- approverHeading: 'Expense approvers',
880
- approverDescription: 'You can add upto :maxApprovers approvers',
881
- FYILabel: 'FYI approver',
882
- FYIDescription: 'Send expense approval alerts to this email',
883
- roles: [{
884
- id: 1,
885
- label: 'Submitter',
886
- description: 'Can submit expenses',
887
- name: 'submitter',
888
- type: 'radio',
889
- fullWidth: false,
890
- visibility: true,
891
- disableText: 'Please get in touch with your administrator to change this value.'
892
- }, {
893
- id: 2,
894
- label: 'Admin',
895
- description: 'Can administer the product, manage user access, billing details, company settings etc.',
896
- name: 'expense_admin',
897
- type: 'radio',
898
- fullWidth: false,
899
- visibility: true,
900
- disableText: 'Please get in touch with your administrator to change this value.'
901
- }, {
902
- id: 3,
903
- label: 'Finance admin',
904
- description: 'Can administer the product, manage user access, billing details, company settings etc.',
905
- name: 'expense_finance_admin',
906
- type: 'radio',
907
- fullWidth: false,
908
- visibility: true,
909
- disableText: 'Please get in touch with your administrator to change this value.'
910
- }],
911
- approvers: [{
912
- id: 1,
913
- label: 'Person 1',
914
- name: 'expense_approver',
915
- required: false,
916
- type: 'input',
917
- fullWidth: false,
918
- visibility: true,
919
- readOnly: false,
920
- placeholder: 'Select Approver',
921
- validation: {
922
- regexOnChange: null,
923
- regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
924
- maxLimit: '',
925
- minLimit: '',
926
- maxLength: 100,
927
- minLength: 0
771
+
772
+ var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expiryDate":"_2tBnF","cardImage":"_3QvZh","visa":"_1IpBm","mastercard":"_2x6IX","amex":"_2a38S","discover":"_2vksl","diners":"_2kQRs","jcb":"_2bO1f","unionpay":"_2_jfu","is_nothing":"_1Lrzs","addCard":"_3711U","cardDeleteBtn":"_7Da2t","cardLabel":"_PQTex","defaultLabel":"_smjc4","defaultBtn":"_1_ArA","cursonPointer":"_1L115","sectionWrapper":"_VpUCK","margin":"_1Fs_D","minGridWidth":"_1hl-Z","firstRowMargin":"_1WZZj","firstChildMargin":"_IT_O_","paddingTop":"_Mhnl7","dividerColor":"_3ltFd"};
773
+
774
+ var SHOW_LOADER = 'SHOW_LOADER';
775
+ var STOP_LOADER = 'STOP_LOADER';
776
+ var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
777
+ var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
778
+ var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
779
+ var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
780
+ var SET_EDITED_TRAVEL_APPROVER_FIELD = 'SET_EDITED_TRAVEL_APPROVER_FIELD';
781
+ var SET_EDITED_EXPENSE_APPROVER_FIELD = 'SET_EDITED_EXPENSE_APPROVER_FIELD';
782
+ var SET_COUNTRY_CODES = 'SET_COUNTRY_CODES';
783
+ var SET_STATIC_FIELDS_VISIBILITY = 'SET_STATIC_FIELDS_VISIBILITY';
784
+ var SET_PAYMENT_DETAILS = 'SET_PAYMENT_DETAILS';
785
+
786
+ var env$1 = configs.env;
787
+ var IUILocalStorageService$2 = services.IUILocalStorageService;
788
+ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
789
+ var _payload$employeeInfo, _payload$employeeInfo2, _payload$employeeInfo3, _payload$employeeInfo4, _payload$employeeInfo5, _payload$employeeInfo6, _payload$employeeInfo7, _payload$employeeInfo8, _payload$employeeInfo9, _payload$employeeInfo10;
790
+
791
+ var res = {
792
+ company_id: +IUILocalStorageService$2.getCompanyId(),
793
+ first_name: payload.personalInfoInput.first_name,
794
+ last_name: payload.personalInfoInput.last_name,
795
+ email: payload.personalInfoInput.email,
796
+ user_personal_info: {
797
+ contact_number: payload.personalInfoInput.contact_number ? payload.personalInfoInput.contact_number.replaceAll(' ', '') : null,
798
+ country_code: payload.personalInfoInput.country_code || null,
799
+ contact_country_code: payload.personalInfoInput.contact_country_code || null,
800
+ dob: payload.personalInfoInput.dob || null,
801
+ gender: payload.personalInfoInput.gender || null
928
802
  },
929
- disableText: 'Please get in touch with your administrator to change this value.'
930
- }, {
931
- id: 2,
932
- label: 'Person 2',
933
- name: 'expense_approver',
934
- required: false,
935
- type: 'input',
936
- fullWidth: false,
937
- visibility: true,
938
- readOnly: false,
939
- placeholder: 'Select Approver',
940
- validation: {
941
- regexOnChange: null,
942
- regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<a>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
943
- maxLimit: '',
944
- minLimit: '',
945
- maxLength: 100,
946
- minLength: 0
803
+ employee_info: {
804
+ emp_level_id: payload !== null && payload !== void 0 && (_payload$employeeInfo = payload.employeeInfoInput) !== null && _payload$employeeInfo !== void 0 && (_payload$employeeInfo2 = _payload$employeeInfo.emp_level) !== null && _payload$employeeInfo2 !== void 0 && _payload$employeeInfo2.value ? payload.employeeInfoInput.emp_level.value : null,
805
+ employee_id: payload.employeeInfoInput.employee_id || null,
806
+ entity_id: payload !== null && payload !== void 0 && (_payload$employeeInfo3 = payload.employeeInfoInput) !== null && _payload$employeeInfo3 !== void 0 && (_payload$employeeInfo4 = _payload$employeeInfo3.entity) !== null && _payload$employeeInfo4 !== void 0 && _payload$employeeInfo4.value ? payload.employeeInfoInput.entity.value : null,
807
+ business_unit_id: payload !== null && payload !== void 0 && (_payload$employeeInfo5 = payload.employeeInfoInput) !== null && _payload$employeeInfo5 !== void 0 && (_payload$employeeInfo6 = _payload$employeeInfo5.business_unit) !== null && _payload$employeeInfo6 !== void 0 && _payload$employeeInfo6.value ? payload.employeeInfoInput.business_unit.value : null,
808
+ department_id: payload !== null && payload !== void 0 && (_payload$employeeInfo7 = payload.employeeInfoInput) !== null && _payload$employeeInfo7 !== void 0 && (_payload$employeeInfo8 = _payload$employeeInfo7.department) !== null && _payload$employeeInfo8 !== void 0 && _payload$employeeInfo8.value ? payload.employeeInfoInput.department.value : null,
809
+ designation: payload.employeeInfoInput.designation || null,
810
+ base_location: payload.employeeInfoInput.base_location || null,
811
+ currency: payload !== null && payload !== void 0 && (_payload$employeeInfo9 = payload.employeeInfoInput) !== null && _payload$employeeInfo9 !== void 0 && (_payload$employeeInfo10 = _payload$employeeInfo9.currency) !== null && _payload$employeeInfo10 !== void 0 && _payload$employeeInfo10.value ? payload.employeeInfoInput.currency.value : null
947
812
  },
948
- disableText: 'Please get in touch with your administrator to change this value.'
949
- }]
950
- };
951
- var passportInfo = [{
952
- id: 1,
953
- label: 'Passport issuing country',
954
- name: 'passport_issue_country',
955
- required: false,
956
- type: 'async_select',
957
- fullWidth: false,
958
- visibility: true,
959
- readOnly: false,
960
- placeholder: 'Select country',
961
- tabelName: 'country_name',
962
- loadOption: countryOptions,
963
- disableText: 'Please get in touch with your administrator to change this value.'
964
- }, {
965
- id: 2,
966
- label: 'Passport number',
967
- name: 'passport_number',
968
- required: false,
969
- type: 'input',
970
- fullWidth: false,
971
- visibility: true,
972
- readOnly: false,
973
- placeholder: 'Enter passport number',
974
- validation: {
975
- regexOnChange: /^[A-Za-z0-9]*$/,
976
- regexOnBlur: null,
977
- maxLimit: '',
978
- minLimit: '',
979
- maxLength: 15,
980
- minLength: 7
981
- },
982
- disableText: 'Please get in touch with your administrator to change this value.'
983
- }, {
984
- id: 3,
985
- label: 'Nationality',
986
- name: 'nationality',
987
- required: false,
988
- type: 'async_select',
989
- fullWidth: true,
990
- visibility: true,
991
- readOnly: false,
992
- placeholder: 'Select nationality',
993
- tabelName: 'nationality',
994
- loadOption: countryOptions,
995
- disableText: 'Please get in touch with your administrator to change this value.'
996
- }, {
997
- id: 4,
998
- label: 'Date of issue',
999
- name: 'passport_issue_date',
1000
- required: false,
1001
- type: 'datepicker',
1002
- hasIcon: false,
1003
- fullWidth: false,
1004
- visibility: true,
1005
- readOnly: false,
1006
- size: 'small',
1007
- maxDate: passportStart.maxDate,
1008
- minDate: passportStart.minDate,
1009
- disableText: 'Please get in touch with your administrator to change this value.'
1010
- }, {
1011
- id: 5,
1012
- label: 'Date of expiry',
1013
- name: 'passport_expiry_date',
1014
- required: false,
1015
- type: 'datepicker',
1016
- hasIcon: false,
1017
- fullWidth: false,
1018
- visibility: true,
1019
- readOnly: false,
1020
- size: 'small',
1021
- maxDate: passportEnd.maxDate,
1022
- minDate: passportEnd.minDate,
1023
- disableText: 'Please get in touch with your administrator to change this value.'
1024
- }, {
1025
- id: 6,
1026
- label: 'Photo of passport',
1027
- description: '',
1028
- name: 'passport_photo',
1029
- required: false,
1030
- type: 'file',
1031
- multiple: true,
1032
- fileType: 'application/pdf,image/png,image/jpeg,image/jpg',
1033
- fileSize: 5,
1034
- title: 'Select Photo',
1035
- fullWidth: true,
1036
- visibility: true,
1037
- readOnly: false,
1038
- maxNoFiles: 2,
1039
- disableText: 'Please get in touch with your administrator to change this value.'
1040
- }, {
1041
- id: 7,
1042
- label: 'Travel documents',
1043
- description: 'You can add upto 5 documents',
1044
- name: 'travel_docs',
1045
- required: false,
1046
- multiple: true,
1047
- fileType: 'application/pdf,image/png,image/jpeg,image/jpg',
1048
- fileSize: 5,
1049
- title: 'Select document',
1050
- type: 'file',
1051
- fullWidth: true,
1052
- visibility: true,
1053
- readOnly: false,
1054
- maxNoFiles: 5,
1055
- tooltip: 'This is for quick access of important travel documents during your trip like Visa, Identification, Vaccine certificates etc.',
1056
- disableText: 'Please get in touch with your administrator to change this value.'
1057
- }];
1058
- var travelPreference = [{
1059
- id: 1,
1060
- label: 'Flight seat preference',
1061
- name: 'flight_seat_preference',
1062
- required: false,
1063
- type: 'select',
1064
- fullWidth: false,
1065
- visibility: true,
1066
- readOnly: false,
1067
- placeholder: 'Select seat preference',
1068
- disableText: 'Please get in touch with your administrator to change this value.'
1069
- }, {
1070
- id: 1,
1071
- label: 'Meals preference',
1072
- name: 'meal_preference',
1073
- required: false,
1074
- type: 'select',
1075
- fullWidth: false,
1076
- visibility: true,
1077
- readOnly: false,
1078
- placeholder: 'Select meals preference',
1079
- disableText: 'Please get in touch with your administrator to change this value.'
1080
- }];
1081
- var secureTravelInfo = [{
1082
- id: 1,
1083
- label: 'Known traveler number',
1084
- placeholder: 'Enter known traveler number',
1085
- name: 'trusted_traveller',
1086
- required: false,
1087
- type: 'input',
1088
- hasIcon: true,
1089
- fullWidth: false,
1090
- visibility: true,
1091
- readOnly: false,
1092
- tooltip: /*#__PURE__*/React.createElement(React.Fragment, null, "The Known Traveler Number is a unique number issued by the U.S. Government to identify customers who participate in a known traveler program (e.g.: Global Entry, SENTRI, NEXUS, TSA PreCheck application process). For more information about the Known Traveler Number,", ' ', /*#__PURE__*/React.createElement("a", {
1093
- href: "https://www.tsa.gov/travel/frequently-asked-questions",
1094
- target: "_blank",
1095
- rel: "noreferrer"
1096
- }, "visit TSA's PreCheck website")),
1097
- disableText: 'Please get in touch with your administrator to change this value.'
1098
- }, {
1099
- id: 1,
1100
- label: 'Redress number',
1101
- placeholder: 'Enter redress number',
1102
- name: 'redress_number',
1103
- required: false,
1104
- type: 'input',
1105
- hasIcon: true,
1106
- fullWidth: false,
1107
- visibility: true,
1108
- readOnly: false,
1109
- tooltip: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "The Redress Number is a unique number issued by the DHS (Department of Homeland Security) that is used to facilitate passenger clearance for persons who have the same name as someone on the TSA (Transportation Security Administration) watch list. For more information about the Secure Flight program,", ' ', /*#__PURE__*/React.createElement("a", {
1110
- href: "https://www.tsa.gov/travel/passenger-support/travel-redress-program",
1111
- target: "_blank",
1112
- rel: "noreferrer"
1113
- }, "visit TSA's Secure Flight website"))),
1114
- disableText: 'Please get in touch with your administrator to change this value.'
1115
- }];
1116
- var NAoptionConfig = {
1117
- option: {
1118
- label: 'Not assigned',
1119
- value: 'Not assigned'
1120
- },
1121
- applyFor: ['employee_level', 'department']
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
- };
813
+ custom_attribute: payload.customFieldsInput || null,
814
+ product: function () {
815
+ var product = {};
1162
816
 
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;
817
+ if (payload.productAccess.travel) {
818
+ product.travel = payload.travelRole || null;
819
+ }
1171
820
 
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
- });
821
+ if (payload.productAccess.expense) {
822
+ product.expense = payload.expenseRole || null;
823
+ }
1184
824
 
1185
- if (showNaOption && page === 1 && NAoptionConfig.applyFor.includes(tabelName)) {
1186
- mappedValue.unshift(NAoptionConfig.option);
1187
- }
825
+ return product;
826
+ }(),
827
+ approvers: {}
828
+ };
829
+ var userTags = [];
1188
830
 
1189
- if (response.next === null && selectCTA) {
1190
- mappedValue.push({
1191
- value: selectCTA.value,
1192
- label: ''
1193
- });
1194
- }
831
+ for (var key in payload.userTagType) {
832
+ if (Object.hasOwnProperty.call(payload.userTagType, key) && payload.userTagType[key]) {
833
+ userTags.push(payload.userTagType[key]);
834
+ }
835
+ }
1195
836
 
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
- };
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);
837
+ if (userTags.length) {
838
+ res.user_tags = userTags;
1221
839
  }
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;
1228
840
 
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
- };
841
+ if (payload.productAccess.travel) {
842
+ var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
843
+
844
+ res.approvers.travel = [];
845
+
846
+ for (var _key in payload.travelApproversInput) {
847
+ if (Object.hasOwnProperty.call(payload.travelApproversInput, _key) && payload.travelApproversInput[_key] && !!payload.travelApproversInput[_key].value) {
848
+ res.approvers.travel.push({
849
+ email: payload.travelApproversInput[_key].value,
850
+ sequence: +_key.split('-')[1]
1243
851
  });
1244
- return {
1245
- options: mappedValue,
1246
- hasMore: !!response.next,
1247
- additional: {
1248
- page: page + 1,
1249
- tabelName: tabelName
1250
- }
852
+ }
853
+ }
854
+
855
+ if (payload.travelFYI && payload.travelFYI.value) {
856
+ res.approvers.travel.push({
857
+ email: payload.travelFYI.value,
858
+ sequence: 'fyi'
859
+ });
860
+ }
861
+
862
+ res.user_travel_info = {
863
+ passport_issue_country: payload !== null && payload !== void 0 && (_payload$passportInfo = payload.passportInfoInput) !== null && _payload$passportInfo !== void 0 && (_payload$passportInfo2 = _payload$passportInfo.passport_issue_country) !== null && _payload$passportInfo2 !== void 0 && _payload$passportInfo2.value ? payload.passportInfoInput.passport_issue_country.value : null,
864
+ nationality: payload !== null && payload !== void 0 && (_payload$passportInfo3 = payload.passportInfoInput) !== null && _payload$passportInfo3 !== void 0 && (_payload$passportInfo4 = _payload$passportInfo3.nationality) !== null && _payload$passportInfo4 !== void 0 && _payload$passportInfo4.value ? payload.passportInfoInput.nationality.value : null,
865
+ passport_number: payload.passportInfoInput.passport_number || null,
866
+ passport_issue_date: payload.passportInfoInput.passport_issue_date || null,
867
+ passport_expiry_date: payload.passportInfoInput.passport_expiry_date || null,
868
+ flight_seat_preference: payload.travelPreferenceInfo.flight_seat_preference || null,
869
+ meal_preference: payload.travelPreferenceInfo.meal_preference || null,
870
+ trusted_traveller: payload.secureTravelInputInfo.trusted_traveller || null,
871
+ redress_number: payload.secureTravelInputInfo.redress_number || null
872
+ };
873
+
874
+ if (payload !== null && payload !== void 0 && (_payload$membershipIn = payload.membershipInfoInput) !== null && _payload$membershipIn !== void 0 && _payload$membershipIn.length && payload.membershipInfoInput.length > 0) {
875
+ res.membership_info = payload.membershipInfoInput.map(function (membership) {
876
+ var res = {
877
+ membership_type: membership.membership_type,
878
+ name: membership.name,
879
+ number: membership.number
1251
880
  };
881
+ return res;
1252
882
  });
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;
883
+ } else {
884
+ res.membership_info = null;
885
+ }
1270
886
 
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
- });
887
+ if (payload !== null && payload !== void 0 && (_payload$uploadedFile = payload.uploadedFiles) !== null && _payload$uploadedFile !== void 0 && _payload$uploadedFile.length && payload.uploadedFiles.length > 0) {
888
+ res.files = payload.uploadedFiles.map(function (_file) {
1282
889
  return {
1283
- options: mappedValue,
1284
- hasMore: !!response.next,
1285
- additional: {
1286
- page: page + 1
1287
- }
890
+ file_type: _file.file_type,
891
+ file_path: _file.file_path,
892
+ user_file_name: _file.user_file_name,
893
+ upload: _file.upload
1288
894
  };
1289
895
  });
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);
896
+ } else {
897
+ res.files = [];
898
+ }
1301
899
  }
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;
1308
900
 
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
- });
901
+ if (payload.productAccess.expense) {
902
+ res.approvers.expense = [];
1320
903
 
1321
- if (page === 1) {
1322
- var placeholderLbl = {
1323
- value: '',
1324
- label: placeholder
1325
- };
1326
- mappedValue.unshift(placeholderLbl);
1327
- }
904
+ for (var _key2 in payload.expenseApproversInput) {
905
+ if (Object.hasOwnProperty.call(payload.expenseApproversInput, _key2) && payload.expenseApproversInput[_key2] && payload.expenseApproversInput[_key2].value) {
906
+ res.approvers.expense.push({
907
+ email: payload.expenseApproversInput[_key2].value,
908
+ sequence: +_key2.split('-')[1]
909
+ });
910
+ }
911
+ }
1328
912
 
1329
- return {
1330
- options: mappedValue,
1331
- hasMore: !!response.next,
1332
- additional: {
1333
- page: page + 1,
1334
- product: product,
1335
- userId: userId
1336
- }
1337
- };
913
+ if (payload.expenseFYI && payload.expenseFYI.value) {
914
+ res.approvers.expense.push({
915
+ email: payload.expenseFYI.value,
916
+ sequence: 'fyi'
1338
917
  });
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,
1382
- additional: {
1383
- page: 1,
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;
1395
-
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);
1441
- }
1442
- };
1443
-
1444
- var UserRole = function UserRole(_ref) {
1445
- var _ref$list = _ref.list,
1446
- list = _ref$list === void 0 ? [] : _ref$list,
1447
- _ref$value = _ref.value,
1448
- value = _ref$value === void 0 ? '' : _ref$value;
1449
- var role = list.find(function (role) {
1450
- return role.name === value;
1451
- });
1452
- return /*#__PURE__*/React.createElement("div", null, role && /*#__PURE__*/React.createElement(IUILabel, {
1453
- label: role.label,
1454
- headerType: true,
1455
- description: role.description
1456
- }));
1457
- };
1458
-
1459
- var styles$1 = {"card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expiryDate":"_2tBnF","cardImage":"_3QvZh","visa":"_1IpBm","mastercard":"_2x6IX","amex":"_2a38S","discover":"_2vksl","diners":"_2kQRs","jcb":"_2bO1f","unionpay":"_2_jfu","is_nothing":"_1Lrzs","addCard":"_3711U","cardDeleteBtn":"_7Da2t","cardLabel":"_PQTex","defaultLabel":"_smjc4","defaultBtn":"_1_ArA","cursonPointer":"_1L115","sectionWrapper":"_VpUCK","margin":"_1Fs_D","minGridWidth":"_1hl-Z","firstRowMargin":"_1WZZj","firstChildMargin":"_IT_O_","paddingTop":"_Mhnl7","dividerColor":"_3ltFd"};
1460
-
1461
- var SHOW_LOADER = 'SHOW_LOADER';
1462
- var STOP_LOADER = 'STOP_LOADER';
1463
- var SET_RENDER_FIELDS = 'SET_RENDER_FIELDS';
1464
- var SET_CUSTOM_FIELD = 'SET_CUSTOM_FIELD';
1465
- var SET_TRAVEL_APPROVER_FIELD = 'SET_TRAVEL_APPROVER_FIELD';
1466
- var SET_EXPENSE_APPROVER_FIELD = 'SET_EXPENSE_APPROVER_FIELD';
1467
- var SET_EDITED_TRAVEL_APPROVER_FIELD = 'SET_EDITED_TRAVEL_APPROVER_FIELD';
1468
- var SET_EDITED_EXPENSE_APPROVER_FIELD = 'SET_EDITED_EXPENSE_APPROVER_FIELD';
1469
- var SET_COUNTRY_CODES = 'SET_COUNTRY_CODES';
1470
- var SET_STATIC_FIELDS_VISIBILITY = 'SET_STATIC_FIELDS_VISIBILITY';
1471
- var SET_PAYMENT_DETAILS = 'SET_PAYMENT_DETAILS';
1472
-
1473
- var env$1 = configs.env;
1474
- var IUILocalStorageService$2 = services.IUILocalStorageService;
1475
- var formatCreateUserPayload = function formatCreateUserPayload(payload) {
1476
- var _payload$employeeInfo, _payload$employeeInfo2, _payload$employeeInfo3, _payload$employeeInfo4, _payload$employeeInfo5, _payload$employeeInfo6, _payload$employeeInfo7, _payload$employeeInfo8, _payload$employeeInfo9, _payload$employeeInfo10;
1477
-
1478
- var res = {
1479
- company_id: +IUILocalStorageService$2.getCompanyId(),
1480
- first_name: payload.personalInfoInput.first_name,
1481
- last_name: payload.personalInfoInput.last_name,
1482
- email: payload.personalInfoInput.email,
1483
- user_personal_info: {
1484
- contact_number: payload.personalInfoInput.contact_number ? payload.personalInfoInput.contact_number.replaceAll(' ', '') : null,
1485
- country_code: payload.personalInfoInput.country_code || null,
1486
- contact_country_code: payload.personalInfoInput.contact_country_code || null,
1487
- dob: payload.personalInfoInput.dob || null,
1488
- gender: payload.personalInfoInput.gender || null
1489
- },
1490
- employee_info: {
1491
- emp_level_id: payload !== null && payload !== void 0 && (_payload$employeeInfo = payload.employeeInfoInput) !== null && _payload$employeeInfo !== void 0 && (_payload$employeeInfo2 = _payload$employeeInfo.emp_level) !== null && _payload$employeeInfo2 !== void 0 && _payload$employeeInfo2.value ? payload.employeeInfoInput.emp_level.value : null,
1492
- employee_id: payload.employeeInfoInput.employee_id || null,
1493
- entity_id: payload !== null && payload !== void 0 && (_payload$employeeInfo3 = payload.employeeInfoInput) !== null && _payload$employeeInfo3 !== void 0 && (_payload$employeeInfo4 = _payload$employeeInfo3.entity) !== null && _payload$employeeInfo4 !== void 0 && _payload$employeeInfo4.value ? payload.employeeInfoInput.entity.value : null,
1494
- business_unit_id: payload !== null && payload !== void 0 && (_payload$employeeInfo5 = payload.employeeInfoInput) !== null && _payload$employeeInfo5 !== void 0 && (_payload$employeeInfo6 = _payload$employeeInfo5.business_unit) !== null && _payload$employeeInfo6 !== void 0 && _payload$employeeInfo6.value ? payload.employeeInfoInput.business_unit.value : null,
1495
- department_id: payload !== null && payload !== void 0 && (_payload$employeeInfo7 = payload.employeeInfoInput) !== null && _payload$employeeInfo7 !== void 0 && (_payload$employeeInfo8 = _payload$employeeInfo7.department) !== null && _payload$employeeInfo8 !== void 0 && _payload$employeeInfo8.value ? payload.employeeInfoInput.department.value : null,
1496
- designation: payload.employeeInfoInput.designation || null,
1497
- base_location: payload.employeeInfoInput.base_location || null,
1498
- currency: payload !== null && payload !== void 0 && (_payload$employeeInfo9 = payload.employeeInfoInput) !== null && _payload$employeeInfo9 !== void 0 && (_payload$employeeInfo10 = _payload$employeeInfo9.currency) !== null && _payload$employeeInfo10 !== void 0 && _payload$employeeInfo10.value ? payload.employeeInfoInput.currency.value : null
1499
- },
1500
- custom_attribute: payload.customFieldsInput || null,
1501
- product: function () {
1502
- var product = {};
1503
-
1504
- if (payload.productAccess.travel) {
1505
- product.travel = payload.travelRole || null;
1506
- }
1507
-
1508
- if (payload.productAccess.expense) {
1509
- product.expense = payload.expenseRole || null;
1510
- }
1511
-
1512
- return product;
1513
- }(),
1514
- approvers: {}
1515
- };
1516
- var userTags = [];
1517
-
1518
- for (var key in payload.userTagType) {
1519
- if (Object.hasOwnProperty.call(payload.userTagType, key) && payload.userTagType[key]) {
1520
- userTags.push(payload.userTagType[key]);
1521
- }
1522
- }
1523
-
1524
- if (userTags.length) {
1525
- res.user_tags = userTags;
1526
- }
1527
-
1528
- if (payload.productAccess.travel) {
1529
- var _payload$passportInfo, _payload$passportInfo2, _payload$passportInfo3, _payload$passportInfo4, _payload$membershipIn, _payload$uploadedFile;
1530
-
1531
- res.approvers.travel = [];
1532
-
1533
- for (var _key in payload.travelApproversInput) {
1534
- if (Object.hasOwnProperty.call(payload.travelApproversInput, _key) && payload.travelApproversInput[_key] && !!payload.travelApproversInput[_key].value) {
1535
- res.approvers.travel.push({
1536
- email: payload.travelApproversInput[_key].value,
1537
- sequence: +_key.split('-')[1]
1538
- });
1539
- }
1540
- }
1541
-
1542
- if (payload.travelFYI && payload.travelFYI.value) {
1543
- res.approvers.travel.push({
1544
- email: payload.travelFYI.value,
1545
- sequence: 'fyi'
1546
- });
1547
- }
1548
-
1549
- res.user_travel_info = {
1550
- passport_issue_country: payload !== null && payload !== void 0 && (_payload$passportInfo = payload.passportInfoInput) !== null && _payload$passportInfo !== void 0 && (_payload$passportInfo2 = _payload$passportInfo.passport_issue_country) !== null && _payload$passportInfo2 !== void 0 && _payload$passportInfo2.value ? payload.passportInfoInput.passport_issue_country.value : null,
1551
- nationality: payload !== null && payload !== void 0 && (_payload$passportInfo3 = payload.passportInfoInput) !== null && _payload$passportInfo3 !== void 0 && (_payload$passportInfo4 = _payload$passportInfo3.nationality) !== null && _payload$passportInfo4 !== void 0 && _payload$passportInfo4.value ? payload.passportInfoInput.nationality.value : null,
1552
- passport_number: payload.passportInfoInput.passport_number || null,
1553
- passport_issue_date: payload.passportInfoInput.passport_issue_date || null,
1554
- passport_expiry_date: payload.passportInfoInput.passport_expiry_date || null,
1555
- flight_seat_preference: payload.travelPreferenceInfo.flight_seat_preference || null,
1556
- meal_preference: payload.travelPreferenceInfo.meal_preference || null,
1557
- trusted_traveller: payload.secureTravelInputInfo.trusted_traveller || null,
1558
- redress_number: payload.secureTravelInputInfo.redress_number || null
1559
- };
1560
-
1561
- if (payload !== null && payload !== void 0 && (_payload$membershipIn = payload.membershipInfoInput) !== null && _payload$membershipIn !== void 0 && _payload$membershipIn.length && payload.membershipInfoInput.length > 0) {
1562
- res.membership_info = payload.membershipInfoInput.map(function (membership) {
1563
- var res = {
1564
- membership_type: membership.membership_type,
1565
- name: membership.name,
1566
- number: membership.number
1567
- };
1568
- return res;
1569
- });
1570
- } else {
1571
- res.membership_info = null;
1572
- }
1573
-
1574
- if (payload !== null && payload !== void 0 && (_payload$uploadedFile = payload.uploadedFiles) !== null && _payload$uploadedFile !== void 0 && _payload$uploadedFile.length && payload.uploadedFiles.length > 0) {
1575
- res.files = payload.uploadedFiles.map(function (_file) {
1576
- return {
1577
- file_type: _file.file_type,
1578
- file_path: _file.file_path,
1579
- user_file_name: _file.user_file_name,
1580
- upload: _file.upload
1581
- };
1582
- });
1583
- } else {
1584
- res.files = [];
1585
- }
1586
- }
1587
-
1588
- if (payload.productAccess.expense) {
1589
- res.approvers.expense = [];
1590
-
1591
- for (var _key2 in payload.expenseApproversInput) {
1592
- if (Object.hasOwnProperty.call(payload.expenseApproversInput, _key2) && payload.expenseApproversInput[_key2] && payload.expenseApproversInput[_key2].value) {
1593
- res.approvers.expense.push({
1594
- email: payload.expenseApproversInput[_key2].value,
1595
- sequence: +_key2.split('-')[1]
1596
- });
1597
- }
1598
- }
1599
-
1600
- if (payload.expenseFYI && payload.expenseFYI.value) {
1601
- res.approvers.expense.push({
1602
- email: payload.expenseFYI.value,
1603
- sequence: 'fyi'
1604
- });
1605
- }
918
+ }
1606
919
  }
1607
920
 
1608
921
  if (payload.verifyUserId) {
@@ -3513,6 +2826,720 @@ var CustomFields = function CustomFields(_ref) {
3513
2826
  }));
3514
2827
  };
3515
2828
 
2829
+ var dob = {
2830
+ maxDate: moment().subtract(18, 'years'),
2831
+ minDate: moment().subtract(300, 'years')
2832
+ };
2833
+ var passportStart = {
2834
+ maxDate: moment(),
2835
+ minDate: moment().subtract(100, 'years')
2836
+ };
2837
+ var passportEnd = {
2838
+ maxDate: moment().add(18, 'years'),
2839
+ minDate: moment()
2840
+ };
2841
+
2842
+ var personalInfo = [{
2843
+ id: 1,
2844
+ label: 'First and middle name',
2845
+ name: 'first_name',
2846
+ required: true,
2847
+ type: 'input',
2848
+ fullWidth: false,
2849
+ visibility: true,
2850
+ readOnly: false,
2851
+ placeholder: 'Enter first and middle name',
2852
+ validation: {
2853
+ regexOnChange: null,
2854
+ regexOnBlur: [{
2855
+ regex: /^[a-zA-Z ]*$/,
2856
+ message: 'Only alphabets are allowed.'
2857
+ }],
2858
+ maxLimit: '',
2859
+ minLimit: '',
2860
+ maxLength: 100,
2861
+ minLength: 0
2862
+ },
2863
+ disableText: 'Please get in touch with your administrator to change this value.'
2864
+ }, {
2865
+ id: 2,
2866
+ label: 'Last name',
2867
+ name: 'last_name',
2868
+ required: true,
2869
+ type: 'input',
2870
+ fullWidth: false,
2871
+ visibility: true,
2872
+ readOnly: false,
2873
+ placeholder: 'Enter last name',
2874
+ validation: {
2875
+ regexOnChange: null,
2876
+ regexOnBlur: [{
2877
+ regex: /^[a-zA-Z ]*$/,
2878
+ message: 'Only alphabets are allowed.'
2879
+ }],
2880
+ maxLimit: '',
2881
+ minLimit: '',
2882
+ maxLength: 100,
2883
+ minLength: 0
2884
+ },
2885
+ disableText: 'Please get in touch with your administrator to change this value.'
2886
+ }, {
2887
+ id: 3,
2888
+ label: 'Email address',
2889
+ name: 'email',
2890
+ required: true,
2891
+ type: 'input',
2892
+ fullWidth: false,
2893
+ visibility: true,
2894
+ readOnly: false,
2895
+ placeholder: 'Enter email address',
2896
+ validation: {
2897
+ regexOnChange: null,
2898
+ regexOnBlur: [{
2899
+ regex: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
2900
+ message: 'Invalid email address'
2901
+ }],
2902
+ maxLimit: '',
2903
+ minLimit: '',
2904
+ maxLength: 100,
2905
+ minLength: 0
2906
+ },
2907
+ disableText: 'Please get in touch with your administrator to change this value.'
2908
+ }, {
2909
+ id: 4,
2910
+ label: 'Phone number',
2911
+ name: 'contact_number',
2912
+ required: true,
2913
+ type: 'phone',
2914
+ fullWidth: false,
2915
+ visibility: true,
2916
+ readOnly: false,
2917
+ validation: {
2918
+ regexOnChange: /^[\d]/,
2919
+ regexOnBlur: null,
2920
+ maxLimit: '',
2921
+ minLimit: '',
2922
+ maxLength: 100,
2923
+ minLength: 0
2924
+ },
2925
+ disableText: 'Please get in touch with your administrator to change this value.'
2926
+ }, {
2927
+ id: 5,
2928
+ label: 'Date of birth',
2929
+ name: 'dob',
2930
+ required: false,
2931
+ type: 'datepicker',
2932
+ fullWidth: false,
2933
+ visibility: true,
2934
+ readOnly: false,
2935
+ hasIcon: false,
2936
+ size: 'normal',
2937
+ maxDate: dob.maxDate,
2938
+ minDate: dob.minDate,
2939
+ disableText: 'Please get in touch with your administrator to change this value.'
2940
+ }, {
2941
+ id: 6,
2942
+ empty: true
2943
+ }, {
2944
+ id: 7,
2945
+ label: 'Gender',
2946
+ name: 'gender',
2947
+ required: false,
2948
+ type: 'select',
2949
+ fullWidth: false,
2950
+ visibility: true,
2951
+ readOnly: false,
2952
+ placeholder: 'Select gender',
2953
+ tooltip: 'This information will be used for flight booking purpose',
2954
+ disableText: 'Please get in touch with your administrator to change this value.'
2955
+ }, {
2956
+ id: 8,
2957
+ label: 'Profile photo',
2958
+ description: 'This will be displayed on your profile',
2959
+ name: 'profile_pic',
2960
+ required: false,
2961
+ multiple: false,
2962
+ fileType: 'image/png,image/jpeg,image/jpg,image/webp,image/JPG,image/JPEG',
2963
+ fileSize: 5,
2964
+ title: 'Select Profile',
2965
+ type: 'file',
2966
+ fullWidth: true,
2967
+ visibility: true,
2968
+ readOnly: false,
2969
+ maxNoFiles: 2,
2970
+ buttonType: 'profile',
2971
+ disableText: 'Disable text here.'
2972
+ }];
2973
+ var workInfo = [{
2974
+ id: 1,
2975
+ label: 'Employee level',
2976
+ name: 'emp_level',
2977
+ required: false,
2978
+ type: 'async_select',
2979
+ fullWidth: false,
2980
+ visibility: true,
2981
+ readOnly: false,
2982
+ title: 'Select employee level',
2983
+ inputType: false,
2984
+ placeholder: 'Select employee level',
2985
+ loadOption: commonLoadOptions,
2986
+ tabelName: 'employee_level',
2987
+ tooltip: 'This information will be used in creation of policies and approval rules',
2988
+ disableText: 'Please get in touch with your administrator to change this value.',
2989
+ selectCTA: {
2990
+ value: 'employee_level',
2991
+ component: /*#__PURE__*/React.createElement(IUITypography, {
2992
+ className: "iui__font--color-link iui__font--weight-500"
2993
+ }, "+ Add Employee Level"),
2994
+ callback: null
2995
+ }
2996
+ }, {
2997
+ id: 2,
2998
+ label: 'Employee ID',
2999
+ name: 'employee_id',
3000
+ required: false,
3001
+ type: 'input',
3002
+ fullWidth: false,
3003
+ visibility: true,
3004
+ readOnly: false,
3005
+ placeholder: 'Enter employee ID',
3006
+ validation: {
3007
+ regexOnChange: null,
3008
+ regexOnBlur: [{
3009
+ regex: /^[A-Za-z0-9]*$/,
3010
+ message: 'Only alphabets & numbers are allowed'
3011
+ }],
3012
+ maxLimit: '',
3013
+ minLimit: '',
3014
+ maxLength: 100,
3015
+ minLength: 0
3016
+ },
3017
+ disableText: 'Please get in touch with your administrator to change this value.'
3018
+ }, {
3019
+ id: 3,
3020
+ label: 'Entity',
3021
+ name: 'entity',
3022
+ required: false,
3023
+ type: 'async_select',
3024
+ fullWidth: false,
3025
+ visibility: true,
3026
+ readOnly: false,
3027
+ title: '',
3028
+ inputType: false,
3029
+ placeholder: 'Select entity',
3030
+ loadOption: commonLoadOptions,
3031
+ tabelName: 'entity',
3032
+ tooltip: 'This information will be used in creation of policies and approval rules',
3033
+ disableText: 'Please get in touch with your administrator to change this value.',
3034
+ selectCTA: {
3035
+ value: 'entity',
3036
+ component: /*#__PURE__*/React.createElement(IUITypography, {
3037
+ className: "iui__font--color-link iui__font--weight-500"
3038
+ }, "+ Add Entity"),
3039
+ callback: null
3040
+ }
3041
+ }, {
3042
+ id: 4,
3043
+ label: 'Business unit',
3044
+ name: 'business_unit',
3045
+ required: false,
3046
+ type: 'async_select',
3047
+ fullWidth: false,
3048
+ visibility: true,
3049
+ readOnly: false,
3050
+ title: 'Select unit',
3051
+ inputType: false,
3052
+ placeholder: 'Select unit',
3053
+ tabelName: 'business_unit',
3054
+ loadOption: commonLoadOptions,
3055
+ disableText: 'Please get in touch with your administrator to change this value.',
3056
+ selectCTA: {
3057
+ value: 'business_unit',
3058
+ component: /*#__PURE__*/React.createElement(IUITypography, {
3059
+ className: "iui__font--color-link iui__font--weight-500"
3060
+ }, "+ Add Business Unit"),
3061
+ callback: null
3062
+ }
3063
+ }, {
3064
+ id: 5,
3065
+ label: 'Department',
3066
+ name: 'department',
3067
+ required: false,
3068
+ type: 'async_select',
3069
+ fullWidth: false,
3070
+ visibility: true,
3071
+ readOnly: false,
3072
+ title: 'Select department',
3073
+ inputType: false,
3074
+ placeholder: 'Select department',
3075
+ tabelName: 'department',
3076
+ loadOption: commonLoadOptions,
3077
+ disableText: 'Please get in touch with your administrator to change this value.',
3078
+ selectCTA: {
3079
+ value: 'department',
3080
+ component: /*#__PURE__*/React.createElement(IUITypography, {
3081
+ className: "iui__font--color-link iui__font--weight-500"
3082
+ }, "+ Add Department"),
3083
+ callback: null
3084
+ }
3085
+ }, {
3086
+ id: 6,
3087
+ label: 'Designation',
3088
+ name: 'designation',
3089
+ required: false,
3090
+ type: 'input',
3091
+ fullWidth: false,
3092
+ visibility: true,
3093
+ readOnly: false,
3094
+ placeholder: 'Enter designation',
3095
+ validation: {
3096
+ regexOnChange: null,
3097
+ regexOnBlur: [{
3098
+ regex: /^[A-Za-z0-9 -.&'()]*$/,
3099
+ message: "Only alphabets, numbers & special characters . & ' () - are allowed."
3100
+ }, {
3101
+ regex: /^[a-zA-Z]/,
3102
+ message: 'Designation should start with alphabets'
3103
+ }],
3104
+ maxLimit: '',
3105
+ minLimit: '',
3106
+ maxLength: 100,
3107
+ minLength: 0
3108
+ },
3109
+ disableText: 'Please get in touch with your administrator to change this value.'
3110
+ }, {
3111
+ id: 7,
3112
+ label: 'Base location',
3113
+ name: 'base_location',
3114
+ required: false,
3115
+ type: 'input',
3116
+ fullWidth: true,
3117
+ placeholder: 'Enter city',
3118
+ visibility: true,
3119
+ readOnly: false,
3120
+ validation: {
3121
+ regexOnChange: null,
3122
+ regexOnBlur: [{
3123
+ regex: /^[A-Za-z0-9 -.&'()]*$/,
3124
+ message: "Only alphabets, numbers & special characters . & ' () - are allowed."
3125
+ }, {
3126
+ regex: /^[a-zA-Z]/,
3127
+ message: 'Base location should start with alphabets'
3128
+ }],
3129
+ maxLimit: '',
3130
+ minLimit: '',
3131
+ maxLength: 500,
3132
+ minLength: 0
3133
+ },
3134
+ disableText: 'Please get in touch with your administrator to change this value.'
3135
+ }, {
3136
+ id: 7,
3137
+ label: 'Default currency',
3138
+ name: 'currency',
3139
+ required: false,
3140
+ type: 'async_select',
3141
+ fullWidth: false,
3142
+ visibility: true,
3143
+ readOnly: false,
3144
+ inputType: false,
3145
+ tabelName: 'default_currency',
3146
+ loadOption: currencyLoadOptions,
3147
+ tooltip: 'This only changes the currency for this user',
3148
+ disableText: 'Please get in touch with your administrator to change this value.'
3149
+ }, {
3150
+ id: 8,
3151
+ empty: true
3152
+ }];
3153
+ var products = [{
3154
+ id: 1,
3155
+ label: 'Travel',
3156
+ name: 'travel',
3157
+ type: 'checkbox',
3158
+ disableText: 'Please get in touch with your administrator to change this value.'
3159
+ }, {
3160
+ id: 2,
3161
+ label: 'Expense',
3162
+ name: 'expense',
3163
+ type: 'checkbox',
3164
+ disableText: 'Please get in touch with your administrator to change this value.'
3165
+ }];
3166
+ var dropdownList = {
3167
+ gender: [{
3168
+ id: 1,
3169
+ name: 'Male'
3170
+ }, {
3171
+ id: 2,
3172
+ name: 'Female'
3173
+ }, {
3174
+ id: 3,
3175
+ name: 'Others'
3176
+ }],
3177
+ flight_seat_preference: [],
3178
+ meal_preference: [],
3179
+ contact_number: [],
3180
+ passport_issue_country: [],
3181
+ nationality: []
3182
+ };
3183
+ var travelConstants = {
3184
+ heading: 'Travel specific information',
3185
+ roleHeading: 'Travel role',
3186
+ roleDescription: 'Roles allow users to only access relevant features and functionalities',
3187
+ approverHeading: 'Travel approvers',
3188
+ approverDescription: 'You can add upto :maxApprovers approvers',
3189
+ FYILabel: 'FYI approver',
3190
+ FYIDescription: 'Send travel approval alerts to this email',
3191
+ roles: [{
3192
+ id: 1,
3193
+ label: 'Traveler',
3194
+ description: 'Can create trips for themselves and guests',
3195
+ name: 'traveler',
3196
+ type: 'radio',
3197
+ fullWidth: false,
3198
+ visibility: true,
3199
+ disableText: 'Please get in touch with your administrator to change this value.'
3200
+ }, {
3201
+ id: 2,
3202
+ label: 'Admin',
3203
+ description: 'Can administer the product, manage user access, billing details, company settings etc.',
3204
+ name: 'travel_admin',
3205
+ type: 'radio',
3206
+ fullWidth: false,
3207
+ visibility: true,
3208
+ disableText: 'Please get in touch with your administrator to change this value.'
3209
+ }, {
3210
+ id: 3,
3211
+ label: 'Finance admin',
3212
+ description: 'Can administer the product, manage user access, billing details, company settings etc.',
3213
+ name: 'travel_finance_admin',
3214
+ type: 'radio',
3215
+ fullWidth: false,
3216
+ visibility: true,
3217
+ disableText: 'Please get in touch with your administrator to change this value.'
3218
+ }],
3219
+ approvers: [{
3220
+ id: 1,
3221
+ label: 'Person 1',
3222
+ name: 'travel_approver',
3223
+ required: false,
3224
+ type: 'input',
3225
+ fullWidth: false,
3226
+ visibility: true,
3227
+ readOnly: false,
3228
+ placeholder: 'Select Approver',
3229
+ validation: {
3230
+ regexOnChange: null,
3231
+ regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
3232
+ maxLimit: '',
3233
+ minLimit: '',
3234
+ maxLength: 100,
3235
+ minLength: 0
3236
+ },
3237
+ disableText: 'Please get in touch with your administrator to change this value.'
3238
+ }, {
3239
+ id: 2,
3240
+ label: 'Person 2',
3241
+ name: 'travel_approver',
3242
+ required: false,
3243
+ type: 'input',
3244
+ fullWidth: false,
3245
+ visibility: true,
3246
+ readOnly: false,
3247
+ placeholder: 'Select Approver',
3248
+ validation: {
3249
+ regexOnChange: null,
3250
+ regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
3251
+ maxLimit: '',
3252
+ minLimit: '',
3253
+ maxLength: 100,
3254
+ minLength: 0
3255
+ },
3256
+ disableText: 'Please get in touch with your administrator to change this value.'
3257
+ }]
3258
+ };
3259
+ var expenseConstants = {
3260
+ heading: 'Expense specific information',
3261
+ roleHeading: 'Expense role',
3262
+ roleDescription: 'Roles allow users to only access relevant features and functionalities',
3263
+ approverHeading: 'Expense approvers',
3264
+ approverDescription: 'You can add upto :maxApprovers approvers',
3265
+ FYILabel: 'FYI approver',
3266
+ FYIDescription: 'Send expense approval alerts to this email',
3267
+ roles: [{
3268
+ id: 1,
3269
+ label: 'Submitter',
3270
+ description: 'Can submit expenses',
3271
+ name: 'submitter',
3272
+ type: 'radio',
3273
+ fullWidth: false,
3274
+ visibility: true,
3275
+ disableText: 'Please get in touch with your administrator to change this value.'
3276
+ }, {
3277
+ id: 2,
3278
+ label: 'Admin',
3279
+ description: 'Can administer the product, manage user access, billing details, company settings etc.',
3280
+ name: 'expense_admin',
3281
+ type: 'radio',
3282
+ fullWidth: false,
3283
+ visibility: true,
3284
+ disableText: 'Please get in touch with your administrator to change this value.'
3285
+ }, {
3286
+ id: 3,
3287
+ label: 'Finance admin',
3288
+ description: 'Can administer the product, manage user access, billing details, company settings etc.',
3289
+ name: 'expense_finance_admin',
3290
+ type: 'radio',
3291
+ fullWidth: false,
3292
+ visibility: true,
3293
+ disableText: 'Please get in touch with your administrator to change this value.'
3294
+ }],
3295
+ approvers: [{
3296
+ id: 1,
3297
+ label: 'Person 1',
3298
+ name: 'expense_approver',
3299
+ required: false,
3300
+ type: 'input',
3301
+ fullWidth: false,
3302
+ visibility: true,
3303
+ readOnly: false,
3304
+ placeholder: 'Select Approver',
3305
+ validation: {
3306
+ regexOnChange: null,
3307
+ regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
3308
+ maxLimit: '',
3309
+ minLimit: '',
3310
+ maxLength: 100,
3311
+ minLength: 0
3312
+ },
3313
+ disableText: 'Please get in touch with your administrator to change this value.'
3314
+ }, {
3315
+ id: 2,
3316
+ label: 'Person 2',
3317
+ name: 'expense_approver',
3318
+ required: false,
3319
+ type: 'input',
3320
+ fullWidth: false,
3321
+ visibility: true,
3322
+ readOnly: false,
3323
+ placeholder: 'Select Approver',
3324
+ validation: {
3325
+ regexOnChange: null,
3326
+ regexOnBlur: /^(([^<>()\\.,;:\s@"]+(\.[^<a>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
3327
+ maxLimit: '',
3328
+ minLimit: '',
3329
+ maxLength: 100,
3330
+ minLength: 0
3331
+ },
3332
+ disableText: 'Please get in touch with your administrator to change this value.'
3333
+ }]
3334
+ };
3335
+ var passportInfo = [{
3336
+ id: 1,
3337
+ label: 'Passport issuing country',
3338
+ name: 'passport_issue_country',
3339
+ required: false,
3340
+ type: 'async_select',
3341
+ fullWidth: false,
3342
+ visibility: true,
3343
+ readOnly: false,
3344
+ placeholder: 'Select country',
3345
+ tabelName: 'country_name',
3346
+ loadOption: countryOptions,
3347
+ disableText: 'Please get in touch with your administrator to change this value.'
3348
+ }, {
3349
+ id: 2,
3350
+ label: 'Passport number',
3351
+ name: 'passport_number',
3352
+ required: false,
3353
+ type: 'input',
3354
+ fullWidth: false,
3355
+ visibility: true,
3356
+ readOnly: false,
3357
+ placeholder: 'Enter passport number',
3358
+ validation: {
3359
+ regexOnChange: null,
3360
+ regexOnBlur: [{
3361
+ regex: /^[A-Za-z0-9]*$/,
3362
+ message: 'Only alphabets & numbers are allowed'
3363
+ }],
3364
+ maxLimit: '',
3365
+ minLimit: '',
3366
+ maxLength: 15,
3367
+ minLength: 7
3368
+ },
3369
+ disableText: 'Please get in touch with your administrator to change this value.'
3370
+ }, {
3371
+ id: 3,
3372
+ label: 'Nationality',
3373
+ name: 'nationality',
3374
+ required: false,
3375
+ type: 'async_select',
3376
+ fullWidth: true,
3377
+ visibility: true,
3378
+ readOnly: false,
3379
+ placeholder: 'Select nationality',
3380
+ tabelName: 'nationality',
3381
+ loadOption: countryOptions,
3382
+ disableText: 'Please get in touch with your administrator to change this value.'
3383
+ }, {
3384
+ id: 4,
3385
+ label: 'Date of issue',
3386
+ name: 'passport_issue_date',
3387
+ required: false,
3388
+ type: 'datepicker',
3389
+ hasIcon: false,
3390
+ fullWidth: false,
3391
+ visibility: true,
3392
+ readOnly: false,
3393
+ size: 'small',
3394
+ maxDate: passportStart.maxDate,
3395
+ minDate: passportStart.minDate,
3396
+ disableText: 'Please get in touch with your administrator to change this value.'
3397
+ }, {
3398
+ id: 5,
3399
+ label: 'Date of expiry',
3400
+ name: 'passport_expiry_date',
3401
+ required: false,
3402
+ type: 'datepicker',
3403
+ hasIcon: false,
3404
+ fullWidth: false,
3405
+ visibility: true,
3406
+ readOnly: false,
3407
+ size: 'small',
3408
+ maxDate: passportEnd.maxDate,
3409
+ minDate: passportEnd.minDate,
3410
+ disableText: 'Please get in touch with your administrator to change this value.'
3411
+ }, {
3412
+ id: 6,
3413
+ label: 'Photo of passport',
3414
+ description: '',
3415
+ name: 'passport_photo',
3416
+ required: false,
3417
+ type: 'file',
3418
+ multiple: true,
3419
+ fileType: 'application/pdf,image/png,image/jpeg,image/jpg',
3420
+ fileSize: 5,
3421
+ title: 'Select Photo',
3422
+ fullWidth: true,
3423
+ visibility: true,
3424
+ readOnly: false,
3425
+ maxNoFiles: 2,
3426
+ disableText: 'Please get in touch with your administrator to change this value.'
3427
+ }, {
3428
+ id: 7,
3429
+ label: 'Travel documents',
3430
+ description: 'You can add upto 5 documents',
3431
+ name: 'travel_docs',
3432
+ required: false,
3433
+ multiple: true,
3434
+ fileType: 'application/pdf,image/png,image/jpeg,image/jpg',
3435
+ fileSize: 5,
3436
+ title: 'Select document',
3437
+ type: 'file',
3438
+ fullWidth: true,
3439
+ visibility: true,
3440
+ readOnly: false,
3441
+ maxNoFiles: 5,
3442
+ tooltip: 'This is for quick access of important travel documents during your trip like Visa, Identification, Vaccine certificates etc.',
3443
+ disableText: 'Please get in touch with your administrator to change this value.'
3444
+ }];
3445
+ var travelPreference = [{
3446
+ id: 1,
3447
+ label: 'Flight seat preference',
3448
+ name: 'flight_seat_preference',
3449
+ required: false,
3450
+ type: 'select',
3451
+ fullWidth: false,
3452
+ visibility: true,
3453
+ readOnly: false,
3454
+ placeholder: 'Select seat preference',
3455
+ disableText: 'Please get in touch with your administrator to change this value.'
3456
+ }, {
3457
+ id: 1,
3458
+ label: 'Meals preference',
3459
+ name: 'meal_preference',
3460
+ required: false,
3461
+ type: 'select',
3462
+ fullWidth: false,
3463
+ visibility: true,
3464
+ readOnly: false,
3465
+ placeholder: 'Select meals preference',
3466
+ disableText: 'Please get in touch with your administrator to change this value.'
3467
+ }];
3468
+ var secureTravelInfo = [{
3469
+ id: 1,
3470
+ label: 'Known traveler number',
3471
+ placeholder: 'Enter known traveler number',
3472
+ name: 'trusted_traveller',
3473
+ required: false,
3474
+ type: 'input',
3475
+ hasIcon: true,
3476
+ fullWidth: false,
3477
+ visibility: true,
3478
+ readOnly: false,
3479
+ tooltip: /*#__PURE__*/React.createElement(React.Fragment, null, "The Known Traveler Number is a unique number issued by the U.S. Government to identify customers who participate in a known traveler program (e.g.: Global Entry, SENTRI, NEXUS, TSA PreCheck application process). For more information about the Known Traveler Number,", ' ', /*#__PURE__*/React.createElement("a", {
3480
+ href: "https://www.tsa.gov/travel/frequently-asked-questions",
3481
+ target: "_blank",
3482
+ rel: "noreferrer"
3483
+ }, "visit TSA's PreCheck website")),
3484
+ disableText: 'Please get in touch with your administrator to change this value.'
3485
+ }, {
3486
+ id: 1,
3487
+ label: 'Redress number',
3488
+ placeholder: 'Enter redress number',
3489
+ name: 'redress_number',
3490
+ required: false,
3491
+ type: 'input',
3492
+ hasIcon: true,
3493
+ fullWidth: false,
3494
+ visibility: true,
3495
+ readOnly: false,
3496
+ tooltip: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "The Redress Number is a unique number issued by the DHS (Department of Homeland Security) that is used to facilitate passenger clearance for persons who have the same name as someone on the TSA (Transportation Security Administration) watch list. For more information about the Secure Flight program,", ' ', /*#__PURE__*/React.createElement("a", {
3497
+ href: "https://www.tsa.gov/travel/passenger-support/travel-redress-program",
3498
+ target: "_blank",
3499
+ rel: "noreferrer"
3500
+ }, "visit TSA's Secure Flight website"))),
3501
+ disableText: 'Please get in touch with your administrator to change this value.'
3502
+ }];
3503
+ var userAddPageFormLabels = {
3504
+ user_personal_info: {
3505
+ first_name: 'First and middle name',
3506
+ last_name: 'Last name',
3507
+ email: 'Email address',
3508
+ contact_number: 'Phone number',
3509
+ dob: 'Date of birth',
3510
+ gender: 'Gender',
3511
+ profile_pic: 'Profile photo'
3512
+ },
3513
+ employee_info: {
3514
+ emp_level: 'Employee level',
3515
+ employee_id: 'Employee ID',
3516
+ entity: 'Entity',
3517
+ business_unit: 'Business unit',
3518
+ department: 'Department',
3519
+ designation: 'Designation',
3520
+ base_location: 'Base location',
3521
+ currency: 'Default currency'
3522
+ },
3523
+ user_travel_info: {
3524
+ nationality: 'Nationality',
3525
+ passport_number: 'Passport number',
3526
+ passport_expiry_date: 'Date of expiry',
3527
+ passport_issue_country: 'Passport issuing country',
3528
+ passport_issue_date: 'Date of issue',
3529
+ passport_photo: 'Photo of passport',
3530
+ travel_docs: 'Travel documents',
3531
+ flight_seat_preference: 'Flight seat preference',
3532
+ meal_preference: 'Meals preference',
3533
+ trusted_traveller: 'Known traveler number',
3534
+ redress_number: 'Redress number'
3535
+ },
3536
+ products: {
3537
+ travel: 'Travel',
3538
+ expense: 'Expense'
3539
+ },
3540
+ travel_fyi_approver: 'FYI approver'
3541
+ };
3542
+
3516
3543
  var initialState = {
3517
3544
  loading: false,
3518
3545
  isRendered: false,