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