@extends('layouts.app')

@section('content')

    <div class="container-fluid">

        <!-- Page Header -->
        <div class="d-flex justify-content-between align-items-center mb-2 flex-shrink-0">
            <div>
                <h3 class="fw-bold mb-1">Dashboard Overview</h3>
            </div>

            <div class="d-flex align-items-center gap-2 mb-3">

                <select id="trend_range" class="form-select w-auto">
                    <option value="8" selected>Last 8 weeks</option>
                    <option value="12">Last 12 weeks</option>
                    <option value="26">Last 26 weeks</option>
                    <option value="custom">Custom range</option>
                </select>

                <div id="custom_range_container" style="display:none;" class="align-items-center gap-1">

                    <select id="start_year" class="form-select"></select>
                    <select id="start_week" class="form-select"></select>

                    <span class="mx-1">to</span>

                    <select id="end_year" class="form-select"></select>
                    <select id="end_week" class="form-select"></select>

                </div>

            </div>
        </div>


        <!-- Summary Cards -->
        <div class="row flex-grow-1" id="summary_cards"></div>


        <div class="row flex-grow-1">

            <!-- LEFT COLUMN -->
            <div class="col-lg-8 d-flex flex-column">

                <!-- Trend Chart -->
                <div class="card shadow-sm mb-3 flex-grow-1">
                    <div class="card-body">

                        <div class="mb-3">
                            <h5 class="fw-bold mb-1">Epidemic Trend</h5>
                            <p class="text-muted small mb-0">
                                (based on selected epiweek range)
                            </p>
                        </div>

                        <canvas id="trendChart" height="90"></canvas>

                    </div>
                </div>

                <!-- Alerts -->
                <div class="card shadow-sm flex-grow-1">
                    <div class="card-body">

                        <h5 class="fw-bold">Recent Alerts & Notifications</h5>

                        <ul class="list-group list-group-flush mt-3">
                            <li class="list-group-item">
                                ⚠ Monitoring influenza increase in selected provinces.
                            </li>

                            <li class="list-group-item">
                                🔔 SARS-CoV-2 positivity rate under review.
                            </li>
                        </ul>

                    </div>
                </div>

            </div>


            <!-- RIGHT COLUMN -->
            <div class="col-lg-4 d-flex flex-column">

                <div class="card shadow-sm">
                    <div class="card-body">

                        <h5 class="fw-bold">Total Cases by Provinces</h5>
                        <p class="text-muted small">(based on selected epiweek range)</p>

                        <div id="provinceMap" style="height:50vh;"></div>

                        <div class="d-flex justify-content-center align-items-center gap-4 mt-4 small">

                            <span>
                                <span
                                    style="display:inline-block;width:10px;height:10px;background:#2563eb;border-radius:50%;margin-right:6px;"></span>
                                SARI
                            </span>

                            <span>
                                <span
                                    style="display:inline-block;width:10px;height:10px;background:#10b981;border-radius:50%;margin-right:6px;"></span>
                                ILI
                            </span>

                            <span>
                                <span
                                    style="display:inline-block;width:10px;height:10px;background:#9333ea;border-radius:50%;margin-right:6px;"></span>
                                LBM
                            </span>

                        </div>

                    </div>
                </div>

            </div>

        </div>

    </div>

    <script src="/js/overview.js"></script>

@endsection