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

(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-24 / +16 lines)
Lines 1-5 Link Here
1
/* global __ */
1
/* global __ */
2
2
3
function CheckRenewCheckinBoxes() {
4
    $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
5
    $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
6
}
3
7
4
function RefreshIssuesTable() {
8
function RefreshIssuesTable() {
5
    var table = $('#issues-table').DataTable();
9
    var table = $('#issues-table').DataTable();
Lines 10-30 function RefreshIssuesTable() { Link Here
10
        return this.value;
14
        return this.value;
11
    }).get();
15
    }).get();
12
    table.ajax.reload( function() {
16
    table.ajax.reload( function() {
13
        $('#RenewChecked, #CheckinChecked').prop('disabled' , true );
17
        CheckRenewCheckinBoxes();
14
        if ( renewchecked.length ) {
18
        var checkout_count = table.page.info().recordsTotal;
15
            $('#RenewChecked').prop('disabled' , false );
19
        $('.checkout_count').text(checkout_count);
16
            renewchecked.forEach( function(checked) {
17
                $('.renew[value="'+checked+'"]').prop('checked' , true );
18
            });
19
        }
20
        if ( checkinchecked.length ) {
21
            $('#CheckinChecked').prop('disabled' , false );
22
            checkinchecked.forEach( function(checked) {
23
                $('.checkin[value="'+checked+'"]').prop('checked' , true );
24
            });
25
        }
26
    var checkout_count = table.page.info().recordsTotal;
27
    $('.checkout_count').text(checkout_count);
28
    });
20
    });
29
}
21
}
30
22
Lines 437-442 function LoadIssuesTable() { Link Here
437
            }
429
            }
438
        },
430
        },
439
        "initComplete": function(oSettings, json) {
431
        "initComplete": function(oSettings, json) {
432
            CheckRenewCheckinBoxes();
433
440
            // Build a summary of checkouts grouped by itemtype
434
            // Build a summary of checkouts grouped by itemtype
441
            var checkoutsByItype = json.aaData.reduce(function (obj, row) {
435
            var checkoutsByItype = json.aaData.reduce(function (obj, row) {
442
                obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1;
436
                obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1;
Lines 502-514 $(document).ready(function() { Link Here
502
    $("#CheckAllRenewals").on("click",function(){
496
    $("#CheckAllRenewals").on("click",function(){
503
        $("#UncheckAllCheckins").click();
497
        $("#UncheckAllCheckins").click();
504
        $(".renew:visible").prop("checked", true);
498
        $(".renew:visible").prop("checked", true);
505
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
499
        CheckRenewCheckinBoxes();
506
        showHideOnHoldRenewal();
500
        showHideOnHoldRenewal();
507
        return false;
501
        return false;
508
    });
502
    });
509
    $("#UncheckAllRenewals").on("click",function(){
503
    $("#UncheckAllRenewals").on("click",function(){
510
        $(".renew:visible").prop("checked", false);
504
        $(".renew:visible").prop("checked", false);
511
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
505
        CheckRenewCheckinBoxes();
512
        showHideOnHoldRenewal();
506
        showHideOnHoldRenewal();
513
        return false;
507
        return false;
514
    });
508
    });
Lines 516-527 $(document).ready(function() { Link Here
516
    $("#CheckAllCheckins").on("click",function(){
510
    $("#CheckAllCheckins").on("click",function(){
517
        $("#UncheckAllRenewals").click();
511
        $("#UncheckAllRenewals").click();
518
        $(".checkin:visible").prop("checked", true);
512
        $(".checkin:visible").prop("checked", true);
519
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
513
        CheckRenewCheckinBoxes();
520
        return false;
514
        return false;
521
    });
515
    });
522
    $("#UncheckAllCheckins").on("click",function(){
516
    $("#UncheckAllCheckins").on("click",function(){
523
        $(".checkin:visible").prop("checked", false);
517
        $(".checkin:visible").prop("checked", false);
524
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
518
        CheckRenewCheckinBoxes();
525
        return false;
519
        return false;
526
    });
520
    });
527
521
Lines 540-554 $(document).ready(function() { Link Here
540
        if ( $(this).is(":checked") ) {
534
        if ( $(this).is(":checked") ) {
541
            $( "#checkin_" + $(this).val() ).prop("checked", false);
535
            $( "#checkin_" + $(this).val() ).prop("checked", false);
542
        }
536
        }
543
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
537
        CheckRenewCheckinBoxes();
544
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
545
    });
538
    });
546
    $(document).on("change", '.checkin', function(){
539
    $(document).on("change", '.checkin', function(){
547
        if ( $(this).is(":checked") ) {
540
        if ( $(this).is(":checked") ) {
548
            $( "#renew_" + $(this).val() ).prop("checked", false);
541
            $( "#renew_" + $(this).val() ).prop("checked", false);
549
        }
542
        }
550
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
543
        CheckRenewCheckinBoxes();
551
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
552
    });
544
    });
553
545
554
    // Display on hold due dates input when an on hold item is
546
    // Display on hold due dates input when an on hold item is
Lines 647-652 $(document).ready(function() { Link Here
647
            $('#RenewChecked, #CheckinChecked').prop('disabled' , true );
639
            $('#RenewChecked, #CheckinChecked').prop('disabled' , true );
648
        });
640
        });
649
641
642
        CheckRenewCheckinBoxes();
650
        // Prevent form submit
643
        // Prevent form submit
651
        return false;
644
        return false;
652
    });
645
    });
653
- 

Return to bug 36060