{% extends "base.html" %}

{% block title %}Clients - {{ app_name }}{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h1 class="h3 mb-0">
                    <i class="fas fa-building text-primary"></i> Clients
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0"><i class="fas fa-list me-1"></i> Client List ({{ clients|length }})</h5>
                </div>
                <div class="card-body">
                    {% if clients %}
                    <div class="row row-cols-1 row-cols-md-3 g-3">
                        {% for client in clients %}
                        <div class="col">
                            <a class="text-decoration-none" href="{{ url_for('clients.view_client', client_id=client.id) }}">
                                <div class="card h-100">
                                    <div class="card-body">
                                        <h5 class="card-title mb-0"><i class="fas fa-briefcase me-2 text-primary"></i>{{ client.name }}</h5>
                                        {% if client.description %}
                                        <p class="card-text text-muted small mt-2">{{ client.description[:50] }}{% if client.description|length > 50 %}...{% endif %}</p>
                                        {% endif %}
                                        <div class="mt-2">
                                            <span class="badge bg-primary">{{ client.total_projects }} projects</span>
                                            {% if client.default_hourly_rate %}
                                            <span class="badge bg-success ms-1">{{ "%.2f"|format(client.default_hourly_rate) }} {{ currency }}/hr</span>
                                            {% endif %}
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </div>
                        {% endfor %}
                    </div>
                    {% else %}
                    <div class="text-center py-5">
                        <i class="fas fa-briefcase fa-3x text-muted mb-3"></i>
                        <h4 class="text-muted">No Clients Found</h4>
                    </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}


