@extends('layouts.app') @section('title', 'Ventes') @section('page-title', 'Ventes') @php $clientsOptions = $clients->map(fn($c) => ['value' => $c->id, 'label' => $c->nom])->values()->all(); $produitsOptions = $produits->map(fn($p) => ['value' => $p->id, 'label' => $p->designation . ($p->reference ? ' (' . $p->reference . ')' : ''), 'prix_vente' => (float) ($p->prix_vente ?? 0)])->values()->all(); $produitsData = $produits->keyBy('id')->map(fn($p) => (float) ($p->prix_vente ?? 0))->all(); $magasinsOptions = $magasins->map(fn($m) => ['value' => $m->id, 'label' => $m->nom])->values()->all(); $modePaiementOptions = [ ['value' => 'Espèce', 'label' => 'Espèce'], ['value' => 'OM', 'label' => 'Orange Money (OM)'], ['value' => 'Wave', 'label' => 'Wave'], ['value' => 'MTN', 'label' => 'MTN Money'], ['value' => 'Autre', 'label' => 'Autre'], ]; $statutOptions = [ ['value' => 'en_attente', 'label' => 'En attente'], ['value' => 'partiellement', 'label' => 'Partiellement payé'], ['value' => 'paye', 'label' => 'Payé'], ]; @endphp @section('content')
Exporter @if(request()->hasAny(['date_debut', 'date_fin', 'statut_paiement'])) Réinitialiser @endif
@forelse($ventes as $index => $v) @empty @endforelse
Réf. Client Produit Magasin Montant Payé Montant Restant Mode paiement Statut paiement Date Actions
{{ $v->reference }} {{ $v->client->nom }} {{ $v->produit?->designation ?? '—' }} {{ $v->magasin->nom }} {{ number_format($v->montant - (optional($v->creance)->montant_restant ?? 0), 0, ',', ' ') }} FCFA {{ number_format(optional($v->creance)->montant_restant ?? 0, 0, ',', ' ') }} FCFA {{ optional($v->paiement)->mode_paiement ?? '—' }} @php $statutClasses = [ 'paye' => 'bg-emerald-100 text-emerald-700', 'partiellement' => 'bg-amber-100 text-amber-700', 'en_attente' => 'bg-slate-100 text-slate-700', ]; $statutLabels = ['paye' => 'Payé', 'partiellement' => 'Partiellement', 'en_attente' => 'En attente']; @endphp {{ $statutLabels[$v->statut_paiement] ?? $v->statut_paiement }} {{ $v->date_vente->format('d/m/Y') }}
Aucune vente enregistrée
@if($ventes->hasPages())
{{ $ventes->links() }}
@endif

Nouvelle vente

Enregistrer une vente pour un client

@csrf {{-- Client & Produit --}}
Client & Produit
{{-- Montant & Paiement --}}
Montant & Paiement
@if($errors->any())
@foreach($errors->all() as $error)

{{ $error }}

@endforeach
@endif
{{-- Modal : Ajouter un nouveau client (depuis le formulaire de vente) --}}

Nouveau client

Le client sera ajouté à la liste et sélectionné pour cette vente.

{{-- Modal : Enregistrer un paiement (vente en attente / partiellement payée) --}}

Enregistrer un paiement

Vente — Reste à payer :

@csrf
Êtes-vous sûr de vouloir supprimer la vente « » ? Cette action est irréversible.
@endsection