diff --git a/InvenTree/build/templatetags/__init__.py b/InvenTree/build/templatetags/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/InvenTree/build/templatetags/inventree_extras.py b/InvenTree/build/templatetags/inventree_extras.py
new file mode 100644
index 0000000000..cb8cd0d235
--- /dev/null
+++ b/InvenTree/build/templatetags/inventree_extras.py
@@ -0,0 +1,12 @@
+""" This module provides template tags for extra functionality
+over and above the built-in Django tags.
+"""
+
+from django import template
+
+register = template.Library()
+
+
+@register.simple_tag()
+def multiply(x, y, *args, **kwargs):
+ return x * y
diff --git a/InvenTree/static/css/inventree.css b/InvenTree/static/css/inventree.css
index f16ce3f038..0a1c34036b 100644
--- a/InvenTree/static/css/inventree.css
+++ b/InvenTree/static/css/inventree.css
@@ -139,4 +139,16 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-}
\ No newline at end of file
+}
+
+.part-allocation-pass {
+ background: #dbf0db;
+}
+
+.part-allocation-underallocated {
+ background: #f0dbdb;
+}
+
+.part-allocation-overallocated {
+ background: #ccf5ff;
+}
diff --git a/InvenTree/static/script/inventree/build.js b/InvenTree/static/script/inventree/build.js
index 92fbf430f7..fd20af0743 100644
--- a/InvenTree/static/script/inventree/build.js
+++ b/InvenTree/static/script/inventree/build.js
@@ -1,4 +1,21 @@
-function loadAllocationTable(table, part, url, button) {
+function updateAllocationTotal(id, count, required) {
+
+
+ $('#allocation-total-'+id).html(count);
+
+ var el = $("#allocation-panel-" + id);
+ el.removeClass('part-allocation-pass part-allocation-underallocated part-allocation-overallocated');
+
+ if (count < required) {
+ el.addClass('part-allocation-underallocated');
+ } else if (count > required) {
+ el.addClass('part-allocation-overallocated');
+ } else {
+ el.addClass('part-allocation-pass');
+ }
+}
+
+function loadAllocationTable(table, part_id, part, url, required, button) {
// Load the allocation table
table.bootstrapTable({
@@ -39,6 +56,19 @@ function loadAllocationTable(table, part, url, button) {
});
});
+ table.on('load-success.bs.table', function(data) {
+ // Extract table data
+ var results = table.bootstrapTable('getData');
+
+ var count = 0;
+
+ for (var i = 0; i < results.length; i++) {
+ count += results[i].quantity;
+ }
+
+ updateAllocationTotal(part_id, count, required);
+ });
+
// Button callbacks for editing and deleting the allocations
table.on('click', '.item-edit-button', function() {
var button = $(this);