<div class="site-page-header">
  <nz-page-header
    nzTitle="教材详情 - {{ textBook?.title }}"
    nzSubtitle=""
    style="padding: 0"
  >
    <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>
  @if (this.tbookSer.profile.identity == '工作联系人' ||
  this.tbookSer.profile.user?.department == textBook?.department) {
  <nz-tabset [(nzSelectedIndex)]="active">
    <nz-tab nzTitle="教材申报书及附件"> </nz-tab>
    <nz-tab nzTitle="教材评审明细"> </nz-tab>
  </nz-tabset>
  }
</div>

@if(active == 0) {
<ng-container *ngTemplateOutlet="one"></ng-container>
} @else if (active == 1) {
<div class="content">
  <nz-table
    [nzLoading]="groupLogin || reviewLogin"
    class="reviewTable"
    #basicTable
    [nzData]="groupList"
    [nzScroll]="{ x: '100%' }"
  >
    <thead>
      <tr>
        <th style="width: 130px" nzLeft>所属评审组</th>
        @for (item of reviewList; track $index) {
        <th style="width: 100px">
          {{
            item?.get("profile")?.get("user")?.get("name") || "未命名评审专家"
          }}
        </th>
        }
        <th style="width: 80px" nzRight>合计分值</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of basicTable.data">
        <td nzLeft>{{ data?.get("name") }}</td>
        @for (item of reviewList; track $index) {
        <td>{{ item?.get("score") || "-" }}</td>
        }
        <td nzRight>{{ total }}</td>
      </tr>
    </tbody>
  </nz-table>
</div>
}

