<app-page-header title="Correspondents">
  <button type="button" class="btn btn-sm btn-outline-secondary" (click)="openCreateDialog()">
    Create
  </button>
</app-page-header>

<ngb-pagination [pageSize]="25" [collectionSize]="collectionSize" [(page)]="page" (pageChange)="reloadData()" aria-label="Default pagination"></ngb-pagination>

<table class="table table-striped">
    <thead>
    <tr>
      <th scope="col">Name</th>
      <th scope="col">Matching</th>
      <th scope="col">Document count</th>
      <th scope="col">Last correspondence</th>
      <th scope="col">Actions</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let correspondent of data">
      <td scope="row">{{ correspondent.name }}</td>
      <td scope="row">{{ getMatching(correspondent) }}</td>
      <td scope="row">{{ correspondent.document_count }}</td>
      <td scope="row">{{ correspondent.last_correspondence | date }}</td>
        <td scope="row">
          <div class="btn-group">
          <button class="btn btn-sm btn-outline-secondary" (click)="openEditDialog(correspondent)">Edit</button>
          <button class="btn btn-sm btn-outline-danger" (click)="openDeleteDialog(correspondent)">Delete</button>
        </div>
        </td>
    </tr>
    </tbody>
  </table>
