Koha/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
Owen Leonard 09f011493c Bug 28949: Use Flatpickr on reports pages
This patch replaces the use of jQueryUI's datepicker on reports pages.

To test, apply the patch and test the following reports pages to confirm
that datepickers work correctly. "Linked" date fields should prevent a
"to" selection which preceeds the selected "from" date.

- Acquisitions statistic wizard: Linked pairs of fields for
  "placed on" and "received on."
- Patrons with the most checkouts: Linked pairs of fields for
  "Checkout date from" and "Check-in date from"
- Patrons who haven't checked out: "Not checked out since"
  field.
- Cash register statistics wizard: Linked "From" and "To"
  fields.
- Most-circulated items: Linked pairs of fields for
  "Checkout date from" and "Check-in date from"
- Catalog statistics wizard: Linked pairs of fields for "Date acquired
  (item)" and "Date deleted (item)" The latter is shown by checking the
  "Count deleted items" radio button.
- View dictionary -> New definition:
  - Enter a definition name
  - Select table Circulation
  - Choose a date column, e.g. "Date of birth" or "Registration date"
  - Select "Date range"
    - Test that the "Start of date range" and "End of date range" fields
      are linked correctly.
- Create guided report:
  - Module: catalog
  - Type: Tabular
  - Select columns (any)
  - Select criteria to limit on: There should be three pairs of linked
    fields, "Creation date," "Modification date," and "Due date."
  - Confirm that the report is saved correctly with the dates you chose.
- Create from SQL -> Test a report with one or more date
  fields, e.g. https://wiki.koha-community.org/wiki/SQL_Reports_Library#Items_added_by_Collection
- Average loan time: Linke pairs of fields for "Checkout
  date" and "Returns."
- Reports -> Circulation statistics wizard: Linked "Period" fields.
- Reports -> Holds statistics wizard: Linked pairs of fields "Hold
  date," "Notification date," "Reminder date," "Waiting date," and
  "Cancellation date."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-05 10:58:13 +02:00

406 lines
18 KiB
Text

