Bug 23059: reserve_stats.pl: Simplify reservestatus
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / reserves_stats.tt
1 [% USE raw %]
2 [% USE Branches %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7     [% IF ( do_it ) %]
8         [% t("Results") | html %] &rsaquo;
9     [% END %]
10     [% t("Holds statistics") | html %] &rsaquo;
11     [% t("Reports") | html %] &rsaquo;
12     [% t("Koha") | html %]
13 [% END %]</title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 <style>
16         .sql {display:none;}
17 </style>
18 </head>
19
20 [% BLOCK reservestatus %]
21     [% IF field == 'reservestatus' %]
22          [% SWITCH value %]
23              [% CASE 'C'%]Cancelled
24              [% CASE 'F'%]Filled
25              [% CASE 'P'%]Placed
26              [% CASE 'W'%]Waiting
27          [% END %]
28     [% ELSE %]
29         [% value | html %]
30     [% END %]
31 [% END %]
32
33 <body id="rep_reserve_stats" class="rep">
34 [% WRAPPER 'header.inc' %]
35     [% INCLUDE 'cat-search.inc' %]
36 [% END %]
37
38 [% WRAPPER 'sub-header.inc' %]
39     [% WRAPPER breadcrumbs %]
40         [% WRAPPER breadcrumb_item %]
41             <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
42         [% END %]
43         [% IF ( do_it ) %]
44             [% WRAPPER breadcrumb_item %]
45                 <a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds statistics</a>
46             [% END %]
47             [% WRAPPER breadcrumb_item bc_active= 1 %]
48                 <span>Results</span>
49             [% END %]
50         [% ELSE %]
51             [% WRAPPER breadcrumb_item bc_active= 1 %]
52                 <span>Holds statistics</span>
53             [% END %]
54         [% END %]
55     [% END #/ WRAPPER breadcrumbs %]
56 [% END #/ WRAPPER sub-header.inc %]
57
58 <div class="main container-fluid">
59     <div class="row">
60         <div class="col-sm-10 col-sm-push-2">
61             <main>
62
63
64 <h1>Holds statistics</h1>
65 [% IF ( do_it ) %]
66     [% IF ( mainloop ) %]
67         [% IF ( loopfilter ) %]
68             <p>Filtered on:</p>
69             <ul>
70             [% FOREACH loopfilte IN loopfilter %]
71                 [% IF ( loopfilte.err ) %]<li class="error">Error:
72                                 [% ELSIF ( loopfilte.sql ) %]<li class="sql">
73                                 [% ELSE %]<li>
74                                 [% END %]
75                                         [% loopfilte.crit | html %] [% loopfilte.filter | html %]
76                                 </li>
77             [% END %]
78             </ul>
79         [% END %]
80                 
81     [% FOREACH mainloo IN mainloop %]
82         
83         <table> 
84             <tr>
85                 <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
86                 [% FOREACH loopco IN mainloo.loopcol %]
87                     <th>[% PROCESS reservestatus field=mainloo.column value=loopco.coltitle_display %]</th>
88                 [% END %]
89                 <th>TOTAL</th>
90                 </tr>
91                 [% FOREACH loopro IN mainloo.looprow %]
92                     <tr>
93                         <td>[% PROCESS reservestatus field=mainloo.line value=loopro.rowtitle_display %]</td>
94                     [% FOREACH loopcel IN loopro.loopcell %]
95                                                 <td align="center">
96                         [% 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 %]
97                                                 </td>
98                     [% END %]
99                                                 <td align="center">[% loopro.totalrow | html %]</td>
100                     </tr>
101                 [% END %]
102             <tr>
103                 <th>TOTAL</th>
104                 [% FOREACH loopfoote IN mainloo.loopfooter %]
105                 <th>[% loopfoote.totalcol | html %]</th>
106                 [% END %]
107                 <th>[% mainloo.total | html %]</th>
108             </tr>
109         </table>
110     [% END %]
111     [% END %]
112 [% ELSE %]
113
114     <form method="post" action="/cgi-bin/koha/reports/reserves_stats.pl">
115     <fieldset class="rows">
116         <legend>Holds statistics</legend><table>
117         <thead>
118             <tr>
119                 <th>Title</th>
120                 <th>Row</th>
121                 <th>Column</th>
122                 <th>Filter</th>
123             </tr>
124         </thead>
125         <tbody>
126                 <tr >
127                 <td>Hold status </td>
128                 <td><input type="radio" name="Line" value="reservestatus" /></td>
129                 <td><input type="radio" name="Column" value="reservestatus" checked="checked" /></td>
130                 <td>
131                 <input type="checkbox" name="filter_reservestatus_or_C" value="C" /> Cancelled
132                 <input type="checkbox" name="filter_reservestatus_or_F" value="F" /> Filled
133                 <input type="checkbox" name="filter_reservestatus_or_P" value="P" /> Placed
134                 <input type="checkbox" name="filter_reservestatus_or_W" value="W" /> Waiting
135                                 </td>
136              </tr>
137              <tr>
138                 <td>Hold date</td>
139                 <td><input type="radio" name="Line" value="reservedate" /></td>
140                 <td><input type="radio" name="Column" value="reservedate" /></td>
141                 <td>
142                     <label for="filter_reservedate_begin">From</label>
143                     <input type="text" size="10" id="filter_reservedate_begin" data-date_to="filter_reservedate_end" name="filter_reservedate_begin" class="flatpickr" />
144
145                     <label for="filter_reservedate_end">To</label>
146                     <input size="10" id="filter_reservedate_end" name="filter_reservedate_end" value="" type="text" class="flatpickr" />
147                 </td>
148             </tr>
149             <tr>
150                 <td>Notification date</td>
151                 <td><input type="radio" name="Line" value="notificationdate" /></td>
152                 <td><input type="radio" name="Column" value="notificationdate" /></td>
153                 <td>
154                     <label for="filter_notificationdate_begin">From</label>
155                     <input type="text" size="10" id="filter_notificationdate_begin" name="filter_notificationdate_begin" data-date_to="filter_notificationdate_end" class="flatpickr" />
156
157                     <label for="filter_notificationdate_end">To</label>
158                     <input  size="10" id="filter_notificationdate_end" name="filter_notificationdate_end" value="" type="text" class="flatpickr" />
159                 </td>
160              </tr>
161             <tr>
162                 <td>Reminder date</td>
163                 <td><input type="radio" name="Line" value="reminderdate" /></td>
164                 <td><input type="radio" name="Column" value="reminderdate" /></td>
165                 <td>
166                     <label for="filter_reminderdate_begin">From</label>
167                     <input type="text" size="10" id="filter_reminderdate_begin" name="Filter" data-date_to="filter_reminderdate_end" class="flatpickr" />
168
169                     <label for="filter_reminderdate_end">To</label>
170                     <input size="10" id="filter_reminderdate_end" name="filter_reminderdate_end" value="" type="text" class="flatpickr" />
171                 </td>
172              </tr>
173             <tr>
174                 <td>Waiting date</td>
175                 <td><input type="radio" name="Line" value="waitingdate" /></td>
176                 <td><input type="radio" name="Column" value="waitingdate" /></td>
177                 <td>
178                     <label for="filter_waitingdate_begin">From</label>
179                     <input type="text" size="10" id="filter_waitingdate_begin" name="filter_waitingdate_begin" data-date_to="filter_waitingdate_end" class="flatpickr" />
180
181                     <label for="filter_waitingdate_end">To</label>
182                     <input  size="10" id="filter_waitingdate_end" name="filter_waitingdate_end" value="" type="text" class="flatpickr" />
183                 </td>
184              </tr>
185                          <tr>
186                 <td>Cancellation date</td>
187                 <td><input type="radio" name="Line" value="cancellationdate" /></td>
188                 <td><input type="radio" name="Column" value="cancellationdate" /></td>
189                 <td>
190                     <label for="filter_cancellationdate_begin">From</label>
191                     <input type="text" size="10" id="filter_cancellationdate_begin" name="filter_cancellationdate_begin" data-date_to="filter_cancellationdate_end" class="flatpickr" />
192
193                     <label for="filter_cancellationdate_end">To</label>
194                     <input  size="10" id="filter_cancellationdate_end" name="filter_cancellationdate_end" value="" type="text" class="flatpickr" />
195                 </td>
196              </tr>
197         <tr>
198             <td>Patron category</td>
199             <td><input type="radio" name="Line" value="borrowers.categorycode" /></td>
200             <td><input type="radio" name="Column" value="borrowers.categorycode" /></td>
201            <td><select name="filter_categorycode" id="borcat">
202                <option value=""> </option>
203                [% FOREACH categoryloo IN categoryloop %]
204                  <option value="[% categoryloo.categorycode | html %]">[% categoryloo.description | html %]</option>
205                [% END %]
206                </select>
207              </td> 
208         </tr>
209         <tr>
210             <td>Item type</td>
211             <td><input type="radio" name="Line" value="items.itype" /></td>
212             <td><input type="radio" name="Column" value="items.itype" /></td>
213            <td><select name="filter_items.itype" id="itype">
214                <option value=""> </option>
215                [% FOREACH itemtype IN itemtypes %]
216                  <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
217                [% END %]
218                </select>
219              </td> 
220         </tr>
221         <tr>
222             <td>Pickup library</td>
223             <td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td>
224             <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
225             <td><select name="filter_reserves.branchcode" id="resbranchcode">
226                <option value=""> </option>
227                 [% PROCESS options_for_libraries libraries => Branches.all() %]
228                </select>
229              </td> 
230         </tr>
231         <tr>
232             <td>Holding library</td>
233             <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
234             <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
235             <td><select name="filter_items.holdingbranch" id="holdingbranch">
236                <option value=""> </option>
237                 [% PROCESS options_for_libraries libraries => Branches.all() %]
238                </select>
239              </td> 
240         </tr>
241         <tr>
242             <td>Home library</td>
243             <td><input type="radio" name="Line" value="items.homebranch" /></td>
244             <td><input type="radio" name="Column" value="items.homebranch" /></td>
245             <td><select name="filter_items.homebranch" id="homebranch">
246                 <option value=""> </option>
247                 [% PROCESS options_for_libraries libraries => Branches.all() %]
248                </select>
249              </td> 
250         </tr>
251         <tr>
252             <td>Collection</td>
253             <td><input type="radio" name="Line"   value="items.ccode" /></td>
254             <td><input type="radio" name="Column" value="items.ccode" /></td>
255             <td><select name="filter_items.ccode" id="ccode">
256                 <option value=""> </option>
257                 [% FOREACH ccodeloo IN ccodeloop %]
258                                         [% 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 %]
259                 [% END %]
260                 </select>
261             </td>
262         </tr>
263         <tr>
264             <td>Shelving location</td>
265             <td><input type="radio" name="Line" value="items.location" /></td>
266             <td><input type="radio" name="Column" value="items.location" /></td>
267             <td><select name="filter_items.location" id="location">
268                 <option value=""> </option>
269                 [% FOREACH locationloo IN locationloop %]
270                                         [% 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 %]
271                                 [% END %]
272                </select>
273             </td> 
274         </tr>
275         <tr>
276             <td>Item call number</td>
277             <td></td>
278             <td></td>
279             <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>
280         </tr>
281         [% IF ( hassort1 ) %]
282         <tr><td>Patron sort 1</td>
283                         <td><input type="radio" name="Line" value="borrowers.sort1" /></td>
284                         <td><input type="radio" name="Column" value="borrowers.sort1" /></td>
285                         <td><select name="filter_borrowers.sort1" id="sort1">
286                <option value=""> </option>
287                [% FOREACH Bsort IN Bsort1 %]
288                            [% 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 %]
289                [% END %]
290                </select>
291             </td> 
292         </tr>
293         [% END %]
294         [% IF ( hassort2 ) %]
295         <tr><td>Patron sort 2</td>
296             <td><input type="radio" name="Line" value="borrowers.sort2" /></td>
297             <td><input type="radio" name="Column" value="borrowers.sort2" /></td>
298                 <td><select name="filter_borrowers.sort2" id="sort2">
299                <option value=""> </option>
300                [% FOREACH Bsort IN Bsort2 %]
301                            [% 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 %]
302                [% END %]
303                </select>
304             </td> 
305         </tr>
306         [% END %]
307         </tbody>
308     </table><br /></fieldset>
309
310 <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>
311             <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>
312                         
313         <fieldset class="rows">
314         <legend>Output</legend>
315     <ol>
316         <li>
317             <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
318         </li>
319         <li>
320             <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
321             <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
322             <label class="inline" for="MIME">Into an application:</label>
323             <select name="MIME" id="MIME">
324             [% FOREACH value IN CGIextChoice %]
325                 <option value="[% value | html %]">[% value | html %]</option>
326             [% END %]
327             </select>
328             <select name="sep" id="sep">
329             [% FOREACH value IN CGIsepChoice.values.sort() %]
330               [% IF ( value == CGIsepChoice.default ) %]
331                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
332               [% ELSE %]
333                 <option value="[% value | html %]">[% value | html %]</option>
334               [% END %]
335             [% END %]
336             </select>
337         </li>
338     </ol>
339         </fieldset>
340
341         <fieldset class="action">
342     <input type="submit" class="btn btn-primary" value="Submit" />
343         <input type="hidden" name="report_name" value="[% report_name | html %]" />
344         <input type="hidden" name="do_it" value="1" />
345         </fieldset>
346         </form>
347 [% END %]
348
349             </main>
350         </div> <!-- /.col-sm-10.col-sm-push-2 -->
351
352         <div class="col-sm-2 col-sm-pull-10">
353             <aside>
354                 [% INCLUDE 'reports-menu.inc' %]
355             </aside>
356         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
357      </div> <!-- /.row -->
358
359 [% MACRO jsinclude BLOCK %]
360     [% INCLUDE 'calendar.inc' %]
361
362     <script>
363         $(document).ready(function () {
364             // Undo the selection that Branches.all made, since there may be no item with homebranch or holdingbranch
365             $('#holdingbranch option').prop('selected', false);
366             $('#homebranch option').prop('selected', false);
367         });
368     </script>
369 [% END %]
370
371 [% INCLUDE 'intranet-bottom.inc' %]