Bug 22007: Remove html filters when KohaDates called with a parameter
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / lateorders.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE ColumnsSettings %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Acquisitions &rsaquo; Late orders</title>
9 [% Asset.css("css/datatables.css") | $raw %]
10 [% INCLUDE 'doc-head-close.inc' %]
11 </head>
12
13 <body id="acq_lateorders" class="acq">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
16
17 <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>
18
19 <div class="main container-fluid">
20     <div class="row">
21         <div class="col-sm-10 col-sm-push-2">
22             <main>
23
24 <h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
25 <div id="acqui_lateorders">
26
27 [% IF error_claim %]
28     [% IF ( error_claim == "no_email" ) %]
29         <div class="dialog alert">This vendor has no email</div>
30     [% ELSIF ( error_claim == "no_order_selected" ) %]
31         <div class="dialog alert">No order selected</div>
32     [% ELSE %]
33         <div class="dialog alert">[% error_claim | html %]</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 | html %]" />
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 | html %]">[% letter.name | html %]</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 | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
78             </td>
79             <td>
80                 <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
81             </td>
82             <td>
83                 [% IF ( lateorder.estimateddeliverydate ) %]
84                     <span title="[% lateorder.estimateddeliverydate | html %]">[% lateorder.estimateddeliverydate | $KohaDates  %]</span>
85                 [% ELSE %]
86                     <span title="0000-00-00"></span>
87                 [% END %]
88             </td>
89             <td>
90                 [% lateorder.supplier | html %]
91                 ([% lateorder.supplierid | html %])
92             </td>
93             <td>
94                 <b>[% lateorder.title | html %]</b>
95                    [% IF ( lateorder.author ) %]<br/><i>Author:</i> [% lateorder.author | html %][% END %]
96                    [% IF ( lateorder.publisher ) %]
97                         <br/><i>Published by:</i> [% lateorder.publisher | html %]
98                         [% IF ( lateorder.publicationyear ) %]
99                             <i> in </i>[% lateorder.publicationyear | html %]
100                         [% END %]
101                    [% END %]
102             </td>
103             <td>
104                    [% lateorder.unitpricesupplier | html %]x[% lateorder.quantity | html %] = 
105                    [% lateorder.subtotal | html %]
106             </td>
107             <td>
108                 [% IF ( CAN_user_acquisition_order_manage ) %]
109                     <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basketname | html %] ([% lateorder.basketno | html %])</a>
110                 [% ELSE %]
111                     [% lateorder.basketname | html %] ([% lateorder.basketno | html %])
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 | uri %]&basketgroupid=[% lateorder.basketgroupid | uri %]" title="basketgroup">[% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
118                     [% ELSE %]
119                         [% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
120                     [% END %]
121                 [% END %]
122             </td>
123             <td>[% Branches.GetName( lateorder.branch ) | html %]
124             </td>
125             <td>[% lateorder.budget | html %]
126             </td>
127             <td>[% lateorder.claims_count | html %]</td>
128             <td>
129                 [% IF ( lateorder.claimed_date ) %]
130                     <span title="[% lateorder.claimed_date | html %]">[% 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 | html %]</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> <!-- /#acqui_lateorders -->
158 </main>
159 </div> <!-- /.col-sm-10.col-sm-push-2 -->
160
161 <div class="col-sm-2 col-sm-pull-10">
162     <aside>
163 <form action="lateorders.pl" method="get">
164 <fieldset class="brief">
165 <h4>Filter results:</h4>
166 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
167 [% 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 %]
168 [% END %]
169 <ol>
170     <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
171     <li><label for="from">Estimated delivery date from: </label>
172         <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
173         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
174     </li>
175     <li><label for="to">To: </label>
176         <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
177         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
178     </li>
179
180         <li><label for="booksellerid">Vendor:</label>
181                 <select id="booksellerid" size="1" tabindex="" name="booksellerid">
182             <option value=""></option>
183                         [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
184                 [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
185                 [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
186                 [% END %]
187                 </select>
188 </ol>
189     <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
190 </fieldset>
191     </form>
192 [% INCLUDE 'acquisitions-menu.inc' %]
193 </aside>
194 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
195 </div>
196
197 [% MACRO jsinclude BLOCK %]
198     [% Asset.js("js/acquisitions-menu.js") | $raw %]
199     [% INCLUDE 'datatables.inc' %]
200     [% INCLUDE 'columns_settings.inc' %]
201     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
202     [% INCLUDE 'calendar.inc' %]
203     <script>
204         var late_orderst;
205         function check_uncheck() {
206             var all_nodes = $(late_orderst.fnGetNodes());
207             if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
208                 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
209                 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
210             } else {
211                 $("input:checkbox[name=ordernumber]").prop('disabled', false);
212             }
213         }
214
215         $(document).ready(function() {
216
217             var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
218             late_orderst = KohaTable("late_orders", {
219                 "aoColumnDefs": [
220                     { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
221                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
222                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
223                 ],
224                 "sPaginationType": "four_button",
225                 "bAutoWidth": false,
226                 "fnDrawCallback": function() {
227                     if ( typeof late_orderst != 'undefined' ) {
228                         check_uncheck();
229                         $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
230                     };
231                 }
232             }, columns_settings );
233             $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
234             $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
235             $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
236
237             // Generates a dynamic link for exporting the selection's data as CSV
238             $("#ExportSelected").click(function() {
239                 var all_nodes = $(late_orderst.fnGetNodes());
240                 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
241
242                 if (selected.length == 0) {
243                     alert(_("Please select at least one item to export."));
244                     return false;
245                 }
246
247                 // Building the url from currently checked boxes
248                 var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
249                 for (var i = 0; i < selected.length; i++) {
250                     url += '&amp;ordernumber=' + selected[i].value;
251                 }
252                 // And redirecting to the CSV page
253                 location.href = url;
254                 return false;
255             });
256         });
257     </script>
258 [% END %]
259
260 [% INCLUDE 'intranet-bottom.inc' %]