<?php
    /**
     * Rune craft report filter view.
     *
     * To be included from the rune craft report view.
     *
     * @category View
     * @property_read mixed[] $filters Selected filters.
     * @property_read int $page Player ID.
     */
?>
<form action='/<?=$UID?>/report/runecraft/' method='get' id='filter_runecraft' class='filter'>
    <table>
        <tr>
            <td class='filter filter_title' rowspan='2'>
                <span>
                    Monster
                </span>
            </td>
            <td class='filter' colspan='3'>
                <span>Name:</span>
                <input type='text' name='monster_name' id='filter_name' value='<?=$filters["MONSTER_NAME"]?>'/>
            </td>
            <td class='filter'>
                <span>Stars:</span>
                <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MONSTER_MIN_STARS"]?>'/>
                -
                <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MONSTER_MAX_STARS"]?>'/>
            </td>
        </tr>
            <td class='filter' colspan='4'>
<?php
                $checked = "";
                if ($filters["MONSTER_IN_STORAGE"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
                <label for='filter_monster_in_storage'>Show monsters in storage</label>
            </td>
        </tr>
        <tr>
            <td class='filter filter_title filter_separator' rowspan='5'>
                <span>
                    Runes
                </span>
            </td>
            <td class='filter filter_stars filter_separator' colspan='2'>
                <span>Stars:</span>
                <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["RUNE_MIN_STARS"]?>'/>
                -
                <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["RUNE_MAX_STARS"]?>'/>
            </td>
            <td class='filter filter_separator' colspan='2'>
                <span>Level:</span>
                <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["RUNE_MIN_LEVEL"]?>'/>
                -
                <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$filters["RUNE_MAX_LEVEL"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' rowspan='4'>
                <span>Slot:</span>
                <select multiple name='rune_slot[]' id='filter_slot'>
<?php
                    for ($i = 1; $i <= 6; $i ++){
                        if (in_array($i, $filters["RUNE_SLOT"])){
                            $selected = "selected='selected'";
                        }
                        else{
                            $selected = "";
                        }
?>
                        <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
<?php
                    }
?>
                </select>
            </td>
            <td class='filter' colspan='3'>
                <span>Quality:</span>
<?php

                $selected = Array("", "", "", "", "");
                $selected[$filters["RUNE_MIN_QUALITY"] - 1] = "selected";
?>
                <select name='rune_min_quality' id='filter_quality_min'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
                -
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["RUNE_MAX_QUALITY"] - 1] = "selected";
?>
                <select name='rune_max_quality' id='filter_quality_max'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='3'>
                <span>Original quality:</span>
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
?>
                <select name='rune_min_original_quality' id='filter_original_quality_min'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
                -
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
?>
                <select name='rune_max_original_quality' id='filter_original_quality_max'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='3'>
                <span>Efficiency:</span>
                <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_EFFICIENCY"]?>'/>%
                -
                <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_EFFICIENCY"]?>'/>%
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='3'>
                <span>Maximum efficiency:</span>
                <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
                -
                <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
            </td>
        </tr>
        <tr>
            <td class='filter filter_title filter_separator'>
                <span>
                    Grindstones
                </span>
            </td>
            <td class='filter filter_stars filter_separator'>
<?php
                $checked = "";
                if ($filters["GRIND"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='grind' id='filter_grind' <?=$checked?>/>
                <label for='filter_grind'>Grindstones</label>
            </td>
            <td class='filter filter_separator'>
                <span>Min. quality:</span>
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["GRIND_MIN_QUALITY"] - 1] = "selected";
?>
                <select name='grind_min_quality'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
            </td>
            <td class='filter filter_separator' colspan='2'>
                <span>Stats:</span>
                <select multiple name='grind_stat[]' id='filter_grind_stat'>
                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>HP</option>
                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>HP%</option>
                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>ATK</option>
                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>ATK%</option>
                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>DEF</option>
                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>DEF%</option>
                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>SPD</option>
                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>CRR</option>
                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>CRD</option>
                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>RES</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class='filter filter_title filter_separator'>
                <span>
                    Gems
                </span>
            </td>
            <td class='filter filter_stars filter_separator'>
<?php
                $checked = "";
                if ($filters["GEM"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='gem' id='filter_gem' <?=$checked?>/>
                <label for='filter_gem'>Gems</label>
            </td>
            <td class='filter filter_separator'>
                <span>Min. quality:</span>
<?php
                $selected = Array("", "", "", "", "");
                $selected[$filters["GEM_MIN_QUALITY"] - 1] = "selected";
?>
                <select name='gem_min_quality'>
                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
                </select>
            </td>
            <td class='filter filter_separator'>
                <span>Replace...</span>
                <select multiple name='gem_stat_from[]' id='filter_gem_stat_from'>
                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>HP</option>
                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>HP%</option>
                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>ATK</option>
                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>ATK%</option>
                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>DEF</option>
                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>DEF%</option>
                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>SPD</option>
                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>CRR</option>
                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>CRD</option>
                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>RES</option>
                </select>
            </td>
            <td class='filter filter_separator'>
                <span>...with...</span>
                <select multiple name='gem_stat_from[]' id='filter_gem_stat_to'>
                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>HP</option>
                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>HP%</option>
                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>ATK</option>
                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>ATK%</option>
                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>DEF</option>
                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>DEF%</option>
                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>SPD</option>
                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>CRR</option>
                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>CRD</option>
                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>RES</option>
                </select>
            </td>
        </tr>
    </table>
    <div id='filter_apply'>
        <input type='submit' value='Apply'/>
    </div>
</form>
