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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt (-47 / +45 lines)
Lines 210-285 Link Here
210
        <script>
210
        <script>
211
            var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'acq_acqui-home', 'accounts', 'json' ) | $raw %];
211
            var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'acq_acqui-home', 'accounts', 'json' ) | $raw %];
212
        </script>
212
        </script>
213
214
        <script>
213
        <script>
215
            dt_overwrite_html_sorting_localeCompare();
214
            dt_overwrite_html_sorting_localeCompare();
216
215
217
            $(document).ready(function() {
216
            $(document).ready(function () {
218
                var oTable = $("#accounts").kohaTable({
217
                var oTable = $("#accounts").kohaTable(
219
                    drawCallback: function ( oSettings ) {
218
                    {
220
                        if ( oSettings.aiDisplay.length == 0 )
219
                        drawCallback: function (oSettings) {
221
                        {
220
                            if (oSettings.aiDisplay.length == 0) {
222
                            return;
221
                                return;
223
                        }
222
                            }
224
223
225
                        var nTrs = $('#accounts tbody tr');
224
                            var nTrs = $("#accounts tbody tr");
226
                        var iColspan = nTrs[0].getElementsByTagName('td').length;
225
                            var iColspan = nTrs[0].getElementsByTagName("td").length;
227
                        var sLastGroup = "";
226
                            var sLastGroup = "";
228
                        for ( var i=0 ; i<nTrs.length ; i++ )
227
                            for (var i = 0; i < nTrs.length; i++) {
229
                        {
228
                                var iDisplayIndex = oSettings._iDisplayStart + i;
230
                            var iDisplayIndex = oSettings._iDisplayStart + i;
229
                                var sGroup = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[1];
231
                            var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
230
                                if (sGroup != sLastGroup) {
232
                            if ( sGroup != sLastGroup )
231
                                    var nGroup = document.createElement("tr");
233
                            {
232
                                    var nCell = document.createElement("td");
234
                                var nGroup = document.createElement( 'tr' );
233
                                    nCell.colSpan = iColspan;
235
                                var nCell = document.createElement( 'td' );
234
                                    nCell.className = "group";
236
                                nCell.colSpan = iColspan;
235
                                    nCell.innerHTML = sGroup;
237
                                nCell.className = "group";
236
                                    nGroup.appendChild(nCell);
238
                                nCell.innerHTML = sGroup;
237
                                    nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
239
                                nGroup.appendChild( nCell );
238
                                    sLastGroup = sGroup;
240
                                nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
239
                                }
241
                                sLastGroup = sGroup;
242
                            }
240
                            }
243
                        }
241
                        },
244
                    },
242
                        footerCallback: function (row, data, start, end, display) {
245
                    footerCallback: function ( row, data, start, end, display ) {
243
                            var api = this.api(),
246
                        var api = this.api(), data;
244
                                data;
247
                        footer_column_sum( api, [ 6, 7, 8, 9 ] );
245
                            footer_column_sum(api, [6, 7, 8, 9]);
246
                        },
247
                        columnDefs: [{ orderable: false, targets: ["_all"] }],
248
                        ordering: true,
249
                        orderFixed: [[1, "asc"]],
250
                        paging: false,
251
                        autoWidth: false,
248
                    },
252
                    },
249
                    columnDefs: [
253
                    table_settings
250
                        { "orderable": false, "targets": ["_all"] }
254
                );
251
                    ],
252
                    ordering: true,
253
                    orderFixed: [[ 1, 'asc' ]],
254
                    paging: false,
255
                    autoWidth: false
256
                }, table_settings );
257
                let table_dt = oTable.DataTable();
255
                let table_dt = oTable.DataTable();
258
256
259
                $(oTable).treetable({
257
                $(oTable).treetable({
260
                    expandable: true
258
                    expandable: true,
261
                });
259
                });
262
                $(oTable).treetable('expandAll');
260
                $(oTable).treetable("expandAll");
263
                $("#expand_all").click(function(e){
261
                $("#expand_all").click(function (e) {
264
                    e.preventDefault();
262
                    e.preventDefault();
265
                    $(oTable).treetable('expandAll');
263
                    $(oTable).treetable("expandAll");
266
                });
264
                });
267
                $("#collapse_all").click(function(e){
265
                $("#collapse_all").click(function (e) {
268
                    e.preventDefault();
266
                    e.preventDefault();
269
                    $(oTable).treetable('collapseAll');
267
                    $(oTable).treetable("collapseAll");
270
                });
268
                });
271
269
272
                $("#hide_inactive").click(function(e){
270
                $("#hide_inactive").click(function (e) {
273
                    e.preventDefault();
271
                    e.preventDefault();
274
                    table_dt.columns(0).search(1).draw(); // Show only active=1
272
                    table_dt.columns(0).search(1).draw(); // Show only active=1
275
                });
273
                });
276
                $("#show_inactive").click(function(e){
274
                $("#show_inactive").click(function (e) {
277
                    e.preventDefault();
275
                    e.preventDefault();
278
                    table_dt.columns(0).search("").draw();
276
                    table_dt.columns(0).search("").draw();
279
                });
277
                });
280
                $("#hide_inactive").click();
278
                $("#hide_inactive").click();
281
279
282
                $("#library-filter").change(function(){
280
                $("#library-filter").change(function () {
283
                    $("#accounts").DataTable().search(this.value);
281
                    $("#accounts").DataTable().search(this.value);
284
                    $("#accounts").DataTable().draw();
282
                    $("#accounts").DataTable().draw();
285
                });
283
                });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-56 / +59 lines)
Lines 1406-1507 Link Here
1406
        </script>
1406
        </script>
1407
    [% END # /UNLESS (closedate) %]
1407
    [% END # /UNLESS (closedate) %]
1408
    <script>
1408
    <script>
1409
            var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %];
1409
        var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %];
1410
1410
1411
            let supplier_report_column = table_settings.columns.find(c => c.columnname == 'supplier_report');
1411
        let supplier_report_column = table_settings.columns.find(c => c.columnname == 'supplier_report');
1412
            [% IF !(Koha.Preference('EDIFACT') && ediaccount) %]
1412
        [% IF !(Koha.Preference('EDIFACT') && ediaccount) %]
1413
                supplier_report_column.is_hidden = 1;
1413
            supplier_report_column.is_hidden = 1;
1414
                supplier_report_column.cannot_be_toggled = 1;
1414
            supplier_report_column.cannot_be_toggled = 1;
1415
            [% ELSE %]
1415
        [% ELSE %]
1416
                supplier_report_column.is_hidden = 0;
1416
            supplier_report_column.is_hidden = 0;
1417
            [% END %]
1417
        [% END %]
1418
            supplier_report_column.force_visibility = 1;
1418
        supplier_report_column.force_visibility = 1;
1419
1419
1420
            let modify_column = table_settings.columns.find(c => c.columnname == 'modify');
1420
        let modify_column = table_settings.columns.find(c => c.columnname == 'modify');
1421
            [% IF ( active && !closedate ) %]
1421
        [% IF ( active && !closedate ) %]
1422
                modify_column.is_hidden = 0;
1422
            modify_column.is_hidden = 0;
1423
            [% ELSE %]
1423
        [% ELSE %]
1424
                modify_column.is_hidden = 1;
1424
            modify_column.is_hidden = 1;
1425
            [% END %]
1425
        [% END %]
1426
            modify_column.force_visibility = 1;
1426
        modify_column.force_visibility = 1;
1427
1427
1428
            let cancel_column = table_settings.columns.find(c => c.columnname == 'cancel');
1428
        let cancel_column = table_settings.columns.find(c => c.columnname == 'cancel');
1429
            [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %]
1429
        [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %]
1430
                cancel_column.is_hidden = 0;
1430
            cancel_column.is_hidden = 0;
1431
            [% ELSE %]
1431
        [% ELSE %]
1432
                cancel_column.is_hidden = 1;
1432
            cancel_column.is_hidden = 1;
1433
            [% END %]
1433
        [% END %]
1434
            cancel_column.force_visibility = 1;
1434
        cancel_column.force_visibility = 1;
1435
1435
1436
            let skip_confirm_reopen = [% skip_confirm_reopen ? 1 : 0 %];
1436
        let skip_confirm_reopen = [% skip_confirm_reopen ? 1 : 0 %];
1437
    </script>
1437
    </script>
1438
1439
    <script>
1438
    <script>
1440
        $(document).ready(function() {
1439
        $(document).ready(function () {
1441
            $("#orders").kohaTable({
1440
            $("#orders").kohaTable(
1442
                bKohaColumnsUseNames: true,
1441
                {
1443
                pagingType: "full",
1442
                    bKohaColumnsUseNames: true,
1444
                autoWidth: false,
1443
                    pagingType: "full",
1445
            }, table_settings);
1444
                    autoWidth: false,
1445
                },
1446
                table_settings
1447
            );
1446
1448
1447
            $("#cancelledorderst").kohaTable({
1449
            $("#cancelledorderst").kohaTable({
1448
                pagingType: "full"
1450
                pagingType: "full",
1449
            });
1451
            });
1450
            $("#reopenform").on("submit",function(e){
1452
            $("#reopenform").on("submit", function (e) {
1451
                var is_confirmed = skip_confirm_reopen || confirm(_("Are you sure you want to reopen this basket?"));
1453
                var is_confirmed = skip_confirm_reopen || confirm(_("Are you sure you want to reopen this basket?"));
1452
                if( is_confirmed ){ return true; }
1454
                if (is_confirmed) {
1453
                else{ return false }
1455
                    return true;
1456
                } else {
1457
                    return false;
1458
                }
1454
            });
1459
            });
1455
            // Generates a dynamic link for exporting the selections data as CSV
1460
            // Generates a dynamic link for exporting the selections data as CSV
1456
            $("#exportbutton, #export-csv-menu a").click(function() {
1461
            $("#exportbutton, #export-csv-menu a").click(function () {
1457
                // Building the url from currently checked boxes
1462
                // Building the url from currently checked boxes
1458
                var url = '/cgi-bin/koha/acqui/basket.pl';
1463
                var url = "/cgi-bin/koha/acqui/basket.pl";
1459
                url += $('#exportbutton').attr('href');
1464
                url += $("#exportbutton").attr("href");
1460
                if($(this).attr("data-value")) {
1465
                if ($(this).attr("data-value")) {
1461
                    url += '&amp;csv_profile=' + $(this).attr("data-value");
1466
                    url += "&amp;csv_profile=" + $(this).attr("data-value");
1462
                }
1467
                }
1463
                // And redirecting to the CSV page
1468
                // And redirecting to the CSV page
1464
                location.href = url;
1469
                location.href = url;
1465
                return false;
1470
                return false;
1466
            });
1471
            });
1467
            $("#select_managing_library").on("change", function(){
1472
            $("#select_managing_library").on("change", function () {
1468
                $(this).parent().submit();
1473
                $(this).parent().submit();
1469
            });
1474
            });
1470
1475
1471
            $(".edit_delivery_date").on("click", function(e) {
1476
            $(".edit_delivery_date").on("click", function (e) {
1472
                e.preventDefault();
1477
                e.preventDefault();
1473
                var ordernumber = $(this).data("ordernumber");
1478
                var ordernumber = $(this).data("ordernumber");
1474
                var order_number_text = _("(order number %s)").format(ordernumber);
1479
                var order_number_text = _("(order number %s)").format(ordernumber);
1475
                var modalTitle = $(this).attr("title") + " " + order_number_text;
1480
                var modalTitle = $(this).attr("title") + " " + order_number_text;
1476
                var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date");
1481
                var delivery_date = $("#delivery_date_" + ordernumber).data("delivery_date");
1477
                const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr;
1482
                const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr;
1478
                estimated_delivery_date.setDate( delivery_date );
1483
                estimated_delivery_date.setDate(delivery_date);
1479
                $("#dateEditor .modal-title").text(modalTitle);
1484
                $("#dateEditor .modal-title").text(modalTitle);
1480
                $("#date_ordernumber").val(ordernumber);
1485
                $("#date_ordernumber").val(ordernumber);
1481
                $("#dateEditor").modal("show");
1486
                $("#dateEditor").modal("show");
1482
            });
1487
            });
1483
1488
1484
             $("#dateEditor").on('hidden.bs.modal', function (e) {
1489
            $("#dateEditor").on("hidden.bs.modal", function (e) {
1485
                $("#dateEditorLabel").html("");
1490
                $("#dateEditorLabel").html("");
1486
                $("#dateEditor .modal-title").text("");
1491
                $("#dateEditor .modal-title").text("");
1487
                $("#estimated_delivery_date").html( "" );
1492
                $("#estimated_delivery_date").html("");
1488
                $("#date_ordernumber").val("");
1493
                $("#date_ordernumber").val("");
1489
            });
1494
            });
1490
        });
1495
        });
1491
1496
1492
        function add_user(borrowernumber, borrowername) {
1497
        function add_user(borrowernumber, borrowername) {
1493
            var ids = $("#users_ids").val();
1498
            var ids = $("#users_ids").val();
1494
            if(ids.length > 0) {
1499
            if (ids.length > 0) {
1495
                ids = ids.split(':');
1500
                ids = ids.split(":");
1496
            } else {
1501
            } else {
1497
                ids = new Array;
1502
                ids = new Array();
1498
            }
1503
            }
1499
            if (ids.indexOf(borrowernumber.toString()) < 0) {
1504
            if (ids.indexOf(borrowernumber.toString()) < 0) {
1500
                ids.push(borrowernumber);
1505
                ids.push(borrowernumber);
1501
                $("#users_ids").val(ids.join(':'));
1506
                $("#users_ids").val(ids.join(":"));
1502
                var li = '<li id="user_'+borrowernumber+'">'+borrowername
1507
                var li = '<li id="user_' + borrowernumber + '">' + borrowername + ' <a href="#" data-borrowernumber="' + borrowernumber + '" class="del_user"><i class="fa fa-trash-can"></i> ' + _("Delete user") + "</a></li>";
1503
                + ' <a href="#" data-borrowernumber="'+borrowernumber+'" class="del_user"><i class="fa fa-trash-can"></i> '
1504
                    + _("Delete user") + '</a></li>';
1505
                $("#users_names").prepend(li);
1508
                $("#users_names").prepend(li);
1506
                $("#add_user_submit").show();
1509
                $("#add_user_submit").show();
1507
                return 0;
1510
                return 0;
Lines 1510-1519 Link Here
1510
        }
1513
        }
1511
1514
1512
        function del_user(borrowernumber) {
1515
        function del_user(borrowernumber) {
1513
            $("#user_"+borrowernumber).remove();
1516
            $("#user_" + borrowernumber).remove();
1514
            var ids = $("#users_ids").val().split(':');
1517
            var ids = $("#users_ids").val().split(":");
1515
            ids.splice(ids.indexOf(borrowernumber.toString()), 1);
1518
            ids.splice(ids.indexOf(borrowernumber.toString()), 1);
1516
            $("#users_ids").val(ids.join(':'));
1519
            $("#users_ids").val(ids.join(":"));
1517
            $("#add_user_submit").show();
1520
            $("#add_user_submit").show();
1518
        }
1521
        }
1519
    </script>
1522
    </script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-24 / +28 lines)
Lines 400-406 Link Here
400
        let listclosed = [% listclosed ? 1 : 0 %];
400
        let listclosed = [% listclosed ? 1 : 0 %];
401
        let grouping = [% grouping ? 1 : 0 %];
401
        let grouping = [% grouping ? 1 : 0 %];
402
    </script>
402
    </script>
403
404
    <script>
403
    <script>
405
        function submitForm(form) {
404
        function submitForm(form) {
406
            if (form.closedbg.checked == true) {
405
            if (form.closedbg.checked == true) {
Lines 413-436 Link Here
413
            form.submit();
412
            form.submit();
414
        }
413
        }
415
414
416
        function closeandprint(bg){
415
        function closeandprint(bg) {
417
            if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=' + bg ){
416
            if ((document.location = "/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&amp;basketgroupid=" + bg)) {
418
                setTimeout(() => {
417
                setTimeout(() => {
419
                    window.location.reload();
418
                    window.location.reload();
420
                }, 3000);
419
                }, 3000);
421
            } else {
420
            } else {
422
                alert( _("Error downloading the file") );
421
                alert(_("Error downloading the file"));
423
            }
422
            }
424
        }
423
        }
425
424
426
        $(document).ready(function() {
425
        $(document).ready(function () {
427
            if (listclosed){
426
            if (listclosed) {
428
                $("#basket_groups a[href='#closed']").tab("show");
427
                $("#basket_groups a[href='#closed']").tab("show");
429
            } else {
428
            } else {
430
                $("#basket_groups a[href='#opened']").tab("show");
429
                $("#basket_groups a[href='#opened']").tab("show");
431
            }
430
            }
432
431
433
            if (!grouping){
432
            if (!grouping) {
434
                let dt_params = {
433
                let dt_params = {
435
                    autoWidth: false,
434
                    autoWidth: false,
436
                    pagingType: "full",
435
                    pagingType: "full",
Lines 456-494 Link Here
456
                });
455
                });
457
            }
456
            }
458
457
459
            $("#basketgroupcolumns").on("click", ".addtogroup", function(){
458
            $("#basketgroupcolumns").on("click", ".addtogroup", function () {
460
                const row = $("#" + $(this).data("basketid") );
459
                const row = $("#" + $(this).data("basketid"));
461
                if( row ){
460
                if (row) {
462
                    $(this).removeClass("addtogroup").addClass("removefromgroup").html("<i class=\"fa fa-trash-can\" aria-hidden=\"true\"></i> " + _("Remove") );
461
                    $(this)
462
                        .removeClass("addtogroup")
463
                        .addClass("removefromgroup")
464
                        .html('<i class="fa fa-trash-can" aria-hidden="true"></i> ' + _("Remove"));
463
                    row.removeClass("ungrouped").addClass("grouped");
465
                    row.removeClass("ungrouped").addClass("grouped");
464
                    ungrouped.row( row ).remove().draw();
466
                    ungrouped.row(row).remove().draw();
465
                    grouped.row.add( row ).draw();
467
                    grouped.row.add(row).draw();
466
                }
468
                }
467
            });
469
            });
468
470
469
            $("#basketgroupcolumns").on("click", ".removefromgroup", function(){
471
            $("#basketgroupcolumns").on("click", ".removefromgroup", function () {
470
                const row = $("#" + $(this).data("basketid") );
472
                const row = $("#" + $(this).data("basketid"));
471
                if( row ){
473
                if (row) {
472
                    $(this).removeClass("removefromgroup").addClass("addtogroup").html("<i class=\"fa fa-plus\" aria-hidden=\"true\"></i> " + _("Add to group") );
474
                    $(this)
475
                        .removeClass("removefromgroup")
476
                        .addClass("addtogroup")
477
                        .html('<i class="fa fa-plus" aria-hidden="true"></i> ' + _("Add to group"));
473
                    $(this).removeClass("").addClass("");
478
                    $(this).removeClass("").addClass("");
474
                    row.removeClass("grouped").addClass("ungrouped");
479
                    row.removeClass("grouped").addClass("ungrouped");
475
                    grouped.row( row ).remove().draw();
480
                    grouped.row(row).remove().draw();
476
                    ungrouped.row.add( row ).draw();
481
                    ungrouped.row.add(row).draw();
477
                }
482
                }
478
            });
483
            });
479
484
480
            $("#close_and_print").on("click", function(e){
485
            $("#close_and_print").on("click", function (e) {
481
                e.preventDefault();
486
                e.preventDefault();
482
                const basketgroupid = $(this).data("basketgroupid");
487
                const basketgroupid = $(this).data("basketgroupid");
483
                closeandprint( basketgroupid );
488
                closeandprint(basketgroupid);
484
            });
489
            });
485
490
486
            $("#groupingform").on("submit", function(e){
491
            $("#groupingform").on("submit", function (e) {
487
                e.preventDefault();
492
                e.preventDefault();
488
                submitForm(this);
493
                submitForm(this);
489
            });
494
            });
490
495
491
            $("#delete_basketgroup").on("click", function(e){
496
            $("#delete_basketgroup").on("click", function (e) {
492
                return confirm(_("Are you sure you want to delete this basket group?"));
497
                return confirm(_("Are you sure you want to delete this basket group?"));
493
            });
498
            });
494
        });
499
        });
495
- 

Return to bug 41324