<?php
    /**
     * Monsters filter view.
     *
     * To be included from the monsters view.
     *
     * @category View
     * @property_read mixed[] $filters Selected filters.
     * @property_read int $page Player ID.
     */

    namespace swdb;
?>
<form action='/<?=$UID?>/monsters/' method='get'  id='filter_monsters' class='filter'>
    <table>
        <tr>
            <td class='filter'>
                <span>Element:</span>
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["ELEMENT"]] = "selected";
?>
                <select name='element'>
                    <option> </option>
                    <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[0]?>>Fire</option>
                    <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[1]?>>Water</option>
                    <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Legend</option>
                </select>
            </td>
            <td class='filter' id='filter_stars'>
                <span>Stars:</span>
                <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MIN_STARS"]?>'/>
                -
                <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MAX_STARS"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
                <span>Name:</span>
                <input type='text' name='name' id='filter_name' value='<?=$filters["NAME"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["IN_STORAGE"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='in_storage' id='filter_in_storage'<?=$checked?>/>
                <label for='filter_in_storage'>Show monsters in storage</label>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["WITHOUT_RUNES"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
                <label for='filter_without_runes'>Show monsters without runes<label>
            </td>
        </tr>
    </table>
    <div id='filter_apply'>
        <input type='submit' value='Apply'/>
    </div>
</form>
