{% extends "report_base.html" %}

{% block body %}
<br>
<div class="container">
  <h4>Scout - Gene panel report</h4> - created on:&nbsp;<strong>{{report_created_at}}</strong><br><br>
  {{ genes_panel() }}
  [END OF REPORT]<br><br>
  <a href="http://www.clinicalgenomics.se/scout/" target="_blank">http://www.clinicalgenomics.se/scout/</a>
</div>
{% endblock %}

{% macro genes_panel() %}
<div class="card border-dark mb-3">
  <div class="card-header">
    Panel: <a href="{{ url_for('panels.panel', panel_id=panel._id) }}">{{panel.name_and_version}}</a>
  </div>
  <div class="card-body">
    <table class="table table-sm">
      <tr>
        <td>Date:<span class="badge badge-secondary badge-pill">{{ panel.date.strftime('%Y-%m-%d') }}</span></td>
      </tr>
      <tr>
        <td>Number of genes:<span class="badge badge-secondary badge-pill">{{ panel.genes|length }}</span></td>
      </tr>
      <tr>
        <td>Institute: <span class="badge badge-secondary badge-pill">{{ panel.institute.display_name }}</span></td>
      </tr>
      <tr>
        <td>Panel archived:
          {% if panel.is_archived %}
            <span class="badge badge-danger badge-pill">True</span>
          {% else %}
            <span class="badge badge-secondary badge-pill">False</span>
          {% endif %}
        </td>
      </tr>
      <tr>
        <td>Panel database ID: <span class="badge badge-secondary badge-pill">{{ panel._id }}</span></td>
      </tr>
    </table>
  </div>
</div>
  <br>
  <div>
    <table class="table table-sm">
      <tr>
        <td></td>
        <td>HGNC id</td>
        <td>Gene name</td>
        <td>Disease associated transcripts</td>
        <td>Reduced penetrance</td>
        <td>Mosaicism</td>
        <td>Entry version</td>
        <td>Inheritance</td>
      </tr>
      {% for gene in panel.genes|sort(attribute='symbol') %}
        <tr>
          <td>{{loop.index}}</td>
          <td>
            <a href="https://www.genenames.org/cgi-bin/gene_symbol_report?hgnc_id={{gene.hgnc_id}}" target="_blank">{{gene.hgnc_id}}</a>
          </td>
          <td>{{ gene.symbol }}</td>
          <td>{{ gene.disease_associated_transcripts|join(', ') }}</td>
          <td>{{ 'Reduced penetrance' if gene.reduced_penetrance }}</td>
          <td>{{ 'Mosaicism' if gene.mosaicism}}</td>
          <td><span class="badge badge-secondary">{{ gene.database_entry_version }}</span></td>
          <td>{{ gene.inheritance_models|join(', ') }}</td>
        </tr>
      {% endfor %}
    </table>
  </div>
</div>
{% endmacro %}
