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