diff --git a/resources/js/components/StrukOverlay.vue b/resources/js/components/StrukOverlay.vue index ac66435..02203c2 100644 --- a/resources/js/components/StrukOverlay.vue +++ b/resources/js/components/StrukOverlay.vue @@ -64,18 +64,23 @@ - + + 1 - + - {{ item.produk?.nama || '' }} + {{ item.produk?.nama || '' }} {{ item.produk.nama ? (item.nampan?.nama || 'Brankas') : '' }} @@ -240,6 +245,32 @@ const grandTotal = computed(() => { return props.total + (ongkosBikin.value || 0) }) +// Fungsi untuk menentukan style row berdasarkan jumlah item +const getRowStyle = () => { + if (props.pesanan.length === 1) { + return { height: '126px' } // 2x lipat dari tinggi normal (48px) + } + return { height: '63px' } // Tinggi normal +} + + + +// Fungsi untuk menentukan class gambar berdasarkan jumlah item +const getImageClass = () => { + if (props.pesanan.length === 1) { + return 'w-25 h-25' // 2x lipat dari ukuran normal (w-10 h-10) + } + return 'w-12 h-12' // Ukuran normal +} + +// Fungsi untuk menentukan class text berdasarkan jumlah item +const getTextClass = () => { + if (props.pesanan.length === 1) { + return 'text-lg font-medium' // Text lebih besar untuk single item + } + return 'text-sm' // Text normal +} + const getCurrentDate = () => { const days = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'] const months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] @@ -354,14 +385,6 @@ onMounted(() => { } }) -const pesananMinimal = computed(() => { - const arr = [...props.pesanan] - while (arr.length < 2) { - arr.push({ produk: {}, harga_deal: 0, posisi: '' }) - } - return arr -}) - function formatInput(e) { let value = e.target.value.replace(/\D/g, ""); ongkosBikin.value = value ? parseInt(value, 10) : null; diff --git a/resources/js/components/StrukView.vue b/resources/js/components/StrukView.vue index a838a87..0134c61 100644 --- a/resources/js/components/StrukView.vue +++ b/resources/js/components/StrukView.vue @@ -2,7 +2,7 @@
- + @@ -200,7 +199,7 @@ const emit = defineEmits(['close']) const formatDate = (dateString) => { if (!dateString) return '-' - const days = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'] + const days = ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'] const months = ['01','02','03','04','05','06','07','08','09','10','11','12'] const date = new Date(dateString) const dayName = days[date.getDay()] @@ -216,12 +215,31 @@ const itemsWithMinimal = computed(() => { props.transaksi.item_transaksi || [] const arr = [...items] - while (arr.length < 2) { - arr.push({ produk: {}, harga_deal: 0, posisi_asal: '' }) - } + // biar minimal ada 1 row terlihat + if (arr.length === 0) arr.push({ produk: {}, harga_deal: 0, posisi_asal: '' }) return arr }) +// === Tambahan style/helper sama dengan strukoverlay === +const getRowStyle = () => { + if (itemsWithMinimal.value.length === 1) { + return { height: '126px' } + } + return { height: '63px' } +} +const getImageClass = () => { + if (itemsWithMinimal.value.length === 1) { + return 'w-25 h-25' + } + return 'w-12 h-12' +} +const getTextClass = () => { + if (itemsWithMinimal.value.length === 1) { + return 'text-lg font-medium' + } + return 'text-sm' +} + const handlePrint = () => { window.print() } @@ -252,12 +270,11 @@ const formatNumber = (number) => { position: absolute; top: 0; left: 0; - transform: scale(0.5); /* perkecil 2x lipat */ - transform-origin: top left; /* supaya mengecil dari pojok kiri atas */ + transform: scale(0.5); + transform-origin: top left; } .no-print { display: none !important; } } -