{% extends "part/part_app_base.html" %} {% load static %} {% load i18n %} {% load barcode %} {% load inventree_extras %} {% block sidebar %} {% include "part/part_sidebar.html" %} {% endblock sidebar %} {% block thumbnail %} {% include "part/part_thumb.html" %} {% endblock thumbnail %} {% block heading %} {{ part.full_name }} {% endblock heading %} {% block actions %} {% admin_url user "part.part" part.pk as url %} {% include "admin_button.html" with url=url %} {% if starred_directly %} {% elif starred %} {% else %} {% endif %} {% if barcodes or labels_enabled %}
{% 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 actions %} {% block details %} {% if part.variant_of %} {% 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 %}
{% include "spacer.html" %}
{% trans "Description" %} {{ part.description }}{% include "clip.html" %}
{% trans "Variant Of" %} {{ part.variant_of.full_name }}
{% endblock details %} {% block details_right %} {% if part.minimum_stock %} {% endif %} {% if on_order > 0 %} {% endif %} {% if required > 0 %} {% endif %} {% if part.component %} {% if required_build_order_quantity > 0 or allocated_build_order_quantity > 0 %} {% endif %} {% endif %} {% if part.salable %} {% if required_sales_order_quantity > 0 or allocated_sales_order_quantity > 0 %} {% endif %} {% endif %} {% if part.assembly %} {% if quantity_being_built > 0 %} {% endif %} {% endif %}
{% trans "Available Stock" %}
{% decimal available %} {% include "part/part_units.html" %}
{% trans "In Stock" %} {% include "part/stock_count.html" %}
{% trans "Minimum Stock" %} {% decimal part.minimum_stock %} {% include "part/part_units.html" %}
{% trans "On Order" %} {% decimal on_order %} {% include "part/part_units.html" %}
{% trans "Required for Orders" %} {% decimal required %}
{% trans "Allocated to Build Orders" %} {% progress_bar allocated_build_order_quantity required_build_order_quantity id='build-order-allocated' max_width='150px' %}
{% trans "Allocated to Sales Orders" %} {% progress_bar allocated_sales_order_quantity required_sales_order_quantity id='sales-order-allocated' max_width='150px' %}
{% trans "Can Build" %} {% decimal part.can_build %}
{% trans "Building" %} {% decimal quantity_being_built %}
{% endblock details_right %} {% block details_below %}
{% if part.category %} {% endif %} {% if part.IPN %} {% endif %} {% settings_value "PART_ENABLE_REVISION" as show_revision %} {% if show_revision and part.revision_of %} {% endif %} {% if show_revision and part.revision %} {% endif %} {% if part.units %} {% endif %} {% if part.minimum_stock %} {% endif %} {% if part.keywords %} {% endif %} {% include "barcode_data.html" with instance=part %}
{% trans "Category" %} {{ part.category.name }}
{% trans "IPN" %} {{ part.IPN }}{% include "clip.html" %}
{% trans "Revision Of" %} {{ part.revision_of.full_name }}
{% trans "Revision" %} {{ part.revision }}{% include "clip.html" %}
{% trans "Units" %} {{ part.units }}
{% trans "Minimum stock level" %} {% decimal part.minimum_stock %}
{% trans "Keywords" %} {{ part.keywords }}{% include "clip.html" %}
{% with part.pricing as pricing %} {% if pricing.is_valid %} {% endif %} {% endwith %} {% with part.latest_stocktake as stocktake %} {% if stocktake %} {% endif %} {% endwith %} {% with part.get_latest_serial_number as sn %} {% if part.trackable and sn %} {% endif %} {% endwith %} {% if part.default_location %} {% endif %} {% if part.default_supplier %} {% endif %} {% if part.link %} {% endif %} {% if part.responsible_owner %} {% endif %}
{% trans "Creation Date" %} {% render_date part.creation_date %} {% if part.creation_user %} {{ part.creation_user }} {% endif %}
{% trans "Price Range" %} {% if pricing.overall_min == pricing.overall_max %} {% render_currency pricing.overall_max %} {% else %} {% render_currency pricing.overall_min %} - {% render_currency pricing.overall_max %} {% endif %} {% if part.units %}  / {{ part.units }}{% endif %}
{% trans "Last Stocktake" %} {% decimal stocktake.quantity %} {{ stocktake.user.username }}
{% trans "Latest Serial Number" %} {{ sn }}
{% trans "Default Location" %} {{ part.default_location }}
{% trans "Default Supplier" %} {{ part.default_supplier }}
{% trans "External Link" %} {% include 'clip_link.html' with link=part.link new_window=True %}
{% trans "Responsible" %} {{ part.responsible_owner }}
{% endblock details_below %} {% block js_ready %} {{ block.super }} {% if part.image %} $('#part-thumb').click(function() { showModalImage('{{ part.image.url }}'); }); {% else %} $('#part-image-delete').hide(); {% 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); }); $("#part-image-delete").show(); } 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); } } ); {% if barcodes %} $("#show-qr-code").click(function() { showQRDialog( '{% trans "Part QR Code" escape %}', `{% clean_barcode part.barcode %}` ); }); $('#barcode-unlink').click(function() { unlinkBarcode({ part: {{ part.pk }}, }); }); $('#barcode-link').click(function() { linkBarcodeDialog( { part: {{ part.pk }}, }, { title: '{% trans "Link Barcode to Part" escape %}', } ); }); {% endif %} {% if labels_enabled %} $('#print-label').click(function() { printLabels({ items: [{{ part.pk }}], model_type: 'part', singular_name: 'part', }); }); {% endif %} 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" escape %}', hideErrorMessage: true, } ); }); $("#toggle-starred").click(function() { toggleStar({ url: '{% url "api-part-detail" part.pk %}', button: '#part-star-icon', }); }); $('#part-image-delete').click(function(event) { event.stopPropagation(); showQuestionDialog( '{% trans "Remove Image" escape %}', '{% trans "Remove associated image from this part" escape %}', { accept_text: '{% trans "Remove" escape %}', submitClass: 'danger', accept: function() { inventreePut( '{% url "api-part-detail" part.pk %}', { 'image': null, }, { method: 'PATCH', success: function(data) { location.reload(); } } ); } } ); }); $("#part-image-upload").click(function(event) { event.stopPropagation(); constructForm( '{% url "api-part-detail" part.pk %}', { method: 'PATCH', fields: { image: {}, }, title: '{% trans "Upload Image" escape %}', 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" escape %}'; }, columns: [ { checkbox: true, }, { field: 'image', title: 'Image', searchable: true, formatter: function(value, row, index, field) { return "image" } } ], 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() { event.stopPropagation(); constructForm( '{% url "api-part-detail" part.pk %}', { method: 'PATCH', title: '{% trans "Download Image" escape %}', fields: { remote_image: {}, }, onSuccess: function(data) { reloadImage(data); }, } ); }); } $("#part-image-select").click(function(event) { event.stopPropagation(); launchModalForm("{% url 'part-image-select' part.id %}", { reload: true, after_render: onSelectImage }); }); $("#part-edit").click(function() { editPart({{ part.pk }}); }); {% endif %} $("#part-order").click(function() { inventreeGet( '{% url "api-part-detail" part.pk %}', {}, { success: function(part) { orderParts( [part], {} ); } } ); }); {% if roles.part.add %} $("#part-duplicate").click(function() { duplicatePart({{ part.pk }}); }); {% endif %} {% if roles.part.delete %} $("#part-delete").click(function() { deletePart({{ part.pk }}, { {% if part.category %} redirect: '{% url "category-detail" part.category.pk %}', {% else %} redirect: '{% url "part-index" %}', {% endif %} }); }); {% endif %} // Callback function when the "part details" panel is shown $('#collapse-part-details').on('show.bs.collapse', function() { $('#toggle-details-button').html('{% trans "Hide Part Details" escape %}'); inventreeSave('show-part-details', true); }); // Callback function when the "part details" panel is hidden $('#collapse-part-details').on('hide.bs.collapse', function() { $('#toggle-details-button').html('{% trans "Show Part Details" escape %}'); inventreeSave('show-part-details', false); }); if (inventreeLoad('show-part-details', false).toString() == 'true') { $('#collapse-part-details').collapse('show'); } $('#serial-number-search').click(function() { findStockItemBySerialNumber({{ part.pk }}); }); {% endblock js_ready %}