{% extends "layout.html" %}
{% block content %}
	  <div class="page-header">
      <h1>Revocation Requests <small>Certificate revocation send by users</small></h1>
    </div>

    <div class="row">
      <div class="col-md-12"><h4>Click on <strong>Revoke</strong> button to validate a revocation request. Revoked certificate will be added to cacrl.pem file.</h4></div>
    </div>

		<div class="row">
		  <div class="col-md-12">
				<div class="panel panel-danger margin-top-40 table">
					<div class="panel-heading">
						<h3 class="panel-title">All Revocation Requests</h3>
						<div class="pull-right">
							<span class="clickable filter" data-toggle="tooltip" title="Toggle table filter" data-container="body">
								<i class="glyphicon glyphicon-filter"></i>
							</span>
						</div>
					</div>
					<div class="panel-body">
						<input type="text" class="form-control" id="cacert-table-filter" data-action="filter" data-filters="#cacert-table" placeholder="Filter Columns" />
					</div>
					<table class="table table-hover" id="cacert-table">
						<thead>
							<tr>
								<th>#</th>
								<th>serial</th>
								<th>Filename</th>
								<th>State</th>
								<th>Common Name</th>
								<th>Request Date</th>
								<th>Reason</th>
								<th></th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							{% for request in data_list -%}
        		  <tr>
        		    <td>{{ request['index'] }}</td>
        		    <td><a href="/viewcert?name={{ request['filename'] }}&type=X509">{{ request['serial'] }}</a></td>
        		    <td><a href="/viewcert?name={{ request['filename'] }}&type=X509">{{ request['filename'] }}</a></td>
        		    <td><span style="color: #1ebfae; font-weight: bold">{{ request['status'] }}</span></td>
        		    <td>{{ request['cn'] }}</td>
        		    <td>{{ request['request_date'] }}</td>
        		    <td>{{ request['reason'] }}</td>
        		    {% if not request['frozen'] -%}
        		    <td><a class="btn btn-danger" href="/revoke_cert?request_id={{ request['id'] }}&serial={{ request['serial'] }}" role="button" title="Revoke certificate">
        		      <i class="fa fa-arrow-circle-right" aria-hidden="true"></i> Revoke</a>
        		    </td>
        		    <td><a class="btn btn-default" href="/reject_revocation_request?request_id={{ request['id'] }}" role="button" title="Reject request">
        		      <i class="fa fa-times" aria-hidden="true"></i> Reject</a>
        		    </td>
        		    {% else -%}
        		    <td>--</td>
        		    <td>--</td>
        		    {% endif -%}
        		  </tr>
        		  {% endfor -%}
						</tbody>
					</table>
				</div>
			</div>
		</div>
{% endblock %}