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