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

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+43 lines)
Lines 4941-4943 div .suggestion_note { Link Here
4941
        }
4941
        }
4942
    }
4942
    }
4943
}
4943
}
4944
4945
.nav.nav-tabs > li > a {
4946
    align-items: center;
4947
    display: flex;
4948
    gap: 5px;
4949
4950
    span[class*=" label-"] {
4951
        color: #000;
4952
        font-size: 85%;
4953
        font-weight: bold;
4954
4955
        &.label-info {
4956
            background-color: #9BD6E8;
4957
        }
4958
4959
        &.label-danger {
4960
            background-color: #FF7873;
4961
        }
4962
4963
        &:has( span:empty + span:empty ), /* If the element contains two empty spans */
4964
        &:has( span:only-child:empty ) { /* If the element contains only one span and it is empty */
4965
            background-color: transparent;
4966
            padding: 0;
4967
        }
4968
4969
        &:has( span + span:empty ) { /* If the element has a non-empty span followed by an empty one, reset style */
4970
            background-color: #9BD6E8;
4971
            padding: .2em .6em .3em;
4972
        }
4973
    }
4974
}
4975
4976
.count-active { /* Add separator between two counts in a tab */
4977
    & + .count-inactive {
4978
        &:empty::before {
4979
            content: "";
4980
        }
4981
4982
        &::before {
4983
            content: " / ";
4984
        }
4985
    }
4986
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc (-26 / +51 lines)
Lines 4-91 Link Here
4
[% WRAPPER tabs id= "finesholdsissues" %]
4
[% WRAPPER tabs id= "finesholdsissues" %]
5
    [% WRAPPER tabs_nav %]
5
    [% WRAPPER tabs_nav %]
6
        [% WRAPPER tab_item tabname= "checkouts" bt_active= 1 %]
6
        [% WRAPPER tab_item tabname= "checkouts" bt_active= 1 %]
7
            <span>Checkouts (<span class="checkout_count">[% issuecount || 0 | html %]</span>)</span>
7
            <span>Checkouts</span>
8
            [% IF ( issuecount ) %]
9
                <span class="checkout_count label label-info">[% issuecount || 0 | html %]</span>
10
            [% END %]
8
        [% END %]
11
        [% END %]
9
12
10
        [% IF relatives_issues_count %]
13
        [% IF relatives_issues_count %]
11
            [% WRAPPER tab_item tabname= "relatives-issues" %]
14
            [% WRAPPER tab_item tabname= "relatives-issues" %]
12
                <span>Relatives' checkouts ([% relatives_issues_count | html %])</span>
15
                <span>Relatives' checkouts</span>
16
                [% IF ( relatives_issues_count ) %]
17
                    <span class="label label-info">[% relatives_issues_count | html %]</span>
18
                [% END %]
13
            [% END %]
19
            [% END %]
14
        [% END %]
20
        [% END %]
15
21
16
        [% IF ( fines ) %]
22
        [% IF ( fines ) %]
17
            [% WRAPPER tab_item tabname= "finesandcharges" %]
23
            [% WRAPPER tab_item tabname= "finesandcharges" %]
18
                <span>Charges ([% fines | $Price %])</span>
24
                <span>Charges</span>
25
                [% IF ( fines ) %]
26
                    <span class="label label-info">[% fines | $Price %]</span>
27
                [% END %]
19
            [% END %]
28
            [% END %]
20
        [% END %]
29
        [% END %]
21
30
22
        [% IF ( guarantees_fines ) %]
31
        [% IF ( guarantees_fines ) %]
23
            [% WRAPPER tab_item tabname= "guarantees_finesandcharges" %]
32
            [% WRAPPER tab_item tabname= "guarantees_finesandcharges" %]
24
                <span>Guarantees' charges ([% guarantees_fines | $Price %])</span>
33
                <span>Guarantees' charges</span>
34
                [% IF ( guarantees_fines ) %]
35
                    <span class="label label-info">[% guarantees_fines | $Price %]</span>
36
                [% END %]
25
            [% END %]
37
            [% END %]
26
        [% END %]
38
        [% END %]
27
39
28
        [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
40
        [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
29
            [% WRAPPER tab_item tabname= "holds" %]
41
            [% WRAPPER tab_item tabname= "holds" %]
30
                <span>Holds ([% holds_count || 0 | html %])</span>
42
                <span>Holds</span>
43
                [% IF ( holds_count ) %]
44
                    <span class="label label-info">[% holds_count | html %]</span>
45
                [% END %]
31
            [% END %]
46
            [% END %]
32
        [% END %]
47
        [% END %]
33
48
34
        [% IF Koha.Preference('UseRecalls') %]
49
        [% IF Koha.Preference('UseRecalls') %]
35
            [% WRAPPER tab_item tabname= "recalls" %]
50
            [% WRAPPER tab_item tabname= "recalls" %]
36
                <span>Recalls ([% recalls.count || 0 | html %])</span>
51
                <span>Recalls</span>
52
                [% IF ( recalls.count ) %]
53
                    <span id="recalls-count" class="label label-info">[% recalls.count | html %]</span>
54
                [% END %]
37
            [% END %]
55
            [% END %]
38
        [% END %]
56
        [% END %]
39
57
40
        [% IF Koha.Preference('ArticleRequests') %]
58
        [% IF Koha.Preference('ArticleRequests') %]
41
            [% SET article_requests = Context.Scalar( Context.Scalar( patron, 'article_requests' ), 'filter_by_current') %]
59
            [% SET article_requests = Context.Scalar( Context.Scalar( patron, 'article_requests' ), 'filter_by_current') %]
42
            [% WRAPPER tab_item tabname= "article-requests" %]
60
            [% WRAPPER tab_item tabname= "article-requests" %]
43
                <span>Article requests ([% article_requests.count || 0 | html %])</span>
61
                <span>Article requests</span>
62
                [% IF ( article_requests.count ) %]
63
                    <span class="label label-info">[% article_requests.count | html %]</span>
64
                [% END %]
44
            [% END %]
65
            [% END %]
45
        [% END %]
66
        [% END %]
46
67
47
        [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %]
68
        [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %]
48
            [% WRAPPER tab_item tabname= "return-claims" %]
69
            [% WRAPPER tab_item tabname= "return-claims" %]
49
                <span>Claims</span>
70
                <span>Claims</span>
50
                [% IF ( patron.return_claims.count ) %]
71
                [% SET warning_threshold = Koha.Preference('ClaimReturnedWarningThreshold') %]
51
                    ([% IF patron.return_claims.resolved.count == 0 %]
72
                [% IF warning_threshold != '' && ( patron.return_claims.count > warning_threshold ) %]
52
                        <span title="Resolved claims" class="label label-default" id="return-claims-count-resolved">[% patron.return_claims.resolved.count | html %]</span>
73
                    <span id="return-claims-count" title="Unresolved claims / Resolved claims" class="label label-warning">
53
                    [% ELSE %]
74
                        <span id="return-claims-count-unresolved" class="count-active" data-warning="[% warning_threshold | html %]">[% patron.return_claims.unresolved.count | html %]</span>
54
                        <span title="Resolved claims" class="label label-success" id="return-claims-count-resolved">[% patron.return_claims.resolved.count | html %]</span>
75
                        <span id="return-claims-count-resolved" class="count-inactive">[% patron.return_claims.resolved.count | html %]</span>
55
                    [% END %]
76
                    </span>
56
                    [% IF patron.return_claims.unresolved.count == 0 %]
57
                        <span title="Unresolved claims" class="label label-default" id="return-claims-count-unresolved">[% patron.return_claims.unresolved.count | html %]</span>
58
                    [% ELSE %]
59
                        <span title="Unresolved claims" class="label label-warning" id="return-claims-count-unresolved">[% patron.return_claims.unresolved.count | html %]</span>
60
                    [% END %])
61
                [% ELSE %]
77
                [% ELSE %]
62
                    [% no_claims = 0 %]
78
                    <span id="return-claims-count" title="Unresolved claims" class="label label-info">
63
                    (<span title="Resolved claims" class="label label-default" id="return-claims-count-resolved">[% no_claims | html %]</span>
79
                        <span id="return-claims-count-unresolved" class="count-active" data-warning="[% warning_threshold | html %]">[% patron.return_claims.unresolved.count || "" | html %]</span>
64
                    <span title="Unresolved claims" class="label label-default" id="return-claims-count-unresolved">[% no_claims | html %]</span>)
80
                        <span id="return-claims-count-resolved" class="count-inactive">[% patron.return_claims.resolved.count || "" | html %]</span>
65
                [% END # /IF patron.return_claims.count %]
81
                    </span>
82
                [% END %]
66
            [% END # /WRAPPER tab_item return-claims %]
83
            [% END # /WRAPPER tab_item return-claims %]
67
        [% END %]
84
        [% END %]
68
85
69
        [% WRAPPER tab_item tabname= "reldebarments" %]
86
        [% WRAPPER tab_item tabname= "reldebarments" %]
70
            <span>Restrictions ([% patron.restrictions.count || 0 | html %])</span>
87
            <span>Restrictions</span>
88
            [% IF ( patron.restrictions.count ) %]
89
                <span class="label label-danger">[% patron.restrictions.count | html %]</span>
90
            [% END %]
71
        [% END %]
91
        [% END %]
72
92
73
        [% SET enrollments = patron.get_club_enrollments %]
93
        [% SET enrollments = patron.get_club_enrollments %]
74
        [% SET enrollable  = patron.get_enrollable_clubs(0) %] <!-- 0 => not OPAC -->
94
        [% SET enrollable  = patron.get_enrollable_clubs(0) %] <!-- 0 => not OPAC -->
75
        [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %]
95
        [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %]
76
            [% WRAPPER tab_item tabname= "clubs" %]
96
            [% WRAPPER tab_item tabname= "clubs" %]
77
                <span>Clubs ([% enrollments.count | html %]/[% enrollable.count | html %])</span>
97
                <span>Clubs</span>
98
                <span id="clubs-count" title="Club enrollments" class="label label-info">
99
                    <span id="clubs-count-enrolled" class="count-active">[% enrollments.count || "" | html %]</span>
100
                </span>
78
            [% END %]
101
            [% END %]
79
        [% END %]
102
        [% END %]
80
103
81
        [% IF CAN_user_tools_manage_patron_lists || patron_lists_count %]
104
        [% IF CAN_user_tools_manage_patron_lists || patron_lists_count %]
82
            [% WRAPPER tab_item tabname="pat_lists" %]
105
            [% WRAPPER tab_item tabname="pat_lists" %]
83
                <span>Patron lists ([% patron_lists_count | html %])</span>
106
                <span>Patron lists</span>
107
                <span id="patron-lists" title="Lists containing this patron" class="label label-info">
108
                    <span id="patron-lists-count">[% patron_lists_count || "" | html %]</span>
109
                </span>
84
            [% END %]
110
            [% END %]
85
        [% END %]
111
        [% END %]
86
    [% END # /WRAPPER tabs_nav %]
112
    [% END # /WRAPPER tabs_nav %]
87
113
88
89
    [% WRAPPER tab_panels %]
114
    [% WRAPPER tab_panels %]
90
        [% WRAPPER tab_panel tabname="checkouts" bt_active= 1 %]
115
        [% WRAPPER tab_panel tabname="checkouts" bt_active= 1 %]
91
            [% INCLUDE "checkouts-table.inc" %]
116
            [% INCLUDE "checkouts-table.inc" %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc (+2 lines)
Lines 16-24 Link Here
16
    var dateformat = "[% Koha.Preference('dateformat') | html %]";
16
    var dateformat = "[% Koha.Preference('dateformat') | html %]";
17
17
18
    var borrowernumber;
18
    var borrowernumber;
19
    var cardnumber;
19
    var number_of_adult_categories = 0;
20
    var number_of_adult_categories = 0;
20
    [% IF patron %]
21
    [% IF patron %]
21
        borrowernumber = "[% patron.borrowernumber | html %]";
22
        borrowernumber = "[% patron.borrowernumber | html %]";
23
        cardnumber = "[% patron.cardnumber | html %]";
22
        [% IF patron.is_child %]
24
        [% IF patron.is_child %]
23
            [% SET adult_categories = Categories.scalar.all(category_type => 'A') %]
25
            [% SET adult_categories = Categories.scalar.all(category_type => 'A') %]
24
            [% SET number_of_adult_categories = adult_categories.count %]
26
            [% SET number_of_adult_categories = adult_categories.count %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt (+1 lines)
Lines 92-97 function cancelEnrollment( id ) { Link Here
92
            if ( success.success ) {
92
            if ( success.success ) {
93
                $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]', function() {
93
                $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]', function() {
94
                    $("body").css("cursor", "default");
94
                    $("body").css("cursor", "default");
95
                    refreshTabCount( $("#clubs-count-enrolled"), $("#table_clubenrollments tbody tr").length );
95
                });
96
                });
96
            } else {
97
            } else {
97
                alert(_("Unable to cancel enrollment!"));
98
                alert(_("Unable to cancel enrollment!"));
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt (-4 / +13 lines)
Lines 53-59 Link Here
53
                [% END %]
53
                [% END %]
54
            [% END %]
54
            [% END %]
55
                <li>
55
                <li>
56
                    <a href="#" class="btn btn-sm btn-default" onclick="addEnrollment(); return false;">Finish enrollment</a>
56
                    <a href="#" class="btn btn-sm btn-default" id="patron-club-add-enrollment">Finish enrollment</a>
57
                    <a class="cancel" href="#" onclick="showClubs(); return false;">Cancel</a>
57
                    <a class="cancel" href="#" onclick="showClubs(); return false;">Cancel</a>
58
                </li>
58
                </li>
59
            </ol>
59
            </ol>
Lines 62-70 Link Here
62
</div>
62
</div>
63
63
64
<script>
64
<script>
65
if([% enrollent_id | html %]){
65
    $(document).ready(function(){
66
    $("#heading").html(_("Modifying enrollment")+" <em>[% club.name | html %]</em>");
66
        if([% enrollent_id | html %]){
67
}
67
            $("#heading").html(_("Modifying enrollment")+" <em>[% club.name | html %]</em>");
68
        }
69
70
        $("#patron-club-add-enrollment").on("click", function(e){
71
            e.preventDefault();
72
            addEnrollment();
73
        });
74
    });
75
68
function addEnrollment() {
76
function addEnrollment() {
69
    $("body").css("cursor", "progress");
77
    $("body").css("cursor", "progress");
70
    const client = APIClient.club;
78
    const client = APIClient.club;
Lines 74-79 function addEnrollment() { Link Here
74
            if ( success.success ) {
82
            if ( success.success ) {
75
                $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]&id=[% club.id | html %]', function() {
83
                $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]&id=[% club.id | html %]', function() {
76
                    $("body").css("cursor", "default");
84
                    $("body").css("cursor", "default");
85
                    refreshTabCount( $("#clubs-count-enrolled"), $("#table_clubenrollments tbody tr").length );
77
                });
86
                });
78
            } else {
87
            } else {
79
                alert(_("Unable to create enrollment!"));
88
                alert(_("Unable to create enrollment!"));
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt (-39 / +15 lines)
Lines 91-136 Link Here
91
[% END %]
91
[% END %]
92
92
93
[% IF available_lists && CAN_user_tools_manage_patron_lists %]
93
[% IF available_lists && CAN_user_tools_manage_patron_lists %]
94
<div class="h4">
94
    <fieldset class="brief">
95
    <span>Add patron to list</span>
95
        <ol>
96
    <select name="patron_list_id" id="add_to_patron_list_id_select">
96
            <li>
97
        <option value=""></option>
97
                <label for="add_to_patron_list_id_select">Add patron to list</label>
98
    [%- FOREACH l IN available_lists %]
98
                <select name="patron_list_id" id="add_to_patron_list_id_select">
99
        <option value="[% l.patron_list_id | html %]">[% l.name | html %]</option>
99
                    <option value=""></option>
100
    [%- END %]
100
                    [%- FOREACH l IN available_lists %]
101
    </select>
101
                        <option value="[% l.patron_list_id | html %]">[% l.name | html %]</option>
102
    <a onclick="addToList()"><i class="fa fa-plus"></i>
102
                    [%- END %]
103
</div>
103
                </select>
104
                <button id="add_patron_to_list" type="button" class="btn btn-default btn-xs"><i class="fa fa-floppy-disk" aria-hidden="true"></i> Save</button></i></button>
105
            </li>
106
        </ol>
107
    </fieldset>
104
[% END %]
108
[% END %]
105
109
106
<script>
110
<script>
107
    $("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, {
111
    var CAN_user_tools_manage_patron_lists = "[% CAN_user_tools_manage_patron_lists || 0 | html %]";
108
        "columnDefs": [
109
            { 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] }
110
        ],
111
        "sPaginationType": "full"
112
    }));
113
114
    [% IF CAN_user_tools_manage_patron_lists %]
115
        function addToList() {
116
            var list_id = $("#add_to_patron_list_id_select").val();
117
            $('#pat_lists_panel').text(_("Loading..."));
118
            $("body").css("cursor", "progress");
119
            $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=[% borrowernumber | html %]&patron_list_id=' + list_id + '&patrons_to_add=[% cardnumber | html %]', function() {
120
                $("body").css("cursor", "default");
121
            });
122
123
            return false;
124
        }
125
126
        function removeFromList( list_id, patron_list_patron_id ) {
127
            $('#pat_lists_panel').text(_("Loading..."));
128
            $("body").css("cursor", "progress");
129
            $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=[% borrowernumber | html %]&patron_list_id=' + list_id + '&patrons_to_remove=' + patron_list_patron_id, function() {
130
                $("body").css("cursor", "default");
131
            });
