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

{% trans "Build Details" %}

{% if build.active %} {% 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" %} {% display_status_label 'build' build.status_custom_key build.status %}
{% trans "Completed Outputs" %} {% 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" %} {% include 'clip_link.html' with link=build.link new_window=True %}
{% 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 "Build Order Line Items" %}

{% include "spacer.html" %}
{% if roles.build.add and build.active %} {% endif %}
{% include "filter_list.html" with id='buildlines' %}
{% if build.take_from %}
{% trans "Available stock has been filtered based on specified source location for this build order" %}
{% endif %}

{% trans "Incomplete Build Outputs" %}

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

{% trans "Allocated Stock" %}

{% include "filter_list.html" with id='buildorderallocatedstock' %}

{% trans "Consumed Stock" %}

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

{% trans "Completed Build Outputs" %}

{% include "stock_table.html" with 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 page_content %} {% block js_ready %} {{ block.super }} onPanelLoad('allocated', function() { loadBuildOrderAllocatedStockTable($('#allocated-stock-table'), {{ build.pk }}); }); onPanelLoad('consumed', function() { loadStockTable($('#consumed-stock-table'), { filterTarget: '#filter-list-consumed-stock', params: { location_detail: true, part_detail: true, consumed_by: {{ build.pk }}, in_stock: false, }, }); }); onPanelLoad('completed', function() { loadStockTable($("#build-stock-table"), { filterTarget: '#filter-list-build-stock', params: { location_detail: true, part_detail: true, build: {{ build.id }}, is_building: false, }, }); }); 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() { loadAttachmentTable('build', {{ build.pk }}); }); onPanelLoad('notes', function() { setupNotesField( 'build-notes', '{% url "api-build-detail" build.pk %}', { model_type: 'build', model_id: {{ build.pk }}, {% if roles.build.change %} editable: true, {% else %} editable: false, {% endif %} } ); }); 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, testable: {% js_bool build.part.testable %}, trackable: {% js_bool build.part.trackable %} }; loadBuildOutputTable(build_info); {% endif %} }); onPanelLoad('allocate', function() { // Load the table of line items for this build order loadBuildLineTable( "#build-lines-table", {{ build.pk }}, { {% if build.take_from %} location: {{ build.take_from.pk }}, {% endif %} {% if build.project_code %} project_code: {{ build.project_code.pk }}, {% 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: function() { $('#build-lines-table').bootstrapTable('refresh'); }, } ); }); function allocateSelectedLines() { let data = getTableData('#build-lines-table'); let unallocated_lines = []; data.forEach(function(line) { if (line.allocated < line.quantity) { unallocated_lines.push(line); } }); if (unallocated_lines.length == 0) { showAlertDialog( '{% trans "Allocation Complete" escape %}', '{% trans "All lines have been fully allocated" escape %}', ); } else { allocateStockToBuild( {{ build.pk }}, unallocated_lines, { {% if build.take_from %} source_location: {{ build.take_from.pk }}, {% endif %} success: function() { $('#build-lines-table').bootstrapTable('refresh'); }, } ); } } $('#btn-unallocate').on('click', function() { deallocateStock({{ build.id }}, { table: '#allocation-table-untracked', onSuccess: function() { $('#build-lines-table').bootstrapTable('refresh'); }, }); }); $("#btn-allocate").on('click', function() { allocateSelectedLines(); }); {% endif %} enableSidebar('buildorder'); {% endblock js_ready %}