import {Component, OnInit} from '@angular/core';
import {FramePageComponent} from "../../../frame/core/page/frame.page";
import {BsModalService} from "ngx-bootstrap/modal";
import {FuncService} from 'src/app/core/service/func.service';

@Component({
  selector: 'app-std-ticket',
  templateUrl: './std-ticket-count.component.html',
  styleUrls: ['./std-ticket-count.component.scss']
})
export class StdTicketCountComponent extends FramePageComponent implements OnInit {
  schoolArray = [];

  query = {
    school_id: '',

  }

  constructor(private modalService: BsModalService) {
    super(modalService);
  }

  ngOnInit() {
    this.AjaxService.requestArray('./cf/school/list.htm', {}, (array) => {
      this.schoolArray = array;
      if (this.schoolArray.length == 1) {
        this.query.school_id = this.schoolArray[0].school_id;
        this.requestData();
      }
    });

  }


  requestData() {
    setTimeout(()=>{this.pager.reload(this.query)},100);

  }


  export(batch_id: any) {
    FuncService.ajaxDownload('std/ticket/undownload/export.htm', {batch_id: batch_id, school_id: this.query.school_id});
  }
}
