diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index b747b34..d3cfec4 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -326,6 +326,7 @@ class CustomerController extends Controller 'status_order' => "Belum Bayar", 'email' => $biodataResult['email'], 'alamat' => $biodataResult['alamat'], + 'entry_at' => Carbon::now()->format('Y-m-d H:i:s.u'), ]; $order = Order::create($payloadOrder); foreach ($dataCart as $cart) { @@ -417,7 +418,6 @@ class CustomerController extends Controller ], 200); return back()->with('success', 'Bukti pembayaran berhasil diunggah.'); } catch (\Throwable $th) { - dd($th); DB::rollBack(); return response([ 'status' => false, @@ -438,6 +438,7 @@ class CustomerController extends Controller } public function checkOrder(){ + $payload = [ 'title' => 'Check Order' ]; diff --git a/public/asset_guests/css/main.css b/public/asset_guests/css/main.css index 29b569d..65f936e 100644 --- a/public/asset_guests/css/main.css +++ b/public/asset_guests/css/main.css @@ -1836,3 +1836,93 @@ section, flex-wrap: wrap; } } + + + /* =============== 375 PX FIX =============== */ +@media (max-width: 375px) { + + /* CARD */ + .col-6.col-xs-12 { + flex: 0 0 50%; + max-width: 50%; + } + + .card { + border-radius: 12px; + margin-bottom: .75rem; + } + + /* GAMBAR */ + .card img { + height: 120px !important; + } + + /* OVERLAY */ + .position-absolute[style*="height:50%"] { + height: 35% !important; + } + + /* NAMA */ + .position-absolute.bottom-0.start-0 h6 { + font-size: .75rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; + margin-bottom: .1rem; + } + + /* BADGE KALORI, KATEGORI, SIANG/SORE */ + .position-absolute.bottom-0.start-0 .badge, + .position-absolute.bottom-0.end-0 .badge { + font-size: .5rem !important; + padding: .15rem .35rem; + max-width: 90%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + /* CHIP TANGGAL */ + .d-flex.gap-1.overflow-auto span { + font-size: .6rem !important; + padding: .15rem .35rem; + white-space: nowrap; + } + + /* HARGA */ + .row.text-muted.small { + font-size: .7rem !important; + } + + /* TOMBOL */ + .btn { + font-size: .60rem !important; /* ≈ 10 px */ + padding: .31rem .41rem !important; + border-radius: .25rem !important; + } + + + .d-flex.justify-content-between small { font-size: .65rem; } + .d-flex.justify-content-between strong { font-size: .65rem; } + +} + +/* fallback < 360 px menjadi 1 kolom */ +@media (max-width: 359px) { + .col-6.col-xs-12 { + flex: 0 0 100%; + max-width: 100%; + } + + @media (max-width: 340px) { + .d-flex.p-2 { flex-direction: column; gap: .5rem; } + .btn { width: 100% !important; font-size: .7rem; padding: .35rem 0; } + } +} + +#floatingCartButton:hover, +#menuBtn:hover { + transform: translateX(-50%) translateY(-2px); + transition: transform .25s; +} \ No newline at end of file diff --git a/public/js/checkout/action.js b/public/js/checkout/action.js index a4f1f0a..7d6c1d4 100644 --- a/public/js/checkout/action.js +++ b/public/js/checkout/action.js @@ -122,7 +122,7 @@ async function submitOrderToServer(){ confirmButtonText: 'Tutup!' }).then(() => { window.location.href = "/"; - });; + }); } } catch (err) { sessionStorage.removeItem('cart'); diff --git a/public/js/order_guest/checkout.js b/public/js/order_guest/checkout.js index e29a163..e253792 100644 --- a/public/js/order_guest/checkout.js +++ b/public/js/order_guest/checkout.js @@ -31,6 +31,7 @@ let orderIndex = 0; function renderCartList() { $("#cartSidebar").offcanvas('show') $('#floatingCartButton').addClass('d-none'); + $('#menuBtn').addClass('d-none'); const cart = JSON.parse(sessionStorage.getItem('cart') || '[]'); let total = 0; @@ -129,6 +130,7 @@ let orderIndex = 0; if (cart.length > 0) { $('#floatingCartButton').removeClass('d-none'); + $('#menuBtn').removeClass('d-none'); $('#floatingCartCount').text(totalItem); $('#floatingCartTotal').text('Rp ' + totalHarga.toLocaleString('id-ID')); $('#floatingCartDesc').text(`Total pesanan dari ${cart[0].nama_menu}`); diff --git a/public/js/order_guest/index.js b/public/js/order_guest/index.js index 9839aea..ceb3b30 100644 --- a/public/js/order_guest/index.js +++ b/public/js/order_guest/index.js @@ -2,6 +2,7 @@ const cart = JSON.parse(sessionStorage.getItem('cart') || '[]'); if (cart.length > 0) { $('#floatingCartButton').removeClass('d-none'); + $('#menuBtn').removeClass('d-none'); } }); @@ -100,85 +101,95 @@ menus?.forEach(menu => { html += ` -
-
- - ${menu.nama_menu} - -
- ${ - menu.apakah_someday - ? ` Tersedia setiap hari (Senin - Minggu)` - : (menu.dmph && menu.dmph.length > 0 - ? ` Tersedia pada tanggal: - ${menu.dmph.slice(0, 5).map(i => i.tgl_harian).join(', ')} - ${menu.dmph.length > 5 ? ` dan ${menu.dmph.length - 5} lainnya...` : ''}` - : ` Tidak tersedia saat ini`) - } -
+
+
+ +
+ ${menu.nama_menu} - -
- ${ - menu.apakah_menu_siang && menu.apakah_menu_sore - ? ` Tersedia untuk makan siang dan sore` - : menu.apakah_menu_siang - ? ` Tersedia untuk makan siang` - : menu.apakah_menu_sore - ? ` Tersedia untuk makan sore` - : ` Tidak tersedia untuk waktu makan apapun` - } + +
+ + + +
+
${menu.nama}
+ ${menu?.kalori.length > 0 ? ` + ${(menu.kalori || []).slice(0,1).map(k=>k.nilai_kalori||0).join('')} kkal`: ''}
-
- ${ - menu.apakah_someday - ? `Menu Someday -` - : `Menu Normal -` - } -
- -
${menu.nama} ${(menu.kalori || []) + +
+ ${(menu.klasifikasiMenu || []) .slice(0, 2) - .map(kkal => { - const name = kkal.nilai_kalori || ''; + .map(tag => { + const name = tag.nama_kategori_diet || ''; const truncated = name.length > 12 ? name.substring(0, 12) + '...' : name; - return `${truncated} kkal`; + return `${truncated}`; }).join('')} - ${(menu.kalori || []).length > 2 - ? `+${(menu.klasifikasiMenu.length - 2)} lainnya` - : ''}
-
-
Harga
-
Karyawan:
-
Rp ${parseInt(menu.harga_karyawan).toLocaleString('id-ID')}
-
Public:
-
Rp ${parseInt(menu.harga_public).toLocaleString('id-ID')}
-
- - - -
- ${(menu.klasifikasiMenu || []) - .slice(0, 2) - .map(tag => { - const name = tag.nama_kategori_diet || ''; - const truncated = name.length > 12 ? name.substring(0, 12) + '...' : name; - return `${truncated} `; - }).join('')} - ${(menu.klasifikasiMenu || []).length > 2 - ? `+${(menu.klasifikasiMenu.length - 2)} lainnya` + ${(menu.klasifikasiMenu || []).length > 2 + ? `+${menu.klasifikasiMenu.length - 2} lainnya` : ''}
+ +
+ ${menu.apakah_someday + ? 'Someday' + : 'Normal'} +
- -
-
+ + +
+ Tersedia: + +
+
+ ${menu.apakah_someday + ? 'Setiap hari' + : (Array.isArray(menu.dmph) && menu.dmph.length > 0 + ? menu.dmph.slice(0, 6).map(d => + `${d.tgl_harian}` + ).join('') + : 'Tutup')} +
+
+
+ + + +
+ Karyawan + Rp ${parseInt(menu.harga_karyawan).toLocaleString('id-ID')} +
+
+ Public + Rp ${parseInt(menu.harga_public).toLocaleString('id-ID')} +
+ + + + +
+ -
-
+
`; @@ -336,6 +345,7 @@ if (menuNames.length > maxLength) { menuNames = menuNames.substring(0, maxLength).trim() + '...'; } + $('#menuBtn').removeClass('d-none'); $('#floatingCartButton').removeClass('d-none'); $('#floatingCartCount').text(cart.length); $('#floatingCartDesc').text(menuNames); @@ -343,6 +353,7 @@ } else { $cartCount.hide(); $('#floatingCartButton').addClass('d-none'); + $('#menuBtn').addClass('d-none'); } } @@ -481,5 +492,51 @@ } } + function toggleCartList() { + const list = document.getElementById('cartList'); + list.classList.toggle('d-none'); + const cart = JSON.parse(sessionStorage.getItem('cart') || '[]'); + renderCart(cart); + + // jika baru dibuka, render & pasang listener + if (!list.classList.contains('d-none')) { + setTimeout(() => document.addEventListener('click', closeOnOutside, { once: true }), 0); + } + } + + function renderCart(cart) { + const body = document.getElementById('cartListBody'); + body.innerHTML = cart.length + ? cart.map((it, i) => ` +
+ ${it.nama_menu} + +
+ `).join('') + : '

Keranjang kosong

'; + if (cart.length === 0) { + document.getElementById('cartList').classList.add('d-none'); + } + } + + function removeItem(index) { + const cart = JSON.parse(sessionStorage.getItem('cart') || '[]'); + cart.splice(index, 1); + sessionStorage.setItem('cart', JSON.stringify(cart)); + renderCart(cart); + updateCartCount(cart.length); + } + + function closeOnOutside(e) { + const list = document.getElementById('cartList'); + const removeButton = e.target.closest('button[onclick^="removeItem"]') + if (!list.contains(e.target) && !document.getElementById('menuBtn').contains(e.target) && !removeButton) { + list.classList.add('d-none'); + } + } + + diff --git a/resources/views/guest/index.blade.php b/resources/views/guest/index.blade.php index 11197cb..f9d15c1 100644 --- a/resources/views/guest/index.blade.php +++ b/resources/views/guest/index.blade.php @@ -58,36 +58,63 @@ Menampilkan menu...
-