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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-13 / +22 lines)
Lines 1052-1058 Link Here
1052
    [% INCLUDE 'datatables.inc' %]
1052
    [% INCLUDE 'datatables.inc' %]
1053
    <script>
1053
    <script>
1054
        const tab = "[% tab | html %]";
1054
        const tab = "[% tab | html %]";
1055
        const logged_in_user_borrowernumber = "[% borrowernumber | html %]";
1056
        addPrefs({
1057
            OpacRenewalAllowed: [% Koha.Preference('OpacRenewalAllowed') ? 1 : 0 | html %],
1058
            GoogleJackets: [% Koha.Preference('GoogleJackets') ? 1 : 0 | html %],
1059
            AllowCheckoutNotes: [% Koha.Preference('AllowCheckoutNotes') ? 1 : 0 | html %],
1060
        });
1061
        const can_renew = [% canrenew ? 1 : 0 | html %];
1062
        const is_debarred = [% userdebarred ? 1 : 0 | html %];
1063
        const current_article_requests_size = [% current_article_requests.size || 0 | html %];
1055
    </script>
1064
    </script>
1065
1056
    <script>
1066
    <script>
1057
        var AR_CAPTION_COUNT = _("(%s total)");
1067
        var AR_CAPTION_COUNT = _("(%s total)");
1058
1068
Lines 1060-1068 Link Here
1060
        function tableInit( tableId ){
1070
        function tableInit( tableId ){
1061
            if( tableId == "checkoutst" ){
1071
            if( tableId == "checkoutst" ){
1062
                $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
1072
                $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
1063
                [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1073
                if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){
1064
                    $(".dt-buttons").append("<button id=\"renewselected_link\" class=\"dt-button buttons-renew\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</button> <button id=\"renewall_link\" class=\"dt-button buttons-renewall\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</button>");
1074
                    $(".dt-buttons").append("<button id=\"renewselected_link\" class=\"dt-button buttons-renew\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</button> <button id=\"renewall_link\" class=\"dt-button buttons-renewall\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</button>");
1065
                [% END %]
1075
                }
1066
            }
1076
            }
1067
        }
1077
        }
1068
        $(document).ready(function(){
1078
        $(document).ready(function(){
Lines 1073-1079 Link Here
1073
                $("#opac-user-views a:first").tab("show");
1083
                $("#opac-user-views a:first").tab("show");
1074
            }
1084
            }
1075
1085
1076
            $('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests.size | html %]'));
1086
            $('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format(current_article_requests_size));
1077
1087
1078
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
1088
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
1079
1089
Lines 1110-1116 Link Here
1110
                        if( result ){
1120
                        if( result ){
1111
                            $.ajax({
1121
                            $.ajax({
1112
                                type: "DELETE",
1122
                                type: "DELETE",
1113
                                url: '/api/v1/public/patrons/'+borrowernumber+'/article_requests/'+article_request_id+'?cancellation_reason=OPAC',
1123
                                url: `/api/v1/public/patrons/${logged_in_user_borrowernumber}/article_requests/${article_request_id}?cancellation_reason=OPAC`,
1114
                                success: function( data ) {
1124
                                success: function( data ) {
1115
                                    $("#article_" + article_request_id ).hide({
1125
                                    $("#article_" + article_request_id ).hide({
1116
                                        duration: 'slow',
1126
                                        duration: 'slow',
Lines 1243-1250 Link Here
1243
                location.href="/cgi-bin/koha/opac-ics.pl";
1253
                location.href="/cgi-bin/koha/opac-ics.pl";
1244
            });
1254
            });
1245
1255
1246
            [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
1256
            if (prefs.GoogleJackets){
1247
            [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1257
                KOHA.Google.GetCoverFromIsbn();
1258
            }
1259
            if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){
1248
                $("#renewselected").submit(function(){
1260
                $("#renewselected").submit(function(){
1249
                    valid = false;
1261
                    valid = false;
1250
                    $("input[type=checkbox]").each(function(){
1262
                    $("input[type=checkbox]").each(function(){
Lines 1265-1273 Link Here
1265
                    e.preventDefault();
1277
                    e.preventDefault();
1266
                    $("#renewall").submit();
1278
                    $("#renewall").submit();
1267
                });
1279
                });
1268
            [% END # /IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1280
            }
1269
1281
1270
            [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
1282
            if (prefs.AllowCheckoutNotes){
1271
1283
1272
                /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1284
                /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1273
                $(".nonjs_submitnote").hide();
1285
                $(".nonjs_submitnote").hide();
Lines 1294-1301 Link Here
1294
                        $btn_save.hide();
1306
                        $btn_save.hide();
1295
                    }
1307
                    }
1296
                });
1308
                });
1297
1309
            }
1298
            [% END %]
1299
1310
1300
            $(".change_pickup").on("click", function(){
1311
            $(".change_pickup").on("click", function(){
1301
                var hold_id = $(this).data("hold-id");
1312
                var hold_id = $(this).data("hold-id");
Lines 1306-1312 Link Here
1306
            if ( $('#opac-user-clubs_panel').length ) {
1317
            if ( $('#opac-user-clubs_panel').length ) {
1307
                $('#opac-user-clubs-tab').on('click', function() {
1318
                $('#opac-user-clubs-tab').on('click', function() {
1308
                    $('#opac-user-clubs_panel').text(_("Loading..."));
1319
                    $('#opac-user-clubs_panel').text(_("Loading..."));
1309
                    $('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
1320
                    $('#opac-user-clubs_panel').load(`/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=${logged_in_user_borrowernumber}`);
1310
                });
1321
                });
1311
            }
1322
            }
1312
1323
Lines 1411-1417 Link Here
1411
            return "<em>" + title + "</em>";
1422
            return "<em>" + title + "</em>";
1412
        }
1423
        }
1413
1424
1414
        var borrowernumber = "[% borrowernumber | html %]";
1415
    </script>
1425
    </script>
1416
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1426
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1417
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1427
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1418
- 

Return to bug 41582