preview qrcode di brankas&nampan

This commit is contained in:
adityaalfarison 2025-09-19 10:15:25 +07:00
parent 8ed0ea26cf
commit edf833e113
2 changed files with 55 additions and 28 deletions

View File

@ -340,40 +340,50 @@ const printQR = () => {
<head>
<title>Print QR Code - ${selectedItem.value.kode_item}</title>
<style>
@page {
size: 60mm 50mm;
margin: 1mm;
}
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.qr-container {
border: 2px solid #ccc;
padding: 20px;
display: inline-block;
margin: 20px;
text-align: center;
}
.qr-img {
width: 40mm;
height: 40mm;
margin-bottom: 2mm;
}
.item-info {
margin-top: 10px;
font-size: 14px;
font-size: 14pt;
font-weight: bold;
}
</style>
</head>
<body>
<div class="qr-container">
<img src="${qrCodeUrl.value}" alt="QR Code" style="width: 200px; height: 200px;" />
<img class="qr-img" src="${qrCodeUrl.value}" alt="QR Code"
onload="window.print()" />
<div class="item-info">
<div style="font-weight: bold; margin-bottom: 5px;">${selectedItem.value.kode_item}</div>
<div>${selectedItem.value.produk.nama}</div>
<div style="color: #666; margin-top: 5px;">${selectedItem.value.produk.berat}g</div>
${selectedItem.value.kode_item}
</div>
</div>
</body>
</html>
`);
printWindow.document.close();
printWindow.print();
}
};
const handleImageError = (event) => {
event.target.style.display = 'none';
};

View File

@ -185,40 +185,57 @@ const printQR = () => {
<head>
<title>Print QR Code - ${selectedItem.value.kode_item}</title>
<style>
@page {
size: 60mm 50mm;
margin: 1mm;
}
* {
margin: 0;
padding: 0;
}
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
}
.qr-container {
border: 2px solid #ccc;
padding: 20px;
display: inline-block;
margin: 20px;
text-align: center;
width: 100%;
}
.item-info {
margin-top: 10px;
font-size: 14px;
.qr-img {
width: 40mm;
height: 40mm;
margin-bottom: 2mm;
}
.kode-item {
font-weight: bold;
font-size: 14pt;
}
</style>
</head>
<body>
<div class="qr-container">
<img src="${qrCodeUrl.value}" alt="QR Code" style="width: 200px; height: 200px;" />
<div class="item-info">
<div style="font-weight: bold; margin-bottom: 5px;">${selectedItem.value.kode_item}</div>
<div>${selectedItem.value.produk.nama}</div>
<div style="color: #666; margin-top: 5px;">${selectedItem.value.produk.berat}g</div>
</div>
<img id="qr-img" class="qr-img" src="${qrCodeUrl.value}" alt="QR Code" />
<div class="kode-item">${selectedItem.value.kode_item}</div>
</div>
</body>
</html>
`);
printWindow.document.close();
printWindow.print();
const img = printWindow.document.getElementById("qr-img");
img.onload = () => {
printWindow.focus();
printWindow.print();
};
}
};
const showDeleteConfirm = ref(false);
const confirmDelete = async () => {