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 430-435 function LoadIssuesTable() { Link Here
430
            }
422
            }
431
        },
423
        },
432
        "initComplete": function(oSettings, json) {
424
        "initComplete": function(oSettings, json) {
425
            CheckRenewCheckinBoxes();
426
433
            // Build a summary of checkouts grouped by itemtype
427
            // Build a summary of checkouts grouped by itemtype
434
            var checkoutsByItype = json.aaData.reduce(function (obj, row) {
428
            var checkoutsByItype = json.aaData.reduce(function (obj, row) {
435
                obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1;
429
                obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1;
Lines 495-507 $(document).ready(function() { Link Here
495
    $("#CheckAllRenewals").on("click",function(){
489
    $("#CheckAllRenewals").on("click",function(){
496
        $("#UncheckAllCheckins").click();
490
        $("#UncheckAllCheckins").click();
497
        $(".renew:visible").prop("checked", true);
491
        $(".renew:visible").prop("checked", true);
498
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
492
        CheckRenewCheckinBoxes();
499
        showHideOnHoldRenewal();
493
        showHideOnHoldRenewal();
500
        return false;
494
        return false;
501
    });
495
    });
502
    $("#UncheckAllRenewals").on("click",function(){
496
    $("#UncheckAllRenewals").on("click",function(){
503
        $(".renew:visible").prop("checked", false);
497
        $(".renew:visible").prop("checked", false);
504
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
498
        CheckRenewCheckinBoxes();
505
        showHideOnHoldRenewal();
499
        showHideOnHoldRenewal();
506
        return false;
500
        return false;
507
    });
501
    });
Lines 509-520 $(document).ready(function() { Link Here
509
    $("#CheckAllCheckins").on("click",function(){
503
    $("#CheckAllCheckins").on("click",function(){
510
        $("#UncheckAllRenewals").click();
504
        $("#UncheckAllRenewals").click();
511
        $(".checkin:visible").prop("checked", true);
505
        $(".checkin:visible").prop("checked", true);
512
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
506
        CheckRenewCheckinBoxes();
513
        return false;
507
        return false;
514
    });
508
    });
515
    $("#UncheckAllCheckins").on("click",function(){
509
    $("#UncheckAllCheckins").on("click",function(){
516
        $(".checkin:visible").prop("checked", false);
510
        $(".checkin:visible").prop("checked", false);
517
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
511
        CheckRenewCheckinBoxes();
518
        return false;
512
        return false;
519
    });
513
    });
520
514
Lines 533-547 $(document).ready(function() { Link Here
533
        if ( $(this).is(":checked") ) {
527
        if ( $(this).is(":checked") ) {
534
            $( "#checkin_" + $(this).val() ).prop("checked", false);
528
            $( "#checkin_" + $(this).val() ).prop("checked", false);
535
        }
529
        }
536
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
530
        CheckRenewCheckinBoxes();
537
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
538
    });
531
    });
539
    $(document).on("change", '.checkin', function(){
532
    $(document).on("change", '.checkin', function(){
540
        if ( $(this).is(":checked") ) {
533
        if ( $(this).is(":checked") ) {
541
            $( "#renew_" + $(this).val() ).prop("checked", false);
534
            $( "#renew_" + $(this).val() ).prop("checked", false);
542
        }
535
        }
543
        $('#CheckinChecked').prop('disabled', !$('.checkin:checked').length );
536
        CheckRenewCheckinBoxes();
544
        $('#RenewChecked').prop('disabled', !$('.renew:checked').length );
545
    });
537
    });
546
538
547
    // Display on hold due dates input when an on hold item is
539
    // Display on hold due dates input when an on hold item is
Lines 640-645 $(document).ready(function() { Link Here
640
            $('#RenewChecked, #CheckinChecked').prop('disabled' , true );
632
            $('#RenewChecked, #CheckinChecked').prop('disabled' , true );
641
        });
633
        });
642
634
635
        CheckRenewCheckinBoxes();
643
        // Prevent form submit
636
        // Prevent form submit
644
        return false;
637
        return false;
645
    });
638
    });
646
- 

Return to bug 36060