0) { return this.selectedVariant ? (this.selectedProduct.buy_url + '?variant_id=' + this.selectedVariant.id) : null; } return this.selectedProduct.buy_url; }, openProduct(p) { this.selectedProduct = p; this.sheetOpen = true; document.body.style.overflow = 'hidden'; const url = 'https://room.akunesia.co.id/produk/' + p.id; if (window.location.pathname !== '/produk/' + p.id) { history.pushState({ produkSheet: true }, '', url); } }, closeSheet() { this.sheetOpen = false; this.shareOpen = false; document.body.style.overflow = ''; if (window.location.pathname !== 'https://room.akunesia.co.id/produk') { history.pushState({}, '', 'https://room.akunesia.co.id/produk'); } setTimeout(() => { this.selectedProduct = null }, 300); }, dragStart(e) { this.dragging = true; this.dragStartY = e.clientY; this.dragY = 0; }, dragMove(e) { if (!this.dragging) return; this.dragY = Math.max(0, e.clientY - this.dragStartY); }, dragEnd() { if (!this.dragging) return; this.dragging = false; if (this.dragY > 120) { this.closeSheet(); } this.dragY = 0; }, // Filter produk berdasarkan search & kategori aktif, lalu sortir // sesuai pilihan dropdown - 'terbaru' sengaja gak di-sort ulang, // this.products dari awal udah urut terbaru dari backend // (orderByDesc('created_at')), jadi biarin urutan aslinya. get filteredProducts() { const filtered = this.products.filter(p => { const matchesCategory = !this.activeCategory || p.category_id == this.activeCategory; const matchesSearch = !this.search || p.name.toLowerCase().includes(this.search.toLowerCase()); return matchesCategory && matchesSearch; }); if (this.sortBy === 'termurah') return filtered.sort((a, b) => a.price - b.price); if (this.sortBy === 'termahal') return filtered.sort((a, b) => b.price - a.price); if (this.sortBy === 'terlaris') return filtered.sort((a, b) => (b.purchase_count || 0) - (a.purchase_count || 0)); return filtered; } }" x-init="window.addEventListener('popstate', () => { if (sheetOpen) closeSheet(); })" @keydown.escape.window="if (sheetOpen) closeSheet()">

Tidak Ada Produk Ditemukan

Coba gunakan kata kunci pencarian atau kategori lain.