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