From a8c9374b6747c644687910bc3167c5702e6ec06c Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 11 Oct 2024 20:00:35 +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 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index a27fd722cfb..792ec7dfa9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -431,13 +431,28 @@ 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.2