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