Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basketgroup.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Basket grouping for [% booksellername | html %] &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% INCLUDE 'datatables.inc' %]
9 <script>
10
11     var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
12     var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
13     var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
14     var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
15     var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
16
17     function submitForm(form) {
18         if (form.close.checked == true) {
19             var input = document.createElement("input");
20             input.setAttribute("type", "hidden");
21             input.setAttribute("name", "closed");
22             input.setAttribute("value", "1");
23             form.appendChild(input);
24         }
25     }
26
27     $(document).ready(function() {
28         [% IF ( listclosed) %]
29             $("#basket_groups a[href='#closed']").tab("show");
30         [% ELSE %]
31             $("#basket_groups a[href='#opened']").tab("show");
32         [% END %]
33         [% UNLESS ( grouping ) %]
34             $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
35                 "aoColumnDefs": [
36                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
37                 ],
38                 "bAutoWidth": false,
39                 "sPaginationType": "full"
40             } ));
41         [% ELSE %]
42             grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, {
43                 "dom": 't',
44                 "columnDefs": [
45                     { 'sortable': false, 'targets': [ 'NoSort' ] }
46                 ],
47                 'autoWidth': false,
48                 "language": {
49                     "emptyTable": _("There are no baskets in this group")
50                 }
51             } ));
52             ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, {
53                 "dom": 't',
54                 "columnDefs": [
55                     { 'sortable': false, 'targets': [ 'NoSort' ] }
56                 ],
57                 'autoWidth': false,
58                 "language": {
59                     "emptyTable": _("There are no ungrouped baskets")
60                 }
61             } ));
62         [% END %]
63
64         $("#basketgroupcolumns").on("click", ".addtogroup", function(){
65             const row = $("#" + $(this).data("basketid") );
66             if( row ){
67                 $(this).removeClass("addtogroup").addClass("removefromgroup").html("<i class=\"fa fa-trash\" aria-hidden=\"true\"></i> " + _("Remove") );
68                 row.removeClass("ungrouped").addClass("grouped");
69                 ungrouped.row( row ).remove().draw();
70                 grouped.row.add( row ).draw();
71             }
72         });
73
74         $("#basketgroupcolumns").on("click", ".removefromgroup", function(){
75             const row = $("#" + $(this).data("basketid") );
76             if( row ){
77                 $(this).removeClass("removefromgroup").addClass("addtogroup").html("<i class=\"fa fa-plus\" aria-hidden=\"true\"></i> " + _("Add to group") );
78                 $(this).removeClass("").addClass("");
79                 row.removeClass("grouped").addClass("ungrouped");
80                 grouped.row( row ).remove().draw();
81                 ungrouped.row.add( row ).draw();
82             }
83         });
84     });
85 </script>
86
87 </head>
88 <body id="acq_basketgroup" class="acq">
89 [% WRAPPER 'header.inc' %]
90     [% INCLUDE 'acquisitions-search.inc' %]
91 [% END %]
92
93 [% WRAPPER 'sub-header.inc' %]
94 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
95     <ol>
96         <li>
97             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
98         </li>
99         <li>
100             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
101         </li>
102
103     [% IF ( grouping ) %]
104         <li>
105             <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
106         </li>
107         <li>
108             <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]">Basket grouping</a>
109         </li>
110         <li>
111             <a href="#" aria-current="page">
112                 Add basket group for [% booksellername | html %]
113             </a>
114         </li>
115
116     [% ELSE %]
117         <li>
118             <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
119         </li>
120         <li>
121             <a href="#" aria-current="page">
122                 Basket grouping
123             </a>
124         </li>
125     [% END %]
126     </ol>
127 </nav>
128 [% END %]
129
130
131 <div class="main container-fluid">
132     <div class="row">
133         <div class="col-sm-10 col-sm-push-2">
134             <main>
135
136                 [% IF ( grouping ) %]
137                     [% IF (closedbg) %]
138                         <div id="toolbar" class="btn-toolbar">
139                             <div class="btn-group"><a href="[% script_name | url %]?op=reopen&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;mode=singlebg" class="btn btn-default" id="reopenbutton"><i class="fa fa-download"></i> Reopen basket group</a></div>
140                             <div class="btn-group"><a href="[% script_name | url %]?op=export&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="exportbutton"><i class="fa fa-download"></i> Export basket group as CSV</a></div>
141                             <div class="btn-group"><a href="[% script_name | url %]?op=print&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="printbutton"><i class="fa fa-download"></i> Print basket group in PDF</a></div>
142                         [% IF (ediaccount) %]
143                             <div class="btn-group"><a href="[% script_name | url %]?op=ediprint&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
144                         [% END %]
145                         </div>
146                     [% END %]
147                     [% IF (name && closedbg) %]
148                         <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
149                     [% ELSIF (name) %]
150                         <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
151                     [% ELSE %]
152                         <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
153                     [% END %]
154                     <div id="basketgroupcolumns" class="row">
155                         [% UNLESS (closedbg) %]
156                             <div class="col-xs-6 col-xs-push-6">
157
158                                     <div id="groups">
159                                         <div class="workarea_alt" >
160                                             <h3>Ungrouped baskets</h3>
161                                                 <table id="ungrouped" class="basketgroup_baskets">
162                                                     <thead>
163                                                         <tr>
164                                                             <th>Basket</th>
165                                                             <th>Total</th>
166                                                             <th class="NoSort"></th>
167                                                         </tr>
168                                                     </thead>
169                                                     <tbody>
170                                                         [% IF ( baskets ) %]
171                                                             [% FOREACH basket IN baskets %]
172                                                                 <tr class="ungrouped" id="b-[% basket.basketno | html %]">
173                                                                     <td>
174                                                                         <a href="basket.pl?basketno=[% basket.basketno | uri %]">
175                                                                             [% IF ( basket.basketname ) %]
176                                                                                 [% basket.basketname | html %]
177                                                                             [% ELSE %]
178                                                                                 <span>No name, basketnumber: [% basket.basketno | html %]</span>
179                                                                             [% END %]
180                                                                         </a>
181                                                                     </td>
182                                                                     <td data-sort="[% basket.total | html %]">
183                                                                         [% basket.total | $Price %]
184                                                                         <input type="hidden" class="basket" name="basket" value="[% basket.basketno | html %]" />
185                                                                     </td>
186                                                                     <td>
187                                                                         <a class="addtogroup btn btn-default btn-xs" data-basketid="b-[% basket.basketno | html %]">
188                                                                             <i class="fa fa-plus" aria-hidden="true"></i> Add to group
189                                                                         </a>
190                                                                     </td>
191                                                                 </tr>
192                                                             [% END %]
193                                                         [% END %]
194                                                     </tbody>
195                                                 </table>
196                                         </div>
197                                     </div>
198
199                             </div>
200                         [% END %]
201                         [% IF ( closedbg ) %]
202                             <div class="col-xs-12">
203                         [% ELSE %]
204                             <div class="col-xs-6 col-xs-pull-6">
205                         [% END %]
206                             <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform" onsubmit="return submitForm(this)">
207                                 <fieldset id="various" class="brief">
208                                     <ol>
209                                         [% UNLESS (closedbg) %]
210                                             <li>
211                                                 <label for="basketgroupname">Basket group name:</label>
212                                                 <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
213                                             </li>
214                                         [% ELSE %]
215                                             <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
216                                         [% END %]
217                                         <li>
218                                             [% UNLESS (closedbg) %]
219                                                 <label for="billingplace">Billing place:</label>
220                                                 <select name="billingplace" id="billingplace">
221                                                     <option value="">--</option>
222                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
223                                                 </select>
224                                             [% ELSE %]
225                                                 <span class="label">Billing place:</span>
226                                                 <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
227                                             [% END %]
228                                         </li>
229                                         [% UNLESS (closedbg) %]
230                                             <li>
231                                                 <label for="deliveryplace">Delivery place:</label>
232                                                 <select name="deliveryplace" id="deliveryplace">
233                                                     <option value="">--</option>
234                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
235                                                 </select>
236                                             </li>
237                                             <li><p>or</p></li>
238                                             <li>
239                                                 <label for="freedeliveryplace">Delivery place:</label>
240                                                 <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace | html %]</textarea>
241                                             </li>
242                                             [% ELSE %]
243                                                 <li>
244                                                     <span class="label">Delivery place:</span>
245                                                     [% IF (freedeliveryplace) %]
246                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace | html %]" />[% freedeliveryplace | html %]
247                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
248                                                     [% ELSE %]
249                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace | html %]" />[% Branches.GetName( deliveryplace ) | html %]
250                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
251                                                     [% END %]
252                                                 </li>
253                                             [% END %]
254                                             <li>
255                                                 [% UNLESS (closedbg) %]
256                                                     <label for="deliverycomment">Delivery comment:</label>
257                                                     <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment | html %]</textarea>
258                                                 [% ELSE %]
259                                                     <span class="label">Delivery comment:</span>[% deliverycomment | html %]
260                                                     <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment | html %]" />
261                                                 [% END %]
262                                             </li>
263                                             <li>
264                                                 <h3>Baskets in this group:</h3>
265                                                 <table id="grouped" class="basketgroup_baskets">
266                                                     <thead>
267                                                         <tr>
268                                                             <th>Basket</th>
269                                                             <th>Total</th>
270                                                             <th class="NoSort"></th>
271                                                         </tr>
272                                                     </thead>
273                                                     <tbody>
274                                                         [% FOREACH selectedbasket IN selectedbaskets %]
275                                                             <tr id="b-[% selectedbasket.basketno | html %]">
276                                                                 <td>
277                                                                     <a href="basket.pl?basketno=[% selectedbasket.basketno | uri %]">
278                                                                         [% IF ( selectedbasket.basketname ) %]
279                                                                             [% selectedbasket.basketname | html %]
280                                                                         [% ELSE %]
281                                                                             <span>No name, basketnumber: [% selectedbasket.basketno | html %]</span>
282                                                                         [% END %]
283                                                                     </a>
284                                                                 </td>
285                                                                 <td data-sort="[% selectedbasket.total | html %]">
286                                                                     [% selectedbasket.total | $Price %]
287                                                                     <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno | html %]" />
288                                                                 </td>
289                                                                 <td>
290                                                                     [% IF ( closedbg ) %]
291                                                                     [% ELSE %]
292                                                                         <a class="removefromgroup btn btn-default btn-xs" data-basketid="b-[% selectedbasket.basketno | html %]" id="addtogroup[% selectedbasket.basketno | html %]">
293                                                                             <i class="fa fa-trash" aria-hidden="true"></i> Remove
294                                                                         </a>
295                                                                     [% END %]
296                                                                 </td>
297                                                             </tr>
298                                                         [% END %]
299                                                     </tbody>
300                                                 </table>
301                                             </li>
302                                             [% UNLESS (closedbg) %]
303                                                 <li><label><input type="checkbox" id="closedbg" name="closedbg" /> Close basket group</label></li>
304                                             [% ELSE %]
305                                                 <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
306                                             [% END %]
307                                     </ol>
308                                 </fieldset>
309
310                                 [% UNLESS (closedbg) %]
311                                     <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
312                                         [% IF ( basketgroupid ) %]
313                                             <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" />
314                                         [% END %]
315                                         <input type="hidden" name="op" value="attachbasket" />
316                                         <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]" class="cancel">Cancel</a>
317                                     </fieldset>
318                                 [% END %]
319                             </form>
320                         </div>
321                     </div>
322                 [% ELSE %]
323                     <div id="toolbar" class="btn-toolbar">
324                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
325                     </div>
326                     <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
327                     [% IF (NoEDIMessage) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %]
328                     <div id="basket_groups" class="toptabs">
329                         <ul class="nav nav-tabs" role="tablist">
330                             <li role="presentation"><a href="#opened" aria-controls="opened" role="tab" data-toggle="tab">Open</a></li>
331                             <li role="presentation"><a href="#closed" aria-controls="closed" role="tab" data-toggle="tab">Closed</a></li>
332                         </ul>
333                         <div class="tab-content">
334                             <div role="tabpanel" class="tab-pane active" id="opened">
335                                 <table id="basket_group_opened">
336                                     <thead>
337                                         <tr>
338                                             <th>Name</th>
339                                             <th>Number</th>
340                                             <th>Billing place</th>
341                                             <th>Delivery place</th>
342                                             <th>Number of baskets</th>
343                                             <th>Action</th>
344                                         </tr>
345                                     </thead>
346                                     <tbody>
347                                         [% FOREACH basketgroup IN basketgroups %]
348                                             [% UNLESS ( basketgroup.closed ) %]
349                                                 <tr>
350                                                     <td>[% IF ( basketgroup.name ) %]
351                                                         [% basketgroup.name | html %]
352                                                         [% ELSE %]
353                                                             <span>Basket group no. [% basketgroup.id | html %]</span>
354                                                         [% END %]
355                                                     </td>
356                                                     <td>[% basketgroup.id | html %]</td>
357                                                     <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
358                                                     <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
359                                                     <td>[% basketgroup.basketsqty | html %]</td>
360                                                     <td>
361                                                         <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
362                                                         <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 | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Edit" /></form>
363                                                         [% UNLESS basketgroup.basketsqty %]
364                                                             <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 | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Delete" /></form>
365                                                         [% END %]
366                                                     </td>
367                                                 </tr>
368                                             [% END %]
369                                         [% END %]
370                                     </tbody>
371                                 </table>
372                             </div>
373                             <div role="tabpanel" class="tab-pane" id="closed">
374                                 <table id="basket_group_closed">
375                                     <thead>
376                                         <tr>
377                                             <th>Name</th>
378                                             <th>Number</th>
379                                             <th>Billing place</th>
380                                             <th>Delivery place</th>
381                                             <th>Number of baskets</th>
382                                             <th>Action</th>
383                                         </tr>
384                                     </thead>
385                                     <tbody>
386                                         [% FOREACH basketgroup IN basketgroups %]
387                                             [% IF ( basketgroup.closed ) %]
388                                                 <tr>
389                                                     <td>
390                                                         [% IF ( basketgroup.name ) %]
391                                                             [% basketgroup.name | html %]
392                                                             [% ELSE %]
393                                                                 <span>Basket group no. [% basketgroup.id | html %]</span>
394                                                             [% END %]
395                                                     </td>
396                                                     <td>[% basketgroup.id | html %]</td>
397                                                     <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
398                                                     <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
399                                                     <td>[% basketgroup.basketsqty | html %]</td>
400                                                     <td>
401                                                         <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 | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="View" /></form>
402                                                         <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 | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Reopen" /></form>
403                                                         <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 | html %]" /><input type="submit" value="Export as PDF" /></form>
404                                                         <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 | html %]" /><input type="submit" value="Export as CSV" /></form>
405                                                 [% IF (ediaccount) %]
406                                                         <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 | html %]" /><input type="submit" value="Generate EDIFACT order" /></form>
407                                                 [% ELSE %]
408                                                         <div>No EDIFACT configuration for [% booksellername | html %]</div>
409                                                 [% END %]
410                                                     </td>
411                                                 </tr>
412                                             [% END %]
413                                         [% END %]
414                                     </tbody>
415                                 </table>
416                             </div>
417                         </div>
418                     </div>
419                 [% END %]
420             </main>
421         </div> <!-- /.col-sm-10.col-sm-push-2 -->
422
423         <div class="col-sm-2 col-sm-pull-10">
424             <aside>
425                 [% IF ( booksellerid ) %]
426                     [% INCLUDE 'vendor-menu.inc' %]
427                 [% END %]
428                 [% INCLUDE 'acquisitions-menu.inc' %]
429             </aside>
430         </div>
431     </div> <!-- /.row -->
432     [% INCLUDE 'intranet-bottom.inc' %]