Bug 24958: Remember last selected tab in SQL reports
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / bor_issues_top.tt
1 [% USE Branches %]
2 [% USE KohaDates %]
3 [% USE ItemTypes %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Reports &rsaquo; Patrons with the most checkouts</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="rep_bor_issues_top" class="rep">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
13
14 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> [% IF ( do_it ) %]&rsaquo; <a href="/cgi-bin/koha/reports/bor_issues_top.pl">Patrons with the most checkouts</a> &rsaquo; Results[% ELSE %]&rsaquo; Patrons with the most checkouts[% END %]</div>
15
16 <div class="main container-fluid">
17     <div class="row">
18         <div class="col-sm-10 col-sm-push-2">
19             <main>
20
21 [% IF ( do_it ) %]
22         [% FOREACH mainloo IN mainloop %]
23         <h1>Patrons with the most checkouts</h1>
24                 [% IF ( mainloo.loopfilter ) %]
25             [% IF mainloo.loopfilter.size %]
26                 <p>Filtered on:</p>
27                 <ul>
28                     [% FOREACH loopfilte IN mainloo.loopfilter %]
29                         <li>
30                             [% SWITCH loopfilte.crit -%]
31                                 [% CASE "Issue From" -%]
32                                     Checked out after [% loopfilte.filter | $KohaDates %]
33                                 [% CASE "Issue To" -%]
34                                     Checked out before [% loopfilte.filter | $KohaDates %]
35                                 [% CASE "Return From" -%]
36                                     Checked in after [% loopfilte.filter | $KohaDates %]
37                                 [% CASE "Return To" -%]
38                                     Checked in before [% loopfilte.filter | $KohaDates %]
39                                 [% CASE "Branch" -%]
40                                     Library is [% Branches.GetName( loopfilte.filter ) | html %]
41                                 [% CASE "Doc Type" -%]
42                                     Item type is [% ItemTypes.GetDescription( loopfilte.filter ) | html %]
43                                 [% CASE "Bor Cat" -%]
44                                     Patron category code is [% loopfilte.filter | html %]
45                                 [% CASE "Day" -%]
46                                     Day is [% loopfilte.filter | html %]
47                                 [% CASE "Month" -%]
48                                     Month is [% loopfilte.filter | html %]
49                                 [% CASE "Year" -%]
50                                     Year is [% loopfilte.filter | html %]
51                                 [% CASE # default case -%]
52                                     [% loopfilte.crit | html %] = [% loopfilte.filter | html %]
53                             [% END -%]
54                         </li>
55                     [% END %]
56                 </ul>
57             [% END %]
58                 [% END %]
59                 
60                 <table>
61                         <tr>
62                                 <th rowspan="2">Rank</th>
63                                 [% FOREACH loopco IN mainloo.loopcol %]
64                                         <th colspan="2">[% loopco.coltitle | html %]</th>
65                                 [% END %]
66                         </tr>
67                         <tr>
68                                 [% FOREACH loopco IN mainloo.loopcol %]
69                                         <th>Patron</th>
70                                         <th>Checkout count</th>
71                                 [% END %]
72                         </tr>
73                                 [% FOREACH loopro IN mainloo.looprow %]
74                                 <tr>
75                                         [% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %]
76                                         [% loopro.rowtitle | html %]</td>
77                                         [% FOREACH loopcel IN loopro.loopcell %]
78                                                 [% IF ( loopcel.hilighted ) %]<td>[% ELSE %]<td>[% END %]
79                             [% IF ( loopcel.reference ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopcel.reference | uri %]">[% END %]
80                                                         [% IF ( loopcel.value ) %][% loopcel.value | html %][% END %]
81                                                         [% IF ( loopcel.reference ) %]</a>[% END %]
82                                                 </td>
83                                                 [% IF ( loopcel.hilighted ) %]<td>[% ELSE %]<td>[% END %]
84                                                 [% IF ( loopcel.count ) %][% loopcel.count | html %][% END %]
85                                                 </td>
86                                         [% END %]
87                                 </tr>
88                                 [% END %]
89                 </table>
90         [% END %]
91 [% ELSE %]
92     <h1>Patrons with the most checkouts</h1>
93         <form method="post" action="/cgi-bin/koha/reports/bor_issues_top.pl">
94         <fieldset class="rows">
95         <ol><li><label for="from">Checkout date from:</label> <input type="text" readonly="readonly" size="10" id="from" name="Filter" />
96                                         <label class="inline" for="to">To: </label> <input readonly="readonly" size="10" id="to" name="Filter" value="" type="text" />
97                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
98                                 <li> <label for="fromRO">Check-in date from:</label> <input type="text" readonly="readonly" size="10" id="fromRO" name="Filter" />
99                                         <label class="inline" for="toRO">To: </label> <input type="text" readonly="readonly" size="10" id="toRO" name="Filter" value="" />
100                     <span class="hint">[% INCLUDE 'date-format.inc' %]</span></li>
101                         <li> 
102                                 <label for="branch">Library: </label>
103 <select name="Filter" id="branch"><option value="" > Any library</option>
104     [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
105         <option value="[% l.branchcode | html %]" >[% l.branchname | html %] </option>
106      [% END %] 
107     </select>                   </li>
108                         <li> 
109                 <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
110     [% FOREACH itemtype IN itemtypes %]
111         <option value="[% itemtype.itemtype | html %]" >[% itemtype.translated_description | html %] </option>
112      [% END %] 
113     </select>
114                         </li>
115                         <li> 
116                 <label for="patroncategory">Patron category: </label><select name="Filter" id="patroncategory"><option value="" > Any category code</option>
117     [% FOREACH patron_category IN patron_categories%]
118         <option value="[% patron_category.categorycode | html %]" >[% patron_category.description | html %] </option>
119      [% END %]
120     </select>
121                         </li>
122                 </ol>
123         </fieldset>
124         
125         <fieldset class="rows">
126         <ol>
127                 <li><label for="numlimit">Limit to: </label> <select name="Limit" id="numlimit">
128                                                 <option value ="5" selected="selected"> 5</option>
129                                                 <option value ="10">10</option>
130                                                 <option value ="15">15</option>
131                                                 <option value ="20">20</option>
132                         <option value ="">No limit</option>
133         <!--                                    <option value ="25">25</option>
134                                                 <option value ="40">40</option>
135                                                 <option value ="50">50</option>
136                                                 <option value ="100">100</option>-->
137                                         </select></li>
138                 <li><label for="criteria">By: </label> <select name="Criteria" id="criteria">
139                                                 <option value ="" selected="selected">None</option>
140                                                 <option value ="branchcode">Library</option>
141                         <option value ="categorycode">Category code</option>
142                         <option value ="itemtype">Item type</option>
143                                                 <option value ="Day">Day</option>
144                                                 <option value ="Week">Week</option>
145                                                 <option value ="Month">Month</option>
146                                                 <option value ="Year">Year</option>
147                                         </select></li>
148         </ol>
149         </fieldset>
150
151 <fieldset class="rows">
152         <legend>Output</legend>
153         <ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /></li>
154                 <li><label for="outputfile">To a file: </label><input type="radio" name="output" value="file" id="outputfile" />
155                         <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
156                         <label class="inline" for="MIME">Into an application: </label>
157                         <select name="MIME" id="MIME">
158                         [% FOREACH mimeloo IN mimeloop %]
159                                 <option value="[% mimeloo.type | html %]">[% mimeloo.type | html %]</option>
160                         [% END %]
161                         </select>
162                         <label class="inline" for="sep">Delimiter: </label>
163             <select name="sep" id="sep" size="1">
164             [% FOREACH value IN CGIseplist.values.sort() %]
165               [% IF ( value == CGIseplist.default ) %]
166                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
167               [% ELSE %]
168                 <option value="[% value | html %]">[% value | html %]</option>
169               [% END %]
170             [% END %]
171             </select>
172                 </li>
173         </ol>
174         </fieldset>
175
176         <fieldset class="action">
177         <input type="submit" value="Submit" />
178         <input type="hidden" name="report_name" value="[% report_name | html %]" />
179         <input type="hidden" name="do_it" value="1" />
180         </fieldset>
181         </form>
182 [% END %]
183
184             </main>
185         </div> <!-- /.col-sm-10.col-sm-push-2 -->
186
187         <div class="col-sm-2 col-sm-pull-10">
188             <aside>
189                 [% INCLUDE 'reports-menu.inc' %]
190             </aside>
191         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
192      </div> <!-- /.row -->
193
194 [% MACRO jsinclude BLOCK %]
195     [% INCLUDE 'calendar.inc' %]
196     <script>
197         $(document).ready(function() {
198             // http://jqueryui.com/demos/datepicker/#date-range
199             var dates = $( "#from, #to" ).datepicker({
200                 changeMonth: true,
201                 numberOfMonths: 1,
202                 onSelect: function( selectedDate ) {
203                     var option = this.id == "from" ? "minDate" : "maxDate",
204                         instance = $( this ).data( "datepicker" );
205                         date = $.datepicker.parseDate(
206                             instance.settings.dateFormat ||
207                             $.datepicker._defaults.dateFormat,
208                             selectedDate, instance.settings );
209                     dates.not( this ).datepicker( "option", option, date );
210                 }
211             });
212             var datesRO = $( "#fromRO, #toRO" ).datepicker({
213                 changeMonth: true,
214                 numberOfMonths: 1,
215                 onSelect: function( selectedDate ) {
216                     var option = this.id == "fromRO" ? "minDate" : "maxDate",
217                         instance = $( this ).data( "datepicker" );
218                         date = $.datepicker.parseDate(
219                             instance.settings.dateFormat ||
220                             $.datepicker._defaults.dateFormat,
221                             selectedDate, instance.settings );
222                     datesRO.not( this ).datepicker( "option", option, date );
223                 }
224             });
225         });
226     </script>
227 [% END %]
228
229 [% INCLUDE 'intranet-bottom.inc' %]