import { Component, OnInit } from '@angular/core';
import {FrameEditComponent} from '../../../../frame/core/FrameEditComponent';
import {BsModalRef} from 'ngx-bootstrap';
import {FormBuilder, Validators} from '@angular/forms';

@Component({
  selector: 'app-std-material-refuse',
  templateUrl: './std-material-refuse.component.html',
  styleUrls: ['./std-material-refuse.component.scss']
})
export class StdMaterialRefuseComponent  extends FrameEditComponent implements OnInit {

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.valForm = fb.group({
      'material_id': [null],
      'msg_flag': [null],
      'v_refuse_msg': [null],
      'refuse_msg': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(64)])],
    });
  }

  ngOnInit() {
  }

  initDefautEntity() {
    super.initDefautEntity();
    console.log(this.currentEntity);
    this.currentEntity['msg_flag'] = 'Active';
  }
  changeRefuseMsg() {
    this.currentEntity.refuse_msg = this.currentEntity.v_refuse_msg;
  }



}