132
133
            return false;
134
        }
135
    [% END %]
136
</script>
112
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-202 / +236 lines)
Lines 465-481 function LoadIssuesTable() { Link Here
465
    }
465
    }
466
}
466
}
467
467
468
var loadIssuesTableDelayTimeoutId;
468
function refreshReturnClaimsTable(){
469
var barcodefield = $("#barcode");
469
    const table = $('#return-claims-table');
470
    if ($.fn.dataTable.isDataTable(table)) {
471
        table.DataTable().ajax.reload();
472
    } else {
473
        loadReturnClaimsTable();
474
    }
475
}
476
477
function loadReturnClaimsTable() {
478
    if ( ! returnClaimsTable ) {
479
        returnClaimsTable = $("#return-claims-table").dataTable({
480
            "autoWidth":  false,
481
            "dom":  "rt",
482
            "order":  [],
483
            "columnDefs":  [
484
                { "orderable":  false, "searchable":  false, "targets":  ['NoSort'] },
485
                { "type":  "anti-the", "targets":  ["anti-the"] },
486
            ],
487
            "columns":  [
488
                {
489
                    "data": "id",
490
                    "visible":  false,
491
                },
492
                {
493
                    "data": function (oObj) {
494
                        if (oObj.resolution) {
495
                            return "is_resolved";
496
                        } else {
497
                            return "is_unresolved";
498
                        }
499
                    },
500
                    "visible":  false,
501
                },
502
                {
503
                    "data": function ( oObj ) {
504
                          let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">'
505
                              + oObj.title
506
                              + ( oObj.subtitle ? " " + oObj.subtitle : "" )
507
                              + ( oObj.enumchron || "" )
508
                          + '</a>';
509
                          if ( oObj.author ) {
510
                            title += ' by ' + oObj.author;
511
                          }
512
                          title += ' <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber='
513
                                + oObj.biblionumber
514
                                + '&itemnumber='
515
                                + oObj.itemnumber
516
                                + '">'
517
                                + (oObj.barcode ? oObj.barcode.escapeHtml() : "")
518
                                + '</a>';
519
520
                          return title;
521
                    }
522
                },
523
                {
524
                    "className": "return-claim-notes-td",
525
                    "data": function ( oObj ) {
526
                        let notes =  '<span id="return-claim-notes-static-' + oObj.id + '" class="return-claim-notes" data-return-claim-id="' + oObj.id + '">';
527
                        if ( oObj.notes ) {
528
                            notes += oObj.notes;
529
                        }
530
                        notes += '</span>';
531
                        notes += '<i style="float:right" class="fa-solid fa-pen-to-square" title="' + __("Double click to edit") + '"></i>';
532
                        return notes;
533
                    }
534
                },
535
                {
536
                    "data": "created_on",
537
                    "visible":  false,
538
                },
539
                {
540
                    "orderData": 4,
541
                    "data": function ( oObj ) {
542
                        if ( oObj.created_on ) {
543
                            return $date(oObj.created_on, { no_tz_adjust: true });;
544
                        } else {
545
                            return "";
546
                        }
547
                    }
548
                },
549
                {
550
                    "data": "updated_on",
551
                    "visible":  false,
552
                },
553
                {
554
                    "orderData": 6,
555
                    "data": function ( oObj ) {
556
                        if ( oObj.updated_on ) {
557
                            return $date(oObj.updated_on, { no_tz_adjust: true });
558
                        } else {
559
                            return "";
560
                        }
561
                    }
562
                },
563
                {
564
                    "data": function ( oObj ) {
565
                        if ( ! oObj.resolution ) return "";
566
567
                        let desc = '<strong>' + oObj.resolution_data.lib + '</strong> <i>(';
568
                        if (oObj.resolved_by_data) desc += '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + oObj.resolved_by_data.borrowernumber + '">' + ( oObj.resolved_by_data.firstname || "" ) + " " + ( oObj.resolved_by_data.surname || "" ) + '</a>';
569
                        desc += ', ' + oObj.resolved_on + ')</i>';
570
                        return desc;
571
                    }
572
                },
573
                {
574
                    "data": function ( oObj ) {
575
                        let delete_html = oObj.resolved_on
576
                            ? '<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="' + oObj.id + '"><i class="fa fa-trash-can"></i> ' + __("Delete") + '</a></li>'
577
                            : "";
578
                        let resolve_html = ! oObj.resolution
579
                            ? '<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="' + oObj.id + '" data-current-lost-status="' + escape_str(oObj.itemlost) + '"><i class="fa fa-check-square"></i> ' + __("Resolve") + '</a></li>'
580
                            : "";
581
582
                        return  '<div class="btn-group">'
583
                              + ' <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
584
                              + __("Actions") + ' <span class="caret"></span>'
585
                              + ' </button>'
586
                              + ' <ul class="dropdown-menu">'
587
                              + '  <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="' + oObj.id + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + __("Edit notes") + '</a></li>'
588
                              + resolve_html
589
                              + delete_html
590
                              + ' </ul>'
591
                              + ' </div>';
592
                    }
593
                },
594
            ],
595
            "paging":  false,
596
            "processing":  true,
597
            "serverSide":  false,
598
            "sAjaxSource": '/cgi-bin/koha/svc/return_claims',
599
            "fnServerData": function ( sSource, aoData, fnCallback ) {
600
                aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
601
602
                $.getJSON( sSource, aoData, function (json) {
603
                    let resolved = Number( json.resolved ) || 0;
604
                    let unresolved = Number( json.unresolved ) || 0;
605
                    let warningThreshold = $("#return-claims-count-unresolved").data("warning");
606
607
                    refreshTabCount( $('#return-claims-count-unresolved'), unresolved );
608
609
                    if( warningThreshold !== '' && ( ( resolved + unresolved ) > Number( warningThreshold ) ) ){
610
                        refreshTabCount( $('#return-claims-count-resolved'), resolved );
611
                        $("#return-claims-count").attr("class", "label label-warning");
612
                    } else {
613
                        $("#return-claims-count").attr("class", "label label-info");
614
                    }
615
                    fnCallback(json)
616
                } );
617
            },
618
            "search": { "search": "is_unresolved" },
619
            "footerCallback": function (row, data, start, end, display) {
620
                var api = this.api();
621
                // Total over all pages
622
                var colData = api.column(1).data();
623
                var is_unresolved = 0;
624
                var is_resolved = 0;
625
                colData.each(function( index, value ){
626
                    if( index == "is_unresolved" ){ is_unresolved++; }
627
                    if (index == "is_resolved") { is_resolved++; }
628
                });
629
                // Update footer
630
                $("#return-claims-controls").html( showClaimFilter( is_unresolved, is_resolved ) )
631
            }
632
        });
633
    }
634
}
470
635
471
$('#issues-table-load-now-button').click(function(){
636
function showClaimFilter( is_unresolved, is_resolved ){
472
    if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId);
637
    var showAll, showUnresolved;
473
    LoadIssuesTable();
638
    var total = Number( is_unresolved ) + Number( is_resolved );
474
    barcodefield.focus();
639
    if( total > 0 ){
640
        showAll = __nx("Show 1 claim", "Show all {count} claims", total, { count: total });
641
    } else {
642
        showAll = "";
643
    }
644
    if( is_unresolved > 0 ){
645
        showUnresolved = __nx("Show 1 unresolved claim", "Show {count} unresolved claims", is_unresolved, { count: is_unresolved })
646
    } else {
647
        showUnresolved = "";
648
    }
649
    $("#show_all_claims").html( showAll );
650
    $("#show_unresolved_claims").html( showUnresolved );
651
}
652
653
function addToList() {
654
    if( CAN_user_tools_manage_patron_lists ){
655
        var list_id = $("#add_to_patron_list_id_select").val();
656
        $('#pat_lists_panel').text(_("Loading..."));
657
        $("body").css("cursor", "progress");
658
        $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=' + borrowernumber + '&patron_list_id=' + list_id + '&patrons_to_add=' + cardnumber, function() {
659
            refreshTabCount( $("#patron-lists-count"), $("#table_inlists tbody tr").length );
660
            $("body").css("cursor", "default");
661
        });
662
    }
