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

@Component({
  selector: 'app-pl-std-record-time',
  templateUrl: './pl-std-record-time.component.html',
  styleUrls: ['./pl-std-record-time.component.scss']
})
export class PlStdRecordTimeComponent extends FlexTableComponent implements OnInit {

  public query = {
    query: "",
    year_code:"",
    apply_form:""
  };
  QUERY_URL = "pl/plStdRecordTime/page.htm";
  ADD_URL = "pl/plStdRecordTime/add.htm";
  DELETE_URL= "pl/plStdRecordTime/delete.htm";
  GET_URL= "pl/plStdRecordTime/get.htm";
  EDIT_URL= "pl/plStdRecordTime/edit.htm";
  YEAR_URL = "pl/plYearCode/list.htm";

  yearArray = [] ;

  constructor(public bsModalService: BsModalService, fb: FormBuilder) {
    super();
    this.formModel = fb.group({
      id: [null],
      year_code: [null,  Validators.required],
      apply_form: [null, Validators.required],
      start_time: [null, Validators.required],
      end_time: [null, Validators.required]
    });
   }

  ngOnInit() {
    FrameRequest.requestArray(this.YEAR_URL, {}, (array) => {
       this.yearArray = array;
    });
  }

}
