diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 15926715f6..68f6ebb4bd 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -328,11 +328,15 @@ class IndexView(TemplateView): def get_context_data(self, **kwargs): context = super(TemplateView, self).get_context_data(**kwargs) - + + context['starred'] = [star.part for star in self.request.user.starred_parts.all()] + # Generate a list of orderable parts which have stock below their minimum values + # TODO - Is there a less expensive way to get these from the database context['to_order'] = [part for part in Part.objects.filter(purchaseable=True) if part.need_to_restock()] # Generate a list of buildable parts which have stock below their minimum values + # TODO - Is there a less expensive way to get these from the database context['to_build'] = [part for part in Part.objects.filter(buildable=True) if part.need_to_restock()] return context diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html index 91cac4c18c..12019ca7b0 100644 --- a/InvenTree/templates/InvenTree/index.html +++ b/InvenTree/templates/InvenTree/index.html @@ -3,6 +3,8 @@ {% block content %}

InvenTree

+{% include "InvenTree/starred_parts.html" with collapse_id="starred" %} + {% if to_order %} {% include "InvenTree/parts_to_order.html" with collapse_id="order" %} {% endif %} @@ -19,4 +21,9 @@ {% block js_ready %} {{ block.super }} + +$("#to-build-table").bootstrapTable(); +$("#to-order-table").bootstrapTable(); +$("#starred-parts-table").bootstrapTable(); + {% endblock %} \ No newline at end of file diff --git a/InvenTree/templates/InvenTree/parts_to_build.html b/InvenTree/templates/InvenTree/parts_to_build.html index e9c1dcdee1..df9199853b 100644 --- a/InvenTree/templates/InvenTree/parts_to_build.html +++ b/InvenTree/templates/InvenTree/parts_to_build.html @@ -1,5 +1,6 @@ {% extends "collapse.html" %} {% block collapse_title %} + Parts to Build{{ to_build | length }} {% endblock %} diff --git a/InvenTree/templates/InvenTree/parts_to_order.html b/InvenTree/templates/InvenTree/parts_to_order.html index b68eda7e14..c9b18606d0 100644 --- a/InvenTree/templates/InvenTree/parts_to_order.html +++ b/InvenTree/templates/InvenTree/parts_to_order.html @@ -1,5 +1,6 @@ {% extends "collapse.html" %} {% block collapse_title %} + Parts to Order{{ to_order | length }} {% endblock %} diff --git a/InvenTree/templates/InvenTree/starred_parts.html b/InvenTree/templates/InvenTree/starred_parts.html new file mode 100644 index 0000000000..eebc251666 --- /dev/null +++ b/InvenTree/templates/InvenTree/starred_parts.html @@ -0,0 +1,15 @@ +{% extends "collapse.html" %} +{% block collapse_title %} + +Starred Parts{{ starred | length }} +{% endblock %} + +{% block collapse_heading %} +You have {{ starred | length }} favourite parts +{% endblock %} + +{% block collapse_content %} + +{% include "required_part_table.html" with parts=starred table_id="starred-parts-table" %} + +{% endblock %} \ No newline at end of file