36716-vm/signed-contracts.php
2025-12-07 05:00:42 +00:00

50 lines
1.6 KiB
PHP

<?php
require_once 'includes/header.php';
require_once 'db/config.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'client') {
header('Location: login.php');
exit;
}
$client_id = $_SESSION['user_id'];
$stmt = db()->prepare('SELECT cc.id, cc.signed_at, c.title FROM client_contracts cc JOIN contracts c ON cc.contract_id = c.id WHERE cc.client_id = ? ORDER BY cc.signed_at DESC');
$stmt->execute([$client_id]);
$signed_contracts = $stmt->fetchAll();
?>
<div class="container mt-5">
<h2>Your Signed Contracts</h2>
<p>Here is a list of all the contracts you have signed.</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Contract Title</th>
<th>Date Signed</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($signed_contracts as $contract): ?>
<tr>
<td><?php echo htmlspecialchars($contract['title']); ?></td>
<td><?php echo date('F j, Y', strtotime($contract['signed_at'])); ?></td>
<td>
<a href="view-signed-contract.php?id=<?php echo $contract['id']; ?>" class="btn btn-sm btn-primary">View</a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($signed_contracts)): ?>
<tr>
<td colspan="3" class="text-center">You have not signed any contracts yet.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php require_once 'includes/footer.php'; ?>