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