<!DOCTYPE html>
<html>

<head>
    <title>
        Abizeitung FAG
    </title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
    <link rel="apple-touch-icon" sizes="180x180" href="/img/shortcut.png">

    <script src="https://code.jquery.com/jquery-3.1.1.min.js"
        integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
    <script src="https://www.google.com/recaptcha/api.js?render=6LfjHdYZAAAAAKro5cv3sgjHTzQO8A_FuLbuJ2Uh"></script>
    <script>
        grecaptcha.ready(function () {
            grecaptcha.execute('6LfjHdYZAAAAAKro5cv3sgjHTzQO8A_FuLbuJ2Uh', { action: 'demo' })
                .then(function (token) {
                    document.getElementById("recapInput").value = token;
                });
        });
    </script>

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <style type="text/css">
        .blur-bg::before {
            content: "";
            position: fixed;
            left: -1%;
            right: 0;
            z-index: -1;

            display: block;
            background-image: url("/img/schule.jpg");
            background-size: cover !important;
            width: 105%;
            height: 105%;

            -webkit-filter: blur(5px);
            -moz-filter: blur(5px);
            -o-filter: blur(5px);
            -ms-filter: blur(5px);
            filter: blur(5px);
        }

        body>.grid {
            height: 100%;
        }

        .image {
            margin-top: -100px;
        }

        .column {
            max-width: 450px;
        }
    </style>
</head>

<body>
    <div class="ui middle aligned center aligned grid blur-bg">
        <div class="column">

            <% if (error) { %>
            <div class="ui negative message">
                <i class="close icon"></i>
                <div class="header">
                    Das hat nicht geklappt
                </div>
                <p>
                    Aufgrund eines Fehlers konnte das Zitat nicht hinzugefügt werden.
                </p>
            </div>
            <% } %>

            <div class="ui segment">
                <h1 class="ui header"><a href="/"><i class="angle left icon"></i></a>Zitat hinzufügen</h1>
            </div>

            <form action="/action/addQuote" enctype="multipart/form-data" method="post" class="ui large form">
                <div class="ui stacked segment">
                    <div class="field">
                        <label>Zitat</label>
                        <textarea name="text"></textarea>
                    </div>
                    <div class="field">
                        <label>Kurs</label>
                        <select name="class" class="ui search dropdown">
                            <% classes.default.forEach(element => { %>
                            <option value="<%= element.acronym %>"><%= element.subject %> <%= element.teacher %>
                                (<%= element.acronym %>)</option>
                            <% }) %>
                        </select>
                    </div>
                    <div class="field">
                        <label>Eingereicht von</label>
                        <input type="text" name="submittedBy" placeholder="Name">
                    </div>
                    <input id="recapInput" type="hidden" name="recaptchaToken">
                    <button type="submit" class="ui fluid large teal submit button">Absenden</button>
                </div>

            </form>
        </div>
    </div>
</body>

<script>
    window.history.replaceState({}, document.title, "/quotes/add");
    $('.dropdown')
        .dropdown();
    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });
</script>

</html>