{% load i18n %}
{% load static %}

{% load common_tags %}
{% load navigation_tags %}
{% load smart_settings_tags %}

{% spaceless %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
        <title>
            {% block base_title %}
                {% block title %}{% endblock %} :: {% block project_name %}{% smart_setting 'COMMON_PROJECT_TITLE' %}{% endblock %}
            {% endblock base_title %}
        </title>

        <link href="{% static 'appearance/vendors/fontawesome-free-5.0.8/svg-with-js/css/fa-svg-with-js.css' %}" media="screen" rel="stylesheet" type="text/css" />
        <link href="{% static 'appearance/node_modules/bootswatch/flatly/bootstrap.min.css' %}" media="screen" rel="stylesheet" type="text/css" />
        <link href="{% static 'appearance/vendors/fancybox-master/dist/jquery.fancybox.min.css' %}" media="screen" rel="stylesheet" type="text/css" />
        <link href="{% static 'appearance/node_modules/select2/dist/css/select2.min.css' %}" media="screen" rel="stylesheet" type="text/css" />
        <link href="{% static 'appearance/node_modules/toastr/build/toastr.min.css' %}" media="screen" rel="stylesheet" type="text/css" />
        <link href="{% static 'appearance/css/base.css' %}" media="screen" rel="stylesheet" type="text/css" />
        {% block stylesheets %}{% endblock %}
    </head>
    <body>
        <div class="hidden-xs hidden-sm" id="ajax-spinner" style="display: none;"></div>
        {% if appearance_type == 'plain' %}
            {% block content_plain %}{% endblock %}
        {% else %}
            <div id="main-menu">
                {% include 'appearance/main_menu.html' %}
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-12">
                        <div id="ajax-content"></div>
                    </div>
                </div>
            </div>
        {% endif %}

        <div class="modal fade" id="modal-server-error" role="dialog" tabindex="-1" >
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">{% trans 'Server error' %}</h4>
                    </div>
                    <div class="modal-body">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">{% trans 'Close' %}</button>
                    </div>
                </div>
            </div>
        </div>

        <script id="template-invalid-document" type="text/x-template">
            <div class="text-center" style="border: height: 100%;">
                <div class="fa-3x">
                    <span class="fa-layers fa-fw">
                        <i class="far fa-file text-primary"></i>
                        <i class="fa-inverse fas fa-times text-danger" data-fa-transform="shrink-6"></i>
                    </span>
                </div>
            </div>
        </script>

        <script id="template-error" type="text/x-template">
            <div class="content">
                <h2 class="title">{% blocktrans %}Server communication error{% endblocktrans %}</h2>
                <div class="inner">
                    <p>{% blocktrans %}Check you network connection and try again in a few moments.{% endblocktrans %}</p>
                </div>
            </div>
        </script>

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

        <script src="{% static 'appearance/node_modules/jquery/dist/jquery.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/bootstrap/dist/js/bootstrap.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/packages/jquery.scrollview.js' %}" type="text/javascript"></script>

        <script src="{% static 'appearance/node_modules/jquery-lazyload/jquery.lazyload.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/jquery-lazyload/jquery.scrollstop.js' %}" type="text/javascript"></script>

        <script src="{% static 'appearance/vendors/fancybox-master/dist/jquery.fancybox.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/select2/dist/js/select2.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/toastr/build/toastr.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/jquery-match-height/dist/jquery.matchHeight-min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/vendors/fontawesome-free-5.0.8/svg-with-js/js/fontawesome-all.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/IPv6.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/punycode.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/SecondLevelDomains.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/URI.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/URITemplate.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/urijs/src/URI.fragmentURI.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/node_modules/jquery-form/dist/jquery.form.min.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/js/mayan_app.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/js/mayan_image.js' %}" type="text/javascript"></script>
        <script src="{% static 'appearance/js/partial_navigation.js' %}" type="text/javascript"></script>
        <script>
            {# Transfer variable from Django to javascript #}
            var initialURL = '{% url home_view %}';
            var djangoDEBUG = {% if debug %}true{% else %}false{% endif %};
            var apiTemplateMainMenuURL = '{% url "rest_api:template-detail" "main_menu" %}';
        </script>
        <script src="{% static 'appearance/js/base.js' %}" type="text/javascript"></script>
        <script>
            var app = new MayanApp();

            var afterBaseLoad = function () {
                MayanImage.intialize();
                app.doToastrMessages();
                app.resizeFullHeight();
                app.setupSelect2();
                app.setupScrollView();
            }

            jQuery(document).ready(function() {
                app.initialize();
            });
        </script>
    </body>
</html>
{% endspaceless %}
