{% extends "base.html" %}

{% block content %}
<h2 class="text-2xl mb-4">Printer Status</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
    {% for printer in printers %}
    <div class="card bg-gray-900 shadow-xl">
        <div class="card-body">
            <h2 class="card-title">{{ printer[1] }}</h2>
            <p>Status: {{ printer[2] }}</p>
            {% if printer[2] == 'frei' %}
            <form method="POST" action="/api/printers/job">
                <input type="hidden" name="printer_id" value="{{ printer[0] }}">
                <button class="btn btn-success mt-4 w-full">Start Job</button>
            </form>
            {% elif printer[2] == 'belegt' %}
            <button class="btn btn-warning mt-4 w-full" disabled>In Use</button>
            {% elif printer[2] == 'reserviert' %}
            <form method="POST" action="/api/printers/release">
                <input type="hidden" name="printer_id" value="{{ printer[0] }}">
                <button class="btn btn-info mt-4 w-full">Release</button>
            </form>
            {% endif %}
        </div>
    </div>
    {% endfor %}
</div>
<a href="/logout" class="btn btn-secondary mt-4">Logout</a>
{% endblock %}
