Brief production

Offres fournisseurs

Projet : {{ $brief->project?->name ?? '—' }}

Brief : {{ $brief->title }}

Retour au brief
@php $canManageOffers = auth()->user()->hasRole('production_manager') || auth()->user()->hasRole('admin') || auth()->user()->can('manage_brief_offers'); $canSelectOffer = auth()->user()->hasRole('admin') || auth()->user()->can('select_brief_offer'); $defaultTiers = old('tiers', [['quantity' => '', 'price' => '']]); $offersById = $brief->offers->mapWithKeys(fn ($o) => [ $o->id => [ 'id' => $o->id, 'name' => $o->name, 'supplier_id' => $o->supplier_id, 'supplier_name' => $o->supplier?->name ?? '', 'description' => $o->description ?? '', 'delivery_days' => $o->deliveryDays(), 'price' => (float) $o->price, 'pricing_tiers' => $o->pricing_tiers ?? [], ], ]); $restoreEdit = null; if (session('edit_offer_id') && $errors->any()) { $restoreEdit = [ 'id' => (int) session('edit_offer_id'), 'name' => old('name'), 'supplier_id' => old('supplier_id'), 'description' => old('description'), 'delivery_days' => old('delivery_days'), 'pricing_tiers' => old('tiers', [['quantity' => '', 'price' => '']]), ]; } $restoreSelect = null; if (session('select_offer_id') && $errors->hasAny(['quantity', 'selling_price'])) { $restoreSelect = [ 'id' => (int) session('select_offer_id'), 'quantity' => old('quantity'), 'selling_price' => old('selling_price'), ]; } $offersQueryParams = array_filter([ 'return' => request('return'), 'project_id' => request('project_id'), ], fn ($value) => $value !== null && $value !== ''); $openAddOnLoad = $canManageOffers && ! session('edit_offer_id') && $errors->any(); $briefActionIconClass = 'inline-flex h-8 w-8 items-center justify-center rounded-xl border border-rose-200 bg-white text-[#E83646] shadow-sm transition hover:bg-rose-50 hover:shadow-[0_4px_12px_rgba(232,54,70,0.15)]'; $sortedOffers = $brief->offers->sortByDesc('created_at')->values(); $historyRows = collect($allOffersHistory ?? [])->map(function ($offer) { $searchable = mb_strtolower(implode(' ', [ $offer->brief?->title ?? '', $offer->brief?->project?->name ?? '', $offer->name ?? '', $offer->supplier?->name ?? '', $offer->description ?? '', (string) $offer->price, (string) ($offer->deliveryDays() ?? ''), collect($offer->pricing_tiers ?? [])->map(fn ($tier) => ($tier['quantity'] ?? '').' '.($tier['price'] ?? ''))->implode(' '), ])); return ['offer' => $offer, 'searchable' => $searchable]; }); @endphp
{{-- Offers list --}}
@if($canManageOffers) @endif
@forelse($sortedOffers as $offer) @php $briefSearchable = mb_strtolower(implode(' ', [ $offer->name ?? '', $offer->supplier?->name ?? '', $offer->description ?? '', (string) $offer->price, (string) ($offer->deliveryDays() ?? ''), collect($offer->pricing_tiers ?? [])->map(fn ($tier) => ($tier['quantity'] ?? '').' '.($tier['price'] ?? ''))->implode(' '), ])); $offerPayload = [ 'id' => $offer->id, 'name' => $offer->name, 'supplier_id' => $offer->supplier_id, 'supplier_name' => $offer->supplier?->name ?? '', 'description' => $offer->description ?? '', 'delivery_days' => $offer->deliveryDays(), 'price' => (float) $offer->price, 'pricing_tiers' => $offer->pricing_tiers ?? [], ]; @endphp @empty @endforelse
Nom Fournisseur Description Délai Prix HT Date Statut Actions
{{ $offer->name ?: '—' }} {{ $offer->supplier?->name ?? '—' }} {{ $offer->description ?: '—' }} {{ $offer->formattedDeliveryDays() }} {{ number_format($offer->price, 3, ',', ' ') }} DT @if(!empty($offer->pricing_tiers))
@foreach($offer->pricing_tiers as $tier)
{{ number_format((float) ($tier['quantity'] ?? 0), 0, ',', ' ') }} pcs → {{ number_format((float) ($tier['price'] ?? 0), 3, ',', ' ') }} DT
@endforeach
@endif
{{ $offer->created_at?->format('d/m/Y H:i') }} @if($offer->is_selected)
Retenue @if($brief->production_quantity || $brief->selling_price)

@if($brief->production_quantity) {{ number_format((int) $brief->production_quantity, 0, ',', ' ') }} pcs @endif @if($brief->production_quantity && $brief->selling_price) · @endif @if($brief->selling_price) {{ number_format((float) $brief->selling_price, 3, ',', ' ') }} DT vente @endif

@endif
@else En attente @endif
@if($canSelectOffer && ! $offer->is_selected) @endif @if($canManageOffers) @endif

Aucune offre pour ce brief.

@if($canManageOffers) @endif
Filtrage en direct sur les offres de ce brief.
@if($canManageOffers) {{-- Modal: nouvelle offre --}} {{-- Modal: modifier offre --}} @endif @if($canSelectOffer)
@endif