<?php
    /**
     * Rune craft report view.
     *
     * Contains the view layout and ome code to present the data.
     *
     * @category View
     * @property_read Report_Runecraft_Page $page The page model.
     */

    namespace swdb;
?>
<!DOCTYPE html>
<html lang='en'>
    <head>
        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
        <title><?=$page->title?></title>
        <link rel='shortcut icon' href='<?=$page->favicon?>'/>
        <!-- CSS files -->
        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report_runecraft.css'/>
        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
        <!-- Meta tags -->
        <link rel='canonical' href='<?=$page->canonical?>'/>
        <link rel='author' href='<?=$page->author?>'/>
        <link rel='publisher' href='<?=$page->author?>'/>
        <meta name='description' content='<?=$page->description?>'/>
        <meta property='og:title' content='<?=$page->title?>'/>
        <meta property='og:url' content='<?=$page->canonical?>'/>
        <meta property='og:description' content='<?=$page->description?>'/>
        <meta property='og:image' content='<?=$page->icon?>'/>
        <meta property='og:site_name' content='<?=$page->name?>'/>
        <meta property='og:type' content='website'/>
        <meta property='og:locale' content='en'/>
        <meta name='twitter:card' content='summary'/>
        <meta name='twitter:title' content='<?=$page->title?>'/>
        <meta name='twitter:description' content='<?=$page->description?>'/>
        <meta name='twitter:image' content='<?=$page->icon?>'/>
        <meta name='twitter:url' content='<?=$page->canonical?>'/>
        <meta name='robots' content='index follow'/>
        <script>

            /**
             * Shows or hiddes the filters panel.
             */
            function toggleFilters(){
                var content = document.getElementById('filters_content');
                var slid = document.getElementById('filters_slid');
                if (content.style.maxHeight != '30em'){
                    content.style.maxHeight = '30em';
                    slid.style.transform = 'rotate(90deg)';
                }
                else{
                    content.style.maxHeight = '0px';
                    slid.style.transform = 'rotate(0deg)';
                }
            };
        </script>
    </head>
    <body>
<?php
        include __DIR__ . "/inc/header.php";
?>
        <section class='filters'>
            <h2 id='filters_title' onClick='toggleFilters();'>
                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
                Upgrade filters
            </h2>
            <article id='filters_content'>
<?php
                $filters = $page->filters;
                $custom_filters = $page->custom_filters;
                include __DIR__ . "/inc/filter_report_runecraft.php";
?>
            </article>

        </section> <!-- #filters -->
<?php
            foreach ($page->upgrades as $upgrade){
?>
            <section class='content'>
                <h2>
                    <span>
                        <?=$upgrade["unit"]->title?>
                    </span>
                </h2>
                <article>
                    <div class='monster'>
                        <div class='profile'>
                            <div class='monster_panel'>
                                <?=HTML::unit_panel($upgrade["unit"])?>
                            </div>
                        </div> <!-- .profile -->
                    </div>
                    <div class='monster_runes'>
<?php
                        foreach ($upgrade["upgrade"] as $rupgrade){
?>
                            <?=HTML::rune_table($rupgrade["rune"])?>
                            <div class='craft'>
<?php
                                foreach ($rupgrade["craft"] as $craft){
?>
                                    <?=HTML::craft_panel($craft)?>
<?php
                                }
?>
                            </div>
<?php
                        }
?>
                    </div> <!-- .monster_runes -->
                </article>
            </section>
<?php
            }
        include __DIR__ . "/inc/footer.php";
?>
    </body>
</html>

