{% extends 'base.html' %}

{% load staticfiles %}

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

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

{% block content %}
<h5>Create New Part</h5>
<div class="row">
    <form action="{% url 'create-part' %}" method="post" class="col s12">
        {% csrf_token %}

        {{ form.non_field_errors }}
        <div class="row">
            <div class="fieldWrapper col s6">
                {{ form.number_class.errors }}
                <label for="{{ form.number_class.id_for_label }}"><b>Part Number Class:</b></label>
                {{ form.number_class }}
            </div>
            <div class="fieldWrapper col s3">
                {{ form.number_item.errors }}
                <label for="{{ form.number_item.id_for_label }}">Part Number:</label>
                {{ form.number_item }}
            </div>
            <div class="fieldWrapper col s3">
                {{ form.number_variation.errors }}
                <label for="{{ form.number_variation.id_for_label }}">Part Variation:</label>
                {{ form.number_variation }}
            </div>
        </div>
        <div class="row">
            <div class="fieldWrapper col s2">
                {{ form.revision.errors }}
                <label for="{{ form.revision.id_for_label }}"><b>Revision</b><br></label>
                {{ form.revision }}
            </div>
            <div class="fieldWrapper col s10">
                {{ form.description.errors }}
                <label for="{{ form.description.id_for_label }}"><b>Description</b> <i>(Max 255 characters.)</i></label>
                {{ form.description }}
            </div>
        </div>
        <div class="row">
            <div class="fieldWrapper col s6">
                {{ form.manufacturer.errors }}
                <label for="{{ form.manufacturer.id_for_label }}"><b>Manufacturer</b><br>Select existing Manufacturer</label>
                {{ form.manufacturer }}
            </div>
            <div class="fieldWrapper col s6">
                {{ form.new_manufacturer.errors }}
                <label for="{{ form.new_manufacturer.id_for_label }}"><br>-or- Create New Manufacturer</label>
                {{ form.new_manufacturer }}
            </div>
        </div>
        <div class="row">
            <div class="fieldWrapper col s12">
                {{ form.manufacturer_part_number.errors }}
                <label for="{{ form.manufacturer_part_number.id_for_label }}"><b>Manufacturer Part Number</b></label>
                {{ form.manufacturer_part_number }}
            </div>
        </div>

        <input class="waves-effect waves-light btn green lighten-1" type="submit" value="Create" />
        <a href="{% url 'home' %}" class="waves-effect waves-light btn green lighten-1">Cancel</a>
    </form>
</div>
{% endblock %}