mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 15:01:56 +00:00
Added modal hiding on add asset to batch, added batch clear functionality, fixed responsive
This commit is contained in:
@@ -874,6 +874,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
document.getElementById("printBtn").addEventListener("click", () => {
|
||||
addAssetIdToBatch(asset.Cn);
|
||||
showToast("@T["Successfully added barcode to print batch"]", "success");
|
||||
bootstrap.Modal.getInstance('#viewAssetModal').hide();
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@@ -915,10 +916,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
<button class="btn btn-primary" onclick="printBatch();" type="button">
|
||||
@T["Print batch"]
|
||||
</button>
|
||||
<div class="col-md-6" id="printPreviewContainer">
|
||||
<div id="printPreviewContainer">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="row g-3 mt-3">
|
||||
<button class="btn btn-warning" onclick="clearBatch();" type="button" style="width: auto; margin: auto;">
|
||||
@T["Clear batch"]
|
||||
</button>
|
||||
</div>
|
||||
<hr class="my-3">
|
||||
<h6 class="fw-bold">@T["Layout"]</h6>
|
||||
@@ -1023,6 +1027,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const cell = document.createElement("div");
|
||||
cell.className = "barcode-cell border rounded p-1 d-flex flex-column align-items-center justify-content-center";
|
||||
cell.style.minHeight = "120px";
|
||||
var isMobileM = window.innerWidth < 992 && window.innerWidth >= 576;
|
||||
var isMobileS = window.innerWidth < 576;
|
||||
|
||||
const assetId = batch[i];
|
||||
if (!assetId) {
|
||||
@@ -1037,7 +1043,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const asset = json.assetsModel;
|
||||
|
||||
const label = document.createElement("div");
|
||||
label.className = "small fw-bold text-truncate";
|
||||
label.className = "small fw-bold";
|
||||
label.textContent = asset?.Name || assetId;
|
||||
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
@@ -1049,12 +1055,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
cell.appendChild(svg);
|
||||
|
||||
grid.appendChild(cell);
|
||||
|
||||
JsBarcode(svg, idToEAN13(asset.Cn), {
|
||||
format: "EAN13",
|
||||
lineColor: "#000",
|
||||
width: 2,
|
||||
height: 40,
|
||||
width: isMobileM ? 1 : (isMobileS ? 0.5 : 2),
|
||||
height: isMobileM ? 20 : (isMobileS ? 20 : 40),
|
||||
displayValue: true,
|
||||
fontSize: 12,
|
||||
});
|
||||
@@ -1263,4 +1268,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
printWindow.print();
|
||||
}
|
||||
|
||||
function clearBatch() {
|
||||
localStorage.setItem("printBatch", JSON.stringify([]));
|
||||
showToast("@T["Batch cleared successfully"]", "success");
|
||||
bootstrap.Modal.getInstance('#printModal').hide();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user