Add "expired stock" table to index page

This commit is contained in:
Oliver Walters 2021-01-04 09:46:14 +11:00
parent d1ce0f062e
commit 4d7c60a130
3 changed files with 35 additions and 3 deletions

View File

@ -0,0 +1,15 @@
{% extends "collapse_index.html" %}
{% load i18n %}
{% block collapse_title %}
<span class='fas fa-stopwatch icon-header'></span>
{% trans "Expired Stock" %}<span class='badge' id='expired-stock-count'><span class='fas fa-spin fa-spinner'></span></span>
{% endblock %}
{% block collapse_content %}
<table class='table table-striped table-condensed' id='expired-stock-table'>
</table>
{% endblock %}

View File

@ -8,7 +8,7 @@ InvenTree | {% trans "Index" %}
<h3>InvenTree</h3>
<hr>
<div class='col-sm-6'>
<div class='col-sm-4'>
{% if roles.part.view %}
{% include "InvenTree/latest_parts.html" with collapse_id="latest_parts" %}
{% include "InvenTree/bom_invalid.html" with collapse_id="bom_invalid" %}
@ -19,11 +19,14 @@ InvenTree | {% trans "Index" %}
{% include "InvenTree/build_overdue.html" with collapse_id="build_overdue" %}
{% endif %}
</div>
<div class='col-sm-6'>
<div class='col-sm-4'>
{% if roles.stock.view %}
{% include "InvenTree/low_stock.html" with collapse_id="order" %}
{% include "InvenTree/expired_stock.html" with collapse_id="expired" %}
{% include "InvenTree/required_stock_build.html" with collapse_id="stock_to_build" %}
{% endif %}
</div>
<div class='col-sm-4'>
{% if roles.purchase_order.view %}
{% include "InvenTree/po_outstanding.html" with collapse_id="po_outstanding" %}
{% endif %}
@ -83,6 +86,14 @@ loadBuildTable("#build-overdue-table", {
disableFilters: true,
});
loadStockTable($("#expired-stock-table"), {
params: {
expired: true,
location_detail: true,
part_detail: true,
},
});
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
params: {
low_stock: true,
@ -151,6 +162,12 @@ $("#build-overdue-table").on('load-success.bs.table', function() {
$("#build-overdue-count").html(count);
});
$("#expired-stock-table").on('load-success.bs.table', function() {
var count = $("#expired-stock-table").bootstrapTable('getData').length;
$("#expired-stock-count").html(count);
});
$("#low-stock-table").on('load-success.bs.table', function() {
var count = $("#low-stock-table").bootstrapTable('getData').length;

View File

@ -1,6 +1,6 @@
{% block collapse_preamble %}
{% endblock %}
<div class='panel-group'>
<div class='panel-group panel-index'>
<div class='panel panel-default'>
<div {% block collapse_panel_setup %}class='panel panel-heading'{% endblock %}>
<div class='panel-title'>