@extends('admin.layouts.app') @section('content')
{{-- Header --}}
@if (request()->hasAny(['search', 'category', 'status', 'brand'])) Reinitialiser @endif
Nouveau produit
{{-- Table --}}
@php $currentSort = request('sort', 'created_at'); $currentDir = request('dir', 'desc'); $sortUrl = function (string $col) use ($currentSort, $currentDir) { $dir = ($currentSort === $col && $currentDir === 'asc') ? 'desc' : 'asc'; return request()->fullUrlWithQuery(['sort' => $col, 'dir' => $dir]); }; $sortIcon = function (string $col) use ($currentSort, $currentDir) { if ($currentSort !== $col) return ''; return $currentDir === 'asc' ? ' ↑' : ' ↓'; }; @endphp @forelse ($products as $product) @empty @endforelse
Nom{!! $sortIcon('name') !!} Categorie Prix Stock{!! $sortIcon('stock_quantity') !!} Vendus Statut{!! $sortIcon('is_active') !!} Actions
{{ $product->name }} @if ($product->sku)
SKU: {{ $product->sku }}
@endif
{{ $product->category?->name ?? '—' }} @php $priceTTC = $product->sale_price ?? $product->price; $priceHT = $priceTTC / 1.20; @endphp @if ($product->sale_price) {{ number_format($priceHT, 2, ',', ' ') }} € HT
{{ number_format($product->price, 2, ',', ' ') }} {{ number_format($product->sale_price, 2, ',', ' ') }} € TTC @else {{ number_format($priceHT, 2, ',', ' ') }} € HT
{{ number_format($priceTTC, 2, ',', ' ') }} € TTC @endif
@if ($product->manage_stock) @if ($product->stock_quantity <= 0) 0 @elseif ($product->stock_quantity <= 5) {{ $product->stock_quantity }} @else {{ $product->stock_quantity }} @endif @else @endif {{ (int) $product->total_sold }} @if ($product->is_active) Visible @else Masque @endif
@csrf @method('DELETE')
Aucun produit.
{{-- Pagination --}} @if ($products->hasPages())
{{ $products->links() }}
@endif
@endsection