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