@php($totalFiles = $rows->sum(fn($r) => $r->groups->count()))
@php($weekdayMap = ['Sunday'=>'日','Monday'=>'月','Tuesday'=>'火','Wednesday'=>'水','Thursday'=>'木','Friday'=>'金','Saturday'=>'土'])
@if($totalFiles === 0)
{{-- 全期間でレコード未生成 --}}
@else
@foreach($rows as $row)
@php($weekday = $weekdayMap[\Carbon\Carbon::parse($row->date)->format('l')] ?? '')
{{-- 日付セクション見出し --}}
{{ $row->date }} ({{ $weekday }})
@if(!$row->is_business_day)
{{-- 非営業日バッジ --}}
非営業日 (生成なし)
@elseif($row->groups->isEmpty())
{{-- 営業日かつレコードなしのプレースホルダ --}}
未生成
@else
({{ $row->groups->count() }}件)
@endif
{{-- ファイル行一覧 --}}
@if($row->groups->isNotEmpty())
@foreach($row->groups as $group)
@php($bytes = (int)$group->file_size)
@php($sizeText = $bytes >= 1048576 ? number_format($bytes / 1048576, 1) . ' MB' : ($bytes >= 1024 ? number_format($bytes / 1024, 1) . ' KB' : $bytes . ' B'))
{{-- ファイル名 --}}
{{ $group->filename }}
{{-- 切り詰めあり警告 --}}
@if($group->is_truncated)
切り詰めあり
@endif
{{-- 行数 / サイズ --}}
{{ number_format($group->row_count) }}行
{{ $sizeText }}
{{-- ダウンロードボタン --}}
ダウンロード
@endforeach
@endif
@endforeach
@endif