<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-21 15:39:30
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-01-26 09:36:07
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\ticket-management\\components\\invoice-requested\\invoice-requested.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->

<page-header-wrapper [title]="'开票申请'"> </page-header-wrapper>

<nz-card class="search-box" nzBordered>
  <div nz-row nzGutter="8">
    <div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
      <sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90, grid: { lg: 8, md: 12, sm: 12, xs: 24 } } }"
        [compact]="true" [button]="'none'"></sf>
    </div>
    <div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
      <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
      <button nz-button (click)="resetSF()">重置</button>
      <button nz-button (click)="exprot()"> 导出</button>
      <button nz-button nzType="link" (click)="expandToggle()">
        {{ !_$expand ? '展开' : '收起' }}
        <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
      </button>
    </div>
  </div>
</nz-card>

<nz-card class="content-box" nzBordered>
  <nz-tabset [nzTabBarExtraContent]="extraTemplate">
    <nz-tab nzTitle="待受理" (nzClick)="selectChange('1')"></nz-tab>
    <nz-tab nzTitle="处理中" (nzClick)="selectChange('2')"></nz-tab>
    <nz-tab nzTitle="已拒绝" (nzClick)="selectChange('4')"></nz-tab>
    <nz-tab nzTitle="已撤销" (nzClick)="selectChange('5')"></nz-tab>
    <nz-tab nzTitle="已受理" (nzClick)="selectChange('3')"></nz-tab>
    <nz-tab nzTitle="全部" (nzClick)="selectChange(null)"></nz-tab>
  </nz-tabset>
  <ng-template #extraTemplate>
    <div class="d-flex align-items-center"
      *ngIf="resourceStatus==='1'|| resourceStatus==='2' || resourceStatus==='3' || !resourceStatus">
      <div class="mr-md">
        已选择
        <strong class="text-red">{{ selectedRows.length }}</strong> 条数据&nbsp;&nbsp; 开票金额总计
        <strong class="text-red">{{ totalCallNo }}</strong>
        <a *ngIf="totalCallNo > 0" (click)="st.clearCheck();totalCallNo=0" class="ml-lg">清空</a>
      </div>
      <button nz-button *ngIf="resourceStatus==='1' || !resourceStatus" (click)="this.batchRequested()">批量受理</button>
      <button nz-button *ngIf="resourceStatus==='1' || !resourceStatus"
        (click)="this.rejectAction(selectedRows)">驳回</button>
      <button nz-button *ngIf="resourceStatus !=='4' && resourceStatus !=='5'"
        (click)="changeAddress(selectedRows)">修改地址</button>
      <button nz-button *ngIf="resourceStatus==='3' || !resourceStatus" (click)="printOrder(selectedRows)">快递下单</button>
    </div>
  </ng-template>

  <st #st [data]="service.$api_get_invoice_requested_page" [columns]="columns" [req]="{ process: beforeReq }"
    [page]="{}" [res]="{  process: afterRes }" [loading]="false" [scroll]="{ x: '1200px' }" (change)="stChange($event)">
    <ng-template st-row="vatappcode" let-item let-index="index" let-column="column">
      {{ item.vatappcode }} <br />
      <label class="text-primary">{{item.stsLabel}}</label>
    </ng-template>
  </st>
</nz-card>

<ng-template #rejectModal>
  <div nz-row nzGutter="8">
    <div nz-col nzSpan="24" se-container [labelWidth]="80">
      <se [col]="1" label="备注" required>
        <textarea nz-input rows="3" [(ngModel)]="rejectReason" placeholder="请说明驳回原因"
          style="width: 325px; margin-left: 14px"></textarea>
      </se>
    </div>
  </div>
</ng-template>