<!DOCTYPE html>
<html lang="de-DE">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta name="generator" content="BVplan" />
        <title>BVplan | dergrimm.net</title>

        <link rel="shortcut icon" href="/static/favicon.ico" />
        <link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png">
        <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png">
        <link rel="manifest" href="/static/site.webmanifest">

        <link rel="stylesheet" type="text/css" href="/static/css/bvplan.css" />

        <script id="data-element-count" type="application/json">{{ data.substitutions.len()|json|safe }}</script>

        <script
            src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js"
            integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ=="
            crossorigin="anonymous"
            referrerpolicy="no-referrer"
        ></script>

        <!-- Matomo -->
        <script>
            var _paq = window._paq = window._paq || [];
            /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
            _paq.push(['trackPageView']);
            _paq.push(['enableLinkTracking']);
            (function() {
                var u="//matomo.dergrimm.net/";
                _paq.push(['setTrackerUrl', u+'matomo.php']);
                _paq.push(['setSiteId', '6']);
                var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
                g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
            })();
        </script>
        <!-- End Matomo Code -->
    </head>
    <body>
        <header id="info">
            <div id="title-wrapper" class="column">
                <h1 id="title">BVplan</h1>
                <span id="subtitle">dergrimm.net</span>
            </div>
            <div id="tenant-info" class="column">
                <span>{{ data.tenant }}, {{ data.schoolyear }}</span>
                <br />
                <span>Stand: {{ data.queried_at }}</span>
                <br />
                <span>Untis: {{ data.last_import_time }}</span>
            </div>
        </header>

        <main>
            <table id="plan">
                <caption>
                    {{ data.date }}, Woche {{ data.week_type }}
                </caption>

                <colgroup>
                    <col />
                    <col />
                    <col />
                    <col style="width: 30%" />
                    <col />
                    <col />
                    <col />
                    <col style="width: 20%" />
                </colgroup>

                <thead>
                    <tr>
                        <th>Stunde</th>
                        <th>Klasse(n)</th>
                        <th>(Fach)</th>
                        <th>Fach</th>
                        <th>Vertreter</th>
                        <th>(Raum)</th>
                        <th>Raum</th>
                        <th>Text</th>
                    </tr>
                </thead>

                <tbody>
                {% for subst in data.substitutions %}
                    <tr>
                        <td>{{ subst.period }}</td>
                        <td>{{ subst.classes|join(", ") }}</td>
                        <td>
                            {% match subst.prev_subject %}
                                {% when Some with (x) %}
                                    {{ x }}
                                {% when None %}
                                    ---
                            {% endmatch %}
                        </td>
                        <td>
                            {% match subst.subject %}
                                {% when Some with (x) %}
                                    {{ x }}
                                {% when None %}
                                    ---
                            {% endmatch %}
                        </td>
                        <td>
                            {% match subst.teachers %}
                                {% when Some with (x) %}
                                    {{ x|join(", ") }}
                                {% when None %}
                                    ---
                            {% endmatch %}
                        </td>
                        <td>
                            {% match subst.prev_room %}
                                {% when Some with (x) %}
                                    {{ x }}
                                {% when None %}
                                    ---
                            {% endmatch %}
                        </td>
                        <td>
                            {% match subst.room %}
                                {% when Some with (x) %}
                                    {{ x }}
                                {% when None %}
                                    ---
                            {% endmatch %}
                        </td>
                        <td>
                            {% match subst.text %}
                                {% when Some with (x) %}
                                    {{ x }}
                                {% when None %}
                            {% endmatch %}
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </main>

        <footer id="footer">
            <div class="element">
                <p>
                    BVplan - der bessre Vertretungsplan sogar mit UTF-8 Support!
                    Wow
                </p>
                <p>
                    <a href="https://git.dergrimm.net/dergrimm/bvplan">
                        https://git.dergrimm.net/dergrimm/bvplan
                    </a>
                </p>
            </div>
            <hr />
            <p class="element">
                <code>
                    Powered by Dominic Grimm &lt;<a
                        href="mailto:dominic@dergrimm.net"
                        >dominic@dergrimm.net</a
                    >&gt;, Untis sucks
                </code>
            </p>
        </footer>

        <script src="/static/js/bvplan.js"></script>
    </body>
</html>