import { Component, OnInit } from '@angular/core';
import {FormBuilder, Validators} from '@angular/forms';
import {DomSanitizer} from '@angular/platform-browser';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../../frame/core/detail/frame.detail';

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

  constructor(bsModalRef: BsModalRef, fb: FormBuilder, sanitizer: DomSanitizer) {
    super(bsModalRef, sanitizer);
    this.detailForm = fb.group({
      'enrol_status': [null],
      'reg_status': [null],
      'ksh_regex': [null],
      'ksh_status': [null],
      'ksh_match_msg': [null],
      'province_limit': [null],
      'reg_fetch_status': [null],
      'reg_fetch_param': [null],
      'art_science_status': [null]
    });
  }

  ngOnInit() {
  }

  initDefautEntity() {
    const ids = [];
    if(this.currentEntity.art_science_status) {
      const art_science = this.currentEntity.art_science_status.split(',');
      for(const id of art_science) {
        ids.push(id);
      }
      this.currentEntity.art_science_status = ids;
    }
  }

}
