@extends('layouts.index') @section('content')

Agent Shop

Orders
@if(session('success'))
{{ session('success') }}
@endif
{{-- ═══════════════════════════════════════ WATER PRODUCTS SECTION ══════════════════════════════════════════ --}} @if ($packaged_products->count() > 0 || $refill_products->count() > 0 || $products->count() > 0)
{{-- ── TAB 1: Packaged Water ────────────────────── --}} @if($packaged_products->count() > 0)
@foreach ($packaged_products as $product) @php $hasVariants = $product->variants->count() > 0; if ($hasVariants) { $variants = $product->variants->where('variant_status', '!=', 'inactive'); $isDual = $variants->whereIn('selling_unit', ['bottle','pack'])->count() > 0; $anyStock = $variants->sum('variant_quantity') > 0; $minPrice = $variants->min('variant_price'); } else { $variants = collect([]); $isDual = false; $anyStock = $product->product_quantity > 0; $minPrice = $product->product_price; } @endphp
📦
{{ $product->product_name }} KES {{ number_format($minPrice, 2) }}
@if($hasVariants) @if($isDual) Bottle / Pack
@endif @if($anyStock) Choose Size @else No Stock @endif @else Stock: {{ $product->product_quantity }} @if($anyStock) Add to Cart @else Out of stock @endif @endif
@endforeach
@endif {{-- ── TAB 2: Refill Water ─────────────────────── --}} @if($refill_products->count() > 0)
@foreach ($refill_products as $refill)
@endforeach

Refills have no stock limit – they are served from the main tank.

@endif {{-- ── TAB 3: Other Products ───────────────────── --}} @if($products->count() > 0)
@foreach ($products as $product) @php $hasVariants = $product->variants->count() > 0; if ($hasVariants) { $variants = $product->variants->where('variant_status', '!=', 'inactive'); $anyStock = $variants->sum('variant_quantity') > 0; $minPrice = $variants->min('variant_price'); } else { $variants = collect([]); $anyStock = $product->product_quantity > 0; $minPrice = $product->product_price; } @endphp
🛍️
{{ $product->product_name }} KES {{ number_format($minPrice, 2) }}
@if($hasVariants) @if($anyStock) Choose Size @else No Stock @endif @else Stock: {{ $product->product_quantity }} @if($anyStock) Add to Cart @else Out of stock @endif @endif
@endforeach
@endif
{{-- tab-content --}}
@else
No products available in your inventory.
@endif

Sale Order

@csrf
Product Qty Sub
Cart is empty
Subtotal KES 0.00
Discount (%)
Total KES 0.00
@endsection @section('script') @endsection