@extends('layouts.app')

@section('content')

    <div class="container-fluid">

        <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 mb-2" id="summary_cards"></div>

        <!-- SLIDESHOW -->
        <div class="row">
            <div class="col-8">

                <div class="slide-wrapper">

                    <!-- SLIDE 1 -->
                    <div class="slide active">
                        <div class="row">
                            <div class="col-lg-12 d-flex flex-column">

                                <div class="card shadow-sm mb-3 overflow-hidden">
                                    <div class="card-body">
                                        <h5 class="fw-bold">Epidemic Trend</h5>
                                        <p class="text-muted small report-period">
                                            (based on selected epiweek range)
                                        </p>
                                        <div class="chart-container">
                                            <canvas id="trendChart"></canvas>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <!-- SLIDE 2 -->
                    <div class="slide">
                        <div class="row">
                            <div class="col-lg-12 d-flex flex-column">
                                <div class="card shadow-sm">
                                    <div class="card-body">

                                        <h5 class="fw-bold">
                                            Influenza Subtypes Distribution
                                        </h5>

                                        <p class="text-muted small report-period">
                                            (based on selected epiweek range)
                                        </p>

                                        <div class="chart-container">
                                            <canvas id="influenzaSubtypeDistribution"></canvas>
                                        </div>

                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <!-- SLIDE 3 -->
                    <div class="slide">
                        <div class="row">
                            <div class="col-lg-12 d-flex flex-column">
                                <div class="card shadow-sm">
                                    <div class="card-body">
                                        <h5 class="fw-bold">SARS-CoV-2 Detected Distribute by Age Group</h5>
                                        <p class="text-muted small report-period">
                                            (based on selected epiweek range)
                                        </p>
                                        <div class="chart-container">
                                            <canvas id="covidDistributedByAgeGroup"></canvas>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <!-- SLIDE 4 -->
                    <div class="slide">
                        <div class="row">
                            <div class="col-lg-12 d-flex flex-column">
                                <div class="card shadow-sm">
                                    <div class="card-body">
                                        <h5 class="fw-bold">SARS-CoV-2 Lineage Relative Frequencies Over Time</h5>
                                        <p class="text-muted small report-period">
                                            (based on selected epiweek range)
                                        </p>
                                        <div class="chart-container" style=" flex:1; max-width: 90%; max-height:40vh; float: left;">
                                            <canvas id="covidLineageFrequency" ></canvas>
                                        </div>
                                        <div id="legendContainer" style="
                                            width:10%;
                                            margin-left:20px;
                                            max-height:375px;
                                            overflow-y:auto;
                                            padding:8px;

                                        "></div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <!-- SLIDE 5 -->
                    <div class="slide">
                        <div class="row">
                            <div class="col-lg-12 d-flex flex-column">
                                <div class="card shadow-sm">
                                    <div class="card-body">
                                        <h5 class="fw-bold">Influenza Subtypes Relative Frequencies Over Time</h5>
                                        <p class="text-muted small report-period">
                                            (based on selected epiweek range)
                                        </p>
                                        
                                        <div class="chart-container" style=" flex:1; max-width: 90%; max-height:40vh; float: left;">
                                            <canvas id="influenzaSubtypeFrequency" ></canvas>
                                        </div>
                                        <div id="legendContainerInfluenzaSubtypeFrequency" style="
                                            width:10%;
                                            margin-left:20px;
                                            max-height:375px;
                                            overflow-y:auto;
                                            padding:8px;

                                        "></div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                    <!-- CONTROLS -->
                    <button class="slide-btn prev-btn">❮</button>
                    <button class="slide-btn next-btn">❯</button>

                </div>
            </div>

            <div class="col-4">
                <div class="row">
                    <div class="col-lg-12 d-flex flex-column">

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

                                <h5 class="fw-bold">Influenza Subtypes Detected by Province</h5>
                                <p class="text-muted small report-period">(based on selected epiweek range)</p>

                                <div class="map-container">
                                    <div id="provinceMap"></div>
                                </div>
                                

                            </div>
                        </div>

                    </div>
                </div>
            </div>

        </div>

    </div>

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

@endsection