import { Component, EventEmitter, Injector, ViewChild, Output, Input } from '@angular/core'; import { AppComponentBase } from '@shared/common/app-component-base'; import { ModalDirective } from 'ngx-bootstrap'; 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'; // import * as DualListbox from 'dual-listbox'; @Component({ templateUrl: './clinic-notes.component.html', selector: 'clinicNotes' }) export class ClinicNotes extends AppComponentBase { @ViewChild('clinicNotesModal', { static: true }) modal: ModalDirective; @Output() modalSave: EventEmitter = new EventEmitter(); @Input() refreshRoute: Function // @Input() orderId: any // @Input() clinicId:any active = false; saving = false; notes: string clinicId: number; orderId: number driverVisibility: any; clinicNotesVisibleToDriver: boolean; params: ControllerGetOrderIdForNoteInput = new ControllerGetOrderIdForNoteInput(); constructor( injector: Injector, private _controllerRouteDetails: ControllerRouteDetailServiceProxy, ) { super(injector); } ngOnInit() { } show(notes: string, clinicNotesVisibleToDriver: boolean, orderId: number) { this.orderId = orderId; this.clinicNotesVisibleToDriver = clinicNotesVisibleToDriver; this.notes = notes; this.active = true; this.modal.show(); } save() { 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(); } }