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, GetAllRouteDefinitionsInput, RouteTemplateServiceProxy } 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'; import { CommonLookupModalComponent } from '@app/shared/common/lookup/common-lookup-modal.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 implements OnInit{ @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective; @ViewChild('routeCodeList', {static: true}) routeCodeList: CommonLookupModalComponent; @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; routeTypeName :any; cutOff: any; cutOffMonday: any; cutOffTuesday: any; cutOffWednesday: any; cutOffThursday: any; cutOffFriday: any; cutOffSaturday: any; cutOffSunday: any; effectivityDate: any; sundayIsAuto: any; mondayIsAuto: any; tuesdayIsAuto: any; wednesdayIsAuto: any; thursdayIsAuto: any; fridayIsAuto: any; saturdayIsAuto: any; sundayIsCallIn: any; mondayIsCallIn: any; tuesdayIsCallIn: any; wednesdayIsCallIn: any; thursdayIsCallIn: any; fridayIsCallIn: any; saturdayIsCallIn: any; sundayIsLTA: any; mondayIsLTA: any; tuesdayIsLTA: any; wednesdayIsLTA: any; thursdayIsLTA: any; fridayIsLTA: any; saturdayIsLTA: any; ltaMonday: any; ltaTuesday: any; ltaWednesday: any; ltaThursday: any; ltaFriday: any; ltaSaturday: any; ltaSunday: any; //dates: Date; clinicId: any; scheduleId: any; showSchedule: boolean; isSaturday: boolean = false; isSunday: boolean = false; showSearch : boolean; txtRouteCodeFilter : string; routeTemplateId : number; constructor( injector: Injector, private _clinicsServiceProxy: ClinicsServiceProxy, private _routeDefinitionsServiceProxy: RouteDefinitionsServiceProxy, private _routeTemplatesServiceProxy: RouteTemplateServiceProxy, private _routeScheduleDetailsServiceProxy: RouteScheduleDetailsServiceProxy, private _routeSchedulesServiceProxy: RouteSchedulesServiceProxy, private _routeTypesServiceProxy: RouteTypesServiceProxy, private _addressService: AddressServiceProxy, private _emailService: EmailServiceProxy, ) { super(injector); } routeCodeModalInit(){ this.routeCodeList.configure({ title: this.l('Select Stop'), dataSource: (skipCount: number, maxResultCount: number, filter: string, tenantId?: number, locationId?:number) => { let input = new GetAllRouteDefinitionsInput(); input.filter = filter; input.maxResultCount = maxResultCount; input.skipCount = skipCount; return this._routeDefinitionsServiceProxy.showPagedRouteDefinitionForSearch(input); } }); } getRoute(routeFilter){ this.routeCodeList.show(); this.routeCodeList.filterText = routeFilter; } clearRoute(){ this.showSearch = true; this.txtRouteCodeFilter = ''; this.routeTemplateId = null; this.scheduleInput.routeTemplateId = null; } selectRouteCode(item){ var templateId = item.value; this.getRouteCode(templateId) //this.getClinicWithRoute(orderId); } getRouteCode(templateId){ this._routeTemplatesServiceProxy.getRouteTemplateById(templateId) .subscribe(result => { this.routeTemplateId = result.routeTemplateId; this.txtRouteCodeFilter = result.routeTemplateName + ' - ' + result.location; this.showSearch = false; this.scheduleInput.routeTemplateId = result.routeTemplateId; this.scheduleInput.routeCode = result.routeTemplateName; this.scheduleInput.routeTypeId = result.routeTemplateId; console.log(result); }); } // public etaOnChange(value: Date): void { // console.log(value); // } show(schedule?: any, routeScheduleId?: any, clinicId?: any): void { let today = new Date(); this.showSchedule = true; let that = this; this.clinicId = clinicId; this.scheduleId = routeScheduleId; 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.sundayIsAuto = true; this.saturdayIsAuto = true; this.fridayIsAuto = true; this.thursdayIsAuto = true; this.wednesdayIsAuto = true; this.tuesdayIsAuto = true; this.mondayIsAuto = true; this.sundayIsCallIn = false; this.mondayIsCallIn = false; this.tuesdayIsCallIn = false; this.wednesdayIsCallIn = false; this.thursdayIsCallIn = false; this.fridayIsCallIn = false; this.saturdayIsCallIn = false; this.sundayIsLTA = false; this.mondayIsLTA = false; this.tuesdayIsLTA = false; this.wednesdayIsLTA = false; this.thursdayIsLTA = false; this.fridayIsLTA = false; this.saturdayIsLTA = false; this.eta = today; this.cutOff = today; this.showSearch = true; this.txtRouteCodeFilter = ''; this.getAllDropDown(); this.active = true; this.modal.show(); } else { console.log(schedule) this.getRouteCode(schedule.routeTemplateId) today = moment(schedule.today).tz(localStorage.getItem('timeZoneId')).toDate(); this.scheduleInput = schedule; this.routeTypeName = schedule.routeTypeName; 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; let mondayLTA = today.toDateString() + ' ' + schedule.mondayLTA; let tuesdayLTA = today.toDateString() + ' ' + schedule.tuesdayLTA; let wednesdayLTA = today.toDateString() + ' ' + schedule.wednesdayLTA; let thursdayLTA = today.toDateString() + ' ' + schedule.thursdayLTA; let fridayLTA = today.toDateString() + ' ' + schedule.fridayLTA; let saturdayLTA = today.toDateString() + ' ' + schedule.saturdayLTA; let sundayLTA = today.toDateString() + ' ' + schedule.sundayLTA; 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.sundayIsLTA = schedule.sundayLTA == "" ? false : true; this.mondayIsLTA = schedule.mondayLTA == "" ? false : true; this.tuesdayIsLTA = schedule.tuesdayLTA == "" ? false : true; this.wednesdayIsLTA = schedule.wednesdayLTA == "" ? false : true; this.thursdayIsLTA = schedule.thursdayLTA == "" ? false : true; this.fridayIsLTA = schedule.fridayLTA == "" ? false : true; this.saturdayIsLTA = schedule.saturdayLTA == "" ? false : true; this.ltaMonday = moment(mondayLTA).toDate(); this.ltaTuesday = moment(tuesdayLTA).toDate(); this.ltaWednesday = moment(wednesdayLTA).toDate(); this.ltaThursday = moment(thursdayLTA).toDate(); this.ltaFriday = moment(fridayLTA).toDate(); this.ltaSaturday = moment(saturdayLTA).toDate(); this.ltaSunday = moment(sundayLTA).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(); this.sundayIsAuto = schedule.sundayIsAuto == 1 ? true : false; this.saturdayIsAuto = schedule.saturdayIsAuto == 1 ? true : false; this.fridayIsAuto = schedule.fridayIsAuto == 1 ? true : false; this.thursdayIsAuto = schedule.thursdayIsAuto == 1 ? true : false; this.wednesdayIsAuto = schedule.wednesdayIsAuto == 1 ? true : false; this.tuesdayIsAuto = schedule.tuesdayIsAuto == 1 ? true : false; this.mondayIsAuto = schedule.mondayIsAuto == 1 ? true : false; this.sundayIsCallIn = schedule.sundayIsAuto == 0 ? true : false; this.saturdayIsCallIn = schedule.saturdayIsAuto == 0 ? true : false; this.fridayIsCallIn = schedule.fridayIsAuto == 0 ? true : false; this.thursdayIsCallIn = schedule.thursdayIsAuto == 0 ? true : false; this.wednesdayIsCallIn = schedule.wednesdayIsAuto == 0 ? true : false; this.tuesdayIsCallIn = schedule.tuesdayIsAuto == 0 ? true : false; this.mondayIsCallIn = schedule.mondayIsAuto == 0 ? true : false; console.log(this.sundayIsCallIn); } } ngAfterViewInit() { } ngOnInit() { this.routeCodeModalInit(); // let maxcount = 2000; // let that = this; // this._routeDefinitionsServiceProxy.getAll( // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // maxcount // ).subscribe(result => { // that.routeDefinitions = result.items; // }); } ngOnChanges() { } save(): void { //this.scheduleInput.routeCode = (document.getElementById('routeDefinition')).value; //$("#routeDefinition option:selected").text(); //(document.getElementById('routeDefinition')).value; // if(!this.edit){ // 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: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.cutOff = new Date(cutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.mondayETATime = new Date(mondayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.tuesdayETATime = new Date(tuesdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.wednesdayETATime = new Date(wednesdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.thursdayETATime = new Date(thursdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.fridayETATime = new Date(fridayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.saturdayETATime = new Date(saturdayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; // if(this.etaSunday != null) { this.scheduleInput.sundayETATime = new Date(sundayEtaMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; // console.log('pasok'); // } // else{ // this.scheduleInput.sundayETATime = null; // } this.scheduleInput.cutOffTime = new Date(cutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.mondayCutOffTime = new Date(mondayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.tuesdayCutOffTime = new Date(tuesdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.wednesdayCutOffTime = new Date(wednesdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.thursdayCutOffTime = new Date(thursdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.fridayCutOffTime = new Date(fridayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.saturdayCutOffTime = new Date(saturdayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; this.scheduleInput.sundayCutOffTime = new Date(sundayCutOffMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; //#region if (this.sundayIsAuto) { this.scheduleInput.sundayIsAuto = 1; } if (this.saturdayIsAuto) { this.scheduleInput.saturdayIsAuto = 1; } if (this.fridayIsAuto) { this.scheduleInput.fridayIsAuto = 1; } if (this.thursdayIsAuto) { this.scheduleInput.thursdayIsAuto = 1; } if (this.wednesdayIsAuto) { this.scheduleInput.wednesdayIsAuto = 1; } if (this.tuesdayIsAuto) { this.scheduleInput.tuesdayIsAuto = 1; } if (this.mondayIsAuto) { this.scheduleInput.mondayIsAuto = 1; } if (this.sundayIsCallIn) { this.scheduleInput.sundayIsAuto = 0; } if (this.saturdayIsCallIn) { this.scheduleInput.saturdayIsAuto = 0; } if (this.fridayIsCallIn) { this.scheduleInput.fridayIsAuto = 0; } if (this.thursdayIsCallIn) { this.scheduleInput.thursdayIsAuto = 0; } if (this.wednesdayIsCallIn) { this.scheduleInput.wednesdayIsAuto = 0; } if (this.tuesdayIsCallIn) { this.scheduleInput.tuesdayIsAuto = 0; } if (this.mondayIsCallIn) { this.scheduleInput.mondayIsAuto = 0; } if (!this.sundayIsCallIn && !this.sundayIsAuto) { this.scheduleInput.sundayIsAuto = null; } if (!this.saturdayIsAuto && !this.saturdayIsCallIn) { this.scheduleInput.saturdayIsAuto = null; } if (!this.fridayIsAuto && !this.fridayIsCallIn) { this.scheduleInput.fridayIsAuto = null; } if (!this.thursdayIsCallIn && !this.thursdayIsAuto) { this.scheduleInput.thursdayIsAuto = null; } if (!this.wednesdayIsCallIn && !this.wednesdayIsAuto) { this.scheduleInput.wednesdayIsAuto = null; } if (!this.tuesdayIsAuto && !this.tuesdayIsCallIn) { this.scheduleInput.tuesdayIsAuto = null; } if (!this.mondayIsAuto && !this.mondayIsCallIn) { this.scheduleInput.mondayIsAuto = null; } //#endregion //#region if (!this.sundayIsLTA) { this.scheduleInput.sundayLTA = null; }else{ var sundayLTAMoment = moment(this.ltaSunday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.sundayLTA = new Date(sundayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.saturdayIsLTA) { this.scheduleInput.saturdayLTA = null; }else{ var saturdayLTAMoment = moment(this.ltaSaturday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.saturdayLTA = new Date(saturdayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.fridayIsLTA) { this.scheduleInput.fridayLTA = null; }else{ var fridayLTAMoment = moment(this.ltaFriday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.fridayLTA = new Date(fridayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.thursdayIsLTA) { this.scheduleInput.thursdayLTA = null; }else{ var thursdayLTAMoment = moment(this.ltaThursday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.thursdayLTA = new Date(thursdayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.wednesdayIsLTA) { this.scheduleInput.wednesdayLTA = null; }else{ var wednesdayLTAMoment = moment(this.ltaWednesday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.wednesdayLTA = new Date(wednesdayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.tuesdayIsLTA) { this.scheduleInput.tuesdayLTA = null; }else{ var tuesdayLTAMoment = moment(this.ltaTuesday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.tuesdayLTA = new Date(tuesdayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } if (!this.mondayIsLTA) { this.scheduleInput.mondayLTA = null; }else{ var mondayLTAMoment = moment(this.ltaMonday).tz(localStorage.getItem('timeZoneId')); this.scheduleInput.mondayLTA = new Date(mondayLTAMoment.format()).toLocaleTimeString('en-US', { hour12: true, hour: "numeric", minute: "numeric", second: "numeric" }) as any; } //#endregion 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; }); } changed(e,it,at){ if(this[it] && this[at]){ this[at] = false; } } }