@extends('layouts.app') @section('title', 'Détails du client') @section('page-title', $client->nom) @section('content') @php $formatPrice = fn($n) => number_format($n, 0, ',', ' ') . ' FCFA'; @endphp
Retour à la liste

Informations client

Référence

{{ $client->reference }}

Nom complet

{{ $client->nom }}

Téléphone

{{ $client->telephone }}

Adresse

{{ $client->adresse ?? '—' }}

Caution d'ouverture

{{ $formatPrice($client->caution) }}

Historique des achats (factures)

@forelse($client->ventes as $vente) @php $montantPaye = (float) ($vente->paiements_sum_montant_paye ?? $vente->montant_paye ?? 0); $restant = max(0, (float) $vente->montant - $montantPaye); $statutLabel = match($vente->statut_paiement ?? '') { \App\Models\Vente::STATUT_PAYE => 'Payé', \App\Models\Vente::STATUT_PARTIELLEMENT => 'Partiel', \App\Models\Vente::STATUT_EN_ATTENTE => 'En attente', default => $vente->statut_paiement ?? '—', }; $statutClass = match($vente->statut_paiement ?? '') { \App\Models\Vente::STATUT_PAYE => 'bg-emerald-100 text-emerald-700', \App\Models\Vente::STATUT_PARTIELLEMENT => 'bg-amber-100 text-amber-700', \App\Models\Vente::STATUT_EN_ATTENTE => 'bg-slate-100 text-slate-600', default => 'bg-slate-100 text-slate-600', }; @endphp @empty @endforelse
Réf. Produit Magasin Montant Statut paiement Montant payé Restant Date
{{ $vente->reference }} {{ $vente->produit?->designation ?? '—' }} {{ $vente->magasin?->nom ?? '—' }} {{ $formatPrice($vente->montant) }} {{ $statutLabel }} {{ $formatPrice($montantPaye) }} {{ $formatPrice($restant) }} {{ $vente->date_vente?->format('d/m/Y') ?? '—' }}
Aucun achat enregistré
@if($client->ventes->isNotEmpty()) @php $totalFactures = $client->ventes->sum('montant'); $totalPaye = (float) $client->ventes->sum('paiements_sum_montant_paye'); $totalRestant = max(0, $totalFactures - $totalPaye); @endphp
Total factures : {{ $formatPrice($totalFactures) }} Total payé : {{ $formatPrice($totalPaye) }} Total restant : {{ $formatPrice($totalRestant) }}
@endif
@endsection