@extends('layouts.app') @section('title', 'Vente') @section('breadcrumb', 'Commercial / Vente') @section('content') @php $vTypes = ['' => 'Tous', 'devis' => 'Devis', 'commande_vente' => 'Commande', 'bl' => 'BL', 'facture_vente' => 'Facture', 'avoir_vente' => 'Avoir']; $tabIcons = ['' => ['fa-th-list','#6b7280'], 'devis' => ['fa-file-alt','#3b82f6'], 'commande_vente' => ['fa-shopping-cart','#f59e0b'], 'bl' => ['fa-truck','#8b5cf6'], 'facture_vente' => ['fa-file-invoice-dollar','#10b981'], 'avoir_vente' => ['fa-undo-alt','#ef4444']]; $activeTab = request('type', ''); $tabBase = request()->except(['type', 'page']); $createUrl = fn($t) => route('vente.create') . '?type=' . $t; @endphp {{-- TABS --}}
@foreach($vTypes as $t => $l) @php $isActive = $activeTab === $t; $href = $t ? route('vente.index', array_merge($tabBase, ['type' => $t])) : ($tabBase ? route('vente.index', $tabBase) : route('vente.index')); $cnt = $t ? ($typeCounts[$t] ?? 0) : $typeCounts->sum(); [$ico, $clr] = $tabIcons[$t]; @endphp {{ $l }} {{ $cnt }} @endforeach
{{-- FILTERS --}}
@if($activeTab)@endif
@forelse($docs as $doc) @empty @endforelse
NuméroTypeClientDateTotal TTCStatutActions
{{ $doc->numero }} {{ $doc->type_libelle }} {{ $doc->client?->nom ?? '-' }} {{ $doc->date->format('d/m/Y') }} {{ number_format($doc->total_ttc, 3, ',', ' ') }} @php $colors = ['brouillon'=>'badge-muted','confirme'=>'badge-info','livre'=>'badge-warning','facture'=>'badge-success','annule'=>'badge-danger']; @endphp {{ ucfirst($doc->statut) }}
@if(!in_array($doc->statut, ['annule','facture'])) @endif
@csrf
@php $venteRowAllowed = ['devis'=>['commande_vente'=>'Commande','bl'=>'Bon de Livraison','facture_vente'=>'Facture'],'commande_vente'=>['bl'=>'Bon de Livraison','facture_vente'=>'Facture'],'bl'=>['facture_vente'=>'Facture'],'facture_vente'=>['avoir_vente'=>'Avoir']]; $cibles = !$doc->converted ? ($venteRowAllowed[$doc->type] ?? []) : []; @endphp @if(count($cibles) > 0) @endif
Aucun document trouvé
@if($docs->hasPages())
{{ $docs->links() }}
@endif
{{-- ═══════════════════════════════════════════════════════ MODAL CONVERSION — partagé pour la liste vente ═══════════════════════════════════════════════════════ --}}
@endsection