mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
Display collapsible list of starred-parts on the index page
This commit is contained in:
parent
aaff92ff9c
commit
c75d892fd7
@ -328,11 +328,15 @@ class IndexView(TemplateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
||||||
context = super(TemplateView, self).get_context_data(**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
|
# 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()]
|
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
|
# 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()]
|
context['to_build'] = [part for part in Part.objects.filter(buildable=True) if part.need_to_restock()]
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>InvenTree</h3>
|
<h3>InvenTree</h3>
|
||||||
|
|
||||||
|
{% include "InvenTree/starred_parts.html" with collapse_id="starred" %}
|
||||||
|
|
||||||
{% if to_order %}
|
{% if to_order %}
|
||||||
{% include "InvenTree/parts_to_order.html" with collapse_id="order" %}
|
{% include "InvenTree/parts_to_order.html" with collapse_id="order" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -19,4 +21,9 @@
|
|||||||
|
|
||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
|
$("#to-build-table").bootstrapTable();
|
||||||
|
$("#to-order-table").bootstrapTable();
|
||||||
|
$("#starred-parts-table").bootstrapTable();
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,5 +1,6 @@
|
|||||||
{% extends "collapse.html" %}
|
{% extends "collapse.html" %}
|
||||||
{% block collapse_title %}
|
{% block collapse_title %}
|
||||||
|
<span class='glyphicon glyphicon-wrench'></span>
|
||||||
Parts to Build<span class='badge'>{{ to_build | length }}</span>
|
Parts to Build<span class='badge'>{{ to_build | length }}</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{% extends "collapse.html" %}
|
{% extends "collapse.html" %}
|
||||||
{% block collapse_title %}
|
{% block collapse_title %}
|
||||||
|
<span class='glyphicon glyphicon-shopping-cart'></span>
|
||||||
Parts to Order<span class='badge'>{{ to_order | length }}</span>
|
Parts to Order<span class='badge'>{{ to_order | length }}</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
15
InvenTree/templates/InvenTree/starred_parts.html
Normal file
15
InvenTree/templates/InvenTree/starred_parts.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% extends "collapse.html" %}
|
||||||
|
{% block collapse_title %}
|
||||||
|
<span class='glyphicon glyphicon-star'></span>
|
||||||
|
Starred Parts<span class='badge'>{{ starred | length }}</span>
|
||||||
|
{% 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 %}
|
Loading…
x
Reference in New Issue
Block a user