<?php require dirname(__DIR__) . '/layouts/app.php'; ?>

<section class="page-heading">
    <div>
        <p class="eyebrow">Module separe</p>
        <h1>Gestion Locative Longue Duree</h1>
    </div>
    <a class="button-link" href="<?= url('/long-rentals/contracts/create') ?>">Nouveau contrat</a>
</section>

<?php require __DIR__ . '/nav.php'; ?>
<?php if (!empty($notice)): ?><div class="alert alert-success"><?= e($notice) ?></div><?php endif; ?>

<section class="stat-grid compact-stats">
    <article class="stat-card"><span>Biens longue duree</span><strong><?= (int) $summary['properties'] ?></strong></article>
    <article class="stat-card"><span>Locataires actifs</span><strong><?= (int) $summary['activeTenants'] ?></strong></article>
    <article class="stat-card"><span>Contrats actifs</span><strong><?= (int) $summary['activeContracts'] ?></strong></article>
    <article class="stat-card"><span>Loyers encaisses</span><strong><?= number_format((float) $summary['paid'], 2, ',', ' ') ?></strong></article>
    <article class="stat-card"><span>Total restant</span><strong><?= number_format((float) $summary['remaining'], 2, ',', ' ') ?></strong></article>
    <article class="stat-card"><span>Mois impayes</span><strong><?= (int) $summary['unpaidMonths'] ?></strong></article>
    <article class="stat-card"><span>Mois partiels</span><strong><?= (int) $summary['partialMonths'] ?></strong></article>
</section>

<section class="module-grid long-rental-sections">
    <a class="module-card" href="<?= url('/long-rentals/properties') ?>">
        <strong>Biens Longue Duree</strong>
        <span>Biens lies aux contrats longue duree, statut occupe ou disponible.</span>
    </a>
    <a class="module-card" href="<?= url('/long-rentals/tenants') ?>">
        <strong>Locataires</strong>
        <span>Coordonnees completes et acces a l'historique locatif.</span>
    </a>
    <a class="module-card" href="<?= url('/long-rentals/contracts') ?>">
        <strong>Contrats</strong>
        <span>Dates, loyers, cautions, observations et statut du contrat.</span>
    </a>
    <a class="module-card" href="<?= url('/long-rentals/payments') ?>">
        <strong>Paiements des Loyers</strong>
        <span>Historique, montants payes, restants et retards de paiement.</span>
    </a>
    <a class="module-card" href="<?= url('/long-rentals/situations') ?>">
        <strong>Situation du Locataire</strong>
        <span>Synthese rapide pour identifier les locataires a jour ou en impaye.</span>
    </a>
</section>

<?php require dirname(__DIR__) . '/layouts/app_footer.php'; ?>
