@props(['product']) @php $tenant = $product->tenant; $image = $product->image_url; $price = number_format($product->price, 0, ',', '.'); $compare = $product->compare_price && $product->compare_price > $product->price ? number_format($product->compare_price, 0, ',', '.') : null; $medicineClass = $product->medicineProfile?->medicine_class ?? null; $salesCount = (int) ($product->sales_count ?? 0); $location = optional($product->inventories->first()?->outlet)->city; $discountPercent = null; $variants = $product->variants->where('is_active', true)->map(fn ($variant) => [ 'id' => $variant->id, 'name' => $variant->name, 'price' => (int) $variant->price, 'stock' => (int) $variant->inventories->sum(fn ($inventory) => max(0, $inventory->quantity_available - $inventory->quantity_reserved)), ])->values(); if ($product->compare_price && $product->compare_price > $product->price) { $discountPercent = intval((($product->compare_price - $product->price) / max(1, $product->compare_price)) * 100); } @endphp
@csrf
{{ $product->name }} @if($discountPercent) -{{ $discountPercent }}% @endif
@if($product->medicineProfile?->requires_prescription) Wajib resep @endif

{{ $product->name }}

Rp{{ $price }} @if($compare) Rp{{ $compare }} @endif

{{ $tenant->name }}

{{ number_format($salesCount, 0, ',', '.') }} terjual @if($location)ยท{{ $location }}@endif