<div class="navbar">
    <nav>
        <a href="/"><img src="{{url_for('static', filename='assets/img/wmgzon.bmp')}}" id="logo" class="not-required" alt="WMGZON Logo"></a>
        <form action="" method="get">
            <input type="text" name="search" placeholder="Find your favourite products" class="search-bar">
            <input type="submit" class="search-button">
        </form>
        <div class="vert-align">
            <a href="/"><img src="{{url_for('static', filename='assets/img/cart.bmp')}}" id="cart" alt="Shopping Cart"></a>
            {% if user != None: %}
                <a href="/logout">Welcome, {{ user.username }}</a>
            {% else %}
                <a href="/login">Login/Signup</a>
            {% endif %}
        </div>
    </nav>
    
    <centre>
        {% if user != None and user.role == "Seller" %}
            <div class="categories">
                {# List all available seller tools #}
                <a href="/products/add" class="category">Create Products</a>
                <a href="/products/ownproducts" class="category">View My Products</a>
                <a href="/products/stats" class="category">View Seller Stats</a>
            </div>
        {% endif %}
    
        <div class="categories">
            {# List all categories and ensure the selected one is highlighted #}
            {% for c in categories %}
                {% if category == c.name %}
                    <a style="color: cyan" href="/products/{{c.name}}" class="category">{{c.name}}</a>
                {% else %}
                    <a href="/products/{{c.name}}" class="category">{{c.name}}</a>
                {% endif %}
            {% endfor %}
        </div>
    </centre>    
</div>

{% with messages = get_flashed_messages(with_categories=true)%}
    {% if messages %}
        {% for category, message in messages %}
            <label>
                <input type="checkbox" class="alertCheckbox" autocomplete="off" />
                <div class="alert {{category}}">
                    <span class="alertClose">X</span>
                    <span class="alertText">{{message}}
                        <br class="clear"/></span>
                </div>
            </label>
        {% endfor%}
    {% endif %}
{% endwith %}
