{{-- Riga alimento DomPDF senza tabelle annidate (evita gonfiore altezza DomPDF) --}} @php $nomeAlimento = (string) ($nome ?? 'Alimento'); $quantitaG = (int) ($quantita_g ?? 0); $porzione = trim((string) ($porzione ?? '')); $quantitaLabel = $porzione !== '' ? $porzione : ($quantitaG > 0 ? $quantitaG . ' g' : ''); $isAlternativa = !empty($alternativa); $nomeLower = strtolower($nomeAlimento); $tipoIcona = 'alimento'; if ( str_contains($nomeLower, 'acqua') || str_contains($nomeLower, 'latte') || str_contains($nomeLower, 'succo') || str_contains($nomeLower, 'tè') || str_contains($nomeLower, 'the ') || str_contains($nomeLower, 'caffè') || str_contains($nomeLower, 'caffe') ) { $tipoIcona = 'bevanda'; } elseif ( str_contains($nomeLower, 'olio') || str_contains($nomeLower, 'sale') || str_contains($nomeLower, 'burro') || str_contains($nomeLower, 'aceto') ) { $tipoIcona = 'condimento'; } $simbolo = match ($tipoIcona) { 'bevanda' => '○', 'condimento' => '◆', default => '●', }; $coloreIcona = match ($tipoIcona) { 'bevanda' => '#2a7f9e', 'condimento' => '#c17f24', default => '#3d9b6e', }; @endphp
@if(!$isAlternativa) {{ $simbolo }} @else   @endif {{ $nomeAlimento }} {{ $quantitaLabel }}