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