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