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