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 4-103 Link Here
4
[% USE Price %]
4
[% USE Price %]
5
[% USE Koha %]
5
[% USE Koha %]
6
[% PROCESS 'i18n.inc' %]
6
[% PROCESS 'i18n.inc' %]
7
[% SET footerjs = 1 %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
8
<title>[% FILTER collapse %]
9
<title>[% FILTER collapse %]
9
    [% tx("Basket grouping for '{vendor}'", { vendor = booksellername }) %] &rsaquo;
10
    [% tx("Basket grouping for '{vendor}'", { vendor = booksellername }) %] &rsaquo;
10
    [% t("Koha") | html %]
11
    [% t("Koha") | html %]
11
[% END %]</title>
12
[% END %]</title>
12
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'datatables.inc' %]
14
<script>
15
16
    var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
17
    var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
18
    var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
19
    var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
20
    var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
21
22
    function submitForm(form) {
23
        if (form.close.checked == true) {
24
            var input = document.createElement("input");
25
            input.setAttribute("type", "hidden");
26
            input.setAttribute("name", "closed");
27
            input.setAttribute("value", "1");
28
            form.appendChild(input);
29
        }
30
    }
31
32
    function closeandprint(bg){
33
        if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=' + bg ){
34
            setTimeout("window.location.reload();", 3000);
35
        } else {
36
            alert(MSG_FILE_DOWNLOAD_ERROR);
37
        }
38
    }
39
40
    $(document).ready(function() {
41
        [% IF ( listclosed) %]
42
            $("#basket_groups a[href='#closed']").tab("show");
43
        [% ELSE %]
44
            $("#basket_groups a[href='#opened']").tab("show");
45
        [% END %]
46
        [% UNLESS ( grouping ) %]
47
            $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
48
                "aoColumnDefs": [
49
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
50
                ],
51
                "bAutoWidth": false,
52
                "sPaginationType": "full"
53
            } ));
54
        [% ELSE %]
55
            grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, {
56
                "dom": 't',
57
                "columnDefs": [
58
                    { 'sortable': false, 'targets': [ 'NoSort' ] }
59
                ],
60
                'autoWidth': false,
61
                "language": {
62
                    "emptyTable": _("There are no baskets in this group")
63
                }
64
            } ));
65
            ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, {
66
                "dom": 't',
67
                "columnDefs": [
68
                    { 'sortable': false, 'targets': [ 'NoSort' ] }
69
                ],
70
                'autoWidth': false,
71
                "language": {
72
                    "emptyTable": _("There are no ungrouped baskets")
73
                }
74
            } ));
75
        [% END %]
76
77
        $("#basketgroupcolumns").on("click", ".addtogroup", function(){
78
            const row = $("#" + $(this).data("basketid") );
79
            if( row ){
80
                $(this).removeClass("addtogroup").addClass("removefromgroup").html("<i class=\"fa fa-trash-can\" aria-hidden=\"true\"></i> " + _("Remove") );
81
                row.removeClass("ungrouped").addClass("grouped");
82
                ungrouped.row( row ).remove().draw();
83
                grouped.row.add( row ).draw();
84
            }
85
        });
86
87
        $("#basketgroupcolumns").on("click", ".removefromgroup", function(){
88
            const row = $("#" + $(this).data("basketid") );
89
            if( row ){
90
                $(this).removeClass("removefromgroup").addClass("addtogroup").html("<i class=\"fa fa-plus\" aria-hidden=\"true\"></i> " + _("Add to group") );
91
                $(this).removeClass("").addClass("");
92
                row.removeClass("grouped").addClass("ungrouped");
93
                grouped.row( row ).remove().draw();
94
                ungrouped.row.add( row ).draw();
95
            }
96
        });
97
    });
98
</script>
99
100
</head>
14
</head>
15
101
<body id="acq_basketgroup" class="acq">
16
<body id="acq_basketgroup" class="acq">
102
[% WRAPPER 'header.inc' %]
17
[% WRAPPER 'header.inc' %]
103
    [% INCLUDE 'acquisitions-search.inc' %]
18
    [% INCLUDE 'acquisitions-search.inc' %]
Lines 205-211 Link Here
205
                        [% ELSE %]
120
                        [% ELSE %]
206
                            <div class="col-xs-6 col-xs-pull-6">
121
                            <div class="col-xs-6 col-xs-pull-6">
207
                        [% END %]
122
                        [% END %]
208
                            <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform" onsubmit="return submitForm(this)">
123
                            <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post" id="groupingform">
209
                                <fieldset id="various" class="brief">
124
                                <fieldset id="various" class="brief">
210
                                    <ol>
125
                                    <ol>
211
                                        [% UNLESS (closedbg) %]
126
                                        [% UNLESS (closedbg) %]
Lines 363-372 Link Here
363
                                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
278
                                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
364
                                                    <td>[% basketgroup.basketsqty | html %]</td>
279
                                                    <td>[% basketgroup.basketsqty | html %]</td>
365
                                                    <td>
280
                                                    <td>
366
                                                        <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
281
                                                        <input type="button" id="close_and_print" data-basketgroupid="[% basketgroup.id | html %]" value="Close and export as PDF" />
367
                                                        <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>
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>
368
                                                        [% UNLESS basketgroup.basketsqty %]
283
                                                        [% UNLESS basketgroup.basketsqty %]
369
                                                            <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>
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>
370
                                                        [% END %]
285
                                                        [% END %]
371
                                                    </td>
286
                                                    </td>
372
                                                </tr>
287
                                                </tr>
Lines 410-416 Link Here
410
                                                        <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>
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>
411
                                                        [% IF Koha.Preference('EDIFACT') %]
326
                                                        [% IF Koha.Preference('EDIFACT') %]
412
                                                            [% IF (ediaccount) %]
327
                                                            [% IF (ediaccount) %]
413
                                                                 <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>
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>
414
                                                            [% ELSE %]
329
                                                            [% ELSE %]
415
                                                                <div>No EDIFACT configuration for [% booksellername | html %]</div>
330
                                                                <div>No EDIFACT configuration for [% booksellername | html %]</div>
416
                                                            [% END %]
331
                                                            [% END %]
Lines 437-440 Link Here
437
            </aside>
352
            </aside>
438
        </div>
353
        </div>
439
    </div> <!-- /.row -->
354
    </div> <!-- /.row -->
440
    [% INCLUDE 'intranet-bottom.inc' %]
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' %]
441
- 

Return to bug 34085