import {Component, OnInit, ViewChild} from '@angular/core';
import {FormBuilder, Validators} from '@angular/forms';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { AjaxService } from '../../../../core/service/ajax.service';
import { MsgService } from '../../../../core/service/msg.service';
import { FrameDetailComponent } from '../../../frame/core/detail/frame.detail';

@Component({
  selector: 'app-pla-group-publish',
  templateUrl: './pla-group-publish.component.html',
  styleUrls: ['./pla-group-publish.component.scss']
})
export class PlaGroupPublishComponent  extends FrameDetailComponent implements OnInit {


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

    this.detailForm = fb.group({
      'pay_start_time': [null, Validators.compose([Validators.required])],
      'pay_end_time': [null, Validators.compose([Validators.required])]
    });
  }


  initDefautEntity() {

  }

  ngOnInit() {
  }

  publishPlan() {
    MsgService.confirmAlert('确定要发布该专业组吗？该操作不可回退！', () => {
        AjaxService.request('plan/group/publish.htm',this.currentEntity,()=>{
            MsgService.successAlert('专业复试已发布，可根据需要给考生发送微信通知！');
            this.closeWindow();
        }, {RequestWithLoading : true});
    });
  }

}
