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