Bug 12088: Improve date handling and sorting in holds to pull report
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / pendingreserves.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Circulation &rsaquo; Holds to pull</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'calendar.inc' %]
6 <!-- Plugin datatables -->
7 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8 [% INCLUDE 'datatables.inc' %]
9 <script type="text/JavaScript">
10 //<![CDATA[
11 $(document).ready(function() {
12   var holdst = $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, {
13     "aoColumnDefs": [
14         { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
15         { "sType": "title-string", "aTargets" : [ "title-string" ] },
16         { "sType": "string", "aTargets": [ "string-sort" ] } //Target columns that use <br> separators and pull-down menus.
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 | $KohaDates %]</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 class="anti-the">Title</th>
97         <th class="string-sort">Libraries</th>
98         <th>Available call numbers</th>
99         <th>Available copy numbers</th>
100         <th>Available enumeration</th>
101         <th class="string-sort">Available itypes</th>
102         <th class="string-sort">Available locations</th>
103         <th class="title-string">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 %]</a></p>
117                 [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author %]</p>[% END %]
118             </td>
119         [% ELSE %]
120             <td>"</td>
121             <td>"</td>
122             <td>"</td>
123             <td>"</td>
124         [% END %]
125         <td>[% reserveloo.holdingbranch %]</td>
126         <td><p>[% reserveloo.itemcallnumber %]</p></td>
127         <td><p>[% reserveloo.copyno %]</p></td>
128         <td><p>[% reserveloo.enumchron %]</p></td>
129         <td>[% reserveloo.itype %]</td>
130         <td>[% reserveloo.location %]</td>
131         <td>
132             <span title="[% reserveloo.reservedate %]">[% reserveloo.reservedate | $KohaDates %] in [% reserveloo.branch %]</span>
133             [% IF ( reserveloo.statusw ) %]<p>Waiting</p>[% END %][% IF ( reserveloo.statusf ) %]<p>Fullfilled</p>[% END %]
134         </td>
135         </tr>
136         [% END %]
137     </tbody>
138     <tfoot>
139         <tr>
140         <td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
141         <td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
142         <td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
143         <td><input type="text" class="filter" data-column_num="3" placeholder="Title" style="width:95%"/></td>
144         <td id="homebranchfilter"></td>
145         <td><input type="text" class="filter" data-column_num="5" placeholder="Call number" style="width:95%"/></td>
146         <td><input type="text" class="filter" data-column_num="6" placeholder="Available copy" style="width:95%"/></td>
147         <td><input type="text" class="filter" data-column_num="7" placeholder="Available enumeration" style="width:95%"/></td>
148         <td id="itypefilter"></td>
149         <td id="locationfilter"></td>
150         <td></td>
151         </tr>
152     </tfoot>
153     </table>
154     [% ELSE %]
155         <b>No items found.</b>
156     [% END %]
157 </div>
158 [% END %]
159
160 </div>
161 </div>
162 <div class="yui-b">
163 <div id="filters">
164
165 <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
166 <fieldset class="brief">
167 <h4>Refine results</h4>
168 <ol>
169 <li>
170 <label for="from">
171     Start date:
172 </label>
173 <input type="text" size="10" id="from" name="from" value="[% from %]" class="datepickerfrom" />
174 </li>
175 <li><label for="to">
176     End date:
177 </label>
178 <input type="text" size="10" id="to" name="to" value="[% to %]" class="datepickerto" />
179 </li>
180 </ol>
181 <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>
182 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
183 </fieldset>
184 </form>
185
186 </div>
187 </div>
188 </div>
189 [% INCLUDE 'intranet-bottom.inc' %]