<div class="site-page-header">
  <nz-page-header>
    <nz-breadcrumb nz-page-header-breadcrumb>
      <div class="back" (click)="back()">
        <span nz-icon nzType="left" nzTheme="outline"></span>返回
      </div>
    </nz-breadcrumb>
    <nz-page-header-title
      >{{ expertGroup?.get("name") || "-" }}
    </nz-page-header-title>
  </nz-page-header>
  <nz-tabset [(nzSelectedIndex)]="active">
    <nz-tab nzTitle="教材申报书及附件"> </nz-tab>
    <nz-tab nzTitle="教材评审明细"> </nz-tab>
  </nz-tabset>
</div>
<div class="edit-content">
  @if (active == 0) {
  <div class="edit-comp">
    <div class="title">设置评审教材</div>
    <nz-radio-group
      [ngModel]="radio"
      (ngModelChange)="onchangeTextbook($event)"
    >
      <label nz-radio nzValue="all">全部教材</label>
      <label nz-radio nzValue="free">手动选择</label>
    </nz-radio-group>
    <div class="textbook">
      @if (showTextbook) {
      <app-textbook
        [hidden]="radio == 'all'"
        [filterObj]="filterObj"
        [eduProcess]="eduProcess"
        [setOfCheckedId]="setOfCheckedTextbookAll"
        (updateCheck)="updateCheck()"
        #textbook
      >
      </app-textbook>
      <div class="text-list">
        <div class="list">
          <div class="text">已选教材：</div>
          @for (item of allTextbook; track $index) { @if (!showAll) {
          <div [hidden]="$index >= 8" class="text-name">
            {{ item.get("title") }}
            <span [hidden]="$index >= 8 - 1 || $index == allTextbook.length - 1"
              >;</span
            >
          </div>
          }@else {
          <div class="text-name">
            {{ item.get("title") }}
            <span [hidden]="$index == allTextbook.length - 1">;</span>
          </div>
          } } @if (allTextbook.length > 8) {
          <div class="show-text" (click)="showAll = !showAll">
            {{ showAll ? "合起教材" : "展开全部" }}
          </div>
          }
        </div>
      </div>
      }
    </div>
    <div class="fonter">
      <button
        style="background: #3e49b3; border: 1px #3e49b3; margin-right: 50px"
        nz-button
        nzType="primary"
        (click)="onSave('eduTextbook')"
      >
        保存
      </button>
      <button
        style="
          background: #eae6e6;
          border: 1px #eae6e6;
          margin-right: 50px;
          color: #000;
        "
        nz-button
        nzType="primary"
        (click)="reset()"
      >
        重置
      </button>
    </div>
  </div>
  <div class="edit-comp" style="margin-top: 30px">
    <div class="title">设置评审专家</div>
    <nz-radio-group
      [ngModel]="radioReview"
      (ngModelChange)="onchangeReview($event)"
    >
      <label nz-radio nzValue="all">全部专家</label>
      <label nz-radio nzValue="free">指定专家</label>
    </nz-radio-group>
    @if (radioReview == 'free') {
    <div class="dep-comp">
      <div class="dep-left">
        <div class="row">
          <div class="value">
            <nz-input-group [nzPrefix]="prefixTemplateUser">
              <input
                nz-input
                placeholder="可输入评审专家用户姓名/手机号/邮箱搜索"
                [(ngModel)]="modalValue"
                (ngModelChange)="getProfile()"
                type="text"
              />
            </nz-input-group>
            <ng-template #prefixTemplateUser
              ><span nz-icon nzType="search"></span
            ></ng-template>
          </div>
        </div>
        <div class="select">
          @if (profilList.length > 0) { @for (item of profilList; track $index)
          {
          <div class="li" (click)="updateAllChecked(item)">
            <div class="lable">
              <label
                nz-checkbox
                [ngModel]="this.setOfCheckedProfileAll.has(item.id)"
                (ngModelChange)="updateAllChecked(item)"
                >{{
                  item?.get("user")?.get("name") ||
                    item?.get("user")?.get("username")
                }}</label
              >
              <div class="detail">
                {{ item?.get("user")?.get("phone") || "-" }} |
                {{ item?.get("email") || "-" }}
              </div>
            </div>
          </div>
          } } @else {
          <nz-empty
            style="margin-top: 10px"
            nzNotFoundContent="暂无找到相关评审专家"
          ></nz-empty>
          }
        </div>
      </div>
      <div class="dep-right">
        <div class="select">
          <div class="tool">
            <div class="">已选：{{ checkProfileListLeng }}</div>
            <div class="clrea">清除</div>
          </div>
          @if (checkProfileListLeng > 0) { @for (item of profilList; track
          $index) { @if ( setOfCheckedProfileAll.has(item.id) ) {
          <div class="li">
            <div class="lable">
              {{
                item?.get("user")?.get("name") ||
                  item?.get("user")?.get("username")
              }}
              <div class="detail" style="margin-left: 0">
                {{ item?.get("user")?.get("phone") || "-" }} |
                {{ item?.get("email") || "-" }}
              </div>
            </div>
            <div class="check" (click)="setOfCheckedProfileAll.delete(item.id)">
              <span nz-icon nzType="close" nzTheme="outline"></span>
            </div>
          </div>
          } } } @else {
          <nz-empty
            style="margin-top: 10px"
            nzNotFoundContent="暂无选择相关评审专家"
          ></nz-empty>
          }
        </div>
      </div>
    </div>
    }

    <div class="fonter">
      <button
        style="background: #3e49b3; border: 1px #3e49b3; margin-right: 50px"
        nz-button
        nzType="primary"
        (click)="onSave('profile')"
      >
        保存
      </button>
      <button
        style="
          background: #eae6e6;
          border: 1px #eae6e6;
          margin-right: 50px;
          color: #000;
        "
        nz-button
        nzType="primary"
        (click)="reset()"
      >
        重置
      </button>
    </div>
  </div>
  } @else if (active == 1) {
  <app-review-details [filterObj]="reviewFilterObj"></app-review-details>
  }
</div>
