{% extends "build/build_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% load status_codes %} {% block sidebar %} {% include "build/sidebar.html" %} {% endblock %} {% block page_content %}

{% trans "Build Details" %}

{% if build.active and has_untracked_bom_items %} {% endif %} {% if build.batch %} {% endif %} {% if build.parent %} {% endif %} {% if build.priority != 0 %} {% endif %} {% if build.sales_order %} {% endif %} {% if build.link %} {% endif %} {% if build.issued_by %} {% endif %} {% if build.responsible %} {% endif %}
{% trans "Description" %} {{ build.title }}{% include "clip.html"%}
{% trans "Part" %} {{ build.part.full_name }}{% include "clip.html"%}
{% trans "Quantity" %}{{ build.quantity }}
{% trans "Stock Source" %} {% if build.take_from %} {{ build.take_from }}{% include "clip.html"%} {% else %} {% trans "Stock can be taken from any available location." %} {% endif %}
{% trans "Destination" %} {% if build.destination %} {{ build.destination }} {% include "clip.html"%} {% else %} {% trans "Destination location not specified" %} {% endif %}
{% trans "Status" %} {% build_status_label build.status %}
{% trans "Completed" %} {% progress_bar build.completed build.quantity id='build-completed-2' max_width='150px' %}
{% trans "Allocated Parts" %}
{% trans "Batch" %} {{ build.batch }}{% include "clip.html"%}
{% trans "Parent Build" %} {{ build.parent }}{% include "clip.html"%}
{% trans "Priority" %} {{ build.priority }}
{% trans "Sales Order" %} {{ build.sales_order }}{% include "clip.html"%}
{% trans "External Link" %} {{ build.link }}{% include "clip.html"%}
{% trans "Issued By" %} {{ build.issued_by }}
{% trans "Responsible" %} {{ build.responsible }}
{% if build.target_date %} {% else %} {% endif %} {% if build.completion_date %} {% else %} {% endif %}
{% trans "Created" %} {% render_date build.creation_date %}
{% trans "Target Date" %} {% render_date build.target_date %}{% if build.is_overdue %} {% endif %} {% trans "No target date set" %}
{% trans "Completed" %}{% render_date build.completion_date %}{% if build.completed_by %}{{ build.completed_by }}{% endif %}{% trans "Build not complete" %}

{% trans "Child Build Orders" %}

{% include "filter_list.html" with id='sub-build' %}

{% trans "Allocate Stock to Build" %}

{% include "spacer.html" %}
{% if roles.build.add and build.active and has_untracked_bom_items %} {% endif %}
{% if has_untracked_bom_items %} {% if build.active %} {% if build.are_untracked_parts_allocated %}
{% trans "Untracked stock has been fully allocated for this Build Order" %}
{% else %}
{% trans "Untracked stock has not been fully allocated for this Build Order" %}
{% endif %} {% endif %}
{% include "filter_list.html" with id='builditems' %}
{% else %}
{% trans "This Build Order does not have any associated untracked BOM items" %}
{% endif %}

{% trans "Incomplete Build Outputs" %}

{% include "spacer.html" %}
{% if roles.build.add and build.active %} {% endif %}
{% if build.active %}
{% include "filter_list.html" with id='incompletebuilditems' %}
{% endif %}

{% trans "Completed Build Outputs" %}

{% include "stock_table.html" with read_only=True prefix="build-" %}

{% trans "Attachments" %}

{% include "spacer.html" %}
{% include "attachment_button.html" %}
{% include "attachment_table.html" %}

{% trans "Build Notes" %}

{% include "spacer.html" %}
{% include "notes_buttons.html" %}
{% endblock %} {% block js_ready %} {{ block.super }} onPanelLoad('completed', function() { loadStockTable($("#build-stock-table"), { params: { location_detail: true, part_detail: true, build: {{ build.id }}, is_building: false, }, groupByField: 'location', buttons: [ '#stock-options', ], url: "{% url 'api-stock-list' %}", }); }); onPanelLoad('children', function() { loadBuildTable($('#sub-build-table'), { locale: '{{ request.LANGUAGE_CODE }}', filterTarget: "#filter-list-sub-build", parentBuild: {{ build.pk }}, params: { ancestor: {{ build.pk }}, } }); }); onPanelLoad('attachments', function() { enableDragAndDrop( '#attachment-dropzone', '{% url "api-build-attachment-list" %}', { data: { build: {{ build.id }}, }, label: 'attachment', success: function(data, status, xhr) { $('#attachment-table').bootstrapTable('refresh'); } } ); loadAttachmentTable('{% url "api-build-attachment-list" %}', { filters: { build: {{ build.pk }}, }, fields: { build: { value: {{ build.pk }}, hidden: true, } } }); }); onPanelLoad('notes', function() { setupNotesField( 'build-notes', '{% url "api-build-detail" build.pk %}', { {% if roles.build.change %} editable: true, {% else %} editable: false, {% endif %} } ); }); function reloadTable() { $('#allocation-table-untracked').bootstrapTable('refresh'); } onPanelLoad('outputs', function() { {% if build.active %} var build_info = { pk: {{ build.pk }}, part: {{ build.part.pk }}, quantity: {{ build.quantity }}, {% if build.take_from %} source_location: {{ build.take_from.pk }}, {% endif %} tracked_parts: true, }; loadBuildOutputTable(build_info); {% endif %} }); {% if build.active and has_untracked_bom_items %} function loadUntrackedStockTable() { var build_info = { pk: {{ build.pk }}, part: {{ build.part.pk }}, quantity: {{ build.quantity }}, {% if build.take_from %} source_location: {{ build.take_from.pk }}, {% endif %} tracked_parts: false, }; $('#allocation-table-untracked').bootstrapTable('destroy'); // Load allocation table for un-tracked parts loadBuildOutputAllocationTable( build_info, null, { search: true, } ); } onPanelLoad('allocate', function() { loadUntrackedStockTable(); }); {% endif %} $('#btn-create-output').click(function() { createBuildOutput( {{ build.pk }}, { trackable_parts: {% js_bool build.part.has_trackable_parts %}, } ); }); {% if build.active %} $("#btn-auto-allocate").on('click', function() { autoAllocateStockToBuild( {{ build.pk }}, [], { {% if build.take_from %} location: {{ build.take_from.pk }}, {% endif %} onSuccess: loadUntrackedStockTable, } ); }); $("#btn-allocate").on('click', function() { var bom_items = $("#allocation-table-untracked").bootstrapTable("getData"); var incomplete_bom_items = []; bom_items.forEach(function(bom_item) { if (bom_item.required > bom_item.allocated) { incomplete_bom_items.push(bom_item); } }); if (incomplete_bom_items.length == 0) { showAlertDialog( '{% trans "Allocation Complete" %}', '{% trans "All untracked stock items have been allocated" %}', ); } else { allocateStockToBuild( {{ build.pk }}, {{ build.part.pk }}, incomplete_bom_items, { {% if build.take_from %} source_location: {{ build.take_from.pk }}, {% endif %} success: loadUntrackedStockTable, } ); } }); $('#btn-unallocate').on('click', function() { unallocateStock({{ build.id }}, { table: '#allocation-table-untracked', onSuccess: loadUntrackedStockTable, }); }); $('#allocate-selected-items').click(function() { var bom_items = getTableData('#allocation-table-untracked'); allocateStockToBuild( {{ build.pk }}, {{ build.part.pk }}, bom_items, { {% if build.take_from %} source_location: {{ build.take_from.pk }}, {% endif %} success: loadUntrackedStockTable, } ); }); {% endif %} enableSidebar('buildorder'); {% endblock %}