@foreach ($transmittals as $transmittal) @php $fileRowCounter = 0; foreach ($transmittal->files as $file) { $fileNoteCount = $file->notes_count; $fileRemarkCount = $file->remarks_count; $fileRowCount = $fileNoteCount; if($fileRemarkCount > $fileNoteCount) { $fileRowCount = $fileRemarkCount; } $fileRowCounter += $fileRowCount; } $transmittalRowCount = $fileRowCounter; if($transmittalRowCount < $transmittal->files_count) { $transmittalRowCount = $transmittal->fiels_count; } $fileNoteCount = $transmittal->files[0]->notes_count; $fileRemarkCount = $transmittal->files[0]->remarks_count; $firstFileRowCount = $fileNoteCount; if($fileRemarkCount > $fileNoteCount) { $firstFileRowCount = $fileRemarkCount; } @endphp @foreach($transmittal->files as $file) @php $fileNoteCount = $file->notes_count; $fileRemarkCount = $file->remarks_count; $fileRowCount = $fileNoteCount; if($fileRemarkCount > $fileNoteCount) { $fileRowCount = $fileRemarkCount; } $notes = $file->notes->pluck('comment'); $remarks = $file->remarks->pluck('remark'); @endphp @if(!$loop->parent->first) @if($loop->first) @for($i = 1 ; $i < $fileRowCount ; $i++) @endfor @else @for($i = 0 ; $i < $fileRowCount ; $i++) @if($i == 0) @endif @endfor @endif @endif @endforeach @endforeach {{-- @foreach($transmittals as $transmittal)--}} {{-- @php $rowspan = 0; @endphp--}} {{-- @foreach($transmittal->files as $file)--}} {{-- @php $rowspan += max(count($file->notes), count($file->remarks)); @endphp--}} {{-- @endforeach--}} {{-- @foreach($transmittal->files as $file)--}} {{-- @php $fileRowspan = max(count($file->notes), count($file->remarks)); @endphp--}} {{-- --}} {{-- @if($loop->first)--}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- @if(count($file->notes) > 0)--}} {{-- --}} {{-- @else--}} {{-- --}} {{-- @endif--}} {{-- @if(count($file->remarks) > 0)--}} {{-- --}} {{-- @else--}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- @for($i = 1; $i < $fileRowspan; $i++)--}} {{-- --}} {{-- @if($loop->first)--}} {{-- --}} {{-- @endif--}} {{-- @if(isset($file->notes[$i]))--}} {{-- --}} {{-- @else--}} {{-- --}} {{-- @endif--}} {{-- @if(isset($file->remarks[$i]))--}} {{-- --}} {{-- @else--}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- @endfor--}} {{-- @endforeach--}} {{-- @endforeach--}}
Transmittal File Notes Remarks
{{ $transmittal->series }} {{ $transmittal->files[0]->description }} {{ $transmittal->files[0]->notes->first()?->comment }} {{ $transmittal->files[0]->remarks->first()?->remark }}
{{ $notes[$i] ?? '' }} {{ $remarks[$i] ?? '' }}
{{ $file->description }} {{ $notes[$i] ?? '' }} {{ $remarks[$i] ?? '' }}
{{ $transmittal->series }}{{ $file->description }}{{ $file->notes[0]->comment }}{{ $file->remarks[0]->remark }}
--first--{{ $file->notes[$i]->comment }}{{ $file->remarks[$i]->remark }}