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