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

{% plugins_enabled as plugins_enabled %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% settings_value 'REPORT_ENABLE_TEST_REPORT' as test_report_enabled %}
{% settings_value 'RETURNORDER_ENABLED' as return_order_enabled %}
{% settings_value "REPORT_ENABLE" as report_enabled %}
{% settings_value "SERVER_RESTART_REQUIRED" as server_restart_required %}
{% settings_value "LABEL_ENABLE" as labels_enabled %}
{% inventree_show_about user as show_about %}

<!DOCTYPE html>
<html lang="en">
<head>

<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="{% static 'img/favicon/apple-icon-57x57.png' %}">
<link rel="apple-touch-icon" sizes="60x60" href="{% static 'img/favicon/apple-icon-60x60.png' %}">
<link rel="apple-touch-icon" sizes="72x72" href="{% static 'img/favicon/apple-icon-72x72.png' %}">
<link rel="apple-touch-icon" sizes="76x76" href="{% static 'img/favicon/apple-icon-76x76.png' %}">
<link rel="apple-touch-icon" sizes="114x114" href="{% static 'img/favicon/apple-icon-114x114.png' %}">
<link rel="apple-touch-icon" sizes="120x120" href="{% static 'img/favicon/apple-icon-120x120.png' %}">
<link rel="apple-touch-icon" sizes="144x144" href="{% static 'img/favicon/apple-icon-144x144.png' %}">
<link rel="apple-touch-icon" sizes="152x152" href="{% static 'img/favicon/apple-icon-152x152.png' %}">
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'img/favicon/apple-icon-180x180.png' %}">
<link rel="icon" type="image/png" sizes="192x192"  href="{% static 'img/favicon/android-icon-192x192.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="96x96" href="{% static 'img/favicon/favicon-96x96.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/favicon/favicon-16x16.png' %}">
<link rel="manifest" href="{% static 'img/favicon/manifest.json' %}">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="{% static 'img/favicon/ms-icon-144x144.png' %}">
<meta name="theme-color" content="#ffffff">

<!-- CSS -->
<link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'bootstrap-table/bootstrap-table.min.css' %}">
<link rel="stylesheet" href="{% static 'bootstrap-table/extensions/group-by-v2/bootstrap-table-group-by.min.css' %}">
<link rel="stylesheet" href="{% static 'bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.css' %}">
<link rel='stylesheet' href='{% static "treegrid/css/jquery.treegrid.css" %}'>
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.min.css' %}">
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.min.css' %}">
<link rel="stylesheet" href="{% static 'select2/css/select2.min.css' %}">
<link rel="stylesheet" href="{% static 'select2/css/select2-bootstrap-5-theme.css' %}">
<link rel="stylesheet" href="{% static 'fullcalendar/main.min.css' %}">
<link rel="stylesheet" href="{% static 'script/jquery-ui/jquery-ui.min.css' %}">
<link rel="stylesheet" href="{% static 'easymde/easymde.min.css' %}">

<link rel="stylesheet" href="{% static 'css/inventree.css' %}">

<link rel="stylesheet" href="{% get_color_theme_css user.get_username %}">

<style>
    {% block css %}
    <!-- Custom CSS style goes here -->
    {% endblock css %}
</style>
{% block head %}
{% endblock head %}

<title>
{% block page_title %}
{% inventree_title %}
{% endblock page_title %}
</title>
</head>

<body>

{% include "navbar.html" %}

<div class='main body wrapper container-fluid inventree-body'>

    <div class='row flex-nowrap inventree-body'>
        <div class='col-auto px-1 sidebar-wrapper'>
            <div id='sidebar' class='collapse collapse-horizontal show' style='display: none;'>
                <div id='sidebar-nav' class='list-group text-sm-start'>
                    <ul id='sidebar-list-group' class='list-group sidebar-list-group'>
                        {% block sidebar %}
                        <!-- Sidebar goes here -->
                        {% endblock sidebar %}
                        {% include "plugin/panel_menu.html" %}
                        {% include "sidebar_toggle.html" with target='sidebar' %}
                    </ul>
                </div>
            </div>
        </div>
        <main class='col ps-md-2 pt-2 pe-2'>

            {% block alerts %}
            <div class='notification-area' id='alerts'>
                <!-- Div for displayed alerts -->
                {% if server_restart_required %}
                <div id='alert-restart-server' class='alert alert-danger' role='alert'>
                    <span class='fas fa-server'></span>
                    <strong>{% trans "Server Restart Required" %}</strong>
                    <small>
                        <br>
                        {% trans "A configuration option has been changed which requires a server restart" %}. {% trans "Contact your system administrator for further information" %}
                    </small>
                </div>
                {% endif %}
            </div>
            {% endblock alerts %}

            {% block breadcrumb_list %}
            <div class='container-fluid navigation' id='breadcrumb-div'>
                <nav aria-label='breadcrumb'>
                    <ol class='breadcrumb' id='breadcrumb-list'>
                        {% block breadcrumbs %}
                        {% endblock breadcrumbs %}
                    </ol>
                </nav>

                <div id='breadcrumb-tree-collapse' class='collapse collapse-horizontal show border' style='display: none;'>
                    {% block breadcrumb_tree %}
                    {% endblock breadcrumb_tree %}
                </div>
            </div>

            {% endblock breadcrumb_list %}

            {% block content %}
                <!-- Each view fills in here.. -->
            {% endblock content %}
        </main>
    </div>

    {% include 'modals.html' %}
    {% include "notifications.html" %}
    {% include "search.html" %}
</div>

{% include "third_party_js.html" %}


<!-- general JS -->
<script defer type='text/javascript' src="{% static 'script/inventree/inventree.js' %}"></script>
<script defer type='text/javascript' src="{% static 'script/inventree/message.js' %}"></script>

<!-- dynamic javascript templates -->
<script defer type='text/javascript' src="{% url 'calendar.js' %}"></script>
<script defer type='text/javascript' src="{% url 'nav.js' %}"></script>
<script defer type='text/javascript' src="{% url 'permissions.js' %}"></script>
<script defer type='text/javascript' src="{% url 'settings.js' %}"></script>

<!-- translated javascript templates-->
<script defer type='text/javascript' src="{% i18n_static 'api.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'attachment.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'barcode.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'bom.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'build.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'charts.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'company.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'filters.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'forms.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'helpers.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'index.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'label.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'modals.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'model_renderers.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'order.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'part.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'purchase_order.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'return_order.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'report.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'sales_order.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'search.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'status_codes.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'stock.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'plugin.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'pricing.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'news.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'tables.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'table_filters.js' %}"></script>
<script defer type='text/javascript' src="{% i18n_static 'notification.js' %}"></script>

{% block js_load %}
{% endblock js_load %}

<script defer type='text/javascript'>

$(document).ready(function () {

    {% include "plugin/panel_js.html" %}

{% block js_ready %}
{% endblock js_ready %}

    inventreeDocReady();

    {% if barcodes %}
    $('#barcode-scan').click(function() {
        barcodeScanDialog();
    });
    {% endif %}

    moment.locale('{{ request.LANGUAGE_CODE }}');

    // Account notifications
    {% if messages %}
    {% for message in messages %}
    showMessage(
        '{{ message }}',
        {
            style: 'info',
        }
    );
    {% endfor %}
    {% endif %}
});

</script>

{% block js %}
{% endblock js %}

</body>
</html>
