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