<!-- GUIPropertiesViewAndSortCustomizer -->
<div>
  <h2 id="page-heading" data-cy="VariableCategoryHeading">
    <span jhiTranslate="resilientApp.variableCategory.home.title">Variable Categories</span>

    <div class="d-flex justify-content-end">
      <button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading">
        <fa-icon icon="sync" [spin]="isLoading"></fa-icon>
        <span jhiTranslate="resilientApp.variableCategory.home.refreshListLabel">Refresh list</span>
      </button>

      <button
        id="jh-create-entity"
        data-cy="entityCreateButton"
        class="btn btn-primary jh-create-entity create-variable-category"
        [routerLink]="['/variable-category/new']"
      >
        <fa-icon icon="plus"></fa-icon>
        <span jhiTranslate="resilientApp.variableCategory.home.createLabel">Criar novo(a) Variable Category</span>
      </button>
    </div>
  </h2>

  <jhi-alert-error></jhi-alert-error>

  <jhi-alert></jhi-alert>

  @if (variableCategories?.length === 0) {
    <div class="alert alert-warning" id="no-result">
      <span jhiTranslate="resilientApp.variableCategory.home.notFound">Nenhum Variable Categories encontrado</span>
    </div>
  }

  @if (variableCategories && variableCategories.length > 0) {
    <div class="table-responsive table-entities" id="entities">
      <table class="table table-striped" aria-describedby="page-heading">
        <thead>
          <tr jhiSort [sortState]="sortState" (sortChange)="navigateToWithComponentValues($event)">
            <th scope="col" jhiSortBy="variableScope.name">
              <div class="d-flex">
                <span jhiTranslate="resilientApp.variableCategory.variableScope">Variable Scope</span>
                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>
            <th scope="col" jhiSortBy="code">
              <div class="d-flex">
                <span jhiTranslate="resilientApp.variableCategory.code">Code</span>

                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>
            <th scope="col" jhiSortBy="name">
              <div class="d-flex">
                <span jhiTranslate="resilientApp.variableCategory.name">Name</span>

                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>
            <th scope="col" jhiSortBy="description">
              <div class="d-flex">
                <span jhiTranslate="resilientApp.variableCategory.description">Description</span>

                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>

<!-- HIDDEN Columns 
            <th scope="col" jhiSortBy="id">
              <div class="d-flex">
                <span jhiTranslate="global.field.id">Código</span>

                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>
            <th scope="col" jhiSortBy="version">
              <div class="d-flex">
                <span jhiTranslate="resilientApp.variableCategory.version">Version</span>

                <fa-icon class="p-1" icon="sort"></fa-icon>
              </div>
            </th>
--> 

            <th scope="col"></th>
          </tr>
        </thead>
        <tbody>
          @for (variableCategory of variableCategories; track trackId) {
            <tr data-cy="entityTable">
              <td>
                @if (variableCategory.variableScope) {
                  <div>
                    <a [routerLink]="['/variable-scope', variableCategory.variableScope.id, 'view']">
                    {{variableCategory.variableScope.code}} - {{variableCategory.variableScope.name}}
                    </a>
                  </div>
                }
              </td>
              <td>{{ variableCategory.code }}</td>
              <td>{{ variableCategory.name }}</td>
              <td>{{ variableCategory.description }}</td>

<!-- HIDDEN Columns 
              <td>
                <a [routerLink]="['/variable-category', variableCategory.id, 'view']">{{ variableCategory.id }}</a>
              </td>
              <td>{{ variableCategory.version }}</td>
--> 

              <td class="text-end">
                <div class="btn-group">
                  <a
                    [routerLink]="['/variable-category', variableCategory.id, 'view']"
                    class="btn btn-info btn-sm"
                    data-cy="entityDetailsButton"
                  >
                    <fa-icon icon="eye"></fa-icon>
                    <span class="d-none d-md-inline" jhiTranslate="entity.action.view">Visualizar</span>
                  </a>

                  <a
                    [routerLink]="['/variable-category', variableCategory.id, 'edit']"
                    class="btn btn-primary btn-sm"
                    data-cy="entityEditButton"
                  >
                    <fa-icon icon="pencil-alt"></fa-icon>
                    <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Editar</span>
                  </a>

                  <button type="submit" (click)="delete(variableCategory)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
                    <fa-icon icon="times"></fa-icon>
                    <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Eliminar</span>
                  </button>
                </div>
              </td>
            </tr>
          }
        </tbody>
      </table>
    </div>
  }
</div>
