{% extends "page_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block page_title %} {% inventree_title %} | {% trans "Supplier Part" %} {% endblock page_title %} {% block sidebar %} {% include "company/supplier_part_sidebar.html" %} {% endblock sidebar %} {% block breadcrumbs %} {% if part.supplier %} {% endif %} {% endblock breadcrumbs %} {% block heading %}

{% trans "Supplier Part" %}: {{ part.SKU }}

{% endblock heading %} {% block actions %} {% if user.is_staff and perms.company.change_company %} {% url 'admin:company_supplierpart_change' part.pk as url %} {% include "admin_button.html" with url=url %} {% endif %} {% if roles.purchase_order.add %} {% endif %} {% if roles.purchase_order.delete %} {% endif %} {% endblock actions %} {% block thumbnail %} {% endblock %} {% block details %} {% if part.description %} {% endif %}
{% trans "Internal Part" %} {% if part.part %} {{ part.part.full_name }}{% include "clip.html"%} {% endif %}
{% trans "Description" %} {{ part.description }}{% include "clip.html"%}
{% endblock details %} {% block details_right %} {% if part.manufacturer_part.manufacturer %} {% endif %} {% if part.manufacturer_part.MPN %} {% endif %} {% if part.packaging %} {% endif %} {% if part.note %} {% endif %} {% if part.link %} {% endif %}
{% 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"%}
{% trans "External Link" %} {{ part.link }}{% include "clip.html"%}
{% endblock %} {% block page_content %}

{% trans "Supplier Part Stock" %}

{% include "spacer.html" %}
{% include "stock_table.html" %}

{% trans "Supplier Part Orders" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add %} {% endif %}
{% include "filter_list.html" with id='purchaseorder' %}

{% trans "Pricing Information" %}

{% include "spacer.html" %}
{% 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; } }, { field: 'updated', title: '{% trans "Last updated" %}', sortable: true, formatter: function(value) { return renderDate(value); } }, ] }); $('#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' %}", }); $("#item-create").click(function() { createNewStockItem({ data: { part: {{ part.part.id }}, supplier_part: {{ part.id }}, }, }); }); $('#order-part, #order-part2').click(function() { inventreeGet( '{% url "api-part-detail" part.part.pk %}', {}, { success: function(response) { orderParts([response], { supplier_part: {{ part.pk }}, {% if part.supplier %} supplier: {{ part.supplier.pk }}, {% endif %} }); } } ); }); $('#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 %}"; } }); }); enableSidebar('supplierpart'); {% endblock %}