{% extends "part/part_app_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block menubar %} {% include "part/navbar.html" %} {% endblock %} {% block content %}
{% if part.variant_of %}
{% object_link 'part-variants' part.variant_of.id part.variant_of.full_name as link %} {% blocktrans %}This part is a variant of {{link}}{% endblocktrans %}
{% endif %}
{% include "part/part_thumb.html" %}

{{ part.full_name }} {% if user.is_staff and roles.part.change %} {% endif %} {% if not part.active %}
{% trans 'Inactive' %}
{% endif %}

{{ part.description }}

{% if barcodes %} {% endif %} {% if part.active %} {% if roles.stock.change %} {% endif %} {% if part.purchaseable %} {% if roles.purchase_order.add %} {% endif %} {% endif %} {% endif %} {% if roles.part.add or roles.part.change or roles.part.delete %}
{% endif %}
{% if part.IPN %} {% endif %} {% if part.link %} {% endif %}
{% trans "IPN" %} {{ part.IPN }}
{% trans "External Link" %} {{ part.link }}
{% 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 %}

{% block heading %} {% endblock %}

{% block details %} {% endblock %}
{% endblock %} {% block js_ready %} {{ block.super }} enableNavbar({ label: 'part', toggleId: '#part-menu-toggle', }); {% if part.image %} $('#part-thumb').click(function() { showModalImage('{{ part.image.url }}'); }); {% endif %} enableDragAndDrop( '#part-thumb', "{% url 'part-image-upload' part.id %}", { label: 'image', success: function(data, status, xhr) { location.reload(); } } ); $("#show-qr-code").click(function() { launchModalForm( "{% url 'part-qr' part.id %}", { no_post: true, } ); }); $("#part-count").click(function() { launchModalForm("/stock/adjust/", { data: { action: "count", part: {{ part.id }}, }, reload: true, }); }); $("#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() { launchModalForm("{% url 'part-image-upload' part.id %}", { reload: true } ); }); 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").bootstrapTable({ pagination: true, pageSize: 25, url: "{% url 'api-part-thumbs' %}", showHeader: false, clickToSelect: true, singleSelect: true, columns: [ { checkbox: true, }, { field: 'image', title: 'Image', 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 %} {% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %} {% if allow_download %} $("#part-image-url").click(function() { launchModalForm( '{% url "part-image-download" part.id %}', { reload: true, } ); }); {% endif %} $("#part-image-select").click(function() { launchModalForm("{% url 'part-image-select' part.id %}", { reload: true, after_render: onSelectImage }); }); $("#part-edit").click(function() { launchModalForm( "{% url 'part-edit' part.id %}", { reload: true, } ); }); {% endif %} $("#part-order").click(function() { launchModalForm("{% url 'order-parts' %}", { data: { part: {{ part.id }}, }, reload: true, }); }); {% if roles.part.add %} $("#part-duplicate").click(function() { launchModalForm( "{% url 'part-duplicate' part.id %}", { follow: true, } ); }); {% endif %} {% if not part.active and 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 %} } ); }); {% endif %} {% endblock %}