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