Bug 27982: Replace obsolete title-string sorting: Acquisitions templates part 1
[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>Koha &rsaquo; Search for vendor [% supplier | html %]</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 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     [% END %]
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     [% 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                 <span class="suppliername">
77                     [% IF (supplier.name) %]
78                         <a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">[% supplier.name | html %]</a>
79                     [% ELSE %]
80                         <a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">NO NAME</a>
81                     [% END %]
82                 </span>
83                 <span class="action">
84                     [% IF ( CAN_user_acquisition_order_manage ) %]
85                         [% IF ( supplier.active ) %]
86                             <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>
87                         [% ELSE %]
88                             (inactive)
89                         [% END %]
90                     [% END %]
91                         [% IF ( supplier.loop_basket.size ) %]
92                     <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>
93                         [% END %]
94                 </span>
95                 <div class="baskets">
96                     [% IF ( supplier.loop_basket.size ) %]
97                         <table class="baskets">
98                             <thead>
99                                 <tr>
100                                     <th>No.</th>
101                                     <th>Name</th>
102                                     <th>Item count</th>
103                                     <th>Bibliographic record count</th>
104                                     <th>Items expected</th>
105                                     <th>[% tp('basket created by', 'Created by') | html %]</th>
106                                     <th>Date</th>
107                                     <th>Basket group</th>
108                                     <th>Closed</th>
109                                     <th class="noExport">Actions</th>
110                                 </tr>
111                             </thead>
112                             <tbody>
113                                 [% FOREACH basket IN supplier.loop_basket %]
114                                     [% IF ( basket.uncertainprices ) %]
115                                         <tr class="problem">
116                                     [% ELSE %]
117                                         <tr>
118                                     [% END %]
119                                         <td>[% basket.basketno | html %]</td>
120                                         <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">[% basket.basketname | html %]</a></td>
121                                         <td data-order="[% basket.total_items | html %]">
122                                             [% basket.total_items | html %]
123                                             [% IF basket.total_items_cancelled %]
124                                                 ([% basket.total_items_cancelled | html %] cancelled)
125                                             [% END %]
126                                         </td>
127                                         <td data-order="[% basket.total_biblios | html %]">
128                                             [% basket.total_biblios | html %]
129                                             [% IF basket.total_biblios_cancelled %]
130                                                 ([% basket.total_biblios_cancelled | html %] cancelled)
131                                             [% END %]
132                                         </td>
133                                         <td>[% basket.expected_items | html %]</td>
134                                         <td>
135                                             [% IF basket.authorisedby %]
136                                                 [% basket.authorisedby.firstname | html %]
137                                                 [% basket.authorisedby.surname | html %]
138                                             [% END %]
139                                         </td>
140                                         <td data-order="[% basket.creationdate | html %]">[% basket.creationdate | $KohaDates %]</td>
141                                         <td>
142                                           [% IF basket.basketgroup %]
143                                             [% basketgroup = basket.basketgroup %]
144                                             [% IF basketgroup.closed %]
145                                               [% basketgroup.name | html %] (closed)
146                                             [% ELSE %]
147                                               <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basket.booksellerid | uri %]&amp;basketgroupid=[% basketgroup.id | uri %]">[% basketgroup.name | html %]</a>
148                                             [% END %]
149                                           [% END %]
150                                         </td>
151                                         <td data-order="[% basket.closedate | html %]">
152                                             [% basket.closedate | $KohaDates %]
153                                         </td>
154                                         <td class="actions">
155                                         [% IF not basket.closedate and supplier.active %]
156                                             [% IF basket.uncertainprices OR ( basket.total_items && !basket.is_standing ) %]
157                                             <div class="dropup">
158                                                 <div class="btn-group">
159                                                 [%# There should be no space between these two buttons, it would render badly %]
160                                                     <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>
161                                                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="basketactions[% basketn.basketno | html %]">
162                                                         [% IF basket.uncertainprices %]
163                                                         <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>
164                                                         [% ELSIF basket.total_items && !basket.is_standing %]
165                                                         <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>
166                                                         [% END %]
167                                                     </ul>
168                                                 </div>
169                                             </div>
170                                             [% ELSE %]
171                                                 <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>
172                                             [% END %]
173                                             <!-- Modal -->
174                                             <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 %]">
175                                                 <div class="modal-dialog">
176                                                     <div class="modal-content">
177                                                         <div class="modal-body">
178                                                             [% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
179                                                         </div>
180                                                         <div class="modal-footer">
181                                                             <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
182                                                         </div>
183                                                     </div>
184                                                 </div>
185                                             </div>
186                                         [% END %]
187                                         </td>
188                                     </tr>
189                                 [% END %][%# FOREACH basket IN supplier.loop_basket %]
190                             </tbody>
191                         </table>
192
193                     [% ELSE %]
194                         <p>No pending baskets</p>
195                     [% END %][%# IF ( supplier.loop_basket.size ) %]
196                 </div>
197             </div>
198         [% END %][%# FOREACH supplier IN loop_suppliers %]
199     </div>
200 [% END %][%# IF ( loop_suppliers.size ) %]
201 </main>
202 </div> <!-- /.col-sm-10.col-sm-push-2 -->
203     <div class="col-sm-2 col-sm-pull-10">
204         <aside>
205             [% IF ( booksellerid ) %]
206                 [% INCLUDE 'vendor-menu.inc' %]
207             [% END %]
208             [% INCLUDE 'acquisitions-menu.inc' %]
209         </aside>
210     </div>
211 </div> <!-- /.row -->
212
213 [% MACRO jsinclude BLOCK %]
214     [% Asset.js("js/acquisitions-menu.js") | $raw %]
215     [% INCLUDE 'datatables.inc' %]
216     [% Asset.js("js/acq.js") | $raw %]
217     <script>
218         $(document).ready(function() {
219             $("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
220                 'sDom': 't',
221                 'bPaginate': false,
222                 'bFilter': false,
223                 'bInfo': false,
224                 "aaSorting": [[ 1, "asc" ]],
225                 "aoColumnDefs": [
226                     { 'aTargets': [-1], 'bSortable': false }
227                 ]
228             }));
229             $("#supplierlist").change(function() {
230                 var id = $(this).find("option:selected").val();
231                 window.location.href = "#" + id;
232             });
233             $(".modal").on("show", function(){
234                 var basket = $(this).data("basketno");
235                 var legend = _("Add order to basket %s").format(basket);
236                 $(this).find("legend").html(legend);
237             });
238             $("#show_all_vendors").hide();
239             $("#show_active_vendors").on('click', function(e){
240                 e.preventDefault();
241                 $(".inactive").hide();
242                 $("#show_active_vendors").hide();
243                 $("#show_all_vendors").show();
244             });
245             $("#show_all_vendors").on('click', function(e){
246                 e.preventDefault();
247                 $(".inactive").show();
248                 $("#show_all_vendors").hide();
249                 $("#show_active_vendors").show();
250             });
251         });
252     </script>
253 [% END %]
254
255 [% INCLUDE 'intranet-bottom.inc' %]