import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { ScoreOneInputDetailComponent } from '../score-one-input-detail/score-one-input-detail.component';
import { FramePageComponent } from 'src/app/routes/frame/core/page/frame.page';

@Component({
  selector: 'app-score-one-input',
  templateUrl: './score-one-input.component.html',
  styleUrls: ['./score-one-input.component.scss']
})
export class ScoreOneInputComponent extends FramePageComponent implements OnInit {

  subjectArr = [];
  subject_id:any;

  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = ScoreOneInputDetailComponent;
  }

  ngOnInit(): void {
    this.requestSubject();
  }

  requestSubject() {
    this.AjaxService.requestArray('score/one/input/list.htm', {}, (array) => {
      this.subjectArr = array;
      for(const sub of this.subjectArr) {
        sub.subject_full_name =   sub.subject_code+'|' +sub.subject_name;
      }
      this.subjectArr.unshift({subject_full_name: '所有', subject_id: ''});
    });
  }

  requestScore() {
    this.pager.reload({subject_id: this.subject_id});
  }

}
