<nz-page-header>
  <nz-breadcrumb nz-page-header-breadcrumb>
    <nz-breadcrumb-item>教材申报</nz-breadcrumb-item>
    <nz-breadcrumb-item>
      <a (click)="back()">申报流程</a>
    </nz-breadcrumb-item>
    <nz-breadcrumb-item
      ><a>{{
        eduProcess?.get("department")?.get("name") || "未选择申报单位"
      }}</a></nz-breadcrumb-item
    >
  </nz-breadcrumb>
  <nz-page-header-title
    >{{ eduProcess?.get("department")?.get("name") || "未选择申报单位" }}
    <br />
    <div class="subtitle">
      在流程中邀请作者、高校联系人、评审员登录系统，创建并提交教材，由工作联系人评审、提交推荐教材完成流程工作
    </div>
  </nz-page-header-title>
</nz-page-header>
<div class="edit-content">
  <nz-tabset [(nzSelectedIndex)]="active">
    <nz-tab nzTitle="流程管理">
      @if (active == 0) {
      <app-process-create [isEdit]="true"></app-process-create>
      }
    </nz-tab>
    <nz-tab nzTitle="评审活动">
      <div class="examine">
        <div class="title">{{ activity?.get("name") || "暂未设置" }}</div>
        <div class="row">
          <div class="lable">开始时间：</div>
          <div class="val">
            {{ this.activity?.get("startDate") | date : "yyyy-MM-dd HH:mm" }}
          </div>
        </div>
        <div class="row">
          <div class="lable">结束时间：</div>
          <div class="val">
            {{ this.activity?.get("deadline") | date : "yyyy-MM-dd HH:mm" }}
          </div>
        </div>
        <div class="row">
          <div class="lable">评审组数量：</div>
          <div class="val">{{ expertGroupLength || 0 }}</div>
        </div>
        <div class="examine-fonter">
          @if (activity?.id && eduProcess?.get('status') == '201') {
          <button
            style="background: #3e49b3; border: 1px #3e49b3; margin-right: 50px"
            nz-button
            nzType="primary"
            [disabled]="!activity?.id"
            (click)="onCease()"
          >
            结束评审
          </button>
          }@else {
          <button
            style="background: #3e49b3; border: 1px #3e49b3; margin-right: 50px"
            nz-button
            nzType="primary"
            [disabled]="!activity?.id"
            (click)="startActivity()"
          >
            启动
          </button>
          }
          <button
            style="background: #a2a2a2; border: 1px #a2a2a2; margin-right: 50px"
            nz-button
            nzType="primary"
            (click)="
              toUrl('/nav-province-contact/manage/activity/' + eduProcess?.id)
            "
          >
            编辑
          </button>
          @if (activity?.id && authCompute) {
          <button [nzLoading]="isLoading" nzDanger nz-button nzType="primary" (click)="onCompute()">
            计算平均分
          </button>
          }
        </div>
      </div>
    </nz-tab>
    <nz-tab nzTitle="教材列表">
      @if (active == 2 && eduProcess) {
      <div class="title">待评审教材列表</div>
      <app-textbook
        [filterObj]="beforeFilterObj"
        [eduProcess]="eduProcess"
      ></app-textbook>
      <br />
      <div class="title">推荐教材列表</div>
      <app-textbook
        [filterObj]="afterFilterObj"
        [recommend]="true"
        [eduProcess]="eduProcess"
      ></app-textbook>
      }
    </nz-tab>
  </nz-tabset>
</div>
