Compare commits

..

No commits in common. "87d38dffb8a675201da9a27508ba51e194b25a9e" and "4e06c250829b40ab58c24f166af42fbc9cb08b4b" have entirely different histories.

View File

@ -54,11 +54,11 @@
@click.self="closeOverlay" @click.self="closeOverlay"
> >
<div <div
class="bg-white rounded-lg shadow-lg p-6 w-[450px] border-2 border-[#e6d3b3] relative flex flex-col items-center" class="bg-white rounded-lg shadow-lg p-6 w-[400px] border-2 border-[#e6d3b3] relative flex flex-col items-center"
@mouseleave="closeOverlay"
> >
<!-- Foto Produk --> <!-- Foto Produk dengan Slider -->
<div class="relative w-72 h-72 border border-[#e6d3b3] flex items-center justify-center mb-3 overflow-hidden rounded"> <div class="relative w-60 h-60 border border-[#e6d3b3] flex items-center justify-center mb-4 overflow-hidden rounded">
<img <img
v-if="detail.foto && detail.foto.length > 0" v-if="detail.foto && detail.foto.length > 0"
:src="detail.foto[currentFotoIndex].url" :src="detail.foto[currentFotoIndex].url"
@ -83,7 +83,7 @@
<button <button
v-if="detail.foto && detail.foto.length > 1" v-if="detail.foto && detail.foto.length > 1"
@click.stop="prevFoto" @click.stop="prevFoto"
class="absolute left-2 bg-white/80 hover:bg-white text-black px-2 py-1 rounded-full shadow" class="absolute left-2 bg-white/70 hover:bg-white text-black px-2 py-1 rounded"
> >
</button> </button>
@ -91,47 +91,40 @@
<button <button
v-if="detail.foto && detail.foto.length > 1" v-if="detail.foto && detail.foto.length > 1"
@click.stop="nextFoto" @click.stop="nextFoto"
class="absolute right-2 bg-white/80 hover:bg-white text-black px-2 py-1 rounded-full shadow" class="absolute right-2 bg-white/70 hover:bg-white text-black px-2 py-1 rounded"
> >
</button> </button>
</div> </div>
<!-- Nama Produk -->
<p class="text-lg font-semibold text-center mb-4">{{ detail.nama }}</p>
<!-- Detail Harga & Info --> <!-- Detail Harga & Info -->
<div class="grid grid-cols-2 gap-y-2 gap-x-4 text-sm w-full mb-6"> <div class="grid grid-cols-2 gap-2 text-sm mb-4 w-full">
<p class="col-span-1">Harga Jual :</p> <!-- harga beli dihapus -->
<p class="col-span-1 text-right">Rp. {{ formatNumber(detail.harga_jual) }}</p> <p>Harga Jual : Rp. {{ formatNumber(detail.harga_jual) }}</p>
<p class="text-right">{{ detail.kadar }} K</p>
<p class="col-span-1">Kadar :</p> <p class="col-span-2 text-center">
<p class="col-span-1 text-right">{{ detail.kadar }} K</p> Berat : {{ detail.berat }} gram
</p>
<p class="col-span-1">Berat :</p> <p class="col-span-2">
<p class="col-span-1 text-right">{{ detail.berat }} gram</p> Harga/gram : Rp. {{ formatNumber(detail.harga_per_gram) }}
</p>
<p class="col-span-1">Harga/gram :</p>
<p class="col-span-1 text-right">Rp. {{ formatNumber(detail.harga_per_gram) }}</p>
</div> </div>
<!-- Tombol Aksi --> <!-- Tombol Aksi -->
<div class="flex w-full gap-3"> <div class="flex justify-between w-full">
<button class="flex-1 bg-yellow-400 text-black py-2 rounded font-bold"> <button class="bg-yellow-400 text-black px-4 py-2 rounded font-bold">
Ubah Ubah
</button> </button>
<button @click="openItemModal" class="bg-green-400 text-black px-4 py-2 rounded font-bold"> <button @click="openItemModal" class="bg-green-400 text-black px-4 py-2 rounded font-bold">
Tambah Tambah
</button> </button>
<button class="flex-1 bg-red-500 text-white py-2 rounded font-bold"> <button class="bg-red-500 text-white px-4 py-2 rounded font-bold">
Hapus Hapus
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</mainLayout> </mainLayout>
</template> </template>
@ -150,7 +143,7 @@ const creatingItem = ref(false);
const openItemModal = () => { const openItemModal = () => {
console.log("open item modal", detail.value); console.log("open item modal", detail.value);
creatingItem.value = true; creatingItem.value = true;
}; };
const closeItemModal = () => { const closeItemModal = () => {
@ -194,13 +187,10 @@ const filteredProducts = computed(() => {
}); });
// buka overlay // buka overlay
function openOverlay(id) { async function openOverlay(id) {
const produk = products.value.find((p) => p.id === id); detail.value = products.value.find(p => p.id === id) ;
if (produk) { currentFotoIndex.value = 0;
detail.value = produk; showOverlay.value = true;
currentFotoIndex.value = 0; // reset ke foto pertama
showOverlay.value = true;
}
} }
// tutup overlay // tutup overlay