{% extends "stock/item_base.html" %} {% load static %} {% load i18n %} {% block details %} {% include "stock/tabs.html" with tab='installed' %}

{% trans "Installed Stock Items" %}


{% endblock %} {% block js_ready %} {{ block.super }} $('#installed-table').inventreeTable({ formatNoMatches: function() { return '{% trans "No stock items installed" %}'; }, url: "{% url 'api-stock-list' %}", queryParams: { installed_in: {{ item.id }}, part_detail: true, }, name: 'stock-item-installed', url: "{% url 'api-stock-list' %}", showColumns: true, columns: [ { checkbox: true, title: '{% trans 'Select' %}', searchable: false, switchable: false, }, { field: 'pk', title: 'ID', visible: false, switchable: false, }, { field: 'part_name', title: '{% trans "Part" %}', sortable: true, formatter: function(value, row, index, field) { var url = `/stock/item/${row.pk}/`; var thumb = row.part_detail.thumbnail; var name = row.part_detail.full_name; html = imageHoverIcon(thumb) + renderLink(name, url); return html; } }, { field: 'IPN', title: 'IPN', sortable: true, formatter: function(value, row, index, field) { return row.part_detail.IPN; }, }, { field: 'part_description', title: '{% trans "Description" %}', sortable: true, formatter: function(value, row, index, field) { return row.part_detail.description; } }, { field: 'quantity', title: '{% trans "Stock" %}', sortable: true, formatter: function(value, row, index, field) { var val = parseFloat(value); // If there is a single unit with a serial number, use the serial number if (row.serial && row.quantity == 1) { val = '# ' + row.serial; } else { val = +val.toFixed(5); } var html = renderLink(val, `/stock/item/${row.pk}/`); return html; } }, { field: 'status', title: '{% trans "Status" %}', sortable: 'true', formatter: function(value, row, index, field) { return stockStatusDisplay(value); }, }, { field: 'batch', title: '{% trans "Batch" %}', sortable: true, }, { field: 'actions', switchable: false, title: '', formatter: function(value, row) { var pk = row.pk; var html = `
`; html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); html += `
`; return html; } } ], onLoadSuccess: function() { var table = $('#installed-table'); // Find buttons and associate actions table.find('.button-uninstall').click(function() { var pk = $(this).attr('pk'); launchModalForm( "{% url 'stock-item-uninstall' %}", { data: { 'items[]': [pk], }, reload: true, } ); }); }, buttons: [ '#stock-options', ] }); $('#multi-item-uninstall').click(function() { var selections = $('#installed-table').bootstrapTable('getSelections'); var items = []; selections.forEach(function(item) { items.push(item.pk); }); launchModalForm( "{% url 'stock-item-uninstall' %}", { data: { 'items[]': items, }, reload: true, } ); }); {% endblock %}