@extends('mobile.layouts.app')

@section('content')
<div id="anniversary" class="container-fluid">
    @include('mobile.service.navTabs')

    <h5>공휴일/특일</h5>
    <hr/>

    <dl>
        <dd>과학기술정보통신부에서 제공하는 월력요항 정보입니다.</dd>
        <dd>그 외 기념일, 24절기, 잡절은 11경 갱신 됩니다.</dd>
        <dd>추가로 임시공휴일 등 갑작스럽게 발생하는 데이터가 생길 경우 데이터는 바로 갱신 되며(최대 1일 이내), 대체공휴일이 추가로 지정되는 경우 대통령령이 공식적으로 시행된 이후에 업데이트 되오니 참고 부탁 드립니다.</dd>
    </dl>

    <form name="f_service_anniversary" id="fServiceAnniversary" action="{{ route('service.anniversary') }}" method="get" accept-charset="UTF-8">
        <div class="row g-2">
            <label for="year" class="col-auto col-form-label">날짜</label>
            <div class="col-auto">
                <select name="year" id="year" class="form-select">
                    @foreach(array_reverse(range(2000, date('Y'))) as $y)
                        <option value="{{ $y }}" @if($y == $year) selected @endif>{{ $y }}</option>
                    @endforeach
                </select>
            </div>
            <div class="col-auto">
                <button type="submit" class="btn btn-dark">검색</button>
            </div>
        </div>
    </form>

    <br/>

    <p>합계 : {{ $data[1]['total'] + $data[2]['total'] + $data[3]['total'] + $data[4]['total'] + $data[5]['total'] }}일</p>

    <ul class="nav nav-tabs">
        @foreach($mapOperation as $i => $optStr)
        <li class="nav-item">
            <label class="nav-link @if($loop->first) active @endif"
                   data-bs-toggle="tab"
                   data-bs-target="#tab_{{ $i }}"
                   role="label"
                   aria-controls="tab_{{ $i }}">{{ $optStr }}</label>
        </li>
        @endforeach
    </ul>

    <div class="tab-content">
        @foreach($mapOperation as $i => $optStr)
        <div id="tab_{{ $i }}" class="tab-pane mt-2 @if($loop->first) show active @endif table-responsive" role="tabpanel" aria-labelledby="tab_{{ $i }}" tabindex="0">
            <table class="table table-hover table-bordered table-nowrap w-auto">
                <caption>
                    <div class="row">
                        <div class="col">
                            <strong>{{ $optStr }}</strong> ({{ $data[$i]['total'] }}일)
                        </div>
                    </div>
                </caption>
                <thead>
                    <tr>
                        <th>날짜</th>
                        <th>명칭</th>
                        <th>공공기관 휴일여부</th>
                    </tr>
                </thead>
                <tbody>
                @if($data[$i]['total'] > 0)
                    @foreach($data[$i]['list'] as $row)
                        <tr>
                            <td>{{ $row['locdate'] }}</td>
                            <td>{{ $row['dateName'] }}</td>
                            <td>{{ $row['isHoliday'] }}</td>
                        </tr>
                    @endforeach
                @else
                    <tr>
                        <td colspan="3">
                            No data.
                        </td>
                    </tr>
                @endif
                </tbody>
            </table>
        </div>
        @endforeach
    </div>

</div>
@endsection

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