7d84c10e51e1aa86612be3a2dad80c0b0eb9362d
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basket.tt
1 [% USE Koha %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% PROCESS 'i18n.inc' %]
5 [% BLOCK csv_export %]
6     <div class="btn-group">
7         <a id="exportbutton" class="btn btn-default" href="[% script_name | url %]?op=export&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]"><i class="fa fa-download"></i> Export as CSV</a>
8       <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
9       <ul class="dropdown-menu" id="export-csv-menu">
10           <li><a href="#">Default</a></li>
11           [% IF csv_profiles.count %]
12               [% FOR csv IN csv_profiles %]
13                 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
14               [% END %]
15           [% END %]
16        </ul>
17     </div>
18 [% END %]
19 [% USE KohaDates %]
20 [% USE Branches %]
21 [% USE Price %]
22 [% USE AuthorisedValues %]
23 [% USE TablesSettings %]
24 [% SET footerjs = 1 %]
25 [% INCLUDE 'doc-head-open.inc' %]
26 <title>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname | html %] ([% basketno | html %]) for [% booksellername | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
27 [% INCLUDE 'doc-head-close.inc' %]
28 <style>
29     .sortmsg {font-size: 80%;}
30 </style>
31 </head>
32
33 <body id="acq_basket" class="acq">
34 [% WRAPPER 'header.inc' %]
35     [% INCLUDE 'acquisitions-search.inc' %]
36 [% END %]
37
38 [% WRAPPER 'sub-header.inc' %]
39 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
40     <ol>
41         <li>
42             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
43         </li>
44         <li>
45             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
46         </li>
47         <li>
48             <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
49         </li>
50         <li>
51             <a href="#" aria-current="page">
52                 [% UNLESS ( basketno ) %]
53                     [% IF ( delete_confirmed ) %]
54                         <span>Deleted</span>
55                     [% ELSE %]
56                         <span>New</span>
57                     [% END %]
58                 [% END %]
59                 <span>Basket [% basketname | html %]
60                 [% IF ( basketno ) %]
61                     ([% basketno | html %])
62                 [% END %]
63                 for [% booksellername | html %]</span>
64             </a>
65         </li>
66     </ol>
67 </nav>
68 [% END %]
69
70 <div class="main container-fluid">
71     <div class="row">
72         <div class="col-sm-10 col-sm-push-2">
73             <main>
74
75     [% IF (cannot_manage_basket) %]
76         <div class="dialog alert">You are not authorised to manage this basket.</div>
77     [% ELSE %]
78
79         [% IF !confirm_close && !edi_confirm %]
80         [% UNLESS ( selectbasketg ) %]
81             [% UNLESS ( closedate ) %]
82             [% UNLESS ( delete_confirmed ) %]
83                 <div id="toolbar" class="btn-toolbar fh-fixedHeader">
84                     [% IF active %]
85                         <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-default" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a></div>
86                     [% END %]
87                     <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]&amp;op=add_form" class="btn btn-default" id="basketheadbutton"><i class="fa fa-pencil"></i> Edit basket</a></div>
88                     [% IF CAN_user_acquisition_delete_baskets %]
89                         <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-default" data-toggle="modal" id="delbasketbutton"><i class="fa fa-trash"></i> Delete basket</a></div>
90                     [% END %]
91                    [% IF ( unclosable ) %]
92                     [% ELSIF ( uncertainprices ) %]
93                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid | uri %]&amp;owner=1" class="btn btn-default" id="uncertpricesbutton"><i class="fa fa-usd"></i> Uncertain prices</a></div>
94                         <div title="Can not close baskets that have items with uncertain prices in them." class="btn-group">
95                             <a href="" class="btn btn-default disabled" id="closebutton"><i class="fa fa-times-circle"></i> Close basket</a>
96                         </div>
97                     [% ELSE %]
98                         <div class="btn-group">
99                             <a href="/cgi-bin/koha/acqui/basket.pl?op=close&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="closebutton"><i class="fa fa-times-circle"></i> Close basket</a>
100                         </div>
101                     [% END %]
102
103                     [% PROCESS csv_export %]
104
105                         [% IF Koha.Preference('EDIFACT') && ediaccount %]
106                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/edi_ean.pl?op=ediorder&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="ediorderbutton"><i class="fa fa-download"></i> Create EDIFACT order</a></div>
107                         [% END %]
108
109                         [% IF ( active && books_loop ) %]
110                             <div class="btn-group">
111                                 <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
112                                     <input type="hidden" name="op" value="email" />
113                                     <input type="hidden" name="basketno" value="[% basketno | html %]" />
114                                     <button type="submit" class="btn btn-default" id="emailvendorbutton"><i class="fa fa-envelope"></i> E-mail order</button>
115                                 </form>
116                             </div>
117                         [% END %]
118                 </div>
119             [% END %]
120
121             <!-- Modal for confirm deletion box-->
122                 <div class="modal" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
123                     <div class="modal-dialog">
124                     <div class="modal-content">
125                     <div class="modal-header">
126                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
127                         <h3>Confirm deletion</h3>
128                     </div>
129                     [% UNLESS book_foot_loop %]
130                         <div class="modal-body">
131                            <p>Are you sure you want to delete this basket?</p>
132                         </div>
133                         <div class="modal-footer">
134                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
135                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
136                                 <input type="hidden" name="op" value="delete_confirm" />
137                                 <input type="hidden" name="basketno" value="[% basketno | html %]" />
138                                 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
139                                 <input type="hidden" name="delbiblio" value="0" />
140                                 <button type="submit" class="btn btn-default btn-default">Delete basket</button>
141                             </form>
142                         </div>
143                     [% ELSE %]
144                         <div class="modal-body">
145                            <p>Are you sure you want to delete this basket?</p>
146                            <p>Warning:</p>
147                            <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
148                            <p>If items have been created when ordering or receiving, they will be deleted.</p>
149                            <p>You can choose to delete bibliographic records if possible (bibliographic records that have other items or that are used in a subscription or another order will not be deleted).</p>
150                         </div>
151                         <div class="modal-footer">
152                             <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
153                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
154                                 <input type="hidden" name="op" value="delete_confirm" />
155                                 <input type="hidden" name="basketno" value="[% basketno | html %]" />
156                                 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
157                                 <input type="hidden" name="delbiblio" value="0" />
158                                 <button type="submit" class="btn btn-default btn-default">Delete basket and orders</button>
159                             </form>
160
161                             <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
162                                 <input type="hidden" name="op" value="delete_confirm" />
163                                 <input type="hidden" name="basketno" value="[% basketno | html %]" />
164                                 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
165                                 <input type="hidden" name="delbiblio" value="1" />
166                                 <button type="submit" class="btn btn-default btn-default">Delete basket, orders, and records</button>
167                             </form>
168
169                         </div>
170                     [% END %]
171                     </div>
172                     </div>
173                 </div>
174 <!-- End of Modal-->
175             [% ELSE %]
176                 <div id="toolbar" class="btn-toolbar">
177                     [% IF grouped %]
178                         <div title="Can not reopen baskets that are part of a basket group." class="btn-group">
179                             <div class="btn-group"><a href="#" class="btn btn-default disabled" id="reopenbutton"><i class="fa fa-refresh"></i> Reopen basket</a></div>
180                         </div>
181                     [% ELSE %]
182                         <div class="btn-group"><a href="#" class="btn btn-default" id="reopenbutton"><i class="fa fa-refresh"></i> Reopen basket</a></div>
183
184                         [% PROCESS csv_export %]
185                     [% END %]
186                 </div>
187             [% END %]
188             [% END %]
189
190     [% IF ( NO_BOOKSELLER ) %]
191     <h1>Vendor not found</h1>
192     [% ELSE %]
193         [% IF ( delete_confirmed ) %]
194             <div class="dialog message">
195                 <h3>Basket deleted</h3>
196             </div>
197             [% IF (cannotdelbiblios) %]
198                 <div class="dialog alert">
199                     <p><strong>Warning:</strong></p>
200                     <p><strong>The following records could not be deleted:</strong></p>
201                     <ul>
202                     [% FOREACH cannotdelbiblio IN cannotdelbiblios %]
203                         <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cannotdelbiblio.biblionumber | uri %]">[% cannotdelbiblio.title | html %]</a> by [% cannotdelbiblio.author | html %]:
204                             <ul>
205                             [% IF (cannotdelbiblio.itemcount) %]<li>[% cannotdelbiblio.itemcount | html %] item(s) attached.</li>[% END %]
206                             [% IF (cannotdelbiblio.subscriptions) %]<li>[% cannotdelbiblio.subscriptions | html %] subscription(s) attached.</li>[% END %]
207                             [% IF (cannotdelbiblio.countbiblio) %]<li>[% cannotdelbiblio.countbiblio | html %] order(s) attached.</li>[% END %]
208                             [% IF (cannotdelbiblio.othererror) %]<li>Unknown error.</li>[% END %]
209                             </ul>
210                         </li>
211                     [% END %]
212                     </ul>
213                 </div>
214                 <a href="booksellers.pl">Go back to vendor page</a>
215             [% ELSE %]
216                 <a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm">Show baskets for vendor [% booksellername | html %]</a> <a href="/cgi-bin/koha/acqui/booksellers.pl" class="btn btn-default btn-sm">Show all active baskets</a>
217             [% END %]
218         [% ELSE %]
219
220         [% FOR m IN messages %]
221             <div class="dialog [% m.type | html %]">
222                 [% SWITCH m.code %]
223                 [% CASE 'no_email' %]
224                     <span>This vendor has no contact selected for sending orders to or is missing an e-mail address.</span>
225                 [% CASE 'no_basketno' %]
226                     <span>No basket given.</span>
227                 [% CASE 'no_letter' %]
228                     <span>There is no notice template with code ACQORDER defined.</span>
229                 [% CASE 'email_sent' %]
230                     <span>Order e-mail was sent to the vendor.</span>
231                 [% CASE %]
232                     <span>ERROR! - [% m.code | html %]</span>
233                 [% END %]
234             </div>
235         [% END %]
236         <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname | html %] ([% basketno | html %]) for <a href="supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
237         [% IF ( basketno ) %]
238             <div id="acqui_basket_summary" class="row">
239                 <div class="rows">
240                 <div class="col-sm-6">
241                 <ol>
242                 [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote | html %]</li>[% END %]
243                 [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote | html %]</li>[% END %]
244                 [% IF ( basketcontractno ) %]
245                     <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno | uri %]&amp;booksellerid=[% booksellerid | uri %]">[% basketcontractname | html %]</a></li>
246                 [% END %]
247                 [% IF deliveryplace %]<li><span class="label">Delivery place:</span> [% Branches.GetName( deliveryplace ) | html %]</li>[% END %]
248                 [% IF billingplace %]<li><span class="label">Billing place:</span> [% Branches.GetName( billingplace ) | html %]</li>[% END %]
249                 [% IF ( authorisedbyname ) %]<li><span class="label">[% tp('basket created by', 'Created by:') | html %]</span>  [% authorisedbyname | html %]</li>[% END %]
250                 <li id="managedby">
251                     <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
252                         <span class="label">Managed by:</span>
253                         <div style="float:left">
254                             <ul id="users_names" style="padding-left:0">
255                                 [% FOREACH user IN users %]
256                                     <li id="user_[% user.borrowernumber | html %]">
257                                         [% user.firstname | html %] [% user.surname | html %]
258                                         <a href="#" data-borrowernumber="[% user.borrowernumber | html %]" class="del_user"><i class="fa fa-trash"></i> Delete user</a>
259                                     </li>
260                                 [% END %]
261                                 <li>
262                                     <a href="#" id="add_user"><i class="fa fa-plus"></i> Add user</a>
263                                 </li>
264                                 <li id="add_user_submit" style="display:none;">
265                                     <button type="submit" class="btn btn-default btn-xs">Save changes</button>
266                                 </li>
267                             </ul>
268                         </div>
269                         <input type="hidden" id="basketno" name="basketno" value="[% basketno | html %]" />
270                         <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids | html %]" />
271                         <input type="hidden" id="op" name="op" value="mod_users" />
272                     </form>
273
274                 </li>
275                 <li id="branch">
276                     <span class="label">Managing library:</span>
277                     [% IF basketbranchcode %]
278                         [% Branches.GetName( basketbranchcode ) | html %]
279                         <a href="#" id="set_managing_library"><i class="fa fa-pencil"></i> Change library</a>
280                     [% ELSE %]
281                         No library
282                         <a href="#" id="set_managing_library"><i class="fa fa-pencil"></i> Set library</a>
283                     [% END %]
284                 </li>
285                 [% IF branches_loop.size %]
286                     <li id="managing_library_entry" style="display:none;">
287                         <span class="label">&nbsp;</span>
288                         <div style="float:left">
289                             <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
290                                 <select id="select_managing_library" name="branch">
291                                     <option value="">(no library)</option>
292                                     [% FOREACH branch IN branches_loop %]
293                                         [% IF ( basketbranchcode == branch.branchcode ) %]
294                                             <option selected="selected" value="[% branch.branchcode | html %]"> [% branch.branchname | html %]</option>
295                                         [% ELSE %]
296                                             <option value="[% branch.branchcode | html %]"> [% branch.branchname | html %]</option>
297                                         [% END %]
298                                     [% END %]
299                                 </select>
300                                 <a id="library_entry_cancel" href="#" class="cancel">Cancel</a>
301                                 <input type="hidden" id="basketno" name="basketno" value="[% basketno | html %]" />
302                                 <input type="hidden" id="op" name="op" value="mod_branch" />
303                             </form>
304                         </div>
305                     </li>
306                 [% END %]
307
308                 [% INCLUDE 'additional-fields-display.inc' available=available_additional_fields values=additional_field_values %]
309
310                 </ol>
311                 </div> <!-- /.col-sm-6 -->
312
313                 <div class="col-sm-6">
314                     <ol>
315                         [% IF ( creationdate ) %]
316                             <li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>
317                         [% END %]
318                         [% IF ( closedate ) %]
319                             <li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>
320                         [% END %]
321                         [% IF ( ediaccount ) %]
322                             [%- BLOCK edi_status -%]
323                                 [%- SWITCH edi_order.status -%]
324                                     [%- CASE 'Pending'   -%]<span>Pending</span>
325                                     [%- CASE 'Sent'      -%]<span>Sent</span>
326                                     [%- CASE 'Processed' -%]<span>Processed</span>
327                                 [%- END -%]
328                             [%- END -%]
329                             [% IF ( edi_order ) %]
330                             <li><span class="label">EDI status:</span> [%- PROCESS edi_status edi_order=edi_order -%] ([% edi_order.transfer_date | $KohaDates %])</li>
331                             [% ELSE %]
332                             <li><span class="label">EDI status:</span> Not ordered</li>
333                             [% END %]
334                         [% END %]
335                         [% IF ( estimateddeliverydate ) %]
336                             <li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates %]</li>
337                         [% END %]
338                         <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
339
340                         [% IF basket.create_items %]
341                             <li>
342                                 <span class="label">Create items when:</span>
343                                 [% SWITCH basket.create_items %]
344                                     [% CASE 'receiving' %]<span>Receiving items</span>
345                                     [% CASE 'cataloguing' %]<span>Cataloguing items</span>
346                                     [% CASE %]<span>Placing orders</span>
347                                 [% END %]
348                             </li>
349                         [% END %]
350                     </ol>
351
352                     [% IF ( closedate ) %]
353                         <ol>
354                             <li>
355                                 <span class="label">Basket group:</span>
356                                 [% IF basketgroup.id and not basketgroup.name %]
357                                     [% SET basketgroup.name = "Basket group no. " _ basketgroup.id %]
358                                 [% END %]
359
360                                 [% IF basketgroup.closed %]
361                                     [% IF ( CAN_user_acquisition_group_manage ) %]
362                                         <a href="basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]&basketgroupid=[% basketgroup.id | uri %]" title="basketgroup">[% basketgroup.name | html %] <span>(closed)</span></a>
363                                     [% ELSE %]
364                                         [% basketgroup.name | html %] <span>(closed)</span>
365                                     [% END %]
366                                 [% ELSIF ( ! CAN_user_acquisition_group_manage ) %]
367                                     [%- IF basketgroup.id -%]
368                                 [% basketgroup.name | html %]
369                                     [%- ELSE -%]
370                                         <span>No group</span>
371                                     [%- END -%]
372                                 [% ELSE %]
373                                     [% IF ( CAN_user_acquisition_group_manage ) %]
374                                         [% IF ( basketgroup.id ) %]
375                                             [% basketgroup.name | html %]
376                                             <a href="#" id="set_basket_group"><i class="fa fa-pencil"></i> Change basket group</a>
377                                         [% ELSE %]
378                                             No group
379                                             <a href="#" id="set_basket_group"><i class="fa fa-pencil"></i> Set basket group</a>
380                                         [% END %]
381                                     [% END %]
382                                 [% END %]
383                             </li>
384                             [% IF ( CAN_user_acquisition_group_manage ) %]
385                                 <li id="basket_grouping" style="display:none;">
386                                     <span class="label">&nbsp;</span>
387                                     <div style="float:left">
388                                         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
389                                             <select id="basketgroupid" name="basketgroupid">
390                                                 <option value="">No group</option>
391                                                 [% FOREACH bg IN basketgroups %]
392                                                     [% IF ( bg.default ) %]
393                                                         <option value="[% bg.id | html %]" selected="selected">[% bg.name | html %]</option>
394                                                     [% ELSE %]
395                                                         [% UNLESS bg.closed %]
396                                                             <option value="[% bg.id | html %]">[% bg.name | html %]</option>
397                                                         [% ELSE %]
398                                                             <option value="[% bg.id | html %]" disabled="disabled">[% bg.name | html %] <span>(closed)</span></option>
399                                                         [% END %]
400                                                     [% END %]
401                                                 [% END %]
402                                                 <option value="new">Add new group</option>
403                                             </select>
404                                             <a href="#" id="basket_group_cancel" class="cancel">Cancel</a>
405                                             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
406                                             <input type="hidden" value="mod_basket" name="op" />
407                                             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
408                                         </form>
409                                     </div>
410                                 </li>
411                             [% END # /IF ( CAN_user_acquisition_group_manage ) %]
412                             [% IF basketgroup.deliveryplace %]
413                                 <li>
414                                     <span class="label">Basket group delivery placename:</span> [% Branches.GetName( basketgroup.deliveryplace ) | html %]
415                                 </li>
416                             [% END %]
417                             [% IF basketgroup.billingplace %]
418                                 <li>
419                                     <span class="label">Basket group billing place:</span> [% Branches.GetName( basketgroup.billingplace ) | html %]
420                                 </li>
421                             [% END %]
422                         </ol>
423                     [% END # /IF closeddate %]
424                     </div> <!-- /.rows -->
425                 </div> <!-- /.col-sm-6 -->
426             </div> <!-- /#acqui_basket_summary.row -->
427         [% END %]
428         [% IF ( duplinbatch ) %]<div class="dialog alert">
429         <h4>Duplicate warning</h4>
430         <p>Some records have not been automatically added because they match an existing record in your catalog:<a href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% duplinbatch | uri %]&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]" title="Open in new window" target="_blank" style="margin-left:10px"><i class="fa fa-window-restore"></i> Display them</a></p>
431         </div>[% END %]
432
433         <div id="acqui_basket_content">
434         [% IF ( books_loop ) %]
435             <h2>Orders</h2>
436             <div class="page-section">
437                 <table id="orders">
438                     <thead>
439                         <tr>
440                             <th>No.</th>
441                             <th>[% tp('noun', 'Order') | html %]</th>
442                             <th>RRP tax exc.</th>
443                             <th>Actual cost tax exc.</th>
444                             <th>Budgeted cost tax exc.</th>
445                             <th>RRP tax inc.</th>
446                             <th>Actual cost tax inc.</th>
447                             <th>Budgeted cost tax inc.</th>
448                             <th>Replacement price</th>
449                             <th>Qty.</th>
450                             <th>Total tax exc. ([% currency | html %])</th>
451                             <th>Total tax inc. ([% currency | html %])</th>
452                             <th>GST %</th>
453                             <th>GST</th>
454                             <th>Fund</th>
455                             <th>Estimated delivery date</th>
456                             [% IF Koha.Preference('EDIFACT') && ediaccount %]
457                             <th>Supplier report</th>
458                             [% END %]
459                             [% IF ( active ) %]
460                                 [% UNLESS ( closedate ) %]
461                                     <th class="NoSort">Modify</th>
462                                     <th class="NoSort">Cancel order</th>
463                                 [% END %]
464                             [% END %]
465                         </tr>
466                     </thead>
467                     <tfoot>
468                     [% FOREACH foot_loo IN book_foot_loop %]
469                         <tr>
470                             <th></th>
471                             <th>Total (GST [% foot_loo.tax_rate * 100 | html %])</th>
472                             <th>&nbsp;</th>
473                             <th>&nbsp;</th>
474                             <th>&nbsp;</th>
475                             <th>&nbsp;</th>
476                             <th>&nbsp;</th>
477                             <th>&nbsp;</th>
478                             <th>&nbsp;</th>
479                             <th>[% foot_loo.quantity | html %]</th>
480                             <th>[% foot_loo.total_tax_excluded | $Price %]</th>
481                             <th>[% foot_loo.total_tax_included | $Price %]</th>
482                             <th>&nbsp;</th>
483                             <th>[% foot_loo.tax_value | $Price %]</th>
484                             <th>&nbsp;</th>
485                             <th>&nbsp;</th>
486                             [% IF Koha.Preference('EDIFACT') && ediaccount %]
487                             <th>&nbsp;</th>
488                             [% END %]
489                             [% IF ( active ) %]
490                                 [% UNLESS ( closedate ) %]
491                                     <th>&nbsp;</th>
492                                     <th>&nbsp;</th>
493                                 [% END %]
494                             [% END %]
495                         </tr>
496                     [% END %]
497                     <tr>
498                         <th></th>
499                         <th>Total ([% currency | html %])</th>
500                         <th>&nbsp;</th>
501                         <th>&nbsp;</th>
502                         <th>&nbsp;</th>
503                         <th>&nbsp;</th>
504                         <th>&nbsp;</th>
505                         <th>&nbsp;</th>
506                         <th>&nbsp;</th>
507                         <th>[% total_quantity | html %]</th>
508                         <th>[% total_tax_excluded | $Price %]</th>
509                         <th>[% total_tax_included | $Price %]</th>
510                         <th>&nbsp;</th>
511                         <th>[% total_tax_value | $Price %]</th>
512                         <th>&nbsp;</th>
513                         <th>&nbsp;</th>
514                         [% IF Koha.Preference('EDIFACT') && ediaccount %]
515                         <th>&nbsp;</th>
516                         [% END %]
517                         [% IF ( active ) %]
518                             [% UNLESS ( closedate ) %]
519                                 <th>&nbsp;</th>
520                                 <th>&nbsp;</th>
521                             [% END %]
522                         [% END %]
523                     </tr>
524                     </tfoot>
525                     <tbody>
526                     [% FOREACH books_loo IN books_loop %]
527                         [% IF ( books_loo.order_received ) %]
528                             <tr class="disabled">
529                         [% ELSE %]
530                             <tr>
531                         [% END %]
532                             <td>
533                                 [% books_loo.ordernumber | html %]
534                             </td>
535                             <td>
536                                 <p>
537                                     [% IF ( books_loo.order_received ) %] <span class="order-received">(received)</span>[% END %]
538                                     [% IF books_loo.title %]
539                                         [% INCLUDE 'biblio-title.inc' biblio=books_loo link = 1 %] [% IF books_loo.author %] by [% books_loo.author | html %][% END %]
540                                     [% ELSE %]
541                                         <em>Deleted bibliographic record, can't find title</em><br />
542                                     [%- END %]
543                                     <br />
544                                     [%- IF ( books_loo.isbn ) %] - [% books_loo.isbn | html %][% END -%]
545                                     [%- IF ( books_loo.issn ) %] - [% books_loo.issn | html %][% END -%]
546                                     [%- IF ( books_loo.publishercode ) %], [% books_loo.publishercode | html %][% END -%]
547                                     [%- IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear | html -%]
548                                     [%- ELSIF ( books_loo.copyrightdate ) %] [% books_loo.copyrightdate | html %][% END -%]
549                                     [%- IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement | html %][% END -%]
550                                     [%- IF ( books_loo.suggestionid ) %]
551                                         <br/>
552                                         Suggested by: [% books_loo.surnamesuggestedby | html %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby | html %] [% END %]
553                                         (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid | uri %]&amp;op=show">suggestion #[% books_loo.suggestionid | html %]</a>)
554                                     [% END %]
555                                 </p>
556                                     [% IF ( books_loo.order_internalnote ) %]
557                                         <p class="ordernote"><strong>Internal note: </strong><span id="internal-note-[% books_loo.ordernumber | html %]">[% books_loo.order_internalnote | html %]</span> <a class="edit_note noExport" data-ordernumber="[% books_loo.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber | html %]&type=internal" title="Edit internal note"><i class="fa fa-pencil"></i> Edit internal note</a></p>
558                                     [% ELSE %]
559                                         <a class="edit_note noExport" data-ordernumber="[% books_loo.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber | html %]&type=internal" title="Add internal note"><i class="fa fa-plus"></i> Add internal note</a>
560                                     [% END %]
561                                     [% IF ( books_loo.order_vendornote ) %]
562                                         <p class="ordernote"><strong>Vendor note: </strong> <span id="vendor-note-[% books_loo.ordernumber | html %]">[% books_loo.order_vendornote | html %]</span> <a class="edit_note noExport" data-ordernumber="[% books_loo.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber | html %]&type=vendor" title="Edit vendor note"><i class="fa fa-pencil"></i> Edit vendor note</a></p>
563                                     [% ELSE %]
564                                         <a class="edit_note noExport" data-ordernumber="[% books_loo.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber | html %]&type=vendor" title="Add vendor note"><i class="fa fa-plus"></i> Add vendor note</a>
565                                     [% END %]
566                                 [% IF (books_loo.transferred_from) %]
567                                   [% basket = books_loo.transferred_from.basket %]
568                                   [% bookseller = books_loo.transferred_from.bookseller %]
569                                   [% timestamp = books_loo.transferred_from.timestamp %]
570                                   <p>Transferred from basket:
571                                     <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]"> [% basket.basketname | html %]</a>
572                                     (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a>)
573                                     on <span title="[% timestamp | $KohaDates with_hours = 1 %]">
574                                       [% timestamp | $KohaDates %]
575                                     </span>
576                                   </p>
577                                 [% END %]
578                                 [% SET claims = books_loo.order_object.claims %]
579                                 [% IF claims.count %]
580                                     <p>
581                                         This order has been claimed [% claims.count | html %] times. On [% FOR c IN claims %][% c.claimed_on | $KohaDates %][% UNLESS loop.last %], [% END %][% END %]
582                                     </p>
583                                 [% END %]
584                             </td>
585                             [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
586                             [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
587                             <td class="number [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %] [% IF ( books_loo.uncertainprice ) %] <span>(Uncertain)</span> [% END %] </td>
588                             <td class="number [% IF books_loo.unitprice_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.unitprice_tax_excluded | $Price %]</td>
589                             <td class="number [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price %]</td>
590                             <td class="number [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
591                             <td class="number [% IF books_loo.unitprice_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.unitprice_tax_included | $Price %]</td>
592                             <td class="number [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
593                             <td class="number [% IF books_loo.replacementprice.search(zero_regex) %]error[% END %]">[% books_loo.replacementprice | $Price %]</td>
594                             <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity | html %]</td>
595                             <td class="number [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
596                             <td class="number [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
597                             <td class="number">[% books_loo.tax_rate * 100 | html %]</td>
598                             <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
599                             <td>[% books_loo.budget_name | html %]</td>
600                             <td data-order="[% books_loo.estimated_delivery_date | html %]" class="actions">
601                                 [% books_loo.estimated_delivery_date | $KohaDates %]
602                                 [% IF CAN_user_acquisition_order_manage %]
603                                 <a class="edit_delivery_date" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% books_loo.ordernumber | html %]" title="Edit delivery date" data-ordernumber="[% books_loo.ordernumber | html %]" id="delivery_date_[% books_loo.ordernumber | html %]" data-delivery_date="[% books_loo.estimated_delivery_date | $KohaDates %]">
604                                     <i class="fa fa-pencil"></i> Edit
605                                 </a>
606                             </td>
607                             [% IF Koha.Preference('EDIFACT') && ediaccount %]
608                             <td>[% books_loo.suppliers_report | html %]</td>
609                             [% END %]
610                         [% END %]
611                             [% IF ( active ) %]
612                                 [% UNLESS ( closedate ) %]
613                                 <td>
614                                     <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]">Modify</a>
615                                     [% UNLESS (books_loo.order_received) %]
616                                         <br />
617                                         <a href="#" class="transfer_order" data-ordernumber="[% books_loo.ordernumber | html %]">Transfer</a>
618                                     [% END %]
619                                 </td>
620                                 <td>
621                                 [% IF ( books_loo.orderstatus != "complete") %]
622                                     [% IF ( books_loo.left_holds_on_order ) %]
623                                         <span class="button" title="Can't cancel order, ([% books_loo.holds_on_order | html %]) holds are linked with this order. Cancel holds first">Can't cancel order</span><br>
624                                     [% ELSE %]
625                                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber | uri %]&biblionumber=[% books_loo.biblionumber | uri %]&basketno=[% basketno | uri %]&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno | uri %]" class="button">Cancel order</a><br>
626                                     [% END %]
627                                     [% IF ( books_loo.can_del_bib ) %]
628                                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% books_loo.ordernumber | uri %]&biblionumber=[% books_loo.biblionumber | uri %]&basketno=[% basketno | uri %]&del_biblio=1&referrer=/cgi-bin/koha/acqui/basket.pl%3Fbasketno=[% basketno | uri %]" class="button">Cancel order and delete catalog record</a><br>
629                                     [% ELSE %]
630                                         <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
631                                     [% END %]
632                                     [% IF ( books_loo.left_item ) %]
633                                         <strong title="Can't delete catalog record, because of [% books_loo.items | html %] existing hold(s)" >[% books_loo.items | html %] item(s) left</strong><br>
634                                     [% END %]
635                                     [% IF ( books_loo.left_biblio ) %]
636                                         <strong title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios | html %] order(s) left</strong><br>
637                                     [% END %]
638                                     [% IF ( books_loo.left_subscription ) %]
639                                         <strong title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions | html %] subscription(s) left</strong><br>
640                                     [% END %]
641                                     [% IF ( books_loo.left_holds ) %]
642                                         <strong title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds | html %] hold(s) left</strong>
643                                     [% END %]
644                                 [% END %]
645                                 </td>
646                                 [% END %]
647                             [% END %]
648                         </tr>
649                     [% END %]
650                     </tbody>
651                 </table>
652             </div><!-- /.page-section -->
653         [% END %]
654         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
655         [% END %]
656         </div> <!-- /#acqui_basket_content -->
657         [% IF (cancelledorders_loop) %]
658             <h2>Cancelled orders</h2>
659             <div id="cancelledorders" class="page-section">
660             <table id="cancelledorderst">
661               <thead>
662                 <tr>
663                   <th>No.</th>
664                   <th>[% tp('noun', 'Order') | html %]</th>
665                   <th class="tax_excluded">RRP tax exc.</th>
666                   <th class="tax_excluded">ecost tax exc.</th>
667                   <th class="tax_included">RRP tax inc.</th>
668                   <th class="tax_included">ecost tax inc.</th>
669                   <th class="replacementprice">Replacement price</th>
670                   <th>Qty.</th>
671                   <th class="tax_excluded">Total tax exc. ([% currency | html %])</th>
672                   <th class="tax_included">Total tax inc. ([% currency | html %])</th>
673                   <th>GST %</th>
674                   <th>GST</th>
675                   <th>Fund</th>
676                 </tr>
677               </thead>
678               <tbody>
679                 [% FOREACH order IN cancelledorders_loop %]
680                   <tr style="color:grey">
681                     <td>
682                         [% order.ordernumber | html %]
683                     </td>
684                     <td>
685                       <p>
686                         [% IF ( order.order_received ) %] <span class="order-received">(received)</span>[% END %]
687                         [% IF (order.title) %]
688                           [% order.title | html %][% IF order.author %] by [% order.author | html %][% END %]
689                         [% ELSE %]
690                           <em>Deleted bibliographic record, can't find title</em>
691                         [% END %]
692                         <br />
693                         [% IF ( order.order_internalnote ) %] [% order.order_internalnote | html %][% END %]
694                         [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
695                         [% IF ( order.issn ) %] - [% order.issn | html %][% END %]
696                         [% IF ( order.publishercode ) %], [% order.publishercode | html %][% END %]
697                         [% IF ( order.publicationyear ) %], [% order.publicationyear | html %]
698                         [% ELSIF ( order.copyrightdate ) %] [% order.copyrightdate | html %][% END %]
699                         [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement | html %][% END %]
700                         [% IF ( order.cancellationreason ) %]
701                           <br />
702                           Cancellation reason: [% AuthorisedValues.GetByCode( 'ORDER_CANCELLATION_REASON', order.cancellationreason ) | html %]
703                         [% END %]
704                       </p>
705                       [% IF order.transferred_to %]
706                         [% basket = order.transferred_to.basket %]
707                         [% bookseller = order.transferred_to.bookseller %]
708                         [% timestamp = order.transferred_to.timestamp %]
709                         <p>Transferred to basket:
710                           <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]"> [% basket.basketname | html %]</a>
711                           (<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id | uri %]">[% bookseller.name | html %]</a>)
712                           on <span title="[% timestamp | $KohaDates with_hours = 1 %]">
713                             [% timestamp | $KohaDates %]
714                           </span>
715                         </p>
716                       [% END %]
717                     </td>
718                     <td class="number">
719                         [% order.rrp_tax_excluded | $Price %]
720                         [% IF ( order.uncertain ) %]
721                             <span>(Uncertain)</span>
722                         [% END %]
723                     </td>
724                     <td class="number">[% order.ecost_tax_excluded | $Price %]</td>
725                     <td class="number">[% order.rrp_tax_included | $Price %]</td>
726                     <td class="number">[% order.ecost_tax_included | $Price %]</td>
727                     <td class="number">[% order.replacementprice | $Price %]</td>
728                     <td class="number">[% order.quantity | html %]</td>
729                     <td class="number">[% order.total_tax_excluded | $Price %]</td>
730                     <td class="number">[% order.total_tax_included | $Price %]</td>
731                     <td class="number">[% order.tax_rate * 100 | html %]</td>
732                     <td class="number">[% order.tax_value | $Price %]</td>
733                     <td>[% order.budget_name | html %]
734                   </tr>
735                 [% END %]
736               </tbody>
737             </table>
738           </div> <!-- /#cancelledorders -->
739         [% END %]
740         <br />
741
742         [% UNLESS ( closedate ) %]
743             <!-- Modal -->
744             <div id="addtoBasket" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel" aria-hidden="true" data-basketno="[% basket.basketname | html %]">
745                 <div class="modal-dialog" role="document">
746                     <div class="modal-content">
747                         <div class="modal-header">
748                             <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
749                             <h4 class="modal-title" id="addtoBasketLabel">Add order to basket</h4>
750                         </div>
751                         <div class="modal-body">
752                             [% IF active %]
753                                 [% INCLUDE 'acquisitions-add-to-basket.inc' %]
754                             [% END %]
755                         </div>
756                         <div class="modal-footer">
757                             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
758                         </div>
759                     </div><!-- /.modal-content -->
760                 </div><!-- /.modal-dialog -->
761             </div><!-- /.modal -->
762         [% END %]
763
764 [% END %]
765 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
766     [% END %]
767 [% IF ( confirm_close ) %]
768         <div id="closebasket_needsconfirmation" class="dialog alert">
769
770         <form action="/cgi-bin/koha/acqui/basket.pl">
771             <h1>Are you sure you want to close basket [% basketname | html %]?</h1>
772             [% IF ( CAN_user_acquisition_group_manage ) %]
773             <p>
774             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
775             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
776             </p>
777             [% END %]
778             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
779             <input type="hidden" value="close" name="op" />
780             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
781             <input type="hidden" name="confirm" value="1" />
782             <input type="hidden" name="basketgroupname" value="[% basketgroupname | html %]" />
783             <button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
784         </form>
785         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
786             <input type="hidden" name="basketno" value="[% basketno | html %]" />
787             <button type="submit" class="deny" accesskey="n"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
788         </form>
789         </div>
790     [% END %]
791 [% IF edi_confirm %]
792         <div id="closebasket_needsconfirmation" class="dialog alert">
793
794         <form action="/cgi-bin/koha/acqui/basket.pl">
795             <h1>Are you sure you want to generate an EDIFACT order and close basket [% basketname | html %]?</h1>
796             [% IF CAN_user_acquisition_group_manage %]
797             <p>
798             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
799             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
800             </p>
801             [% END %]
802             <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
803             <input type="hidden" value="ediorder" name="op" />
804             <input type="hidden" name="ean" value="[% ean | html %]" />
805             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
806             <input type="hidden" name="confirm" value="1" />
807             <input type="hidden" name="basketgroupname" value="[% basketgroupname | html %]" />
808             <button type="submit" class="approve" accesskey="Y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button>
809         </form>
810         <form action="/cgi-bin/koha/acqui/basket.pl" method="get">
811             <input type="hidden" name="basketno" value="[% basketno | html %]" />
812             <button type="submit" class="deny" accesskey="N"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button>
813         </form>
814         </div>
815     [% END %]
816 [% END %][%# IF (cannot_manage_basket) %]
817
818             </main>
819         </div> <!-- /.col-sm-10.col-sm-push-2 -->
820
821         <div class="col-sm-2 col-sm-pull-10">
822             <aside>
823                 [% INCLUDE 'vendor-menu.inc' %]
824                 [% INCLUDE 'acquisitions-menu.inc' %]
825             </aside>
826         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
827     </div> <!-- /.row -->
828
829
830 <!-- Modal for editing vendor and internal notes -->
831 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
832     <div class="modal-dialog" role="document">
833         <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
834             <div class="modal-content">
835                 <div class="modal-header">
836                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
837                     <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
838                 </div>
839                 <div class="modal-body">
840                 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
841                 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
842                 <input type="hidden" name="op" value="save" />
843                 <input type="hidden" id="type" name="type" value="" />
844             </div>
845             <div class="modal-footer">
846                 <button type="submit" class="btn btn-default">Save</button>
847                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
848             </div>
849             </div>
850         </form>
851     </div>
852 </div>
853
854 <!-- Modal for editing estimated delivery date -->
855 <div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
856     <div class="modal-dialog" role="document">
857         <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
858             <div class="modal-content">
859                 <div class="modal-header">
860                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
861                     <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
862                 </div>
863                 <div class="modal-body">
864                 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% books_loo.estimated_delivery_date | $KohaDates %]"/>
865                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
866                 <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
867                 <input type="hidden" name="op" value="save" />
868             </div>
869             <div class="modal-footer">
870                 <button type="submit" class="btn btn-default">Save</button>
871                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
872             </div>
873             </div>
874         </form>
875     </div>
876 </div>
877
878 [% MACRO jsinclude BLOCK %]
879     [% Asset.js("js/acquisitions-menu.js") | $raw %]
880     [% INCLUDE 'datatables.inc' %]
881     [% INCLUDE 'columns_settings.inc' %]
882     [% Asset.js("lib/hc-sticky.js") | $raw %]
883     [% Asset.js("js/acq.js") | $raw %]
884     [% INCLUDE 'calendar.inc' %]
885     <script>
886         function updateColumnsVisibility(visible) {
887             if ( visible ) {
888                 $("table .tax_excluded, .tax_included").show();
889             } else {
890                 [% IF ( listincgst ) %]
891                     $("table .tax_excluded").hide();
892                 [% ELSE %]
893                     $("table .tax_included").hide();
894                 [% END %]
895             }
896         }
897
898         var Sticky;
899
900         $(document).ready(function() {
901             if ( $('#toolbar').length ) {
902                 Sticky = $("#toolbar");
903                 Sticky.hcSticky({
904                     stickTo: "main",
905                     stickyClass: "floating"
906                 });
907             }
908
909             [% UNLESS ( closedate ) %]
910                 $('#addtoBasket').on('show', function () {
911                    $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML);
912                 });
913             [% END %]
914
915             $("body").on("click", ".del_user", function(e){
916                 e.preventDefault();
917                 del_user( $(this).data("borrowernumber") );
918             });
919
920             $("#add_user").on("click",function(e){
921                 e.preventDefault();
922                 UserSearchPopup();
923             });
924
925             $(".transfer_order").on("click",function(e){
926                 e.preventDefault();
927                 transfer_order_popup( $(this).data("ordernumber"));
928             });
929
930             $(".edit_note").on("click", function(e) {
931                 e.preventDefault();
932                 var ordernumber = $(this).data("ordernumber");
933                 var note_type = $(this).data("note_type");
934                 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
935                 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
936                 $("#noteEditor .modal-title").text(modalTitle);
937                 $("#ordernumber").val( ordernumber );
938                 $("#ordernotes").html( note_text );
939                 $("#type").val( note_type );
940                 $("#noteEditor").modal("show");
941                 $("#ordernotes").focus();
942             });
943
944              $("#noteEditor").on('hidden.bs.modal', function (e) {
945                 $("#noteEditorLabel").html("");
946                 $("#noteEditor .modal-title").text("");
947                 $("#ordernotes").html( "" );
948                 $("#ordernumber").val("");
949                 $("#type").val("");
950             });
951
952             $("#set_managing_library").on("click", function(e){
953                 e.preventDefault();
954                 $(this).hide();
955                 $("#managing_library_entry").show();
956             });
957
958             $("#library_entry_cancel").on("click", function(e){
959                 e.preventDefault();
960                 $("#managing_library_entry").hide();
961                 $("#set_managing_library").show();
962             });
963
964             $("#set_basket_group").on("click", function(e){
965                 e.preventDefault();
966                 $(this).hide();
967                 $("#basket_grouping").show();
968             });
969
970             $("#basket_group_cancel").on("click", function(e){
971                 e.preventDefault();
972                 $("#basket_grouping").hide();
973                 $("#set_basket_group").show();
974             });
975
976             $("#addtoBasket").on("shown.bs.modal", function(){
977                 var basket = $(this).data("basketno");
978                 var legend = _("Add order to basket %s").format(basket);
979                 $(this).find("h4").text( legend );
980                 $(this).find("legend").html(legend);
981                 $(this).find("input:text").focus();
982             });
983         });
984     </script>
985
986     [% UNLESS ( closedate ) %]
987         <script>
988             function transfer_order_popup(ordernumber) {
989                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
990                     + "ordernumber=" + ordernumber
991                 window.open(url, 'TransferOrder','width=600,height=400,toolbar=false,scrollbars=yes');
992             }
993
994             function confirm_ediorder() {
995                 var is_confirmed = confirm(_("Are you sure you want to close this basket and generate an EDIFACT order?"));
996                 if (is_confirmed) {
997                     window.location = "/cgi-bin/koha/acqui/basket.pl?op=edi_confirm&basketno=[% basketno | html %]";
998                 }
999             }
1000         </script>
1001     [% ELSE %]
1002         <script>
1003             $(document).ready(function(){
1004                 $("#basketgroupid").change(function(){
1005                     if($(this).val() == "new"){
1006                         location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]";
1007                     } else {
1008                         $(this).parent().submit();
1009                     }
1010                 });
1011             });
1012         </script>
1013         [% UNLESS ( grouped ) %]
1014             <script>
1015                 function confirm_reopen() {
1016                     var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
1017                     var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));
1018                     if (is_confirmed) {
1019                         window.location = "/cgi-bin/koha/acqui/basket.pl?op=reopen&basketno=[% basketno | html %]";
1020                     }
1021                 }
1022             </script>
1023         [% END %]
1024     [% END %]
1025     <script>
1026         $(document).ready(function() {
1027             var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %];
1028             [% IF !(Koha.Preference('EDIFACT') && ediaccount) %]
1029                 table_settings['columns'].splice(13, 1);
1030             [% END %]
1031             KohaTable("orders", {
1032                 "sPaginationType": "full",
1033                 "autoWidth": false,
1034                 "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12,13],
1035             }, table_settings);
1036
1037             var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
1038                 "sPaginationType": "full"
1039             } ) );
1040             $("#reopenbutton").on("click",function(e){
1041                 e.preventDefault();
1042                 confirm_reopen();
1043             });
1044             // Generates a dynamic link for exporting the selections data as CSV
1045             $("#exportbutton, #export-csv-menu a").click(function() {
1046                 // Building the url from currently checked boxes
1047                 var url = '/cgi-bin/koha/acqui/basket.pl';
1048                 url += $('#exportbutton').attr('href');
1049                 if($(this).attr("data-value")) {
1050                     url += '&amp;csv_profile=' + $(this).attr("data-value");
1051                 }
1052                 // And redirecting to the CSV page
1053                 location.href = url;
1054                 return false;
1055             });
1056             $("#select_managing_library").on("change", function(){
1057                 $(this).parent().submit();
1058             });
1059
1060             $(".edit_delivery_date").on("click", function(e) {
1061                 e.preventDefault();
1062                 var ordernumber = $(this).data("ordernumber");
1063                 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
1064                 var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date");
1065                 $("#dateEditor .modal-title").text(modalTitle);
1066                 $("#date_ordernumber").val(ordernumber);
1067                 $("#estimated_delivery_date").val(date_text);
1068                 $("#dateEditor").modal("show");
1069             });
1070
1071              $("#dateEditor").on('hidden.bs.modal', function (e) {
1072                 $("#dateEditorLabel").html("");
1073                 $("#dateEditor .modal-title").text("");
1074                 $("#estimated_delivery_date").html( "" );
1075                 $("#date_ordernumber").val("");
1076             });
1077         });
1078
1079         function UserSearchPopup(f) {
1080             window.open(
1081                 "/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add&filter=baskets_managers",
1082                 'UserSearchPopup',
1083                 'width=1024, height=768, scrollbars=yes, toolbar=no,'
1084              );
1085         }
1086
1087         function add_user(borrowernumber, borrowername) {
1088             var ids = $("#users_ids").val();
1089             if(ids.length > 0) {
1090                 ids = ids.split(':');
1091             } else {
1092                 ids = new Array;
1093             }
1094             if (ids.indexOf(borrowernumber.toString()) < 0) {
1095                 ids.push(borrowernumber);
1096                 $("#users_ids").val(ids.join(':'));
1097                 var li = '<li id="user_'+borrowernumber+'">'+borrowername
1098                 + ' <a href="#" data-borrowernumber="'+borrowernumber+'" class="del_user"><i class="fa fa-trash"></i> '
1099                     + _("Delete user") + '</a></li>';
1100                 $("#users_names").prepend(li);
1101                 $("#add_user_submit").show();
1102                 return 0;
1103             }
1104             return -1;
1105         }
1106
1107         function del_user(borrowernumber) {
1108             $("#user_"+borrowernumber).remove();
1109             var ids = $("#users_ids").val().split(':');
1110             ids.splice(ids.indexOf(borrowernumber.toString()), 1);
1111             $("#users_ids").val(ids.join(':'));
1112             $("#add_user_submit").show();
1113         }
1114     </script>
1115 [% END %]
1116
1117 [% INCLUDE 'intranet-bottom.inc' %]