{% load staticfiles %}
{% load app_tags %}
{% load hijack_tags %}
<!DOCTYPE html>
<html>
<head>

    <title>Code For Life - there has been an error</title>

    <link rel="stylesheet" type="text/css" href="{% static 'portal.css' %}">
    <link href="https://fonts.googleapis.com/css?family=Baloo" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
    <link rel="shortcut icon" href="{% static 'portal/img/favicon.ico' %}" type="image/x-icon">
    <link rel="icon" href="{% static 'portal/img/favicon.ico' %}" type="image/x-icon">  
</head>
<body>

<div id="contentWrapper">
    <div class="header">
        <a class="hidden-xs" href="{% url 'home' %}">
            <img class="logo col-sm-offset-1" src="{% static 'portal/img/logo_c4l_hexa.png' %}">
        </a>
        <div class="menu">
            <div class="menu__brand">
                <a class="visible-xs" href="{% url 'home' %}">
                    <img class="logo" src="{% static 'portal/img/logo_c4l_hexa.png' %}">
                </a>
                <a target="_blank" href="https://www.ocadogroup.com/technology/technology-pioneers">
                    <img title="Proudly developed by Ocado Technology" alt="Proudly developed by Ocado Technology"
                    class="hidden-xs" src="{% static 'portal/img/logo_ocado_tech_tagline.svg' %}">
                    <img title="Proudly developed by Ocado Technology" alt="Proudly developed by Ocado Technology"
                    class="header__ot-logo--no-tagline visible-xs" src="{% static 'portal/img/logo_ocado_tech_no_tagline.svg' %}">
                </a>
                <span class="glyphicon glyphicon-menu-hamburger header__hamburger visible-xs"
                      data-toggle="collapse" data-target="#menu-items"></span>
            </div>
            {% block leftMenuButtons %}
                {% if user|is_logged_in %}
                <div class="menu__left-side col-sm-7">
                    {% if user|is_logged_in_as_teacher %}
                        <a href="{% url 'teach' %}" class="button--menu button--menu--primary"><b>Teacher</b></a>
                        {% block secondaryButtons %}
                        {% if user|has_teacher_finished_onboarding %}
                            {% block dashboard %}<a href="{% url 'dashboard' %}" class="button--menu button--menu--secondary button--menu--enabled">School / Club</a>{% endblock dashboard %}
                            {% block rapidrouter %}<a href="{% url 'levels' %}" class="button--menu button--menu--secondary button--menu--enabled">Rapid Router</a>{% endblock rapidrouter %}
                            {% block aimmo %}
                                <a href="{% url 'play_aimmo' %}" id="aimmo_home_button" class="button--menu button--menu--secondary button--menu--enabled">Kurono</a>
                            {% endblock aimmo %}
                            {% block materials %}<a id="resources_button" href="{% url 'teaching_resources' %}" class="button--menu button--menu--secondary button--menu--enabled">Teaching Resources</a>{% endblock materials %}
                        {% else %}
                            <a href="{% url 'onboarding-organisation' %}" class="button--menu button--menu--secondary button--menu--enabled">School / Club</a>
                            <a class="button--menu button--menu--secondary button--menu--disabled">Rapid Router</a>
                            <a class="button--menu button--menu--secondary button--menu--disabled">Kurono</a>
                            <a class="button--menu button--menu--secondary button--menu--disabled">Teaching Resources</a>
                        {% endif %}
                        {% endblock secondaryButtons %}
                    {% else %}
                        <a href="{% url 'play' %}" class="button--menu button--menu--primary"><b>Student</b></a>
                        {% block studentButtons %}
                        <div class="dropdown">
                            {% block myGames %}<a href="{% url 'student_details' %}" id="student_dashboard_button"
                               class="button--menu button--menu--secondary button--menu--enabled">My Games</a>{% endblock myGames %}
                            <div class="dropdown-content">
                                <a href="{% url 'levels' %}"><small>Rapid Router</small></a>
                                {% if not user|is_independent_student %}
                                    <a href="{% url 'play_aimmo' %}"><small>Kurono</small></a>
                                {% endif %}
                            </div>
                        </div>
                        {% if user|is_logged_in_as_school_user %}
                        <div class="dropdown">
                            <a href="{% url 'scoreboard' %}" id="student_scoreboards_button"
                               class="button--menu button--menu--secondary button--menu--enabled">View Scoreboards</a>
                            <div class="dropdown-content">
                                <a href="{% url 'scoreboard' %}"><small>Rapid Router</small></a>
                            </div>
                        </div>
                        {% endif %}
                        {% if not user.new_student.class_field %}
                            <a href="{% url 'student_join_organisation' %}" id="student_join_school_button"
                               class="button--menu button--menu--secondary button--menu--enabled">Join a school</a>
                        {% endif %}
                        {% endblock studentButtons %}
                    {% endif %}
                {% else %}
                    <div class="menu__left-side col-sm-5">
                        {% block nav_teach %}<a href="{% url 'teach' %}" class="button--menu button--menu--primary button--menu--enabled">Teachers</a>{% endblock nav_teach %}
                        {% block nav_play %}<a href="{% url 'play' %}" class="button--menu button--menu--primary  button--menu--enabled">Students</a>{% endblock nav_play %}
                {% endif %}
                </div>
            {% endblock leftMenuButtons %}
            {% block rightMenuButtons %}
                {% if user|is_logged_in %}
                <div class="menu__right-side col-sm-4">
                    <div class="dropdown header__account-details-dropdown">
                        <button id="logout_menu" class="button--regular button--secondary button--dropdown header__account-details-dropdown"
                                data-toggle="dropdown">
                            <div class="dropdown__text">{{ user|make_into_username }}</div>
                        </button>
                        <ul class="dropdown-menu header__account-details-dropdown-menu">
                            {% if not request|is_hijacked %}
                            <li class="dropdown-menu__option">
                                <a class="button--regular button--primary--navigation" id="logout_button" aria-labelledby="Log out"
                                   href="{% url 'logout_view' %}" onclick="deleteAllLocalStorageWorkspaces();">
                                    <small class="dropdown-menu__option__text">Log out</small>
                                    <div class="glyphicon glyphicon-log-out"></div></a>
                            </li>
                            {% endif %}
                            {% if user|is_logged_in_as_teacher %}
                                <li class="dropdown-menu__option">
                                    <a class="button--regular button--primary--navigation" aria-labelledby="Change password"
                                       href="{% url 'dashboard' %}#edit_account_details_password">
                                        <small class="dropdown-menu__option__text">Change password</small>
                                        <div class="glyphicon glyphicon-lock"></div></a>
                                </li>
                                <li class="dropdown-menu__option">
                                    <a class="button--regular button--primary--navigation" aria-labelledby="Update my details"
                                       href="{% url 'dashboard' %}#account">
                                        <small class="dropdown-menu__option__text">Update my details</small>
                                        <div class="glyphicon glyphicon-user"></div></a>
                                </li>
                            {% else %}
                                <li class="dropdown-menu__option">
                                    <a class="button--regular button--primary--navigation" aria-labelledby="Change password"
                                       href="{% url 'student_edit_account' %}" id="student_edit_account_button">
                                        <small class="dropdown-menu__option__text">Change password</small>
                                        <div class="glyphicon glyphicon-lock"></div></a>
                                </li>
                            {% endif %}
                        </ul>
                    </div>
                    {% else %}
                    <div class="menu__right-side col-sm-5">
                        <a href="{% url 'register' %}" id="signup_button" class="button button--regular button--primary--general-play register">Register now</a>
                        <div class="dropdown">
                            <button id="login_dropdown" class="button--regular button--secondary login button--dropdown"
                                    data-toggle="dropdown">
                                <div class="dropdown__text">Log in</div>
                            </button>
                            <ul class="dropdown-menu header__login-options-dropdown-menu">
                                <li class="dropdown-menu__option">
                                    <a id="teacher_login_button" class="button--regular button--primary--general-play" aria-labelledby="Teacher" href="{% url 'teacher_login' %}">
                                        <small class="dropdown-menu__option__text">Teacher</small></a>
                                </li>
                                <li class="dropdown-menu__option">
                                    <a class="button--regular button--primary--general-educate" aria-labelledby="Student" href="{% url 'student_login' %}">
                                        <small class="dropdown-menu__option__text">Student</small></a>
                                </li>
                                <li class="dropdown-menu__option">
                                    <a class="button--regular button--primary--negative" aria-labelledby="Independent" href="{% url 'independent_student_login' %}">
                                        <small class="dropdown-menu__option__text">Independent</small></a>
                                </li>
                            </ul>
                        </div>
                    {% endif %}
                </div>
            {% endblock rightMenuButtons %}
        </div>
        <div id="menu-items" class="collapse">
            {% if user|is_logged_in %}
                <div class="menu__item">
                    <h1>{{ user|make_into_username }}</h1>
                </div>
                {% if user|is_logged_in_as_teacher %}
                    <button class="button--menu__item button--menu__item--sub-header"
                            data-toggle="collapse" data-target="#teacher-tabs">Teacher</button>
                    <div id="teacher-tabs" class="collapse">
                        <a class="button button--menu__item button--menu__item--teacher button--menu__item__sub"
                           href="{% url 'dashboard' %}">School / Club<div class="glyphicon glyphicon-chevron-right"></div></a>
                        <a class="button button--menu__item button--menu__item--teacher button--menu__item__sub"
                           href="{% url 'levels' %}">Rapid Router<div class="glyphicon glyphicon-chevron-right"></div></a>
                        <a class="button button--menu__item button--menu__item--teacher button--menu__item__sub"
                           href="{% url 'teaching_resources' %}">Teaching Resources<div class="glyphicon glyphicon-chevron-right"></div></a>
                    </div>
                {% else %}
                    <button class="button--menu__item button--menu__item--sub-header"
                            data-toggle="collapse" data-target="#student-tabs">Student</button>
                    <div id="student-tabs" class="collapse">
                        <button class="button--menu__item button--menu__item--student button--menu__item--sub-header"
                                data-toggle="collapse" data-target="#games-tabs">My Games</button>
                        <div id="games-tabs" class="collapse">
                            <a class="button button--menu__item button--menu__item--student button--menu__item__sub"
                               href="{% url 'levels' %}">Rapid Router<div class="glyphicon glyphicon-chevron-right"></div></a>
                            {% if not user|is_independent_student %}
                                <a class="button button--menu__item button--menu__item--student button--menu__item__sub"
                                   href="{% url 'play_aimmo' %}">Kurono<div class="glyphicon glyphicon-chevron-right"></div></a>
                            {% endif %}
                        </div>
                        <button class="button--menu__item button--menu__item--student button--menu__item--sub-header"
                                data-toggle="collapse" data-target="#scoreboards-tabs">View Scoreboards</button>
                        <div id="scoreboards-tabs" class="collapse">
                            <a class="button button--menu__item button--menu__item--student button--menu__item__sub"
                               href="{% url 'scoreboard' %}">Rapid Router<div class="glyphicon glyphicon-chevron-right"></div></a>
                        </div>
                    {% if not user.new_student.class_field %}
                        <a class="button button--menu__item button--menu__item--student"
                           href="{% url 'student_join_organisation' %}">Join a school<div class="glyphicon glyphicon-chevron-right"></div></a>
                    {% endif %}
                    </div>
                {% endif %}
            {% else %}
                <a class="button button--menu__item button--menu__item--teacher"
                   href="{% url 'register' %}">Register now<div class="glyphicon glyphicon-chevron-right"></div></a>
                <button class="button--menu__item button--menu__item--navigation button--menu__item--sub-header"
                        data-toggle="collapse" data-target="#login-tabs">Log in</button>
                <div id="login-tabs" class="collapse">
                    <a class="button button--menu__item button--menu__item--teacher button--menu__item__sub"
                       href="{% url 'teacher_login' %}">Teacher<div class="glyphicon glyphicon-chevron-right"></div></a>
                    <a class="button button--menu__item button--menu__item--student button--menu__item__sub"
                       href="{% url 'student_login' %}">Student<div class="glyphicon glyphicon-chevron-right"></div></a>
                    <a class="button button--menu__item button--menu__item--independent button--menu__item__sub"
                       href="{% url 'independent_student_login' %}">Independent<div class="glyphicon glyphicon-chevron-right"></div></a>
                </div>
                <a class="button button--menu__item" href="{% url 'teach' %}">Teacher
                    <div class="glyphicon glyphicon-chevron-right"></div></a>
                <a class="button button--menu__item" href="{% url 'play' %}">Student
                    <div class="glyphicon glyphicon-chevron-right"></div></a>
            {% endif %}
            <a class="button button--menu__item" href="{% url 'about' %}">About
                <div class="glyphicon glyphicon-chevron-right"></div></a>
            <a class="button button--menu__item" href="{% url 'help' %}">Help and support
                <div class="glyphicon glyphicon-chevron-right"></div></a>
            <a class="button button--menu__item" href="{% url 'terms' %}">Terms of use
                <div class="glyphicon glyphicon-chevron-right"></div></a>
            <a class="button button--menu__item" href="{% url 'privacy_policy' %}">Privacy policy
                <div class="glyphicon glyphicon-chevron-right"></div></a>
            {% if user|is_logged_in %}
                {% if user|is_logged_in_as_teacher %}
                    <a class="button button--menu__item" href="{% url 'dashboard' %}#account">Change password
                        <div class="glyphicon glyphicon-chevron-right"></div></a>
                    <a class="button button--menu__item" href="{% url 'dashboard' %}#password">Update my details
                        <div class="glyphicon glyphicon-chevron-right"></div></a>
                {% endif %}
                <a class="button button--menu__item" href="{% url 'logout_view' %}">Logout
                    <div class="glyphicon glyphicon-chevron-right"></div></a>
            {% endif %}
        </div>
    </div>

    <div class="content">
        <div class="error-page">
            <div class="banner banner--error-page banner--homepage--teacher row">
                <div class="col-sm-5 col-sm-offset-2">
                    <h1>Zap!</h1>
                    <h4>Oh dear! Something technical has gone wrong.</h4>
                    <p>Dee will attempt to fix this soon.</p>
                </div>
            </div>

            <div class="background col-sm-offset-2">
                <a class="button button--regular button--primary--general-educate" href="{% url 'home' %}">Back to homepage</a>
            </div>

            <img title="Dee" alt="Dee" src="{% static 'portal/img/dee_hi_res.png' %}"/>
        </div>
    </div>

    <div class="push"></div>