663
    return false;
664
}
665
666
function removeFromList( list_id, patron_list_patron_id ) {
667
    if( CAN_user_tools_manage_patron_lists ){
668
        $('#pat_lists_panel').text(_("Loading..."));
669
        $("body").css("cursor", "progress");
670
        $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=' + borrowernumber + '&patron_list_id=' + list_id + '&patrons_to_remove=' + patron_list_patron_id, function() {
671
            refreshTabCount( $("#patron-lists-count"), $("#table_inlists tbody tr").length );
672
            $("body").css("cursor", "default");
673
        });
674
    }
475
    return false;
675
    return false;
476
});
676
}
677
678
function refreshTabCount( container, num ){
679
    if( num > 0 ){
680
        container.text( num );
681
    } else {
682
        container.text( "" );
683
    }
684
}
685
686
var loadIssuesTableDelayTimeoutId;
687
var barcodefield = $("#barcode");
688
var returnClaimsTable;
477
689
478
$(document).ready(function() {
690
$(document).ready(function() {
691
    $('#issues-table-load-now-button').click(function(){
692
        if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId);
693
        LoadIssuesTable();
694
        barcodefield.focus();
695
        return false;
696
    });
479
697
480
    var onHoldDueDateSet = false;
698
    var onHoldDueDateSet = false;
481
699
Lines 995-1199 $(document).ready(function() { Link Here
995
    });
1213
    });
996
1214
997
    // Don't load return claims table unless its tab is shown
1215
    // Don't load return claims table unless its tab is shown
998
    var returnClaimsTable;
999
    $("#return-claims-tab").on('shown.bs.tab', function() {
1216
    $("#return-claims-tab").on('shown.bs.tab', function() {
1000
        refreshReturnClaimsTable();
1217
        refreshReturnClaimsTable();
1001
    });
1218
    });
1002
1219
1003
    function refreshReturnClaimsTable(){
1004
        const table = $('#return-claims-table');
1005
        if ($.fn.dataTable.isDataTable(table)) {
1006
            table.DataTable().ajax.reload();
1007
        } else {
1008
            loadReturnClaimsTable();
1009
        }
1010
    }
1011
    function loadReturnClaimsTable() {
1012
        if ( ! returnClaimsTable ) {
1013
            returnClaimsTable = $("#return-claims-table").dataTable({
1014
                "autoWidth":  false,
1015
                "dom":  "rt",
1016
                "order":  [],
1017
                "columnDefs":  [
1018
                    { "orderable":  false, "searchable":  false, "targets":  ['NoSort'] },
1019
                    { "type":  "anti-the", "targets":  ["anti-the"] },
1020
                ],
1021
                "columns":  [
1022
                    {
1023
                        "data": "id",
1024
                        "visible":  false,
1025
                    },
1026
                    {
1027
                        "data": function (oObj) {
1028
                            if (oObj.resolution) {
1029
                                return "is_resolved";
1030
                            } else {
1031
                                return "is_unresolved";
1032
                            }
1033
                        },
1034
                        "visible":  false,
1035
                    },
1036
                    {
1037
                        "data": function ( oObj ) {
1038
                              let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">'
1039
                                  + oObj.title
1040
                                  + ( oObj.subtitle ? " " + oObj.subtitle : "" )
1041
                                  + ( oObj.enumchron || "" )
1042
                              + '</a>';
1043
                              if ( oObj.author ) {
1044
                                title += ' by ' + oObj.author;
1045
                              }
1046
                              title += ' <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber='
1047
                                    + oObj.biblionumber
1048
                                    + '&itemnumber='
1049
                                    + oObj.itemnumber
1050
                                    + '">'
1051
                                    + (oObj.barcode ? oObj.barcode.escapeHtml() : "")
1052
                                    + '</a>';
1053
1054
                              return title;
1055
                        }
1056
                    },
1057
                    {
1058
                        "className": "return-claim-notes-td",
1059
                        "data": function ( oObj ) {
1060
                            let notes =  '<span id="return-claim-notes-static-' + oObj.id + '" class="return-claim-notes" data-return-claim-id="' + oObj.id + '">';
1061
                            if ( oObj.notes ) {
1062
                                notes += oObj.notes;
1063
                            }
1064
                            notes += '</span>';
1065
                            notes += '<i style="float:right" class="fa-solid fa-pen-to-square" title="' + __("Double click to edit") + '"></i>';
1066
                            return notes;
1067
                        }
1068
                    },
1069
                    {
1070
                        "data": "created_on",
1071
                        "visible":  false,
1072
                    },
1073
                    {
1074
                        "orderData": 4,
1075
                        "data": function ( oObj ) {
1076
                            if ( oObj.created_on ) {
1077
                                return $date(oObj.created_on, { no_tz_adjust: true });;
1078
                            } else {
1079
                                return "";
1080
                            }
1081
                        }
1082
                    },
1083
                    {
1084
                        "data": "updated_on",
1085
                        "visible":  false,
1086
                    },
1087
                    {
1088
                        "orderData": 6,
1089
                        "data": function ( oObj ) {
1090
                            if ( oObj.updated_on ) {
1091
                                return $date(oObj.updated_on, { no_tz_adjust: true });
1092
                            } else {
1093
                                return "";
1094
                            }
1095
                        }
1096
                    },
1097
                    {
1098
                        "data": function ( oObj ) {
1099
                            if ( ! oObj.resolution ) return "";
1100
1101
                            let desc = '<strong>' + oObj.resolution_data.lib + '</strong> <i>(';
1102
                            if (oObj.resolved_by_data) desc += '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + oObj.resolved_by_data.borrowernumber + '">' + ( oObj.resolved_by_data.firstname || "" ) + " " + ( oObj.resolved_by_data.surname || "" ) + '</a>';
1103
                            desc += ', ' + oObj.resolved_on + ')</i>';
1104
                            return desc;
1105
                        }
1106
                    },
1107
                    {
1108
                        "data": function ( oObj ) {
1109
                            let delete_html = oObj.resolved_on
1110
                                ? '<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="' + oObj.id + '"><i class="fa fa-trash-can"></i> ' + __("Delete") + '</a></li>'
1111
                                : "";
1112
                            let resolve_html = ! oObj.resolution
1113
                                ? '<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="' + oObj.id + '" data-current-lost-status="' + escape_str(oObj.itemlost) + '"><i class="fa fa-check-square"></i> ' + __("Resolve") + '</a></li>'
1114
                                : "";
1115
1116
                            return  '<div class="btn-group">'
1117
                                  + ' <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
1118
                                  + __("Actions") + ' <span class="caret"></span>'
1119
                                  + ' </button>'
1120
                                  + ' <ul class="dropdown-menu">'
1121
                                  + '  <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="' + oObj.id + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + __("Edit notes") + '</a></li>'
1122
                                  + resolve_html
1123
                                  + delete_html
1124
                                  + ' </ul>'
1125
                                  + ' </div>';
1126
                        }
1127
                    },
1128
                ],
1129
                "paging":  false,
1130
                "processing":  true,
1131
                "serverSide":  false,
1132
                "sAjaxSource": '/cgi-bin/koha/svc/return_claims',
1133
                "fnServerData": function ( sSource, aoData, fnCallback ) {
1134
                    aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
1135
1136
                    $.getJSON( sSource, aoData, function (json) {
1137
                        let resolved = json.resolved;
1138
                        let unresolved = json.unresolved;
1139
1140
                        if ( resolved > 0 ) {
1141
                            $('#return-claims-count-resolved').text(resolved)
1142
                                                              .removeClass('label-default')
1143
                                                              .addClass('label-success');
1144
                        } else {
1145
                            $('#return-claims-count-resolved').text(resolved)
1146
                                                              .removeClass('label-success')
1147
                                                              .addClass('label-default');
1148
                        }
1149
                        if ( unresolved > 0 ) {
1150
                            $('#return-claims-count-unresolved').text(unresolved)
1151
                                                                .removeClass('label-default')
1152
                                                                .addClass('label-warning');
1153
                        } else {
1154
                            $('#return-claims-count-unresolved').text(unresolved)
1155
                                                                .removeClass('label-warning')
1156
                                                                .addClass('label-default');
1157
                        }
1158
1159
                        fnCallback(json)
1160
                    } );
1161
                },
1162
                "search": { "search": "is_unresolved" },
1163
                "footerCallback": function (row, data, start, end, display) {
1164
                    var api = this.api();
1165
                    // Total over all pages
1166
                    var colData = api.column(1).data();
1167
                    var is_unresolved = 0;
1168
                    var is_resolved = 0;
1169
                    colData.each(function( index, value ){
1170
                        if( index == "is_unresolved" ){ is_unresolved++; }
1171
                        if (index == "is_resolved") { is_resolved++; }
1172
                    });
1173
                    // Update footer
1174
                    $("#return-claims-controls").html( showClaimFilter( is_unresolved, is_resolved ) )
1175
                }
1176
            });
1177
        }
1178
    }
1179
1180
    function showClaimFilter( is_unresolved, is_resolved ){
1181
        var showAll, showUnresolved;
1182
        var total = Number( is_unresolved ) + Number( is_resolved );
1183
        if( total > 0 ){
1184
            showAll = __nx("Show 1 claim", "Show all {count} claims", total, { count: total });
1185
        } else {
1186
            showAll = "";
1187
        }
1188
        if( is_unresolved > 0 ){
1189
            showUnresolved = __nx("Show 1 unresolved claim", "Show {count} unresolved claims", is_unresolved, { count: is_unresolved })
1190
        } else {
1191
            showUnresolved = "";
1192
        }
1193
        $("#show_all_claims").html( showAll );
1194
        $("#show_unresolved_claims").html( showUnresolved );
1195
    }
1196
1197
    $('body').on('click', '.return-claim-tools-editnotes', function() {
1220
    $('body').on('click', '.return-claim-tools-editnotes', function() {
1198
        let id = $(this).data('return-claim-id');
1221
        let id = $(this).data('return-claim-id');
1199
        $('#return-claim-notes-static-' + id).parent().dblclick();
1222
        $('#return-claim-notes-static-' + id).parent().dblclick();
Lines 1276-1279 $(document).ready(function() { Link Here
1276
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1299
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1277
    });
1300
    });
1278
1301
1302
    $("body").on("click", "#add_patron_to_list", function(e){
1303
        e.preventDefault();
1304
        addToList();
1305
    });
1306
1307
    $("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, {
1308
        "columnDefs": [
1309
            { 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] }
1310
        ],
1311
        "sPaginationType": "full"
1312
    }));
1279
 });
1313
 });
(-)a/koha-tmpl/intranet-tmpl/prog/js/recalls.js (-1 / +2 lines)
Lines 12-17 $(document).ready(function() { Link Here
12
                            message = __("The recall may have already been cancelled. Please refresh the page.");
12
                            message = __("The recall may have already been cancelled. Please refresh the page.");
13
                        } else {
13
                        } else {
14
                            message = __("Cancelled");
14
                            message = __("Cancelled");
15
                            let recallsCount = $("#recalls-count");
16
                            refreshTabCount( recallsCount, ( Number( recallsCount.text() ) - 1 ) );
15
                        }
17
                        }
16
                        td_node.html(message);
18
                        td_node.html(message);
17
                    },
19
                    },
18
- 

Return to bug 26258