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: './order-notes.component.html', selector: 'orderNotes' }) export class OrderNotes extends AppComponentBase { @ViewChild('orderNotesModal', { 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; notesVisibleToDriver: boolean; params: ControllerGetOrderIdForNoteInput = new ControllerGetOrderIdForNoteInput(); constructor( injector: Injector, private _controllerRouteDetails: ControllerRouteDetailServiceProxy, ) { super(injector); } ngOnInit() { } show(notes: string, notesVisibleToDriver: boolean, orderId: number) { this.orderId = orderId; this.notesVisibleToDriver = notesVisibleToDriver; this.notes = notes; this.active = true; console.log(this.notesVisibleToDriver) this.modal.show(); } save() { let params = new OrderNotesInput({ orderId: this.orderId, clinicNotesVisibleToDriver: false, notesVisibleToDriver: this.notesVisibleToDriver, 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.notesVisibleToDriver == true) { this.notesVisibleToDriver = false; } else { this.notesVisibleToDriver = true; } } onShown(): void { } close() { this.active = false; this.modal.hide(); } }