[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Holds statistics[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
.sql {display:none;}
</style>
</head>
<body id="rep_reserve_stats" class="rep">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
</li>
[% IF ( do_it ) %]
<li>
<a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds statistics</a>
</li>
<li>
<a href="#" aria-current="page">
Results
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Holds statistics
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF ( do_it ) %]
[% IF ( mainloop ) %]
<h1>Holds statistics</h1>
[% IF ( loopfilter ) %]
<p>Filtered on:</p>
<ul>
[% FOREACH loopfilte IN loopfilter %]
[% IF ( loopfilte.err ) %]<li class="error">Error:
[% ELSIF ( loopfilte.sql ) %]<li class="sql">
[% ELSE %]<li>
[% END %]
[% loopfilte.crit | html %] [% loopfilte.filter | html %]
</li>
[% END %]
</ul>
[% END %]
[% FOREACH mainloo IN mainloop %]
<table>
<tr>
<th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
[% FOREACH loopco IN mainloo.loopcol %]
<th>[% loopco.coltitle_display | html %]</th>
[% END %]
<th>TOTAL</th>
</tr>
[% FOREACH loopro IN mainloo.looprow %]
<tr>
<td>[% loopro.rowtitle_display or "UNKNOWN VALUE" | html %]</td>
[% FOREACH loopcel IN loopro.loopcell %]
<td align="center">
[% IF ( loopcel.url_complement ) %]<a href="reserves_stats.pl?output=[% loopcel.output | uri %]&amp;[% loopcel.url_complement | uri %]">[% loopcel.value | html %]</a>[% ELSE %][% loopcel.value | html %][% END %]
</td>
[% END %]
<td align="center">[% loopro.totalrow | html %]</td>
</tr>
[% END %]
<tr>
<th>TOTAL</th>
[% FOREACH loopfoote IN mainloo.loopfooter %]
<th>[% loopfoote.totalcol | html %]</th>
[% END %]
<th>[% mainloo.total | html %]</th>
</tr>
</table>
[% END %]
[% END %]
[% ELSE %]
<form method="post" action="/cgi-bin/koha/reports/reserves_stats.pl">
<fieldset class="rows">
<legend>Holds statistics</legend><table>
<thead>
<tr>
<th>Title</th>
<th>Row</th>
<th>Column</th>
<th>Filter</th>
</tr>
</thead>
<tbody>
<tr >
<td>Hold status </td>
<td><input type="radio" name="Line" value="reservestatus" /></td>
<td><input type="radio" name="Column" value="reservestatus" checked="checked" /></td>
<td>
<input type="checkbox" name="filter_reservestatus_or_1" value="1" /> Asked
<input type="checkbox" name="filter_reservestatus_or_2" value="2" /> Processing
<input type="checkbox" name="filter_reservestatus_or_3" value="3" /> Waiting
<input type="checkbox" name="filter_reservestatus_or_4" value="4" /> Satisfied
<input type="checkbox" name="filter_reservestatus_or_5" value="5" /> Cancelled
</td>
</tr>
<tr>
<td>Hold date</td>
<td><input type="radio" name="Line" value="reservedate" /></td>
<td><input type="radio" name="Column" value="reservedate" /></td>
<td>
<label for="filter_reservedate_begin">From</label>
<input type="text" size="10" id="filter_reservedate_begin" name="filter_reservedate_begin" />
<label for="filter_reservedate_end">To</label>
<input size="10" id="filter_reservedate_end" name="filter_reservedate_end" value="" type="text" />
</td>
</tr>
<tr>
<td>Notification date</td>
<td><input type="radio" name="Line" value="notificationdate" /></td>
<td><input type="radio" name="Column" value="notificationdate" /></td>
<td>
<label for="filter_notificationdate_begin">From</label>
<input type="text" size="10" id="filter_notificationdate_begin" name="filter_notificationdate_begin" />
<label for="filter_notificationdate_end">To</label>
<input size="10" id="filter_notificationdate_end" name="filter_notificationdate_end" value="" type="text" />
</td>
</tr>
<tr>
<td>Reminder date</td>
<td><input type="radio" name="Line" value="reminderdate" /></td>
<td><input type="radio" name="Column" value="reminderdate" /></td>
<td>
<label for="filter_reminderdate_begin">From</label>
<input type="text" size="10" id="filter_reminderdate_begin" name="Filter" />
<label for="filter_reminderdate_end">To</label>
<input size="10" id="filter_reminderdate_end" name="filter_reminderdate_end" value="" type="text" />
</td>
</tr>
<tr>
<td>Waiting date</td>
<td><input type="radio" name="Line" value="waitingdate" /></td>
<td><input type="radio" name="Column" value="waitingdate" /></td>
<td>
<label for="filter_waitingdate_begin">From</label>
<input type="text" size="10" id="filter_waitingdate_begin" name="filter_waitingdate_begin" />
<label for="filter_waitingdate_end">To</label>
<input size="10" id="filter_waitingdate_end" name="filter_waitingdate_end" value="" type="text" />
</td>
</tr>
<tr>
<td>Cancellation date</td>
<td><input type="radio" name="Line" value="cancellationdate" /></td>
<td><input type="radio" name="Column" value="cancellationdate" /></td>
<td>
<label for="filter_cancellationdate_begin">From</label>
<input type="text" size="10" id="filter_cancellationdate_begin" name="filter_cancellationdate_begin" />
<label for="filter_cancellationdate_end">To</label>
<input size="10" id="filter_cancellationdate_end" name="filter_cancellationdate_end" value="" type="text" />
</td>
</tr>
<tr>
<td>Patron category</td>
<td><input type="radio" name="Line" value="borrowers.categorycode" /></td>
<td><input type="radio" name="Column" value="borrowers.categorycode" /></td>
<td><select name="filter_categorycode" id="borcat">
<option value=""> </option>
[% FOREACH categoryloo IN categoryloop %]
<option value="[% categoryloo.categorycode | html %]">[% categoryloo.description | html %]</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>Item type</td>
<td><input type="radio" name="Line" value="items.itype" /></td>
<td><input type="radio" name="Column" value="items.itype" /></td>
<td><select name="filter_items.itype" id="itype">
<option value=""> </option>
[% FOREACH itemtype IN itemtypes %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>Pickup library</td>
<td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td>
<td><input type="radio" name="Column" value="reserves.branchcode" /></td>
<td><select name="filter_reserves.branchcode" id="resbranchcode">
<option value=""> </option>
[% PROCESS options_for_libraries libraries => Branches.all() %]
</select>
</td>
</tr>
<tr>
<td>Holding library</td>
<td><input type="radio" name="Line" value="items.holdingbranch" /></td>
<td><input type="radio" name="Column" value="items.holdingbranch" /></td>
<td><select name="filter_items.holdingbranch" id="holdingbranch">
<option value=""> </option>
[% PROCESS options_for_libraries libraries => Branches.all() %]
</select>
</td>
</tr>
<tr>
<td>Home library</td>
<td><input type="radio" name="Line" value="items.homebranch" /></td>
<td><input type="radio" name="Column" value="items.homebranch" /></td>
<td><select name="filter_items.homebranch" id="homebranch">
<option value=""> </option>
[% PROCESS options_for_libraries libraries => Branches.all() %]
</select>
</td>
</tr>
<tr>
<td>Collection</td>
<td><input type="radio" name="Line" value="items.ccode" /></td>
<td><input type="radio" name="Column" value="items.ccode" /></td>
<td><select name="filter_items.ccode" id="ccode">
<option value=""> </option>
[% FOREACH ccodeloo IN ccodeloop %]
[% IF ( ccodeloo.selected ) %] <option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>[% ELSE %]<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>[% END %]
[% END %]
</select>
</td>
</tr>
<tr>
<td>Shelving location</td>
<td><input type="radio" name="Line" value="items.location" /></td>
<td><input type="radio" name="Column" value="items.location" /></td>
<td><select name="filter_items.location" id="location">
<option value=""> </option>
[% FOREACH locationloo IN locationloop %]
[% IF ( locationloo.selected ) %]<option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>[% ELSE %]<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>[% END %]
[% END %]
</select>
</td>
</tr>
<tr>
<td>Item call number</td>
<td></td>
<td></td>
<td>From <input type="text" name="filter_items.itemcallnumber_begin" size="10" /> (inclusive) to <input type="text" name="filter_items.itemcallnumber_endex" size="10" /> (exclusive) </td>
</tr>
[% IF ( hassort1 ) %]
<tr><td>Patron sort 1</td>
<td><input type="radio" name="Line" value="borrowers.sort1" /></td>
<td><input type="radio" name="Column" value="borrowers.sort1" /></td>
<td><select name="filter_borrowers.sort1" id="sort1">
<option value=""> </option>
[% FOREACH Bsort IN Bsort1 %]
[% IF ( Bsort.selected ) %]<option value="[% Bsort.authorised_value | html %]" selected="selected">[% Bsort.lib | html %]</option>[% ELSE %]<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>[% END %]
[% END %]
</select>
</td>
</tr>
[% END %]
[% IF ( hassort2 ) %]
<tr><td>Patron sort 2</td>
<td><input type="radio" name="Line" value="borrowers.sort2" /></td>
<td><input type="radio" name="Column" value="borrowers.sort2" /></td>
<td><select name="filter_borrowers.sort2" id="sort2">
<option value=""> </option>
[% FOREACH Bsort IN Bsort2 %]
[% IF ( Bsort.selected ) %]<option value="[% Bsort.authorised_value | html %]" selected="selected">[% Bsort.lib | html %]</option>[% ELSE %]<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>[% END %]
[% END %]
</select>
</td>
</tr>
[% END %]
</tbody>
</table><br /></fieldset>
<fieldset class="rows"><legend>Cell value </legend><ol><li><label for="cellvalue1">Count holds:</label> <input type="radio" name="Cellvalue" value="1" id="cellvalue1" checked="checked" /> </li>
<li><label for="cellvalue2">Count unique borrowers:</label> <input type="radio" name="Cellvalue" value="2" id="cellvalue2" /> </li><li><label for="cellvalue3">Count unique items:</label> <input type="radio" name="Cellvalue" id="cellvalue3" value="3" /> </li><li><label for="cellvalue4">Count unique bibliographic records:</label> <input type="radio" name="Cellvalue" id="cellvalue4" value="4" /> </li></ol></fieldset>
<fieldset class="rows">
<legend>Output</legend>
<ol>
<li>
<label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
</li>
<li>
<label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
<label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
<label class="inline" for="MIME">Into an application:</label>
<select name="MIME" id="MIME">
[% FOREACH value IN CGIextChoice %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
</select>
<select name="sep" id="sep">
[% FOREACH value IN CGIsepChoice.values.sort() %]
[% IF ( value == CGIsepChoice.default ) %]
<option value="[% value | html %]" selected="selected">[% value | html %]</option>
[% ELSE %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
[% END %]
</select>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<input type="hidden" name="report_name" value="[% report_name | html %]" />
<input type="hidden" name="do_it" value="1" />
</fieldset>
</form>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'reports-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
var filter_reservedate_begin = $("#filter_reservedate_begin").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
filter_reservedate_end.set('minDate', selectedDates[0]);
}
});
var filter_reservedate_end = $("#filter_reservedate_end").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
var filter_notificationdate_begin = $("#filter_notificationdate_begin").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
filter_notificationdate_end.set('minDate', selectedDates[0]);
}
});
var filter_notificationdate_end = $("#filter_notificationdate_end").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
var filter_reminderdate_begin = $("#filter_reminderdate_begin").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
filter_reminderdate_end.set('minDate', selectedDates[0]);
}
});
var filter_reminderdate_end = $("#filter_reminderdate_end").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
var filter_waitingdate_begin = $("#filter_waitingdate_begin").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
filter_waitingdate_end.set('minDate', selectedDates[0]);
}
});
var filter_waitingdate_end = $("#filter_waitingdate_end").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
var filter_cancellationdate_begin = $("#filter_cancellationdate_begin").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
filter_cancellationdate_end.set('minDate', selectedDates[0]);
}
});
var filter_cancellationdate_end = $("#filter_cancellationdate_end").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]