{% extends "base.html" %}

{% block container %}

<div class="container">
  <div class="row">
    <h3>Point response</h3>
    <span> Request: <a href="{{ url_for('.request_views', ruuid=pointresponse.point_request.scan_request.uuid) }}">
	{{ pointresponse.point_request.scan_request.title }}
      </a>
    </span>
    <br><br>

    <div class="col-md-12">
      <div class="card col-md-6">
	<br>
	<table class="table col-md-12 table-hover table-bordered">
	  <tbody>
	    <tr>
	      <td class="bg-success">Lower 1 sig expected CLs</td>
	      <td>{{ pointresponse.lower_1sig_expected_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Lower 2 sig expected CLs</td>
	      <td>{{ pointresponse.lower_2sig_expected_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Expected CLs</td>
	      <td>{{ pointresponse.expected_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Upper 1 sig expected CLs</td>
	      <td>{{ pointresponse.upper_1sig_expected_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Upper 2 sig expected CLs</td>
	      <td>{{ pointresponse.upper_2sig_expected_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Observed CLs</td>
	      <td>{{ pointresponse.observed_CLs }}</td>
	    </tr>

	    <tr>
	      <td class="bg-success">Log likelihood at reference</td>
	      <td>{{ pointresponse.log_likelihood_at_reference }}</td>
	    </tr>

	  </tbody>
	</table>
      </div>

      <div class="col-md-6">
	{% if pointresponse.archives[:] %}
	<h4> File of the point response </h4>


	<a download="{{pointresponse.archives[0].original_file_name}}"
	   class="btn btn-success btn-sm"
	   href="{{'https://s3.amazonaws.com/'+ bucket_name +'/'+ pointresponse.archives[0].file_name}}"
	   >
	  <i class="glyphicon glyphicon-download"></i>&nbsp;Download File
	</a>
	{% endif %}


      </div>
    </div>


    {% if pointresponse.basic_answers[:] %}
    <div class="col-md-6">
      <h3> Basic Request </h3>
      {% for basicresponse in pointresponse.basic_answers %}

      <br>
      <table class="table col-md-12 table-hover table-bordered">
	<tbody>
	  <tr>
	    <td class="bg-success">Lower 1 sig expected CLs</td>
	    <td>{{ pointresponse.lower_1sig_expected_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success">Lower 2 sig expected CLs</td>
	    <td>{{ pointresponse.lower_2sig_expected_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success">Expected CLs</td>
	    <td>{{ pointresponse.expected_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success">Upper 1 sig expected CLs</td>
	    <td>{{ pointresponse.upper_1sig_expected_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success">Upper 2 sig expected CLs</td>
	    <td>{{ pointresponse.upper_2sig_expected_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success">Observed CLs</td>
	    <td>{{ pointresponse.observed_CLs }}</td>
	  </tr>

	  <tr>
	    <td class="bg-success text-weight-bold">Log likelihood at reference</td>
	    <td>{{ pointresponse.log_likelihood_at_reference }}</td>
	  </tr>

	</tbody>
      </table>

      {% endfor %}
    </div>

    <div class="col-md-6">

    </div>
    {% endif %}
  </div>
</div>
{% endblock %}
