Bug 12107 - Move checkboxes jQuery plugin outside of language-specific directory
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / lateorders.tt
1 [% USE KohaDates %]
2 [% USE Branches %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Acquisitions &rsaquo; Late orders</title>
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 [% INCLUDE 'calendar.inc' %]
10 <script type="text/javascript">
11 //<![CDATA[
12 [% IF (dateformat == 'metric') %]
13     dt_add_type_uk_date();
14 [% END %]
15
16 var late_orderst;
17 function check_uncheck() {
18     var all_nodes = $(late_orderst.fnGetNodes());
19     if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
20         var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
21         $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").attr('disabled', 'disabled');
22     } else {
23         $("input:checkbox[name=ordernumber]").removeAttr('disabled');
24     }
25 }
26
27 $(document).ready(function() {
28
29     late_orderst = $("#late_orders").dataTable($.extend(true, {}, dataTablesDefaults, {
30         "aoColumnDefs": [
31             { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
32         ],
33         "sPaginationType": "four_button",
34         "bAutoWidth": false,
35         "fnDrawCallback": function() {
36             if ( typeof late_orderst != 'undefined' ) {
37                 check_uncheck();
38                 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
39             };
40         }
41     } ) );
42     $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
43     $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
44     $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
45
46     // Generates a dynamic link for exporting the selection's data as CSV
47     $("#ExportSelected").click(function() {
48         var all_nodes = $(late_orderst.fnGetNodes());
49         var selected = $(all_nodes).find("input[name='ordernumber']:checked");
50
51         if (selected.length == 0) {
52             alert(_("Please select at least one item to export."));
53             return false;
54         }
55
56         // Building the url from currently checked boxes
57         var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
58         for (var i = 0; i < selected.length; i++) {
59             url += '&amp;ordernumber=' + selected[i].value;
60         }
61         // And redirecting to the CSV page
62         location.href = url;
63         return false;
64     });
65 });
66 //]]>
67 </script>
68 </head>
69 <body id="acq_lateorders" class="acq">
70 [% INCLUDE 'header.inc' %]
71 [% INCLUDE 'acquisitions-search.inc' %]
72
73 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="lateorders.pl">Late orders</a></div>
74
75 <div id="doc3" class="yui-t2">
76    
77    <div id="bd">
78         <div id="yui-main">
79         <div class="yui-b">
80         
81 <h1>[% IF ( Supplier ) %][% Supplier %] : [% END %]Late orders</h1>
82 <div id="acqui_lateorders">
83
84 [% IF error_claim %]
85     [% IF ( error_claim == "no_email" ) %]
86         <div class="error">This vendor has no email</div>
87     [% ELSE %]
88         <div class="error">[% error_claim %]</div>
89     [% END %]
90 [% END %]
91 [% IF info_claim %]
92     <div class="dialog message">Email has been sent.</div>
93 [% END %]
94 [% IF ( lateorders ) %]
95 <form action="lateorders.pl" name="claim" method="post">
96   <input type="hidden" name="op" value="send_alert" />
97   <input type="hidden" name="delay" value="[% delay %]" />
98   <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
99         [% IF ( letters ) %]
100         <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
101           [% FOREACH letter IN letters %]
102                 <option value="[% letter.code %]">[% letter.name %]</option>
103           [% END %]
104           </select>
105         </p>
106         [% END %]
107     <table id="late_orders">
108       <thead>
109         <tr>
110             [% IF Supplier %]
111                 <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
112             [% ELSE %]
113                 <th></th>
114             [% END %]
115             <th>Order date</th>
116             <th>Estimated delivery date</th>
117             <th>Vendor</th>
118             <th>Information</th>
119             <th>Total cost</th>
120             <th>Basket</th>
121             <th>Basket group</th>
122             <th>Library</th>
123             <th>Fund</th>
124             <th>Claims count</th>
125             <th>Claimed date</th>
126         </tr>
127       </thead>
128       <tbody>
129       [% FOREACH lateorder IN lateorders %]
130         [% UNLESS ( loop.odd ) %]<tr class="highlight">
131         [% ELSE %]<tr>[% END %]
132             <td>
133                 <input type="checkbox" value="[% lateorder.ordernumber %]" data-booksellerid="[% lateorder.supplierid %]" name="ordernumber">
134             </td>
135             <td>
136                 [% lateorder.orderdate %]
137                 ([% lateorder.latesince %] days)
138             </td>
139             <td>
140                 [% IF ( lateorder.estimateddeliverydate ) %]
141                     [% lateorder.estimateddeliverydate | $KohaDates  %]
142                 [% END %]
143             </td>
144             <td>
145                 [% lateorder.supplier %]
146                 ([% lateorder.supplierid %])
147             </td>
148             <td>
149                 <b>[% lateorder.title |html %]</b>
150                    [% IF ( lateorder.author ) %]<br/><i>Author:</i> [% lateorder.author %][% END %]
151                    [% IF ( lateorder.publisher ) %]
152                         <br/><i>Published by:</i> [% lateorder.publisher %]
153                         [% IF ( lateorder.publicationyear ) %]
154                             <i> in </i>[% lateorder.publicationyear %]
155                         [% END %]
156                    [% END %]
157             </td>
158             <td>
159                    [% lateorder.unitpricesupplier %]x[% lateorder.quantity %] = 
160                    [% lateorder.subtotal %]
161             </td>
162             <td>
163                 [% IF ( CAN_user_acquisition_order_manage ) %]
164                     <a href="basket.pl?basketno=[% lateorder.basketno %]" title="basket">[% lateorder.basketname %] ([% lateorder.basketno %])</a>
165                 [% ELSE %]
166                     [% lateorder.basketname %] ([% lateorder.basketno %])
167                 [% END %]
168             </td>
169             <td>
170                 [% IF ( lateorder.basketgroupid ) %]
171                     [% IF ( CAN_user_acquisition_group_manage ) %]
172                         <a href="basketgroup.pl?op=add&booksellerid=[% lateorder.supplierid %]&basketgroupid=[% lateorder.basketgroupid %]" title="basketgroup">[% lateorder.basketgroupname %] ([% lateorder.basketgroupid %])</a>
173                     [% ELSE %]
174                         [% lateorder.basketgroupname %] ([% lateorder.basketgroupid %])</a>
175                     [% END %]
176                 [% END %]
177             </td>
178             <td>[% Branches.GetName( lateorder.branch ) %]
179             </td>
180             <td>[% lateorder.budget %]
181             </td>
182             <td>[% lateorder.claims_count %]</td>
183             <td>[% lateorder.claimed_date %]</td>
184         </tr>
185       [% END %]
186       </tbody>
187       <tfoot>
188         <tr>
189             <th colspan="5">Total</th>
190             <th>[% total %]</th>
191             <th colspan="6">&nbsp;</th>
192         </tr>
193       </tfoot>
194     </table>
195     <div class="spacer"></div>
196
197     <p style="display:block;">
198         <input type="button" value="Export as CSV" id="ExportSelected" />
199         [% UNLESS lateorder.budget_lock %]
200             <input type="submit"  value="Claim order" />
201         [% END %]
202     </p>
203 </form>
204 [% ELSE %]<p>There are no late orders.</p>
205 [% END %]
206 </div>
207 </div>
208 </div>
209 <div class="yui-b">
210 <form action="lateorders.pl" method="get">
211 <fieldset class="brief">
212 <h4>Filter results:</h4>
213 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
214 [% IF ( ERROR_LOO.delay_digits ) %]<p class="error">The number of days ([% ERROR_LOO.bad_delay %]) must be a number between 0 and 999.</p>[% END %]
215 [% END %]
216 <ol>
217     <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay %]" /> days ago</li>
218     <li><label for="from">Estimated delivery date from: </label>
219         <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom %]" class="datepickerfrom" />
220         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
221     </li>
222     <li><label for="to">To: </label>
223         <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto %]" class="datepickerto" />
224         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
225     </li>
226
227         <li><label for="booksellerid">Vendor:</label>
228                 <select id="booksellerid" size="1" tabindex="" name="booksellerid">
229                         <option value=""/>
230                         [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
231                 [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id %]" selected="selected">[% SUPPLIER_LOO.name %]</option>
232                 [% ELSE %]<option value="[% SUPPLIER_LOO.id %]">[% SUPPLIER_LOO.name %]</option>[% END %]
233                 [% END %]
234                 </select>
235 </ol>
236     <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
237 </fieldset>
238     </form>
239 [% INCLUDE 'acquisitions-menu.inc' %]
240 </div>
241 </div>
242 [% INCLUDE 'intranet-bottom.inc' %]