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