]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
Bug 32910: (follow-up) Replace v4 icon names with v6
[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 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Basket grouping for [% booksellername | html %] &rsaquo; Koha</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 <script>
11
12     var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
13     var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
14     var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
15     var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
16     var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
17
18     function submitForm(form) {
19         if (form.close.checked == true) {
20             var input = document.createElement("input");
21             input.setAttribute("type", "hidden");
22             input.setAttribute("name", "closed");
23             input.setAttribute("value", "1");
24             form.appendChild(input);
25         }
26     }
27
28     function closeandprint(bg){
29         if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=' + bg ){
30             setTimeout("window.location.reload();", 3000);
31         } else {
32             alert(MSG_FILE_DOWNLOAD_ERROR);
33         }
34     }
35
36     $(document).ready(function() {
37         [% IF ( listclosed) %]
38             $("#basket_groups a[href='#closed']").tab("show");
39         [% ELSE %]
40             $("#basket_groups a[href='#opened']").tab("show");
41         [% END %]
42         [% UNLESS ( grouping ) %]
43             $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
44                 "aoColumnDefs": [
45                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
46                 ],
47                 "bAutoWidth": false,
48                 "sPaginationType": "full"
49             } ));
50         [% ELSE %]
51             grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, {
52                 "dom": 't',
53                 "columnDefs": [
54                     { 'sortable': false, 'targets': [ 'NoSort' ] }
55                 ],
56                 'autoWidth': false,
57                 "language": {
58                     "emptyTable": _("There are no baskets in this group")
59                 }
60             } ));
61             ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, {
62                 "dom": 't',
63                 "columnDefs": [
64                     { 'sortable': false, 'targets': [ 'NoSort' ] }
65                 ],
66                 'autoWidth': false,
67                 "language": {
68                     "emptyTable": _("There are no ungrouped baskets")
69                 }
70             } ));
71         [% END %]
72
73         $("#basketgroupcolumns").on("click", ".addtogroup", function(){
74             const row = $("#" + $(this).data("basketid") );
75             if( row ){
76                 $(this).removeClass("addtogroup").addClass("removefromgroup").html("<i class=\"fa fa-trash-can\" aria-hidden=\"true\"></i> " + _("Remove") );
77                 row.removeClass("ungrouped").addClass("grouped");
78                 ungrouped.row( row ).remove().draw();
79                 grouped.row.add( row ).draw();
80             }
81         });
82
83         $("#basketgroupcolumns").on("click", ".removefromgroup", function(){
84             const row = $("#" + $(this).data("basketid") );
85             if( row ){
86                 $(this).removeClass("removefromgroup").addClass("addtogroup").html("<i class=\"fa fa-plus\" aria-hidden=\"true\"></i> " + _("Add to group") );
87                 $(this).removeClass("").addClass("");
88                 row.removeClass("grouped").addClass("ungrouped");
89                 grouped.row( row ).remove().draw();
90                 ungrouped.row.add( row ).draw();
91             }
92         });
93     });
94 </script>
95
96 </head>
97 <body id="acq_basketgroup" class="acq">
98 [% WRAPPER 'header.inc' %]
99     [% INCLUDE 'acquisitions-search.inc' %]
100 [% END %]
101
102 [% WRAPPER 'sub-header.inc' %]
103     [% WRAPPER breadcrumbs %]
104         [% WRAPPER breadcrumb_item %]
105             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
106         [% END %]
107         [% IF ( grouping ) %]
108             [% WRAPPER breadcrumb_item %]
109                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
110             [% END %]
111             [% WRAPPER breadcrumb_item %]
112                 <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]">Basket grouping</a>
113             [% END %]
114             [% WRAPPER breadcrumb_item bc_active= 1 %]
115                 <span>Add basket group for [% booksellername | html %]</span>
116             [% END %]
117         [% ELSE %]
118             [% WRAPPER breadcrumb_item %]
119                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
120             [% END %]
121             [% WRAPPER breadcrumb_item bc_active= 1 %]
122                 <span>Basket grouping</span>
123             [% END %]
124         [% END  # /IF grouping %]
125     [% END #/ WRAPPER breadcrumbs %]
126 [% END #/ WRAPPER sub-header.inc %]
127
128 <div class="main container-fluid">
129     <div class="row">
130         <div class="col-sm-10 col-sm-push-2">
131             <main>
132
133                 [% IF ( grouping ) %]
134                     [% IF (closedbg) %]
135                         <div id="toolbar" class="btn-toolbar">
136                             <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>
137                             <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>
138                             <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>
139                         [% IF (ediaccount) %]
140                             <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>
141                         [% END %]
142                         </div>
143                     [% END %]
144                     [% IF (name && closedbg) %]
145                         <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
146                     [% ELSIF (name) %]
147                         <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
148                     [% ELSE %]
149                         <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
150                     [% END %]
151                     <div id="basketgroupcolumns" class="row">
152                         [% UNLESS (closedbg) %]
153                             <div class="col-xs-6 col-xs-push-6">
154                                     <div id="groups">
155                                         <div class="workarea_alt" >
156                                             <h3>Ungrouped baskets</h3>
157                                                 <div class="page-section">
158                                                     <table id="ungrouped" class="basketgroup_baskets">
159                                                         <thead>
160                                                             <tr>
161                                                                 <th>Basket</th>
162                                                                 <th>Total</th>
163                                                                 <th class="NoSort"></th>
164                                                             </tr>
165                                                         </thead>
166                                                         <tbody>
167                                                             [% IF ( baskets ) %]
168                                                                 [% FOREACH basket IN baskets %]
169                                                                     <tr class="ungrouped" id="b-[% basket.basketno | html %]">
170                                                                         <td>
171                                                                             <a href="basket.pl?basketno=[% basket.basketno | uri %]">
172                                                                                 [% IF ( basket.basketname ) %]
173                                                                                     [% basket.basketname | html %]
174                                                                                 [% ELSE %]
175                                                                                     <span>No name, basketnumber: [% basket.basketno | html %]</span>
176                                                                                 [% END %]
177                                                                             </a>
178                                                                         </td>
179                                                                         <td data-sort="[% basket.total | html %]">
180                                                                             [% basket.total | $Price %]
181                                                                             <input type="hidden" class="basket" name="basket" value="[% basket.basketno | html %]" />
182                                                                         </td>
183                                                                         <td>
184                                                                             <a class="addtogroup btn btn-default btn-xs" data-basketid="b-[% basket.basketno | html %]">
185                                                                                 <i class="fa fa-plus" aria-hidden="true"></i> Add to group
186                                                                             </a>
187                                                                         </td>
188                                                                     </tr>
189                                                                 [% END %]
190                                                             [% END %]
191                                                         </tbody>
192                                                     </table>
193                                                 </div><!--/.page-section -->
194                                         </div><!-- /#groups -->
195                                     </div><!-- /.col-xs-6 -->
196
197                             </div>
198                         [% END %]
199                         [% IF ( closedbg ) %]
200                             <div class="col-xs-12">
201                         [% ELSE %]
202                             <div class="col-xs-6 col-xs-pull-6">
203                         [% END %]
204                             <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform" onsubmit="return submitForm(this)">
205                                 <fieldset id="various" class="brief">
206                                     <ol>
207                                         [% UNLESS (closedbg) %]
208                                             <li>
209                                                 <label for="basketgroupname">Basket group name:</label>
210                                                 <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
211                                             </li>
212                                         [% ELSE %]
213                                             <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
214                                         [% END %]
215                                         <li>
216                                             [% UNLESS (closedbg) %]
217                                                 <label for="billingplace">Billing place:</label>
218                                                 <select name="billingplace" id="billingplace">
219                                                     <option value="">--</option>
220                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
221                                                 </select>
222                                             [% ELSE %]
223                                                 <span class="label">Billing place:</span>
224                                                 <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
225                                             [% END %]
226                                         </li>
227                                         [% UNLESS (closedbg) %]
228                                             <li>
229                                                 <label for="deliveryplace">Delivery place:</label>
230                                                 <select name="deliveryplace" id="deliveryplace">
231                                                     <option value="">--</option>
232                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
233                                                 </select>
234                                             </li>
235                                         </ol>
236                                         <p>or</p>
237                                         <ol>
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                                         </ol>
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-can" aria-hidden="true"></i> Remove
294                                                                 </a>
295                                                             [% END %]
296                                                         </td>
297                                                     </tr>
298                                                 [% END %]
299                                             </tbody>
300                                         </table>
301                                         [% UNLESS (closedbg) %]
302                                             <ol>
303                                                 <li><label for="closedbg">Close basket group</label><input type="checkbox" id="closedbg" name="closedbg" /></li>
304                                             </ol>
305                                         [% ELSE %]
306                                             <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
307                                         [% END %]
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" class="btn btn-primary" 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 && Koha.Preference('EDIFACT')) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %]
328
329                     [% WRAPPER tabs id= "basket_groups" %]
330                         [% WRAPPER tabs_nav %]
331                             [% WRAPPER tab_item tabname= "opened" bt_active= 1 %] <span>Open</span> [% END %]
332                             [% WRAPPER tab_item tabname= "closed" %] <span>Closed</span> [% END %]
333                         [% END %]
334                         [% WRAPPER tab_panels %]
335                             [% WRAPPER tab_panel tabname="opened" bt_active= 1 %]
336                                 <table id="basket_group_opened">
337                                     <thead>
338                                         <tr>
339                                             <th>Name</th>
340                                             <th>Number</th>
341                                             <th>Billing place</th>
342                                             <th>Delivery place</th>
343                                             <th>Number of baskets</th>
344                                             <th>Action</th>
345                                         </tr>
346                                     </thead>
347                                     <tbody>
348                                         [% FOREACH basketgroup IN basketgroups %]
349                                             [% UNLESS ( basketgroup.closed ) %]
350                                                 <tr>
351                                                     <td>[% IF ( basketgroup.name ) %]
352                                                         [% basketgroup.name | html %]
353                                                         [% ELSE %]
354                                                             <span>Basket group no. [% basketgroup.id | html %]</span>
355                                                         [% END %]
356                                                     </td>
357                                                     <td>[% basketgroup.id | html %]</td>
358                                                     <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
359                                                     <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
360                                                     <td>[% basketgroup.basketsqty | html %]</td>
361                                                     <td>
362                                                         <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
363                                                         <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>
364                                                         [% UNLESS basketgroup.basketsqty %]
365                                                             <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" class="btn btn-primary" value="Delete" /></form>
366                                                         [% END %]
367                                                     </td>
368                                                 </tr>
369                                             [% END %]
370                                         [% END %]
371                                     </tbody>
372                                 </table>
373                             [% END #/opened %]
374
375                             [% WRAPPER tab_panel tabname="closed" %]
376                                 <table id="basket_group_closed">
377                                     <thead>
378                                         <tr>
379                                             <th>Name</th>
380                                             <th>Number</th>
381                                             <th>Billing place</th>
382                                             <th>Delivery place</th>
383                                             <th>Number of baskets</th>
384                                             <th>Action</th>
385                                         </tr>
386                                     </thead>
387                                     <tbody>
388                                         [% FOREACH basketgroup IN basketgroups %]
389                                             [% IF ( basketgroup.closed ) %]
390                                                 <tr>
391                                                     <td>
392                                                         [% IF ( basketgroup.name ) %]
393                                                             [% basketgroup.name | html %]
394                                                             [% ELSE %]
395                                                                 <span>Basket group no. [% basketgroup.id | html %]</span>
396                                                             [% END %]
397                                                     </td>
398                                                     <td>[% basketgroup.id | html %]</td>
399                                                     <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
400                                                     <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
401                                                     <td>[% basketgroup.basketsqty | html %]</td>
402                                                     <td>
403                                                         <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>
404                                                         <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>
405                                                         <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>
406                                                         <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>
407                                                         [% IF Koha.Preference('EDIFACT') %]
408                                                             [% IF (ediaccount) %]
409                                                                  <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" class="btn btn-primary" value="Generate EDIFACT order" /></form>
410                                                             [% ELSE %]
411                                                                 <div>No EDIFACT configuration for [% booksellername | html %]</div>
412                                                             [% END %]
413                                                         [% END %]
414                                                     </td>
415                                                 </tr>
416                                             [% END %]
417                                         [% END %]
418                                     </tbody>
419                                 </table>
420                             [% END #/closed %]
421                         [% END # /WRAPPER tab_panels %]
422                     [% END # /#basket_groups %]
423                 [% END %]
424             </main>
425         </div> <!-- /.col-sm-10.col-sm-push-2 -->
426
427         <div class="col-sm-2 col-sm-pull-10">
428             <aside>
429                 [% IF ( booksellerid ) %]
430                     [% INCLUDE 'vendor-menu.inc' %]
431                 [% END %]
432                 [% INCLUDE 'acquisitions-menu.inc' %]
433             </aside>
434         </div>
435     </div> <!-- /.row -->
436     [% INCLUDE 'intranet-bottom.inc' %]