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

@Component({
  selector: 'app-cf-material-feedback',
  templateUrl: './material-feedback.component.html',
  styleUrls: ['./material-feedback.component.scss']
})
export class CfMaterialFeedBackComponent extends FrameDetailComponent implements OnInit {


  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
  }

  step = "page";

  ngOnInit() {


  }

  goAdd() {
    this.step = "add";
  }

  goPage() {
    this.step = "page";
  }

  save() {
    if (!this.currentEntity.feedback_msg) {
      MsgService.errorAlert("请输入材料反馈内容");
      return;
    }
    let _this = this;
    this.currentEntity.material_def_id = this.ResponseEntity.material_def_id;
    this.AjaxService.request("cf/material/feedback/add.htm", this.currentEntity, (ret) => {
      debugger;
      _this.step = "page";
      _this.pager.reload();
    });
  }

}
