@extends('mobile.layouts.app')

@section('content')
<div id="index" class="container">
    <section>
        <div class="row">
            <div class="col-lg-6 mb-2 mb-lg-0 notice">
                <div class="row align-items-end">
                    <div class="col">
                        공지사항
                    </div>
                    <div class="col text-end">
                        <a href="{{ route('board.list', 'notice') }}">전체보기</a>
                    </div>
                </div>
                <hr/>
                <table class="table table-borderless">
                    <colgroup>
                        <col/>
                        <col/>
                        <col/>
                    </colgroup>
                    <tbody>
                    @if($notice)
                        @foreach($notice->list as $row)
                            <tr>
                                <td>
                                    <img src="/images/icon/notice.gif" alt="[공지]"/>
                                </td>
                                <td>
                                    <p class="ellip">
                                        @if($row->categoryName)
                                            <label>
                                                <a href="{{ $row->listURL }}?category={{ $row->board_category_id }}" rel="search">
                                                    [{{ $row->categoryName }}]
                                                </a>
                                            </label>
                                        @endif
                                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html">{{ $row->subject }}</a>
                                    </p>
                                </td>
                                <td class="text-end">
                                    <small>{{ $row->createdAt }}</small>
                                </td>
                            </tr>
                        @endforeach
                    @else
                        <tr>
                            <td colspan="3" class="text-center p-2">
                                공지 글이 없습니다.
                            </td>
                        </tr>
                    @endif
                    </tbody>
                </table>
            </div>

            <div class="col-lg-6 mb-2 mb-lg-0 latest">
                <div class="row align-items-end">
                    <div class="col">
                        최근 게시글
                    </div>
                    <div class="col text-end">
                        <a href="/recently">전체보기</a>
                    </div>
                </div>
                <hr/>
                <table class="table table-borderless">
                    <tbody>
                    @if($recent)
                        @foreach($recent->list as $row)
                            <tr>
                                <td>
                                    <div class="row">
                                        <div class="col">
                                            <a href="{{ route('board.list', $row->code) }}" class="board-name">
                                                {{ $row->boardName }}
                                            </a>
                                        </div>
                                        <div class="col-auto text-end">
                                            <small>{{ $row->createdAt }}</small>
                                        </div>
                                    </div>
                                    <p class="ellip">
                                        @if($row->categoryName)
                                            <label>
                                                <a href="{{ $row->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>
                                </td>
                            </tr>
                        @endforeach
                    @else
                        <tr>
                            <td colspan="3" class="text-center p-2">
                                최근 게시글이 없습니다.
                            </td>
                        </tr>
                    @endif
                    </tbody>
                </table>
            </div>
        </div>
    </section>

    <section class="photo">
        <div class="row align-items-end">
            <div class="col">
                일상/풍경/사진
            </div>
            <div class="col text-end">
                <a href="{{ route('board.list', 'photo') }}">전체보기</a>
            </div>
        </div>
        <hr/>
        @if($photo && $photo->total > 0)
            <div class="d-flex flex-nowrap overflow-scroll photo-strip">
            @foreach($photo->list as $row)
                <figure class="figure h-100 d-flex flex-column">
                    @if($row->thumbnail)
                        <a href="{{ $row->viewURL }}" hreflang="ko" referrerpolicy="origin" type="text/html" target="_self" class="ratio ratio-4x3">
                            <img src="{{ $row->thumbnail }}" class="figure-img img-fluid rounded object-fit-cover" alt="{{ $row->subject }}" onerror="this.src='{{ NO_IMAGE_NORMAL_SRC }}'"/>
                        </a>
                    @endif
                    <figcaption class="figure-caption">
                        @if($row->categoryName)
                            <label>
                                <a href="{{ $row->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" target="_self">
                                <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" target="_self">{{ $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
                    </figcaption>
                </figure>
            @endforeach
            </div>
        @else
            <div class="text-center p-2">
                사진 글이 없습니다.
            </div>
        @endif
    </section>

    <section class="news">
        <div class="row pt-2 align-items-end">
            <div class="col">
                주요 기사
            </div>
            <div class="col text-end">
            </div>
        </div>
        <hr/>
        <div class="row">
        @if($news)
            @foreach($news as $new)
                @break($loop->index == 8)
                <div class="col-sm-2 col-sm-6 col-xl-3 mb-1">
                    <a href="{{ $new['link'] }}" class="d-flex" title="{{ $new['title'] }}" target="_blank">
                        <div class="flex-shrink-0">
                            @isset($new['thumbnail'])
                                <div class="thumb">
                                    <img src="{!! $new['thumbnail'] !!}" class="rounded" alt="{{ $new['title'] }}">
                                </div>
                            @endisset
                        </div>
                        <div class="flex-grow-1 ms-3">
                            <p class="fw-bold">{{ $new['title'] }}</p>
                            <small class="text-muted">{{ $new['source'] ?? null }}</small>
                        </div>
                    </a>
                </div>
            @endforeach
        @endif
        </div>
    </section>

    <hr/>

    <section>
        <div class="row">
            <div class="col-lg-3">
                <fxwidget-cc amount="1000" decimals="0" large="false" shadow="true" symbol="true" grouping="true" from="KRW" to="USD" background-color="#000000" lang="ko" border-radius="0.2"></fxwidget-cc>
            </div>
            <div class="col-lg-3">
                <fxwidget-er inverse="true" amount="1000" decimals="0" large="false" shadow="false" symbol="true" flag="true" changes="true" grouping="true" main-curr="KRW" sel-curr="EUR,USD,GBP,CAD,AUD,CNY,JPY,HKD" background-color="#000000" border="true" border-radius="0" separator="," decimal-point="."></fxwidget-er>
            </div>
            <div class="col-lg-6 align-self-end">
                <div id="ww_d8c9e8037d02a" v='1.3' loc='auto' a='{"t":"responsive","lang":"ko","sl_lpl":1,"ids":[],"font":"Arial","sl_ics":"one_a","sl_sot":"celsius","cl_bkg":"#000000","cl_font":"#FFFFFF","cl_cloud":"#FFFFFF","cl_persp":"#81D4FA","cl_sun":"#FFC107","cl_moon":"#FFC107","cl_thund":"#FF5722","cl_odd":"#FFFFFF17"}'>Weather Data Source: <a href="https://wetterlang.de/" id="ww_d8c9e8037d02a_u" target="_blank">Wettervorhersage 30 tage</a></div>
            </div>
        </div>
    </section>
</div>

<script async src="https://s.fx-w.io/widgets/currency-converter/latest.js?ko"></script>
<script async src="https://s.fx-w.io/widgets/exchange-rates/latest.js?ko"></script>
<script async src="https://app1.weatherwidget.org/js/?id=ww_d8c9e8037d02a"></script>
@endsection

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