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