From 033e6371d2d6214b4cc58bdb4e0cff062c0fa701 Mon Sep 17 00:00:00 2001
From: Sam Lau <samalau@gmail.com>
Date: Thu, 20 Jun 2024 20:50:04 +0000
Subject: [PATCH] Bug 26777: Add barcode generator file and initial styling

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 .../opac-tmpl/bootstrap/css/src/opac.scss     | 30 +++++++++++++++++++
 .../bootstrap/js/barcode-generator.js         | 11 +++++++
 2 files changed, 41 insertions(+)
 create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js

diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
index c852515e27c..43c1e9665ba 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
+++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
@@ -3006,4 +3006,34 @@ $star-selected: #EDB867;
     }
 }
 
+#patron-virtual-card {
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+
+    #barcode-container {
+        flex: 1;
+        width: 100%;
+        #patron-barcode {
+            padding: 1rem 0.25rem 1rem 0.25rem;
+            width: 100%;
+            height: auto;
+            min-height: 25px;
+        }
+    }
+
+    #image-and-library-container {
+        #image-container {
+            flex: 0;
+            width: 100%;
+            #patron-image {
+                padding: 1rem 0 0.25rem 0.25rem;
+                display: block;
+                width: 100%;
+                height: auto;
+            }
+        }
+    }
+}
+
 @import "responsive";
diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js
new file mode 100644
index 00000000000..afd32f8284b
--- /dev/null
+++ b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js
@@ -0,0 +1,11 @@
+document.addEventListener("DOMContentLoaded", function() {
+    var barcodeNumber = document.getElementById("patron-barcode").dataset.barcode;
+    JsBarcode("#patron-barcode", barcodeNumber, {
+        format: "CODE39",
+        lineColor: "#000",
+        width: 2,
+        height: 100,
+        displayValue: false,
+        margin: 0
+    });
+});
\ No newline at end of file
-- 
2.45.2