{% extends "base.html" %}

{% block container %}
<div class="col-md-12 sub-header">
    <h3> {{ request.title }}
	<span class="pull-right" ng-controller="AddParameterCtrl as ctrl">
	    <button class="btn btn-primary" ng-click="ctrl.addParameter({{request.id}})" type="button">
		<i class="glyphicon glyphicon-plus"></i>
		&nbsp;Add Parameter Point
		</button>
	</span>
    </h3>
</div>

<div class="container-fluid">
    <div class="row">
	<!--First column -->
	<div class="col-md-2 scroll-area">
	    <br>
	    <table class="table col-md-12 table-bordered table-hover">

		<tbody ng-controller="ParameterViewCtrl as ctrl">
		    {% for pointrequest in request.scan_points %}
		    <tr>
			<td>
			    <span ng-click="ctrl.fetchParameter('{{pointrequest.id}}', {{loop.index0+1}})" style="cursor:pointer">
				<h5><strong> Point {{loop.index0+1}}</strong></h5>
			    </span>

			    <span class="label label-default">{{ pointrequest.point_coordinates[:]|length }} coordinates</span>
			    <span class="label label-default">{{ pointrequest.requests[:]|length}} basic requests</span>
			</td>
		    </tr>
		    {% endfor %}
		</tbody>
	    </table>
	</div>

	<div class="col-md-6 card-flat scroll-area" ng-controller="ParameterViewCtrl as ctrl">
	    <span bind-html-compile="ctrl.parameterData()"></span>
	</div>

	<div class="col-md-2 scroll-area">
	    <br>
	    <span>
		<strong>
		    <span>
			<i class="glyphicon glyphicon-pencil"></i>
			&nbsp;analysis&nbsp;
		    </span>
		</strong>
		<a href="{{ url_for('.analyses', id=request.analysis.id) }}">
		    <span id="analysis-title">{{ request.analysis.title }}
		    </span>
		    </a>
		    <span class="label label-primary">
			{{ request.analysis.collaboration }}
		    </span>
	    </span>

	    <br><br>
	    <strong>Reason for request</strong>
	    <br>
	    {{ request.reason_for_request }}
	    <br>
	    <br>
	    <strong>Additional information</strong>
	    <br>
		{{request.additional_information }}
	    <br><br>
	</div>
    </div>
</div>

{% include "modal_add_parameter.html" %}
{% include "modal_add_basic_request.html" %}

{% endblock %}
