@extends('layouts.dashboard') @section('content') @php $totalProducts = \App\Models\Product::count(); $missingImages = \App\Models\Product::where(function($q){ $q->whereNull('main_image')->orWhere('main_image', ''); })->count(); $withPrices = \App\Models\Product::where(function($q){ $q->where('van_sales_price','>',0)->orWhere('default_van_sales_price','>',0); })->count(); $activeProducts = \App\Models\Product::where('status', 'active')->count(); $discontinuedProducts = \App\Models\Product::where('status', 'discontinued')->count(); @endphp
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif

Products

Product library with prices, images, SKU and barcode.

{{ $totalProducts }} Products
{{ $activeProducts }} Active
{{ $discontinuedProducts }} Stop Production
{{ $withPrices }} With Prices
{{ $missingImages }} Missing Images
Reset
@foreach($products as $product) @php $effectiveImage = $product->effective_image ?? $product->main_image; $familyKey = $product->family_key; $suggestions = collect(); if ($familyKey) { $suggestions = \App\Models\Product::query() ->where('id', '!=', $product->id) ->whereNotNull('main_image') ->where('main_image', '!=', '') ->where('family_key', $familyKey) ->limit(12) ->get(); } if ($suggestions->isEmpty()) { $suggestions = \App\Models\Product::query() ->where('id', '!=', $product->id) ->whereNotNull('main_image') ->where('main_image', '!=', '') ->when($product->category, fn($q) => $q->where('category', $product->category)) ->limit(12) ->get(); } @endphp
@if($product->is_test_data)
QA ยท TEST DATA
@endif @if($effectiveImage) @else
๐Ÿ–ผ
Missing Image
@endif @if($product->image_source_product_id)
Linked
@endif @if($product->status === 'discontinued')
๐Ÿ”ด Stop Production
@else
๐ŸŸข Active
@endif @if(($product->van_sales_price ?? $product->default_van_sales_price) > 0)
AED {{ number_format($product->van_sales_price ?? $product->default_van_sales_price, 2) }}
@else
Ask Price
@endif
@csrf

{{ $product->name }}

SKU: {{ $product->sku ?: '-' }}
Family: {{ $product->family_key ?: '-' }}
Barcode: {{ $product->barcode ?: '-' }}
Category: {{ $product->category ?: '-' }}
@if($effectiveImage && $product->family_key)
@csrf
@endif
@csrf
@csrf
@endforeach
{{ $products->links() }}
@endsection