@extends('layouts.app') @section('title', 'Achats') @section('page-title', 'Achats') @php $fournisseursOptions = $fournisseurs->map(fn($f) => [ 'value' => $f->id, 'label' => $f->nom, ])->values()->all(); $produitsOptions = $produits->map(fn($p) => [ 'value' => $p->id, 'label' => $p->designation . ($p->reference ? ' (' . $p->reference . ')' : ''), ])->values()->all(); $magasinsOptions = $magasins->map(fn($m) => [ 'value' => $m->id, 'label' => $m->nom, ])->values()->all(); $achatsData = $achats->map(function ($a) { return [ 'id' => $a->id, 'type' => $a->type ?? 'achat', 'reference' => $a->reference ?? '', 'fournisseur' => $a->fournisseur->nom ?? '', 'produit' => $a->produit->designation ?? '', 'quantite' => (int) ($a->quantite ?? 0), 'montant' => (float) ($a->montant ?? 0), 'statut_achat' => $a->statut_achat ?? 'soldé', 'date' => optional($a->date_achat)->format('d/m/Y') ?? '', 'can_retour' => ! auth()->user()->hasRole('Vendeur') || (int) $a->user_id === (int) auth()->id(), ]; })->values()->all(); @endphp @section('content')
| Réf. | Type | Paiement | Fournisseur | Produit | Qté | Montant | Date | Actions |
|---|---|---|---|---|---|---|---|---|
| Achat Retour marchandise | — |
|
Enregistrer un nouvel achat auprès d'un fournisseur