Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt
Owen Leonard 9cb89b4639 Bug 20168: Update of the OPAC bootstrap template to bootstrap v4
This patch updates the version of Bootstrap in the OPAC from 2.3.1 to
4.5.0. The Bootstrap JavaScript files have been replaced with custom
builds of the 4.5.0 JavaScript source files. The Bootstrap CSS is now
built into the OPAC CSS by loading the required Bootstrap 4.5.0 SCSS
files in node_modules.

OPAC SCSS now starts with Bootstrap customizations:

/* Bootstrap variable customizations */
$headings-color: #727272;
...

Followed by loading the necessary Bootstrap SCSS files:

/* Bootstrap imports */
@import "../../../../../node_modules/bootstrap/scss/functions";
@import "../../../../../node_modules/bootstrap/scss/variables";
...

Followed by our CSS. The build process for generating compiled CSS now
creates a file which bundles Bootstrap CSS and ours. Removed from the
Koha source: Bootstrap CSS files, Bootstrap "glyphicons" images.

The upgrade to Bootstrap 4 involved a lot of markup changes to conform
with new Bootstrap classes, especially in classes related to the grid.
Besides duplicating the grid we used before, this upgrade adds some new
features made possible by Bootstrap 4.5's use of flexbox as a layout
tool. This includes custom ordering of columns based on class names:
https://getbootstrap.com/docs/4.5/layout/grid/#order-classes.

Other areas where the most changes have been made: Navigation menus,
breadcrumb menus, buttons, dropdowns.

Bootstrap's JavaScript file is now "bootstrap.bundle.min.js" to reflect
the fact that a required JavaScript asset is now distributed separately
in Bootstrap 4. The "bundle" version includes Popper.js.

Unrelated changes: Indentation corrections, removal of invalid
"//<![CDATA[" markers, removal of invalid script type attributes.

To test, apply the patch and run 'yarn install' to install Bootstrap as
an npm module. Run 'yarn build --view opac' to regenerate the OPAC CSS.

Test as many aspect of the OPAC as possible, viewing pages at various
browser widths to confirm that everything adjusts well. Test with
various OPAC interface system preferences enabled and disabled.

Test self checkout and self checkin.

Known issues: RTL support has not been updated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-09 14:13:03 +02:00

178 lines
7.6 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE Price %]
[% SET ENABLE_OPAC_PAYMENTS = Koha.Preference('EnablePayPalOpacPayments') || plugins %]
[% SET DISPLAY_PAYMENT_BLOCK = 0 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your charges</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
[% Asset.css("css/datatables.css") | $raw %]
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
</li>
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<a href="#">Your charges</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col col-lg-2 order-2 order-lg-1">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="col-md-12 col-lg-10 order-1">
<div id="useraccount" class="maincontent">
[% IF message %]
<div class="alert alert-info">
[% IF message == 'valid_payment' %]
<p>Your payment of $[% message_value | html %] has been processed successfully!</p>
[% ELSIF message == 'duplicate_payment' %]
<p>A payment with the transaction id '[% message_value | html %]' has already been posted to an account.</p>
<p>Please contact a librarian for details.</p>
[% ELSIF message == 'invalid_payment' %]
<p>The transaction id '[% message_value | html %]' for this payment is invalid.</p>
<p>Please contact a librarian for details.</p>
[% END %]
</div>
[% END %]
[% IF payment_error %]
<div id="error" class="alert alert-warning">
<p><strong>Error:</strong> there was a problem processing your payment</p>
[% IF payment_error == "PAYPAL_UNABLE_TO_CONNECT" %]
<p>Unable to connect to PayPal.</p>
<p>Please contact a librarian to verify your payment.</p>
[% ELSIF payment_error == "PAYPAL_ERROR_PROCESSING" %]
<p>Unable to verify payment.</p>
<p>Please contact a librarian to verify your payment.</p>
[% END %]
</div>
[% ELSIF payment %]
<div class="alert alert-info">
<p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
</div>
[% END %]
<h2>Charges</h2>
[% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
</div> <!-- / #useraccount -->
</div> <!-- / .col-10 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
$( document ).ready(function() {
var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
var txtActivefilter = _("Filter paid transactions");
var txtInactivefilter = _("Show all transactions");
var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "type": "title-string", "targets" : [ "title-string" ] }
],
[% IF ENABLE_OPAC_PAYMENTS %]
"order": [[ 1, "desc" ]],
[% ELSE %]
"order": [[ 0, "desc" ]],
[% END %]
"dom": '<"#filter_p">',
} ));
$("#filter_p").html('<p><a href="#" id="filter_paid"><i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter+'</a>');
$('#filter_paid').click(function(e) {
e.preventDefault();
if ($(this).hasClass('filtered')) {
var filteredValue = '';
$(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter);
} else { //Not filtered. Let's do it!
var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
$(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtInactivefilter);
}
fines_table.fnFilter(filteredValue, -1, true, false);
$(this).toggleClass('filtered');
});
//Start filtered
$('#filter_paid').click();
$(".paypal").on("click", function() {
window.open('https://www.paypal.com/webapps/mpp/paypal-popup','WIPaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700');
return false;
});
$(".pay-online").removeClass("hidden");
$("#amount-to-pay-label").hide();
$(".checkbox-pay, input[name='payment_method']").change( function() {
// Disable the pay button if no fees are selected
//$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
// Calculate the total amount to be paid based on selected fees
var total = 0;
$(".checkbox-pay").each( function() {
if ( $(this).is(":checked") ) {
var id = this.id.split("checkbox-pay-")[1];
total += parseFloat( $("#amount-" + id).val() );
}
});
var p = Promise.resolve();
if ( total ) {
p = Promise.all(
$('input[name="payment_method"]').map(function() {
var self = this;
return new Promise(function(resolve, reject) {
var threshold = $(self).data('threshold');
var help = $(self).parent().siblings('.help-block');
if(!threshold || threshold == '' || threshold <= total) {
$(self).prop('disabled', false);
help.addClass('hide');
} else {
$(self).prop('disabled', true);
help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
}
resolve();
})
}).toArray()
);
$("#amount-to-pay").html( total.toFixed(2) );
$("#amount-to-pay-label").show();
} else {
$('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
$("#amount-to-pay-label").hide();
}
p.then(function() {
$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);
})
});
});
</script>
[% END %]