Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basketgroup.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Basket grouping for [% booksellername | html %]</title>
7 [% Asset.css("css/datatables.css") | $raw %]
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 [% Asset.js("lib/yui/utilities/utilities.js") | $raw %]
11 [% Asset.js("lib/yui/button/button-min.js") | $raw %]
12 [% Asset.js("lib/yui/container/container_core-min.js") | $raw %]
13 [% Asset.js("lib/yui/menu/menu-min.js") | $raw %]
14 [% Asset.js("js/basketgroup.js") | $raw %]
15 [% IF ( grouping ) %]
16 [% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") | $raw %]
17 [% Asset.js("lib/yui/animation/animation-min.js") | $raw %]
18 [% Asset.js("lib/yui/dragdrop/dragdrop-min.js") | $raw %]
19 [% Asset.js("lib/yui/element/element-min.js") | $raw %]
20 <style type="text/css">
21 /*margin and padding on body element
22   can introduce errors in determining
23   element position and are not recommended;
24   we turn them off as a foundation for YUI
25   CSS treatments. */
26
27 #ungrouped {
28         overflow: auto;
29         height: 400px;
30 }
31
32 .draglist{
33         width: 200px;
34         height: 300px;
35         overflow: auto;
36 }
37
38 div.workarea_alt { padding: 5px; float:left; width: 95%;}
39 div.closed { background-color: pink; padding:10px; float:left; width: 45%;}
40
41 ul.draglist {
42     position: relative;
43     background: #EEE;
44     padding-bottom:10;
45     border: 1px inset gray;
46     list-style: none;
47     margin:0;
48     padding: 5px;
49 }
50
51 ul.draglist li {
52     margin: 1px;
53     cursor: move;
54     list-style: none;
55 }
56
57 ul.draglist_alt {
58     position: relative;
59     border: 1px solid gray;
60     list-style: none;
61     margin: 0;
62     background: #f7f7f7;
63     padding: 5px;
64     cursor: move;
65 }
66
67 ul.draglist_alt li {
68     margin: 1px;
69     list-style: none;
70 }
71
72 li.grouped {
73     background-color: #D1E6EC;
74     border:1px solid #7EA6B2;
75     list-style: none;
76 }
77
78 li.ungrouped {
79     background-color: #D8D4E2;
80     border:1px solid #6B4C86;
81 }
82
83 fieldset.various li {
84     list-style: none;
85     clear: none;
86 }
87
88 </style>
89  [% END %]
90 <script type="text/javascript">
91 //<![CDATA[
92         YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
93
94 var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
95 var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
96 var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
97 var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
98 var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
99
100 function submitForm(form) {
101     if (form.close.checked == true) {
102         var input = document.createElement("input");
103         input.setAttribute("type", "hidden");
104         input.setAttribute("name", "closed");
105         input.setAttribute("value", "1");
106         form.appendChild(input);
107     }
108 }
109
110  $(document).ready(function() {
111     $("#basket_groups").tabs();
112
113     $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
114         "aoColumnDefs": [
115             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
116         ],
117         "bAutoWidth": false,
118         "sPaginationType": "four_button"
119     } ));
120
121  });
122
123
124 //]]>
125 </script>
126 </head>
127 <body id="acq_basketgroup" class="acq">
128 [% INCLUDE 'header.inc' %]
129 [% INCLUDE 'acquisitions-search.inc' %]
130
131 <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;
132 [% IF ( grouping ) %]
133     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]">Basket grouping</a> &rsaquo; Add basket group for [% booksellername | html %]</div>
134 [% ELSE %]
135     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; Basket grouping</div>
136 [% END %]
137
138
139 <div class="main container-fluid">
140     <div class="row">
141         <div class="col-sm-10 col-sm-push-2">
142             <main>
143
144                 [% IF ( grouping ) %]
145                     [% IF (closedbg) %]
146                         <div id="toolbar" class="btn-toolbar">
147                             <div class="btn-group"><a href="[% script_name | html %]?op=reopen&amp;basketgroupid=[% basketgroupid | html %]&amp;booksellerid=[% booksellerid | html %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
148                             <div class="btn-group"><a href="[% script_name | html %]?op=export&amp;basketgroupid=[% basketgroupid | html %]&amp;booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
149                             <div class="btn-group"><a href="[% script_name | html %]?op=print&amp;basketgroupid=[% basketgroupid | html %]&amp;booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
150                             <div class="btn-group"><a href="[% script_name | html %]?op=ediprint&amp;basketgroupid=[% basketgroupid | html %]&amp;booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
151                         </div>
152                     [% END %]
153                     [% IF (name && closedbg) %]
154                         <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
155                     [% ELSIF (name) %]
156                         <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
157                     [% ELSE %]
158                         <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
159                     [% END %]
160                     <div id="basketgroupcolumns" class="row">
161                         [% UNLESS (closedbg) %]
162                             <div class="col-xs-6 col-xs-push-6">
163                                 <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
164                                     <div id="groups">
165                                         <fieldset class="brief">
166                                             <div class="workarea_alt" >
167                                                 <h3>Ungrouped baskets</h3>
168                                                 <ul id="ungrouped" class="draglist_alt">
169                                                     [% IF ( baskets ) %]
170                                                         [% FOREACH basket IN baskets %]
171                                                             <li class="ungrouped" id="b-[% basket.basketno | html %]" >
172                                                                 <a href="basket.pl?basketno=[% basket.basketno | html %]">
173                                                                     [% IF ( basket.basketname ) %]
174                                                                         [% basket.basketname | html %]
175                                                                     [% ELSE %]
176                                                                         No name, basketnumber: [% basket.basketno | html %]
177                                                                     [% END %]
178                                                                 </a>, <br />
179                                                                 Total: [% basket.total | $Price | html %]
180                                                                 <input type="hidden" class="basket" name="basket" value="[% basket.basketno | html %]" />
181                                                             </li>
182                                                         [% END %]
183                                                     [% END %]
184                                                 </ul>
185                                             </div>
186                                         </fieldset>
187                                     </div>
188                                 </form>
189                             </div>
190                         [% END %]
191                         [% IF ( closedbg ) %]
192                             <div class="col-xs-12">
193                         [% ELSE %]
194                             <div class="col-xs-6 col-xs-pull-6">
195                         [% END %]
196                             <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
197                                 <fieldset id="various" class="brief">
198                                     <ol>
199                                         [% UNLESS (closedbg) %]
200                                             <li>
201                                                 <label for="basketgroupname">Basket group name:</label>
202                                                 <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
203                                             </li>
204                                         [% ELSE %]
205                                             <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
206                                         [% END %]
207                                         <li>
208                                             [% UNLESS (closedbg) %]
209                                                 <label for="billingplace">Billing place:</label>
210                                                 <select name="billingplace" id="billingplace">
211                                                     <option value="">--</option>
212                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
213                                                 </select>
214                                             [% ELSE %]
215                                                 <span class="label">Billing place:</span>
216                                                 <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
217                                             [% END %]
218                                         </li>
219                                         [% UNLESS (closedbg) %]
220                                             <li>
221                                                 <label for="deliveryplace">Delivery place:</label>
222                                                 <select name="deliveryplace" id="deliveryplace">
223                                                     <option value="">--</option>
224                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
225                                                 </select>
226                                             </li>
227                                             <li><p>or</p></li>
228                                             <li>
229                                                 <label for="freedeliveryplace">Delivery place:</label>
230                                                 <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace | html %]</textarea>
231                                             </li>
232                                             [% ELSE %]
233                                                 <li>
234                                                     <span class="label">Delivery place:</span>
235                                                     [% IF (freedeliveryplace) %]
236                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace | html %]" />[% freedeliveryplace | html %]
237                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
238                                                     [% ELSE %]
239                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace | html %]" />[% Branches.GetName( deliveryplace ) | html %]
240                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
241                                                     [% END %]
242                                                 </li>
243                                             [% END %]
244                                             <li>
245                                                 [% UNLESS (closedbg) %]
246                                                     <label for="deliverycomment">Delivery comment:</label>
247                                                     <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment | html %]</textarea>
248                                                 [% ELSE %]
249                                                     <span class="label">Delivery comment:</span>[% deliverycomment | html %]
250                                                     <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment | html %]" />
251                                                 [% END %]
252                                             </li>
253                                             <li>
254                                                 <span class="label">Baskets in this group:</span>
255                                                 [% UNLESS (closedbg) %]
256                                                     <ul class="draglist" id="bg">
257                                                 [% ELSE %]
258                                                     <ul>
259                                                 [% END %]
260                                                 [% FOREACH selectedbasket IN selectedbaskets %]
261                                                     <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
262                                                         <a href="basket.pl?basketno=[% selectedbasket.basketno | html %]">
263                                                             [% IF ( selectedbasket.basketname ) %]
264                                                                 [% selectedbasket.basketname | html %]
265                                                             [% ELSE %]
266                                                                 No name, basketnumber: [% selectedbasket.basketno | html %]
267                                                             [% END %]
268                                                         </a>, <br />
269                                                         Total: [% selectedbasket.total | $Price | html %]
270                                                         <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno | html %]" />
271                                                     </li>
272                                                 [% END %]
273                                             </ul>
274                                         </li>
275                                             [% UNLESS (closedbg) %]
276                                                 <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
277                                             [% ELSE %]
278                                                 <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
279                                             [% END %]
280                                     </ol>
281                                 </fieldset>
282                                 [% UNLESS (closedbg) %]
283                                     <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
284                                         [% IF ( basketgroupid ) %]
285                                             <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" />
286                                         [% END %]
287                                         <input type="hidden" name="op" value="attachbasket" />
288                                         <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]" class="cancel">Cancel</a>
289                                     </fieldset>
290                                 [% END %]
291                             </form>
292                         </div>
293                     </div>
294                 [% ELSE %]
295                     <div id="toolbar" class="btn-toolbar">
296                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
297                     </div>
298                     <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
299                     <div id="basket_groups" class="toptabs">
300                         <ul class="ui-tabs-nav">
301                             [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
302                             [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
303                             [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
304                             [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
305                         </ul>
306                         <div id="opened">
307                             <table id="basket_group_opened">
308                                 <thead>
309                                     <tr>
310                                         <th>Name</th>
311                                         <th>Number</th>
312                                         <th>Billing place</th>
313                                         <th>Delivery place</th>
314                                         <th>Number of baskets</th>
315                                         <th>Action</th>
316                                     </tr>
317                                 </thead>
318                                 <tbody>
319                                     [% FOREACH basketgroup IN basketgroups %]
320                                         [% UNLESS ( basketgroup.closed ) %]
321                                             <tr>
322                                                 <td>[% IF ( basketgroup.name ) %]
323                                                     [% basketgroup.name | html %]
324                                                     [% ELSE %]
325                                                         Basket group no. [% basketgroup.id | html %]
326                                                     [% END %]
327                                                 </td>
328                                                 <td>[% basketgroup.id | html %]</td>
329                                                 <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
330                                                 <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
331                                                 <td>[% basketgroup.basketsqty | html %]</td>
332                                                 <td>
333                                                     <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
334                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Edit" /></form>
335                                                     [% UNLESS basketgroup.basketsqty %]
336                                                         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Delete" /></form>
337                                                     [% END %]
338                                                 </td>
339                                             </tr>
340                                         [% END %]
341                                     [% END %]
342                                 </tbody>
343                             </table>
344                         </div>
345                         <div id="closed">
346                             <table id="basket_group_closed">
347                                 <thead>
348                                     <tr>
349                                         <th>Name</th>
350                                         <th>Number</th>
351                                         <th>Billing place</th>
352                                         <th>Delivery place</th>
353                                         <th>Number of baskets</th>
354                                         <th>Action</th>
355                                     </tr>
356                                 </thead>
357                                 <tbody>
358                                     [% FOREACH basketgroup IN basketgroups %]
359                                         [% IF ( basketgroup.closed ) %]
360                                             <tr>
361                                                 <td>
362                                                     [% IF ( basketgroup.name ) %]
363                                                         [% basketgroup.name | html %]
364                                                         [% ELSE %]
365                                                             Basket group no. [% basketgroup.id | html %]
366                                                         [% END %]
367                                                 </td>
368                                                 <td>[% basketgroup.id | html %]</td>
369                                                 <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
370                                                 <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
371                                                 <td>[% basketgroup.basketsqty | html %]</td>
372                                                 <td>
373                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="View" /></form>
374                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Reopen" /></form>
375                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as PDF" /></form>
376                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="export" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as CSV" /></form>
377                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="ediprint" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Generate EDIFACT order" /></form>
378                                                 </td>
379                                             </tr>
380                                         [% END %]
381                                     [% END %]
382                                 </tbody>
383                             </table>
384                         </div>
385                     </div>
386                 [% END %]
387             </main>
388         </div> <!-- /.col-sm-10.col-sm-push-2 -->
389
390         <div class="col-sm-2 col-sm-pull-10">
391             <aside>
392                 [% IF ( booksellerid ) %]
393                     [% INCLUDE 'vendor-menu.inc' %]
394                 [% END %]
395                 [% INCLUDE 'acquisitions-menu.inc' %]
396             </aside>
397         </div>
398     </div> <!-- /.row -->
399     [% INCLUDE 'intranet-bottom.inc' %]