import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from 'src/app/routes/frame/core/detail/frame.detail';
import { FramePageComponent } from 'src/app/routes/frame/core/page/frame.page';
import { InitialReviewPdfLookComponent } from '../initial-review-pdf-look/initial-review-pdf-look.component';
import { InitialReviewImageLookComponent } from '../initial-review-image-look/initial-review-image-look.component';
import { FramePager } from 'src/app/core/frame/pager/frame-pager/frame-pager';

@Component({
  selector: 'app-initial-review-reject-file',
  templateUrl: './initial-review-reject-file.component.html',
  styleUrls: ['./initial-review-reject-file.component.scss']
})
export class InitialReviewRejectFileComponent extends FrameDetailComponent  implements OnInit {

  rejectList = [];

  @ViewChild('inroomPager', {static: false}) inroomPager: FramePager;

  constructor(private modalService: BsModalService, private detectRef: ChangeDetectorRef) { 
    super(modalService);
  }

  ngOnInit(): void {
    this.AjaxService.requestArray('review/initial/reject/list.htm', {detail_id: this.ResponseEntity.detail_id, std_id: this.ResponseEntity.std_id}, (array) => {
      this.rejectList = array;
    });
  }


  showMaterilRejectModal(v) {
    let imageList = [];
      if(v.log_type=='pdf') {
        v.file_path = v.log_value;
        this.framePageComponent.showComponentModal(InitialReviewPdfLookComponent, { 'ResponseEntity': v }, {class: 'modal-9p'});
      } else if(v.log_type.toLowerCase().indexOf('jpg') >= 0 || v.log_type.toLowerCase().indexOf('png') >= 0) {
        imageList.push( v.log_value);
      }
    //图片显示
    if (imageList.length > 0) {
      v.imageList = imageList;
      this.framePageComponent.showComponentModal(InitialReviewImageLookComponent, { 'ResponseEntity': v }, {class: 'modal-7p'});
    }
  }

}
