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