<div data-ng-controller="CustodianIdentityAccessRequestsCtrl">
  <div class="row">
    <div class="col-md-12 clearfix">
        <span class="float-left">
        <a id="link-tiplist"
           href="#/custodian/home"
           data-uib-tooltip="{{'Home' | translate}}"
           class="btn btn-outline-secondary">
          <i class="fa-solid fa-arrow-left"></i>
        </a>

        <span id="link-reload"
              data-ng-click="reload()"
              data-uib-tooltip="{{'Refresh' | translate}}"
              class="btn btn-outline-secondary">
          <i class="fa-solid fa-sync"></i>
        </span>
      </span>
    </div>
  </div>
  <div class="row mt-2">
    <div class="col-md-12">
      <table class="table table-condensed table-striped">
        <thead>
        <tr>
          <th data-translate>Request date</th>
          <th data-translate>ID</th>
          <th data-translate>Report date</th>
          <th data-translate>User</th>
          <th data-translate>Request motivation</th>
          <th data-translate>Authorization</th>
        </tr>
        </thead>
        <tbody>
        <tr id="iar-{{$index}}" data-ng-repeat="iar in iars | orderBy:request_date:true">
          <td>{{iar.request_date | date:'dd-MM-yyyy HH:mm'}}</td>
          <td>{{iar.submission_progressive}}</td>
          <td>{{iar.submission_date | date:'dd-MM-yyyy HH:mm'}}</td>
          <td>{{iar.request_user_name | date:'dd-MM-yyyy HH:mm'}}</td>
          <td>{{iar.request_motivation | date:'dd-MM-yyyy HH:mm'}}</td>
          <td>
            <span data-ng-switch="iar.reply">
              <span data-ng-switch-when="authorized" data-translate>Authorized</span>
              <span data-ng-switch-when="denied" data-translate>Denied</span>
              <span data-ng-switch-when="pending">
                <button class="btn btn-sm btn-primary" data-ng-click="authorize_identity_access_request(iar.id)"
                        data-translate>Authorize</button>&nbsp;
                <button class="btn btn-sm btn-danger" data-ng-click="file_denied_identity_access_reply(iar.id)"
                        data-translate>Deny</button>
              </span>
            </span>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
