{% extends "mcsimulator/layout.html" %}
{% load static %}

{% block title %}Results{% endblock %}
{% block head_extra %}
  <meta http-equiv="Refresh" content="5">
  <style type="text/css">
    p { color: #336699; }
    div.centered {
      margin: 10px 0px 10px 0px;
      text-align: center;
    }
  </style>

<form method="GET" action="/logout/">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
<ol>
  <input type=submit id="btn_logout" value="logout" onclick="logout_user()" />
</ol>
</form>

{% endblock %}


{% block content %}
  <h1>{{ job.sim.name }}:
    <small>{{ run.created|date:'DATETIME_FORMAT' }} ({{ run.created|timesince }} old)</small></h1>
  <fieldset>
    <legend>Simulation Parameters:</legend>
  <pre>{% for p in params %} {{ p }} {% endfor %}
    (<a target="_blank" href="/job/{{ job.ref }}">reconfigure</a>)
  </pre>
  <p>Status: <b><font color="#000000">{{ run.status }}</font></b>
  </fieldset>
  <script language="javascript">
    var runid = "{{ runref }}";
    var sim   = "{{ job.sim.name }}";
    var compN = "{{ compN }}";
    var npoints = "{{ job.npoints }}";
  </script>
  <script type="text/javascript" src="{% static 'status.js' %}"></script>
  <script language="javascript">
    $(document).ready(doInit);
  </script>

  <fieldset id="linFieldset">
    <legend id="linLegend">
      Data plots [LIN] (click here for logarithmic - or press 'L')</legend>
    <div id="linPlots" class="centered"></div>
  </fieldset>
  <fieldset id="logFieldset">
    <legend id="logLegend">
      Data plots [LOG] (click here for linear - or press 'L')</legend>
    <div id="logPlots" class="centered"></div>
  </fieldset>
  {% if compNs != 'None' %}
  <div><ul id="comps" class="inlinelist"></ul></div>
  {% endif %}

  <br />

  <fieldset>
    <legend>Instrument layout</legend>
    <div id="imgLayout" class="centered"></div>
    <div class="centered"><span id=vrml>layout.wrl</span></div>
  </fieldset>

  <br />

  <fieldset>
    <legend>Simulation output</legend>
    <div class="centered">
      <ul class="inlinelist">
        <li>
          <span id=mcstas>mcstas.tar.gz</span>
        </li>
        <li>
          <span id=instr>{{ job.sim.displayname }}.instr</span>
        </li>
        <li>
          <span id=out>stdout</span>
        </li>
        <li>
          <span id=err>stderr</span>
        </li>
      </ul>
    </div>
  </fieldset>

{% endblock %}
