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

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

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

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

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

{% block content %}
    <div class="container-app">
    {% if profile.role == 'A' %}
        <h5>{{ manufacturer_part.part.full_part_number }} {{ manufacturer_part.part.description }}</h5>

        <div class="row">
            <form name="seller" action="{% url 'bom:manufacturer-part-add-sellerpart' manufacturer_part_id=manufacturer_part.id %}" method="post" class="col s12">
                {% csrf_token %}
                {{ form.non_field_errors }}

                <div class="row">
                    <div class="fieldWrapper col m6 s12">
                        <label for="{{ form.seller.id_for_label }}"><b>Seller:</b></label>
                        {{ form.seller.errors }}
                        {{ form.seller }}
                    </div>
                    <div class="fieldWrapper col m6 s12">
                        <label for="{{ form.new_seller.id_for_label }}"><b>-or- New Seller:</b></label>
                        {{ form.new_seller.errors }}
                        {{ form.new_seller }}
                    </div>
                </div>
                <div class="row">
                    <div class="fieldWrapper col m3 s12">
                        <label for="{{ form.unit_cost.id_for_label }}"><b>Unit Cost:</b></label>
                        {{ form.unit_cost.errors }}
                        {{ form.unit_cost }}
                    </div>
                    <div class="fieldWrapper col m3 s12">
                        <label for="{{ form.nre_cost.id_for_label }}">NRE Cost:</label>
                        {{ form.nre_cost.errors }}
                        {{ form.nre_cost }}
                    </div>
                </div>
                <div class="row">
                    <div class="fieldWrapper col m3 s12">
                        <label for="{{ form.minimum_order_quantity.id_for_label }}">Minimum Order Quantity:</label>
                        {{ form.minimum_order_quantity.errors }}
                        {{ form.minimum_order_quantity }}
                    </div>
                    <div class="fieldWrapper col m3 s12">
                        <label for="{{ form.minimum_pack_quantity.id_for_label }}">Minimum Pack Quantity:</label>
                        {{ form.minimum_pack_quantity.errors }}
                        {{ form.minimum_pack_quantity }}
                    </div>
                </div>
                <div class="row">
                    <div class="fieldWrapper col m3 s12">
                        <label for="{{ form.lead_time_days.id_for_label }}">Lead Time (Days):</label>
                        {{ form.lead_time_days.errors }}
                        {{ form.lead_time_days }}
                    </div>
                </div>
                <div class="row">
                    <div class="fieldWrapper col m3 s12">
                        {{ form.ncnr.errors }}
                        {{ form.ncnr|materializecss }}
                    </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 %}
    </div>
{% endblock %}