<!DOCTYPE html>
<html lang="en-eu">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
        <link rel="stylesheet" href="/static/bootstrap/dist/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
        {% if title %}
        <title> MiniBase - {{ title }} </title>
        {% else %}
        <title> MiniBase </title>
        {% endif %}
    </head>

    <body style="{{ theme.layoutBgColor }};">
        <nav class="navbar navbar-expand-lg" style="{{ theme.layoutNavbarBgColor }}">
            <a class="navbar-brand" style="color: {{ theme.orange }};" href="#">MiniBase</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <!-- Checks if the user is logged in or not-->
                    {% if current_user.is_authenticated %}
                    <li class="nav-item"><a class="nav-link" href="{{ url_for('main.home') }}">Overwiev</a></li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Relations</a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="{{ url_for('main.customer') }}">Customers</a>
                            <a class="dropdown-item" href="#">Suppliers</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="{{ url_for('company.company_register') }}">Register Company</a>
                            <a class="dropdown-item" href="#">Update Company</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="{{ url_for('person.person_register') }}">Register Person</a>
                            <a class="dropdown-item" href="#">Update Person</a>
                        </div>
                    
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('main.customer') }}">Custommer</a></li>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Admin</a>
                            <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <a class="dropdown-item" href="#">User Management</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('admin.company_register_legal_entity') }}">Company Regiters Legal Entity</a>
                                <a class="dropdown-item" href="{{ url_for('admin.company_register_relation') }}">Company Register Relation</a>
                                <a class="dropdown-item" href="{{ url_for('admin.company_register_status') }}">Company Register Status</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('admin.person_register_competence') }}">Person Register Competence</a>
                                <a class="dropdown-item" href="{{ url_for('admin.person_register_role') }}">Person Register Role</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('admin.project_register_status') }}">Project Register Status</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_status') }}">Product Register Status</a>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_eligibility') }}">Product Register Eligibility</a>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_domain') }}">Product Register Domain</a>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_classification') }}">Product Register Classification</a>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_category') }}">Product Register Category</a>
                                <a class="dropdown-item" href="{{ url_for('admin.product_register_sub_category') }}">Product Register Sub Category</a>
                                <a class="dropdown-item" href="#">Product Register Physical</a>
                                <a class="dropdown-item" href="#">Product Register Packaging</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{ url_for('admin.note_register_status') }}">Note Register Status</a>
                                <a class="dropdown-item" href="{{ url_for('admin.register_industry') }}">Register Industry</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="#">Database</a>
                            </div>
                            </li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Project</a>
                                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{ url_for('company.select_company') }}">Find Projects</a>
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item" href="{{ url_for('project.register_project') }}">Register Project</a>
                                    <a class="dropdown-item" href="#">Update Project</a>
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item" href="{{ url_for('project.register_element') }}">Register Element</a>
                                    <a class="dropdown-item" href="#">Update Element</a>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-brand"><h3 class="nav-brand" style="color: {{ theme.orange }};">||</h3></li>
                    {% if globalVars.selectedCompany.id %} 
                        <li class="nav-item"><a class="nav-link" href="#">{{ globalVars.selectedCompany.name}}</a></li>
                    {% else %}
                    <li class="nav-item"><a class="nav-link" href="{{ url_for('company.select_company') }}">Customer</a></li>
                    {% endif %}
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.orange }};"> / </a></li>
                    {% if globalVars.selectedProject.id %} 
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('project.show_project', projectId=globalVars.selectedProject.id ) }}">{{ globalVars.selectedProject.name}}</a></li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('project.select_project') }}">Project</a></li>
                    {% endif %}
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.orange }};"> / </a></li>
                    {% if globalVars.selectedElement.id %} 
                    <li class="nav-item"><a class="nav-link" href="{{ url_for('project.show_element', elementId=globalVars.selectedElement.id) }}">{{ globalVars.selectedElement.name }}</a></li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('project.select_project') }}">Element</a></li>
                    {% endif %}
                    <li class="nav-brand"><h3 class="nav-brand" style="color: {{ theme.orange }};">||</h3></li>
                </ul>
                {% endif %}
                <ul class="navbar-nav ml-auto">
                    {% if current_user.is_authenticated %}
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.light_blue }};" href="{{ url_for('users.account') }}">Account</a></li>
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.light_blue }};" href="{{ url_for('users.logout') }}">Logout</a></li>
                    {% else %}
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.light_blue }};" href="{{ url_for('users.login') }}">Login</a></li>
                    <li class="nav-item"><a class="nav-link" style="color: {{ theme.light_blue }};" href="{{ url_for('users.register') }}">Register</a></li>
                    {% endif %}
                </ul>
            </div>
        </nav>

        <main>
            <!-- This part will catch anny messages that we whant to send when something has been updated -->
            {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
            {% for category, message in messages %}
            <div class="alert alert-{{ category }}">
                {{ message }}
            </div>
            {% endfor %}
            {% endif %}
            {% endwith %}

            <!-- Every extra template will be placed here for examplem login.htlm and so on -->
            {% block content %}{% endblock %}
        </main>
        <script src="/static/jquery/dist/jquery.js"></script>
        <script src="/static/bootstrap/dist/js/bootstrap.min.js"></script>
    </body>
</html>
