{% extends "part/part_app_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block menubar %} {% include "part/navbar.html" %} {% endblock %} {% block content %}

{{ part.full_name }}

{% include "part/part_thumb.html" %}

{% if user.is_staff and roles.part.change %}   {% endif %}
{% 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 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.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 %}
{% 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 %}

{% if part.IPN %} {% endif %} {% if part.revision %} {% endif %} {% if part.keywords %} {% endif %} {% if part.link %} {% endif %} {% if part.trackable and part.getLatestSerialNumber %} {% endif %} {% if part.default_location %} {% endif %} {% if part.default_supplier %} {% endif %}
{% trans "IPN" %} {{ part.IPN }}{% include "clip.html"%}
{% trans "Name" %} {{ part.name }}{% include "clip.html"%}
{% trans "Description" %} {{ part.description }}{% include "clip.html"%}
{% trans "Revision" %} {{ part.revision }}{% include "clip.html"%}
{% trans "Keywords" %} {{ part.keywords }}{% include "clip.html"%}
{% trans "External Link" %} {{ part.link }}{% include "clip.html"%}
{% trans "Creation Date" %} {{ part.creation_date }} {% if part.creation_user %} {{ part.creation_user }} {% endif %}
{% trans "Latest Serial Number" %} {{ part.getLatestSerialNumber }}{% include "clip.html"%}
{% trans "Default Location" %} {{ part.default_location }}
{% trans "Default Supplier" %} {{ part.default_supplier }}
{% block page_content %} {% 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 %} function reloadImage(data) { // If image / thumbnail data present, live update if (data.image) { $('#part-image').attr('src', 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, { onSuccess: 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 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 %} $("#toggle-part-details").click(function() { if (this.value == 'show') { this.innerHTML = ' {% trans "Hide Part Details" %}'; this.value = 'hide'; // Store state of part details section localStorage.setItem("part-details-show", true); } else { this.innerHTML = ' {% trans "Show Part Details" %}'; this.value = 'show'; // Store state of part details section localStorage.setItem("part-details-show", false); } }); // Load part details section window.onload = function() { details_show = localStorage.getItem("part-details-show") if (details_show === 'true') { console.log(details_show) // Get collapsible details section details = document.getElementById('collapsible-part-details'); // Add "show" class details.classList.add("in"); // Get toggle toggle = document.getElementById('toggle-part-details'); // Change state of toggle toggle.innerHTML = ' {% trans "Hide Part Details" %}'; toggle.value = 'hide'; } else { // Get toggle toggle = document.getElementById('toggle-part-details'); // Change state of toggle toggle.innerHTML = ' {% trans "Show Part Details" %}'; toggle.value = 'show'; } } {% endblock %}