Bug 27631: circ folder
[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   <h1>Overdue report</h1>
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 %]
107             [% END %]
108           </td>
109             <td>[% Categories.GetName( overdueloo.patron.categorycode ) | html %]</td>
110             <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td>
111           <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>
112             <td>[% Branches.GetName( overdueloo.homebranchcode ) | html %]</td>
113             <td>[% Branches.GetName( overdueloo.holdingbranchcode ) | html %]</td>
114             <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => overdueloo.location ) | html %]</td>
115           <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>
116           <td>[% overdueloo.itemcallnumber | html %]</td>
117             <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
118           <td>[% overdueloo.replacementprice | $Price %]</td>
119           <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
120         </tr>
121       [% END %]
122       </tbody>
123     </table>
124   </div>
125
126 [% ELSE %]
127
128   <h1>Overdue report</h1>
129   [% IF ( isfiltered ) %]
130     <p>There are no overdues matching your search. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a></p>
131   [% ELSE %]
132     <p>There are no overdues.</p>
133   [% END %]
134
135 [% END %]  <!-- overdueloop -->
136 [% END %]  <!-- noreport -->
137
138             </main>
139         </div> <!-- /.col-sm-10.col-sm-push-2 -->
140
141         <div class="col-sm-2 col-sm-pull-10">
142             <aside>
143
144 <form method="post" action="/cgi-bin/koha/circ/overdue.pl">
145   <fieldset class="brief">
146 <h4>Filter on:</h4>
147     <fieldset><legend>Date due:</legend>
148         <ol>
149             <li class="radio">
150                 <label for="showall">Show any items currently checked out:</label>
151                 [% IF ( showall ) %]
152                         <input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
153                 [% ELSE %]
154                     <input type="checkbox" id="showall" name="showall" value="show" />
155                 [% END %]
156             </li>
157
158             <li class="date_due_filter">
159                 <label for="from">From:</label>
160                 <input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | $KohaDates %]" class="flatpickr" data-date_to="to" />
161             </li>
162             <li class="date_due_filter">
163                 <label for="to">To:</label>
164                 <input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | $KohaDates %]" class="flatpickr" />
165             </li>
166         </ol>
167     </fieldset>
168     <ol>
169     <li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% filters.borname | html %]" /></li>
170     <li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
171       [% FOREACH borcatloo IN borcatloop %]
172         [% 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 %]
173       [% END %]
174       </select>
175     </li>
176
177     <li><label>Patron flags:</label>
178         <select name="borflag" id="borflag">
179             <option value="">None</option>
180             [% IF ( borflag_gonenoaddress ) %]<option value="gonenoaddress" selected="selected">Address in question</option>
181             [% ELSE %]<option value="gonenoaddress">Address in question</option>[% END %]
182             [% IF ( borflag_debarred ) %]<option value="debarred" selected="selected">Restricted</option>
183             [% ELSE %]<option value="debarred">Restricted</option>[% END %]
184             [% IF ( borflag_lost ) %]<option value="lost" selected="selected">Lost card</option>
185             [% ELSE %]<option value="lost">Lost card</option>[% END %]
186         </select>
187     </li>
188         [% FOREACH patron_attr_filter_loo IN patron_attr_filter_loop %]
189                 <!-- domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category -->
190                 <li>
191                         <label>[% patron_attr_filter_loo.description | html %]:</label>
192             [% IF ( patron_attr_filter_loo.authorised_value_category ) %]
193                 [% SET authvals = AuthorisedValues.GetAuthValueDropbox( patron_attr_filter_loo.authorised_value_category ) %]
194                 <select id="pattrodue-input-[% patron_attr_filter_loo.domid | html %]" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" class="pattrodue-input">
195                     <option></option>
196                     [% FOREACH authval IN authvals %]
197                         [% IF ( patron_attr_filter_loo.cgivalue == authval.authorised_value ) -%]
198                             <option value="[% authval.authorised_value | html %]" selected="selected">[% authval.lib | html %]</option>
199                         [% ELSE -%]
200                             <option value="[% authval.authorised_value | html %]">[% authval.lib | html %]</option>
201                         [% END %]
202                     [% END %]
203                 </select>
204                         [% ELSE %]
205                 <input type="text" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"/>
206                         [% END %]
207                         [% IF ( patron_attr_filter_loo.repeatable ) %]
208                 <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>
209                 [% IF ( patron_attr_filter_loo.isclone ) %]
210                     <a href="#" class="btn btn-link delete_clone"><i class="fa fa-remove"></i> Delete</a>
211                 [% ELSIF ( patron_attr_filter_loo.ismany ) %]
212                     <a href="#" class="btn btn-link delete_clone"><i class="fa fa-remove"></i> Delete</a>
213                 [% ELSE %]
214                     <a href="#" class="btn btn-link delete_clone" style="display:none"><i class="fa fa-remove"></i> Delete</a>
215                 [% END %]
216                         [% END %]
217                 </li>
218         [% END %]
219
220     <li><label>Item type:</label><select name="itemtype" id="itemtype"><option value="">Any</option>
221       [% FOREACH itemtypeloo IN itemtypeloop %][% IF ( itemtypeloo.selected ) %]
222         <option value="[% itemtypeloo.value | html %]" selected="selected">[% itemtypeloo.itemtypename | html %]</option>[% ELSE %]
223         <option value="[% itemtypeloo.value | html %]">[% itemtypeloo.itemtypename | html %]</option>[% END %]
224       [% END %]
225       </select>
226     </li>
227
228     <li>
229         <label>Item home library:</label>
230         <select name="homebranch" id="homebranch">
231             <option value="">Any</option>
232             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %]
233         </select>
234     </li>
235
236     <li>
237         <label>Item holding library:</label>
238         <select name="holdingbranch" id="holdingbranch">
239             <option value="">Any</option>
240             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %]
241         </select>
242     </li>
243
244     <li>
245         <label>Library of the patron:</label>
246         <select name="branch" id="branch">
247             <option value="">Any</option>
248             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %]
249         </select>
250     </li>
251
252 </ol>
253    <fieldset class="action">
254       <input type="submit" value="Apply filter" class="submit" />
255       <input type="hidden" name="op" value="apply filter" />
256    </fieldset>
257    </fieldset>
258   </form>
259
260             </aside>
261         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
262      </div> <!-- /.row -->
263
264 [% MACRO jsinclude BLOCK %]
265     [% INCLUDE 'calendar.inc' %]
266     [% INCLUDE 'datatables.inc' %]
267     [% INCLUDE 'columns_settings.inc' %]
268     [% INCLUDE 'select2.inc' %]
269     <script>
270         function clone_input( node, original_id ) {
271             var original = node;
272             var clone = original.clone();
273             var appendid = original_id + "-" + Math.floor(Math.random()*1000+1);
274             clone.find(".delete_clone").show();
275             if( clone.find("select").length ){
276                 /* <select> element is present */
277                 clone.find("select").removeClass("select2-hidden-accessible").removeAttr("data-select2-id").attr("id", appendid );
278                 clone.find(".select2").remove();
279                 original.after( clone );
280                 $("#" + appendid ).select2();
281             } else {
282                 clone.attr("id", appendid );
283                 original.after( clone );
284             }
285         }
286
287         function update_date_due_filters_visibility(){
288             if( $("#showall").is(":checked")) {
289                 $(".date_due_filter").hide();
290                 $("#from").prop("disabled", true);
291                 $("#to").prop("disabled", true);
292             } else {
293                 $(".date_due_filter").show();
294                 $("#from").prop("disabled", false);
295                 $("#to").prop("disabled", false);
296             }
297         }
298
299         $(document).ready(function(){
300             var columns_settings = [% TablesSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
301             KohaTable("overduest", {
302                 "sPaginationType": "full",
303                 "aaSorting": [[0, 'asc']],
304                 "autoWidth": false,
305                 "stateSave": true
306             }, columns_settings);
307
308             $("#showall").on("change", function(){
309                 update_date_due_filters_visibility();
310             });
311             update_date_due_filters_visibility();
312
313             $(".pattrodue-input").each(function(){
314                 $(this).select2();
315             });
316
317             $("body").on("click", ".delete_clone", function(e){
318                 e.preventDefault();
319                 $(this).parent().remove();
320             });
321
322             $("body").on("click", ".clone-attribute", function(e){
323                 e.preventDefault();
324                 clone_input( $(this).parent(), $(this).data("original-id") );
325             })
326         });
327   </script>
328 [% END %]
329
330 [% INCLUDE 'intranet-bottom.inc' %]