mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-09 00:38:50 +00:00
78 lines
2.1 KiB
HTML
78 lines
2.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
{% load inventree_extras %}
|
|
|
|
{% block page_title %}
|
|
InvenTree | Allocate Parts
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<h3>Allocate Parts for Build</h3>
|
|
|
|
<div class='row'>
|
|
<div class='col-sm-6'>
|
|
|
|
<h4><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></h4>
|
|
{{ build.quantity }} x {{ build.part.name }}
|
|
</div>
|
|
<div class='col-sm-6'>
|
|
<div class='btn-group' style='float: right;'>
|
|
<button class='btn btn-primary' type='button' title='Automatic allocation' id='auto-allocate-build'>Auto Allocate</button>
|
|
<button class='btn btn-warning' type='button' title='Complete build' id='complete-build'>Complete Build</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
|
|
{% for bom_item in bom_items.all %}
|
|
{% include "build/allocation_item.html" with item=bom_item build=build collapse_id=bom_item.id %}
|
|
{% endfor %}
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block js_load %}
|
|
{{ block.super }}
|
|
<script src="{% static 'script/inventree/api.js' %}"></script>
|
|
<script src="{% static 'script/inventree/part.js' %}"></script>
|
|
<script src="{% static 'script/inventree/build.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block js_ready %}
|
|
{{ block.super }}
|
|
|
|
{% 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.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 %}
|
|
|
|
$("#complete-build").on('click', function() {
|
|
launchModalForm(
|
|
"{% url 'build-complete' build.id %}",
|
|
{
|
|
reload: true,
|
|
submit_text: "Complete Build",
|
|
}
|
|
);
|
|
});
|
|
|
|
$("#auto-allocate-build").on('click', function() {
|
|
launchModalForm(
|
|
"{% url 'build-auto-allocate' build.id %}",
|
|
{
|
|
reload: true,
|
|
}
|
|
);
|
|
});
|
|
|
|
{% endblock %}
|