import { Component, EventEmitter, Injector, ViewChild, Output, Input } from '@angular/core'; import { AppComponentBase } from '@shared/common/app-component-base'; import { ModalDirective } from 'ngx-bootstrap'; import { AppLocalizationService } from '@app/shared/common/localization/app-localization.service'; //import { RouteDetailComponent } from './route-detail.component'; //import { ControllerRouteDetailServiceProxy, ControllerGetOrderIdForNoteInput,OrderNotesInput } from '@shared/service-proxies/service-proxies'; import { PrimengTableHelper } from 'shared/helpers/PrimengTableHelper'; import { finalize } from 'rxjs/operators'; import * as jquery from 'jquery'; import * as moment from 'moment'; @Component({ templateUrl: './edit-count-notes.component.html', selector: 'editCountNotes' }) export class EditCountNotes extends AppComponentBase { @ViewChild('editCountNotesModal', { static: true }) modal: ModalDirective; //@ViewChild('routeDetail' , { static: false}) public routeDetail: RouteDetailComponent; @Output() saveCount: EventEmitter = new EventEmitter(); @Input() refreshRoute: Function active = false; saving = false; isView = false; notes: string //params: ControllerGetOrderIdForNoteInput = new ControllerGetOrderIdForNoteInput(); constructor( injector: Injector, private _appLocalizationService: AppLocalizationService, //private _controllerRouteDetails: ControllerRouteDetailServiceProxy, ) { super(injector); } ngOnInit() { } show(notes:string, isView: boolean) { // this.orderId = orderId; // this.clinicNotesVisibleToDriver = clinicNotesVisibleToDriver; this.notes = notes; this.isView = isView; this.active = true; this.modal.show(); } save() { let notes = String((document.getElementById('notes')).value); if(notes != ""){ this.close(); this.saveCount.emit(notes); } else{ this.message.info(this._appLocalizationService.l('EditCountError'),this._appLocalizationService.l('EditCount')); } // let params = new OrderNotesInput({ // orderId: this.orderId, // clinicNotesVisibleToDriver: this.clinicNotesVisibleToDriver, // notesVisibleToDriver: false, // notes: String((document.getElementById('notes')).value) // }); // this._controllerRouteDetails.updateOrderNotes( // params // ).subscribe(() => { // this.notify.info(this.l('SavedSuccessfully')); // this.close(); // this.modalSave.emit(null); // }) } // visibilityTrigger() { // if (this.clinicNotesVisibleToDriver == true) { // this.clinicNotesVisibleToDriver = false; // } // else { // this.clinicNotesVisibleToDriver = true; // } // } onShown(): void { } close() { this.active = false; this.modal.hide(); } }