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