import { Component, OnInit } from "@angular/core";
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { ModalController } from "@ionic/angular";
import { WorkListAttachViewComponent } from "src/app/notification/work-list-attach-view/work-list-attach-view.component";
import { AbsenceAttahcment } from "../models/abs.attach";
import { AbsenceAttahcmentResponse } from "../models/abs.attach.response";
@Component({
  selector: "app-view-attachments",
  templateUrl: "./view-attachments.component.html",
  styleUrls: ["./view-attachments.component.scss"]
})
export class ViewAttachmentsComponent implements OnInit {
  AttachmentList: AbsenceAttahcment[];
  constructor(
    public common: CommonService,
    public modalCtrl: ModalController,
    private ts: TranslatorService
  ) {}

  ngOnInit() {
    this.AttachmentList = this.common.sharedService.getSharedData(
      AbsenceAttahcmentResponse.SHARED_DATA
    );
  }
  async OpenAttachFiles(value, Type) {
    this.common.sharedService.setSharedData(
      { displayData: value, TypeData: Type },
      "WorkListAttachViewPage"
    );
    const modal = await this.modalCtrl.create({
      component: WorkListAttachViewComponent
    });

    modal.onDidDismiss().then(data => {});

    return await modal.present();
  }
}
