diff --git a/InvenTree/templates/InvenTree/expired_stock.html b/InvenTree/templates/InvenTree/expired_stock.html index 7ecf117fa7..20e2591c16 100644 --- a/InvenTree/templates/InvenTree/expired_stock.html +++ b/InvenTree/templates/InvenTree/expired_stock.html @@ -3,7 +3,7 @@ {% load i18n %} {% block collapse_title %} - + {% trans "Expired Stock" %} {% endblock %} diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html index 9fcb818c7a..d1e10cb00e 100644 --- a/InvenTree/templates/InvenTree/index.html +++ b/InvenTree/templates/InvenTree/index.html @@ -26,6 +26,7 @@ InvenTree | {% trans "Index" %} {% settings_value "STOCK_ENABLE_EXPIRY" as expiry %} {% if expiry %} {% include "InvenTree/expired_stock.html" with collapse_id="expired" %} + {% include "InvenTree/stale_stock.html" with collapse_id="stale" %} {% endif %} {% include "InvenTree/required_stock_build.html" with collapse_id="stock_to_build" %} {% endif %} @@ -98,6 +99,14 @@ loadStockTable($("#expired-stock-table"), { }, }); +loadStockTable($("#stale-stock-table"), { + params: { + stale: true, + location_detail: true, + part_detail: true, + }, +}); + loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", { params: { low_stock: true, @@ -136,70 +145,19 @@ loadSalesOrderTable("#so-overdue-table", { } }); -$("#latest-parts-table").on('load-success.bs.table', function() { - var count = $("#latest-parts-table").bootstrapTable('getData').length; +{% include "InvenTree/index/on_load.html" with label="latest-parts" %} +{% include "InvenTree/index/on_load.html" with label="starred-parts" %} +{% include "InvenTree/index/on_load.html" with label="bom-invalid" %} +{% include "InvenTree/index/on_load.html" with label="build-pending" %} +{% include "InvenTree/index/on_load.html" with label="build-overdue" %} - $("#latest-parts-count").html(count); -}); +{% include "InvenTree/index/on_load.html" with label="expired-stock" %} +{% include "InvenTree/index/on_load.html" with label="stale-stock" %} +{% include "InvenTree/index/on_load.html" with label="low-stock" %} +{% include "InvenTree/index/on_load.html" with label="stock-to-build" %} -$("#starred-parts-table").on('load-success.bs.table', function() { - var count = $("#starred-parts-table").bootstrapTable('getData').length; - - $("#starred-parts-count").html(count); -}); - -$("#bom-invalid-table").on('load-success.bs.table', function() { - var count = $("#bom-invalid-table").bootstrapTable('getData').length; - - $("#bom-invalid-count").html(count); -}); - -$("#build-pending-table").on('load-success.bs.table', function() { - var count = $("#build-pending-table").bootstrapTable('getData').length; - - $("#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); -}); - -$("#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; - - $("#low-stock-count").html(count); -}); - -$("#stock-to-build-table").on('load-success.bs.table', function() { - var count = $("#stock-to-build-table").bootstrapTable('getData').length; - - $("#stock-to-build-count").html(count); -}); - -$("#po-outstanding-table").on('load-success.bs.table', function() { - var count = $("#po-outstanding-table").bootstrapTable('getData').length; - - $("#po-outstanding-count").html(count); -}); - -$("#so-outstanding-table").on('load-success.bs.table', function() { - var count = $("#so-outstanding-table").bootstrapTable('getData').length; - - $("#so-outstanding-count").html(count); -}); - -$("#so-overdue-table").on('load-success.bs.table', function() { - var count = $("#so-overdue-table").bootstrapTable('getData').length; - - $("#so-overdue-count").html(count); -}); +{% include "InvenTree/index/on_load.html" with label="po-outstanding" %} +{% include "InvenTree/index/on_load.html" with label="so-outstanding" %} +{% include "InvenTree/index/on_load.html" with label="so-overdue" %} {% endblock %} \ No newline at end of file diff --git a/InvenTree/templates/InvenTree/index/on_load.html b/InvenTree/templates/InvenTree/index/on_load.html new file mode 100644 index 0000000000..a63479e60d --- /dev/null +++ b/InvenTree/templates/InvenTree/index/on_load.html @@ -0,0 +1,5 @@ +$("#{{ label }}-table").on('load-success.bs.table', function() { + var count = $("#{{ label }}-table").bootstrapTable('getData').length; + + $("#{{ label }}-count").html(count); +}); \ No newline at end of file diff --git a/InvenTree/templates/InvenTree/stale_stock.html b/InvenTree/templates/InvenTree/stale_stock.html new file mode 100644 index 0000000000..3cbb74369c --- /dev/null +++ b/InvenTree/templates/InvenTree/stale_stock.html @@ -0,0 +1,15 @@ +{% extends "collapse_index.html" %} + +{% load i18n %} + +{% block collapse_title %} + +{% trans "Stale Stock" %} +{% endblock %} + +{% block collapse_content %} + +