<div class="detail-task-container">
  <h2>{{ 'taskDetailsTitle' | translate }}</h2>

  <mat-card>
    <mat-card-header>
      <mat-card-subtitle>{{ 'createdBy' | translate }}: {{ task.createdBy }}</mat-card-subtitle>
    </mat-card-header>

    <mat-card-content>
      <p><strong>{{ 'taskId' | translate }}:</strong> {{ task.uuid }}</p>
      <p><strong>{{ 'status' | translate }}:</strong> {{ task.status }}</p>
      <p><strong>{{ 'creationDate' | translate }}:</strong> {{ task.createdAt | date: 'short' }}</p>
      <p><strong>{{ 'notes' | translate }}:</strong> {{ task.notes }}</p>
      
      <h3>{{ 'includedCommandGroups' | translate }}</h3>
      <table mat-table [dataSource]="task.commandGroups" class="mat-elevation-z8">
        <ng-container matColumnDef="name">
          <th mat-header-cell *matHeaderCellDef> {{ 'commandGroupColumn' | translate }} </th>
          <td mat-cell *matCellDef="let group"> {{ group.name }} </td>
        </ng-container>

        <ng-container matColumnDef="uuid">
          <th mat-header-cell *matHeaderCellDef> UUID </th>
          <td mat-cell *matCellDef="let group"> {{ group.uuid }} </td>
        </ng-container>

        <tr mat-header-row *matHeaderRowDef="['name', 'uuid']"></tr>
        <tr mat-row *matRowDef="let row; columns: ['name', 'uuid'];"></tr>
      </table>

      <h3>{{ 'commandsToExecute' | translate }}</h3>
      <div *ngFor="let group of task.commandGroups">
        <p><strong>{{ 'group' | translate }}: </strong>{{ group.name }}</p>
        <table mat-table [dataSource]="group.commands" class="mat-elevation-z8">
          <ng-container matColumnDef="commandName">
            <th mat-header-cell *matHeaderCellDef> {{ 'commandColumn' | translate }} </th>
            <td mat-cell *matCellDef="let command"> {{ command.name }} </td>
          </ng-container>

          <ng-container matColumnDef="commandUuid">
            <th mat-header-cell *matHeaderCellDef> UUID </th>
            <td mat-cell *matCellDef="let command"> {{ command.uuid }} </td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="['commandName', 'commandUuid']"></tr>
          <tr mat-row *matRowDef="let row; columns: ['commandName', 'commandUuid'];"></tr>
        </table>
      </div>
    </mat-card-content>
  </mat-card>

  <div class="task-actions">
    <button class="ordinary-button" (click)="closeDialog()">Cancel</button>
  </div>
</div>
