Update templates

This commit is contained in:
Oliver Walters 2020-04-25 23:20:55 +10:00
parent 01a68270ea
commit 77361bd0a2
3 changed files with 5 additions and 96 deletions

View File

@ -13,8 +13,9 @@ InvenTree | Allocate Parts
<div id='build-item-toolbar'>
<div class='btn-group'>
<button class='btn btn-primary' type='button' id='btn-allocate' title='Allocate Stock'>{% trans "Allocate" %}</button>
<button class='btn btn-primary' type='button' id='btn-order-parts' title='Order Parts'>{% trans "Order Parts" %}</button>
{% if 0 %}<button class='btn btn-primary' type='button' id='btn-allocate' title='Allocate Stock'>{% trans "Allocate" %}</button>{% endif %}
<button class='btn btn-danger' type='button' id='btn-unallocate' title='Unallocate Stock'>{% trans "Unallocate" %}</button>
</div>
</div>
@ -317,21 +318,7 @@ InvenTree | Allocate Parts
],
});
{% 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 %}
{% if 0 %}
$("#auto-allocate-build").on('click', function() {
launchModalForm(
"{% url 'build-auto-allocate' build.id %}",
@ -340,8 +327,9 @@ InvenTree | Allocate Parts
}
);
});
{% endif %}
$('#unallocate-build').on('click', function() {
$('#btn-unallocate').on('click', function() {
launchModalForm(
"{% url 'build-unallocate' build.id %}",
{
@ -350,15 +338,6 @@ InvenTree | Allocate Parts
);
});
{% else %}
$("#build-list").inventreeTable({
});
$("#btn-allocate").click(function() {
location.href = "{% url 'build-allocate' build.id %}?edit=1";
});
$("#btn-order-parts").click(function() {
launchModalForm("/order/purchase-order/order-parts/", {
data: {
@ -367,6 +346,4 @@ InvenTree | Allocate Parts
});
});
{% endif %}
{% endblock %}

View File

@ -1,34 +0,0 @@
{% load i18n %}
{% load inventree_extras %}
<div class='row'>
<h4>{% trans "Allocate Stock to Build" %}</h4>
<div class='col-sm-6'>
</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'>{% trans "Auto Allocate" %}</button>
<button class='btn btn-warning' type='button' title='Unallocate build stock' id='unallocate-build'>{% trans "Unallocate" %}</button>
</div>
</div>
</div>
<hr>
<div class='row'>
<div class='col-sm-6'>
<h4>{% trans "Part" %}</h4>
</div>
<div class='col-sm-2'>
<h4>{% trans "Available" %}</h4>
</div>
<div class='col-sm-2'>
<h4>{% trans "Required" %}</h4>
</div>
<div class='col-sm-2'>
<h4>{% trans "Allocated" %}</h4>
</div>
</div>
{% for bom_item in bom_items.all %}
{% include "build/allocation_item.html" with item=bom_item build=build collapse_id=bom_item.id %}
{% endfor %}

View File

@ -1,34 +0,0 @@
{% extends "collapse.html" %}
{% load static %}
{% load inventree_extras %}
{% block collapse_panel_setup %}class='panel part-allocation' id='allocation-panel-{{ item.sub_part.id }}'{% endblock %}
{% block collapse_title %}
{% include "hover_image.html" with image=item.sub_part.image hover=false %}
<div>
{{ item.sub_part.full_name }}
<small><i>{{ item.sub_part.description }}</i></small>
</div>
{% endblock %}
{% block collapse_heading %}
<div class='col-sm-2'>
<b>{% decimal item.sub_part.total_stock %}</b>
</div>
<div class='col-sm-2'>
<b>{% multiply build.quantity item.quantity %}{% if item.overage %} (+ {{ item.overage }}){% endif %}</b>
</div>
<div class='col-sm-2'>
<b><span id='allocation-total-{{ item.sub_part.id }}'>{% part_allocation_count build item.sub_part %}</span></b>
<div class='btn-group' style='float: right;'>
<button class='btn btn-success btn-sm' title='Allocate stock for {{ item.sub_part}}' id='new-item-{{ item.sub_part.id }}' url="{% url 'build-item-create' %}?part={{ item.sub_part.id }}&build={{ build.id }}">Allocate</button>
</div>
</div>
{% endblock %}
{% block collapse_content %}
<table class='table table-striped table-condensed' id='allocate-table-id-{{ item.sub_part.id }}'>
</table>
{% endblock %}