<?php

use WoWPress\Models\Raid;

global $widget_area;

global $year;
global $month;

$raids = Raid::whereStart("$year-$month-01",">")->whereEnd("$year-$month-31","<")->get();

var_dump($raids);

get_header();
?>

<section id="primary">
    <main id="main">
        <div class="bg-glass shadow p-auto">
            <div class="text-xl font-bold bg-glass text-white text-center"><?=format_date("$year-$month-1",'MMMM')?></div>
            <div class="grid grid-cols-7 gap-1 pt-1" style="grid-auto-rows: 1fr">
                <?php 
                for($i=1;$i<=date("t",strtotime("$year-$month-01"));$i++){
                    ?>
                    <div class="bg-glass p-auto text-center <?php if($i== 24 || $i == 12){ ?> glow shadow-hunter <?php } ?> grid grid-cols-2 grid-rows-2">
                    <div class="text-left"><?=date('d',strtotime("$year-$month-$i"))?></div>
                    <div class="text-right"><?=format_date("$year-$month-$i",'E')?></div>

                <?php
                if($i == 24 || $i == 12){
                    ?>
                    <div style="grid-area: 2 / 1 / 3 / 3;">
                        <div>Raid XY</div>
                        <div class="text-sm text-slate-500">(Heroisch)</div>
                    </div>
                    <?php
                }
                ?>
                </div>
                    <?php
                }
                ?>
            </div>
        </div>
    </main>
</section>

<?php
get_footer();