<commit_before>{% extends "layout.html" %}

{% block title %}
  {{ super() }} - {{ current_user.name }} - Gene Panels
{% endblock %}

{% block top_nav %}
  {{ super() }}
  <li>
    <a href="{{ url_for('cases.index') }}">Institutes</a>
  </li>
  <li class="active">
    <span class="navbar-text">Gene Panels</span>
  </li>
{% endblock %}

{% block content_main %}
  <div>
    {% if panel_groups %}
      {% for institute,panels in panel_groups %}
        {{ panel_view(institute,panels) }}
      {% endfor %}
    {% else %}
      <div class="panel-body">No gene panels found.</div>
    {% endif %}
  </div>
{% endblock %} <!-- end of content_main -->


{% macro panel_view(institute,panels) %}
  <div class="panel panel-default">
    <div class="panel-heading">
      <strong>{{ institute.display_name }}</strong> - Panels
    </div>
    <div>
        <table class="table table-striped">
        <thead>
          <tr>
            <th width="30%">Name</th>
            <th width="20%">Version</th>
            <th width="15%">Number of genes</th>
            <th width="25%">History</th>
            <th width="10%"></th>
          </tr>
        </thead>
      {% for panel in panels %}
        <!--create table for each panel-->
        <tbody>
          <tr>
            <td><a href="{{ url_for('panels.panel', panel_id=panel._id) }}">{{ panel.display_name }}</a></td>
            <td>{{ panel.version }} ({{ panel.date.date()}})</td>
            <td>{{ panel.genes|length}}</td>
            <td><button id="{{panel._id}}" type="button" class="btn btn-primary btn-xs history_btn"><span class="glyphicon glyphicon-zoom-in"></span></button><br>{{ history_view(panel._id, panel.panel_name) }}</td>
            <td><button id="{{panel._id}}" type="button" class="btn btn-warning btn-xs modify_btn"><span class="glyphicon glyphicon-pencil"></span></button><br>{{ history_view(panel._id, panel.panel_name) }}</td>
          </tr>
          {{ modify_panel(panel._id, panel) }}
        </tbody>
      {% endfor %}
      </table>
    </div>

  </div>
{% endmacro %}

{% macro history_view(panel_id, panel_name) %}
  <div id="paneldiv_{{panel_id}}" style="display:none;">
    <ul>
    {% for version in panel_versions[panel_name]|sort(attribute='version', reverse=True) %}
      <li><a href={{ url_for('panels.panel', panel_id=version._id) }}>{{ version.version }} {{ version.date.date() }} {{ version.genes|length }} genes</a></li>
    {% endfor %}
    </ul>
  </div>
{% endmacro %}

{% macro modify_panel(panel_id, panel_obj) %}
  <tr id="modifydiv_{{panel_id}}" style="display:none;">
    <td>{{ modify_form(panel_obj) }}</td>
  </tr>
{% endmacro %}

{% macro modify_form(panel_obj) %}
  <form>
    
  </form>
{% endmacro %}


{% block scripts %}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">

