</div>
[% END %]
<div id="barcode-container">
<svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]"></svg>
<svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]" data-barcode-format="[% barcode_format | html %]"></svg>
<div id="lib-container">
<p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p>
document.addEventListener("DOMContentLoaded", function() {
var barcodeNumber = document.getElementById("patron-barcode").dataset.barcode;
const svgElement = document.getElementById('patron-barcode');
JsBarcode("#patron-barcode", barcodeNumber, {
var barcodeNumber = svgElement.dataset.barcode;
format: "CODE39",
var barcodeFormat = svgElement.dataset.barcodeFormat;
lineColor: "#000",
width: 2,
try {
height: 100,
displayValue: false,
format: barcodeFormat,
margin: 0
});
} catch (error) {
// Handle the error by displaying a message on the screen
console.error(error);
document.getElementById('barcode-container').innerHTML = `<p><strong>Error: </strong>"${error}"</p>`;
}
$template->param( display_patron_image => 1 ) if $patron->image;
# Get the desired barcode format
my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode');
$template->param(
virtualcardview => 1,
patron => $patron,
barcode_format => $barcode_format,
);
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
-