import { Component, ViewChild, Injector, Output, EventEmitter } from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap';
import { GetClinicForViewDto, ClinicDto } from '@shared/service-proxies/service-proxies';
import { AppComponentBase } from '@shared/common/app-component-base';

@Component({
    selector: 'viewClinicModal',
    templateUrl: './view-clinic-modal.component.html'
})
export class ViewClinicModalComponent extends AppComponentBase {

    @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective;
    @Output() modalSave: EventEmitter<any> = new EventEmitter<any>();

    active = false;
    saving = false;

    item: GetClinicForViewDto;


    constructor(
        injector: Injector
    ) {
        super(injector);
        this.item = new GetClinicForViewDto();
        this.item.clinic = new ClinicDto();
    }

    show(item: GetClinicForViewDto): void {
        this.item = item;
        this.active = true;
        console.log(this.item);
        this.modal.show();
    }

    close(): void {
        this.active = false;
        this.modal.hide();
    }
}
