Bug 28082: Add acquisitions toolbar to vendors on vendor search page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / booksellers.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE KohaDates %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Search for vendor [% supplier | html %] &rsaquo; Koha</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <style>
10 #vendors td{
11         vertical-align: top;
12 }
13 </style>
14 </head>
15
16 <body id="acq_booksellers" class="acq">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'acquisitions-search.inc' %]
19
20 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
21     <ol>
22         <li>
23             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24         </li>
25         <li>
26             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
27         </li>
28         <li>
29             <a href="#" aria-current="page">
30                 Search for vendor <em>[% supplier | html %]</em>
31             </a>
32         </li>
33     </ol>
34 </nav>
35
36 <div class="main container-fluid">
37     <div class="row">
38         <div class="col-sm-10 col-sm-push-2">
39             <main>
40
41 [% INCLUDE 'acquisitions-toolbar.inc' %]
42 [% UNLESS ( count == 1 ) %]
43     [% UNLESS count %]
44         <h1>Your vendor search returned no results.</h1>
45     [% ELSIF ( supplier.length < 1 ) %]
46         <h1>Vendor search: [% count | html %] results found</h1>
47     [% ELSE %]
48         <h1>Vendor search: [% count | html %] results found for '[% supplier | html %]'</h1>
49     [% END %]
50 [% END %]
51 [% IF ( loop_suppliers.size ) %]
52     [% UNLESS (count == 1) %]
53         <p>Choose a vendor in the list to jump directly to the right place.
54         <select id="supplierlist">
55             [% FOREACH supplier1 IN loop_suppliers %]
56                 <option value="[% supplier1.booksellerid | html %]">[% supplier1.name | html %]</option>
57             [% END %]
58         </select>
59         </p>
60         [% IF ( allbaskets ) %]
61             <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&amp;booksellerid=[% booksellerid | uri %]">Show active baskets only</a>
62         [% ELSE %]
63             <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;allbaskets=1">Show all baskets</a>
64         [% END %]
65     [% END %]
66     [% UNLESS booksellerid %]
67         | <a href="#" id="show_active_vendors">Show active vendors only</a><a href="#" id="show_all_vendors">Show all vendors</a>
68     [% END %]
69     <div id="acqui_order_supplierlist">
70         [% FOREACH supplier IN loop_suppliers %]
71             [% IF ( supplier.active ) %]
72                 <div class="supplier">
73             [% ELSE %]
74                 <div class="supplier inactive">
75             [% END %]
76                 [% IF ( supplier.active ) %]
77                     <h2 class="suppliername">
78                 [% ELSE %]
79                     <h2 class="suppliername inactive">
80                 [% END %]
81                         <a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">
82                             [% IF (supplier.name) %]
83                                 [% supplier.name | html %]
84                             [% ELSE %]
85                                 NO NAME
86                             [% END %]
87                         </a>
88                         <a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]"></a>
89                     [% IF ( !supplier.active ) %]<span class="vendor_inactive">(inactive)</span>[% END %]
90                 </h2>
91                 <span class="basketcounts">
92                     [% IF ( count > 1 ) %]
93                         <a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% supplier.booksellerid | uri %]">[% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %]</a>,
94                     [% ELSE %]
95                         [% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %],
96                     [% END %]
97                     [% IF supplier.subscriptioncount > 0 %]
98                         <a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% supplier.name | uri %]&searched=1">
99                             [% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %]
100                         </a>
101                     [% ELSE %]
102                         [% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %]
103                     [% END %]
104                 </span>
105                 [% IF ( count == 1 ) %]
106                     [% IF ( supplier.basketcount > 0 ) %]
107                         <div>
108                             [% IF ( allbaskets ) %]
109                                 <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier.booksellerid | uri %]&amp;booksellerid=[% booksellerid | uri %]">Show active baskets only</a>
110                             [% ELSE %]
111                                 <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier.booksellerid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;allbaskets=1">Show all baskets</a>
112                             [% END %]
113                         </div>
114                     [% END %]
115                 [% ELSE %]
116                     [% INCLUDE "acquisitions-toolbar.inc" booksellerid=supplier.booksellerid active=supplier.active basketcount=supplier.loop_basket.size basketcount=supplier.basketcount subscriptioncount=supplier.subscriptioncount %]
117                 [% END %]
118
119                 <div class="baskets">
120                     [% IF ( supplier.loop_basket.size ) %]
121                         <table class="baskets">
122                             <thead>
123                                 <tr>
124                                     <th>No.</th>
125                                     <th>Name</th>
126                                     <th>Item count</th>
127                                     <th>Bibliographic record count</th>
128                                     <th>Items expected</th>
129                                     <th>[% tp('basket created by', 'Created by') | html %]</th>
130                                     <th>Date</th>
131                                     <th>Basket group</th>
132                                     <th>Closed</th>
133                                     <th class="noExport">Actions</th>
134                                 </tr>
135                             </thead>
136                             <tbody>
137                                 [% FOREACH basket IN supplier.loop_basket %]
138                                     [% IF ( basket.uncertainprices ) %]
139                                         <tr class="problem">
140                                     [% ELSE %]
141                                         <tr>
142                                     [% END %]
143                                         <td>[% basket.basketno | html %]</td>
144                                         <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">[% basket.basketname | html %]</a></td>
145                                         <td data-order="[% basket.total_items | html %]">
146                                             [% basket.total_items | html %]
147                                             [% IF basket.total_items_cancelled %]
148                                                 ([% basket.total_items_cancelled | html %] cancelled)
149                                             [% END %]
150                                         </td>
151                                         <td data-order="[% basket.total_biblios | html %]">
152                                             [% basket.total_biblios | html %]
153                                             [% IF basket.total_biblios_cancelled %]
154                                                 ([% basket.total_biblios_cancelled | html %] cancelled)
155                                             [% END %]
156                                         </td>
157                                         <td>[% basket.expected_items | html %]</td>
158                                         <td>
159                                             [% IF basket.authorisedby %]
160                                                 [% basket.authorisedby.firstname | html %]
161                                                 [% basket.authorisedby.surname | html %]
162                                             [% END %]
163                                         </td>
164                                         <td data-order="[% basket.creationdate | html %]">[% basket.creationdate | $KohaDates %]</td>
165                                         <td>
166                                           [% IF basket.basketgroup %]
167                                             [% basketgroup = basket.basketgroup %]
168                                             [% IF basketgroup.closed %]
169                                               [% basketgroup.name | html %] <span>(closed)</span>
170                                             [% ELSE %]
171                                               <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basket.booksellerid | uri %]&amp;basketgroupid=[% basketgroup.id | uri %]">[% basketgroup.name | html %]</a>
172                                             [% END %]
173                                           [% END %]
174                                         </td>
175                                         <td data-order="[% basket.closedate | html %]">
176                                             [% basket.closedate | $KohaDates %]
177                                         </td>
178                                         <td class="actions">
179                                         [% IF not basket.closedate and supplier.active %]
180                                             [% IF basket.uncertainprices OR ( basket.total_items && !basket.is_standing ) %]
181                                             <div class="dropup">
182                                                 <div class="btn-group">
183                                                 [%# There should be no space between these two buttons, it would render badly %]
184                                                     <a class="btn btn-default btn-xs" id="addtoBasketLabel[% basket.basketno | html %]" href="#addtoBasket[% basket.basketno | html %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a><a class="btn btn-default btn-xs dropdown-toggle" id="basketactions[% basket.basknetno | html %]" role="button" data-toggle="dropdown" href="#"><b class="caret"></b></a>
185                                                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="basketactions[% basketn.basketno | html %]">
186                                                         [% IF basket.uncertainprices %]
187                                                         <li><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% basket.booksellerid | uri %]&owner=1"><i class="fa fa-usd"></i> Uncertain prices</a></li>
188                                                         [% ELSIF basket.total_items && !basket.is_standing %]
189                                                         <li><a href="/cgi-bin/koha/acqui/basket.pl?op=close&basketno=[% basket.basketno | uri %]&booksellerid=[% basket.booksellerid | uri %]"><i class="fa fa-times-circle"></i> Close this basket</a></li>
190                                                         [% END %]
191                                                     </ul>
192                                                 </div>
193                                             </div>
194                                             [% ELSE %]
195                                                 <a class="btn btn-default btn-xs" id="addtoBasketLabel[% basket.basketno | html %]" href="#addtoBasket[% basket.basketno | html %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a>
196                                             [% END %]
197                                             <!-- Modal -->
198                                             <div id="addtoBasket[% basket.basketno | html %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno | html %]" aria-hidden="true" data-basketno="[% basket.basketname | html %]">
199                                                 <div class="modal-dialog" role="document">
200                                                     <div class="modal-content">
201                                                         <div class="modal-header">
202                                                             <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
203                                                             <h4 class="modal-title" id="addtoBasketLabel[% basket.basketno | html %]">Add order to basket</h4>
204                                                         </div>
205                                                         <div class="modal-body">
206                                                             [% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
207                                                         </div>
208                                                         <div class="modal-footer">
209                                                             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
210                                                         </div>
211                                                     </div><!-- /.modal-content -->
212                                                 </div><!-- /.modal-dialog -->
213                                             </div><!-- /.modal -->
214                                         [% END %]
215                                         </td>
216                                     </tr>
217                                 [% END %][%# FOREACH basket IN supplier.loop_basket %]
218                             </tbody>
219                         </table>
220
221                     [% ELSE %]
222                         <p>
223                             No pending baskets.
224                             [% IF ( supplier.basketcount > 0 && count > 1 ) %]
225                                 <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=1&booksellerid=[% supplier.booksellerid | uri %]&allbaskets=1">View all baskets</a>.
226                             [% END %]
227                         </p>
228
229                     [% END %][%# IF ( supplier.loop_basket.size ) %]
230                 </div>
231             </div>
232         [% END %][%# FOREACH supplier IN loop_suppliers %]
233     </div>
234 [% END %][%# IF ( loop_suppliers.size ) %]
235 </main>
236 </div> <!-- /.col-sm-10.col-sm-push-2 -->
237     <div class="col-sm-2 col-sm-pull-10">
238         <aside>
239             [% IF ( booksellerid ) %]
240                 [% INCLUDE 'vendor-menu.inc' %]
241             [% END %]
242             [% INCLUDE 'acquisitions-menu.inc' %]
243         </aside>
244     </div>
245 </div> <!-- /.row -->
246
247 [% MACRO jsinclude BLOCK %]
248     [% Asset.js("js/acquisitions-menu.js") | $raw %]
249     [% INCLUDE 'datatables.inc' %]
250     [% Asset.js("js/acq.js") | $raw %]
251     <script>
252         $(document).ready(function() {
253             $("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
254                 'sDom': 't',
255                 'bPaginate': false,
256                 'bFilter': false,
257                 'bInfo': false,
258                 "aaSorting": [[ 1, "asc" ]],
259                 "aoColumnDefs": [
260                     { 'aTargets': [-1], 'bSortable': false }
261                 ]
262             }));
263             $("#supplierlist").change(function() {
264                 var id = $(this).find("option:selected").val();
265                 window.location.href = "#" + id;
266             });
267             $(".modal").on("shown.bs.modal", function(){
268                 var basket = $(this).data("basketno");
269                 var legend = _("Add order to basket %s").format(basket);
270                 $(this).find("h4").text( legend );
271                 $(this).find("legend").html(legend);
272                 $(this).find("input:text").focus();
273             });
274             $("#show_all_vendors").hide();
275             $("#show_active_vendors").on('click', function(e){
276                 e.preventDefault();
277                 $(".inactive").hide();
278                 $("#show_active_vendors").hide();
279                 $("#show_all_vendors").show();
280             });
281             $("#show_all_vendors").on('click', function(e){
282                 e.preventDefault();
283                 $(".inactive").show();
284                 $("#show_all_vendors").hide();
285                 $("#show_active_vendors").show();
286             });
287         });
288     </script>
289 [% END %]
290
291 [% INCLUDE 'intranet-bottom.inc' %]