Add overdue builds to the index page

This commit is contained in:
Oliver Walters 2020-12-15 23:34:28 +11:00
parent c8c50af54b
commit 17d23fa47c
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,15 @@
{% extends "collapse_index.html" %}
{% load i18n %}
{% block collapse_title %}
<span class='fas fa-calendar-times icon-header'></span>
{% trans "Overdue Builds" %}<span class='badge' id='build-overdue-count'><span class='fas fa-spin fa-spinner'></span></span>
{% endblock %}
{% block collapse_content %}
<table class='table table-striped table-condensed' id='build-overdue-table'>
</table>
{% endblock %}

View File

@ -16,6 +16,7 @@ InvenTree | {% trans "Index" %}
{% endif %}
{% if roles.build.view %}
{% include "InvenTree/build_pending.html" with collapse_id="build_pending" %}
{% include "InvenTree/build_overdue.html" with collapse_id="build_overdue" %}
{% endif %}
</div>
<div class='col-sm-6'>
@ -72,6 +73,15 @@ loadBuildTable("#build-pending-table", {
disableFilters: true,
});
loadBuildTable("#build-overdue-table", {
url: "{% url 'api-build-list' %}",
params: {
part_detail: true,
overdue: true,
},
disableFilters: true,
});
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
params: {
low_stock: true,
@ -126,6 +136,12 @@ $("#build-pending-table").on('load-success.bs.table', function() {
$("#build-pending-count").html(count);
});
$("#build-overdue-table").on('load-success.bs.table', function() {
var count = $("#build-overdue-table").bootstrapTable('getData').length;
$("#build-overdue-count").html(count);
});
$("#low-stock-table").on('load-success.bs.table', function() {
var count = $("#low-stock-table").bootstrapTable('getData').length;