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