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