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-std-enrol-bank-audit',
  templateUrl: './std-enrol-bank-audit.component.html',
  styleUrls: ['./std-enrol-bank-audit.component.scss']
})
export class StdEnrolBankAuditComponent extends FrameDetailComponent implements OnInit {

  imageList = [];
  remark: any;

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

  ngOnInit(): void {
    this.imageList.push(this.FrameService.getParamValue('EnrolMaterialWebPath')+this.ResponseEntity.bank_reply_url);
  }

  handleImageEvent(event) {

  }

  //银行回执审核
  auditBank(status) {
    let msg ='';
    if(status == 'Active') {
      msg = '请确定学校是否已经收到缴费，通过后，考生的缴费状态自动修改为已缴费！';
    } else {
      msg='确定不通过吗？不通过，则考生的缴费状态不会改变';
    }
    this.MsgService.confirmAlert(msg, () => {
      this.AjaxService.request('std/enrol/pay/update.htm', {
        school_id: this.ResponseEntity.school_id,
        batch_id: this.ResponseEntity.batch_id,
        std_id: this.ResponseEntity.std_id,
        pay_status: status,
        remark: this.remark
      }, () => {
        this.MsgService.successToastr('审核成功');
        this.closeWindow();
      });
    });
  }
}
