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

{% block title %}Pulpit - webFirma{% endblock %}

{% block content %}
<header class="hero-section text-white text-center">
    <div class="container">
        <h1 class="display-4">Witaj w webFirma</h1>
        <p class="lead">Kompleksowe zarządzanie firmą w jednym miejscu.</p>
    </div>
</header>

<div class="container mt-5">
    <section id="projects">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2 class="section-title">Projekty</h2>
            <a href="{% url 'add_project' %}" class="btn btn-primary">Dodaj projekt</a>
        </div>

        <div class="card shadow-sm">
            <div class="card-body">
                {% if projects %}
                    <div class="table-responsive">
                        <table class="table table-hover align-middle">
                            <thead class="table-light">
                                <tr>
                                    <th scope="col">Nazwa projektu</th>
                                    <th scope="col">Kontrahent</th>
                                    <th scope="col">Data rozpoczęcia</th>
                                    <th scope="col">Data zakończenia</th>
                                    <th scope="col">Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for project in projects %}
                                <tr>
                                    <td>{{ project.name }}</td>
                                    <td>{{ project.client }}</td>
                                    <td>{{ project.start_date|date:"Y-m-d" }}</td>
                                    <td>{{ project.end_date|date:"Y-m-d" }}</td>
                                    <td><span class="badge bg-primary-soft">{{ project.get_status_display }}</span></td>
                                </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                {% else %}
                    <div class="text-center p-4">
                        <p class="mb-3">Brak projektów do wyświetlenia.</p>
                        <p>Utwórz swój pierwszy projekt, aby zacząć zarządzać pracą.</p>
                    </div>
                {% endif %}
            </div>
        </div>
    </section>
</div>
{% endblock %}
