<?php
    global $ELEMENT;
?>
<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["FIRE"]?>' <?=$selected[0]?>>Fire</option>
                    <option value='<?=$ELEMENT["WATER"]?>' <?=$selected[1]?>>Water</option>
                    <option value='<?=$ELEMENT["WIND"]?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=$ELEMENT["LIGHT"]?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=$ELEMENT["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='<?=$page->filters["name"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($page->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 ($page->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>
