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

@Component({
    selector: 'viewOrderPackageModal',
    templateUrl: './view-orderPackage-modal.component.html'
})
export class ViewOrderPackageModalComponent extends AppComponentBase {

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

    active = false;
    saving = false;

    item: GetOrderPackageForViewDto;


    constructor(
        injector: Injector
    ) {
        super(injector);
        this.item = new GetOrderPackageForViewDto();
        this.item.orderPackage = new OrderPackageDto();
    }

    show(item: GetOrderPackageForViewDto): void {
        this.item = item;
        console.log(this.item.orderPackage.package.id);
        this.active = true;
        this.modal.show();
    }

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