{% extends "part/part_app_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block sidebar %} {% include "part/part_sidebar.html" %} {% endblock %} {% block thumbnail %} {% include "part/part_thumb.html" %} {% endblock %} {% block heading %} {{ part.full_name }} {% endblock %} {% block actions %} {% if user.is_staff and roles.part.change %} {% url 'admin:part_part_change' part.pk as url %} {% include "admin_button.html" with url=url %} {% endif %} {% if barcodes %}
{% endif %} {% if part.active %} {% if roles.stock.change %}
{% endif %} {% if part.purchaseable and roles.purchase_order.add %} {% endif %} {% endif %} {% if roles.part.add or roles.part.change or roles.part.delete %}
{% endif %} {% endblock %} {% block details %}

{% if part.is_template %}   {% endif %} {% if part.assembly %}   {% endif %} {% if part.component %}   {% endif %} {% if part.trackable %}   {% endif %} {% if part.purchaseable %}   {% endif %} {% if part.salable %}   {% endif %} {% if not part.active %}  
{% trans 'Inactive' %}
{% endif %} {% if part.virtual and part.active %}  
{% trans 'Virtual' %}
{% endif %}

{% if part.variant_of %}
{% object_link 'part-detail' part.variant_of.id part.variant_of.full_name as link %} {% blocktrans %}This part is a variant of {{link}}{% endblocktrans %}
{% endif %}
{% endblock %} {% block details_right %} {% if on_order > 0 %} {% endif %} {% if required_build_order_quantity > 0 %} {% endif %} {% if required_sales_order_quantity > 0 %} {% endif %} {% if allocated > 0 %} {% endif %} {% if not part.is_template %} {% if part.assembly %} {% if quantity_being_built > 0 %} {% endif %} {% endif %} {% endif %}
{% trans "Available Stock" %}
{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}
{% trans "In Stock" %} {% include "part/stock_count.html" %}
{% trans "On Order" %} {% decimal on_order %}
{% trans "Required for Build Orders" %} {% decimal required_build_order_quantity %}
{% trans "Required for Sales Orders" %} {% decimal required_sales_order_quantity %}
{% trans "Allocated to Orders" %} {% decimal allocated %}
{% trans "Build Status" %}
{% trans "Can Build" %} {% decimal part.can_build %}
{% trans "Building" %} {% decimal quantity_being_built %}
{% endblock %} {% block js_ready %} {{ block.super }} {% if part.image %} $('#part-thumb').click(function() { showModalImage('{{ part.image.url }}'); }); {% endif %} function reloadImage(data) { // If image / thumbnail data present, live update if (data.image) { $('#part-image').attr('src', data.image); // Reset the "modal image" view $('#part-thumb').click(function() { showModalImage(data.image); }); } else { // Otherwise, reload the page location.reload(); } } enableDragAndDrop( '#part-thumb', "{% url 'api-part-detail' part.id %}", { label: 'image', method: 'PATCH', success: function(data, status, xhr) { reloadImage(data); } } ); $("#show-qr-code").click(function() { launchModalForm( "{% url 'part-qr' part.id %}", { no_post: true, } ); }); $('#print-label').click(function() { printPartLabels([{{ part.pk }}]); }); function adjustPartStock(action) { inventreeGet( '{% url "api-stock-list" %}', { part: {{ part.id }}, in_stock: true, allow_variants: true, part_detail: true, location_detail: true, }, { success: function(items) { adjustStock(action, items, { success: function() { location.reload(); } }); }, } ); } $("#part-move").click(function() { adjustPartStock('move'); }); $("#part-count").click(function() { adjustPartStock('count'); }); $("#price-button").click(function() { launchModalForm( "{% url 'part-pricing' part.id %}", { submit_text: '{% trans "Calculate" %}', hideErrorMessage: true, } ); }); $("#toggle-starred").click(function() { toggleStar({ part: {{ part.id }}, button: '#part-star-icon', }); }); $("#part-image-upload").click(function() { constructForm( '{% url "api-part-detail" part.pk %}', { method: 'PATCH', fields: { image: {}, }, title: '{% trans "Upload Image" %}', onSuccess: function(data) { reloadImage(data); } } ) }); function onSelectImage(response) { // Callback when the image-selection modal form is displayed // Populate the form with image data (requested via AJAX) $("#modal-form").find("#image-select-table").inventreeTable({ url: "{% url 'api-part-thumbs' %}", showHeader: false, showColumns: false, clickToSelect: true, sidePagination: 'server', singleSelect: true, formatNoMatches: function() { return '{% trans "No matching images found" %}'; }, columns: [ { checkbox: true, }, { field: 'image', title: 'Image', searchable: true, formatter: function(value, row, index, field) { return "" } } ], onCheck: function(row, element) { // Update the selected image in the form var ipt = $("#modal-form").find("#image-input"); ipt.val(row.image); } }); } {% if roles.part.change %} if (global_settings.INVENTREE_DOWNLOAD_FROM_URL) { $("#part-image-url").click(function() { launchModalForm( '{% url "part-image-download" part.id %}', { reload: true, } ); }); } $("#part-image-select").click(function() { launchModalForm("{% url 'part-image-select' part.id %}", { reload: true, after_render: onSelectImage }); }); $("#part-edit").click(function() { editPart({{ part.pk }}); }); {% endif %} $("#part-order").click(function() { launchModalForm("{% url 'order-parts' %}", { data: { part: {{ part.id }}, }, reload: true, }); }); {% if roles.part.add %} $("#part-duplicate").click(function() { duplicatePart({{ part.pk }}); }); {% endif %} {% if roles.part.delete %} $("#part-delete").click(function() { launchModalForm( "{% url 'part-delete' part.id %}", { redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}, no_post: {% if part.active %}true{% else %}false{% endif %}, } ); }); {% endif %} {% endblock %}