import {Component, OnInit, ViewChild} from '@angular/core';
import {FramePageComponent} from "../../../frame/core/page/frame.page";
import {BsModalService} from "ngx-bootstrap/modal";
import { AjaxService } from '../../../../core/service/ajax.service';
import { MsgService } from '../../../../core/service/msg.service';
import { FramePager } from '../../../../core/frame/pager/frame-pager/frame-pager';
import { CfPromiseDetailComponent } from '../promise-detail/promise-detail.component';

@Component({
  selector: 'app-cf-promise-page',
  templateUrl: './promise-page.component.html',
  styleUrls: ['./promise-page.component.scss']
})
export class CfPromisePageComponent extends FramePageComponent implements OnInit {
  schoolArray = [];
  query = {
    school_id : ''
  };
  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = CfPromiseDetailComponent;
  }

  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.pager.pagerParams["school_id"] = this.query.school_id;
        this.pager.reload();
      }
    });
  }



}
