Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / overdue.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [%- USE Branches -%]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate | html %]</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% Asset.css("css/datatables.css") | $raw %]
10 <style type="text/css">
11     .sql {display:none;}
12 </style>
13 </head>
14
15 <body id="circ_overdue" class="circ">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'circ-search.inc' %]
18
19 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Overdues as of [% todaysdate | html %]</div>
20
21 <div id="doc3" class="yui-t2">
22
23    <div id="bd">
24         <div id="yui-main">
25         <div class="yui-b">
26
27 [% IF ( noreport ) %]
28   <h2>Overdue report</h2>
29   <p>Please choose one or more filters to proceed.</p>
30 [% ELSE %]
31
32 [% IF ( overdueloop ) %]
33
34   <h2>[% nnoverdue | html %] [% IF ( noverdue_is_plural ) %]Items[% ELSE %]Item[% END %] overdue as of [% todaysdate | html %][% IF ( isfiltered ) %] <span style="font-size:70%;">(Filtered. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a>)</span>[% END %]</h2>
35
36   <p>
37     [% IF ( isfiltered ) %]
38       <a href="overdue.pl?op=csv&amp;[% csv_param_string | html %]">Download file of displayed overdues</a>
39     [% ELSE %]
40       <a href="overdue.pl?op=csv">Download file of all overdues</a>
41     [% END %]
42   </p>
43
44   <div class="sql"><pre>[% sql | html %]</pre></div>
45   <div class="searchresults">
46     <table id="overduest">
47       <thead>
48         <tr>
49           <th class="title-string">Due date</th>
50           <th>Patron</th>
51           <th>Library</th>
52           <th>Title</th>
53           <th>Barcode</th>
54           <th>Call number</th>
55           <th>Price</th>
56         </tr>
57       </thead>
58       [%- BLOCK subject -%]Overdue:[%- END -%]
59       <tbody>
60       [% FOREACH overdueloo IN overdueloop %]
61         <tr>
62           <td><span title="[% overdueloo.duedate | html %]">[% overdueloo.duedate | $KohaDates %]</span></td>
63           <td>
64             [% INCLUDE 'patron-title.inc' patron=overdueloo.patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]
65             [% IF logged_in_user.can_see_patron_infos( overdueloo.patron ) %]
66                 [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email | html %]?subject=[% INCLUDE subject %] [% overdueloo.title | html %]">email</a>][% END %]
67                 [% IF ( overdueloo.phone ) %]([% overdueloo.phone | html %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile | html %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro | html %])[% END %]</td>
68             [% END %]
69           <td>[% IF overdueloo.branchcode %][% Branches.GetName( overdueloo.branchcode ) | html %][% END %]</td>
70           <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overdueloo.biblionumber %][% overdueloo.title | html %]  [% overdueloo.subtitle | html %]</a> [% IF ( overdueloo.author ) %], by [% overdueloo.author | html %][% END %][% IF ( overdueloo.enumchron ) %], [% overdueloo.enumchron | html %][% END %]</td>
71           <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% overdueloo.biblionumber | html %]&amp;itemnumber=[% overdueloo.itemnum | html %]#item[% overdueloo.itemnum | html %]">[% overdueloo.barcode | html %]</a></td>
72           <td>[% overdueloo.itemcallnumber | html %]</td>
73           <td>[% overdueloo.replacementprice | html %]</td>
74         </tr>
75       [% END %]
76       </tbody>
77     </table>
78   </div>
79
80 [% ELSE %]
81
82   <h2>Overdue report</h2>
83   [% IF ( isfiltered ) %]
84     <p>There are no overdues matching your search. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a></p>
85   [% ELSE %]
86     <p>There are no overdues.</p>
87   [% END %]
88
89 [% END %]  <!-- overdueloop -->
90 [% END %]  <!-- noreport -->
91
92 </div>
93 </div>
94 <div class="yui-b">
95 <form method="post" action="/cgi-bin/koha/circ/overdue.pl">
96   <fieldset class="brief">
97 <h4>Filter on:</h4>
98         <fieldset><legend>Date due:</legend>
99         <ol>
100     <li><label for="from">From:</label>
101     <input type="text" id="from" name="dateduefrom" size="10" value="[% dateduefrom | $KohaDates %]" class="datepickerfrom" />
102         </li>
103         <li>
104     <label for="to">To:</label>
105     <input type="text" id="to" name="datedueto" size="10" value="[% datedueto | $KohaDates %]" class="datepickerto" />
106     </li>
107     </ol></fieldset>
108     <ol>
109     <li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% borname | html %]" /></li>
110     <li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
111       [% FOREACH borcatloo IN borcatloop %]
112         [% IF ( borcatloo.selected ) %]<option value="[% borcatloo.value | html %]" selected="selected">[% borcatloo.catname | html %]</option>[% ELSE %]<option value="[% borcatloo.value | html %]">[% borcatloo.catname | html %]</option>[% END %]
113       [% END %]
114       </select>
115     </li>
116     <li><label>Patron flags:</label>
117         <select name="borflag" size="1" id="borflag">
118             <option value="">None</option>
119             [% IF ( borflag_gonenoaddress ) %]<option value="gonenoaddress" selected="selected">Address in question</option>
120             [% ELSE %]<option value="gonenoaddress">Address in question</option>[% END %]
121             [% IF ( borflag_debarred ) %]<option value="debarred" selected="selected">Restricted</option>
122             [% ELSE %]<option value="debarred">Restricted</option>[% END %]
123             [% IF ( borflag_lost ) %]<option value="lost" selected="selected">Lost card</option>
124             [% ELSE %]<option value="lost">Lost card</option>[% END %]
125         </select>
126     </li>
127         [% FOREACH patron_attr_filter_loo IN patron_attr_filter_loop %]
128                 <!-- domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category -->
129                 <li>
130                         <label>[% patron_attr_filter_loo.description | html %]:</label>
131             [% IF ( patron_attr_filter_loo.authorised_value_category ) %]
132                 <script type="text/javascript" x-code="[% patron_attr_filter_loo.code | html %]">create_auto_completion_responder([% patron_attr_filter_loo.domid | html %],"[% patron_attr_filter_loo.code | html %]");</script>
133                                 <span id="pattrodue-getready-[% patron_attr_filter_loo.domid | html %]">
134                                                 <div class="pattrodue-autocomplete">
135                             <input autocomplete="off" id="pattrodue-input-[% patron_attr_filter_loo.domid | html %]" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"  class="pattrodue-input" type="text" />
136                                                 </div>
137                                 </span>
138                         [% ELSE %]
139                 <input type="text" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"/>
140                         [% END %]
141                         [% IF ( patron_attr_filter_loo.repeatable ) %]
142                 <a href="#" onclick="clone_parent(this); return false;">Add</a>
143                 [% IF ( patron_attr_filter_loo.isclone ) %]
144                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
145                 [% ELSIF ( patron_attr_filter_loo.ismany ) %]
146                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
147                 [% ELSE %]
148                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: hidden">Delete</a>
149                 [% END %]
150                         [% END %]
151                 </li>
152         [% END %]
153
154     <li><label>Item type:</label><select name="itemtype" id="itemtype"><option value="">Any</option>
155       [% FOREACH itemtypeloo IN itemtypeloop %][% IF ( itemtypeloo.selected ) %]
156         <option value="[% itemtypeloo.value | html %]" selected="selected">[% itemtypeloo.itemtypename | html %]</option>[% ELSE %]
157         <option value="[% itemtypeloo.value | html %]">[% itemtypeloo.itemtypename | html %]</option>[% END %]
158       [% END %]
159       </select>
160     </li>
161
162     <li>
163         <label>Item home library:</label>
164         <select name="homebranch" id="homebranch">
165             <option value="">Any</option>
166             [% PROCESS options_for_libraries libraries => Branches.all( selected => homebranchfilter ) %]
167         </select>
168     </li>
169
170     <li>
171         <label>Item holding library:</label>
172         <select name="holdingbranch" id="holdingbranch">
173             <option value="">Any</option>
174             [% PROCESS options_for_libraries libraries => Branches.all( selected => holdingbranchfilter ) %]
175         </select>
176     </li>
177
178     <li>
179         <label>Library of the patron:</label>
180         <select name="branch" id="branch">
181             <option value="">Any</option>
182             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter, only_from_group => 1 ) %]
183         </select>
184     </li>
185
186 <li class="radio"><label for="showall">Show any items currently checked out:</label>
187         [% IF ( showall ) %]
188             <input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
189     [% ELSE %]
190         <input type="checkbox" id="showall" name="showall" value="show" />
191     [% END %]
192 </li>
193 </ol>
194    <fieldset class="action">
195       <input type="submit" value="Apply filter" class="submit" />
196       <input type="hidden" name="op" value="apply filter" />
197    </fieldset>
198    </fieldset>
199   </form>
200 </div>
201 </div>
202
203 [% MACRO jsinclude BLOCK %]
204     [% INCLUDE 'calendar.inc' %]
205     [% INCLUDE 'datatables.inc' %]
206     <script type="text/javascript">
207         function clone_parent(node) {
208             var parent = node.parentNode;
209             var clone = parent.cloneNode(true);
210             parent.parentNode.insertBefore(clone, parent.nextSibling);
211             $("a", clone).attr("style", "visibility: visible");
212             $("input", clone).attr("value", "");
213
214             var theid = $("span", clone).attr("id") || "";
215             var theid = $("span", clone).attr("id") || "";
216             var parts = theid.match(/^pattrodue-getready-(.*)$/);
217             if (parts && parts.length > 1){
218                 var appendid = "-" + Math.floor(Math.random()*1000+1);
219                 $("span", clone).attr("id",theid+appendid);
220
221                 theid = $("input", clone).attr("id");
222                 $("input", clone).attr("id",theid+appendid);
223
224                 theid = $("div[id]", clone).attr("id");
225                 $("div[id]", clone).attr("id",theid+appendid);
226
227                 var attrcode = $("script", clone).attr("x-code");
228                 var newsuffix = parts[1] + appendid;
229                 create_auto_completion_responder(newsuffix,attrcode);
230             }
231         }
232
233
234         function delete_parent(node) {
235             var parent = node.parentNode;
236             parent.parentNode.removeChild(parent);
237         }
238
239         function create_auto_completion_responder(uniqueid,attrcode) {
240             $("#pattrodue-getready-" + uniqueid).ready(function(){
241                 $( "#pattrodue-input-" + uniqueid ).autocomplete({
242                     source: "/cgi-bin/koha/circ/ypattrodue-attr-search-authvalue.pl/"+attrcode,
243                     select: function( event, ui ) {
244                         $( "#pattrodue-input-"+uniqueid ).val( ui.item.description );
245                         return false;
246                     }
247                 })
248                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
249                     return $( "<li></li>" )
250                     .data( "ui-autocomplete-item", item )
251                     .append( "<a>" + item.description + " (" + item.authorised_value + ")</a>" )
252                     .appendTo( ul )
253                     .css("font-size","90%").css("width","13em");
254                 };
255             });
256         }
257
258         $(document).ready(function(){
259             $("#overduest").dataTable($.extend(true, {}, dataTablesDefaults, {
260                 "sPaginationType": "four_button",
261                 "aaSorting": [[0, 'asc']],
262                 "aoColumnDefs": [
263                     { "sType": "title-string", "aTargets": [ "title-string" ] }
264                 ]
265             }));
266         });
267   </script>
268 [% END %]
269
270 [% INCLUDE 'intranet-bottom.inc' %]