import {Component, OnInit} from '@angular/core';
import {BsModalRef} from 'ngx-bootstrap';
import {MsgService} from '../../../../../core/msg/msg.service';
import {AjaxService} from '../../../../../core/ajax/ajax.service';
import {FrameEditComponent} from '../../../../frame/core/FrameEditComponent';
import { debug } from 'console';

@Component({
  selector: 'app-agent-std-aspect',
  templateUrl: './agent-std-aspect.component.html'
})
export class AgentStdAspectComponent extends FrameEditComponent implements OnInit {

  initMap: any;
  viewStep = 'page';

  constructor(bsModalRef: BsModalRef) {
    super(bsModalRef);
  }

  ngOnInit() {
  }


  changAspect() {
    if ((this.ResponseMap.aspect_id + '') === (this.ResponseMap.StdEnrol.aspect_id + '')) {
      MsgService.errorToaster('新专业和旧专业一致！');
      return;
    }
    MsgService.confirm('确定要更改该考生的专业信息吗？', () => {
      AjaxService.request('school/school/std/aspect/save.htm', {
        std_id: this.ResponseMap.StdReg.std_id,
        enrol_id: this.ResponseMap.StdEnrol.enrol_id,
        aspect_id: this.ResponseMap.aspect_id
      }, () => {
        MsgService.successToaster('专业更改成功');
        //this.framePageComponent.page.reload();
        this.closeWindow();
      });
    });
  }
}
