Bug 19700: Move template JavaScript to the footer: Some circulation pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / pendingreserves.tt
1 [% USE KohaDates %]
2 [% USE ColumnsSettings %]
3 [% USE AuthorisedValues %]
4 [%- USE Branches -%]
5 [%- USE ItemTypes -%]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Circulation &rsaquo; Holds to pull</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11 </head>
12
13 <body id="circ_pendingreserves" class="circ">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'circ-search.inc' %]
16
17
18 <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; Holds to pull</div>
19
20 <div id="doc3" class="yui-t2">
21
22    <div id="bd">
23     <div id="yui-main">
24     <div class="yui-b">
25
26 <h2>Holds to pull placed between [% from | $KohaDates %] and [% to | $KohaDates %]</h2>
27 <h3>Reported on [% todaysdate | $KohaDates %]</h3>
28 <p>The following holds have not been filled. Please retrieve them and check them in.</p>
29 <div class="searchresults">
30     [% IF ( reserveloop ) %]
31     <table id="holdst">
32     <thead>
33         <tr>
34         <th>Pull this many items</th>
35         <th>Items available</th>
36         <th>Patrons with holds</th>
37         <th>First patron</td>
38         <th class="anti-the">Title</th>
39         <th class="string-sort">Libraries</th>
40         <th>Available call numbers</th>
41         <th>Available copy numbers</th>
42         <th>Available enumeration</th>
43         <th class="string-sort">Available itypes</th>
44         <th class="string-sort">Available locations</th>
45         <th class="title-string">Earliest hold date</th>
46         </tr>
47     </thead>
48     <tbody>
49         [% FOREACH reserveloo IN reserveloop %]
50         <tr>
51         [% IF ( reserveloo.borrowernumber ) %]
52             <td><p><b>[% reserveloo.pullcount %]</b></p></td>
53             <td>[% reserveloo.count %]</td>
54             <td>[% reserveloo.rcount %]</td>
55             <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber %]">[% reserveloo.firstname %] [%reserveloo.surname %]</a></td>
56             <td>
57             <p>
58                 [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
59                 [% reserveloo.title |html %] [% FOREACH s IN reserveloo.subtitle %] [% s %][% END %]</a></p>
60                 [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author %]</p>[% END %]
61             </td>
62         [% ELSE %]
63             <td>"</td>
64             <td>"</td>
65             <td>"</td>
66             <td>"</td>
67             <td>"</td>
68         [% END %]
69         <td>
70             [% FOREACH holdingbranch IN reserveloo.holdingbranches %]
71                 [% Branches.GetName ( holdingbranch ) %]<br>
72             [% END %]
73         </td>
74         <td><p>[% reserveloo.itemcallnumber %]</p></td>
75         <td><p>[% reserveloo.copyno %]</p></td>
76         <td><p>[% reserveloo.enumchron %]</p></td>
77         <td>
78         [% FOREACH itype IN reserveloo.itypes %]
79             [% ItemTypes.GetDescription( itype ) %]
80         [% END %]
81         </td>
82         <td>
83         [% FOREACH loc IN reserveloo.locations %]
84             [% AuthorisedValues.GetByCode('LOC', loc) %]<br>
85         [% END %]
86         </td>
87         <td>
88             <span title="[% reserveloo.reservedate %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) %]</span>
89         </td>
90         </tr>
91         [% END %]
92     </tbody>
93     <tfoot>
94         <tr>
95         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
96         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
97         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
98         <td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
99         <td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
100         <td id="homebranchfilter"></td>
101         <td><input type="text" class="filter" data-column_num="6" placeholder="Call number" style="width:95%"/></td>
102         <td><input type="text" class="filter" data-column_num="7" placeholder="Available copy" style="width:95%"/></td>
103         <td><input type="text" class="filter" data-column_num="8" placeholder="Available enumeration" style="width:95%"/></td>
104         <td id="itypefilter"></td>
105         <td id="locationfilter"></td>
106         <td></td>
107         </tr>
108     </tfoot>
109     </table>
110     [% ELSE %]
111         <b>No items found.</b>
112     [% END %]
113 </div>
114
115 </div>
116 </div>
117 <div class="yui-b">
118 <div id="filters">
119
120 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
121 <fieldset class="brief">
122 <h4>Refine results</h4>
123 <ol>
124 <li>
125 <label for="from">
126     Start date:
127 </label>
128 <input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
129 </li>
130 <li><label for="to">
131     End date:
132 </label>
133 <input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
134 </li>
135 </ol>
136
137 [% IF ( HoldsToPullEndDate ) %]
138     <p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% HoldsToPullEndDate %] days ahead. Set other date ranges as needed.)</i></p>
139 [% ELSE %]
140     <p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to today. Set other date ranges as needed.)</i></p>
141 [% END %]
142
143 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
144 </fieldset>
145 </form>
146
147 </div>
148 </div>
149 </div>
150
151 [% MACRO jsinclude BLOCK %]
152     [% INCLUDE 'calendar.inc' %]
153     [% INCLUDE 'datatables.inc' %]
154     [% INCLUDE 'columns_settings.inc' %]
155     <script type="text/javascript">
156         $(document).ready(function() {
157           var columns_settings = [% ColumnsSettings.GetColumns('circ', 'holds', 'holds-to-pull', 'json') %];
158           var holdst = KohaTable("#holdst", {
159             "aoColumnDefs": [
160                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
161                 { "sType": "title-string", "aTargets" : [ "title-string" ] },
162                 { "sType": "string", "aTargets": [ "string-sort" ] } //Target columns that use <br> separators and pull-down menus.
163             ],
164             "sPaginationType": "full_numbers"
165           }, columns_settings);
166           holdst.fnAddFilters("filter");
167           [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
168           function separateData ( ColumnData ){
169             var cD = ColumnData;
170             var new_array = new Array();
171             for ( j=0 ; j<cD.length ; j++ ) {
172                 var split_array = cD[j].split(/<br>/gi);
173                 for ( k=0 ; k<split_array.length ; k++ ){
174                     var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
175                     if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
176                         new_array.push(str);
177                     }
178                 }
179             }
180             new_array.sort();
181             return new_array;
182           }
183           [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
184           function createSelect( data ) {
185               data = separateData(data);
186               var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
187               for ( i=0 ; i<len ; i++ ) {
188                   r += '<option value="'+data[i]+'">'+data[i]+'</option>';
189               }
190               return r+'</select>';
191           }
192           $("#homebranchfilter").each( function () {
193               $(this).html( createSelect( holdst.fnGetColumnData(5) ) );
194               $('select', this).change( function () {
195                   var filter_value = $(this).val();
196                   holdst.fnFilter( filter_value, 5, true );
197               });
198           });
199           $("#itypefilter").each( function () {
200               $(this).html( createSelect( holdst.fnGetColumnData(9) ) );
201               $('select', this).change( function () {
202                   holdst.fnFilter( $(this).val(), 9 );
203               });
204           });
205           $("#locationfilter").each( function () {
206               $(this).html( createSelect( holdst.fnGetColumnData(10) ) );
207               $('select', this).change( function () {
208                   holdst.fnFilter( $(this).val(), 10 );
209               });
210           });
211         });
212     </script>
213 [% END %]
214
215 [% INCLUDE 'intranet-bottom.inc' %]