{% extends "base.html" %}
{% block content %}

{% if jobs_completed %}
    <div class="noticeBox">
            &nbsp;Just finished running:
                <ul>
                {% for job in jobs_completed %}
                    <li>{{ job }}</li>
                {% endfor %}
                </ul>
                &nbsp;See <a href="/dataissues">Data Issues</a> report
                <br>&nbsp;
    </div>
{% endif %}

{% if error %}
    <div class="noticeBox">
            {{ error }}
    </div>
{% endif %}

<div style="column-count: 2;">
{%comment%}
<form name="reset" method="post" action="">
{% csrf_token %}              
    <h3>Wipe:</h3>
    <table>
        <tr>
            <td>Wipe entire database and recreate tables: </td>
            <td><input type="checkbox" name="reload_db" /></td>
            <td>
                <input type="submit" id="Import" value="I really want to delete all information in troggle, and accept all responsibility.">
            </td>
        </tr>
    </table>
</form>
{% endcomment %}

<h3>Import (on top of existing data):</h3>
<p>To get a fully-functioning system, all these imports must be done and in this order.
<form name="import" method="post" action="">
{% csrf_token %}              
    <table>
        <tr>
            <th colspan="2">Import from master files</th>
        </tr>    
        <tr>
            <td>all caves </td>
            <td><input type="checkbox" name="import_caves"/></td>
        </tr>
        <tr>
            <td>all people </td>
            <td><input type="checkbox" name="import_people"/></td>
        </tr>
        <tr>
            <td>all surveys scans </td>
            <td><input type="checkbox" name="import_surveyscans"/></td>
        </tr>
        <tr>
            <td>all logbooks</td>
            <td><input type="checkbox" name="import_logbooks"/></td>
        </tr>
        <tr>
            <td>QMs (from old csv files)</td>
            <td><input type="checkbox" name="import_QMs" /></td>
        </tr>
        <tr>
            <td>all drawings files</td>
            <td><input type="checkbox" name="import_drawingsfiles" /></td>
        </tr>
        <tr>
            <td>all survex data (10 minutes)</td>
            <td><input type="checkbox" name="import_survex" /></td>
        </tr>
    </table>
    <p>
      <input type="submit" id="Import" value="Import">
      
    </p>
</form>


<p>&nbsp;


<h3>Export to a different format:</h3>
<p>This creates 'newlogbook.html' in the years/&lt;year&gt;/ folder
<table>
<tr>


    <th>Export and Download</th>

</tr>
<tr>
    <td>
        <form name="export" method="POST" action={% url "exportlogbook" %}>
{% csrf_token %}              
            <p>Download a logbook file which is dynamically generated by Troggle.</p>
            
            <p>
            Expedition year:
            <select name="year">
                        {% for expedition in expeditions %}
                            <option value="{{expedition}}"> {{expedition}} </option>
                        {% endfor %}
            </select>
            </p>
            
            <p>
            Output style: 
            <select name="extension">
              <option value="html">.html file - 2005 style</option>
              <option value="txt">.txt file with MediaWiki markup</option>
            </select>
            </p>
            <p>
            <input name="download_logbook" type="submit" value="Download logbook" />
            </p>
        </form>
    </td>        
</tr>

</table>
</form>
</div>
{% endblock %}