{% extends BASE_TEMPLATE %}

{% load staticfiles %}

{% block head-title %}{{ title }}{% endblock %}

{% block main %}
<link rel="stylesheet" type="text/css" href="{% static 'bom/style.css' %}" />
{% endblock %}

{% block menu %}
<li><a href="{% url 'bom:home' %}">Cancel</a></li>
{% endblock%}


{% block content %}
{% if profile.role == 'A' %}
<h5>Upload Parts</h5>
    <p>To batch create parts, upload a csv that contains columns with the headers  
    <b>'part_class'</b> or </b>'part_number'</b>, <b>'description'</b> or <b>'value'</b> 
    along with <b>'value_units'</b>, and <b>'revision'</b>. If you specify a part number 
    then it must be one that is not already being used. If you don't specify a part number 
    then IndaBOM will create one for you.
    </p>
    </p>
    You may optionally specify a manufacturer and manufacturer's part number using 
    columns with the headers <b>'manufacturer'</b> and a <b>'manufacturer_part_number'</b>. 
    For the names of other optional columns click <a href="{% url 'bom:upload-parts-help' %}">here</a>.
    </p> 
<form action="{% url 'bom:upload-parts' %}" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    <div class="row">
        <div class="col s8 file-field input-field">
            <div class="green lighten-1 btn">
                <span>File</span>
                {{ form.file }}
            </div>
            <div class="file-path-wrapper">
                <input class="file-path validate" type="text" placeholder="Upload a file.">
                {{ form.file.errors }}
            </div>
        </div>
        <div class="col s1 input-field">
            <input class="green lighten-1 btn" type="submit" value="Upload"/>
        </div>
    </div>
</form>
{% else %}
{% include 'bom/nothing-to-see.html' with required_privilege='Admin' %}
{% endif %}
{% endblock %}

