<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzLg='18' class="list-template__searchBox"></div>
      <div nz-col nzLg="6" class="list-template__btns">
        <button nz-button class="btn default" (click)='refreshTaskType()' [nzLoading]="refreshLoading">刷新缓存</button>
        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</button>
      </div>
    </div>
    <div class="list-template__bottom">
      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
        [nzLoading]="loading1">
        <thead>
          <tr class="thead">
            <th nzWidth="14%">班次名称</th>
            <th nzWidth="14%">班次描述</th>
            <th nzWidth="14%">呼叫中心班次</th>
            <th nzWidth="14%">优先级班次</th>
            <th nzWidth="14%">工作时间</th>
            <th nzWidth="14%">工作日/节假日</th>
            <th nzWidth="16%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData">
            <td>{{ data.name }}</td>
            <td>{{ (data.describe?data.describe:'-') }}</td>
            <td>{{ data.bindCall == 1 ? '是' : '否' }}</td>
            <td>{{ data.bindPriority == 1 ? '是' : '否' }}</td>
            <td>
              <div *ngIf="data.scheduleClassTimes">
                <div *ngFor="let time of data.scheduleClassTimes">
                  {{(time.startTime).substring(10,16)}} - {{(time.endTime).substring(10,16)}}
                </div>
              </div>
              <div *ngIf="!data.scheduleClassTimes.length">
                -
              </div>
            </td>
            <td *ngIf="data.type==1">工作日</td>
            <td *ngIf="data.type==2">节假日</td>
            <td *ngIf="data.type==3">工作日,节假日</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
                <span *ngIf="coopBtns.del" (click)="showDelModal(data.id)">删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 新增/编辑模态框 -->
<div class="display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
  <div class="modalBody">
    <div class="title">{{add?"新增":"编辑"}} - 班次<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
    </div>
    <overlay-scrollbars #osComponentRef1 class="content">
      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
        <nz-form-item>
          <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="classesName">班次名称</nz-form-label>
          <nz-form-control nzErrorTip="请输入班次名称!">
            <nz-input-group>
              <input type="classesName" nz-input formControlName="classesName" placeholder="请输入班次名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="description">班次描述</nz-form-label>
          <nz-form-control nzErrorTip="请输入班次描述!">
            <nz-input-group>
              <textarea type="description" nz-input formControlName="description" placeholder="请输入班次描述"></textarea>
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSpan]="9" nzRequired nzFor="bindCall">呼叫中心班次</nz-form-label>
          <nz-form-control [nzSpan]="15" nzErrorTip="请选择呼叫中心班次!">
            <nz-radio-group formControlName="bindCall">
              <label nz-radio [nzValue]="1">是</label>
              <label nz-radio [nzValue]="0">否</label>
            </nz-radio-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSpan]="9" nzRequired nzFor="bindPriority">优先级班次</nz-form-label>
          <nz-form-control [nzSpan]="15" nzErrorTip="请选择优先级班次!">
            <nz-radio-group formControlName="bindPriority">
              <label nz-radio [nzValue]="1">是</label>
              <label nz-radio [nzValue]="0">否</label>
            </nz-radio-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="datesType">适用日期类型</nz-form-label>
          <nz-form-control nzErrorTip="请选择适用日期类型!">
            <nz-checkbox-group formControlName="datesType" [(ngModel)]="oneOption"
              (ngModelChange)="logDateType(oneOption)">
            </nz-checkbox-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item class="timer">
          <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="timer1">时间段1</nz-form-label>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerF1" nzFormat="HH:mm"></nz-time-picker>
              <span class="line"> -</span>
            </div>
          </nz-form-control>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerT1" nzFormat="HH:mm"></nz-time-picker>
            </div>
          </nz-form-control>
          <div class="red"
            *ngIf="(validateForm.get('timerF1').dirty||validateForm.get('timerT1').dirty)&&(!validateForm.value.timerF1||!validateForm.value.timerT1)">
            请输入时间段1!</div>
        </nz-form-item>
        <nz-form-item class="timer">
          <nz-form-label [nzSm]="24" [nzXs]="24" nzFor="timer2">时间段2</nz-form-label>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerF2" nzFormat="HH:mm"></nz-time-picker>
              <span class="line"> -</span>
            </div>
          </nz-form-control>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerT2" nzFormat="HH:mm"></nz-time-picker>
            </div>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item class="timer">
          <nz-form-label [nzSm]="24" [nzXs]="24" nzFor="timer3">时间段3</nz-form-label>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerF3" nzFormat="HH:mm"></nz-time-picker>
              <span class="line"> -</span>
            </div>
          </nz-form-control>
          <nz-form-control class="dib">
            <div>
              <nz-time-picker formControlName="timerT3" nzFormat="HH:mm"></nz-time-picker>
            </div>
          </nz-form-control>
        </nz-form-item>
      </form>
    </overlay-scrollbars>
    <div class=" display_flex justify-content_flex-center">
      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
      <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
    </div>
  </div>
</div>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
  (confirmDelEvent)="confirmDel()" content="您确认要删除此班次吗？"></app-dialog-delete>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
