{% extends "build/build_base.html" %} {% load static %} {% load i18n %} {% load status_codes %} {% load markdownify %} {% block menubar %} {% include "build/navbar.html" %} {% endblock %} {% block page_content %}

{% trans "Build Details" %}

{% if build.batch %} {% endif %} {% if build.parent %} {% 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 "Progress" %} {{ build.completed }} / {{ build.quantity }}
{% trans "Batch" %} {{ build.batch }}{% include "clip.html"%}
{% trans "Parent Build" %} {{ build.parent }}{% include "clip.html"%}
{% 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" %} {{ build.creation_date }}
{% trans "Target Date" %} {{ build.target_date }}{% if build.is_overdue %} {% endif %} {% trans "No target date set" %}
{% trans "Completed" %}{{ build.completion_date }}{% if build.completed_by %}{{ build.completed_by }}{% endif %}{% trans "Build not complete" %}

{% trans "Child Build Orders" %}

{% trans "Allocate Stock to Build" %}

{% if build.has_untracked_bom_items %} {% if build.active %}
{% if build.areUntrackedPartsFullyAllocated %}
{% 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 %}
{% else %}
{% trans "This Build Order does not have any associated untracked BOM items" %}
{% endif %}
{% if not build.is_complete %}

{% trans "Incomplete Build Outputs" %}

{% if build.active %} {% endif %}
{% if build.incomplete_outputs %}
{% for item in build.incomplete_outputs %} {% include "build/allocation_card.html" with item=item tracked_items=build.has_tracked_bom_items %} {% endfor %}
{% else %}
{% trans "Create a new build output" %}
{% trans "No incomplete build outputs remain." %}
{% trans "Create a new build output using the button above" %}
{% endif %}
{% endif %}

{% trans "Completed Build Outputs" %}

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

{% trans "Attachments" %}

{% include "attachment_table.html" %}

{% trans "Build Notes" %}

{% if build.notes %} {{ build.notes | markdownify }} {% endif %}
{% endblock %} {% block js_ready %} {{ block.super }} $('#btn-create-output').click(function() { launchModalForm('{% url "build-output-create" build.id %}', { reload: true, } ); }); loadStockTable($("#build-stock-table"), { params: { location_detail: true, part_detail: true, build: {{ build.id }}, }, groupByField: 'location', buttons: [ '#stock-options', ], url: "{% url 'api-stock-list' %}", }); var buildInfo = { pk: {{ build.pk }}, quantity: {{ build.quantity }}, completed: {{ build.completed }}, part: {{ build.part.pk }}, }; {% for item in build.incomplete_outputs %} // Get the build output as a javascript object inventreeGet('{% url 'api-stock-detail' item.pk %}', {}, { success: function(response) { loadBuildOutputAllocationTable(buildInfo, response); } } ); {% endfor %} loadBuildTable($('#sub-build-table'), { url: '{% url "api-build-list" %}', filterTarget: "#filter-list-sub-build", params: { ancestor: {{ build.pk }}, } }); enableDragAndDrop( '#attachment-dropzone', '{% url "api-build-attachment-list" %}', { data: { build: {{ build.id }}, }, label: 'attachment', success: function(data, status, xhr) { location.reload(); } } ); // Callback for creating a new attachment $('#new-attachment').click(function() { constructForm('{% url "api-build-attachment-list" %}', { fields: { attachment: {}, comment: {}, build: { value: {{ build.pk }}, hidden: true, } }, method: 'POST', onSuccess: reloadAttachmentTable, title: '{% trans "Add Attachment" %}', }); }); loadAttachmentTable( '{% url "api-build-attachment-list" %}', { filters: { build: {{ build.pk }}, }, onEdit: function(pk) { var url = `/api/build/attachment/${pk}/`; constructForm(url, { fields: { filename: {}, comment: {}, }, onSuccess: reloadAttachmentTable, title: '{% trans "Edit Attachment" %}', }); }, onDelete: function(pk) { constructForm(`/api/build/attachment/${pk}/`, { method: 'DELETE', confirmMessage: '{% trans "Confirm Delete Operation" %}', title: '{% trans "Delete Attachment" %}', onSuccess: reloadAttachmentTable, }); } } ); $('#edit-notes').click(function() { constructForm('{% url "api-build-detail" build.pk %}', { fields: { notes: { multiline: true, } }, title: '{% trans "Edit Notes" %}', reload: true, }); }); var buildInfo = { pk: {{ build.pk }}, quantity: {{ build.quantity }}, completed: {{ build.completed }}, part: {{ build.part.pk }}, }; {% if build.has_untracked_bom_items %} // Load allocation table for un-tracked parts loadBuildOutputAllocationTable(buildInfo, null); {% endif %} function reloadTable() { $('#allocation-table-untracked').bootstrapTable('refresh'); } {% if build.active %} $("#btn-auto-allocate").on('click', function() { launchModalForm( "{% url 'build-auto-allocate' build.id %}", { success: reloadTable, } ); }); $('#btn-unallocate').on('click', function() { launchModalForm( "{% url 'build-unallocate' build.id %}", { success: reloadTable, } ); }); $("#btn-order-parts").click(function() { launchModalForm("/order/purchase-order/order-parts/", { data: { build: {{ build.id }}, }, }); }); {% endif %} {% endblock %}