@itilite/iui-user-management 0.2.1 → 0.2.2

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