Bug 16785: Remove Autocomplete from overdues report filter
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / overdue.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE KohaDates %]
5 [%- USE Branches -%]
6 [%- USE Price -%]
7 [%- USE ItemTypes -%]
8 [%- USE Categories -%]
9 [%- USE TablesSettings -%]
10 [% SET footerjs = 1 %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate | html %]</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 [% FILTER collapse %]
15     <style>
16         .sql {display:none;}
17         .select2-container--open .select2-dropdown--below,
18         .select2-search.select2-search--dropdown {
19             border: 1px solid #AAA;
20         }
21         .select2-container--open .select2-dropdown--below,
22         .select2-search.select2-search--dropdown,
23         .select2-results {
24             background-color: #FFF;
25             width: 20em !important;
26         }
27     </style>
28 [% END %]
29 </head>
30
31 <body id="circ_overdue" class="circ">
32 [% INCLUDE 'header.inc' %]
33 [% INCLUDE 'circ-search.inc' %]
34
35 <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>
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42 [% IF ( noreport ) %]
43   <h2>Overdue report</h2>
44   <p>Please choose one or more filters to proceed.</p>
45 [% ELSE %]
46
47 [% IF ( overdueloop ) %]
48
49   <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>
50
51   <p>
52     [% IF ( isfiltered ) %]
53         [% SET url_params = '' %]
54         [% FOR var IN filters.keys %]
55             [% url_params = BLOCK %][% url_params | $raw %]&amp;[% var | uri %]=[% filters.$var | uri %][% END %]
56         [% END %]
57       <a href="overdue.pl?op=csv[% url_params | $raw %]">Download file of displayed overdues</a>
58     [% ELSE %]
59       <a href="overdue.pl?op=csv">Download file of all overdues</a>
60     [% END %]
61   </p>
62
63   <div class="sql"><pre>[% sql | html %]</pre></div>
64   <div class="searchresults">
65     <table id="overduest">
66       <thead>
67         <tr>
68           <th class="title-string">Due date</th>
69           <th>Patron</th>
70           <th>Patron category</th>
71           <th>Patron library</th>
72           <th class="anti-the">Title</th>
73           <th>Home library</th>
74           <th>Holding library</th>
75           <th>Barcode</th>
76           <th>Call number</th>
77           <th>Item type</th>
78           <th>Price</th>
79           <th>Non-public note</th>
80         </tr>
81       </thead>
82       [%- BLOCK subject -%]Overdue:[%- END -%]
83       <tbody>
84       [% FOREACH overdueloo IN overdueloop %]
85         <tr>
86           <td><span title="[% overdueloo.duedate | html %]">[% overdueloo.duedate | $KohaDates %]</span></td>
87           <td>
88             [% INCLUDE 'patron-title.inc' patron=overdueloo.patron hide_patron_infos_if_needed=1 %]
89             [% IF logged_in_user.can_see_patron_infos( overdueloo.patron ) %]
90                 [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email | uri %]?subject=[% INCLUDE subject %] [% overdueloo.title | uri %]">email</a>][% END %]
91                 [% IF ( overdueloo.phone ) %]([% overdueloo.phone | html %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile | html %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro | html %])[% END %]</td>
92             [% END %]
93             <td>[% Categories.GetName( overdueloo.patron.categorycode ) | html %]</td>
94             <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td>
95           <td>[% INCLUDE 'biblio-title.inc' biblio=overdueloo link = 1 %] [% IF ( overdueloo.author ) %], by [% overdueloo.author | html %][% END %][% IF ( overdueloo.enumchron ) %], [% overdueloo.enumchron | html %][% END %]</td>
96             <td>[% Branches.GetName( overdueloo.homebranchcode ) | html %]</td>
97             <td>[% Branches.GetName( overdueloo.holdingbranchcode ) | html %]</td>
98           <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% overdueloo.biblionumber | uri %]&amp;itemnumber=[% overdueloo.itemnum | uri %]#item[% overdueloo.itemnum | uri %]">[% overdueloo.barcode | html %]</a></td>
99           <td>[% overdueloo.itemcallnumber | html %]</td>
100             <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
101           <td>[% overdueloo.replacementprice | $Price %]</td>
102           <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
103         </tr>
104       [% END %]
105       </tbody>
106     </table>
107   </div>
108
109 [% ELSE %]
110
111   <h2>Overdue report</h2>
112   [% IF ( isfiltered ) %]
113     <p>There are no overdues matching your search. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a></p>
114   [% ELSE %]
115     <p>There are no overdues.</p>
116   [% END %]
117
118 [% END %]  <!-- overdueloop -->
119 [% END %]  <!-- noreport -->
120
121             </main>
122         </div> <!-- /.col-sm-10.col-sm-push-2 -->
123
124         <div class="col-sm-2 col-sm-pull-10">
125             <aside>
126
127 <form method="post" action="/cgi-bin/koha/circ/overdue.pl">
128   <fieldset class="brief">
129 <h4>Filter on:</h4>
130     <fieldset><legend>Date due:</legend>
131         <ol>
132             <li class="radio">
133                 <label for="showall">Show any items currently checked out:</label>
134                 [% IF ( showall ) %]
135                         <input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
136                 [% ELSE %]
137                     <input type="checkbox" id="showall" name="showall" value="show" />
138                 [% END %]
139             </li>
140
141             <li class="date_due_filter">
142                 <label for="from">From:</label>
143                 <input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | $KohaDates %]" class="datepickerfrom" />
144             </li>
145             <li class="date_due_filter">
146                 <label for="to">To:</label>
147                 <input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | $KohaDates %]" class="datepickerto" />
148             </li>
149         </ol>
150     </fieldset>
151     <ol>
152     <li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% filters.borname | html %]" /></li>
153     <li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
154       [% FOREACH borcatloo IN borcatloop %]
155         [% 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 %]
156       [% END %]
157       </select>
158     </li>
159
160     <li><label>Patron flags:</label>
161         <select name="borflag" size="1" id="borflag">
162             <option value="">None</option>
163             [% IF ( borflag_gonenoaddress ) %]<option value="gonenoaddress" selected="selected">Address in question</option>
164             [% ELSE %]<option value="gonenoaddress">Address in question</option>[% END %]
165             [% IF ( borflag_debarred ) %]<option value="debarred" selected="selected">Restricted</option>
166             [% ELSE %]<option value="debarred">Restricted</option>[% END %]
167             [% IF ( borflag_lost ) %]<option value="lost" selected="selected">Lost card</option>
168             [% ELSE %]<option value="lost">Lost card</option>[% END %]
169         </select>
170     </li>
171         [% FOREACH patron_attr_filter_loo IN patron_attr_filter_loop %]
172                 <!-- domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category -->
173                 <li>
174                         <label>[% patron_attr_filter_loo.description | html %]:</label>
175             [% IF ( patron_attr_filter_loo.authorised_value_category ) %]
176                 [% SET authvals = AuthorisedValues.GetAuthValueDropbox( patron_attr_filter_loo.authorised_value_category ) %]
177                 <select id="pattrodue-input-[% patron_attr_filter_loo.domid | html %]" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" class="pattrodue-input">
178                     <option></option>
179                     [% FOREACH authval IN authvals %]
180                         [% IF ( patron_attr_filter_loo.cgivalue == authval.authorised_value ) -%]
181                             <option value="[% authval.authorised_value | html %]" selected="selected">[% authval.lib | html %]</option>
182                         [% ELSE -%]
183                             <option value="[% authval.authorised_value | html %]">[% authval.lib | html %]</option>
184                         [% END %]
185                     [% END %]
186                 </select>
187                         [% ELSE %]
188                 <input type="text" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"/>
189                         [% END %]
190                         [% IF ( patron_attr_filter_loo.repeatable ) %]
191                 <a href="#" class="btn btn-link clone-attribute" data-original-id="pattrodue-input-[% patron_attr_filter_loo.domid | html %]"><i class="fa fa-plus"></i> Add</a>
192                 [% IF ( patron_attr_filter_loo.isclone ) %]
193                     <a href="#" class="btn btn-link delete_clone"><i class="fa fa-remove"></i> Delete</a>
194                 [% ELSIF ( patron_attr_filter_loo.ismany ) %]
195                     <a href="#" class="btn btn-link delete_clone"><i class="fa fa-remove"></i> Delete</a>
196                 [% ELSE %]
197                     <a href="#" class="btn btn-link delete_clone" style="display:none"><i class="fa fa-remove"></i> Delete</a>
198                 [% END %]
199                         [% END %]
200                 </li>
201         [% END %]
202
203     <li><label>Item type:</label><select name="itemtype" id="itemtype"><option value="">Any</option>
204       [% FOREACH itemtypeloo IN itemtypeloop %][% IF ( itemtypeloo.selected ) %]
205         <option value="[% itemtypeloo.value | html %]" selected="selected">[% itemtypeloo.itemtypename | html %]</option>[% ELSE %]
206         <option value="[% itemtypeloo.value | html %]">[% itemtypeloo.itemtypename | html %]</option>[% END %]
207       [% END %]
208       </select>
209     </li>
210
211     <li>
212         <label>Item home library:</label>
213         <select name="homebranch" id="homebranch">
214             <option value="">Any</option>
215             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %]
216         </select>
217     </li>
218
219     <li>
220         <label>Item holding library:</label>
221         <select name="holdingbranch" id="holdingbranch">
222             <option value="">Any</option>
223             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %]
224         </select>
225     </li>
226
227     <li>
228         <label>Library of the patron:</label>
229         <select name="branch" id="branch">
230             <option value="">Any</option>
231             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %]
232         </select>
233     </li>
234
235 </ol>
236    <fieldset class="action">
237       <input type="submit" value="Apply filter" class="submit" />
238       <input type="hidden" name="op" value="apply filter" />
239    </fieldset>
240    </fieldset>
241   </form>
242
243             </aside>
244         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
245      </div> <!-- /.row -->
246
247 [% MACRO jsinclude BLOCK %]
248     [% INCLUDE 'calendar.inc' %]
249     [% INCLUDE 'datatables.inc' %]
250     [% INCLUDE 'columns_settings.inc' %]
251     [% INCLUDE 'select2.inc' %]
252     <script>
253         function clone_input( node, original_id ) {
254             var original = node;
255             var clone = original.clone();
256             var appendid = original_id + "-" + Math.floor(Math.random()*1000+1);
257             clone.find(".delete_clone").show();
258             if( clone.find("select").length ){
259                 /* <select> element is present */
260                 clone.find("select").removeClass("select2-hidden-accessible").removeAttr("data-select2-id").attr("id", appendid );
261                 clone.find(".select2").remove();
262                 original.after( clone );
263                 $("#" + appendid ).select2();
264             } else {
265                 clone.attr("id", appendid );
266                 original.after( clone );
267             }
268         }
269
270         function update_date_due_filters_visibility(){
271             if( $("#showall").is(":checked")) {
272                 $(".date_due_filter").hide();
273                 $("#from").prop("disabled", true);
274                 $("#to").prop("disabled", true);
275             } else {
276                 $(".date_due_filter").show();
277                 $("#from").prop("disabled", false);
278                 $("#to").prop("disabled", false);
279             }
280         }
281
282         $(document).ready(function(){
283             var columns_settings = [% TablesSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
284             KohaTable("overduest", {
285                 "sPaginationType": "full",
286                 "aaSorting": [[0, 'asc']],
287                 "autoWidth": false,
288                 "stateSave": true
289             }, columns_settings);
290
291             $("#showall").on("change", function(){
292                 update_date_due_filters_visibility();
293             });
294             update_date_due_filters_visibility();
295
296             $(".pattrodue-input").each(function(){
297                 $(this).select2();
298             });
299
300             $("body").on("click", ".delete_clone", function(e){
301                 e.preventDefault();
302                 $(this).parent().remove();
303             });
304
305             $("body").on("click", ".clone-attribute", function(e){
306                 e.preventDefault();
307                 clone_input( $(this).parent(), $(this).data("original-id") );
308             })
309         });
310   </script>
311 [% END %]
312
313 [% INCLUDE 'intranet-bottom.inc' %]