import {Component, OnInit} from '@angular/core';
import {BsModalService} from "ngx-bootstrap/modal";
import {FormBuilder, Validators} from "@angular/forms";
import {FlexTableComponent} from "../../../../shared/common/FlexTable.component";
import {AppComponent} from "../../../../app.component";
import * as _ from "lodash";

@Component({
  selector: 'app-std-app-feedback',
  templateUrl: './std-app-feedback.component.html',
  styleUrls: ['./std-app-feedback.component.scss']
})
export class StdAppFeedbackComponent extends FlexTableComponent implements OnInit {

  public query = {
    std_name: "",
    cert_no: "",
    ticket_no: "",
    type_name: "",
    status:""
  };

  QUERY_URL = "std/stdAppFeedback/page.htm";
  DELETE_URL = "std/stdAppFeedback/delete.htm";
  GET_URL = "std/stdAppFeedback/get.htm";
  ADD_URL = "std/stdAppFeedback/add.htm";
  EDIT_URL = "std/stdAppFeedback/edit.htm";

  constructor(public bsModalService: BsModalService, fb: FormBuilder) {
    super();
    // CustomValidators.rangeLength([1, 6])
    this.formModel = fb.group({
      id: [null],
      result: [null, Validators.compose([Validators.required])],
    });
  }



  ngOnInit() {

  }

  audit (){
  
    AppComponent.confirm("确定完成投诉咨询的受理吗?",()=>{
      super.save();
  });
}

  search(param) {
    if (!this.query.std_name) {
      this.query.std_name = "";
    }

    if (!this.query.cert_no) {
      this.query.cert_no = "";
    }

    if (!this.query.ticket_no) {
      this.query.ticket_no = "";
    }

    if (!this.query.type_name) {
      this.query.type_name = "";
    }

    if (!this.query.status) {
      this.query.status = "";
    }
    
    param.std_name = this.query.std_name;
    param.cert_no = this.query.cert_no;
    param.ticket_no = this.query.ticket_no;
    param.type_name = this.query.type_name;
    param.status = this.query.status;
  }

  carouselContentFilter(str) {
    
    if(str){
        var carContent ='';
        if(str.length >= 30){
           
            carContent = str.substring(0,30) + '...';
        }
        else {
            carContent = str
        }
        return carContent;
    }else{
      return str;
    }
}

}
