<nz-page-header>
  <!--title-->
  <nz-page-header-title
    >申报流程
    <br />
    <div class="subtitle">
      统一管理各类教材推荐流程和限额，设置各个流程开始和结束时间、查看各流程工作进度
    </div>
  </nz-page-header-title>

  <!--extra-->
  <nz-page-header-extra> </nz-page-header-extra>
</nz-page-header>
<div class="edit-content">
  <div class="tool">
    <div class="tool-left">
      <!-- <div class="search">
        <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
          <input
            type="text"
            nz-input
            placeholder="搜索"
            [(ngModel)]="searchValue"
            (ngModelChange)="onSearch($event)"
          />
        </nz-input-group>
        <ng-template #prefixTemplateUser
          ><span nz-icon nzType="search"></span
        ></ng-template>
      </div> -->
      <div class="">
        <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
          <input
            type="text"
            nz-input
            placeholder="搜索流程名称 / 流程 code"
            [(ngModel)]="searchValuePro"
            (ngModelChange)="onSearchPro($event)"
          />
        </nz-input-group>
        <ng-template #prefixTemplateUser
          ><span nz-icon nzType="search"></span
        ></ng-template>
      </div>
    </div>
    <div class="tool-right"></div>
  </div>
  <div class="layout" #maxWidth>
    <!-- <div class="sider" #sider>
      <ul nz-menu>
        @for (item of nodes; track $index) {
        <li nz-menu-item (click)="changeDepart(item)">{{ item.title }}</li>
        }
      </ul>
    </div> -->
    <div class="breadcrumb">
      <nz-table
        #tableData
        [nzData]="eduProcessList"
        [nzTotal]="eduProcessList.length"
        [nzPageSize]="10"
        style="margin: 10px 0"
        [nzLoading]="loading"
        nzSize="middle"
        [nzNoResult]="emptyResult"
        nzTableLayout="fixed"
      >
        <thead>
          <tr>
            <th
              nzWidth="50px"
              nzLeft
              [nzChecked]="checkedAll"
              [nzIndeterminate]="indeterminate"
              nzLabel="Select all"
              (nzCheckedChange)="onAllChecked($event)"
            ></th>
            <th nzWidth="120px" nzLeft>流程名称</th>
            <th nzWidth="120px">流程code</th>
            <th nzWidth="120px">流程描述</th>
            <th nzWidth="80px">申报限额</th>
            <th nzWidth="120px">流程联系人</th>
            <th nzWidth="80px">流程状态</th>
            <th nzWidth="50px" nzRight>操作</th>
          </tr>
        </thead>
        <tbody>
          @for (data of eduProcessList; track data.objectId) {
          <tr>
            <td
              nzLeft
              [nzChecked]="data.checked"
              (nzCheckedChange)="onItemChecked(data.objectId, $event)"
            ></td>
            <td
              nzLeft
              nzEllipsis
              (click)="
                toUrl('/nav-province-contact/manage/process/page', {
                  id: data?.objectId
                })
              "
              class="activeTd"
            >
              {{ data?.name || "-" }}
            </td>
            <td>
              {{ data?.code || "-" }}
            </td>
            <td>
              {{ data?.desc || "-" }}
            </td>
            <td>
              {{ data?.num || "-" }}
            </td>
            <td>
              {{ data?.profileSubmitted?.user.name || "-" }}
            </td>
            <td>
              <nz-tag [nzColor]="data?.state.color">
                {{ data?.state.title }}</nz-tag
              >
            </td>
            <td nzRight>
              <button
                nz-button
                nz-dropdown
                [nzDropdownMenu]="menu"
                [nzPlacement]="'bottomLeft'"
              >
                <span nz-icon nzType="ellipsis" nzTheme="outline"></span>
              </button>
              <nz-dropdown-menu #menu="nzDropdownMenu">
                <ul nz-menu>
                  @if (data.state?.strat){
                  <li nz-menu-item>
                    <button
                      nz-button
                      [disabled]="user?.get('isDeleted')"
                      nzType="link"
                      style="color: #231c1f"
                    >
                      <span
                        nz-icon
                        nzType="caret-right"
                        nzTheme="outline"
                      ></span
                      >开始流程
                    </button>
                  </li>
                  } @if (data.state?.stop){
                  <li nz-menu-item>
                    <button
                      nz-button
                      [disabled]="user?.get('isDeleted')"
                      nzType="link"
                      style="color: #231c1f"
                    >
                      <span
                        nz-icon
                        nzType="pause-circle"
                        nzTheme="outline"
                      ></span
                      >暂停流程
                    </button>
                  </li>
                  } @if (data.state?.end){
                  <li nz-menu-item>
                    <button
                      nz-button
                      [disabled]="user?.get('isDeleted')"
                      nzType="link"
                      style="color: #231c1f"
                    >
                      <span nz-icon nzType="stop" nzTheme="outline"></span
                      >结束流程
                    </button>
                  </li>
                  } @if (data.state?.del){
                  <li nz-menu-item>
                    <button nz-button nzType="link" style="color: #231c1f">
                      <span nz-icon nzType="delete" nzTheme="outline"></span
                      >删除流程
                    </button>
                  </li>
                  }
                </ul>
              </nz-dropdown-menu>
            </td>
          </tr>
          }
        </tbody>
      </nz-table>
      <ng-template #emptyResult>
        <nz-empty nzNotFoundImage="/img/group-empty.png"></nz-empty>
      </ng-template>
    </div>
  </div>
</div>
<!-- 全选操作：批量操作 -->
<div class="batch-toolbar-modal" *ngIf="setOfCheckedId?.size">
  <div class="batch-toolbar">
    <div class="styles_counter__18S08">
      <span>已选</span>
      <span class="styles_num__178Wa">{{ setOfCheckedId.size }}</span>
    </div>
    <div class="batch-toolbar-actions">
      <div class="ant-space ant-space-horizontal ant-space-align-center">
        <div class="ant-space-item" style="margin-right: 16px">
          <button nz-button nzType="text" (click)="deleteSelected()">
            <span nz-icon nzType="delete"></span>
            删除
          </button>
        </div>
      </div>
    </div>
    <div class="styles_cancel__AARoT">
      <button nz-button nzType="text" (click)="onAllChecked(false)">
        取消选中
      </button>
    </div>
  </div>
</div>
