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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-1 / +1 lines)
Lines 81-87 Link Here
81
                        </div> <!-- / .dropdown-menu -->
81
                        </div> <!-- / .dropdown-menu -->
82
                    </li> <!-- / .nav-item.dropdown -->
82
                    </li> <!-- / .nav-item.dropdown -->
83
                [% END # / IF virtualshelves %]
83
                [% END # / IF virtualshelves %]
84
                [% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %]
84
                [% IF Koha.Preference( 'OpacTrustedCheckout' ) %]
85
                    <li class="nav-item">
85
                    <li class="nav-item">
86
                        <a href="#" class="nav-link" title="Self check out" id="comenulink" role="button" data-toggle="modal" data-target="#checkoutModal">
86
                        <a href="#" class="nav-link" title="Self check out" id="comenulink" role="button" data-toggle="modal" data-target="#checkoutModal">
87
                            <i id="checkout-icon" class="fa fa-barcode fa-icon-black" aria-hidden="true"></i> <span class="checkout-label">Self checkout</span>
87
                            <i id="checkout-icon" class="fa fa-barcode fa-icon-black" aria-hidden="true"></i> <span class="checkout-label">Self checkout</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (-2 / +2 lines)
Lines 117-123 Link Here
117
    [% END # /IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %]
117
    [% END # /IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %]
118
[% END # / UNLESS is_popup %]
118
[% END # / UNLESS is_popup %]
119
119
120
[% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %]
120
[% IF Koha.Preference( 'OpacTrustedCheckout' ) %]
121
    [% INCLUDE 'modals/checkout.inc' %]
121
    [% INCLUDE 'modals/checkout.inc' %]
122
[% END %]
122
[% END %]
123
123
Lines 311-317 $(document).ready(function() { Link Here
311
        </script>
311
        </script>
312
    [% END %]
312
    [% END %]
313
[% END %]
313
[% END %]
314
[% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %]
314
[% IF Koha.Preference( 'OpacTrustedCheckout' ) %]
315
    [% Asset.js("js/modals/checkout.js") | $raw %]
315
    [% Asset.js("js/modals/checkout.js") | $raw %]
316
[% END %]
316
[% END %]
317
[% KohaPlugins.get_plugins_opac_js | $raw %]
317
[% KohaPlugins.get_plugins_opac_js | $raw %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js (-1 / +24 lines)
Lines 61-66 $(document).ready(function() { Link Here
61
        $('#checkoutConfirm').replaceWith('<button type="submit" id="checkoutSubmit" class="btn btn-primary">Submit</button>');
61
        $('#checkoutConfirm').replaceWith('<button type="submit" id="checkoutSubmit" class="btn btn-primary">Submit</button>');
62
    };
62
    };
63
63
64
    // Before modal show, check login
65
    $('#checkoutModal').on('show.bs.modal', function(e) {
66
       // Redirect to login modal if not logged in
67
       if (logged_in_user_id === "") {
68
           let url = new URL(window.location.href);
69
           url.searchParams.append('modal','checkout');
70
           $('#modalAuth').append('<input type="hidden" name="return" value="' + url.href +'" />');
71
           $('#loginModal').modal('show');
72
           return false;
73
       }
74
    });
75
76
    // Detect that we were redirected here after login and re-open modal
77
    let urlParams = new URLSearchParams(window.location.search);
78
    if (urlParams.has('modal')) {
79
        let modal = urlParams.get('modal');
80
        history.replaceState && history.replaceState(
81
            null, '', location.pathname + location.search.replace(/[\?&]modal=[^&]+/, '').replace(/^&/, '?')
82
        );
83
        if (modal == 'checkout') {
84
            $("#checkoutModal").modal('show');
85
        }
86
    }
87
64
    // On modal show, clear any prior results and set focus
88
    // On modal show, clear any prior results and set focus
65
    $('#checkoutModal').on('shown.bs.modal', function(e) {
89
    $('#checkoutModal').on('shown.bs.modal', function(e) {
66
        $('#checkoutResults').replaceWith('<div id="checkoutResults"></div>');
90
        $('#checkoutResults').replaceWith('<div id="checkoutResults"></div>');
67
- 

Return to bug 30979