<?php require dirname(__DIR__) . '/layouts/app.php'; ?>
<section class="page-heading"><div><p class="eyebrow">Location longue duree</p><h1>Locataires</h1></div><a class="button-link" href="<?= url('/long-rentals/tenants/create') ?>">Ajouter</a></section>
<?php require __DIR__ . '/nav.php'; ?>
<?php if (!empty($notice)): ?><div class="alert alert-success"><?= e($notice) ?></div><?php endif; ?>
<form class="filter-panel client-filter" method="get"><label>Recherche <input name="search" value="<?= e($search) ?>" placeholder="Nom, telephone, email, CIN"></label><button>Filtrer</button></form>
<section class="table-panel"><table><thead><tr><th>Nom</th><th>Telephone</th><th>Email</th><th>CIN/Passeport</th><th>Adresse</th><th>Actions</th></tr></thead><tbody><?php foreach ($tenants as $tenant): ?><tr><td><?= e($tenant['full_name']) ?></td><td><?= e($tenant['phone']) ?></td><td><?= e($tenant['email']) ?></td><td><?= e($tenant['identity_number']) ?></td><td><?= e($tenant['address']) ?></td><td class="actions"><a href="<?= url('/long-rentals/tenants/show?id=' . $tenant['id']) ?>">Situation</a><a href="<?= url('/long-rentals/tenants/edit?id=' . $tenant['id']) ?>">Modifier</a><form method="post" action="<?= url('/long-rentals/tenants/delete') ?>" onsubmit="return confirm('Supprimer ce locataire ?');"><input type="hidden" name="_token" value="<?= csrf_token() ?>"><input type="hidden" name="id" value="<?= (int) $tenant['id'] ?>"><button class="link-danger">Supprimer</button></form></td></tr><?php endforeach; ?><?php if (!$tenants): ?><tr><td colspan="6">Aucun locataire.</td></tr><?php endif; ?></tbody></table></section>
<?php require dirname(__DIR__) . '/partials/pagination.php'; ?>
<?php require dirname(__DIR__) . '/layouts/app_footer.php'; ?>
