<div *ngIf="tickets && !tickets.length" class="fl-heading-md fl-gray-color" i18n>No tickets</div>
<p class="fl-detail" i18n>Shows tickets created by the user or tickets related to one of the user's clients.</p>
<app-fl-backdrop *ngIf="!tickets || loading" overlayParent></app-fl-backdrop>
<div *ngIf="tickets && tickets.length" layoutDirection="column">
  <table class="full-width" mat-table [dataSource]="tickets">
    <ng-container matColumnDef="id">
      <th mat-header-cell *matHeaderCellDef i18n>ID</th>
      <td class="position-relative" mat-cell *matCellDef="let ticket">
        <app-status-line [direction]="LineDirection.Vertical" [type]="LineType.Solid"
                         [color]="ticket.appLineColor"></app-status-line>
        <a [routerLink]="[config.getPanelUrl('tickets'), ticket.id]">
          {{ticket.id}}
        </a>
      </td>
    </ng-container>
    <ng-container matColumnDef="title">
      <th mat-header-cell *matHeaderCellDef i18n>Title</th>
      <td mat-cell *matCellDef="let ticket">
        <a [routerLink]="[config.getPanelUrl('tickets'), ticket.id]">
          {{ticket.title}}
        </a>
      </td>
    </ng-container>
    <ng-container matColumnDef="created_at">
      <th mat-header-cell *matHeaderCellDef i18n>Created at</th>
      <td mat-cell *matCellDef="let ticket">
        <a [routerLink]="[config.getPanelUrl('tickets'), ticket.id]">
          <app-date-displayer [date]="ticket.created_at" withTime></app-date-displayer>
        </a>
      </td>
    </ng-container>
    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
  </table>

  <div *ngIf="previousPage || nextPage" class="fl-margin-top">
    <button mat-button (click)="changePage('previous')"
            [disabled]="previousPage === false || loading === true" color="primary" i18n>
      Previous page <ng-container *ngIf="previousPage && loading !== true">({{currentPage - 1}})</ng-container>
    </button>
    <button mat-button (click)="changePage('next')"
            [disabled]="nextPage === false || loading === true" color="primary" i18n>
      Next page <ng-container *ngIf="nextPage && loading !== true">({{currentPage + 1}})</ng-container>
    </button>
  </div>

</div>
