{% extends 'bom/bom-base.html' %}

{% load static %}
{% load materializecss %}

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

{% block bom-menu %}
    <li><a href="{% url 'bom:part-info' part_id=part.id %}">Cancel</a></li>
{% endblock %}

{% block content %}
    <div class="container-app">
        {% if profile.role == 'A' %}
            <div class="row">
                <form action="{% url 'bom:part-edit' part_id=part.id %}" method="post" class="col s12">
                    <div class="row">
                        {% csrf_token %}
                        {{ part_form.non_field_errors }}
                        <div class="fieldWrapper">
                            {{ part_form.number_class|materializecss:'m4 s12' }}
                        </div>
                        <div class="fieldWrapper">
                            {{ part_form.number_item|materializecss:'m4 s12' }}
                        </div>
                        <div class="fieldWrapper">
                            {{ part_form.number_variation|materializecss:'m4 s12' }}
                        </div>
                        <div class="fieldWrapper">
                            {{ part_form.primary_manufacturer_part|materializecss:'m12 s12' }}
                        </div>
                    </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.description|materializecss:'m10 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 class="fieldWrapper">
                            {{ part_revision_form.package|materializecss:'m6 s12' }}
                        </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 btn-primary" type="submit" name="action">Save
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        {% else %}
            {% include 'bom/nothing-to-see.html' with required_privilege='Admin' %}
        {% endif %}
    </div>
{% endblock %}