{% extends "base.html" %}
{% load static %}

{% block title %}EventKasse POS{% endblock %}

{% block content %}
<div class="pos-container">
    <main class="pos-main">
        <header class="pos-header">
            <div class="d-flex justify-content-between align-items-center">
                <h1 class="text-white">EventKasse</h1>
                <div>
                    <span class="text-white me-3">Hallo, {{ request.user.username }}</span>
                    <a href="{% url 'logout' %}" class="btn btn-secondary">Abmelden</a>
                    <a href="/admin/" class="btn btn-secondary">Admin</a>
                </div>
            </div>
        </header>

        <div class="product-area">
            {% for category, products in grouped_products.items %}
                <h2 class="category-title">{{ category }}</h2>
                <div class="product-grid">
                    {% for product in products %}
                    <div class="product-card">
                        <div class="product-card-body">
                            <h5 class="product-card-title">{{ product.name }}</h5>
                            <p class="product-card-price">€{{ product.price|stringformat:".2f" }}</p>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            {% empty %}
                <div class="col-12">
                    <div class="card bg-dark text-white">
                        <div class="card-body">
                            <h5 class="card-title">No Products Found</h5>
                            <p class="card-text">Please add some products in the <a href="/admin/core/product/add/">Django Admin</a> to get started.</p>
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
    </main>

    <aside class="pos-sidebar">
        <div class="cart">
            <h2 class="cart-title">Cart</h2>
            <div class="cart-items">
                <p class="text-white-50">Your cart is empty.</p>
            </div>
            <div class="cart-summary">
                <div class="summary-row">
                    <span>Subtotal</span>
                    <span>€0.00</span>
                </div>
                <div class="summary-row">
                    <span>Deposit</span>
                    <span>€0.00</span>
                </div>
                <div class="summary-row total">
                    <span>Total</span>
                    <span>€0.00</span>
                </div>
            </div>
            <button class="btn btn-primary btn-lg w-100 mt-3">Charge</button>
        </div>
    </aside>
</div>
{% endblock %}