</div>

<div class="footer">
    <a id="back_to_top_button" class="back-to-top" href="#top"><img class="no-padding" src="{% static 'portal/img/footer_arrow.png' %}"></a>
    <p><a href="#top"><small>BACK TO TOP</small></a></p>
    <img class="col-sm-3" src="{% static 'portal/img/logo_c4l_horizontal.png' %}">
    <div class="row">
        <p><a href="{% url 'about' %}">About us</a></p>
        <p><a href="{% url 'teach' %}">Teachers</a></p>
        <p><a href="{% url 'play' %}">Students</a></p>
        <p><a id="help_and_support_button" href="{% url 'help' %}">Help and support</a></p>
        <p><a class="freshdesk__contact-us">Contact us</a></p>
        <p><a href="{% url 'terms' %}">Terms of use</a></p>
        <p><a href="{% url 'privacy_policy' %}">Privacy policy</a></p>
    </div>
    <div class="row social-media"><br>
        <a target="_blank" href="https://twitter.com/codeforlifeuk"><img src="{% static 'portal/img/twitter.png' %}"></a>
        <a target="_blank" href="https://www.facebook.com/codeforlifeuk/"><img src="{% static 'portal/img/facebook.png' %}"></a>
    </div>
    <a target="_blank" href="https://www.ocadogroup.com/technology/technology-pioneers"><img src="{% static 'portal/img/logo_ocado.png' %}"></a>
    <p><small>&copy; Ocado Technology 2019</small></p>
</div>

</body>
</html>