$('.history_btn').on('click', function(){
    var bid = $(this)[0].id;
    var sel = '#paneldiv_' + bid;
    if($(sel).is(':visible')){
      $(sel).hide();
    }
    else{
      $(sel).fadeToggle();
    }<commit_msg>fixed the link to the upload new panel guide<commit_after>{% extends "layout.html" %}

{% block title %}
  {{ super() }} - {{ current_user.name }} - Gene Panels
{% endblock %}

{% block top_nav %}
  {{ super() }}
  <li>
    <a href="{{ url_for('cases.index') }}">Institutes</a>
  </li>
  <li class="active">
    <span class="navbar-text">Gene Panels</span>
  </li>
{% endblock %}

{% block content_main %}
  <div>
    {% if panel_groups %}
      {% for institute,panels in panel_groups %}
        {{ panel_view(institute,panels) }}
      {% endfor %}
    {% else %}
      <div class="panel-body">No gene panels found.</div>
    {% endif %}
  </div>
{% endblock %} <!-- end of content_main -->


{% macro panel_view(institute,panels) %}
  <div class="panel panel-default">
    <div class="panel-heading">
      <strong>{{ institute.display_name }}</strong> - Panels
    </div>
    <div>
        <table class="table table-striped">
        <thead>
          <tr>
            <th width="30%">Name</th>
            <th width="20%">Version</th>
            <th width="15%">Number of genes</th>
            <th width="25%">History</th>
            <th width="10%"></th>
          </tr>
        </thead>
      {% for panel in panels %}
        <!--create table for each panel-->
        <tbody>
          <tr>
            <td><a href="{{ url_for('panels.panel', panel_id=panel._id) }}">{{ panel.display_name }}</a></td>
            <td>{{ panel.version }} ({{ panel.date.date()}})</td>
            <td>{{ panel.genes|length}}</td>
            <td><button id="{{panel._id}}" type="button" class="btn btn-primary btn-xs history_btn"><span class="glyphicon glyphicon-zoom-in"></span></button><br>{{ history_view(panel._id, panel.panel_name) }}</td>
            <td><button id="{{panel._id}}" type="button" class="btn btn-warning btn-xs modify_btn"><span class="glyphicon glyphicon-pencil"></span></button><br>{{ history_view(panel._id, panel.panel_name) }}</td>
          </tr>
          {{ modify_panel(panel._id, panel) }}
        </tbody>
      {% endfor %}
      </table>
    </div>

  </div>
{% endmacro %}

{% macro history_view(panel_id, panel_name) %}
  <div id="paneldiv_{{panel_id}}" style="display:none;">
    <ul>
    {% for version in panel_versions[panel_name]|sort(attribute='version', reverse=True) %}
      <li><a href={{ url_for('panels.panel', panel_id=version._id) }}>{{ version.version }} {{ version.date.date() }} {{ version.genes|length }} genes</a></li>
    {% endfor %}
    </ul>
  </div>
{% endmacro %}

{% macro modify_panel(panel_id, panel_obj) %}
  <tr id="modifydiv_{{panel_id}}" style="display:none;">
    <td colspan=5>{{ modify_form(panel_obj) }}</td>
  </tr>
{% endmacro %}

{% macro modify_form(panel_obj) %}
  <br>
  <strong>{{panel_obj.panel_name}}</strong><br>
  <form method="POST" action="{{ url_for('panels.panels') }}" enctype="multipart/form-data" class="form-horizontal">
    <input type="hidden" name="panel_name" value="{{panel_obj.panel_name}}">
    <div class="form-group">
      <div class="col-sm-3">
        <div class="radio">
          <label><input type="radio" name="modify_option" checked>Add genes from CSV file</label>
        </div>
        <div class="radio">
          <label><input type="radio" name="modify_option">Replace genes using CSV file</label>
        </div>
      </div><!--end of <div class="col-sm-4">-->

      <div class="form-group">
          <div class="col-sm-6">
            <input type="file" name="csv_file" class="form-control" required>
            <p class="help-block">How do I format my <a href="https://www.clinicalgenomics.se/scout/user-guide/panels/#uploading-a-new-gene-panel-version">gene panel file</a>?</p>
          </div>
          <div class="col-sm-2">
            <button id="submit" type="submit">submit</button>
          </div>
      </div>

    </div><!--end of form-group-->

  </form>
  <br>
{% endmacro %}


{% block scripts %}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">

$('.history_btn').on('click', function(){
    var bid = $(this)[0].id;
    var sel = '#paneldiv_' + bid;
    if($(sel).is(':visible')){
      $(sel).hide();
    }
    else{
      $(sel).fadeToggle();
    }
{'fraction_non_alphanumeric': 0.21497938007183717, 'fraction_numerical': 0.005188239989357456, 'mean_word_length': 2.915625, 'pattern_counts': {'":': 0, '<': 205, '<?xml version=': 0, '>': 205, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3433616', 'n_tokens_mistral': 2685, 'n_tokens_neox': 2489, 'n_words': 474}