@extends('layouts.admin') @section('header', 'Dashboard') @section('content')

Revenu Total

{{ number_format($totalRevenue, 2) }} MAD

Aujourd'hui: {{ number_format($todayRevenue, 2) }} Ce mois: {{ number_format($monthRevenue, 2) }}

Commandes

{{ $ordersCount }}

{{ $pendingOrders }} en attente {{ $confirmedOrders }} confirmée {{ $shippedOrders }} expédiée {{ $deliveredOrders }} livrée

Produits

{{ $productsCount }}

@php $availableStock = $productsCount - $outOfStockProducts->count(); @endphp En stock: {{ $availableStock }} Rupture: {{ $outOfStockProducts->count() }}

Clients

{{ $usersCount }}

Retours en attente: {{ $returnsPending }}

Commandes (7 derniers jours)

@php $maxVal = max(1, $last7Days->max('total')); $svgW = 600; $svgH = 180; $pad = 30; $count = count($last7Days); $points = ''; $fillPoints = ''; foreach ($last7Days as $i => $day) { $x = $pad + ($i / max(1, $count - 1)) * ($svgW - 2 * $pad); $y = $svgH - $pad - (($day['total'] / $maxVal) * ($svgH - 2 * $pad)); $points .= "$x,$y "; $fillPoints .= "$x,$y "; } // Close fill path to bottom $lastX = $pad + (($count - 1) / max(1, $count - 1)) * ($svgW - 2 * $pad); $firstX = $pad; $bottomY = $svgH - $pad; $fillPoints .= "$lastX,$bottomY $firstX,$bottomY"; @endphp @for($g = 0; $g <= 4; $g++) @php $gy = $pad + ($g / 4) * ($svgH - 2 * $pad); @endphp @endfor @foreach($last7Days as $i => $day) @php $x = $pad + ($i / max(1, $count - 1)) * ($svgW - 2 * $pad); $y = $svgH - $pad - (($day['total'] / $maxVal) * ($svgH - 2 * $pad)); @endphp {{ $day['total'] }} {{ $day['date'] }} @endforeach

Top 5 Produits

@if($topProducts->isNotEmpty())
@foreach($topProducts as $index => $item)
{{ $index + 1 }}

{{ $item->product->name }}

{{ $item->total_sold }} vendu(s)

@endforeach
@else

Aucune vente pour le moment.

@endif
@if($lowStockProducts->isNotEmpty() || $outOfStockProducts->isNotEmpty())

Alertes Stock

@if($lowStockProducts->isNotEmpty())

Stock Faible (≤ 5)

@foreach($lowStockProducts as $product) {{ $product->name }} {{ $product->stock }} @endforeach
@endif @if($outOfStockProducts->isNotEmpty())

En Rupture

@foreach($outOfStockProducts as $product) {{ $product->name }} {{ $product->stock }} @endforeach
@endif
@endif

Commandes Récentes

Voir tout
@forelse($recentOrders as $order) @empty @endforelse
ID Client Articles Total Statut Date
#{{ $order->id }} {{ $order->guest_name }} {{ $order->items_count }} {{ number_format($order->total, 2) }} MAD @php $badges = ['pending' => 'bg-yellow-900/50 text-yellow-400', 'confirmed' => 'bg-blue-900/50 text-blue-400', 'shipped' => 'bg-purple-900/50 text-purple-400', 'delivered' => 'bg-green-900/50 text-green-400', 'cancelled' => 'bg-red-900/50 text-red-400']; $labels = ['pending' => 'En attente', 'confirmed' => 'Confirmée', 'shipped' => 'Expédiée', 'delivered' => 'Livrée', 'cancelled' => 'Annulée']; @endphp {{ $labels[$order->status] ?? $order->status }} {{ $order->created_at->format('d/m/Y') }}
Aucune commande pour le moment.
@endsection