<!-- 
 Copyright 2018 The MIT Internet Trust Consortium
 
 Portions copyright 2011-2013 The MITRE Corporation
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<!-- approved sites (grants) -->

<script type="text/html" id="tmpl-grant-table">
  <div class="well well-small">
    <button class="btn btn-small refresh-table">
      <i class="icon-refresh"></i>
      <span data-i18n="common.refresh">Refresh</span>
    </button>
  </div>

  <div id="grant-approved-tab">
    <p data-i18n="grant.grant-table.text">
      These are sites you have approved manually. If the same site asks for the
      same access in the future, it will be granted without prompting.
    </p>

    <div
      id="grant-table-empty"
      class="alert alert-info"
      data-i18n="grant.grant-table.no-sites"
    >
      You have not approved any sites.
    </div>

    <table id="grant-table" class="table table-hover table-striped">
      <thead>
        <tr>
          <th></th>
          <th data-i18n="grant.grant-table.application">Application</th>
          <th><i class="icon-time"></i></th>
          <th><i class="icon-edit"></i></th>
        </tr>
      </thead>
      <tbody></tbody>
    </table>
  </div>

  <div class="well well-small">
    <button class="btn btn-small refresh-table">
      <i class="icon-refresh"></i>
      <span data-i18n="common.refresh">Refresh</span>
    </button>
  </div>
</script>

<script type="text/html" id="tmpl-grant">
  <td>
    <% if (client.dynamicallyRegistered) { %>
    <span class="label label-inverse dynamically-registered"
      ><i class="icon-globe icon-white"></i
    ></span>
    <% } %>
  </td>

  <td>
    <span title="<%- client.clientId %>"
      ><%- client.clientName != null ? client.clientName : (
      client.clientId.substr(0,8) + '...' ) %></span
    >
    <div class="client-more-info-block"></div>
    <div class="scope-list"></div>
  </td>

  <td>
    <div>
      <i data-i18n="grant.grant-table.authorized">Authorized:</i>
      <span title="<%- formattedDate.hoverCreationDate %>"
        ><%- formattedDate.displayCreationDate %></span
      >
    </div>

    <div>
      <i data-i18n="grant.grant-table.last-accessed">Last accessed:</i>
      <span title="<%- formattedDate.hoverAccessDate %>"
        ><%- formattedDate.displayAccessDate %></span
      >
    </div>

    <div>
      <i data-i18n="common.expires">Expires:</i>
      <span title="<%- formattedDate.hoverTimeoutDate %>"
        ><%- formattedDate.displayTimeoutDate %></span
      >
    </div>
  </td>

  <td>
    <button class="btn btn-danger btn-delete pull-right">
      <i class="icon-trash icon-white"></i>
      <span data-i18n="common.revoke">Revoke</span>
    </button>
  </td>
</script>
