@php $periodList = $planMediaProposal->operations ->flatMap(function($op) { $sp = $op->pivot->select_period; return $sp ? json_decode($sp, true) : []; }) ->unique()->sort()->values(); $grandTotal = 0; @endphp @if($periodList->isEmpty())
Le client n'a pas encore sélectionné de périodes.
@else
@foreach($periodList as $period) @endforeach @foreach($planMediaProposal->operations as $op) @php $selectPeriod = $op->pivot->select_period ? json_decode($op->pivot->select_period, true) : []; $unitPrice = $op->pivot->discount_price ?: $op->technical_cost; $count = 0; @endphp @foreach($periodList as $period) @endforeach @endforeach
Média Type Nb Lecteur Dotation € {{ ucfirst(\Carbon\Carbon::parse($period . '-01')->locale('fr')->shortMonthName) }} {{ \Carbon\Carbon::parse($period . '-01')->format('Y') }} Frais Tech. Sous total
{{ $op->media?->name ?? '—' }} @if($op->media?->type) {{ $op->media->type->name }} @endif {{ $op->media?->readers?->content ?? '—' }} {{ number_format($op->amount, 2, '.', ' ') }} € @if(in_array($period, $selectPeriod)) @php $count++; @endphp @endif {{ number_format($unitPrice, 2, '.', ' ') }} € @php $subtotal = $count * $unitPrice; $grandTotal += $subtotal; @endphp {{ number_format($subtotal, 2, '.', ' ') }} €
Total {{ number_format($grandTotal, 2, '.', ' ') }} €
@endif