{% extends "base.html" %}


{% block container %}

<div class="col-md-12 sub-header">
    <div class="container">
	<div class="row">
	    <h3>&nbsp&nbsp;REQUESTS
		<span class="pull-right">
		    <a id="sort" href="/requests?sort" type="button" class="btn btn-default">
			<i class="glyphicon glyphicon-sort-by-attributes"></i>
			&nbsp;sort
		    </a>&nbsp;&nbsp;
		    <a id="max-results" href="request?max" type="button" class="btn btn-default">
			<i class="glyphicon glyphicon-resize-vertical"></i>
			&nbsp;Max results
		    </a>
		</span>
	    </h3>
	    <br>
	</div>
    </div>
</div>


<div class="container">
    <div class="row">

	
	<div class="col-md-12">
	    <br>
	</div>


	<div class="col-md-12">
	    <div class="card-columns">
	
		{% for request in requests %}
		
		<div class="card card-on-deck">

		    
		    <div class="card-block">

			<h4 class="text-center">
			    <a href="{{ url_for('.request_views', id=request.id) }}">
				<strong>{{ request.title }}</strong>
			    </a>
			</h4>
			
			<br>
			
			{% if request.post_date %}
			<span class="label label-default">
			    <i class="glyphicon glyphicon-time"></i>
			    &nbsp;<strong>Post date:</strong>
			    &nbsp;
			    <span class="more">
				{{request.post_date}}
			    </span>
			</span>
			{% endif %}
			
			{% if request.status == "Complete" or request.status == "complete" %}
			&nbsp;&nbsp;
			<span class="label label-success">
			    <i class="glyphicon glyphicon-tag"></i>
			    &nbsp;
			    <strong>Processing Status:</strong>
			    &nbsp;
			    <span class="more">
				{{request.status}}
			    </span>
			</span>
			{% else %}			
			&nbsp;&nbsp;
			<span class="label label-danger">
			    <i class="glyphicon glyphicon-tag"></i>
			    &nbsp;
			    <strong>Status:</strong>
			    &nbsp;
			    <span class="more">
				{{request.status}}
			    </span>
			</span>
			{% endif %}
			
			
			{% if request.description_of_model %}
			<br><br>
			<span class="label label-default">
			    <i class="glyphicon glyphicon-tag"></i>
			    &nbsp;
			    <strong>Model:</strong>
			    &nbsp;
			    <span class="more">
				{{request.description_of_model}}
			    </span>
			</span>
			{% endif %}
			
			<br><br>
			<p class="card-text">
			    <strong>Reason for request:</strong>
			    &nbsp;&nbsp;
			    <span class="request-body">
				{{ request.reason_for_request }}
			    </span>
			</p>
			<br>
			<span class="label label-info">
			    {{request.analysis.collaboration}}
			</span>
			&nbsp;&nbsp;
			<a href="{{ url_for('.analyses', id=request.analysis.id) }}">
			    <span class="analysis-title">
				{{ request.analysis.title }}
			    </span>
			</a>
			<br><br><br>
			
			<span>
			    <span class="badge">
				<i class="glyphicon glyphicon-user"></i>
				&nbsp;{{request.requester.name}}
			    </span>
			    <span class="badge">
				{{request.scan_points[:]|length}}&nbsp;parmeter points
			    </span>
			    
			    <a href="{{ url_for('.request_views', id=request.id) }}">
				<span class="label label-primary pull-right">
				    <i class="glyphicon glyphicon-eye-open"></i>
				    view
				</span>
			    </a>
			    <br>
			</span>
				
		    </div>
		</div>
		{% endfor %}
	    </div>
	</div>
    </div>
</div>

{% endblock %}
