@model FamilyBudget.ViewModels.DepenseFactureViewModel

@{
    ViewData["Title"] = "Liste des Dépenses";
}

<h2 class="text-center">Dépenses et Factures</h2>

<!-- Section Dépenses -->
<h3 class="mt-4">📌 Dépenses</h3>
<div class=" box container">
    @if (Model.Factures != null && Model.Factures.Any())
    {
        <div class="row">
            @foreach (var depense in Model.Depenses)
            {
                <div class="col-md-4">
                    <div class="card shadow-sm mb-4">
                        <div class="card-body">
                            <h5 class="card-title text-primary">@depense.IdBudgetNavigation.Categorie</h5>
                            <p class="card-text">
                                <strong>💰 Montant :</strong> <span class="text-danger">-@depense.Montant FCFA</span> <br>
                                <strong>📅 Date :</strong> @depense.DateDepense.ToString("dd/MM/yyyy") <br>
                                <strong>🏦 Compte :</strong> @depense.Compte.Type <br>
                            </p>
                        </div>
                    </div>
                </div>
            }
        </div>

    }
    else
    {
        <p class="text-muted text-center">❌ Aucune dépense enregistrée.</p>
    }
    </div>

    <!-- Section Factures -->
    <h3 class="mt-4">🧾 Factures</h3>
    <div class="box container">
        @if (Model.Factures != null && Model.Factures.Any())
        {
            <div class="row">
                @foreach (var facture in Model.Factures)
                {
                    <div class="col-md-4">
                        <div class="card shadow-sm mb-4">
                            <div class="card-body">
                                <h5 class="card-title text-warning">@facture.CategorieFacture</h5>
                                <p class="card-text">
                                    <strong>💰 Montant :</strong> <span class="text-danger">-@facture.Montant FCFA</span> <br>
                                    <strong>📅 Date :</strong> @facture.DateFacture.ToString("dd/MM/yyyy") <br>
                                    <strong>🏦 Compte :</strong> @(facture.Compte != null ? facture.Compte.Type : "Aucun") <br>
                                    <strong>📝 Statut :</strong> @(facture.IdFacture !=0 ? "Payée ✅" : "Non payée ❌")
                                </p>
                            </div>
                        </div>
                    </div>
                }
            </div>
        }
        else
        {
            <p class="text-muted text-center">❌ Aucune facture enregistrée.</p>
        }
    </div>


    <style>
        .card {
            border-radius: 10px;
            transition: transform 0.2s ease-in-out;
        }

            .card:hover {
                transform: scale(1.03);
            }

        .btn {
            border-radius: 20px;
        }

        .box {
            padding: 10px;
            box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
            border-radius: 10px;
        }
    </style>
