{% extends "two_column.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block page_title %} {% inventree_title %} | {% trans "Supplier Part" %} {% endblock %} {% block menubar %} {% include "company/supplier_part_navbar.html" %} {% endblock %} {% block thumbnail %} {% endblock %} {% block page_data %}

{% trans "Supplier Part" %}


{{ part.part.full_name }} {% if user.is_staff and perms.company.change_company %} {% endif %}

{{ part.supplier.name }} - {{ part.SKU }}

{% if roles.purchase_order.change %}
{% if roles.purchase_order.add %} {% endif %} {% if roles.purchase_order.delete %} {% endif %}
{% endif %} {% endblock %} {% block page_details %}

{% trans "Supplier Part Details" %}

{% if part.description %} {% endif %} {% if part.link %} {% endif %} {% if part.manufacturer_part.manufacturer %} {% endif %} {% if part.manufacturer_part.MPN %} {% endif %} {% if part.packaging %} {% endif %} {% if part.note %} {% endif %}
{% trans "Internal Part" %} {% if part.part %} {{ part.part.full_name }}{% include "clip.html"%} {% endif %}
{% trans "Description" %} {{ part.description }}{% include "clip.html"%}
{% trans "External Link" %} {{ part.link }}{% include "clip.html"%}
{% trans "Supplier" %} {{ part.supplier.name }}{% include "clip.html"%}
{% trans "SKU" %} {{ part.SKU }}{% include "clip.html"%}
{% trans "Manufacturer" %} {{ part.manufacturer_part.manufacturer.name }}{% include "clip.html"%}
{% trans "MPN" %} {{ part.manufacturer_part.MPN }}{% include "clip.html"%}
{% trans "Packaging" %} {{ part.packaging }}{% include "clip.html"%}
{% trans "Note" %} {{ part.note }}{% include "clip.html"%}
{% endblock %} {% block page_content %}

{% trans "Supplier Part Stock" %}

{% include "stock_table.html" %}

{% trans "Supplier Part Orders" %}

{% if roles.purchase_order.add %}
{% endif %}

{% trans "Pricing Information" %}

{% if roles.purchase_order.add %}
{% endif %}
{% endblock %} {% block js_ready %} {{ block.super }} function reloadPriceBreaks() { $("#price-break-table").bootstrapTable("refresh"); } $('#price-break-table').inventreeTable({ name: 'buypricebreaks', formatNoMatches: function() { return "{% trans "No price break information found" %}"; }, queryParams: { part: {{ part.id }}, }, url: "{% url 'api-part-supplier-price-list' %}", onPostBody: function() { var table = $('#price-break-table'); table.find('.button-price-break-delete').click(function() { var pk = $(this).attr('pk'); constructForm(`/api/company/price-break/${pk}/`, { method: 'DELETE', onSuccess: reloadPriceBreaks, title: '{% trans "Delete Price Break" %}', }); }); table.find('.button-price-break-edit').click(function() { var pk = $(this).attr('pk'); constructForm(`/api/company/price-break/${pk}/`, { fields: { quantity: {}, price: {}, price_currency: {}, }, onSuccess: reloadPriceBreaks, title: '{% trans "Edit Price Break" %}', }); }); }, columns: [ { field: 'pk', title: 'ID', visible: false, switchable: false, }, { field: 'quantity', title: '{% trans "Quantity" %}', sortable: true, }, { field: 'price', title: '{% trans "Price" %}', sortable: true, formatter: function(value, row, index) { var html = value; html += `
` html += makeIconButton('fa-edit icon-blue', 'button-price-break-edit', row.pk, '{% trans "Edit price break" %}'); html += makeIconButton('fa-trash-alt icon-red', 'button-price-break-delete', row.pk, '{% trans "Delete price break" %}'); html += `
`; return html; } }, ] }); $('#new-price-break').click(function() { constructForm( '{% url "api-part-supplier-price-list" %}', { method: 'POST', fields: { quantity: {}, part: { value: {{ part.pk }}, hidden: true, }, price: {}, price_currency: { }, }, title: '{% trans "Add Price Break" %}', onSuccess: reloadPriceBreaks, } ); }); loadPurchaseOrderTable($("#purchase-order-table"), { url: "{% url 'api-po-list' %}?supplier_part={{ part.id }}", }); loadStockTable($("#stock-table"), { params: { supplier_part: {{ part.id }}, location_detail: true, part_detail: false, }, groupByField: 'location', buttons: ['#stock-options'], url: "{% url 'api-stock-list' %}", }); $("#stock-export").click(function() { exportStock({ supplier_part: {{ part.pk }}, }); }); $("#item-create").click(function() { createNewStockItem({ data: { part: {{ part.part.id }}, supplier_part: {{ part.id }}, }, reload: true, }); }); enableNavbar({ label: 'supplier-part', toggleId: '#supplier-part-menu-toggle' }) $('#order-part, #order-part2').click(function() { launchModalForm( "{% url 'order-parts' %}", { data: { part: {{ part.part.id }}, }, reload: true, }, ); }); $('#edit-part').click(function () { editSupplierPart({{ part.pk }}, { onSuccess: function() { location.reload(); } }); }); $('#delete-part').click(function() { deleteSupplierPart({{ part.pk }}, { onSuccess: function() { window.location.href = "{% url 'company-detail' part.supplier.id %}"; } }); }); attachNavCallbacks({ name: 'supplierpart', default: 'stock' }); {% endblock %}