{% 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:part-info' part_id=part.id %}">Cancel</a></li>
{% endblock%}

{% block content %}
{% if profile.role == 'A' %}
<h4 class="center">{{part.description}}</h4>
<div class="row">
    <form action="{% url 'bom:part-add-manufacturer-part' part_id=part.id %}" method="post" class="col s12">
        {% csrf_token %}
        {{ manufacturer_form.non_field_errors }}
        {{ manufacturer_part_form.non_field_errors }}
        {{ manufacturer_form.errors }}
        {{ manufacturer_part_form.errors }}
        <div class="row">
            <div class="col">
                <p>Manufacturer <i>(skip if custom part)</i></p>
            </div>
        </div>
        <div class="row">
            <div class="fieldWrapper col m6 s12">
                <label for="{{ manufacturer_part_form.manufacturer.id_for_label }}">Select existing Manufacturer</label>
                {{ manufacturer_part_form.manufacturer.errors }}
                {{ manufacturer_part_form.manufacturer }}
            </div>
            <div class="fieldWrapper col m6 s12">
                <label for="{{ manufacturer_form.name.id_for_label }}">-or- Create New Manufacturer</label>
                {{ manufacturer_form.name.errors }}
                {{ manufacturer_form.name }}
            </div>
        </div>
        <div class="row">
            <div class="fieldWrapper col m6 s12">
                <label for="{{ manufacturer_part_form.manufacturer_part_number.id_for_label }}"><b>Manufacturer Part Number</b></label>
                {{ manufacturer_part_form.manufacturer_part_number.errors }}
                {{ manufacturer_part_form.manufacturer_part_number }}
            </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>
{% else %}
{% include 'bom/nothing-to-see.html' with required_privilege='Admin' %}
{% endif %}
{% endblock %}
