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