From 466b7308d34267015299fac01d8c0fc252eda7c0 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 2 Apr 2025 09:56:54 +0000 Subject: [PATCH] Bug 38159: Add count to todays/previous checkouts To test: 1. APPLY Patch 2. Make some checkouts. 3. Change some of the checkouts to have an older issuedate. 4. When you open the checkouts tables you should see something like Today's checkouts (2) and Previous checkouts (1). --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index f11f755964a..556483cfe78 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -657,13 +657,35 @@ function LoadIssuesTable() { dataSrc: "issued_today", startRender: function (rows, group) { if (group) { - return __("Today's checkouts"); + return ( + "" + + __("Today's checkouts") + + " ()" + ); } else { - return __("Previous checkouts"); + return ( + "" + + __("Previous checkouts") + + " ()" + ); } }, }, initComplete: function (oSettings, json) { + let todaysIssuesCount = 0; + let previousIssuesCount = 0; + + json.aaData.forEach(function (issue) { + if (issue.issued_today) { + todaysIssuesCount++; + } else { + previousIssuesCount++; + } + }); + + $(".previous_count").text(previousIssuesCount); + $(".today_count").text(todaysIssuesCount); + CheckRenewCheckinBoxes(); // Build a summary of checkouts grouped by itemtype -- 2.39.5