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

@Component({
  selector: 'app-frame-dept-bank-detail',
  templateUrl: './frame-dept-bank-detail.component.html',
  styleUrls: ['./frame-dept-bank-detail.component.scss']
})
export class FrameDeptBankDetailComponent extends FrameDetailComponent implements OnInit {

  deptArray = [];
  bSchoolArray = [];

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'join_school_code': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(64)])],
      'bank': [null, Validators.compose([Validators.required, Validators.minLength(1), Validators.maxLength(32)])],
      'bank_card_no': [null, Validators.compose([Validators.required, Validators.minLength(1), Validators.maxLength(32)])]
    });
  }

  ngOnInit() {
     //查询衔接学校
     AjaxService.requestArray("conf/org/list.htm",{dept_type : "bridge"},(array)=>{
      this.bSchoolArray = array;
    });

  }

  initDefautEntity() {
    if (this.detailMode === 'add') {
      this.currentEntity.status = 1;//默认是启用
    }
  }

}
