{% extends BASE_TEMPLATE %}

{% load staticfiles %}
{% load materializecss %}

{% 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 %}
<div class="row">
    <form name="seller" action="{% url 'bom:create-part' %}" method="post" class="col s12">
    	<div class="row">
            {% csrf_token %}
            {{ part_form.non_field_errors }}
            {{ part_form|materializecss:'m4 s12' }}
		</div>
    	<div class="row">
            {% csrf_token %}
            {{ part_revision_form.non_field_errors }}
            <div class="fieldWrapper">
                {{ part_revision_form.revision|materializecss:'m2 s12' }}
            </div>
            <div class="fieldWrapper">
                {{ part_revision_form.configuration|materializecss:'m2 s12' }}
            </div>
            <div class="fieldWrapper">
                {{ part_revision_form.description|materializecss:'m8 s12' }}
            </div>
            <div class="fieldWrapper">
                {{ part_revision_form.attribute|materializecss:'m6 s12' }}
            </div>
            <div class="fieldWrapper">
                {{ part_revision_form.value|materializecss:'m6 s12' }}
            </div>
		</div>
        <h2>Add a Manufacturer Part (optional)</h2>
        <div class="row">
            <div class="col s12">
                <span>Skip this form if your part is a custom part. Leave the manufacturer field unselected if creating a new manufacturer.</span>
            </div>
        </div>
    	<div class="row">
            {% csrf_token %}
            {{ manufacturer_part_form|materializecss:'m4 s12' }}
            {{ manufacturer_form.non_field_errors }}
            <div class="input-field col m4 s12">
                {{ manufacturer_form.name.errors }}
                {{ manufacturer_form.name }}
                <label for="{{ manufacturer_form.name.id_for_label }}">OR Create A New Manufacturer:</label>
            </div>
		</div>
		<div class="row">
	        <div class="col s6">
                <a href="javascript:history.back()" class="waves-effect waves-light btn-flat grey-text lighten-1" style="margin-left: -16px;">Cancel</a>
            </div>
            <div class="col s6 right-align">
	        	<button class="waves-effect waves-light btn green lighten-1" type="submit" name="action">Save</button>
	    	</div>
    	</div>
    </form>
</div>
{% endblock %}