<ng-template #one>
  <div class="content">
    <div nz-row>
      <div nz-col nzSpan="18">
        <div id="anchor1" class="occupy" style="height: 100px"></div>
        <div class="templ1" #templ1 style="width: 500px">
          <div class="title">教材基本信息</div>
          <div class="base-content">
            <div class="row">
              <div class="label">申报教材名称</div>
              <div class="value">{{ textBook?.title }}</div>
            </div>
            <div class="row">
              <div class="label">教材应用对象及所属学科专业类</div>
              <div class="value">
                {{ textBook?.majorPoniter?.code }}-{{
                  textBook?.majorPoniter?.name
                }}
              </div>
            </div>
            <div class="row">
              <div class="label">是否为重点立项教材</div>
              <div class="value">
                {{ textBook?.approval }}
                @if (textBook?.approval&&textBook?.approval!='否') {
                <a (click)="openFile(textBook?.approvedImgUrl)">
                  <span nz-icon nzType="file" nzTheme="outline"></span>
                  教材获批截图
                </a>
                }
              </div>
            </div>
            <div class="row">
              <div class="label">申报类型</div>
              <div class="value">
                {{ textBook?.type }}
                {{
                  textBook?.type == "全册" ? textBook?.typeNumber + "册" : ""
                }}
              </div>
            </div>

            <nz-collapse>
              @for (volume of eduTextbookVolumeList; track $index) {
              <nz-collapse-panel
                [nzHeader]="$index + 1 + '册'"
                [nzActive]="'true'"
              >
                <div class="row">
                  <div class="label">第一主编（作者）</div>
                  <div class="value">{{ volume?.author }}</div>
                </div>
                <div class="row">
                  <div class="label">第一主编（作者）单位</div>
                  <div class="value">{{ volume?.unit }}</div>
                </div>

                <div class="row">
                  <div class="label">教材主要语种类型</div>
                  <div class="value">{{ volume?.lang }}</div>
                </div>
                <div class="row">
                  <div class="label">国际标准书号</div>
                  <div class="value">{{ volume?.ISBN }}</div>
                </div>
                <div class="row">
                  <div class="label">其他主编姓名</div>
                  <div class="value">{{ volume?.authors || "-" }}</div>
                </div>
                <div class="row">
                  <div class="label">其他编者姓名</div>
                  <div class="value">{{ volume?.editor || "-" }}</div>
                </div>

                <div class="row">
                  <div class="label">出版单位</div>
                  <div class="value">{{ volume?.editionUnit }}</div>
                </div>
                <div class="row">
                  <div class="label">初版时间</div>
                  <div class="value">
                    {{ volume?.editionFirst?.iso | date : "yyyy-MM" }}
                  </div>
                </div>
                <div class="row">
                  <div class="label">载体形式</div>
                  <div class="value">{{ volume?.carrierShape }}</div>
                </div>
                <div class="row">
                  <div class="label">本版出版时间及版次</div>
                  <div class="value">
                    {{ volume?.editionDate?.iso | date : "yyyy-MM" }}/{{
                      volume?.editionNumber
                    }}
                  </div>
                </div>
                <div class="row">
                  <div class="label">最新印次时间及印次</div>
                  <div class="value">
                    {{ volume?.printDate?.iso | date : "yyyy-MM-dd" }}/{{
                      volume?.printNumber
                    }}
                  </div>
                </div>
                <div class="row">
                  <div class="label">初版以来合计印数</div>
                  <div class="value">{{ volume?.printSum }}</div>
                </div>
                <div class="row">
                  <div class="label">初版以来是否曾列为重点项目</div>
                  <div class="value">
                    @for (item of volume?.importantProject; track $index) {
                    <p>
                      {{ item }}
                      {{
                        item == "其他省部级及以上项目"
                          ? "-" + volume?.importantProjectOther
                          : ""
                      }}
                    </p>
                    }
                  </div>
                </div>
              </nz-collapse-panel>
              }
            </nz-collapse>

            <!-- <div class="row">
              <div class="label">版权页截图</div>
              <div class="value">
                <a (click)="openFile(textBook?.copyrightImgUrl)">截图文件</a>
              </div>
            </div>
            <div class="row">
              <div class="label">中国版本图书馆 CIP 查询截图</div>
              <div class="value">
                <a (click)="openFile(textBook?.CIPImgUrl)">查询截图</a>
              </div>
            </div> -->
          </div>
        </div>
        <div id="anchor2" class="occupy" style="height: 60px"></div>
        <div class="templ">
          <div class="title">教材适用情况</div>
          <div class="base-content">
            <div class="row">
              <div class="label">适用专业代码（六位）及名称</div>
              <div class="value">
                {{ textBook?.major?.code }}-{{ textBook?.major?.name }}
              </div>
            </div>
            <div class="row">
              <div class="label">适用课程</div>
              <div class="value">{{ textBook?.lessons }}</div>
            </div>
            <div class="row">
              <div class="label">课程学时</div>
              <div class="value">{{ textBook?.period }}</div>
            </div>
            <div class="row">
              <div class="label">适用课程性质</div>
              <div class="value">
                @for (tag of textBook?.characteristic; track tag) { @if
                (tag.checked){
                <nz-tag>{{ tag.label }}</nz-tag>
                } }
              </div>
            </div>
          </div>
        </div>
        <div id="anchor3" class="occupy" style="height: 60px"></div>
        <div class="templ">
          <div id="anchor3_1" class="occupy" style="height: 60px"></div>
          <div class="title">作者信息</div>

          <nz-collapse>
            @for (volume of eduTextbookVolumeList; track $index) {
            <nz-collapse-panel
              [nzHeader]="$index + 1 + '册'"
              [nzActive]="'true'"
            >
              <div class="text mar10">
                作者（含主编，不超过 6 人，教材中明确出现姓名）
              </div>
              <div class="base-content">
                <nz-table
                  #basicTable
                  [nzShowPagination]="false"
                  [nzData]="volume?.authorList"
                  [nzScroll]="{
                    x: (templ1.style.width || '1000') + 'px',
                    y: '240px'
                  }"
                >
                  <thead>
                    <tr>
                      <th nzEllipsis nzWidth="120px" nzLeft>姓名</th>
                      <th nzEllipsis nzWidth="120px">单位</th>
                      <th nzEllipsis nzWidth="120px">出生年月</th>
                      <th nzEllipsis nzWidth="120px">国籍</th>
                      <th nzEllipsis nzWidth="120px">职务</th>
                      <th nzEllipsis nzWidth="120px">职称</th>
                      <th nzEllipsis nzWidth="120px">手机号码</th>
                      <th nzEllipsis nzWidth="120px">电子邮箱</th>
                      <th nzEllipsis nzWidth="120px">分工</th>
                      <!-- <th nzEllipsis nzWidth="120px">签名</th> -->
                      <!-- <th nzEllipsis nzWidth="120px">政治审查表</th> -->
                    </tr>
                  </thead>
                  <tbody>
                    @for (data of volume?.authorList; track data.mobile;let
                    index = $index) {
                    <tr>
                      <td nzEllipsis nzLeft>
                        {{ data.name }}
                      </td>
                      <td nzEllipsis>
                        {{ data.unit }}
                      </td>
                      <td nzEllipsis>
                        {{ data.birth?.iso | date : "yyyy-MM" }}
                      </td>
                      <td nzEllipsis>
                        {{ data.nationality }}
                      </td>
                      <td nzEllipsis>
                        {{ data.job }}
                      </td>
                      <td nzEllipsis>
                        {{ data.title }}
                      </td>
                      <td nzEllipsis>
                        {{ data.mobile }}
                      </td>
                      <td nzEllipsis>
                        {{ data.email }}
                      </td>
                      <td nzEllipsis>
                        {{ data.work }}
                      </td>
                    </tr>
                    }
                  </tbody>
                </nz-table>
              </div>

              <div id="anchor3_2" class="occupy" style="height: 60px"></div>
              <div class="text mar10">第一主编（作者）情况</div>
              <div class="base-content">
                <div class="text-tips">1.相关教学经历</div>
                <div class="note">
                  {{ volume?.authorDetails }}
                </div>
                <div class="text-tips">
                  2.相关科学研究项目、成果或论文专著（限5项）
                </div>
                <nz-table
                  #basicTable
                  [nzShowPagination]="false"
                  [nzData]="volume?.achievementOptions"
                  [nzScroll]="{
                    x: (templ1.style.width || '1000') + 'px',
                    y: '240px'
                  }"
                  nzTableLayout="fixed"
                >
                  <thead>
                    <tr>
                      <th nzWidth="80px" nzLeft nzAlign="right">序号</th>
                      <th nzWidth="160px" nzEllipsis>名称</th>
                      <th nzWidth="160px">来源/出版单位</th>
                      <th nzWidth="80px">时间</th>
                    </tr>
                  </thead>
                  <tbody>
                    @for (data of volume?.achievementOptions; track
                    data.name;let index = $index) {
                    <tr>
                      <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
                      <td nzEllipsis>
                        {{ data.name }}
                      </td>
                      <td nzEllipsis>
                        {{ data.unit }}
                      </td>
                      <td nzEllipsis>
                        {{ data.date?.iso | date : "yyyy-MM" }}
                      </td>
                    </tr>
                    }
                  </tbody>
                </nz-table>
              </div>
            </nz-collapse-panel>
            }
          </nz-collapse>
        </div>
        <div id="anchor4" class="occupy" style="height: 60px"></div>
        <div class="templ">
          <div class="title">申报教材建设历程</div>

          <div class="base-content">
            <nz-collapse>
              @for (volume of eduTextbookVolumeList; track $index) {
              <nz-collapse-panel
                [nzHeader]="$index + 1 + '册'"
                [nzActive]="'true'"
              >
                <nz-table
                  #basicTable
                  [nzShowPagination]="false"
                  [nzData]="volume?.courses"
                  [nzScroll]="{
                    x: (templ1.style.width || '1000') + 'px',
                    y: '240px'
                  }"
                >
                  <thead>
                    <tr>
                      <th nzWidth="80px" nzLeft nzAlign="right">版次</th>
                      <th nzWidth="120px">出版时间</th>
                      <th nzWidth="100px">字数</th>
                      <th nzWidth="100px">重印次数</th>
                      <th nzWidth="100px">本版总印数</th>
                      <th nzWidth="200px">获奖励情况</th>
                    </tr>
                  </thead>
                  <tbody>
                    @for (data of volume?.courses; track data;let index =
                    $index) {
                    <tr>
                      <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
                      <td nzEllipsis>
                        {{ data.date?.iso | date : "yyyy-MM" }}
                      </td>
                      <td nzEllipsis>
                        {{ data.wordage }}
                      </td>
                      <td nzEllipsis>
                        {{ data.num }}
                      </td>
                      <td nzEllipsis>
                        {{ data.sumNum }}
                      </td>
                      <td nzEllipsis>
                        {{ data.accolade }}
                      </td>
                    </tr>
                    }
                  </tbody>
                </nz-table>
              </nz-collapse-panel>
              }
            </nz-collapse>
          </div>
        </div>
        <div
          id="anchor4"
          id="anchor5"
          class="occupy"
          style="height: 60px"
        ></div>
        <div class="templ">
          <div class="title">申报教材特色及创新</div>
          <div class="base-content">
            <div class="note">
              {{ textBook?.innovateExplain }}
            </div>
          </div>
        </div>
        <div
          id="anchor4"
          id="anchor6"
          class="occupy"
          style="height: 60px"
        ></div>
        <div class="templ">
          <div class="title">申报教材应用情况及社会影响力</div>
          <div class="base-content">
            <div class="note">
              {{ textBook?.influence }}
            </div>
          </div>
        </div>
        <div
          id="anchor4"
          id="anchor9"
          class="occupy"
          style="height: 60px"
        ></div>
        <div class="templ">
          <div class="title">申报单位承诺意见</div>
          <div class="base-content">
            <div class="text-tips">1.教材作者诚信承诺</div>
            <div class="note">
              {{ textBook?.accept }}
            </div>
            <!-- <div class="text-tips">2.申报单位承诺意见</div>
            <div class="note">
              {{textBook?.unitMaterial?.text}}
            </div> -->
          </div>
        </div>
        <div
          id="anchor4"
          id="anchor7"
          class="occupy"
          style="height: 60px"
        ></div>
        <div class="templ">
          <div class="title">附件材料</div>
          <div class="base-content">
            <nz-collapse>
              @for (volume of eduTextbookVolumeList; track $index) {
              <nz-collapse-panel
                [nzHeader]="$index + 1 + '册'"
                [nzActive]="'true'"
              >
                <nz-table
                  style="margin-bottom: 20px"
                  #basicTable
                  [nzShowPagination]="false"
                  [nzData]="volume?.authorList"
                  [nzScroll]="{
                    x: (templ1.style.width || '1000') + 'px',
                    y: '240px'
                  }"
                >
                  <thead>
                    <tr>
                      <th nzEllipsis nzWidth="120px" nzLeft>姓名</th>
                      <th nzEllipsis nzWidth="120px" nzLeft>政治审查表</th>
                      <th nzEllipsis nzWidth="120px">单位</th>
                      <th nzEllipsis nzWidth="120px">出生年月</th>
                      <th nzEllipsis nzWidth="120px">国籍</th>
                      <th nzEllipsis nzWidth="120px">职务</th>
                      <th nzEllipsis nzWidth="120px">职称</th>
                      <th nzEllipsis nzWidth="120px">手机号码</th>
                      <th nzEllipsis nzWidth="120px">电子邮箱</th>
                      <th nzEllipsis nzWidth="120px">分工</th>
                      <!-- <th nzEllipsis nzWidth="120px">签名</th> -->
                    </tr>
                  </thead>
                  <tbody>
                    @for (data of volume?.authorList; track data.mobile;let
                    index = $index) {
                    <tr>
                      <td nzEllipsis nzLeft>
                        {{ data.name }}
                      </td>
                      <td nzEllipsis nzLeft>
                        <a (click)="openFile(data?.examine)">政治审查表</a>
                      </td>
                      <td nzEllipsis>
                        {{ data.unit }}
                      </td>
                      <td nzEllipsis>
                        {{ data.birth?.iso | date : "yyyy-MM" }}
                      </td>
                      <td nzEllipsis>
                        {{ data.nationality }}
                      </td>
                      <td nzEllipsis>
                        {{ data.job }}
                      </td>
                      <td nzEllipsis>
                        {{ data.title }}
                      </td>
                      <td nzEllipsis>
                        {{ data.mobile }}
                      </td>
                      <td nzEllipsis>
                        {{ data.email }}
                      </td>
                      <td nzEllipsis>
                        {{ data.work }}
                      </td>
                      <!-- <td nzEllipsis>
                    <a (click)="openFile(data?.signature)">签名文件</a>
                  </td> -->
                    </tr>
                    }
                  </tbody>
                </nz-table>
              </nz-collapse-panel>
              }
            </nz-collapse>

            <div class="row" style="margin-top: 10px">
              <div class="label">图书编校质量自查结果记录表</div>
              <div class="value">
                <a (click)="openFile(textBook?.selfResults?.url)">{{
                  textBook?.selfResults?.name
                }}</a>
              </div>
            </div>
            <div class="row">
              <div class="label">专家审查意见表</div>
              <div class="value">
                <a (click)="openFile(textBook?.expertOpinion?.url)">{{
                  textBook?.expertOpinion?.name
                }}</a>
              </div>
            </div>
            <div class="row">
              <div class="label">教材使用情况证明材料</div>
              <div class="value">
                <a (click)="openFile(textBook?.evidence?.url)">{{
                  textBook?.evidence?.name
                }}</a>
              </div>
            </div>
            <div class="row">
              <div class="label">版权页截图</div>
              <div class="value">
                <a (click)="openFile(textBook?.copyrightImgUrl)">截图文件</a>
              </div>
            </div>
            <div class="row">
              <div class="label">中国版本图书馆 CIP 查询截图</div>
              <div class="value">
                <a (click)="openFile(textBook?.CIPImgUrl)">查询截图</a>
              </div>
            </div>
            <div class="row">
              <div class="label">CIP 相关证明截图</div>
              <div class="value">
                @for (item of textBook?.cipProveFile; track item.name) {
                <a (click)="openFile(item.url)" style="margin-right: 10px">{{
                  item.name
                }}</a>
                <br />
                }
              </div>
            </div>

            <div class="row">
              <div class="label">其他材料</div>
              <div class="value">
                @for (item of textBook?.moreMaterial; track item.name) {
                <a (click)="openFile(item.url)" style="margin-right: 10px">{{
                  item.name
                }}</a>
                <br />
                }
              </div>
            </div>
          </div>
        </div>
        <!-- <div class="templ">
          <div class="title">教材作者诚信承诺</div>
          <div class="base-content">
            <nz-table
              #basicTable
              [nzShowPagination]="false"
              [nzData]="textBook?.authorSign"
              [nzScroll]="{
                x: (templ1.style.width || '1000') + 'px',
                y: '240px'
              }"
            >
              <thead>
                <tr>
                  <th nzWidth="80px" nzLeft nzAlign="right">序号</th>
                  <th nzWidth="100px">作者</th>
                  <th nzWidth="100px">单位</th>
                  <th nzWidth="100px">出生年月</th>
                  <th nzWidth="100px">国籍</th>
                  <th nzWidth="100px" nzRight>作者签名</th>
                </tr>
              </thead>
              <tbody>
                @for (data of textBook?.authorSign; track data.name;let index =
                $index) {
                <tr>
                  <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
                  <td nzEllipsis>
                    {{ data.name }}
                  </td>
                  <td nzEllipsis>
                    {{ data.unit }}
                  </td>
                  <td nzEllipsis>
                    {{ data.birth?.iso | date : "yyyy-MM" }}
                  </td>
                  <td nzEllipsis>
                    {{ data.nationality }}
                  </td>
                  <td nzEllipsis nzRight>
                    <a (click)="openFile(data.reviewFile?.url)">{{
                      data.reviewFile?.name
                    }}</a>
                  </td>
                </tr>
                }
              </tbody>
            </nz-table>
          </div>
        </div> -->

        <!-- <div class="templ">
          <div class="title">初评推荐意见</div>
          <div class="base-content">
            <div class="row">
              <div class="label">省级教育行政部门初评专家组意见</div>
              <div class="value">
                <span style="color: #231c1f99">暂未填写</span>
              </div>
            </div>
            <div class="row">
              <div class="label">省级教育行政部门意见</div>
              <div class="value">
                <span style="color: #231c1f99">暂无</span>
              </div>
            </div>
          </div>
        </div> -->
      </div>

      <div nz-col nzSpan="6">
        <div style="position: fixed">
          <ul class="herf">
            <li class="lv1" (click)="herfLink('anchor1')">教材基本信息</li>
            <li class="lv1" (click)="herfLink('anchor2')">教材适用情况</li>
            <li class="lv1" (click)="herfLink('anchor3')">作者信息</li>
            <li class="lv2" (click)="herfLink('anchor3_1')">作者</li>
            <li class="lv2" (click)="herfLink('anchor3_2')">
              第一主编（作者）情况
            </li>
            <li class="lv1" (click)="herfLink('anchor4')">申报教材建设历程</li>
            <li class="lv1" (click)="herfLink('anchor5')">
              申报教材特色及创新
            </li>
            <li class="lv1" (click)="herfLink('anchor6')">
              申报教材应用情况及社会影响力
            </li>
            <li class="lv1" (click)="herfLink('anchor9')">申报单位承诺意见</li>
            <li class="lv1" (click)="herfLink('anchor7')">附件材料清单</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</ng-template>

@if (user?.id == textBook?.user?.objectId && !textBook?.discard &&
!textBook?.render) {
<div class="footer">
  <button
    nz-button
    nzType="primary"
    style="background: #3e49b3; border: 1px #3e49b3"
    (click)="edit()"
  >
    编辑教材
  </button>
</div>
}
