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