{% extends "base.html" %}

{% block title %}Upload GPX file for a *fix{% endblock %}

{% block content %}

<!-- re do all this to autogenerate the form using Django magic stuff -->


<h2>Upload GPX file for a *fix</h2>

<div style = "max-width:35%; margin-left:20%; text-align: center; " >
    <form method ='post' enctype ="multipart/form-data">
        {% csrf_token %}              
            <br>
                   <input class="fancybutton2"   type = "file"  
                   name = "uploadfiles" id="uploadfiles"  />
                   <br><br><br>
                   <input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 125px"
                   label = "Rename to" name = "renameto" id="renameto"  
                   pattern="[A-Za-z][A-Za-z0-9_-\.]*"/> 
                   <br />
                   <label 
                   style="padding: 0.5em 25px; margin-left: 110px"
                   for="renameto">You can rename the file<br></label>

                  <input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 125px"
                   label = "prospector" name = "prospector" id="prospector"  
                   pattern="[A-Za-z]+"
                   placeholder="Wookey" required /> 
                   <label 
                   style="padding: 0.5em 25px; margin-left: 110px"
                   for="prospector">your name<br></label>
                   
                   <br>

                  <input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 125px"
                   label = "areacode" name = "areacode" id="areacode"  
                   pattern="[A-Za-z]+"
                   placeholder="1623" required /> 
                   <label 
                   style="padding: 0.5em 25px; margin-left: 110px"
                   for="areacode" ><br>the area code for this station<br></label>
                   
                   <br>

                  <input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 125px"
                   label = "station" name = "station" id="station"  
                   pattern="[A-Za-z]+"
                   placeholder="p2025-WW-01" required /> 
                   <label 
                   style="padding: 0.5em 25px; margin-left: 110px"
                   for="station" >proposed station identifier<br></label>
                   
                   <br><br><br>
                   <button  class="fancybutton2"  style="padding: 0.5em 25px; margin-left: 155px" type = "submit" value = "Upload" >
                      Upload
                   </button>
    </form>
</div>
<div style = "max-width:29%; margin-left:20%; text-align: left" >
    {% if filesaved %}
        <p>
        <b>File(s) saved as <br>
        {% for f in actual_saved %}
        <em>{{f}}</em> <br>
        {% endfor %}
        </p>
    {% endif %}

    <strong style="font-size: 110%;">Files already here:</strong><br>
    {% for f in files %}
    <a href="{{urlfile|urlencode}}/{{f|urlencode}}">{{f}}</a><br />
    {% empty %}
    <p>&lt;No files here&gt;
    {% endfor %}
</div> 
<p>You can upload your GPX track which will be averaged into a single *fix
<p>Note that only GPX files are accepted: all other types of files are refused.
<hr>
<p>This GPX file has x locations of which y (_%) have been averaged to produce a a location:<br>
<pre>
[1623]
*fix p2025-WW-01 13.8229370 47.6874630 1871
*entrance p2025-WW-01
</pre>
<p>

<hr />


{% endblock %}