{% extends "build/build_base.html" %} {% load static %} {% load inventree_extras %} {% block page_title %} InvenTree | Allocate Parts {% endblock %} {% block details %} {% include "build/tabs.html" with tab='allocate' %} {% if editing %} {% include "build/allocate_edit.html" %} {% else %} {% include "build/allocate_view.html" %} {% endif %} {% endblock %} {% block js_load %} {{ block.super }} {% endblock %} {% block js_ready %} {{ block.super }} {% if editing %} {% for bom_item in bom_items.all %} loadAllocationTable( $("#allocate-table-id-{{ bom_item.sub_part.id }}"), {{ bom_item.sub_part.id }}, "{{ bom_item.sub_part.full_name }}", "{% url 'api-build-item-list' %}?build={{ build.id }}&part={{ bom_item.sub_part.id }}", {% multiply build.quantity bom_item.quantity %}, $("#new-item-{{ bom_item.sub_part.id }}") ); {% endfor %} $("#auto-allocate-build").on('click', function() { launchModalForm( "{% url 'build-auto-allocate' build.id %}", { reload: true, } ); }); $('#unallocate-build').on('click', function() { launchModalForm( "{% url 'build-unallocate' build.id %}", { reload: true, } ); }); {% else %} $("#build-item-table").bootstrapTable({ url: "{% url 'api-build-item-list' %}", queryParams: { build: {{ build.id }}, }, search: true, columns: [ { field: 'part_name', title: 'Part', formatter: function(value, row, index, field) { return imageHoverIcon(row.part_image) + value; } }, { field: 'stock_item_detail.location_name', title: 'Location', }, { field: 'quantity', title: 'Quantity Allocated', }, ] }); $("#btn-allocate").click(function() { location.href = "{% url 'build-allocate' build.id %}?edit=1"; }); {% endif %} {% endblock %}