@php $review = $batch->flavorResult; $rating = (int) ($review->rating ?? 0); // Tiny helper: a row of filled/empty marks for a 1–5 score. $marks = function (int $score, string $glyph, string $on, string $off) { $out = ''; for ($i = 1; $i <= 5; $i++) { $color = $i <= $score ? $on : $off; $out .= '' . $glyph . ' '; } return rtrim($out); }; @endphp @component('emails.layout', ['subject' => 'πŸŽ‰ ' . $batch->name . ' β€” tu resumen', 'preview' => 'Tu fermento ha salido genial. AquΓ­ tienes el resumen completo.'])

Β‘Enhorabuena! πŸŽ‰

Tu lote {{ $batch->name }} @if($batch->guide) de {{ $batch->guide->name }} @endif ha terminado con muy buena nota. AquΓ­ tienes su resumen para que lo guardes.

{{-- ── Rating ─────────────────────────────────────────── --}} @if($rating > 0)
{!! $marks($rating, 'β˜…', '#E8B33D', '#D8D2C2') !!}
{{ $rating }}/5
@if($review?->overall_comment)

β€œ{{ $review->overall_comment }}”

@endif
@endif {{-- ── Datos del lote ─────────────────────────────────── --}}

Datos

@php $rows = array_filter([ 'Fermento' => $batch->guide?->name, 'Inicio' => $batch->start_date?->format('d/m/Y'), 'Fin' => ($batch->actual_end_date ?? null)?->format('d/m/Y'), 'DuraciΓ³n' => $stats['days'] !== null ? $stats['days'] . ' dΓ­as' : null, 'Rendimiento' => $stats['yield'], ]); @endphp @foreach($rows as $label => $value) @endforeach
{{ $label }} {{ $value }}
{{-- ── EstadΓ­sticas de seguimiento ────────────────────── --}} @if($stats['logs'] || $stats['measurements'] || $stats['ph_last'] !== null || $stats['temp_range'])

Seguimiento

@php $statRows = array_filter([ 'Registros diarios' => $stats['logs'] ?: null, 'Mediciones' => $stats['measurements'] ?: null, 'pH final' => $stats['ph_last'] !== null ? rtrim(rtrim(number_format($stats['ph_last'], 2, ',', '.'), '0'), ',') : null, 'Temperatura' => $stats['temp_range'] ? number_format($stats['temp_range'][0], 0) . '–' . number_format($stats['temp_range'][1], 0) . ' Β°C' : null, ], fn ($v) => $v !== null); @endphp @foreach($statRows as $label => $value) @endforeach
{{ $label }} {{ $value }}
@endif {{-- ── Perfil de sabor ────────────────────────────────── --}} @if(!empty($flavors))

Perfil de sabor

@foreach($flavors as $label => $score) @endforeach
{{ $label }} {!! $marks((int) $score, '●', '#4B7A50', '#D8D2C2') !!}
@endif {{-- ── CronologΓ­a ─────────────────────────────────────── --}} @if($timeline->isNotEmpty())

CronologΓ­a

@foreach($timeline as $step) @endforeach
@if($step['day'] !== null) DΓ­a {{ $step['day'] }} @endif {{ $step['title'] }} @if($step['state'] === 'skipped') Β· saltado @endif
@endif Ver lote completo @endcomponent