import { Component, OnInit } from '@angular/core';
import { FlexTableComponent } from '../../../../../shared/common/FlexTable.component';
import { FrameRequest } from '../../../../../shared/frame/frame-request';
import { FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'app-kw-special-examroom',
  templateUrl: './kw-special-examroom.component.html',
  styleUrls: ['./kw-special-examroom.component.scss']
})
export class KwSpecialExamroomComponent extends FlexTableComponent implements OnInit {

  query = {
    query: '',
    exam_time_id: ''
  }
  QUERY_URL = "kw/kwSpecialExamRoom/page.htm";
  DELETE_URL = "kw/kwSpecialExamRoom/delete.htm";
  GET_URL = "kw/kwSpecialExamRoom/get.htm";
  ADD_URL = "kw/kwSpecialExamRoom/add.htm";
  EDIT_URL = "kw/kwSpecialExamRoom/edit.htm";
  EXAM_TIME_URL = "pl/plExamTime/listtime.htm";
  SPECIAL_COURSE_URL = "pl/plCourse/listSpecial.htm";
  examtimeList = [];

  constructor() { 
    super();
    const fb = new FormBuilder();
    this.formModel = fb.group({
      id: [''],
      room_capacity: ['',Validators.required],
      course_id: ['',Validators.required],
      start_time: ['',Validators.required],
      end_time: ['',Validators.required],
      remark: ['']
    });
  }

  ngOnInit() {
    FrameRequest.requestArray(this.EXAM_TIME_URL, {}, (arrary) => {
      this.examtimeList = arrary;
    });
  }

}
