Advertisement
coffeecode12

Untitled

Dec 16th, 2021
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit, Inject, ViewChild, QueryList, ElementRef } from "@angular/core";
  2. import { Title } from "@angular/platform-browser";
  3. import { NgbDateStruct } from "@ng-bootstrap/ng-bootstrap";
  4. import { VacancyFormService } from "./vacancy-form.service";
  5. import { NgxSpinnerService } from 'ngx-spinner';
  6. import { Router, ActivatedRoute, ParamMap } from '@angular/router';
  7. import { SESSION_STORAGE, StorageService } from 'angular-webstorage-service';
  8. import { FormGroup, FormBuilder, Validators, FormControl } from "@angular/forms";
  9. import { DataService } from "../services/data.service";
  10. import { MatStepper } from '@angular/material/stepper';
  11. import { formatDate, DatePipe } from "@angular/common";
  12. import { MatDialog, MatSnackBar } from "@angular/material";
  13. import { MatDatepickerInputEvent } from '@angular/material/datepicker';
  14. import { ApplyConfirmationDialogComponent } from "./apply-confirmation-dialog/apply-confirmation-dialog.component";
  15. import * as moment from 'moment';
  16. import { debounceTime, map, startWith } from "rxjs/operators";
  17. import { debounce } from 'lodash';
  18. import { Observable } from "rxjs";
  19. import { CoverLetterData, DocumentGeneratorService } from "./document-generator.service";
  20.  
  21. export class AvailableVacancies {
  22.   vacancyId: number
  23.   title: string
  24.   category: string
  25.   description: string
  26.   requirement: string
  27.   createdDate: Date
  28.   modifiedDate: Date
  29.   expiredDate: Date
  30.   availableVacanciesConfig: AvailableVacanciesConfig[]
  31.  
  32. }
  33. export class AvailableVacanciesConfig {
  34.   id: number
  35.   vacancyId: string
  36.   field: string
  37.   rule: string
  38.   value: string
  39.  
  40. }
  41.  
  42. export class Document {
  43.   candidatesDocumentId: number;
  44.   npwpNo: string
  45.   bpjsNo: string
  46.   faskes: string
  47.   jamsostekNo: string
  48.   jamsostekDate: string
  49.   simType: string
  50.   simNo: string
  51.   simExpiredDate: string
  52.   stnkExpiredDate: string
  53.   stnkPlatNoDate: string
  54.   bankName: string
  55.   bankAccountName: string
  56.   bankAccountNo: string
  57.   licensePlate: string
  58. }
  59. export class EmergencyContact {
  60.   candidatesEmergencyContactId: number
  61.   emergencyContactName: string;
  62.   phoneNumber: string;
  63.   relationship: string;
  64. }
  65. export class LanguageSkill {
  66.   candidatesLanguageId: number;
  67.   language: string;
  68.   readingSkill: string
  69.   writingSkill: string
  70.   listeningSkill: string
  71.   conversationalSkill: string
  72.   remarks: string
  73. }
  74. export class WorkExperience {
  75.   candidatesWorkExperienceId: number;
  76.   companyName: string
  77.   position: string
  78.   yearIn: string
  79.   yearOut: string
  80.   achievement: string
  81. }
  82. export class InformalEducation {
  83.   candidatesInformalId: number;
  84.   trainingName: string
  85.   trainingDate: string
  86.   remarks: string
  87. }
  88. export class Education {
  89.   candidatesEducationId: number;
  90.   institution: string
  91.   major: string
  92.   yearIn: string
  93.   yearOut: string
  94.   grade: string
  95. }
  96. export class Family {
  97.   candidatesFamilyId: number;
  98.   relationship: string;
  99.   name: string;
  100.   gender: string;
  101.   dateOfBirth: string;
  102.   lastEducation: string;
  103.   occupation: string;
  104.   companyName: string;
  105. }
  106. export class PersonalInfo {
  107.   candidatesId: number
  108.   name: string;
  109.   sex: string;
  110.   dateOfBirth: string;
  111.   placeOfBirth: string;
  112.   dateOfDivorce: string;
  113.   ktpNo: string = "";
  114.   ktpAddress: string;
  115.   ktpKota: string;
  116.   ktpKodePos: string;
  117.   ktpKecamatan: string;
  118.   ktpKelurahan: string;
  119.   ktpRt: string;
  120.   ktpRw: string;
  121.   domisiliAddress: string;
  122.   domisiliKota: string;
  123.   domisiliKodePos: string = "";
  124.   kkNo: string = "";
  125.   address: string;
  126.   lastEducation: string;
  127.   religion: string;
  128.   maritalStatus: string;
  129.   email: string;
  130.   phoneNumber: string = "";
  131.   driverLicenseType: string = "";
  132.   driverLicenseNumber: string = "";
  133.   hobby: string;
  134.   appliedPosition: string;
  135.   level: string
  136.   placementCityCode: string;
  137.   placementProvinceCode: string;
  138.   jobVacancySource: string;
  139.   ptkp: string;
  140.   vaccineStatus: number;
  141.   vaccineConsent: number;
  142. }
  143.  
  144. export interface ResumeData {
  145.   personalInfo: PersonalInfoPrint;
  146.   familyList: Family[];
  147.   educationList: Education[];
  148.   informalEducationList: InformalEducation[];
  149.   workExperienceList: WorkExperience[];
  150. }
  151.  
  152. export interface PersonalInfoPrint extends PersonalInfo {
  153.   placeDateBirth?: string;
  154. }
  155.  
  156.  
  157.  
  158.  
  159. @Component({
  160.   selector: "app-vacancy-form-component",
  161.   templateUrl: "./vacancy-form.component.html",
  162.   styleUrls: ["./vacancy-form.component.scss"]
  163. })
  164. export class VacancyFormComponent implements OnInit {
  165.  
  166.   @ViewChild('stepper') private myStepper: MatStepper;
  167.   @ViewChild('cards') cards: QueryList<ElementRef>;
  168.  
  169.   moment: any = moment;
  170.  
  171.   allowedFile: string = "JPG,JPEG,PDF"
  172.   optionVaccine = [
  173.     {
  174.       label: "Belum Vaksin",
  175.       value: 0
  176.     },
  177.     {
  178.       label: "Tahap 1",
  179.       value: 1
  180.     },
  181.     {
  182.       label: "Tahap 2",
  183.       value: 2
  184.     },
  185.   ]
  186.   optionVaccineConsent = [
  187.     {
  188.       label: "Ya",
  189.       value: 1
  190.     },
  191.     {
  192.       label: "Tidak",
  193.       value: 0
  194.     },
  195.   ]
  196.  
  197.   applyConfirmationDialogComponent = ApplyConfirmationDialogComponent;
  198.   optionBpjs: Array<string> = ["YA", "TIDAK"]
  199.   selectedOptionBpjs: string
  200.   selectedOptionJamsostek: string
  201.  
  202.   numberOnly: RegExp = /[0-9]+/
  203.   validKtp: RegExp = /^(?!(\d)\1+$|\d*(\d)\2{6}$)(?:\d{16})?$/
  204.   validEmail: RegExp = /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/
  205.   validPhone: RegExp = /^08[0-9]*$/
  206.   alphaspaceOnly: RegExp = /[^a-z ]/gi
  207.  
  208.   placementProvince: string
  209.   placementCity: string
  210.   placementProvinceCode: string
  211.   placementCityCode: string
  212.   placementProvinceAuto: Array<any>
  213.   placementCityAuto: Array<any>
  214.  
  215.   numberOfSibling: number = 0
  216.   numberOfChild: number = 0
  217.  
  218.   loadPersonalData: boolean = false
  219.   loadFamily: boolean = false
  220.   loadDocument: boolean = false
  221.   loadEducation: boolean = false
  222.   loadInformalEducation: boolean = false
  223.   loadWorkExperience: boolean = false
  224.   loadLanguageSkill: boolean = false
  225.   loadEmergencyContact: boolean = false
  226.  
  227.  
  228.  
  229.   ijazah: File
  230.   cv: File
  231.   ktp: File
  232.   kk: File
  233.   skck: File
  234.   sim: File
  235.   stnk: File
  236.   stnkBack: File
  237.   tabungan: File
  238.   vaccine: File
  239.   coverLetter: File
  240.  
  241.   ijazahStatus: boolean = false
  242.   cvStatus: boolean = false
  243.   ktpStatus: boolean = false
  244.   kkStatus: boolean = false
  245.   skckStatus: boolean = false
  246.   simStatus: boolean = false
  247.   stnkStatus: boolean = false
  248.   stnkBackStatus: boolean = false
  249.   tabunganStatus: boolean = false
  250.   vaccineStatus: boolean = false
  251.  
  252.   ijazahFilename: string
  253.   cvFilename: string
  254.   ktpFilename: string
  255.   kkFilename: string
  256.   skckFilename: string
  257.   simFilename: string
  258.   stnkFilename: string
  259.   stnkBackFilename: string
  260.   tabunganFilename: string
  261.   vaccineFilename: string
  262.  
  263.   vacancyId: string
  264.   title: string = ""
  265.   category: string = ""
  266.   candidatesId: string
  267.  
  268.   step: number = 0
  269.  
  270.   availableVacancies: AvailableVacancies
  271.   availableVacanciesConfig: AvailableVacanciesConfig[] = []
  272.  
  273.   personalInfoDetail: PersonalInfo = new PersonalInfo
  274.   documentDetail: Document = new Document
  275.   familyList: Family[] = []
  276.   educationList: Education[] = [new Education]
  277.   informalEducationList: InformalEducation[] = [new InformalEducation]
  278.   workExperienceList: WorkExperience[] = []
  279.   languageSkillList: LanguageSkill[] = []
  280.   emergencyContactList: EmergencyContact[] = [new EmergencyContact]
  281.   validationStatus: Array<boolean> = [
  282.     false,
  283.     false,
  284.     false,
  285.     false,
  286.     false,
  287.     false,
  288.     false,
  289.   ]
  290.  
  291.   url: string = "";
  292.   public candidateId: any;
  293.   public authorization: string = "";
  294.   public position: string = "";
  295.  
  296.   hasFileName = {
  297.     KTP: '',
  298.     KK: '',
  299.     Ijazah: '',
  300.     CV: '',
  301.     SIM: '',
  302.     STNK: '',
  303.     STNKBACK: '',
  304.     Tabungan: '',
  305.     Vaccine: '',
  306.   }
  307.  
  308.  
  309.   textPTKP = {
  310.     TK0: 'BELUM KAWIN',
  311.     TK1: 'BELUM KAWIN TANGGUNGAN SATU',
  312.     TK2: 'BELUM KAWIN TANGGUNGAN DUA',
  313.     TK3: 'BELUM KAWIN TANGGUNGAN TIGA',
  314.     K0: 'KAWIN TANGGUNGAN 0',
  315.     K1: 'KAWIN TANGGUNGAN 1',
  316.     K2: 'KAWIN TANGGUNGAN 2',
  317.     K3: 'KAWIN TANGGUNGAN 3'
  318.   }
  319.  
  320.   simOption = [
  321.     // "SIM A",
  322.     // "SIM B",
  323.     "SIM C"
  324.   ];
  325.  
  326.   bankDetail = [
  327.     {
  328.       bankName: "BCA",
  329.       minLength: 10,
  330.       maxLength: 10
  331.     },
  332.     {
  333.       bankName: "BNI",
  334.       minLength: 4,
  335.       maxLength: 20
  336.     },
  337.     {
  338.       bankName: "BRI",
  339.       minLength: 4,
  340.       maxLength: 20
  341.     },
  342.     {
  343.       bankName: "MANDIRI",
  344.       minLength: 13,
  345.       maxLength: 13
  346.     },
  347.     {
  348.       bankName: "BSI",
  349.       minLength: 4,
  350.       maxLength: 20
  351.     },
  352.   ]
  353.   districtList;
  354.  
  355.   provinceList = [];
  356.   filteredProvinceList: Observable<any>;
  357.  
  358.   cityList = [];
  359.   filteredCityList: Observable<any>;
  360.  
  361.   provinceControl = new FormControl();
  362.   cityControl = new FormControl();
  363.  
  364.   constructor(
  365.     private datePipe: DatePipe,
  366.     private dataService: DataService,
  367.     private _formBuilder: FormBuilder,
  368.     private services: VacancyFormService,
  369.     public spinner: NgxSpinnerService,
  370.     public router: Router,
  371.     private route: ActivatedRoute,
  372.     @Inject(SESSION_STORAGE) public storage: StorageService,
  373.     private dialog: MatDialog,
  374.     private _snackBar: MatSnackBar,
  375.     private titleService: Title,
  376.     private docGenerator: DocumentGeneratorService,
  377.   ) {
  378.     this.url = this.router.url;
  379.     if (this.url == "/psikotest-start" || this.url == "/epkwt-form") {
  380.       this.authorization = this.storage.get("token") ? this.storage.get("token") : this.dataService.token;
  381.       this.candidateId = this.storage.get("candidate_id");
  382.       this.titleService.setTitle("Psikotest");
  383.     } else {
  384.       this.titleService.setTitle("Anteraja Career");
  385.     }
  386.     // this.onInputPlacementProvince = debounce(this.onInputPlacementProvince, 4)
  387.     // this.onInputPlacementCity = debounce(this.onInputPlacementCity, 4)
  388.     // this.onChangePlacementCity = debounce(this.onChangePlacementCity, 7)
  389.     // this.onChangePlacementProvince = debounce(this.onChangePlacementProvince, 7)
  390.  
  391.   }
  392.  
  393.   @ViewChild('topPage')
  394.   topPage: ElementRef;
  395.  
  396.   ngOnInit() {
  397.  
  398.  
  399.     //For AutoComplete
  400.     this.services.getDisctrictFromAPI().subscribe((res) => {
  401.       this.districtList = res;
  402.       this.provinceList = Object.keys(this.districtList);
  403.  
  404.       this.provinceControl.valueChanges.subscribe((val) => {
  405.         // console.log(val);
  406.         if (this.districtList) {
  407.           let provinceData = this.districtList[val];
  408.           // console.log('dis',provinceData);
  409.           if (provinceData) {
  410.             this.cityList = provinceData;
  411.             this.placementProvinceCode = this.cityList[0].provinceCode;
  412.             this.cityControl.setValue('');
  413.             // console.log('code',this.placementProvinceCode);
  414.           }
  415.           else {
  416.             this.cityList = [];
  417.             this.placementProvinceCode = null;
  418.             this.cityControl.setValue('');
  419.             // console.log(this.placementCityCode);
  420.           }
  421.         }
  422.       })
  423.  
  424.       this.cityControl.valueChanges.subscribe((val) => {
  425.         // console.log(val);
  426.         if (this.cityList) {
  427.           let cityData = this.cityList.filter(x => x.cityName == val);
  428.           // console.log('city',cityData);
  429.           if (cityData.length == 1) {
  430.             this.placementCityCode = cityData[0].cityCode;
  431.             // console.log('code',this.placementCityCode);
  432.           }
  433.           else {
  434.             this.placementCityCode = null;
  435.           }
  436.         }
  437.       })
  438.  
  439.       this.filteredCityList = this.cityControl.valueChanges
  440.         .pipe(
  441.           startWith(''),
  442.           map(value => this.filterCity(value))
  443.         );
  444.  
  445.       this.filteredProvinceList = this.provinceControl.valueChanges
  446.         .pipe(
  447.           startWith(''),
  448.           map(value => this.filterProvince(value))
  449.         );
  450.     });
  451.  
  452.     let ayah = new Family
  453.     let ibu = new Family
  454.     ayah.relationship = "Father"
  455.     ibu.relationship = "Mother"
  456.     ayah.gender = "M"
  457.     ibu.gender = "F"
  458.     this.familyList.push(ayah)
  459.     this.familyList.push(ibu)
  460.     //console.log(this.validateSatriaAge(new Date("2012-10-10")))
  461.     if (this.isPsikotestStart() || this.isEpkwtForm()) {
  462.       this.getAllDataPsikotest()
  463.       this.services.findAVacancyByTitle(this.personalInfoDetail.appliedPosition).subscribe(
  464.         result => {
  465.           this.availableVacancies = result
  466.           this.availableVacanciesConfig = result.availableVacanciesConfig
  467.           console.log("Detail Vacancy")
  468.           console.log(this.availableVacancies)
  469.         }
  470.       )
  471.     } else {
  472.       console.log(this.route.snapshot.paramMap.get('id'))
  473.       this.services.findAVacancy(this.route.snapshot.paramMap.get('id')).subscribe(
  474.         result => {
  475.           console.log(result)
  476.           if (result) {
  477.             // console.log("notEmpty")
  478.             this.availableVacancies = result
  479.             this.availableVacanciesConfig = result.availableVacanciesConfig
  480.             console.log("Detail Vacancy")
  481.             console.log(this.availableVacancies)
  482.             this.vacancyId = result.vacancyId
  483.             this.title = result.title
  484.             this.position = this.title;
  485.             this.category = result.category
  486.             if (this.title.toUpperCase() == "SATMOB" || this.position.toUpperCase() == "SATMOB") {
  487.               this.simOption = [
  488.                 "SIM A",
  489.                 "SIM B1"
  490.               ];
  491.             }
  492.             //this.personalInfoDetail.appliedPosition = result.title
  493.             //this.personalInfoDetail.level = result.category
  494.           } else {
  495.             console.log("empty")
  496.             this.router.navigate(['/'])
  497.           }
  498.         }, err => {
  499.           console.log("empty")
  500.           this.router.navigate(['/'])
  501.         }
  502.       );
  503.     }
  504.  
  505.   }
  506.  
  507.  
  508.  
  509.   createResume() {
  510.  
  511.     let personalInfoPrint = Object.assign({}, this.personalInfoDetail);
  512.  
  513.     let data: ResumeData = {
  514.       personalInfo: personalInfoPrint,
  515.       familyList: this.familyList,
  516.       educationList: this.educationList,
  517.       informalEducationList: this.informalEducationList,
  518.       workExperienceList: this.workExperienceList,
  519.     }
  520.  
  521.     this.docGenerator.createResume(data).then((data) => {
  522.       this.cv = data;
  523.     });
  524.   }
  525.  
  526.   createCoverLetter() {
  527.  
  528.     let data: CoverLetterData = {
  529.       position: this.position.toUpperCase(),
  530.       vacancySource: this.personalInfoDetail.jobVacancySource,
  531.       personalInfo: {
  532.         name: this.personalInfoDetail.name,
  533.         sex: this.personalInfoDetail.sex,
  534.         religion: this.personalInfoDetail.religion,
  535.         placeDateOfBirth: this.personalInfoDetail.placeOfBirth + ', ' + this.personalInfoDetail.dateOfBirth,
  536.         nik: this.personalInfoDetail.ktpNo,
  537.         address: this.personalInfoDetail.address,
  538.         phoneNum: this.personalInfoDetail.phoneNumber,
  539.         email: this.personalInfoDetail.email,
  540.       },
  541.       education: {
  542.         lastEducation: this.personalInfoDetail.lastEducation,
  543.         major: this.educationList[0].institution,
  544.         gradYear: this.educationList[0].yearOut,
  545.       },
  546.     }
  547.  
  548.     this.docGenerator.createCoverLetter(data).then((data) => {
  549.       this.coverLetter = data;
  550.     });
  551.  
  552.   }
  553.  
  554.   checkCandidateUploadedFiles() {
  555.     if (!this.candidatesId) return;
  556.     this.services.getCandidateDocumentFile(this.candidatesId).subscribe((res: any[]) => {
  557.       const KTPName = res.find(x => x.fileName.includes('KTP')).fileName;
  558.       this.hasFileName.KTP = KTPName ? KTPName : '';
  559.  
  560.       const KKName = res.find(x => x.fileName.includes('KK')).fileName;
  561.       this.hasFileName.KK = KKName ? KKName : '';
  562.  
  563.       const IjazahName = res.find(x => x.fileName.includes('IJAZAH')).fileName
  564.       this.hasFileName.Ijazah = IjazahName ? IjazahName : '';
  565.  
  566.       const TabunganName = res.find(x => x.fileName.includes('TABUNGAN')).fileName;
  567.       this.hasFileName.Tabungan = TabunganName ? TabunganName : '';
  568.  
  569.       const SIMName = res.find(x => x.fileName.includes('SIM')).fileName;
  570.       this.hasFileName.SIM = SIMName ? SIMName : '';
  571.  
  572.       const CVName = res.find(x => x.fileName.includes('CV')).fileName;
  573.       this.hasFileName.CV = CVName ? CVName : '';
  574.  
  575.       const vaccineName = res.find(x => x.fileName.includes('SERTIFIKAT VAKSIN')).fileName;
  576.       this.hasFileName.Vaccine = vaccineName ? vaccineName : '';
  577.  
  578.       const STNKName = res.find(x => x.fileName.includes('STNK PAJAK TAHUNAN')).fileName;
  579.       this.hasFileName.STNK = STNKName ? STNKName : '';
  580.  
  581.       const STNKBackName = res.find(x => x.fileName.includes('STNK PAJAK 5 TAHUNAN')).fileName;
  582.       this.hasFileName.STNKBACK = STNKBackName ? STNKBackName : '';
  583.     })
  584.   }
  585.  
  586.   checkLoadingState() {
  587.     if (this.loadPersonalData ||
  588.       this.loadDocument ||
  589.       this.loadFamily ||
  590.       this.loadEducation ||
  591.       this.loadInformalEducation ||
  592.       this.loadEmergencyContact ||
  593.       this.loadWorkExperience) {
  594.       console.log("Loading Data")
  595.  
  596.     } else {
  597.       console.log("Loading Data End")
  598.       this.hideSpinner()
  599.     }
  600.   }
  601.  
  602.   progressBarValue() {
  603.     return (this.step / 6) * 100
  604.   }
  605.   isSatria() {
  606.     if (this.title.toUpperCase() == "SATRIA"
  607.       || this.position.toUpperCase() == "SATRIA"
  608.       || this.position.toUpperCase() == "COURIER"
  609.       || this.title.toUpperCase() == "SATMOB"
  610.       || this.position.toUpperCase() == "SATMOB") {
  611.       return true
  612.     } else {
  613.       return false
  614.     }
  615.   }
  616.  
  617.   isPsikotestStart() {
  618.     if (this.url == "/psikotest-start") {
  619.       return true;
  620.     } else {
  621.       return false;
  622.     }
  623.   }
  624.  
  625.   isEpkwtForm() {
  626.     if (this.url == "/epkwt-form") {
  627.       return true;
  628.     } else {
  629.       return false;
  630.     }
  631.   }
  632.  
  633.   isSibling(family) {
  634.     if (family.relationship.toLowerCase() == "sibling" || family.relationship.toLowerCase() == "older sibling") {
  635.       return true;
  636.     } else {
  637.       return false;
  638.     }
  639.   }
  640.  
  641.   isChild(family) {
  642.     if (family.relationship.toLowerCase() == "child") {
  643.       return true;
  644.     } else {
  645.       return false;
  646.     }
  647.   }
  648.  
  649.   validatePersonalInfoPage() {
  650.     let valid = true
  651.     valid = this.validateEmergencyContact()
  652.     if (this.personalInfoDetail.name == "" || this.personalInfoDetail.name == null) {
  653.       valid = false
  654.     }
  655.     if (this.personalInfoDetail.sex == "" || this.personalInfoDetail.sex == null) {
  656.       valid = false
  657.     }
  658.     if (this.personalInfoDetail.dateOfBirth == null) {
  659.       valid = false
  660.     }
  661.     if (this.personalInfoDetail.placeOfBirth == "" || this.personalInfoDetail.placeOfBirth == null) {
  662.       valid = false
  663.     }
  664.     if (this.personalInfoDetail.religion == "" || this.personalInfoDetail.religion == null) {
  665.       valid = false
  666.     }
  667.     if (this.personalInfoDetail.ktpNo == "" || this.personalInfoDetail.ktpNo == null) {
  668.       valid = false
  669.     }
  670.     if (this.personalInfoDetail.ktpKodePos == "" || this.personalInfoDetail.ktpKodePos == null) {
  671.       valid = false
  672.     }
  673.     if (this.personalInfoDetail.ktpAddress == "" || this.personalInfoDetail.ktpAddress == null) {
  674.       valid = false
  675.     }
  676.     if (this.personalInfoDetail.ktpKecamatan == "" || this.personalInfoDetail.ktpKecamatan == null) {
  677.       valid = false
  678.     }
  679.     if (this.personalInfoDetail.ktpKelurahan == "" || this.personalInfoDetail.ktpKelurahan == null) {
  680.       valid = false
  681.     }
  682.     if (this.personalInfoDetail.ktpRt == "" || this.personalInfoDetail.ktpRt == null) {
  683.       valid = false
  684.     }
  685.     if (this.personalInfoDetail.ktpRw == "" || this.personalInfoDetail.ktpRw == null) {
  686.       valid = false
  687.     }
  688.     if (this.personalInfoDetail.domisiliAddress == "" || this.personalInfoDetail.domisiliAddress == null) {
  689.       valid = false
  690.     }
  691.     if (this.personalInfoDetail.domisiliKodePos == "" || this.personalInfoDetail.domisiliKodePos == null) {
  692.       valid = false
  693.     }
  694.     if (this.personalInfoDetail.domisiliKota == "" || this.personalInfoDetail.domisiliKota == null) {
  695.       valid = false
  696.     }
  697.     if (this.personalInfoDetail.email == "" || this.personalInfoDetail.email == null) {
  698.       valid = false
  699.     }
  700.     if (this.personalInfoDetail.phoneNumber == "" || this.personalInfoDetail.phoneNumber == null) {
  701.       valid = false
  702.     }
  703.     if (!this.validEmail.test(this.personalInfoDetail.email)) {
  704.       valid = false
  705.     }
  706.     if (!this.numberOnly.test(this.personalInfoDetail.ktpNo)) {
  707.       valid = false
  708.     }
  709.     if (!this.validKtp.test(this.personalInfoDetail.ktpNo)) {
  710.       valid = false
  711.     }
  712.     if (this.personalInfoDetail.ktpNo.length != 16) {
  713.       valid = false
  714.     }
  715.     if (this.personalInfoDetail.phoneNumber != null && this.personalInfoDetail.phoneNumber != "") {
  716.       if (!this.validPhone.test(this.personalInfoDetail.phoneNumber)) {
  717.         valid = false
  718.       }
  719.       if (this.personalInfoDetail.phoneNumber.length < 10) {
  720.         valid = false
  721.       }
  722.     }
  723.     if (this.personalInfoDetail.dateOfBirth != null) {
  724.       let umur = moment(this.personalInfoDetail.dateOfBirth).diff(new Date(), "years") * -1;
  725.       console.log("umur :" + umur)
  726.       if (umur >= this.maxAge() || umur < this.minAge()) {
  727.         //console.log(this.maxAge()+"<= umur <"+this.minAge())
  728.         valid = false
  729.       }
  730.     }
  731.     if (this.placementCityValidationMsg() != "") {
  732.       valid = false
  733.     }
  734.     if (this.placementProvinceValidationMsg() != "") {
  735.       valid = false
  736.     }
  737.     if (this.placementCityCode == "" || this.placementCityCode == null) {
  738.       valid = false
  739.     }
  740.     if (this.placementProvinceCode == "" || this.placementProvinceCode == null) {
  741.       valid = false
  742.     }
  743.     if (this.vaccineShow() && this.vaccineRequired()) {
  744.  
  745.       if (this.personalInfoDetail.vaccineStatus == null) {
  746.  
  747.         valid = false
  748.       } else {
  749.         if (this.personalInfoDetail.vaccineStatus == 0) {
  750.           if (this.personalInfoDetail.vaccineConsent == null) {
  751.  
  752.             valid = false
  753.           }
  754.         }
  755.       }
  756.     }
  757.     return valid
  758.   }
  759.   validateFamily() {
  760.     let valid = true
  761.     if (this.familyList.length == 0) {
  762.       valid = true
  763.     } else {
  764.       this.familyList.forEach((val, idx) => {
  765.         if (val.relationship == "" || val.relationship == null) {
  766.           valid = false
  767.         }
  768.         if (val.name == "" || val.name == null) {
  769.           valid = false
  770.         }
  771.         if (val.relationship != "" && val.relationship != null) {
  772.           if (val.relationship == "Wife" || val.relationship == "Child" || val.relationship == "Husband") {
  773.             if (val.dateOfBirth == null) {
  774.               valid = false
  775.             }
  776.           }
  777.         }
  778.  
  779.         if (val.gender == "" || val.gender == null) {
  780.           valid = false
  781.         }
  782.         if (val.lastEducation == "" || val.lastEducation == null) {
  783.           valid = false
  784.         }
  785.       })
  786.     }
  787.     if (this.personalInfoDetail.kkNo != null) {
  788.       if (this.personalInfoDetail.kkNo.length < 16) {
  789.         valid = false
  790.       }
  791.     }
  792.     if (this.personalInfoDetail.maritalStatus == null || this.personalInfoDetail.maritalStatus == "") {
  793.       valid = false
  794.     }
  795.     return valid
  796.   }
  797.   validateDocument() {
  798.     let valid = true
  799.     if (this.simShow() && this.simRequired()) {
  800.       if (this.documentDetail.simNo == "" || this.documentDetail.simNo == null) {
  801.         valid = false
  802.       }
  803.       if (this.documentDetail.simType == "" || this.documentDetail.simType == null) {
  804.         valid = false
  805.       }
  806.       if (this.documentDetail.simExpiredDate == "" || this.documentDetail.simExpiredDate == null) {
  807.         valid = false
  808.       }
  809.       if (this.documentDetail.simNo != "" && this.documentDetail.simNo != null) {
  810.         if (this.documentDetail.simNo.length < 12 || this.documentDetail.simNo.length > 17) {
  811.           valid = false
  812.         }
  813.       }
  814.       if (this.simExpirationThreshold() != null) {
  815.         if (this.documentDetail.simExpiredDate != "" && this.documentDetail.simExpiredDate != null) {
  816.           if (moment(this.documentDetail.simExpiredDate).diff(new Date(), "months") < this.simExpirationThreshold()) {
  817.             valid = false
  818.           }
  819.         } else {
  820.           valid = false
  821.         }
  822.       }
  823.     }
  824.     if (this.stnkShow() && this.stnkRequired()) {
  825.       if (this.documentDetail.stnkExpiredDate == "" || this.documentDetail.stnkExpiredDate == null) {
  826.         valid = false
  827.       }
  828.       if (this.documentDetail.stnkPlatNoDate == "" || this.documentDetail.stnkPlatNoDate == null) {
  829.         valid = false
  830.       }
  831.       if (this.documentDetail.licensePlate == "" || this.documentDetail.licensePlate == null) {
  832.         valid = false
  833.       }
  834.       if (this.stnkExpirationThreshold() != null) {
  835.         if (this.documentDetail.stnkExpiredDate != "" && this.documentDetail.stnkExpiredDate != null) {
  836.           if (moment(this.documentDetail.stnkExpiredDate).diff(new Date(), "months") < this.stnkExpirationThreshold()) {
  837.             valid = false
  838.           }
  839.         } else {
  840.           valid = false
  841.         }
  842.         if (this.documentDetail.stnkPlatNoDate != "" && this.documentDetail.stnkPlatNoDate != null) {
  843.           if (moment(this.documentDetail.stnkPlatNoDate).diff(new Date(), "months") < this.stnkExpirationThreshold()) {
  844.             valid = false
  845.           }
  846.         } else {
  847.           valid = false
  848.         }
  849.       }
  850.     }
  851.     //if (this.isSatria()) {
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.     //}
  860.     if (this.selectedOptionBpjs == null || this.selectedOptionJamsostek == null) {
  861.       valid = false
  862.  
  863.     }
  864.     if (this.selectedOptionBpjs == "YA") {
  865.       if (this.documentDetail.bpjsNo == "" || this.documentDetail.bpjsNo == null) {
  866.         valid = false
  867.       }
  868.     }
  869.     if (this.selectedOptionJamsostek == "YA") {
  870.       if (this.documentDetail.jamsostekNo == "" || this.documentDetail.jamsostekNo == null) {
  871.         valid = false
  872.       }
  873.     }
  874.     if (this.documentDetail.bankAccountName == "" || this.documentDetail.bankAccountName == null) {
  875.       valid = false
  876.     }
  877.     if (this.documentDetail.bankAccountNo == "" || this.documentDetail.bankAccountNo == null) {
  878.       valid = false
  879.     }
  880.     if (this.documentDetail.bankName == "" || this.documentDetail.bankName == null) {
  881.       valid = false
  882.     }
  883.     if (this.documentDetail.bankAccountNo) {
  884.       if (this.documentDetail.bankAccountNo.length < this.bankMinValue()) {
  885.         valid = false
  886.       }
  887.     }
  888.  
  889.     return valid
  890.   }
  891.   validateSatriaAge(date: Date) {
  892.     return moment().diff(date, "years")
  893.   }
  894.   validateEducation() {
  895.  
  896.     let valid = true
  897.     if (this.personalInfoDetail.lastEducation == null || this.personalInfoDetail.lastEducation == "") {
  898.       valid = false
  899.     }
  900.     if (this.educationList.length == 0) {
  901.       valid = false
  902.     } else {
  903.       this.educationList.forEach((val, idx) => {
  904.         if (val.institution == "" || val.institution == null) {
  905.           valid = false
  906.         }
  907.         if (val.major == "" || val.major == null) {
  908.           valid = false
  909.         }
  910.         if (val.yearIn == "" || val.yearIn == null) {
  911.           valid = false
  912.         }
  913.         if (val.yearOut == "" || val.yearOut == null) {
  914.           valid = false
  915.         }
  916.       })
  917.     }
  918.     //valid=this.validateLanguageSkill()
  919.     return valid
  920.  
  921.   }
  922.   validateInformalEducation() {
  923.  
  924.     let valid = true
  925.     if (this.informalEducationList.length == 0) {
  926.       valid = true
  927.     } else {
  928.       this.informalEducationList.forEach((val, idx) => {
  929.         if (val.trainingName == "" || val.trainingName == null) {
  930.           valid = false
  931.         }
  932.         if (val.trainingDate == "" || val.trainingDate == null) {
  933.           valid = false
  934.         }
  935.       })
  936.     }
  937.     return valid
  938.  
  939.   }
  940.   validateLanguageSkill() {
  941.  
  942.     let valid = true
  943.     if (this.languageSkillList.length == 0) {
  944.       valid = true
  945.     } else {
  946.       this.languageSkillList.forEach((val, idx) => {
  947.         if (val.language == "" || val.language == null) {
  948.           valid = false
  949.         }
  950.         if (val.writingSkill == "" || val.writingSkill == null) {
  951.           valid = false
  952.         }
  953.         if (val.readingSkill == "" || val.readingSkill == null) {
  954.           valid = false
  955.         }
  956.         if (val.listeningSkill == "" || val.listeningSkill == null) {
  957.           valid = false
  958.         }
  959.         if (val.conversationalSkill == "" || val.conversationalSkill == null) {
  960.           valid = false
  961.         }
  962.       })
  963.     }
  964.     return valid
  965.  
  966.   }
  967.   validateWorkExperience() {
  968.  
  969.     let valid = true
  970.     if (this.workExperienceList.length == 0) {
  971.       valid = true
  972.     } else {
  973.       this.workExperienceList.forEach((val, idx) => {
  974.         if (val.companyName == "" || val.companyName == null) {
  975.           valid = false
  976.         }
  977.         // if (val.yearIn==""||val.yearIn==null){
  978.         //   valid=false
  979.         // }
  980.         if (val.position == "" || val.position == null) {
  981.           valid = false
  982.         }
  983.       })
  984.     }
  985.     return valid
  986.  
  987.   }
  988.   validateEmergencyContact() {
  989.  
  990.     let valid = true
  991.     if (this.emergencyContactList.length == 0) {
  992.       valid = false
  993.     } else {
  994.       this.emergencyContactList.forEach((val, idx) => {
  995.         if (val.emergencyContactName == "" || val.emergencyContactName == null) {
  996.           valid = false
  997.         }
  998.         if (val.relationship == "" || val.relationship == null) {
  999.           valid = false
  1000.         }
  1001.         if (val.phoneNumber == "" || val.phoneNumber == null) {
  1002.           valid = false
  1003.         }
  1004.         if (val.phoneNumber != "" && val.phoneNumber != null) {
  1005.           if (!this.validPhone.test(val.phoneNumber)) {
  1006.             valid = false
  1007.           }
  1008.           if (val.phoneNumber.length < 10) {
  1009.             valid = false
  1010.           }
  1011.         }
  1012.  
  1013.  
  1014.  
  1015.       })
  1016.     }
  1017.     return valid
  1018.  
  1019.   }
  1020.   validateBerkas() {
  1021.  
  1022.     let valid = true;
  1023.  
  1024.     if (!this.ktpStatus && !this.hasFileName.KTP) {
  1025.       valid = false
  1026.     }
  1027.     if (!this.kkStatus && !this.hasFileName.KK) {
  1028.       valid = false
  1029.     }
  1030.     // if (!this.cvStatus && !this.hasFileName.CV) {
  1031.     //   valid = false
  1032.     // }
  1033.     if (!this.ijazahStatus && !this.hasFileName.Ijazah) {
  1034.       valid = false
  1035.     }
  1036.     if (!this.tabunganStatus && !this.hasFileName.Tabungan) {
  1037.       valid = false
  1038.     }
  1039.     if (this.personalInfoDetail.vaccineStatus == 2) {
  1040.       if (!this.vaccineStatus && !this.hasFileName.Vaccine) {
  1041.         valid = false
  1042.       }
  1043.     }
  1044.     if (this.simShow() && this.simRequired()) {
  1045.       if (!this.simStatus && !this.hasFileName.SIM) {
  1046.         valid = false
  1047.       }
  1048.  
  1049.     }
  1050.     if (this.stnkShow() && this.stnkRequired()) {
  1051.       if (!this.stnkStatus && !this.hasFileName.STNK) {
  1052.         valid = false
  1053.       }
  1054.       if (!this.stnkBackStatus && !this.hasFileName.STNKBACK) {
  1055.         valid = false
  1056.       }
  1057.     }
  1058.  
  1059.     return valid
  1060.   }
  1061.  
  1062.   //Vacancies Config
  1063.  
  1064.   maxAge(): number {
  1065.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "dateOfBirth" && element.rule == "MAX_AGE")
  1066.     if (config == null) {
  1067.       return 9999
  1068.     }
  1069.     return parseInt(config.value)
  1070.   }
  1071.  
  1072.   minAge(): number {
  1073.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "dateOfBirth" && element.rule == "MIN_AGE")
  1074.     if (config == null) {
  1075.       return 0
  1076.     }
  1077.     return parseInt(config.value)
  1078.   }
  1079.  
  1080.   stnkShow(): boolean {
  1081.  
  1082.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "stnk" && element.rule == "SHOW")
  1083.     if (config == null) {
  1084.       return false
  1085.     }
  1086.     return config.value == "1" ? true : false
  1087.   }
  1088.  
  1089.   simShow(): boolean {
  1090.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "sim" && element.rule == "SHOW")
  1091.     if (config == null) {
  1092.       return false
  1093.     }
  1094.     return config.value == "1" ? true : false
  1095.   }
  1096.  
  1097.   vaccineShow(): boolean {
  1098.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "vaccine" && element.rule == "SHOW")
  1099.     if (config == null) {
  1100.       return false
  1101.     }
  1102.     return config.value == "1" ? true : false
  1103.   }
  1104.  
  1105.   stnkRequired(): boolean {
  1106.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "stnk" && element.rule == "REQUIRED")
  1107.     if (config == null) {
  1108.       return false
  1109.     }
  1110.     if (!this.stnkShow()) {
  1111.       return false
  1112.     }
  1113.     return config.value == "1" ? true : false
  1114.  
  1115.   }
  1116.  
  1117.   simRequired(): boolean {
  1118.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "sim" && element.rule == "REQUIRED")
  1119.     if (config == null) {
  1120.       return false
  1121.     }
  1122.     if (!this.simShow()) {
  1123.       return false
  1124.     }
  1125.     return config.value == "1" ? true : false
  1126.   }
  1127.  
  1128.   vaccineRequired(): boolean {
  1129.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "vaccine" && element.rule == "REQUIRED")
  1130.     if (config == null) {
  1131.       return false
  1132.     }
  1133.     if (!this.vaccineShow()) {
  1134.       return false
  1135.     }
  1136.     return config.value == "1" ? true : false
  1137.  
  1138.   }
  1139.  
  1140.   simType(): string {
  1141.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "simType" && element.rule == "VALUE")
  1142.     if (config == null) {
  1143.       return ""
  1144.     }
  1145.     if (!this.simShow()) {
  1146.       return ""
  1147.     }
  1148.     return config.value
  1149.  
  1150.   }
  1151.  
  1152.   simExpirationThreshold(): number {
  1153.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "sim" && element.rule == "MIN_ACTIVE")
  1154.     if (config == null) {
  1155.       return null
  1156.     }
  1157.     if (!this.simShow()) {
  1158.       return null
  1159.     }
  1160.     parseInt(config.value)
  1161.   }
  1162.  
  1163.   stnkExpirationThreshold(): number {
  1164.     let config: AvailableVacanciesConfig = this.availableVacanciesConfig.find(element => element.field == "stnk" && element.rule == "MIN_ACTIVE")
  1165.     if (config == null) {
  1166.       return null
  1167.     }
  1168.     if (!this.stnkShow()) {
  1169.       return null
  1170.     }
  1171.     return parseInt(config.value)
  1172.   }
  1173.  
  1174.   replace(fileName, key) {
  1175.     fileName[key] = '';
  1176.   }
  1177.  
  1178.   bankMinValue() {
  1179.     let selectedBank = this.bankDetail.findIndex(elem => elem.bankName == this.documentDetail.bankName)
  1180.     if (selectedBank >= 0) {
  1181.       return this.bankDetail[selectedBank].minLength
  1182.     } else {
  1183.       return 4
  1184.     }
  1185.   }
  1186.   bankMaxValue() {
  1187.     let selectedBank = this.bankDetail.findIndex(elem => elem.bankName == this.documentDetail.bankName)
  1188.     if (selectedBank >= 0) {
  1189.       return this.bankDetail[selectedBank].maxLength
  1190.     } else {
  1191.       return 20
  1192.     }
  1193.   }
  1194.  
  1195.   maritalStatusChange(maritalStatus: string) {
  1196.     console.log(maritalStatus)
  1197.     this.familyList = this.familyList.filter(el => el.relationship.toUpperCase() != "WIFE" && el.relationship.toUpperCase() != "HUSBAND")
  1198.     if (maritalStatus.toUpperCase() == "MENIKAH" && this.personalInfoDetail.sex == "M") {
  1199.       let istri = new Family
  1200.       istri.relationship = "Wife"
  1201.       istri.gender = "F"
  1202.       this.familyList.push(istri)
  1203.     }
  1204.     if (maritalStatus.toUpperCase() == "MENIKAH" && this.personalInfoDetail.sex == "F") {
  1205.       let suami = new Family
  1206.       suami.gender = "M"
  1207.       suami.relationship = "Husband"
  1208.       this.familyList.push(suami)
  1209.     }
  1210.     this.checkPTKP(this.personalInfoDetail.maritalStatus, this.numberOfChild);
  1211.   }
  1212.   numberOfSiblingChange(nSiblings: number) {
  1213.     console.log(nSiblings)
  1214.     this.familyList = this.familyList.filter(el => el.relationship.toUpperCase() != "OLDER SIBLING" && el.relationship.toUpperCase() != "SIBLING")
  1215.  
  1216.     for (let i = 0; i < nSiblings; i++) {
  1217.       let sibling = new Family
  1218.       sibling.relationship = "Sibling"
  1219.       this.familyList.push(sibling)
  1220.     }
  1221.   }
  1222.  
  1223.   numberOfChildChange(nChilds: number) {
  1224.     console.log(nChilds)
  1225.     this.familyList = this.familyList.filter(el => el.relationship.toUpperCase() != "CHILD" && el.relationship.toUpperCase() != "FOSTER CHILD")
  1226.  
  1227.     for (let i = 0; i < nChilds; i++) {
  1228.       let child = new Family
  1229.       child.relationship = "Child"
  1230.       this.familyList.push(child)
  1231.     }
  1232.     this.checkPTKP(this.personalInfoDetail.maritalStatus, this.numberOfChild);
  1233.   }
  1234.   checkPTKP(marriageStatus: string, numChild: number) {
  1235.     if (!marriageStatus && !numChild) return;
  1236.     let status = '';
  1237.  
  1238.     if (marriageStatus.toUpperCase() == 'MENIKAH') status += 'K';
  1239.     else status += 'TK';
  1240.  
  1241.     if (numChild > 2) status += '3';
  1242.     else status += numChild;
  1243.  
  1244.     this.personalInfoDetail.ptkp = status;
  1245.   }
  1246.  
  1247.   checkApplicantIdByNIK() {
  1248.     if (this.personalInfoDetail.ktpNo.length >= 16) {
  1249.       console.log("hit")
  1250.       this.services.findPersonalDataByNik(this.personalInfoDetail.ktpNo).subscribe(
  1251.         result => {
  1252.           if (!result.data) {
  1253.             let obj = {
  1254.               candidatesId: result.candidatesId,
  1255.               appliedPosition: result.appliedPosition,
  1256.               applyingPosition: this.title,
  1257.               vacancyId: this.vacancyId
  1258.             }
  1259.             this.reRegisterDialog(obj);
  1260.             console.log(result)
  1261.           }
  1262.         }, err => {
  1263.           if (err != "Data not found") {
  1264.             this.openSnackBarV2(err, "close")
  1265.           }
  1266.  
  1267.           console.log(err)
  1268.         }
  1269.       )
  1270.     }
  1271.  
  1272.   }
  1273.  
  1274.   reRegisterDialog(obj) {
  1275.     let dialogRef = this.dialog.open(this.applyConfirmationDialogComponent, {
  1276.       width: '70vw',
  1277.       data: obj
  1278.     });
  1279.  
  1280.     dialogRef.componentInstance.data.subscribe(result => {
  1281.       if (result == "yes") {
  1282.         this.showSpinner();
  1283.         this.services.reRegisterApplicant(obj.candidatesId, obj.vacancyId).subscribe(result => {
  1284.           this.hideSpinner()
  1285.           this.openSnackBarV2("Registrasi kembali berhasil", "close")
  1286.           this.dialog.closeAll()
  1287.         }, err => {
  1288.           this.hideSpinner()
  1289.           this.openSnackBar(err, "close")
  1290.           this.dialog.closeAll()
  1291.         })
  1292.       } else {
  1293.         this.dialog.closeAll()
  1294.       }
  1295.     })
  1296.   }
  1297.  
  1298.  
  1299.   public handleFileKK(files: FileList) {
  1300.     setTimeout(() => {
  1301.       if (files[0]) {
  1302.         let ext = files[0].name.split('.').pop()
  1303.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1304.           if ((files[0].size / 1024) > 2000) {
  1305.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1306.           } else {
  1307.             this.kk = files[0];
  1308.             this.kkFilename = files[0].name;
  1309.             this.kkStatus = true
  1310.           }
  1311.         } else {
  1312.           this.openSnackBar('File harus JPG/PDF', 'close')
  1313.  
  1314.         }
  1315.       }
  1316.  
  1317.  
  1318.     })
  1319.  
  1320.   }
  1321.   public handleFileKTP(files: FileList) {
  1322.     setTimeout(() => {
  1323.       if (files[0]) {
  1324.         let ext = files[0].name.split('.').pop()
  1325.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1326.           if ((files[0].size / 1024) > 2000) {
  1327.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1328.           } else {
  1329.             this.ktp = files[0];
  1330.             this.ktpFilename = files[0].name;
  1331.             this.ktpStatus = true
  1332.           }
  1333.         } else {
  1334.           this.openSnackBar('File harus JPG/PDF', 'close')
  1335.         }
  1336.       }
  1337.  
  1338.  
  1339.     })
  1340.  
  1341.   }
  1342.   public handleFileIjazah(files: FileList) {
  1343.     setTimeout(() => {
  1344.  
  1345.       if (files[0]) {
  1346.         let ext = files[0].name.split('.').pop()
  1347.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1348.           if ((files[0].size / 1024) > 2000) {
  1349.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1350.           } else {
  1351.             this.ijazah = files[0];
  1352.             this.ijazahFilename = files[0].name
  1353.             this.ijazahStatus = true
  1354.           }
  1355.         } else {
  1356.           this.openSnackBar('File harus JPG/PDF', 'close')
  1357.         }
  1358.       }
  1359.  
  1360.  
  1361.     })
  1362.  
  1363.   }
  1364.   public handleFileCV(files: FileList) {
  1365.     setTimeout(() => {
  1366.  
  1367.       if (files[0]) {
  1368.         let ext = files[0].name.split('.').pop()
  1369.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1370.           if ((files[0].size / 1024) > 2000) {
  1371.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1372.           } else {
  1373.             this.cv = files[0];
  1374.             this.cvFilename = files[0].name;
  1375.             this.cvStatus = true
  1376.           }
  1377.         } else {
  1378.           this.openSnackBar('File harus JPG/PDF', 'close')
  1379.         }
  1380.       }
  1381.  
  1382.     })
  1383.  
  1384.   }
  1385.   public handleFileSIM(files: FileList) {
  1386.     setTimeout(() => {
  1387.  
  1388.       if (files[0]) {
  1389.         let ext = files[0].name.split('.').pop()
  1390.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1391.           if ((files[0].size / 1024) > 2000) {
  1392.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1393.           } else {
  1394.             this.sim = files[0];
  1395.             this.simFilename = files[0].name;
  1396.             this.simStatus = true
  1397.           }
  1398.         } else {
  1399.           this.openSnackBar('File harus JPG/PDF', 'close')
  1400.         }
  1401.       }
  1402.  
  1403.  
  1404.     })
  1405.  
  1406.   }
  1407.   public handleFileSTNK(files: FileList) {
  1408.     setTimeout(() => {
  1409.  
  1410.  
  1411.       if (files[0]) {
  1412.         let ext = files[0].name.split('.').pop()
  1413.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1414.           if ((files[0].size / 1024) > 2000) {
  1415.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1416.           } else {
  1417.             this.stnk = files[0];
  1418.             this.stnkFilename = files[0].name;
  1419.             this.stnkStatus = true
  1420.           }
  1421.         } else {
  1422.           this.openSnackBar('File harus JPG/PDF', 'close')
  1423.         }
  1424.       }
  1425.  
  1426.     })
  1427.  
  1428.   }
  1429.  
  1430.   public handleFileSTNKBack(files: FileList) {
  1431.     setTimeout(() => {
  1432.  
  1433.  
  1434.       if (files[0]) {
  1435.         let ext = files[0].name.split('.').pop()
  1436.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1437.           if ((files[0].size / 1024) > 2000) {
  1438.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1439.           } else {
  1440.             this.stnkBack = files[0];
  1441.             this.stnkBackFilename = files[0].name;
  1442.             this.stnkBackStatus = true
  1443.           }
  1444.         } else {
  1445.           this.openSnackBar('File harus JPG/PDF', 'close')
  1446.         }
  1447.       }
  1448.  
  1449.     })
  1450.  
  1451.   }
  1452.  
  1453.   public handleFileTabungan(files: FileList) {
  1454.     setTimeout(() => {
  1455.       if (files[0]) {
  1456.         let ext = files[0].name.split('.').pop()
  1457.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1458.           if ((files[0].size / 1024) > 2000) {
  1459.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1460.           } else {
  1461.             this.tabungan = files[0];
  1462.             this.tabunganFilename = files[0].name;
  1463.             this.tabunganStatus = true
  1464.           }
  1465.         } else {
  1466.           this.openSnackBar('File harus JPG/PDF', 'close')
  1467.         }
  1468.       }
  1469.  
  1470.     })
  1471.  
  1472.   }
  1473.  
  1474.   public handleFileVaccine(files: FileList) {
  1475.     setTimeout(() => {
  1476.       if (files[0]) {
  1477.         let ext = files[0].name.split('.').pop()
  1478.         if (this.allowedFile.includes(ext.toUpperCase())) {
  1479.           if ((files[0].size / 1024) > 2000) {
  1480.             this.openSnackBar('File berkas tidak boleh lebih dari 2 MB', 'close')
  1481.           } else {
  1482.             this.vaccine = files[0];
  1483.             this.vaccineFilename = files[0].name;
  1484.             this.vaccineStatus = true
  1485.           }
  1486.         } else {
  1487.           this.openSnackBar('File harus JPG/PDF', 'close')
  1488.         }
  1489.       }
  1490.  
  1491.     })
  1492.  
  1493.   }
  1494.  
  1495.   nextStep(stepTo: number) {
  1496.     if (this.isPsikotestStart() || this.isEpkwtForm()) {
  1497.       if (stepTo == 1) {
  1498.         this.submitPersonalInfo(stepTo)
  1499.       }
  1500.       if (stepTo == 2) {
  1501.         this.submitDocumentInfo(stepTo)
  1502.       }
  1503.       if (stepTo == 3) {
  1504.         this.submitFamily(stepTo)
  1505.       }
  1506.       if (stepTo == 4) {
  1507.         this.submitEducation(stepTo)
  1508.       }
  1509.       if (stepTo == 5) {
  1510.         this.submitWorkExperience(stepTo)
  1511.       }
  1512.       if (stepTo == 6) {
  1513.         this.submitAttachment(stepTo)
  1514.       }
  1515.     } else {
  1516.       this.step = stepTo
  1517.       this.topPage.nativeElement.scrollIntoView({ behavior: 'smooth' });
  1518.     }
  1519.  
  1520.   }
  1521.   prevStep() {
  1522.     this.step--
  1523.     this.topPage.nativeElement.scrollIntoView({ behavior: 'smooth' });
  1524.   }
  1525.  
  1526.   translateFamilyRelation(relation) {
  1527.     switch (relation) {
  1528.       case 'Father':
  1529.         return 'Ayah Kandung'
  1530.         break;
  1531.       case 'Mother':
  1532.         return 'Ibu Kandung'
  1533.         break;
  1534.       case 'Wife':
  1535.         return 'Istri'
  1536.         break;
  1537.       case 'Husband':
  1538.         return 'Suami'
  1539.         break;
  1540.       case 'Child':
  1541.         return 'Anak'
  1542.         break;
  1543.     }
  1544.   }
  1545.   familyRelationOption(relation) {
  1546.     if (relation == "Father") {
  1547.       return true
  1548.     } else if (relation == "Mother") {
  1549.       return true
  1550.     }
  1551.     else if (relation == "Sibling") {
  1552.       return true
  1553.     } else if (relation == "Husband") {
  1554.       if (this.personalInfoDetail.maritalStatus == "Menikah" && this.personalInfoDetail.sex == "F") {
  1555.         return true
  1556.       } else {
  1557.         return false
  1558.       }
  1559.  
  1560.     } else if (relation == "Wife") {
  1561.       if (this.personalInfoDetail.maritalStatus == "Menikah" && this.personalInfoDetail.sex == "M") {
  1562.         return true
  1563.       } else {
  1564.         return false
  1565.       }
  1566.     } else if (relation == "Child") {
  1567.       if (this.personalInfoDetail.maritalStatus == "Menikah" || this.personalInfoDetail.maritalStatus == "Janda" || this.personalInfoDetail.maritalStatus == "Duda") {
  1568.         return true
  1569.       } else {
  1570.         return false
  1571.       }
  1572.     } else if (relation == "Foster Child") {
  1573.       if (this.personalInfoDetail.maritalStatus == "Menikah" || this.personalInfoDetail.maritalStatus == "Janda" || this.personalInfoDetail.maritalStatus == "Duda") {
  1574.         return true
  1575.       } else {
  1576.         return false
  1577.       }
  1578.     } else {
  1579.       return false
  1580.     }
  1581.   }
  1582.   familyDeleteFormValidation() {
  1583.     if (this.familyList.length == 1) {
  1584.       if (this.personalInfoDetail.maritalStatus == "Menikah") {
  1585.         return false
  1586.       } else {
  1587.         return true
  1588.       }
  1589.     } else {
  1590.       return true
  1591.     }
  1592.   }
  1593.   lastFormElement(data: Array<any>, index: number) {
  1594.     if (data.length == index + 1) {
  1595.       return true
  1596.     } else if (data.length < 1) {
  1597.       return true
  1598.     } else {
  1599.       return false
  1600.     }
  1601.   }
  1602.   addNewEmergencyContact() {
  1603.     this.emergencyContactList.push(new EmergencyContact)
  1604.   }
  1605.   deleteEmergencyContact(idx) {
  1606.     this.emergencyContactList.splice(idx, 1)
  1607.   }
  1608.   addNewEducation() {
  1609.     this.educationList.push(new Education)
  1610.   }
  1611.   deleteEducation(idx) {
  1612.     this.educationList.splice(idx, 1)
  1613.   }
  1614.   addNewInformalEducation() {
  1615.     this.informalEducationList.push(new InformalEducation)
  1616.   }
  1617.   deleteInformalEducation(idx) {
  1618.     this.informalEducationList.splice(idx, 1)
  1619.   }
  1620.   addNewLanguageSkill() {
  1621.     this.languageSkillList.push(new LanguageSkill)
  1622.   }
  1623.   deleteLanguageSkill(idx) {
  1624.     this.languageSkillList.splice(idx, 1)
  1625.   }
  1626.   addNewFamily() {
  1627.     this.familyList.push(new Family)
  1628.   }
  1629.   deleteFamily(idx) {
  1630.     this.familyList.splice(idx, 1)
  1631.   }
  1632.   addNewWorkExperience() {
  1633.     if (this.workExperienceList.length < 3) {
  1634.       this.workExperienceList.push(new WorkExperience)
  1635.     } else {
  1636.       this.openSnackBar('Maksimal 3 Pengalaman Kerja', 'close');
  1637.     }
  1638.  
  1639.   }
  1640.   deleteWorkExperience(idx) {
  1641.     this.workExperienceList.splice(idx, 1)
  1642.   }
  1643.  
  1644.  
  1645.  
  1646.  
  1647.   getAllData() {
  1648.     if (!(this.isPsikotestStart() || this.isEpkwtForm())) {
  1649.       this.showSpinner();
  1650.       this.loadPersonalData = true
  1651.       this.checkLoadingState()
  1652.       this.getPersonalDataByNIK().then((res) => {
  1653.         this.loadPersonalData = false
  1654.         this.loadDocument = true
  1655.         this.loadEducation = true
  1656.         this.loadFamily = true
  1657.         this.loadInformalEducation = true
  1658.         this.loadEmergencyContact = true
  1659.         this.loadWorkExperience = true
  1660.         //this.loadLanguageSkill=true
  1661.  
  1662.         this.checkCandidateUploadedFiles();
  1663.  
  1664.         this.getDocumentByCandidateId().then((res) => {
  1665.           this.loadDocument = false
  1666.           this.checkLoadingState()
  1667.         }).catch(err => {
  1668.           this.loadDocument = false
  1669.           this.checkLoadingState()
  1670.         })
  1671.         this.getFamilyByCandidateId().then((res) => {
  1672.           this.loadFamily = false
  1673.           this.checkLoadingState()
  1674.         }).catch(err => {
  1675.           this.loadFamily = false
  1676.           this.checkLoadingState()
  1677.         })
  1678.         this.getEducationByCandidateId().then((res) => {
  1679.           this.loadEducation = false
  1680.           this.checkLoadingState()
  1681.         }).catch(err => {
  1682.           this.loadEducation = false
  1683.           this.checkLoadingState()
  1684.         })
  1685.         this.getInformalEducationByCandidateId().then((res) => {
  1686.           this.loadInformalEducation = false
  1687.           this.checkLoadingState()
  1688.         }).catch(err => {
  1689.           this.loadInformalEducation = false
  1690.           this.checkLoadingState()
  1691.         })
  1692.         this.getWorkExperienceByCandidateId().then((res) => {
  1693.           this.loadWorkExperience = false
  1694.           this.checkLoadingState()
  1695.         }).catch(err => {
  1696.           this.loadWorkExperience = false
  1697.           this.checkLoadingState()
  1698.         })
  1699.         // this.getLanguageByCandidateId().then((res)=>{
  1700.         //   this.loadLanguageSkill=false
  1701.         //   this.checkLoadingState()
  1702.         // }).catch(err=>{
  1703.         //   this.loadLanguageSkill=false
  1704.         //   this.checkLoadingState()
  1705.         // })
  1706.         this.getEmergencyContactByCandidateId().then((res) => {
  1707.           this.loadEmergencyContact = false
  1708.           this.checkLoadingState()
  1709.         }).catch(err => {
  1710.           this.loadEmergencyContact = false
  1711.           this.checkLoadingState()
  1712.         })
  1713.       }).catch(err => {
  1714.         console.log(err)
  1715.         this.loadPersonalData = false
  1716.         this.checkLoadingState()
  1717.       })
  1718.     }
  1719.   }
  1720.  
  1721.   getAllDataPsikotest() {
  1722.     this.showSpinner();
  1723.     this.loadPersonalData = true
  1724.     this.checkLoadingState();
  1725.     this.getPersonalDataById().then((res) => {
  1726.       this.loadPersonalData = false
  1727.       this.loadDocument = true
  1728.       this.loadEducation = true
  1729.       this.loadFamily = true
  1730.       this.loadInformalEducation = true
  1731.       this.loadEmergencyContact = true
  1732.       this.loadWorkExperience = true
  1733.       //this.loadLanguageSkill=true
  1734.  
  1735.       this.checkCandidateUploadedFiles();
  1736.  
  1737.       this.getDocumentByCandidateId().then((res) => {
  1738.         this.loadDocument = false
  1739.         this.checkLoadingState();
  1740.  
  1741.       }).catch(err => {
  1742.         this.loadDocument = false
  1743.         this.checkLoadingState()
  1744.       })
  1745.       this.getFamilyByCandidateId().then((res) => {
  1746.         this.loadFamily = false
  1747.         this.checkLoadingState()
  1748.       }).catch(err => {
  1749.         this.loadFamily = false
  1750.         this.checkLoadingState()
  1751.       })
  1752.       this.getEducationByCandidateId().then((res) => {
  1753.         this.loadEducation = false
  1754.         this.checkLoadingState()
  1755.       }).catch(err => {
  1756.         this.loadEducation = false
  1757.         this.checkLoadingState()
  1758.       })
  1759.       this.getInformalEducationByCandidateId().then((res) => {
  1760.         this.loadInformalEducation = false
  1761.         this.checkLoadingState()
  1762.       }).catch(err => {
  1763.         this.loadInformalEducation = false
  1764.         this.checkLoadingState()
  1765.       })
  1766.       this.getWorkExperienceByCandidateId().then((res) => {
  1767.         this.loadWorkExperience = false
  1768.         this.checkLoadingState()
  1769.       }).catch(err => {
  1770.         this.loadWorkExperience = false
  1771.         this.checkLoadingState()
  1772.       })
  1773.       this.getEmergencyContactByCandidateId().then((res) => {
  1774.         this.loadEmergencyContact = false
  1775.         this.checkLoadingState()
  1776.       }).catch(err => {
  1777.         this.loadEmergencyContact = false
  1778.         this.checkLoadingState()
  1779.       })
  1780.     }).catch(err => {
  1781.       console.log(err)
  1782.       this.loadPersonalData = false
  1783.       this.checkLoadingState()
  1784.     })
  1785.  
  1786.   }
  1787.  
  1788.  
  1789.  
  1790.   getPersonalDataByNIK() {
  1791.     return new Promise((resolve, reject) => {
  1792.       this.services.findPersonalDataByNik(this.personalInfoDetail.ktpNo).subscribe(
  1793.         result => {
  1794.           if (!result.data) {
  1795.             console.log(result)
  1796.             this.candidatesId = result.candidatesId
  1797.             delete result.candidatesDocument
  1798.             delete result.oneCandidatesDocument
  1799.             this.personalInfoDetail = result
  1800.             this.position = this.title;
  1801.             this.personalInfoDetail.appliedPosition = this.title;
  1802.             this.personalInfoDetail.level = this.title;
  1803.             this.placementProvince = result.placementProvince != '0' ? result.placementProvince : null;
  1804.             this.provinceControl.setValue(this.placementProvince);
  1805.             this.placementProvinceCode = result.placementProvinceCode != '0' ? result.placementProvinceCode : null;
  1806.             this.placementCity = result.placementCity != '0' ? result.placementCity : null;
  1807.             this.cityControl.setValue(this.placementCity);
  1808.             this.placementCityCode = result.placementCityCode != '0' ? result.placementCityCode : null;
  1809.             if (this.title.toUpperCase() == "SATMOB" || this.position.toUpperCase() == "SATMOB") {
  1810.               this.simOption = [
  1811.                 "SIM A",
  1812.                 "SIM B1"
  1813.               ];
  1814.             }
  1815.             //delete this.personalInfoDetail.oneCandidate
  1816.             console.log("Data candidate")
  1817.             console.log(this.personalInfoDetail)
  1818.             // this.personalInfoDetail.candidatesId=result.candidatesId
  1819.             // this.personalInfoDetail.address=result.address
  1820.             // this.personalInfoDetail.dateOfBirth= new Date(result.dateOfBirth)
  1821.             // this.personalInfoDetail.email=result.email
  1822.             // this.personalInfoDetail.kkNo=result.kkNo
  1823.             // this.personalInfoDetail.name=result.name
  1824.             // this.personalInfoDetail.placeOfBirth=result.placeOfBirth
  1825.             // this.personalInfoDetail.sex=result.sex
  1826.             // this.personalInfoDetail.religion=result.religion
  1827.             // this.personalInfoDetail.lastEducation=result.lastEducation
  1828.             // this.personalInfoDetail.maritalStatus=result.maritalStatus
  1829.             // this.personalInfoDetail.phoneNumber=result.phoneNumber
  1830.             // this.personalInfoDetail.driverLicenseNumber=result.driverLicenseNumber
  1831.             // this.personalInfoDetail.driverLicenseType=result.driverLicenseType
  1832.             // this.personalInfoDetail.hobby=result.hobby
  1833.             // this.personalInfoDetail.ktpAddress=result.ktpAddress
  1834.             // this.personalInfoDetail.ktpKecamatan=result.ktpKecamatan
  1835.             // this.personalInfoDetail.ktpKelurahan=result.ktpKelurahan
  1836.             // this.personalInfoDetail.ktpKota=result.ktpKota
  1837.             // this.personalInfoDetail.ktpKodePos=result.ktpKodePos
  1838.             // this.personalInfoDetail.ktpRt=result.ktpRt
  1839.             // this.personalInfoDetail.ktpRw=result.ktpRw
  1840.             // this.personalInfoDetail.domisiliAddress=result.domisiliAddress
  1841.             // this.personalInfoDetail.domisiliKota=result.domisiliKota
  1842.             // this.personalInfoDetail.domisiliKodePos=result.domisiliKodePos
  1843.           }
  1844.           resolve("Done")
  1845.         }, err => {
  1846.           console.log(err)
  1847.           reject("error getting nik")
  1848.         }
  1849.       )
  1850.     })
  1851.  
  1852.  
  1853.   }
  1854.  
  1855.   getPersonalDataById() {
  1856.     return new Promise((resolve, reject) => {
  1857.       this.services.findPersonalDataById(this.candidateId).subscribe(
  1858.         result => {
  1859.           if (!result.data) {
  1860.             console.log(result)
  1861.             this.candidatesId = result.candidatesId
  1862.             this.personalInfoDetail = result;
  1863.             this.position = result.appliedPosition;
  1864.             this.placementProvince = result.placementProvince != '0' ? result.placementProvince : null;
  1865.             this.provinceControl.setValue(this.placementProvince);
  1866.             this.placementProvinceCode = result.placementProvinceCode != '0' ? result.placementProvinceCode : null;
  1867.             this.placementCity = result.placementCity != '0' ? result.placementCity : null;
  1868.             this.cityControl.setValue(this.placementCity);
  1869.             this.placementCityCode = result.placementCityCode != '0' ? result.placementCityCode : null;
  1870.             if (this.title.toUpperCase() == "SATMOB" || this.position.toUpperCase() == "SATMOB") {
  1871.               this.simOption = [
  1872.                 "SIM A",
  1873.                 "SIM B1"
  1874.               ];
  1875.             }
  1876.             // console.log(this.personalInfoDetail)
  1877.           }
  1878.           resolve("Done")
  1879.         }, err => {
  1880.           console.log(err)
  1881.           reject("error getting candidates data")
  1882.         }
  1883.       )
  1884.     })
  1885.  
  1886.  
  1887.   }
  1888.   getDocumentByCandidateId() {
  1889.     return new Promise((resolve, reject) => {
  1890.       if (!this.candidatesId) {
  1891.  
  1892.         resolve("done")
  1893.       }
  1894.       this.services.findDocumentByCandidateId(this.candidatesId).subscribe(
  1895.         result => {
  1896.           if (!result.data) {
  1897.             this.documentDetail.candidatesDocumentId = result.candidatesDocumentId
  1898.             this.documentDetail.bankAccountName = result.bankAccountName
  1899.             this.documentDetail.bankAccountNo = result.bankAccountNo
  1900.             this.documentDetail.bankName = result.bankName
  1901.             this.documentDetail.bpjsNo = result.bpjsNo
  1902.             this.documentDetail.faskes = result.faskes
  1903.             this.documentDetail.jamsostekDate = result.jamsostekDate
  1904.             this.documentDetail.jamsostekNo = result.jamsostekNo
  1905.             this.documentDetail.npwpNo = result.npwpNo
  1906.             this.documentDetail.simNo = result.simNo
  1907.             this.documentDetail.simType = result.simType
  1908.             this.documentDetail.simExpiredDate = result.simExpiredDate
  1909.             this.documentDetail.stnkExpiredDate = result.stnkExpiredDate
  1910.             this.documentDetail.stnkPlatNoDate = result.stnkPlatNoDate
  1911.             this.documentDetail.licensePlate = result.licensePlate
  1912.             if (result.bpjsNo != null) {
  1913.               this.selectedOptionBpjs = "YA"
  1914.             } else {
  1915.               this.selectedOptionBpjs = "TIDAK"
  1916.             }
  1917.             if (result.jamsostekNo != null) {
  1918.               this.selectedOptionJamsostek = "YA"
  1919.             } else {
  1920.               this.selectedOptionJamsostek = "TIDAK"
  1921.             }
  1922.  
  1923.           }
  1924.  
  1925.           resolve("done")
  1926.         }, err => {
  1927.           console.log(err)
  1928.           reject(err)
  1929.         }
  1930.       )
  1931.     })
  1932.  
  1933.  
  1934.   }
  1935.   getFamilyByCandidateId() {
  1936.     return new Promise((resolve, reject) => {
  1937.       if (!this.candidatesId) {
  1938.         console.log("new data")
  1939.         resolve("Done")
  1940.       }
  1941.       this.services.findFamilyByCandidateId(this.candidatesId).subscribe(
  1942.         result => {
  1943.           if (!result.data) {
  1944.             if (result.length == 0) {
  1945.  
  1946.               resolve("Done")
  1947.             }
  1948.  
  1949.             result.forEach(family => {
  1950.               if (this.isChild(family)) {
  1951.                 this.numberOfChild++;
  1952.               } else if (this.isSibling(family)) {
  1953.                 this.numberOfSibling++;
  1954.               }
  1955.             });
  1956.             this.checkPTKP(this.personalInfoDetail.maritalStatus, this.numberOfChild);
  1957.             this.familyList = result
  1958.             resolve("Done")
  1959.           }
  1960.  
  1961.         }, err => {
  1962.           console.log(err)
  1963.           resolve(err)
  1964.         }
  1965.       )
  1966.     })
  1967.   }
  1968.  
  1969.  
  1970.   getEducationByCandidateId() {
  1971.     return new Promise((resolve, reject) => {
  1972.       if (!this.candidatesId) {
  1973.         resolve("Done")
  1974.       }
  1975.  
  1976.       this.services.findEducationByCandidateId(this.candidatesId).subscribe(
  1977.         result => {
  1978.           if (result.length == 0) {
  1979.  
  1980.             resolve("Done")
  1981.           }
  1982.           if (!result.data) {
  1983.             //  let dataEducation:Education[]=[]
  1984.             // result.forEach(element => {
  1985.             //   let education = new Education
  1986.             //   education.candidatesEducationId=element.candidatesEducationId
  1987.             //   education.institution= element.institution
  1988.             //   education.major= element.major
  1989.             //   education.yearIn= element.yearIn
  1990.             //   education.yearOut= element.yearOut
  1991.             //   education.grade=element.grade
  1992.             //   dataEducation.push(education)
  1993.             // });
  1994.             this.educationList = result
  1995.             resolve("Done")
  1996.           }
  1997.  
  1998.         }, err => {
  1999.           console.log(err)
  2000.           reject(err)
  2001.         }
  2002.       )
  2003.     })
  2004.   }
  2005.   getInformalEducationByCandidateId() {
  2006.     return new Promise((resolve, reject) => {
  2007.       if (!this.candidatesId) {
  2008.         resolve("Done")
  2009.       }
  2010.  
  2011.       this.services.findInformalEducationByCandidateId(this.candidatesId).subscribe(
  2012.         result => {
  2013.           if (result.length == 0) {
  2014.             //this.informalEducationList.push(new InformalEducation)
  2015.             resolve("Done")
  2016.           } else {
  2017.             if (!result.data) {
  2018.               //   let dataInformalEducation:InformalEducation[]=[]
  2019.               //   result.forEach(element => {
  2020.               //     let informalEducation = new InformalEducation
  2021.               //     informalEducation.candidatesInformalId=element.candidatesInformalId
  2022.               //     informalEducation.trainingName= element.trainingName
  2023.               //     informalEducation.trainingDate= element.trainingDate
  2024.               //     informalEducation.remarks= element.remarks
  2025.               //     dataInformalEducation.push(informalEducation)
  2026.               // });
  2027.               this.informalEducationList = result
  2028.               resolve("Done")
  2029.             }
  2030.           }
  2031.         }, err => {
  2032.           console.log(err)
  2033.           //this.informalEducationList.push(new InformalEducation)
  2034.           reject(reject)
  2035.         }
  2036.       )
  2037.     })
  2038.  
  2039.  
  2040.   }
  2041.   getLanguageByCandidateId() {
  2042.     return new Promise((resolve, reject) => {
  2043.       if (!this.candidatesId) {
  2044.         resolve("Done")
  2045.       }
  2046.       this.services.findLanguageByCandidateId(this.candidatesId).subscribe(
  2047.         result => {
  2048.           if (result.length == 0) {
  2049.  
  2050.             resolve("Done")
  2051.           }
  2052.           if (!result.data) {
  2053.             //  let dataLanguage:LanguageSkill[]=[]
  2054.             // result.forEach(element => {
  2055.             //   let language = new LanguageSkill
  2056.             //   language.candidatesLanguageId=element.candidatesLanguageId
  2057.             //   language.language= element.language
  2058.             //   language.conversationalSkill= element.conversationalSkill
  2059.             //   language.writingSkill= element.writingSkill
  2060.             //   language.readingSkill= element.readingSkill
  2061.             //   language.listeningSkill=element.listeningSkill
  2062.             //   language.remarks=element.remarks
  2063.             //   dataLanguage.push(language)
  2064.             // });
  2065.             this.languageSkillList = result
  2066.             resolve("Done")
  2067.           }
  2068.  
  2069.         }, err => {
  2070.           console.log(err)
  2071.           reject(reject)
  2072.         }
  2073.       )
  2074.     })
  2075.  
  2076.   }
  2077.   getWorkExperienceByCandidateId() {
  2078.     return new Promise((resolve, reject) => {
  2079.       if (!this.candidatesId) {
  2080.         resolve("Done")
  2081.       }
  2082.  
  2083.       this.services.findWorkExperienceByCandidateId(this.candidatesId).subscribe(
  2084.         result => {
  2085.           if (result.length == 0) {
  2086.  
  2087.             resolve("Done")
  2088.           }
  2089.           if (!result.data) {
  2090.             //  let dataExperience:WorkExperience[]=[]
  2091.             // result.forEach(element => {
  2092.             //   let experience = new WorkExperience
  2093.             //   experience.candidatesWorkExperienceId=element.candidatesWorkExperienceId
  2094.             //   experience.companyName= element.companyName
  2095.             //   experience.position= element.position
  2096.             //   experience.yearIn= element.yearIn
  2097.             //   experience.yearOut= element.yearOut
  2098.             //   experience.achievement=element.achievement
  2099.             //   dataExperience.push(experience)
  2100.             // });
  2101.             this.workExperienceList = result
  2102.             resolve("Done")
  2103.           }
  2104.  
  2105.         }, err => {
  2106.           console.log(err)
  2107.           reject(err)
  2108.         }
  2109.       )
  2110.     })
  2111.  
  2112.   }
  2113.   getEmergencyContactByCandidateId() {
  2114.     return new Promise((resolve, reject) => {
  2115.       if (!this.candidatesId) {
  2116.         resolve("done")
  2117.       }
  2118.  
  2119.       this.services.findEmergencyContactByCandidateId(this.candidatesId).subscribe(
  2120.         result => {
  2121.           console.log(result)
  2122.           if (result.length == 0) {
  2123.  
  2124.             resolve("done")
  2125.           }
  2126.           if (!result.data) {
  2127.             //  let dataEmergencyContact:EmergencyContact[]=[]
  2128.             // result.forEach(element => {
  2129.             //   let emergencyContact = new EmergencyContact
  2130.             //   emergencyContact.candidatesEmergencyContactId=element.candidatesEmergencyContactId
  2131.             //   emergencyContact.emergencyContactName= element.emergencyContactName
  2132.             //   emergencyContact.relationship = element.relationship
  2133.             //   emergencyContact.phoneNumber= element.phoneNumber
  2134.             //   dataEmergencyContact.push(emergencyContact)
  2135.             // });
  2136.             this.emergencyContactList = result
  2137.             resolve("done")
  2138.           }
  2139.  
  2140.         }, err => {
  2141.           console.log(err)
  2142.           reject("done")
  2143.         }
  2144.       )
  2145.     })
  2146.  
  2147.   }
  2148.   npwpFormat(nStr: string) {
  2149.     if (nStr) {
  2150.       if (nStr.length == 15) {
  2151.         return nStr.replace(/(\d{2})(\d{3})(\d{3})(\d{1})(\d{3})(\d{3})/, '$1.$2.$3.$4-$5.$6');
  2152.       } else {
  2153.         return ''
  2154.       }
  2155.  
  2156.     } else {
  2157.       return ''
  2158.     }
  2159.   }
  2160.  
  2161.   changePersonalDoB(event: MatDatepickerInputEvent<Date>) {
  2162.     let umur = moment(this.personalInfoDetail.dateOfBirth).diff(new Date(), "years") * -1
  2163.     //console.log(moment(new Date()).diff(event.value, "days"))
  2164.     if (umur >= this.maxAge()) {
  2165.       this.openSnackBar("Maksimum Umur untuk posisi " + this.position + " adalah " + this.maxAge() + " tahun", "close")
  2166.     }
  2167.     if (umur < this.minAge()) {
  2168.       this.openSnackBar("Minimum Umur untuk posisi " + this.position + " adalah " + this.minAge() + " tahun", "close")
  2169.     }
  2170.     console.log(this.personalInfoDetail.dateOfBirth)
  2171.   }
  2172.   changeExpiredSim(event: MatDatepickerInputEvent<Date>) {
  2173.     console.log(moment(event.value).diff(new Date(), "months"))
  2174.     if (this.simExpirationThreshold() != null) {
  2175.       if (moment(event.value).diff(new Date(), "months") < this.simExpirationThreshold()) {
  2176.         this.openSnackBar("SIM Wajib aktif minimal " + this.simExpirationThreshold() + " bulan sebelum masa berakhir", "close")
  2177.       }
  2178.     }
  2179.     console.log(event.value)
  2180.   }
  2181.  
  2182.   changeExpiredStnk(event: MatDatepickerInputEvent<Date>) {
  2183.     console.log(moment(event.value).diff(new Date(), "months"))
  2184.     if (this.stnkExpirationThreshold() != null) {
  2185.       if (moment(event.value).diff(new Date(), "months") < this.stnkExpirationThreshold()) {
  2186.         this.openSnackBar("STNK Wajib aktif minimal " + this.stnkExpirationThreshold() + " bulan sebelum masa berakhir", "close")
  2187.       }
  2188.     }
  2189.     console.log(event.value)
  2190.   }
  2191.  
  2192.   // onInputPlacementProvince() {
  2193.  
  2194.   //   this.filteredProvinceList = this.filteredProvinceList
  2195.   //     .pipe(map(province => this.filterProvince(province)),
  2196.   //     )
  2197.  
  2198.   // }
  2199.  
  2200.   filterProvince(value: string) {
  2201.     const filterValue = value.toLowerCase();
  2202.  
  2203.     return this.provinceList.filter(option => option.toLowerCase().includes(filterValue));
  2204.   }
  2205.  
  2206.   filterCity(value: string) {
  2207.     const filterValue = value.toLowerCase();
  2208.  
  2209.     return this.cityList.filter(option => option.cityName.toLowerCase().includes(filterValue));
  2210.   }
  2211.  
  2212.   // onInputPlacementCity(value: string) {
  2213.   //console.log("input")
  2214.   // if (value.length >= 2) {
  2215.   //   this.services.suggestCity(this.placementProvinceCode, value).subscribe(res => {
  2216.   //     console.log(res)
  2217.   //     this.placementCityAuto = res
  2218.   //   }, err => {
  2219.   //     this.placementCityAuto = []
  2220.   //   })
  2221.   // }
  2222.   // if (value.length < 1) {
  2223.   //   this.placementCityAuto = []
  2224.   // }
  2225.   // }
  2226.   placementProvinceValidationMsg() {
  2227.     if (this.placementProvinceCode == null && this.placementProvince != null) {
  2228.       return "Nama Provinsi tidak Valid"
  2229.     }
  2230.     return ""
  2231.   }
  2232.   placementCityValidationMsg() {
  2233.     if (this.placementCityCode == null) {
  2234.       return "Nama Kota tidak Valid"
  2235.     }
  2236.     return ""
  2237.   }
  2238.   escapeNonAlphaSpaceName(value: string, page: string, index: number) {
  2239.     value = value.trim()
  2240.     if (page == 'personal') this.personalInfoDetail.name = value.replace(this.alphaspaceOnly, '')
  2241.     if (page == 'family') this.familyList[index].name = value.replace(this.alphaspaceOnly, '')
  2242.     if (page == 'ttl') this.personalInfoDetail.placeOfBirth = value.replace(this.alphaspaceOnly, '')
  2243.   }
  2244.   escapeNonAlphaSpaceNameRek(value: string) {
  2245.     value = value.trim()
  2246.     this.documentDetail.bankAccountName = value.replace(this.alphaspaceOnly, '')
  2247.   }
  2248.   unixTimestampToDate(unix) {
  2249.     // Create a new JavaScript Date object based on the timestamp
  2250.     // multiplied by 1000 so that the argument is in milliseconds, not seconds.
  2251.     let dateFormat = new Date(unix);
  2252.     // Hours part from the timestamp
  2253.     let date = dateFormat.getDate();
  2254.     let dateStr = date + ""
  2255.     if (date < 10) {
  2256.       dateStr = "0" + date
  2257.     }
  2258.     // Minutes part from the timestamp
  2259.     let month = dateFormat.getMonth() + 1;
  2260.     let monthStr = month + ""
  2261.     if (month < 10) {
  2262.       monthStr = "0" + month
  2263.     }
  2264.     // Seconds part from the timestamp
  2265.     let year = dateFormat.getFullYear();
  2266.  
  2267.     // Will display time in 10:30:23 format
  2268.     let formattedTime = dateStr + '/' + monthStr + '/' + year;
  2269.  
  2270.     console.log(formattedTime);
  2271.     return formattedTime
  2272.   }
  2273.  
  2274.   appendAttachment(body: FormData) {
  2275.  
  2276.     if (!this.coverLetter) this.createCoverLetter();
  2277.     if (!this.cv) this.createResume();
  2278.  
  2279.     if (this.ktp) body.append("ktp", this.ktp);
  2280.     if (this.kk) body.append("kk", this.kk);
  2281.     if (this.ijazah) body.append("ijazah", this.ijazah);
  2282.     if (this.cv) body.append("cv", this.cv);
  2283.     if (this.tabungan) body.append("tabungan", this.tabungan);
  2284.     if (this.sim) {
  2285.       body.append("sim", this.sim)
  2286.     }
  2287.     if (this.stnk) {
  2288.       body.append("stnkFront", this.stnk)
  2289.     }
  2290.     if (this.stnkBack) {
  2291.       body.append("stnkBack", this.stnkBack)
  2292.     }
  2293.     if (this.vaccine) body.append("vaccine", this.vaccine);
  2294.     if (this.coverLetter) body.append("coverLetter", this.coverLetter)
  2295.   }
  2296.  
  2297.   submitApplication() {
  2298.     this.showSpinner()
  2299.     let body = new FormData()
  2300.     let arrayDoc: Document[] = []
  2301.     let status = "";
  2302.     if (this.personalInfoDetail.vaccineStatus == 1 || this.personalInfoDetail.vaccineStatus == 2) {
  2303.       this.personalInfoDetail.vaccineConsent = null
  2304.     }
  2305.     arrayDoc.push(this.documentDetail)
  2306.     this.personalInfoDetail.address = this.personalInfoDetail.domisiliAddress + ' ' + this.personalInfoDetail.domisiliKota
  2307.     this.personalInfoDetail.dateOfBirth = moment(this.personalInfoDetail.dateOfBirth).format("YYYY-MM-DD")
  2308.     if (this.documentDetail.simExpiredDate != null) this.documentDetail.simExpiredDate = moment(this.documentDetail.simExpiredDate).format("YYYY-MM-DD")
  2309.     if (this.documentDetail.stnkExpiredDate != null) this.documentDetail.stnkExpiredDate = moment(this.documentDetail.stnkExpiredDate).format("YYYY-MM-DD")
  2310.     if (this.documentDetail.stnkPlatNoDate != null) this.documentDetail.stnkPlatNoDate = moment(this.documentDetail.stnkPlatNoDate).format("YYYY-MM-DD")
  2311.     if (this.documentDetail.jamsostekDate != null) this.documentDetail.jamsostekDate = moment(this.documentDetail.jamsostekDate).format("YYYY-MM-DD")
  2312.     this.personalInfoDetail.placementCityCode = this.placementCityCode
  2313.     this.personalInfoDetail.placementProvinceCode = this.placementProvinceCode
  2314.     this.familyList.forEach(family => {
  2315.       if (family.dateOfBirth != null) family.dateOfBirth = moment(family.dateOfBirth).format("YYYY-MM-DD")
  2316.     });
  2317.     if (this.isPsikotestStart()) {
  2318.       console.log("psikotest")
  2319.     } else {
  2320.       this.personalInfoDetail.appliedPosition = this.title
  2321.       this.personalInfoDetail.level = this.category
  2322.     }
  2323.     body.append("candidates", JSON.stringify(this.personalInfoDetail))
  2324.     body.append("candidatesFamilies", JSON.stringify(this.familyList))
  2325.     //body.append("candidatesLanguages",JSON.stringify(this.languageSkillList))
  2326.     body.append("candidatesWorkExperiences", JSON.stringify(this.workExperienceList))
  2327.     body.append("candidatesEducations", JSON.stringify(this.educationList[0]))
  2328.     body.append("candidatesInformalEducations", JSON.stringify(this.informalEducationList[0]))
  2329.     body.append("candidatesEmergencyContacts", JSON.stringify(this.emergencyContactList[0]))
  2330.     body.append("candidatesDocument", JSON.stringify(arrayDoc[0]))
  2331.  
  2332.     this.appendAttachment(body);
  2333.  
  2334.     if (this.isPsikotestStart()) {
  2335.       status = "psikotest";
  2336.     } else {
  2337.       status = "entry";
  2338.     }
  2339.     body.append("status", status);
  2340.     console.log(this.personalInfoDetail)
  2341.     console.log(this.emergencyContactList)
  2342.     console.log(this.documentDetail)
  2343.     console.log(this.familyList)
  2344.     console.log(this.workExperienceList)
  2345.     console.log(this.educationList)
  2346.     console.log(this.informalEducationList)
  2347.     this.services.registerApplicant(body).subscribe(result => {
  2348.       if (this.isPsikotestStart()) {
  2349.         this.services.postPathDone(this.candidateId, null, this.authorization)
  2350.           .subscribe(result => {
  2351.             this.router.navigate([result.nextPath]);
  2352.             setTimeout(() => {
  2353.               this.myStepper.next();
  2354.               this.hideSpinner()
  2355.             }, 500);
  2356.           }, error => {
  2357.             setTimeout(() => {
  2358.               this.hideSpinner();
  2359.               console.log(error);
  2360.             })
  2361.           });
  2362.       } else {
  2363.         console.log(result)
  2364.         this.myStepper.next();
  2365.         this.step++
  2366.         this.hideSpinner()
  2367.         this.openSnackBar("Data Berhasil Dikirim", "close")
  2368.       }
  2369.     },
  2370.       err => {
  2371.         console.log('error register', err)
  2372.         this.hideSpinner()
  2373.         this.openSnackBarV2(err, "close")
  2374.       })
  2375.   }
  2376.   //per step submit
  2377.   submitPersonalInfo(stepTo: number) {
  2378.     this.showSpinner()
  2379.     if (this.personalInfoDetail.vaccineStatus == 1 || this.personalInfoDetail.vaccineStatus == 2) {
  2380.       this.personalInfoDetail.vaccineConsent = null
  2381.     }
  2382.     this.personalInfoDetail.dateOfBirth = moment(this.personalInfoDetail.dateOfBirth).format("YYYY-MM-DD")
  2383.     this.personalInfoDetail.address = this.personalInfoDetail.domisiliAddress + ' ' + this.personalInfoDetail.domisiliKota
  2384.     this.personalInfoDetail.placementCityCode = this.placementCityCode
  2385.     this.personalInfoDetail.placementProvinceCode = this.placementProvinceCode
  2386.     let body = {
  2387.       candidates: this.personalInfoDetail,
  2388.       candidatesEmergencyContact: this.emergencyContactList[0]
  2389.     }
  2390.     this.services.submitPersonalData(body).subscribe(result => {
  2391.       console.log(result.message)
  2392.       this.step = stepTo
  2393.       this.hideSpinner()
  2394.     },
  2395.       err => {
  2396.         console.log(err)
  2397.         this.hideSpinner()
  2398.         this.openSnackBarV2(err, "close")
  2399.       })
  2400.   }
  2401.   submitDocumentInfo(stepTo: number) {
  2402.     this.showSpinner()
  2403.     let body = new FormData()
  2404.     if (this.documentDetail.simExpiredDate != null) this.documentDetail.simExpiredDate = moment(this.documentDetail.simExpiredDate).format("YYYY-MM-DD")
  2405.     if (this.documentDetail.stnkExpiredDate != null) this.documentDetail.stnkExpiredDate = moment(this.documentDetail.stnkExpiredDate).format("YYYY-MM-DD")
  2406.     if (this.documentDetail.stnkPlatNoDate != null) this.documentDetail.stnkPlatNoDate = moment(this.documentDetail.stnkPlatNoDate).format("YYYY-MM-DD")
  2407.     if (this.documentDetail.jamsostekDate != null) this.documentDetail.jamsostekDate = moment(this.documentDetail.jamsostekDate).format("YYYY-MM-DD")
  2408.     body.append("candidatesId", this.candidateId)
  2409.     body.append("candidatesDocument", JSON.stringify(this.documentDetail))
  2410.     this.services.submitDocument(body).subscribe(result => {
  2411.       console.log(result.message)
  2412.       console.log(result)
  2413.       this.documentDetail = result.document
  2414.       this.step = stepTo
  2415.       this.hideSpinner()
  2416.     },
  2417.       err => {
  2418.         console.log(err)
  2419.         this.hideSpinner()
  2420.         this.openSnackBarV2(err, "close")
  2421.       })
  2422.  
  2423.   }
  2424.   submitFamily(stepTo: number) {
  2425.     this.showSpinner()
  2426.     let body = new FormData()
  2427.     this.familyList.forEach(family => {
  2428.       if (family.dateOfBirth != null) family.dateOfBirth = moment(family.dateOfBirth).format("YYYY-MM-DD")
  2429.     });
  2430.     body.append("candidatesId", this.candidateId)
  2431.     body.append("candidatesFamilies", JSON.stringify(this.familyList))
  2432.     body.append("kkNo", this.personalInfoDetail.kkNo)
  2433.     body.append("maritalStatus", this.personalInfoDetail.maritalStatus)
  2434.     this.services.submitFamily(body).subscribe(result => {
  2435.       console.log(result.message)
  2436.       this.familyList = result.family
  2437.       this.step = stepTo
  2438.       this.hideSpinner()
  2439.     },
  2440.       err => {
  2441.         console.log(err)
  2442.         this.hideSpinner()
  2443.         this.openSnackBarV2(err, "close")
  2444.       })
  2445.  
  2446.   }
  2447.   submitEducation(stepTo: number) {
  2448.     this.showSpinner()
  2449.     let body = new FormData()
  2450.     body.append("candidatesId", this.candidateId)
  2451.     body.append("candidatesEducations", JSON.stringify(this.educationList[0]))
  2452.     body.append("candidatesInformalEducations", JSON.stringify(this.informalEducationList[0]))
  2453.     this.services.submitEducation(body).subscribe(result => {
  2454.       console.log(result.message)
  2455.       console.log(result)
  2456.       this.educationList[0] = result.education
  2457.       if (result.informalEducation != null) {
  2458.         this.informalEducationList[0] = result.informalEducation
  2459.       }
  2460.  
  2461.       this.step = stepTo
  2462.       this.hideSpinner()
  2463.     },
  2464.       err => {
  2465.         console.log(err)
  2466.         this.hideSpinner()
  2467.         this.openSnackBarV2(err, "close")
  2468.       })
  2469.  
  2470.   }
  2471.   submitWorkExperience(stepTo: number) {
  2472.     this.showSpinner()
  2473.     let body = new FormData()
  2474.     body.append("candidatesId", this.candidateId)
  2475.     body.append("candidatesWorkExperiences", JSON.stringify(this.workExperienceList))
  2476.     this.services.submitWorkExperience(body).subscribe(result => {
  2477.       console.log(result.message)
  2478.       console.log(result)
  2479.       this.workExperienceList = result.workExperience
  2480.       this.step = stepTo
  2481.       this.hideSpinner()
  2482.     },
  2483.       err => {
  2484.         console.log(err)
  2485.         this.hideSpinner()
  2486.         this.openSnackBarV2(err, "close")
  2487.       })
  2488.  
  2489.   }
  2490.   submitAttachment(stepTo: number) {
  2491.  
  2492.     this.showSpinner()
  2493.     let body = new FormData()
  2494.     if (this.candidateId) body.append("candidatesId", this.candidateId);
  2495.     if (this.isPsikotestStart()) body.append("source", "psikotest");
  2496.     if (this.isEpkwtForm()) body.append("source", "epkwt");
  2497.  
  2498.     this.appendAttachment(body);
  2499.  
  2500.     this.services.submitAttachment(body).subscribe(result => {
  2501.       let obj = JSON.parse(result);
  2502.       console.log("next path return " + obj["nextPath"]);
  2503.       console.log("next path return " + obj);
  2504.       if (this.isPsikotestStart() || this.isEpkwtForm()) {
  2505.         this.router.navigate([obj.nextPath]);
  2506.         // this.services.postPathDone(this.candidateId, null, this.authorization)
  2507.         //   .subscribe(result => {
  2508.         //     this.router.navigate([result.nextPath]);
  2509.         //     setTimeout(() => {
  2510.         //       this.hideSpinner()
  2511.         //     }, 500);
  2512.         //   }, error => {
  2513.         //     setTimeout(() => {
  2514.         //       this.hideSpinner()
  2515.         //       console.log(error);
  2516.         //     })
  2517.         //   });
  2518.       } else {
  2519.         console.log(result)
  2520.         this.step++
  2521.         this.hideSpinner()
  2522.         this.openSnackBar("Data Berhasil Dikirim", "close")
  2523.       }
  2524.     },
  2525.       err => {
  2526.         console.log(err)
  2527.         this.hideSpinner()
  2528.         this.openSnackBarV2(err, "close")
  2529.       })
  2530.  
  2531.   }
  2532.  
  2533.   sliceFilename(str) {
  2534.     if (str) {
  2535.       return str.slice(0, 10) + " ... " + str.split('.').pop();
  2536.     } else {
  2537.       return ""
  2538.     }
  2539.   }
  2540.   checkFile(file: File) {
  2541.     if (file) {
  2542.       return true
  2543.     } else {
  2544.       return false
  2545.     }
  2546.  
  2547.   }
  2548.   private openSnackBar(message: string, action: string) {
  2549.     this._snackBar.open(message, action, {
  2550.       duration: 4000
  2551.     });
  2552.   }
  2553.   private openSnackBarV2(message: string, action: string) {
  2554.     this._snackBar.open(message, action);
  2555.   }
  2556.   showSpinner() {
  2557.     this.spinner.show()
  2558.   }
  2559.   hideSpinner() {
  2560.     this.spinner.hide();
  2561.   }
  2562.  
  2563. }
  2564.  
  2565.  
  2566.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement