View | Details | Raw Unified | Return to bug 34085
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-93 / +105 lines)
Lines 3-99 Link Here
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Price %]
4
[% USE Price %]
5
[% USE Koha %]
5
[% USE Koha %]
6
[% SET footerjs = 1 %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Basket grouping for [% booksellername | html %] &rsaquo; Koha</title>
8
<title>Basket grouping for [% booksellername | html %] &rsaquo; Koha</title>
8
[% INCLUDE 'doc-head-close.inc' %]
9
[% 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>
10
</head>
11
97
<body id="acq_basketgroup" class="acq">
12
<body id="acq_basketgroup" class="acq">
98
[% WRAPPER 'header.inc' %]
13
[% WRAPPER 'header.inc' %]
99
    [% INCLUDE 'acquisitions-search.inc' %]
14
    [% INCLUDE 'acquisitions-search.inc' %]
Lines 201-207 Link Here
201
                        [% ELSE %]
116
                        [% ELSE %]
202
                            <div class="col-xs-6 col-xs-pull-6">
117
                            <div class="col-xs-6 col-xs-pull-6">
203
                        [% END %]
118
                        [% END %]
204
                            <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform" onsubmit="return submitForm(this)">
119
                            <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform">
205
                                <fieldset id="various" class="brief">
120
                                <fieldset id="various" class="brief">
206
                                    <ol>
121
                                    <ol>
207
                                        [% UNLESS (closedbg) %]
122
                                        [% UNLESS (closedbg) %]
Lines 359-368 Link Here
359
                                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
274
                                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
360
                                                    <td>[% basketgroup.basketsqty | html %]</td>
275
                                                    <td>[% basketgroup.basketsqty | html %]</td>
361
                                                    <td>
276
                                                    <td>
362
                                                        <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
277
                                                        <input type="button" id="close_and_print" data-basketgroupid="[% 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>
278
                                                        <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 %]
279
                                                        [% 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>
280
                                                            <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>
366
                                                        [% END %]
281
                                                        [% END %]
367
                                                    </td>
282
                                                    </td>
368
                                                </tr>
283
                                                </tr>
Lines 406-412 Link Here
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>
321
                                                        <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') %]
322
                                                        [% IF Koha.Preference('EDIFACT') %]
408
                                                            [% IF (ediaccount) %]
323
                                                            [% 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>
324
                                                                 <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>
410
                                                            [% ELSE %]
325
                                                            [% ELSE %]
411
                                                                <div>No EDIFACT configuration for [% booksellername | html %]</div>
326
                                                                <div>No EDIFACT configuration for [% booksellername | html %]</div>
412
                                                            [% END %]
327
                                                            [% END %]
Lines 433-436 Link Here
433
            </aside>
348
            </aside>
434
        </div>
349
        </div>
435
    </div> <!-- /.row -->
350
    </div> <!-- /.row -->
436
    [% INCLUDE 'intranet-bottom.inc' %]
351
352
[% MACRO jsinclude BLOCK %]
353
    [% INCLUDE 'datatables.inc' %]
354
    <script>
355
\        function submitForm(form) {
356
            if (form.closedbg.checked == true) {
357
                var input = document.createElement("input");
358
                input.setAttribute("type", "hidden");
359
                input.setAttribute("name", "closed");
360
                input.setAttribute("value", "1");
361
                form.appendChild(input);
362
            }
363
            form.submit();
364
        }
365
366
        function closeandprint(bg){
367
            if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=' + bg ){
368
                setTimeout("window.location.reload();", 3000);
369
            } else {
370
                alert( _("Error downloading the file") );
371
            }
372
        }
373
374
        $(document).ready(function() {
375
            [% IF ( listclosed) %]
376
                $("#basket_groups a[href='#closed']").tab("show");
377
            [% ELSE %]
378
                $("#basket_groups a[href='#opened']").tab("show");
379
            [% END %]
380
            [% UNLESS ( grouping ) %]
381
                $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
382
                    "aoColumnDefs": [
383
                        { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
384
                    ],
385
                    "bAutoWidth": false,
386
                    "sPaginationType": "full"
387
                } ));
388
            [% ELSE %]
389
                grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, {
390
                    "dom": 't',
391
                    "columnDefs": [
392
                        { 'sortable': false, 'targets': [ 'NoSort' ] }
393
                    ],
394
                    'autoWidth': false,
395
                    "language": {
396
                        "emptyTable": _("There are no baskets in this group")
397
                    }
398
                } ));
399
                ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, {
400
                    "dom": 't',
401
                    "columnDefs": [
402
                        { 'sortable': false, 'targets': [ 'NoSort' ] }
403
                    ],
404
                    'autoWidth': false,
405
                    "language": {
406
                        "emptyTable": _("There are no ungrouped baskets")
407
                    }
408
                } ));
409
            [% END %]
410
411
            $("#basketgroupcolumns").on("click", ".addtogroup", function(){
412
                const row = $("#" + $(this).data("basketid") );
413
                if( row ){
414
                    $(this).removeClass("addtogroup").addClass("removefromgroup").html("<i class=\"fa fa-trash-can\" aria-hidden=\"true\"></i> " + _("Remove") );
415
                    row.removeClass("ungrouped").addClass("grouped");
416
                    ungrouped.row( row ).remove().draw();
417
                    grouped.row.add( row ).draw();
418
                }
419
            });
420
421
            $("#basketgroupcolumns").on("click", ".removefromgroup", function(){
422
                const row = $("#" + $(this).data("basketid") );
423
                if( row ){
424
                    $(this).removeClass("removefromgroup").addClass("addtogroup").html("<i class=\"fa fa-plus\" aria-hidden=\"true\"></i> " + _("Add to group") );
425
                    $(this).removeClass("").addClass("");
426
                    row.removeClass("grouped").addClass("ungrouped");
427
                    grouped.row( row ).remove().draw();
428
                    ungrouped.row.add( row ).draw();
429
                }
430
            });
431
432
            $("#close_and_print").on("click", function(e){
433
                e.preventDefault();
434
                const basketgroupid = $(this).data("basketgroupid");
435
                closeandprint( basketgroupid );
436
            });
437
438
            $("#groupingform").on("submit", function(e){
439
                e.preventDefault();
440
                submitForm(this);
441
            });
442
443
            $("#delete_basketgroup").on("click", function(e){
444
                return confirm(_("Are you sure you want to delete this basket group?"));
445
            });
446
        });
447
    </script>
448
[% END %]
449
[% INCLUDE 'intranet-bottom.inc' %]
437
- 

Return to bug 34085