@extends('mobile.layouts.app')

@section('content')
<div id="flower" class="container-fluid">
    <h5>화훼 시세</h5>
    <hr/>

    <dl>
        <dd>한국농수산식품유통공사가 제공하는 화훼 경매 시세 정보입니다.</dd>
        <dd>경매정보를 일자별로 비교 분석할 수 있도록 제공합니다.</dd>
        <dd>휴일 안내 : 매주 일요일, 신정(1월 1일), 설날 및 추석연휴</dd>
        <dd>제공날짜 : 절화(월~토), 난(월/목), 관엽(화/목)</dd>
        <dd>제공시간 : 절화(당일 9시이후), 난/관엽/춘란 (익일 오전 10시)</dd>
    </dl>

    <form name="f_service_flower" id="fServiceFlower" action="{{ route('service.price.flower') }}" method="get" accept-charset="UTF-8">
        <input type="hidden" name="page" value="{{ $page }}"/>
        <input type="hidden" name="per_page" value="{{ $perPage }}"/>
        <input type="hidden" name="p_name" value="{{ $pName }}"/>

        <div class="row align-items-center">
            <label for="gubun_1" class="col-auto col-sm-auto col-md-1">부류</label>
            <div class="col-10 col-sm">
                <div class="form-check-inline">
                    <input type="radio" name="gubun" id="gubun_1" class="form-check-input" value="1" @if($gubun == '1') checked @endif/>
                    <label for="gubun_1" class="form-check-label">절화</label>
                </div>
                <div class="form-check-inline">
                    <input type="radio" name="gubun" id="gubun_3" class="form-check-input" value="3" @if($gubun == '3') checked @endif/>
                    <label for="gubun_3" class="form-check-label">난</label>
                </div>
                <div class="form-check-inline">
                    <input type="radio" name="gubun" id="gubun_2" class="form-check-input" value="2" @if($gubun == '2') checked @endif/>
                    <label for="gubun_2" class="form-check-label">관엽</label>
                </div>
                <div class="form-check-inline">
                    <input type="radio" name="gubun" id="gubun_4" class="form-check-input" value="4" @if($gubun == '4') checked @endif/>
                    <label for="gubun_4" class="form-check-label">춘란</label>
                </div>
            </div>
            <label for="pName" class="col-auto col-sm-auto col-md-1">품목명</label>
            <div class="col col-sm pt-2 pt-sm-0">
                <select name="pid" id="pid" class="form-select" data-selected="{{ $pid }}">
                    <option value="">전체</option>
                </select>
            </div>
        </div>
        <div class="row align-items-center">
            <label for="date" class="col-auto col-sm-auto col-md-1">기준일</label>
            <div class="col col-sm pt-2">
                <input type="text" name="date" id="date" class="form-control date-picker" value="{{ $date }}" />
            </div>
            <label for="gName" class="col-auto col-sm-auto col-md-1">품종명</label>
            <div class="col col-sm pt-2">
                <input type="text" name="g_name" id="gName" class="form-control" value="{{ $gName }}" />
            </div>
        </div>
        <div class="row justify-content-center mt-3">
            <div class="col col-sm-auto">
                <button type="submit" class="btn btn-dark w-100">검색</button>
            </div>
        </div>
    </form>

    <br/>

    <div class="row align-items-center">
        <div class="col">
            <label>전체 : {{ number_format($total) }}</label>
        </div>
        <div class="col-auto">
            <select name="per_page" id="perPage" class="form-select">
                <option value="10" @if($perPage == '10') selected @endif>10개씩</option>
                <option value="15" @if($perPage == '15') selected @endif>15개씩</option>
                <option value="20" @if($perPage == '20') selected @endif>20개씩</option>
                <option value="30" @if($perPage == '30') selected @endif>30개씩</option>
                <option value="40" @if($perPage == '40') selected @endif>40개씩</option>
                <option value="50" @if($perPage == '50') selected @endif>50개씩</option>
            </select>
        </div>
    </div>

    <br/>

    <div class="table-responsive">
        <table class="table table-hover table-bordered table-nowrap">
            <thead>
                <tr>
                    <th>No</th>
                    <th>경매일자</th>
                    <th>화훼부류명</th>
                    <th>품목명</th>
                    <th>품종명</th>
                    <th>등급명</th>
                    <th>최고가</th>
                    <th>최저가</th>
                    <th>평균가</th>
                    <th>총물량</th>
                    <th>총금액</th>
                </tr>
            </thead>
            <tbody>
                @if($total > 0)
                    @foreach($list as $row)
                        <tr>
                            <td>{{ $row['num'] }}</td>
                            <td>{{ $row['saleDate'] }}</td>
                            <td>{{ $row['flowerGubn'] }}</td>
                            <td>{{ $row['pumName'] }}</td>
                            <td>{{ $row['goodName'] }}</td>
                            <td>{{ $row['lvNm'] }}</td>
                            <td>{{ $row['maxAmt'] }}</td>
                            <td>{{ $row['minAmt'] }}</td>
                            <td>{{ $row['avgAmt'] }}</td>
                            <td>{{ $row['totQty'] }}</td>
                            <td>{{ $row['totAmt'] }}</td>
                        </tr>
                    @endforeach
                @else
                    <tr>
                        <td colspan="11">
                            No data.
                        </td>
                    </tr>
                @endif
                <tr>
                    <td colspan="6">합계</td>
                    <td>{{ $maxAmt }}</td>
                    <td>{{ $minAmt }}</td>
                    <td>{{ $avgAmt }}</td>
                    <td>{{ $totQty }}</td>
                    <td>{{ $totAmt }}</td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="11">

                    </td>
                </tr>
            </tfoot>
        </table>
    </div>

    {{ $list->withQueryString()->onEachSide(5)->links('component.pagination') }}

    <br/>

    <p>단위 : 속(분), 원/속(분)</p>

    <dl>
        <dt>주의 사항</dt>
        <dd><small>화훼류경매시세는 양재동 화훼공판장 중도매인들이 전자식 경매를 통하여 낙찰받은 물량의 가격이며, 중도매인들의 제비용 등이 전혀 포함되어 있지 않으므로 도소매 구입금액과 차이가 있을 수 있습니다.</small></dd>
        <dd><small>절화류 화목토 요일은 작은 장인 관계로 거래량이 저조하기 때문에 적정 가격형성이 되지 않습니다. 따라서 화,목,토요일 경매시세는 제공되지 않으며 시세자료 비교시는 거래량이 많은 큰 장인 월,수,금요일 자료를 참조하시기 바랍니다.</small></dd>
    </dl>
</div>
@endsection

@push('scripts')
    <script src="{{ asset('js/desktop/service/flower.js') }}" defer></script>
@endpush
