<div class="container">
  <div class="row">
    <div class="content-block">
      <ngx-loading [show]="loading" [config]="{fullScreenBackdrop: true}"></ngx-loading>
      <h2 class="title">頁面管理</h2>
      <button type="button" class="btn btn-sm btn-primary" routerLink="/sys/sys005-create-page" routerLinkActive="active">新增頁面資料</button>
      <div class="right">
        <input type="search" class="form-group" [(ngModel)]="this.tableQueryData.Term" placeholder="查詢模組/頁面">
        <button type="submit" class="btn btn-sm btn-outline-primary" (click)="doSearch()">
          <i class="fa fa-search" aria-hidden="true"></i>
        </button>
        <button type="submit" class="btn btn-sm btn-outline-danger" (click)="clearSearch()">
          <i class="fa fa-times" aria-hidden="true"></i>
        </button>
      </div>
      <div class="table-responsive">
        <table class="table table-hover">
          <thead>
            <tr>
              <th (click)="order('PageModule')">
                <i [ngClass]="{'asc icon-arrow-up-circle': IsAsc, 'desc icon-arrow-down-circle': !IsAsc}" *ngIf="this.item === 'PageModule'"></i>
                所屬模組</th>
              <th (click)="order('PageName')">
                <i [ngClass]="{'asc icon-arrow-up-circle': IsAsc, 'desc icon-arrow-down-circle': !IsAsc}" *ngIf="this.item === 'PageName'"></i>
                頁面名稱</th>
              <th (click)="order('PageURL')">
                <i [ngClass]="{'asc icon-arrow-up-circle': IsAsc, 'desc icon-arrow-down-circle': !IsAsc}" *ngIf="this.item === 'PageURL'"></i>
                頁面URL</th>
              <th>執行動作</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let pageData of pageDataList">
              <td>{{pageData.PageModule}}</td>
              <td>{{pageData.PageName}}</td>
              <td>{{pageData.PageURL}}</td>
              <td>
                <button type="submit" class="btn btn-sm btn-outline-warning" (click)="goEditPage(pageData)">
                  <i class="fa fa-pencil"></i> 編輯
                </button>
                <button type="submit" class="btn btn-sm btn-outline-danger" (click)="deletePageData(pageData.Id)">
                  <i class="fa fa-trash"></i> 刪除
                </button>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="noData" *ngIf="pageDataList.length == 0">
        暫無資料
      </div>
      <div *ngIf="pageDataList.length > 0" class="pagination_center">
        <div class="pagination">
          <span *ngFor="let page of pageLinks;">
            <a *ngIf="page.pageNo!==this.tableQueryData.CurrentPage" (click)="onPageChange($event,page.pageNo)">{{page.text}}</a>
            <a *ngIf="page.pageNo===this.tableQueryData.CurrentPage" class="active">{{page.text}}</a>
          </span>
        </div>
      </div>
    </div>
  </div>
</div>
