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

{% block title %}Client Dashboard - Veracity Real Estate{% endblock %}

{% block content %}
<div class="container-fluid mt-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2 style="color: #0A2342;">My Appraisal Orders</h2>
        <a href="{% url 'order_form' %}" class="btn btn-primary" style="background-color: #3498DB; border-color: #3498DB;">Request New Appraisal</a>
    </div>

    <div class="card shadow-sm">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover align-middle">
                    <thead class="table-light">
                        <tr>
                            <th scope="col">Order ID</th>
                            <th scope="col">Property Address</th>
                            <th scope="col">Status</th>
                            <th scope="col">Date Submitted</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for order in orders %}
                        <tr>
                            <td>{{ order.id }}</td>
                            <td>{{ order.property_address }}</td>
                            <td><span class="badge bg-secondary">{{ order.status }}</span></td>
                            <td>{{ order.created_at|date:"Y-m-d H:i" }}</td>
                        </tr>
                        {% empty %}
                        <tr>
                            <td colspan="4" class="text-center py-5">
                                <p class="text-muted">You have not submitted any orders yet.</p>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}
