<?php
include 'includes/header.php';
include 'includes/db.php';
?>
<div class="container">
<h1 class="mt-4">العروض</h1>
<h2 class="mt-4">عروض الشركات</h2>
<div class="row">
<?php
$stmt = $conn->prepare("SELECT * FROM offers WHERE type = 'corporate' ORDER BY id DESC");
$stmt->execute();
$result = $stmt->get_result();
$corporate_offers = $result->fetch_all(MYSQLI_ASSOC);
foreach ($corporate_offers as $offer): ?>
<div class="col-md-4 mb-4" id="offer-<?php echo $offer['id']; ?>">
<div class="card offer-card">
<img src="uploads/offers/<?php echo htmlspecialchars($offer['image']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($offer['title']); ?>">
<div class="card-body">
<h5 class="card-title"><?php echo htmlspecialchars($offer['title']); ?></h5>
<p class="card-text"><?php echo htmlspecialchars($offer['description']); ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<h2 class="mt-4">عروض الأفراد</h2>
<div class="row">
<?php
$stmt = $conn->prepare("SELECT * FROM offers WHERE type = 'individual' ORDER BY id DESC");
$stmt->execute();
$result = $stmt->get_result();
$individual_offers = $result->fetch_all(MYSQLI_ASSOC);
foreach ($individual_offers as $offer): ?>
<div class="col-md-4 mb-4" id="offer-<?php echo $offer['id']; ?>">
<div class="card offer-card">
<img src="uploads/offers/<?php echo htmlspecialchars($offer['image']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($offer['title']); ?>">
<div class="card-body">
<h5 class="card-title"><?php echo htmlspecialchars($offer['title']); ?></h5>
<p class="card-text"><?php echo htmlspecialchars($offer['description']); ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php include 'includes/footer.php'; ?>