@extends('admin.layout.content') @section('content')
@if (session('success')) @endif @if (session('error')) @endif @if ($errors->any()) @endif

Produk untuk Dijual

Daftar produk yang sudah diinput untuk dijual.

{{-- Filter Bar --}}
search
@forelse($products as $index => $product) @php $mainMedia = $product->media->where('is_main', true)->first() ?? $product->media->first(); @endphp @empty @endforelse
No Nama Produk Varian Harga Stok Kapasitas Panen Media Aksi
{{ $index + 1 }} {{ $product->product_name }} @if($product->packages->isNotEmpty()) {{ $product->packages->count() }} varian @else Belum ada @endif @if($product->packages->isNotEmpty()) @php $minPrice = $product->packages->min('price'); $maxPrice = $product->packages->max('price'); @endphp @if($minPrice == $maxPrice) Rp{{ number_format($minPrice, 0, ',', '.') }} @else Rp{{ number_format($minPrice, 0, ',', '.') }} - Rp{{ number_format($maxPrice, 0, ',', '.') }} @endif @else - @endif @if($product->packages->isNotEmpty()) @php $totalStock = $product->packages->sum('stock'); @endphp {{ $totalStock }} @else - @endif @php $remainingKg = $product->remaining_kg ?? 0; $harvestKg = $product->harvest_kg ?? 0; $usedKg = $product->used_kg ?? 0; $pct = $harvestKg > 0 ? round(($usedKg / $harvestKg) * 100) : 0; $barColor = $pct >= 90 ? 'bg-danger' : ($pct >= 60 ? 'bg-warning' : 'bg-success'); @endphp
Sisa: {{ number_format($remainingKg, 2) }} Kg
{{ number_format($usedKg, 2) }} / {{ number_format($harvestKg, 2) }} Kg
@if($mainMedia) @if($mainMedia->media_type === 'photo') @else
videocam
@endif @else - @endif
shopping_bag Belum ada produk yang dijual.

Catatan: Hanya produk yang masa tanamnya sudah Panen/Selesai dan memiliki hasil panen (Kg) yang bisa dijual.
Pastikan Anda sudah mencatat hasil panen di menu Masa Tanam.
{{-- ==================== MODAL TAMBAH Produk ==================== --}} {{-- ==================== MODAL DETAIL ==================== --}} {{-- ==================== MODAL HAPUS ==================== --}} {{-- ==================== MODAL EDIT Produk ==================== --}} @endsection