{% load static %}
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Scrapyd Dash - {% block title %}{% endblock %}</title>
    <meta name="description" content="Scrapyd Dash - Scrapy dashboard using scrapyd and logparser">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="{% static 'js/bootstrap-notify.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'js/script.js' %}"></script>

    <link rel="stylesheet" href="{% static 'vendors/bootstrap/dist/css/bootstrap.min.css' %}">
    <link rel="stylesheet" href="{% static 'vendors/font-awesome/css/font-awesome.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/style.css' %}">
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' rel='stylesheet' type='text/css'>
</head>

<body>

    {% if messages %}
      {% for message in messages %}
        <script>django_messages("{{message}}", "{{message.tags}}");</script>
      {% endfor %}
    {% endif %}


    <!-- Left Panel -->

    <aside id="left-panel" class="left-panel">
        <nav class="navbar navbar-expand-sm navbar-default">

            <div class="navbar-header">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-menu" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="fa fa-bars"></i>
                </button>
                <a class="navbar-brand" href="{% url 'servers' %}">Scrapyd Dash</a>
                <a class="navbar-brand hidden" href="{% url 'servers' %}">SD</a>
            </div>

            <div id="main-menu" class="main-menu collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="{% url 'servers' %}"> <i class="menu-icon fa fa-server"></i>Scrapyd Servers</a>
                    </li>
                    <li>
                         <a href="{% url 'tasks' %}" > <i class="menu-icon fa fa-tasks"></i>Tasks</a>
                    </li>
                    <li>
                         <a href="{% url 'scheduled_tasks' %}" > <i class="menu-icon fa fa-calendar"></i>Scheduled Tasks</a>
                    </li>
                    <li>
                        <h3 class="menu-title">Extras</h3>
                    </li>
                    <li>
                        <div class="social">
                            <a href="https://github.com/Dainius-P/scrapyd-dash"><i class="fa fa-github fa-2x" class="github"></i></a>
                        </div>
                    </li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </nav>
    </aside><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

            <div class="header-menu">

                <div class="col-sm-7">
                    <a id="menuToggle" class="menutoggle pull-left"><i class="fa fa fa-tasks"></i></a>
                </div>
                {% if user.is_authenticated %}
                    <div class="col-sm-5">
                        <div class="user-area dropdown float-right">
                            <a href="{% url 'logout' %}">
                                Log out
                            </a>
                        </div>
                    </div>
                {% endif %}
            </div>

        </header><!-- /header -->
        <!-- Header-->
        <div class="content">
            {% if user.is_authenticated %}
                {% block body %}
                {% endblock %}
            {% else %}
                <div class="sufee-login d-flex align-content-center flex-wrap">
                    <div class="container">
                        <div class="login-content">
                            <div class="login-form">
                                <form method="POST" action="/login/">
                                    {% csrf_token %}
                                    <div class="form-group">
                                        <label>Username</label>
                                        <input type="text" name="username" class="form-control" placeholder="Username" required>
                                    </div>
                                    <div class="form-group">
                                        <label>Password</label>
                                        <input type="password" name="password" class="form-control" placeholder="Password" required>
                                    </div>
                                    <button type="submit" class="btn btn-success btn-flat m-b-30 m-t-30">Sign in</button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            {% endif %}
        </div>
        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

    <script src="{% static 'vendors/jquery/dist/jquery.min.js' %}"></script>
    <script src="{% static 'vendors/bootstrap/dist/js/bootstrap.min.js' %}"></script>
    <script src="{% static 'js/main.js' %}"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</body>

</html>
