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';

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

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'score_name': [null, Validators.compose([Validators.required])],
      'score_max': [null, Validators.compose([Validators.required])],
      'score_min': [null, Validators.compose([Validators.required])],
      'master_flag': [null, null],
      'score_type': [null, null],
      'show_score': [null, null],
      'score_tick': [null, Validators.compose([Validators.required])],
      'score_level': [null, Validators.compose([Validators.required])]
    });
   }

  ngOnInit(): void {
  }

  initDefautEntity(): void {
    if(this.detailMode == 'add') {
      this.currentEntity.panel_id = localStorage.getItem('panel_id');
      this.currentEntity.show_score = 'Active';
      this.currentEntity.master_flag = 'InActive';
    }
  }

}
