From 68e4adda4817c70b35a1514e1c1549cc60d4e565 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 3 Jun 2019 21:59:15 +1000 Subject: [PATCH] Simplified build allocation view --- InvenTree/build/templates/build/allocate.html | 25 +---------- .../build/templates/build/allocate_edit.html | 2 +- .../build/templates/build/allocate_view.html | 27 +++++++++++- .../build/templates/build/build_base.html | 2 +- InvenTree/build/templates/build/required.html | 41 ------------------- InvenTree/build/templates/build/tabs.html | 3 -- InvenTree/build/urls.py | 2 - InvenTree/build/views.py | 2 + 8 files changed, 30 insertions(+), 74 deletions(-) delete mode 100644 InvenTree/build/templates/build/required.html diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index 3ad123da7f..3a024c8255 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -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"; diff --git a/InvenTree/build/templates/build/allocate_edit.html b/InvenTree/build/templates/build/allocate_edit.html index 3040997fb9..d5978afa1d 100644 --- a/InvenTree/build/templates/build/allocate_edit.html +++ b/InvenTree/build/templates/build/allocate_edit.html @@ -1,6 +1,6 @@ -

Allocate Stock to Build

+

Allocate Stock to Build

diff --git a/InvenTree/build/templates/build/allocate_view.html b/InvenTree/build/templates/build/allocate_view.html index 9cef45bbbc..1c38c38e12 100644 --- a/InvenTree/build/templates/build/allocate_view.html +++ b/InvenTree/build/templates/build/allocate_view.html @@ -1,4 +1,4 @@ -

Stock Allocated to Build

+

Required Parts

@@ -6,5 +6,28 @@
- +
+ + + + + + + + + + + {% for item in build.required_parts %} + + + + + + + + {% endfor %} +
PartDescriptionAvailableRequiredAllocated
+ {% include "hover_image.html" with image=item.part.image %} + {{ item.part.full_name }} + {{ item.part.description }}{{ item.part.total_stock }}{{ item.quantity }}{{ item.allocated }}
\ No newline at end of file diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index 83a89de7c4..b171f2c8aa 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -42,7 +42,7 @@ InvenTree | Build - {{ build }} {% if bom_price %} {{ bom_price }} {% if build.part.has_complete_bom_pricing == False %} - BOM pricing is incomplete +
BOM pricing is incomplete {% endif %} {% else %} No pricing information diff --git a/InvenTree/build/templates/build/required.html b/InvenTree/build/templates/build/required.html deleted file mode 100644 index 66aea7d48a..0000000000 --- a/InvenTree/build/templates/build/required.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends "build/build_base.html" %} -{% load static %} - -{% block details %} - -{% include "build/tabs.html" with tab='required' %} - -

Required Parts

- - - - - - - - - - - {% for item in build.required_parts %} - - - - - - - {% endfor %} - -
PartAvailableRequiredAllocated
- {% include "hover_image.html" with image=item.part.image %} - {{ item.part.full_name }} - {{ item.part.total_stock }}{{ item.quantity }}{{ item.allocated }}
- -{% endblock %} - -{% block js_ready %} - -{{ block.super }} - - $("#build-list").bootstrapTable({}); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/build/templates/build/tabs.html b/InvenTree/build/templates/build/tabs.html index c52309b132..7440cc9eb1 100644 --- a/InvenTree/build/templates/build/tabs.html +++ b/InvenTree/build/templates/build/tabs.html @@ -2,9 +2,6 @@ Details - - Required - Allocate diff --git a/InvenTree/build/urls.py b/InvenTree/build/urls.py index 383e478494..3118bd6042 100644 --- a/InvenTree/build/urls.py +++ b/InvenTree/build/urls.py @@ -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'), ] diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index e325d3cc5b..ace53ecca6 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -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