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