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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-19 / +24 lines)
Lines 1059-1065 Link Here
1059
    [% INCLUDE 'datatables.inc' %]
1059
    [% INCLUDE 'datatables.inc' %]
1060
    <script>
1060
    <script>
1061
        const tab = "[% tab | html %]";
1061
        const tab = "[% tab | html %]";
1062
        const logged_in_user_borrowernumber = "[% borrowernumber | html %]";
1063
        addPrefs({
1064
            OpacRenewalAllowed: [% Koha.Preference('OpacRenewalAllowed') ? 1 : 0 | html %],
1065
            GoogleJackets: [% Koha.Preference('GoogleJackets') ? 1 : 0 | html %],
1066
            AllowCheckoutNotes: [% Koha.Preference('AllowCheckoutNotes') ? 1 : 0 | html %],
1067
            OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %],
1068
        });
1069
        const can_renew = [% canrenew ? 1 : 0 | html %];
1070
        const is_debarred = [% userdebarred ? 1 : 0 | html %];
1071
        const current_article_requests_size = [% current_article_requests.size || 0 | html %];
1062
    </script>
1072
    </script>
1073
1063
    <script>
1074
    <script>
1064
        var AR_CAPTION_COUNT = _("(%s total)");
1075
        var AR_CAPTION_COUNT = _("(%s total)");
1065
1076
Lines 1067-1075 Link Here
1067
        function tableInit( tableId ){
1078
        function tableInit( tableId ){
1068
            if( tableId == "checkoutst" ){
1079
            if( tableId == "checkoutst" ){
1069
                $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
1080
                $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
1070
                [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1081
                if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){
1071
                    $(".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>");
1082
                    $(".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>");
1072
                [% END %]
1083
                }
1073
            }
1084
            }
1074
        }
1085
        }
1075
        $(document).ready(function(){
1086
        $(document).ready(function(){
Lines 1080-1086 Link Here
1080
                $("#opac-user-views a:first").tab("show");
1091
                $("#opac-user-views a:first").tab("show");
1081
            }
1092
            }
1082
1093
1083
            $('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests.size | html %]'));
1094
            $('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format(current_article_requests_size));
1084
1095
1085
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
1096
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
1086
1097
Lines 1117-1123 Link Here
1117
                        if( result ){
1128
                        if( result ){
1118
                            $.ajax({
1129
                            $.ajax({
1119
                                type: "DELETE",
1130
                                type: "DELETE",
1120
                                url: '/api/v1/public/patrons/'+borrowernumber+'/article_requests/'+article_request_id+'?cancellation_reason=OPAC',
1131
                                url: `/api/v1/public/patrons/${logged_in_user_borrowernumber}/article_requests/${article_request_id}?cancellation_reason=OPAC`,
1121
                                success: function( data ) {
1132
                                success: function( data ) {
1122
                                    $("#article_" + article_request_id ).hide({
1133
                                    $("#article_" + article_request_id ).hide({
1123
                                        duration: 'slow',
1134
                                        duration: 'slow',
Lines 1229-1240 Link Here
1229
                });
1240
                });
1230
            });
1241
            });
1231
1242
1232
            [% IF ( Koha.Preference('OPACTableColExpandedByDefault') ) %]
1243
            var responsive_display = prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow;
1233
                var responsive_display = DataTable.Responsive.display.childRowImmediate;
1234
            [% ELSE %]
1235
                var responsive_display = DataTable.Responsive.display.childRow;
1236
            [% END %]
1237
1238
            var dataTables = $("#recalls-table,#article-requests-table");
1244
            var dataTables = $("#recalls-table,#article-requests-table");
1239
            dataTables.each(function(){
1245
            dataTables.each(function(){
1240
                $(this).kohaTable({
1246
                $(this).kohaTable({
Lines 1260-1267 Link Here
1260
                location.href="/cgi-bin/koha/opac-ics.pl";
1266
                location.href="/cgi-bin/koha/opac-ics.pl";
1261
            });
1267
            });
1262
1268
1263
            [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
1269
            if (prefs.GoogleJackets){
1264
            [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1270
                KOHA.Google.GetCoverFromIsbn();
1271
            }
1272
            if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){
1265
                $("#renewselected").submit(function(){
1273
                $("#renewselected").submit(function(){
1266
                    valid = false;
1274
                    valid = false;
1267
                    $("input[type=checkbox]").each(function(){
1275
                    $("input[type=checkbox]").each(function(){
Lines 1282-1290 Link Here
1282
                    e.preventDefault();
1290
                    e.preventDefault();
1283
                    $("#renewall").submit();
1291
                    $("#renewall").submit();
1284
                });
1292
                });
1285
            [% END # /IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1293
            }
1286
1294
1287
            [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
1295
            if (prefs.AllowCheckoutNotes){
1288
1296
1289
                /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1297
                /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1290
                $(".nonjs_submitnote").hide();
1298
                $(".nonjs_submitnote").hide();
Lines 1311-1318 Link Here
1311
                        $btn_save.hide();
1319
                        $btn_save.hide();
1312
                    }
1320
                    }
1313
                });
1321
                });
1314
1322
            }
1315
            [% END %]
1316
1323
1317
            $(".change_pickup").on("click", function(){
1324
            $(".change_pickup").on("click", function(){
1318
                var hold_id = $(this).data("hold-id");
1325
                var hold_id = $(this).data("hold-id");
Lines 1323-1329 Link Here
1323
            if ( $('#opac-user-clubs_panel').length ) {
1330
            if ( $('#opac-user-clubs_panel').length ) {
1324
                $('#opac-user-clubs-tab').on('click', function() {
1331
                $('#opac-user-clubs-tab').on('click', function() {
1325
                    $('#opac-user-clubs_panel').text(_("Loading..."));
1332
                    $('#opac-user-clubs_panel').text(_("Loading..."));
1326
                    $('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
1333
                    $('#opac-user-clubs_panel').load(`/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=${logged_in_user_borrowernumber}`);
1327
                });
1334
                });
1328
            }
1335
            }
1329
1336
Lines 1428-1434 Link Here
1428
            return "<em>" + title + "</em>";
1435
            return "<em>" + title + "</em>";
1429
        }
1436
        }
1430
1437
1431
        var borrowernumber = "[% borrowernumber | html %]";
1432
    </script>
1438
    </script>
1433
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1439
    [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1434
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1440
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1435
- 

Return to bug 41582