Bug 5356: delivery place and billing place centralised in basket management
[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                                 <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></li>
212                         <li><label for="deliveryplace">Delivery place:</label>
213                                                         <select name="deliveryplace" id="deliveryplace" style="width:13em;">
214                                                                 <option value="">--</option>
215                                                                 [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
216                                         [% IF ( deliveryplaceloo.selected ) %]<option value="[% deliveryplaceloo.value %]" selected="selected">[% deliveryplaceloo.branchname %]</option>
217                                         [% ELSE %]<option value="[% deliveryplaceloo.value %]">[% deliveryplaceloo.branchname %]</option>[% END %]
218                                                                 [% END %]
219                                                                                                 </select></li>
220                         <li><p>or</p></li>
221                         <li><label for="freedeliveryplace">Delivery place:</label>
222                             <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace %]</textarea></li>
223                                                 <li><label for="deliverycomment">Delivery comment:</label>
224                                                         <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment %]</textarea>
225                                                 </li>
226                                                 <li><span class="label">Baskets in this group:</span>
227                                                         <ul class="draglist" id="bg">
228                                                                 [% FOREACH selectedbasket IN selectedbaskets %]
229                                                     <li class="grouped" id="b-[% selectedbasket.basketno %]" >
230                                                         <a href="basket.pl?basketno=[% selectedbasket.basketno %]">
231                                                         [% IF ( selectedbasket.basketname ) %]
232                                                             [% selectedbasket.basketname %]
233                                                         [% ELSE %]
234                                                             No name, basketnumber: [% selectedbasket.basketno %]
235                                                         [% END %]
236                                                         </a>, <br />
237                                                         Total: [% selectedbasket.total %]
238                                                         <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno %]" />
239                                                     </li>
240                                             [% END %]
241                                                         </ul>
242                                                 </li>
243                                                 <li><label><input type="checkbox" id="close" name="close" /> Close basket group</label></li>
244                                                 </ol>
245                                         </fieldset>
246
247                         <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid %]" />
248                                 [% IF ( basketgroupid ) %]
249                                         <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
250                                 [% END %]
251                                 <input type="hidden" name="op" value="attachbasket" />
252                                 <input type="submit" value="Save" />
253                         </fieldset>
254                                 </form>
255                         </div> 
256                 </div>   
257     </div> 
258 [% ELSE %]
259         <div class="yui-g">
260         <div id="basket_groups" class="toptabs">
261         <ul class="ui-tabs-nav">
262         [% UNLESS ( closed ) %]<li class="ui-tabs-selected"><a href="#opened">Open</a></li>
263         [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
264         [% IF ( closed ) %]<li class="ui-tabs-selected"><a href="#closed">Closed</a></li>
265         [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
266     </ul>
267     <div id="opened">
268         <table id="basket_group_opened">
269                         <thead>
270                                 <tr>
271                     <th>Basket group</th><th>Action</th>
272                                 </tr>
273                         </thead>
274                         <tbody>
275                         [% FOREACH basketgroup IN basketgroups %]
276                                 [% UNLESS ( basketgroup.closed ) %]
277                                         <tr>
278                                                 <td><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basketgroup.booksellerid %]&amp;basketgroupid=[% basketgroup.id %]">[% IF ( basketgroup.name ) %]
279                                                                                                         [% basketgroup.name %]
280                                                                                                 [% ELSE %]
281                                                                                                         Basket group no. [% basketgroup.id %]
282                                                                                                 [% END %]</a>
283                                                 </td>
284                                                         <td>
285                               <span>
286                                                                 <input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and Print" />
287                                                                 <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>
288                                                                 <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>
289                               </span>
290                                                         </td>
291                                         </tr>
292                                 [% END %]
293                         [% END %]
294                         </tbody>
295                 </table>
296     </div>
297     <div id="closed">
298         <table id="basket_group_closed">
299                         <thead>
300                                 <tr>
301                     <th>Basket group</th><th>Action</th>
302                                 </tr>
303                         </thead>
304                         <tbody>
305                                 [% FOREACH basketgroup IN basketgroups %]
306                                 [% IF ( basketgroup.closed ) %]
307                                 <tr>
308                                 <td>
309                     <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=reopen&amp;booksellerid=[% basketgroup.booksellerid %]&amp;basketgroupid=[% basketgroup.id %]">[% IF ( basketgroup.name ) %]
310                                                                                         [% basketgroup.name %]
311                                                                                 [% ELSE %]
312                                                                                         Basket group no. [% basketgroup.id %]
313                                                                                 [% END %]</a>
314                                         </td>
315                                         <td>
316                                                         <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>
317                                                         <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>
318                                                         <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>
319                     </td>
320                                 </tr>
321                                 [% END %]
322                                 [% END %]
323                                 </tbody>
324                         </table>
325                         </div>
326                     </div>
327                     </div>
328 [% END %]
329
330 [% INCLUDE 'intranet-bottom.inc' %]