import { Component, OnInit, ViewChild } from "@angular/core";
import { FlexTableComponent } from "../../../../shared/common/FlexTable.component";
import { FormBuilder, Validators } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { BsModalService } from "ngx-bootstrap/modal";

@Component({
  selector: "app-std-reg-info",
  templateUrl: "./std-reg-info.component.html",
  styleUrls: ["./std-reg-info.component.scss"]
})
export class StdRegInfoComponentM implements OnInit {
  
  @ViewChild('FlexTable1')
  flexTable1:FlexTableComponent;

  constructor(
    public bsModalService: BsModalService,
    public  fb: FormBuilder
  ) {
  }

  ngOnInit() {
  }

  initFlextTable(page,ft){
    ft.framePager = page;
    //ExpressionChangedAfterItHasBeenCheckedError 解决方案
    setTimeout(() => {
      ft.query = {
        "std_name": "",
        "cert_no": "",
        "enrol_no": "",
        "belong_city_id": "",
      };
  
      // ft.QUERY_URL = "std/stdRegInfo/page.htm";
      ft.DELETE_URL = "std/stdRegInfo/delete.htm";
      ft.GET_URL = "std/stdRegInfo/get.htm";
      ft.ADD_URL = "std/stdRegInfo/add.htm";
      ft.EDIT_URL = "std/stdRegInfo/edit.htm";

      ft.search = (param)=>{

      }

      ft.preGoEditEvent = async (entity)=>{
        return;
      };

      ft.formModel = this.fb.group({
        std_name: [null, Validators.compose([Validators.required])],
        std_eng_name: [null],
        enrol_no: [null, Validators.compose([Validators.required])],
        cert_no: [null, Validators.compose([Validators.required])],
        school_code: [null],
        std_sex: [null],
        ticket_no: [null],
        std_nation: [null],
        belong_city_id: [null],
        std_occupation: [null],
        std_birth: [null],
        enrol_county_city: [null],
        std_mobile: [null],
        learn_form: [null],
        enrol_place: [null, Validators.compose([Validators.required])],
        political_status: [null],
        std_email: [null],
        std_family_reg: [null],
        old_ticket_no1: [null],
        std_postcode: [null],
        std_source: [null],
        std_address: [null],
        assist_attr: [null],
        std_healthy: [null],
        std_birth_place: [null],
        old_ticket_no2: [null],
        remark: [null],
        std_edu: [null]
      });
    }, 300);
    
  }

}
