Simplified build allocation view

This commit is contained in:
Oliver Walters 2019-06-03 21:59:15 +10:00
parent 7a3b186a0c
commit 68e4adda48
8 changed files with 30 additions and 74 deletions

View File

@ -62,30 +62,7 @@ InvenTree | Allocate Parts
{% else %}
$("#build-item-table").bootstrapTable({
url: "{% url 'api-build-item-list' %}",
queryParams: {
build: {{ build.id }},
},
search: true,
columns: [
{
field: 'part_name',
title: 'Part',
formatter: function(value, row, index, field) {
return imageHoverIcon(row.part_image) + value;
}
},
{
field: 'stock_item_detail.location_name',
title: 'Location',
},
{
field: 'quantity',
title: 'Quantity Allocated',
},
]
});
$("#build-list").bootstrapTable({});
$("#btn-allocate").click(function() {
location.href = "{% url 'build-allocate' build.id %}?edit=1";

View File

@ -1,6 +1,6 @@
<h4>Allocate Stock to Build</h4>
<div class='row'>
<h4>Allocate Stock to Build</h4>
<div class='col-sm-6'>
</div>
<div class='col-sm-6'>

View File

@ -1,4 +1,4 @@
<h4>Stock Allocated to Build</h4>
<h4>Required Parts</h4>
<div id='#build-item-toolbar'>
<div class='btn-group'>
@ -6,5 +6,28 @@
</div>
</div>
<table class='table table-condensed table-striped' id='build-item-table' data-toolbar='#build-item-toolbar'>
<table class='table table-striped table-condensed' id='build-list' data-sorting='true' data-toolbar='#build-item-toolbar'>
<thead>
<tr>
<th>Part</th>
<th>Description</th>
<th>Available</th>
<th>Required</th>
<th>Allocated</th>
</tr>
</thead>
<tbody>
{% for item in build.required_parts %}
<tr>
<td>
{% include "hover_image.html" with image=item.part.image %}
<a class='hover-icon'a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a>
</td>
<td>{{ item.part.description }}</td>
<td>{{ item.part.total_stock }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.allocated }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -42,7 +42,7 @@ InvenTree | Build - {{ build }}
{% if bom_price %}
{{ bom_price }}
{% if build.part.has_complete_bom_pricing == False %}
<span class='warning-msg'><i>BOM pricing is incomplete</i></span>
<br><span class='warning-msg'><i>BOM pricing is incomplete</i></span>
{% endif %}
{% else %}
<span class='warning-msg'><i>No pricing information</i></span>

View File

@ -1,41 +0,0 @@
{% extends "build/build_base.html" %}
{% load static %}
{% block details %}
{% include "build/tabs.html" with tab='required' %}
<h4>Required Parts</h4>
<table class='table table-striped table-condensed' id='build-list' data-sorting='true'>
<thead>
<tr>
<th>Part</th>
<th>Available</th>
<th>Required</th>
<th>Allocated</th>
</tr>
</thead>
<tbody>
{% for item in build.required_parts %}
<tr>
<td>
{% include "hover_image.html" with image=item.part.image %}
<a class='hover-icon'a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a>
</td>
<td>{{ item.part.total_stock }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.allocated }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
$("#build-list").bootstrapTable({});
{% endblock %}

View File

@ -2,9 +2,6 @@
<li{% if tab == 'details' %} class='active'{% endif %}>
<a href="{% url 'build-detail' build.id %}">Details</a>
</li>
<li{% if tab == 'required' %} class='active'{% endif %}>
<a href="{% url 'build-required' build.id %}">Required</a>
</li>
<li{% if tab == 'allocate' %} class='active'{% endif %}>
<a href="{% url 'build-allocate' build.id %}">Allocate</a>
</li>

View File

@ -24,8 +24,6 @@ build_detail_urls = [
url(r'^auto-allocate/?', views.BuildAutoAllocate.as_view(), name='build-auto-allocate'),
url(r'^unallocate/', views.BuildUnallocate.as_view(), name='build-unallocate'),
url(r'^required/', views.BuildDetail.as_view(template_name='build/required.html'), name='build-required'),
url(r'^.*$', views.BuildDetail.as_view(), name='build-detail'),
]

View File

@ -294,6 +294,8 @@ class BuildAllocate(DetailView):
context['part'] = part
context['bom_items'] = bom_items
context['bom_price'] = build.part.get_price_info(build.quantity, buy=False)
if str2bool(self.request.GET.get('edit', None)):
context['editing'] = True