<?php
    /**
     * Run filter view.
     *
     * To be included from the run view.
     *
     * @category View
     * @property_read mixed[] $filters Selected filters.
     * @property_read int $page Player ID.
     */
?>
<form action='/<?=$UID?>/runs/' method='get' id='filter_runeupgrade' class='filter'>
    <table>
        <tr>
            <td class='filter filter_title'>
                <span>
                    Area
                </span>
            </td>
            <td class='filter'>
<?php
                $selected = array_fill(0, 12 + 1, "");
                $selected[$filters["AREA_TYPE"]] = "selected";
?>
                <span>Region:</span>
                <select name='area_type' id='filter_area'>
                    <option value='0'>All</option>
                    <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
                    <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
                    <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
                    <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
                    <option value='<?=AREA_TYPE_ID::ARENA?>' <?=$selected[AREA_TYPE_ID::ARENA]?>>Arena</option>
                    <option value='<?=AREA_TYPE_ID::GUILD_WAR?>' <?=$selected[AREA_TYPE_ID::GUILD_WAR]?>>Guild War</option>
                    <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>' <?=$selected[AREA_TYPE_ID::GUILD_SIEGE]?>>Guild Siege</option>
                    <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>' <?=$selected[AREA_TYPE_ID::TARTARUS_LABYRINTH]?>>Tartarus Labyrinth</option>
                    <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>' <?=$selected[AREA_TYPE_ID::TRIAL_OF_ASCENSION]?>>Trial of Ascension</option>
                    <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>' <?=$selected[AREA_TYPE_ID::WORLD_BOSS]?>>World Boss</option>
                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_RIFT]?>>Dimensional Rift</option>
                </select>
            </td>
            <td class='filter'>
<?php
                $selected = array_fill(0, 9002, "");
                $selected[$filters["AREA"]] = "selected";
?>
                <span>Area:</span>
                <select name='area_scenario'>
                    <option value='0'>All</option>
                    <option value='1' <?=$selected[1]?>>Garen Forest</option>
                    <option value='2' <?=$selected[2]?>>Mt. Siz</option>
                    <option value='3' <?=$selected[3]?>>Kabir Ruins</option>
                    <option value='4' <?=$selected[4]?>>Mt. White Ragon</option>
                    <option value='5' <?=$selected[5]?>>Telain Forest</option>
                    <option value='6' <?=$selected[6]?>>Hydeni Ruins</option>
                    <option value='7' <?=$selected[7]?>>Tamor Desert</option>
                    <option value='8' <?=$selected[8]?>>Vrofagus Ruins</option>
                    <option value='9' <?=$selected[9]?>>Faimon Volcano</option>
                    <option value='10' <?=$selected[10]?>>Aiden Forest</option>
                    <option value='11' <?=$selected[11]?>>Ferun Castle</option>
                    <option value='12' <?=$selected[12]?>>Mt. Runar</option>
                    <option value='13' <?=$selected[13]?>>Charuka Remains</option>
                </select>
                <select name='area_cairos'>
                    <option value='0'>All</option>
                    <option value='1001' <?=$selected[1001]?>>Hall of Dark</option>
                    <option value='2001' <?=$selected[2001]?>>Hall of Fire</option>
                    <option value='3001' <?=$selected[3001]?>>Hall of Water</option>
                    <option value='4001' <?=$selected[4001]?>>Hall of Wind</option>
                    <option value='5001' <?=$selected[5001]?>>Hall of Magic</option>
                    <option value='6001' <?=$selected[6001]?>>Necropolis</option>
                    <option value='7001' <?=$selected[7001]?>>Hall of Light</option>
                    <option value='8001' <?=$selected[8001]?>>Giant&#39;s Keep</option>
                    <option value='9001' <?=$selected[9001]?>>Dragon&#39;s Lair</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class='filter filter_title filter_separator' rowspan='4'>
                <span>
                    Extra
                </span>
            </td>
            <td class='filter filter_separator' colspan='2'>
                <span>Date range:</span>
                <input type='date' name='date_min' id='date_min' value='<?=$filters["DATE_MIN"]?>'/>
                -
                <input type='date' name='date_max' id='date_max' value='<?=$filters["DATE_MAX"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["DEFEAT"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='defeat' id='filter_defeat' <?=$checked?>/>
                <label for='filter_defeat'>Show defeats</label>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["HELPER"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='helper' id='filter_helper' <?=$checked?>/>
                <label for='filter_helper'>Show runs with friends/mentors</label>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
                <input type='number' name='number' id='number' min='1' value='<?=$filters["NUMBER"]?>'/> runs per page
            </td>
        </tr>
    </table>
    <div id='filter_apply'>
        <input type='submit' value='Apply'/>
    </div>
</form>

