import { Component, OnInit } from '@angular/core';
import {FormBuilder, Validators} from '@angular/forms';
import {BsModalRef} from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../frame/core/detail/frame.detail';
import { AjaxService } from '../../../../core/service/ajax.service';
import { FuncService } from '../../../../core/service/func.service';
import { MsgService } from '../../../../core/service/msg.service';

declare let laydate;

@Component({
  selector: 'app-cf-pattern-detail',
  templateUrl: './pattern-detail.component.html',
  styleUrls: ['./pattern-detail.component.scss']
})
export class CfPatternDetailComponent extends FrameDetailComponent implements OnInit {
  schoolArray = [];

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'pattern_name': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(64)])],
      'is_auth_dtl_dur_submit': [null,Validators.compose([Validators.required])],
      'is_auth_main_dur_submit': [null,Validators.compose([Validators.required])],
      'is_auth_recheck': [null,Validators.compose([Validators.required])],
      'is_msg_dur_submit': [null,Validators.compose([Validators.required])],
      'is_msg_dur_auth': [null,Validators.compose([Validators.required])],
      'is_enable_auth_lable': [null,Validators.compose([Validators.required])]
    });

  }

  ngOnInit() {

  }

  initDefautEntity() {
    if (this.detailMode === 'add') {

    } else {

      this.currentEntity.is_auth_dtl_dur_submit = this.currentEntity.is_auth_dtl_dur_submit + "";
      this.currentEntity.is_auth_main_dur_submit = this.currentEntity.is_auth_main_dur_submit + "";
      this.currentEntity.is_auth_recheck = this.currentEntity.is_auth_recheck + "";
      this.currentEntity.is_msg_dur_submit = this.currentEntity.is_msg_dur_submit + "";
      this.currentEntity.is_msg_dur_auth = this.currentEntity.is_msg_dur_auth + "";
      this.currentEntity.is_enable_auth_lable = this.currentEntity.is_enable_auth_lable + "";
    }
  }


}
