From 38d33a3f5f68e1e3d92118d28ad897fd9218c5c1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 16 Mar 2022 23:48:49 +1100 Subject: [PATCH] Display a message if scheduling information is unavailable for a given part --- InvenTree/templates/js/translated/part.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index ca063b3f9b..dcdd3da7d6 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -2028,6 +2028,22 @@ function loadPartSchedulingChart(canvas_id, part_id) { } ); + // If no scheduling information is available for the part, + // remove the chart and display a message instead + if (stock_schedule.length <= 1) { + + var message = ` +
+ {% trans "No scheduling information available for this part" %}.
+
`; + + var canvas_element = $('#part-schedule-chart'); + + canvas_element.closest('div').html(message); + + return; + } + // Iterate through future "events" to calculate expected quantity var quantity = part_info.in_stock;