import { Component, ViewChild, Injector, Input, Output, EventEmitter, OnInit, AfterViewInit} from '@angular/core'; import { ModalDirective } from 'ngx-bootstrap'; import { finalize } from 'rxjs/operators'; //import { ClinicsServiceProxy, CreateOrEditClinicDto } from '@shared/service-proxies/service-proxies'; import { ClinicsServiceProxy, CreateOrEditClinicDto, RouteDefinitionsServiceProxy, CreateOrEditRouteDefinitionDto, RouteTypesServiceProxy, RouteScheduleDetailsServiceProxy, RouteScheduleDetailDto, CreateOrEditRouteScheduleDetailDto, CreateOrEditClinicScheduleDto } from '@shared/service-proxies/service-proxies'; import { AddressServiceProxy, CreateAddressInput } from '@shared/service-proxies/service-proxies'; import { EmailServiceProxy, CreateEmailInput } from '@shared/service-proxies/service-proxies'; import { RouteSchedulesServiceProxy, CreateOrEditRouteScheduleDto } from '@shared/service-proxies/service-proxies'; import { AppComponentBase } from '@shared/common/app-component-base'; import * as moment from 'moment-timezone'; import { AddressFormComponent } from '@app/shared/layout/form/address-form.component'; import { AddressFormMainComponent } from '../../../shared/layout/formMain/address-form.component'; declare var KTWizard: any; declare var $: any; declare var KTApp: any; declare let swal: any; @Component({ selector: 'createOrEditClinicModal', templateUrl: './create-or-edit-clinic-modal.component.html' }) export class CreateOrEditClinicModalComponent extends AppComponentBase { @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective; @ViewChild(AddressFormMainComponent, {static:false}) addressForm; @Output() modalSave: EventEmitter = new EventEmitter(); @Output()iconChange = new EventEmitter(); active = false; saving = false; edit = false; change = false; activeTabIndex: number = 0; scheduleInput: CreateOrEditRouteScheduleDetailDto = new CreateOrEditRouteScheduleDetailDto; input: CreateOrEditRouteScheduleDto = new CreateOrEditRouteScheduleDto; clinic: CreateOrEditClinicDto = new CreateOrEditClinicDto(); address: CreateAddressInput = new CreateAddressInput(); schedules: any; routeDefinitions: any; routeTypes: any; designationSelect: any; designation: any; eta: any; etaMonday: any; etaTuesday: any; etaWednesday: any; etaThursday: any; etaFriday: any; etaSaturday: any; etaSunday: any; cutOff: any; cutOffMonday: any; cutOffTuesday: any; cutOffWednesday: any; cutOffThursday: any; cutOffFriday: any; cutOffSaturday: any; cutOffSunday: any; sundayActiveStatus = true; sunday_active_class: string; sunday_inactive_class: string; mondayActiveStatus = true; monday_active_class: string; monday_inactive_class: string; tuesdayActiveStatus = true; tuesday_active_class: string; tuesday_inactive_class: string; wednesdayActiveStatus = true; wednesday_active_class: string; wednesday_inactive_class: string; thursdayActiveStatus = true; thursday_active_class: string; thursday_inactive_class: string; fridayActiveStatus = true; friday_active_class: string; friday_inactive_class: string; saturdayActiveStatus = true; saturday_active_class: string; saturday_inactive_class: string; effectivityDate: any; //dates: Date; clinicId: any; scheduleId: any; showSchedule: boolean; constructor( injector: Injector, private _clinicsServiceProxy: ClinicsServiceProxy, private _routeDefinitionsServiceProxy: RouteDefinitionsServiceProxy, private _routeScheduleDetailsServiceProxy: RouteScheduleDetailsServiceProxy, private _routeSchedulesServiceProxy: RouteSchedulesServiceProxy, private _routeTypesServiceProxy: RouteTypesServiceProxy, private _addressService: AddressServiceProxy, private _emailService: EmailServiceProxy, ) { super(injector); } show(schedule?: any, routeScheduleId?: any, clinicId?: any): void { let today = new Date(); this.showSchedule = true; this.sunday_active_class = "btn btn-success"; this.sunday_inactive_class = "btn btn-light"; this.monday_active_class = "btn btn-success"; this.monday_inactive_class = "btn btn-light"; this.tuesday_active_class = "btn btn-success"; this.tuesday_inactive_class = "btn btn-light"; this.wednesday_active_class = "btn btn-success"; this.wednesday_inactive_class = "btn btn-light"; this.thursday_active_class = "btn btn-success"; this.thursday_inactive_class = "btn btn-light"; this.friday_active_class = "btn btn-success"; this.friday_inactive_class = "btn btn-light"; this.saturday_active_class = "btn btn-success"; this.saturday_inactive_class = "btn btn-light"; let that = this; $(document).ready(function() { $('#routeType').on('select2:select', function (e) { var data = e.params.data; that._routeTypesServiceProxy.getRouteTypeForEdit(data.id).subscribe(result => { if(!result.routeType.sunday) { that.sundayIsInActive(e); } else { that.sundayIsActive(e); } if(!result.routeType.monday) { that.mondayIsInActive(e); } else { that.mondayIsActive(e); } if(!result.routeType.tuesday) { that.tuesdayIsInActive(e); } else { that.tuesdayIsActive(e); } if(!result.routeType.wednesday) { that.wednesdayIsInActive(e); } else { that.wednesdayIsActive(e); } if(!result.routeType.thursday) { that.thursdayIsInActive(e); } else { that.thursdayIsActive(e); } if(!result.routeType.friday) { that.fridayIsInActive(e); } else { that.fridayIsActive(e); } if(!result.routeType.saturday) { that.saturdayIsInActive(e); } else { that.saturdayIsActive(e); } }); }); $('#routeDefinition').on('select2:select', function (e) { var data = e.params.data; let selectedRouteDefintion = that.routeDefinitions.find(i => i.routeTemplateName === data.id); //that.routeDefinitions.map(({ routeTemplateName }) => data.id); that.scheduleInput.routeTypeId = selectedRouteDefintion.routeDefinition.routeTypeId; that.getAllDropDown(); }); }); //today = moment(today).tz(localStorage.getItem('timeZoneId')).toDate(); this.clinicId = clinicId; this.scheduleId = routeScheduleId; this.designationSelect = ([ { value: "auto", text: "Auto" }, { value: "willCall", text: "Will Call" } ]); if (schedule == undefined) { this.scheduleInput.isActive = true; this.scheduleInput.routeScheduleId = routeScheduleId; this.cutOffMonday = today; this.cutOffTuesday = today; this.cutOffWednesday = today; this.cutOffThursday = today; this.cutOffFriday = today; this.cutOffSaturday = today; this.cutOffSunday = today; this.etaMonday = today; this.etaTuesday = today; this.etaWednesday = today; this.etaThursday = today; this.etaFriday = today; this.etaSaturday = today; this.etaSunday = today; this.eta = today; this.cutOff= today; this.getAllDropDown(); this.active = true; this.modal.show(); } else { today = moment(schedule.today).tz(localStorage.getItem('timeZoneId')).toDate(); this.scheduleInput = schedule; this.edit = true; this.getAllDropDown(); this.active = true; this.modal.show(); if(schedule.willCall == true) { this.designation = "willCall"; } else if(schedule.automatic == true) { this.designation = "auto"; } //alert(today.toDateString()); let dateCutOff = today.toDateString() + ' ' + schedule.cutOff; let dateEta = today.toDateString() + ' ' + schedule.estimatedTimeOfArrival; let mondayEta = today.toDateString() + ' ' + schedule.mondayETATime; let tuesdayEta = today.toDateString() + ' ' + schedule.tuesdayETATime; let wednesdayEta = today.toDateString() + ' ' + schedule.wednesdayETATime; let thursdayEta = today.toDateString() + ' ' + schedule.thursdayETATime; let fridayEta = today.toDateString() + ' ' + schedule.fridayETATime; let saturdayEta = today.toDateString() + ' ' + schedule.saturdayETATime; let sundayEta = today.toDateString() + ' ' + schedule.sundayETATime; let mondayCutOff = today.toDateString() + ' ' + schedule.mondayCutOffTime; let tuesdayCutOff = today.toDateString() + ' ' + schedule.tuesdayCutOffTime; let wednesdayCutOff = today.toDateString() + ' ' + schedule.wednesdayCutOffTime; let thursdayCutOff = today.toDateString() + ' ' + schedule.thursdayCutOffTime; let fridayCutOff = today.toDateString() + ' ' + schedule.fridayCutOffTime; let saturdayCutOff = today.toDateString() + ' ' + schedule.saturdayCutOffTime; let sundayCutOff = today.toDateString() + ' ' + schedule.sundayCutOffTime; this.eta = dateEta; //moment(today.toDateString() + " " + schedule.estimatedTimeOfArrival).tz(localStorage.getItem('timeZoneId')).toDate(); //moment(schedule.displayEta).tz(localStorage.getItem('timeZoneId')).toDate(); //today.setTime(schedule.estimatedTimeOfArrival); this.etaMonday = moment(mondayEta).toDate(); this.etaTuesday = moment(tuesdayEta).toDate(); this.etaWednesday = moment(wednesdayEta).toDate(); this.etaThursday = moment(thursdayEta).toDate(); this.etaFriday = moment(fridayEta).toDate(); this.etaSaturday = moment(saturdayEta).toDate(); this.etaSunday = moment(sundayEta).toDate(); this.cutOff = dateCutOff; //moment(today.toDateString() + " " + schedule.cutOff); //moment(schedule.displayCutOff).tz(localStorage.getItem('timeZoneId')).toDate(); //schedule.cutOff; this.cutOffMonday = moment(mondayCutOff).toDate(); this.cutOffTuesday = moment(tuesdayCutOff).toDate(); this.cutOffWednesday = moment(wednesdayCutOff).toDate(); this.cutOffThursday = moment(thursdayCutOff).toDate(); this.cutOffFriday = moment(fridayCutOff).toDate(); this.cutOffSaturday = moment(saturdayCutOff).toDate(); this.cutOffSunday = moment(sundayCutOff).toDate(); this.effectivityDate = schedule.effectivityDate.toDate(); if(schedule.sundayIsActive != true) { this.sundayActiveStatus = false; this.sunday_inactive_class = "btn btn-success"; this.sunday_active_class = "btn btn-light"; } else { this.sundayActiveStatus = true; this.sunday_active_class = "btn btn-success"; this.sunday_inactive_class = "btn btn-light"; } if(schedule.mondayIsActive != true) { this.mondayActiveStatus = false; this.monday_inactive_class = "btn btn-success"; this.monday_active_class = "btn btn-light"; } else { this.mondayActiveStatus = true; this.monday_active_class = "btn btn-success"; this.monday_inactive_class = "btn btn-light"; } if(schedule.tuesdayIsActive != true) { this.tuesdayActiveStatus = false; this.tuesday_inactive_class = "btn btn-success"; this.tuesday_active_class = "btn btn-light"; } else { this.tuesdayActiveStatus = true; this.tuesday_active_class = "btn btn-success"; this.tuesday_inactive_class = "btn btn-light"; } if(schedule.wednesdayIsActive != true) { this.wednesdayActiveStatus = false; this.wednesday_inactive_class = "btn btn-success"; this.wednesday_active_class = "btn btn-light"; } else { this.wednesdayActiveStatus = true; this.wednesday_active_class = "btn btn-success"; this.wednesday_inactive_class = "btn btn-light"; } if(schedule.thursdayIsActive != true) { this.thursdayActiveStatus = false; this.thursday_inactive_class = "btn btn-success"; this.thursday_active_class = "btn btn-light"; } else { this.thursdayActiveStatus = true; this.thursday_active_class = "btn btn-success"; this.thursday_inactive_class = "btn btn-light"; } if(schedule.fridayIsActive != true) { this.fridayActiveStatus = false; this.friday_inactive_class = "btn btn-success"; this.friday_active_class = "btn btn-light"; } else { this.fridayActiveStatus = true; this.friday_active_class = "btn btn-success"; this.friday_inactive_class = "btn btn-light"; } if(schedule.saturdayIsActive != true) { this.saturdayActiveStatus = false; this.saturday_inactive_class = "btn btn-success"; this.saturday_active_class = "btn btn-light"; } else { this.saturdayActiveStatus = true; this.saturday_active_class = "btn btn-success"; this.saturday_inactive_class = "btn btn-light"; } } } ngAfterViewInit() { //this.address = this.addressForm.address; } ngOnInit() { let maxcount = 1000; let that = this; this._routeDefinitionsServiceProxy.getAll( undefined, undefined, undefined, undefined, undefined, maxcount ).subscribe(result => { that.routeDefinitions = result.items; }); } ngOnChanges(){ } sundayIsActive($event): void { this.sundayActiveStatus = true; this.sunday_inactive_class = "btn btn-light"; this.sunday_active_class = "btn btn-success"; } sundayIsInActive($event): void { this.sundayActiveStatus = false; this.sunday_active_class = "btn btn-light"; this.sunday_inactive_class = "btn btn-success"; } mondayIsActive($event): void { this.mondayActiveStatus = true; this.monday_inactive_class = "btn btn-light"; this.monday_active_class = "btn btn-success"; } mondayIsInActive($event): void { this.mondayActiveStatus = false; this.monday_active_class = "btn btn-light"; this.monday_inactive_class = "btn btn-success"; } tuesdayIsActive($event): void { this.tuesdayActiveStatus = true; this.tuesday_inactive_class = "btn btn-light"; this.tuesday_active_class = "btn btn-success"; } tuesdayIsInActive($event): void { this.tuesdayActiveStatus = false; this.tuesday_active_class = "btn btn-light"; this.tuesday_inactive_class = "btn btn-success"; } wednesdayIsActive($event): void { this.wednesdayActiveStatus = true; this.wednesday_inactive_class = "btn btn-light"; this.wednesday_active_class = "btn btn-success"; } wednesdayIsInActive($event): void { this.wednesdayActiveStatus = false; this.wednesday_active_class = "btn btn-light"; this.wednesday_inactive_class = "btn btn-success"; } thursdayIsActive($event): void { this.thursdayActiveStatus = true; this.thursday_inactive_class = "btn btn-light"; this.thursday_active_class = "btn btn-success"; } thursdayIsInActive($event): void { this.thursdayActiveStatus = false; this.thursday_active_class = "btn btn-light"; this.thursday_inactive_class = "btn btn-success"; } fridayIsActive($event): void { this.fridayActiveStatus = true; this.friday_inactive_class = "btn btn-light"; this.friday_active_class = "btn btn-success"; } fridayIsInActive($event): void { this.fridayActiveStatus = false; this.friday_active_class = "btn btn-light"; this.friday_inactive_class = "btn btn-success"; } saturdayIsActive($event): void { this.saturdayActiveStatus = true; this.saturday_inactive_class = "btn btn-light"; this.saturday_active_class = "btn btn-success"; } saturdayIsInActive($event): void { this.saturdayActiveStatus = false; this.saturday_active_class = "btn btn-light"; this.saturday_inactive_class = "btn btn-success"; } save(): void { //this.saving = true; console.log(this.scheduleInput); this.scheduleInput.routeCode = (document.getElementById('routeDefinition')).value; //$("#routeDefinition option:selected").text(); //(document.getElementById('routeDefinition')).value; this.scheduleInput.routeTypeId = Number((document.getElementById('routeType')).value); this.designation = (document.getElementById('designations')).value; if(this.designation == 'willCall') { this.scheduleInput.willCall = true; this.scheduleInput.automatic = false; } else if(this.designation == 'auto') { this.scheduleInput.automatic = true; this.scheduleInput.willCall = false; } //this.scheduleInput.etaTime = moment(this.eta).format("HH:mm:ss.SSS"); //this.scheduleInput.cutOffTime = moment(this.cutOff).format("HH:mm:ss.SSS"); this.scheduleInput.effectivityDate = moment(this.effectivityDate).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.locationId = Number(localStorage.getItem('operatingLocationId')); if(this.scheduleId == undefined) { this.input.clinicId = this.clinicId; this.scheduleInput.createRouteSchedule = this.input; } if(this.scheduleInput.dateEtaLocked != null || this.scheduleInput.dateEtaLocked != undefined) { this.scheduleInput.dateEtaLocked = moment.utc(this.scheduleInput.dateEtaLocked); } if(this.scheduleInput.oorRate == null) { this.scheduleInput.oorRate = 0; } if(this.scheduleInput.serviceTime == null) { this.scheduleInput.oorRate = 0; } //var isoDate = new Date(this.eta).toISOString(); var etaMoment = moment(this.eta).tz(localStorage.getItem('timeZoneId')); var mondayEtaMoment = moment(this.etaMonday).tz(localStorage.getItem('timeZoneId')); var tuesdayEtaMoment = moment(this.etaTuesday).tz(localStorage.getItem('timeZoneId')); var wednesdayEtaMoment = moment(this.etaWednesday).tz(localStorage.getItem('timeZoneId')); var thursdayEtaMoment = moment(this.etaThursday).tz(localStorage.getItem('timeZoneId')); var fridayEtaMoment = moment(this.etaFriday).tz(localStorage.getItem('timeZoneId')); var saturdayEtaMoment = moment(this.etaSaturday).tz(localStorage.getItem('timeZoneId')); var sundayEtaMoment = moment(this.etaSunday).tz(localStorage.getItem('timeZoneId')); var cutOffMoment = moment(this.cutOff).tz(localStorage.getItem('timeZoneId')); var mondayCutOffMoment = moment(this.cutOffMonday).tz(localStorage.getItem('timeZoneId')); var tuesdayCutOffMoment = moment(this.cutOffTuesday).tz(localStorage.getItem('timeZoneId')); var wednesdayCutOffMoment = moment(this.cutOffWednesday).tz(localStorage.getItem('timeZoneId')); var thursdayCutOffMoment = moment(this.cutOffThursday).tz(localStorage.getItem('timeZoneId')); var fridayCutOffMoment = moment(this.cutOffFriday).tz(localStorage.getItem('timeZoneId')); var saturdayCutOffMoment = moment(this.cutOffSaturday).tz(localStorage.getItem('timeZoneId')); var sundayCutOffMoment = moment(this.cutOffSunday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.estimatedTimeOfArrival = etaMoment; this.scheduleInput.etaTime = new Date(etaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.cutOff = new Date(cutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; /* this.scheduleInput.mondayETATime = mondayEtaMoment; this.scheduleInput.tuesdayETATime = tuesdayEtaMoment; this.scheduleInput.wednesdayETATime = wednesdayEtaMoment; this.scheduleInput.thursdayETATime = thursdayEtaMoment; this.scheduleInput.fridayETATime = fridayEtaMoment; this.scheduleInput.saturdayETATime = saturdayEtaMoment; this.scheduleInput.sundayETATime = sundayEtaMoment; this.scheduleInput.mondayCutOffTime = mondayCutOffMoment; this.scheduleInput.tuesdayCutOffTime = tuesdayCutOffMoment; this.scheduleInput.wednesdayCutOffTime = wednesdayCutOffMoment; this.scheduleInput.thursdayCutOffTime = thursdayCutOffMoment; this.scheduleInput.fridayCutOffTime = fridayCutOffMoment; this.scheduleInput.saturdayCutOffTime = saturdayCutOffMoment; this.scheduleInput.sundayCutOffTime = sundayCutOffMoment;*/ this.scheduleInput.mondayETATime = new Date(mondayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.tuesdayETATime = new Date(tuesdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.wednesdayETATime = new Date(wednesdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.thursdayETATime = new Date(thursdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.fridayETATime = new Date(fridayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.saturdayETATime = new Date(saturdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.sundayETATime = new Date(sundayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.cutOffTime = new Date(cutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.mondayCutOffTime = new Date(mondayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" })as any; this.scheduleInput.tuesdayCutOffTime = new Date(tuesdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.wednesdayCutOffTime = new Date(wednesdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.thursdayCutOffTime = new Date(thursdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.fridayCutOffTime = new Date(fridayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.saturdayCutOffTime = new Date(saturdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.sundayCutOffTime = new Date(sundayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: false, hour: "numeric", minute: "numeric", second: "numeric" }) as any; // //this.scheduleInput.estimatedTimeOfArrival = moment(etaMoment.toDate().toDateString() + " " + this.scheduleInput.etaTime); // //this.scheduleInput.cutOff = moment(cutOffMoment.toDate().toDateString() + " " + this.scheduleInput.cutOffTime); this.scheduleInput.sundayIsActive = this.sundayActiveStatus; this.scheduleInput.mondayIsActive = this.mondayActiveStatus; this.scheduleInput.tuesdayIsActive = this.tuesdayActiveStatus; this.scheduleInput.wednesdayIsActive = this.wednesdayActiveStatus; this.scheduleInput.thursdayIsActive = this.thursdayActiveStatus; this.scheduleInput.fridayIsActive = this.fridayActiveStatus; this.scheduleInput.saturdayIsActive = this.saturdayActiveStatus; this._routeScheduleDetailsServiceProxy.createOrEdit(this.scheduleInput) .pipe(finalize(() => { this.saving = false; })) .subscribe(() => { this.notify.info(this.l('SavedSuccessfully')); this.modalSave.emit(null); this.close(); }); } close(): void { this.eta = null; this.showSchedule = false; this.effectivityDate = null; this.etaSunday = null; this.cutOffSunday = null; this.etaMonday = null; this.cutOffMonday = null; this.etaTuesday = null; this.cutOffTuesday = null; this.etaWednesday = null; this.cutOffWednesday = null; this.etaThursday = null; this.cutOffThursday = null; this.etaFriday = null; this.cutOffFriday = null; this.etaSaturday = null; this.cutOffSaturday = null; this.cutOff = null; this.scheduleInput = new CreateOrEditRouteScheduleDetailDto; this.edit = false; //this.scheduleInput = null; this.active = false; this.modalSave.emit(null); this.modal.hide(); //this.scheduleInput.routeCode = null; //this.scheduleInput.routeTypeId = null; } getAllDropDown() { let maxcount = 1000; let that = this; jQuery(document).ready(function () { $('.kt-select2').select2(); $('.select2-container').css('width', '100%'); }); this._routeDefinitionsServiceProxy.getAllRouteTypeForLookupTable( undefined, undefined, undefined, maxcount ).subscribe(result => { that.routeTypes = result.items; }); } }