Compare commits

..

No commits in common. "bd07755a0f601dc65069e17e59ea98bd2d308af4" and "e4e98e3f980d2b2e1a1a47886bc036bbf6200569" have entirely different histories.

4 changed files with 35 additions and 80 deletions

View File

@ -340,50 +340,40 @@ 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;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
padding: 20px;
}
.qr-container {
text-align: center;
}
.qr-img {
width: 40mm;
height: 40mm;
margin-bottom: 2mm;
border: 2px solid #ccc;
padding: 20px;
display: inline-block;
margin: 20px;
}
.item-info {
font-size: 14pt;
font-weight: bold;
margin-top: 10px;
font-size: 14px;
}
</style>
</head>
<body>
<div class="qr-container">
<img class="qr-img" src="${qrCodeUrl.value}" alt="QR Code"
onload="window.print()" />
<img src="${qrCodeUrl.value}" alt="QR Code" style="width: 200px; height: 200px;" />
<div class="item-info">
${selectedItem.value.kode_item}
<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>
</div>
</body>
</html>
`);
printWindow.document.close();
printWindow.print();
}
};
const handleImageError = (event) => {
event.target.style.display = 'none';
};

View File

@ -87,7 +87,7 @@ const props = defineProps({
});
// Emits
const emit = defineEmits(['close','itemAdded']);
const emit = defineEmits(['close']);
// State
const selectedNampan = ref('');
@ -150,14 +150,12 @@ const createItem = async () => {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
});
});;
success.value = true;
createdItem.value = response.data.data;
createdItem.value = response.data.data
console.log('Item created:', createdItem);
emit('itemAdded'); // 🔔 penting
loadNampanList();
} catch (error) {
console.error('Error creating item:', error);
@ -167,7 +165,6 @@ const createItem = async () => {
}
};
const addNewItem = () => {
success.value = false;
selectedNampan.value = '';

View File

@ -185,57 +185,40 @@ 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;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
text-align: center;
padding: 20px;
}
.qr-container {
text-align: center;
width: 100%;
border: 2px solid #ccc;
padding: 20px;
display: inline-block;
margin: 20px;
}
.qr-img {
width: 40mm;
height: 40mm;
margin-bottom: 2mm;
}
.kode-item {
font-weight: bold;
font-size: 14pt;
.item-info {
margin-top: 10px;
font-size: 14px;
}
</style>
</head>
<body>
<div class="qr-container">
<img id="qr-img" class="qr-img" src="${qrCodeUrl.value}" alt="QR Code" />
<div class="kode-item">${selectedItem.value.kode_item}</div>
<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>
</div>
</body>
</html>
`);
printWindow.document.close();
const img = printWindow.document.getElementById("qr-img");
img.onload = () => {
printWindow.focus();
printWindow.print();
};
}
};
const showDeleteConfirm = ref(false);
const confirmDelete = async () => {

View File

@ -1,13 +1,7 @@
<template>
<mainLayout>
<!-- Modal Buat Item -->
<CreateItemModal
:isOpen="creatingItem"
:product="detail"
@close="closeItemModal"
@itemAdded="handleItemAdded"
/>
<CreateItemModal :isOpen="creatingItem" :product="detail" @close="closeItemModal" />
<!-- Modal Konfirmasi Hapus Produk -->
<ConfirmDeleteModal :isOpen="deleting" @cancel="deleting = false" @confirm="deleteProduk" title="Hapus Produk"
@ -274,15 +268,6 @@ function formatNumber(num) {
return new Intl.NumberFormat().format(num || 0);
}
function handleItemAdded() {
if (detail.value) {
detail.value.items_count++;
}
creatingItem.value = false;
}
// Hapus produk
async function deleteProduk() {
try {