{% extends "base.html" %}
{% set currentPage = cfg["flow"][uploadType] %}  <!--Needs fixed; relies on flow-->
{% block title %} Upload a {{ uploadType | capitalize }} {% endblock %}

{% block body %}
{% include "snips/breadcrumbs_for_uploads.html" %}
<div class = "row">
   <h1> URCPP {{ uploadType | capitalize }} Submission </h1>
</div>

{# 
   The following snip comes through as its own row.
   It is probably good practice to assume snips always come through
   in a div. Or, it is only exceptional circumstances that they don't.
#}

<!-- My name is {{ldap.firstname}}, but it doesn't show up in the snip? -->

{% include "snips/" ~ uploadType ~ "-info.html" ignore missing with context %}
<div hidden id = "success" class="alert alert-success">
  <strong>Success!</strong> Your {{uploadType}} has been uploaded.
</div>
<div class = "row">
   <div class = "col-sm-8 col-sm-offset-2">
      <form class = "dropzone" id = "drop" action = "/v1/upload/{{uploadType}}/{{username}}">
      </form>
      <label>Current File:&nbsp; </label>
      <label id="fileLabel">
        {% if prevFilepath != "" %}
        <a href = "/{{ldap.username}}/document/{{prevFilepath}}" target = '_blank'>
            {{prevFilepath}}
          </a>
        {% else %} 
          None yet 
        {% endif %}
      </label>
   </div>
</div>

<div class = "row">
&nbsp;
</div>



{% include "snips/allowed-file-types.html" %}
<div class = "form-group"  >
 <div class = "col-sm-offset-9 col-sm-2" 
      id = "moveForwardButton"
      >
   <button id = "moveForward"  
           class="btn btn-block btn-primary"
           class = "form-control"
           type = "button"
           {% if prevFilepath == "" %} disabled {% endif %}
           onclick = "buttonMoveForward()"
           />
     Submit
   </button>
 </div>
</div>

<script>
  var uploadType = "{{uploadType}}";
  var nextPage = "{{currentPage}}";
  var getValue = "{{ request.args.get('source') }}";
  
  // var referrer =  document.referrer.split("/").pop();
  
  // console.log("Coming from " + referrer);

</script>


{% endblock %}

{% block footer_imports %}
<script src = "/s/js/pages/upload.js" type = "text/javascript"> </script>
{% endblock %}
