@if($boardMeta->show_list_from_view)
    @if($latest && $latest->total > 0)
    <div id="latest">

        @if($boardMeta->use_personal)
        {{-- 1:1문의 시작 --}}
        <table class="table">
            <tbody>
            @foreach($latest->list as $row)
                <tr>
                    <td>
                        <div class="row">
                            <div class="col col-md-10">
                                <p>
                                    @if($boardMeta->use_category && $row->categoryName)
                                        <label>
                                            <a href="{{ $listURL }}?category={{ $row->board_category_id }}" class="me-0" rel="search">
                                                [{{ $row->categoryName }}]
                                            </a>
                                        </label>
                                    @endif
                                    @if($row->is_secret)
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">
                                            <i class="fas fa-lock"></i> 비밀글입니다.
                                        </a>
                                    @elseif($row->isBlame)
                                        <i class="fas fa-ban"></i> <del>{{ $row->subject }}</del>
                                    @else
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">{{ $row->subject }}</a>
                                    @endif
                                    @if($row->comment_rows > 0)
                                        <var>[{{ $row->comment_rows }}]</var>
                                    @endif
                                    @if($row->file_rows > 0)
                                        <i class="fas fa-save"></i>
                                    @endif
                                    @if($row->link_rows > 0)
                                        <i class="fas fa-external-link-alt"></i>
                                    @endif
                                    @if($row->image_rows > 0)
                                        <i class="fas fa-image"></i>
                                    @endif
                                    @if($row->isNew)
                                        <span class="badge bg-warning text-dark">New</span>
                                    @endif
                                    @if($row->isHot)
                                        <span class="badge bg-danger">Hot</span>
                                    @endif
                                </p>
                                <ul>
                                    <li>{{ $row->user->name }}</li>
                                    <li>{{ $row->createdAt }}</li>
                                    <li>조회 {{ $row->hit }}</li>
                                    <li>추천 {{ $row->like }}</li>
                                </ul>
                            </div>
                            <div class="col-3 col-md-2 align-self-center text-end">
                                @if($row->is_reply)
                                    <div class="badge bg-success p-2">답변완료</div>
                                @else
                                    <div class="badge bg-secondary p-2">접수완료</div>
                                @endif
                            </div>
                        </div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>

        @if($latest->total > 0)
            <div class="pagination">
                {{ $latest->list->onEachSide($pageCount)->links('mobile.board.component.pagination') }}
            </div>
        @endif
        {{-- 1:1문의 종료 --}}

        @elseif($boardMeta->board_layout_type == BOARD_LAYOUT_NORMAL)

        {{-- 일반 게시글 시작 --}}
        <table class="table">
            <tbody>
            @foreach($latest->list as $row)
                <tr>
                    <td>
                        <div class="row">
                            <div class="col col-md-10">
                                <p>
                                    @if($boardMeta->use_category && $row->categoryName)
                                        <label>
                                            <a href="{{ $listURL }}?category={{ $row->board_category_id }}" rel="search">
                                                [{{ $row->categoryName }}]
                                            </a>
                                        </label>
                                    @endif
                                    @if($row->is_secret)
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">
                                            <i class="fas fa-lock"></i> 비밀글입니다.
                                        </a>
                                    @elseif($row->isBlame)
                                        <i class="fas fa-ban"></i> <del>{{ $row->subject }}</del>
                                    @else
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">{{ $row->subject }}</a>
                                    @endif
                                    @if($row->comment_rows > 0)
                                        <var>[{{ $row->comment_rows }}]</var>
                                    @endif
                                    @if($row->file_rows > 0)
                                        <i class="fas fa-save"></i>
                                    @endif
                                    @if($row->link_rows > 0)
                                        <i class="fas fa-external-link-alt"></i>
                                    @endif
                                    @if($row->image_rows > 0)
                                        <i class="fas fa-image"></i>
                                    @endif
                                    @if($row->isNew)
                                        <span class="badge bg-warning text-dark">New</span>
                                    @endif
                                    @if($row->isHot)
                                        <span class="badge bg-danger">Hot</span>
                                    @endif
                                </p>
                                <ul>
                                    <li>{{ $row->user->name }}</li>
                                    <li>{{ $row->createdAt }}</li>
                                    <li>조회 {{ $row->hit }}</li>
                                    <li>추천 {{ $row->like }}</li>
                                </ul>
                            </div>
                            @if($row->thumbnail)
                                <div class="col-3 col-md-2 align-self-center">
                                    <div class="thumbnail">
                                        <img src="{{ $row->thumbnail }}" class="img-fluid rounded" alt="{{ $row->subject }}" onerror="this.src='{{ NO_IMAGE_NORMAL_SRC }}'"/>
                                    </div>
                                </div>
                            @endif
                        </div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>

        @if($latest->total > 0)
            <div class="pagination">
                {{ $latest->list->onEachSide($pageCount)->links('mobile.board.component.pagination') }}
            </div>
        @endif
        {{-- 일반 게시글 종료 --}}

        @elseif($boardMeta->board_layout_type == BOARD_LAYOUT_TYPE_1)

        {{-- 사진/동영상 게시글 시작 --}}
        <table class="table">
            <tbody>
            @if($latest->total > 0)
                <tr>
                    <td>
                        <section>
                            @foreach($latest->list as $row)
                                <figure id="figure_{{ $row->num }}" class="figure">
                                    @if($row->thumbnail)
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">
                                            <img src="{{ $row->thumbnail }}" class="figure-img img-fluid rounded" alt="{{ $row->subject }}" onerror="this.src='{{ NO_IMAGE_NORMAL_SRC }}'"/>
                                        </a>
                                    @endif
                                    <figcaption class="figure-caption">
                                        <p>
                                            @if($boardMeta->use_category && $row->categoryName)
                                                <label>
                                                    <a href="{{ $listURL }}?category={{ $row->board_category_id }}" rel="search">
                                                        [{{ $row->categoryName }}]
                                                    </a>
                                                </label>
                                            @endif
                                            @if($row->is_secret)
                                                <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">
                                                    <i class="fas fa-lock"></i> 비밀글입니다.
                                                </a>
                                            @elseif($row->isBlame)
                                                <i class="fas fa-ban"></i> <del>{{ $row->subject }}</del>
                                            @else
                                                <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">{{ $row->subject }}</a>
                                            @endif
                                            @if($row->comment_rows > 0)
                                                <var>[{{ $row->comment_rows }}]</var>
                                            @endif
                                            @if($row->file_rows > 0)
                                                <i class="fas fa-save"></i>
                                            @endif
                                            @if($row->link_rows > 0)
                                                <i class="fas fa-external-link-alt"></i>
                                            @endif
                                            @if($row->image_rows > 0)
                                                <i class="fas fa-image"></i>
                                            @endif
                                            @if($row->isNew)
                                                <span class="badge bg-warning text-dark">New</span>
                                            @endif
                                            @if($row->isHot)
                                                <span class="badge bg-danger">Hot</span>
                                            @endif
                                        </p>
                                    </figcaption>
                                    <strong>{{ $row->user->name }}</strong>
                                    <ul>
                                        <li>{{ $row->createdAt }}</li>
                                        <li>조회 <small>{{ $row->hit }}</small></li>
                                        <li>좋아요 <small>{{ $row->like }}</small></li>
                                    </ul>
                                </figure>
                            @endforeach
                        </section>
                    </td>
                </tr>
            @else
                <tr>
                    <td>
                        게시글이 존재하지 않습니다.
                    </td>
                </tr>
            @endif
            </tbody>
        </table>

        @if($latest->total > 0)
            <div class="pagination">
                {{ $latest->list->onEachSide($pageCount)->links('mobile.board.component.pagination') }}
            </div>
        @endif
        {{-- 사진/동영상 게시글 종료 --}}

        @endif
    </div>
    @endif
@endif

@push('styles')
    <link rel="stylesheet" href="{{ asset('css/mobile/board/latest.css') }}"/>
@endpush
