<?php
include "admin/db.php";
?>

<!DOCTYPE html>
<html lang="en">

<head>

  <meta charset="UTF-8">

  <meta name="viewport"
  content="width=device-width, initial-scale=1.0">

  <title>
    Maria Curtains | Offers Collection
  </title>

  
 <link rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"/>  

<link rel="canonical"
href="https://mariacurtains.co.ke/offers">

  <link rel="preconnect"
  href="https://fonts.googleapis.com">

  <link rel="preconnect"
  href="https://fonts.gstatic.com"
  crossorigin>

  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap"
  rel="stylesheet">

  

 

  

  <link rel="stylesheet"
  href="products.css">

</head>

<body>



<header class="navbar">

  <div class="logo">
    <a href="index.php">Maria Curtains</a>
  </div>

  
  <div class="hamburger" onclick="toggleMenu()">
    <i class="fa-solid fa-bars"></i>
  </div>

  <nav id="navMenu" class="nav">

    <ul class="nav-menu">

      <li><a href="index.php">Home</a></li>

      <li><a href="categories.php">Categories</a></li>

      <li><a href="offers.php">Offers</a></li>

      <li><a href="contact.php">Contact</a></li>

      <li class="quote-item">
        <a href="index.php#quote" class="quote-nav">Request Quote</a>
      </li>

    </ul>

  </nav>

</header>






<section class="offers-section">

  <div class="offers-grid">

<?php

$today = date("Y-m-d");

$query = "

SELECT
offers.*,
products.name,
products.category

FROM offers

LEFT JOIN products
ON offers.product_id = products.id

WHERE CURDATE() BETWEEN offers.start_date AND offers.end_date

ORDER BY offers.id DESC

";



$result = $conn->query($query);

if ($result->num_rows > 0):

    while($offer = $result->fetch_assoc()):

        $product_id = $offer['product_id'];

        
        $imageQuery = $conn->query("
            SELECT * FROM product_images
            WHERE product_id='$product_id'
            LIMIT 1
        ");

        $image = $imageQuery->fetch_assoc();
?>


<div class="offer-card">

    <div class="offer-image">

        <?php if($image): ?>
            <img src="uploads/<?= $image['image_path'] ?>"
                 alt="<?= $offer['offer_title'] ?>">
        <?php endif; ?>

        <span class="offer-badge">
            <?= $offer['badge'] ?>
        </span>

    </div>

    <div class="offer-content">

 <h4 class="offer-category">
        <?= htmlspecialchars($offer['name']) ?>
    </h4>
     
        <h3>
            <?= $offer['offer_title'] ?>
        </h3>
 
        <p>
            <?= $offer['offer_text'] ?>
        </p>

        <div class="offer-pricing">

            <?php if($offer['old_price'] > 0): ?>
                <span class="old-price">
                    Ksh <?= number_format($offer['old_price']) ?>
                </span>
            <?php endif; ?>

            <?php if($offer['new_price'] > 0): ?>
                <span class="new-price">
                    Ksh <?= number_format($offer['new_price']) ?>
                </span>
            <?php endif; ?>

        </div>

        <div class="offer-stock">
            Offer Ends:
            <?= date("d M", strtotime($offer['end_date'])) ?>
        </div>

        <a href="https://wa.me/254724361914?text=Hello%20Maria%20Curtains!%20I%20am%20interested%20in%20<?= urlencode($offer['offer_title']) ?>"
           target="_blank"
           class="offer-btn">

            <i class="fa-brands fa-whatsapp"></i>
            Enquire Offer

        </a>

    </div>
</div>

<?php
    endwhile;

else:
?>


<div class="no-offers">

    <h2>No offers at the moment</h2>

    <p>Please check back later for exciting discounts and deals.</p>

</div>

<?php endif; ?>


</div>
</section>



<footer class="site-footer">

  <div class="footer-container">

    

    <div class="footer-brand">

      <div class="footer-logo">

        <a href="index.php"
        class="logo-link">

          Maria Curtains

        </a>

      </div>

      <p>

        Premium curtains, sheers, rods, mats and interior solutions crafted to elevate your space.

      </p>

    </div>

    

    <div class="footer-section">

      <h3>
        Contact
      </h3>

      <a href="tel:+254724361914">

        <i class="fa-solid fa-phone"></i>

        <span>
          0724361914
        </span>

      </a>

      <a href="https://wa.me/254724361914"
      target="_blank">

        <i class="fa-brands fa-whatsapp"></i>

        <span>
          Chat on WhatsApp
        </span>

      </a>

    </div>

    

    <div class="footer-section">

      <h3>
        Location
      </h3>

      <a class="location-card"
      href="https://www.google.com/maps/place/Maria+Curtains+%26+Textile+Thika/@-1.0358071,37.0701991,17z/data=!3m1!4b1!4m15!1m8!3m7!1s0x182f4e5b27c66117:0xb6f8a7e126152c26!2sThika!3b1!8m2!3d-1.0387569!4d37.0833753!16zL20vMDh3eTIz!3m5!1s0x182f4f004d46d3f1:0xe1de14448b11459b!8m2!3d-1.0358125!4d37.0748125!16s%2Fg%2F11zb2bs4d8?entry=ttu&g_ep=EgoyMDI2MDUxMy4wIKXMDSoASAFQAw%3D%3D"
      target="_blank">

        <div class="location-title">

          <i class="fa-solid fa-location-dot"></i>

          Thika, Kenya

        </div>

        <div class="location-action">

          Get Directions →

        </div>

      </a>

    </div>

    

    <div class="footer-section">

      <h3>
        Follow Us
      </h3>

      <a href="https://www.facebook.com/share/18Uq2Kkryq/"
      target="_blank">

        <i class="fa-brands fa-facebook"></i>

        <span>
          Facebook
        </span>

      </a>

      <a href=https://www.instagram.com/maria_wa_curtains?igsh=MXgydDVwZ3VneXVxZg==
      target="_blank">

        <i class="fa-brands fa-instagram"></i>

        <span>
          Instagram
        </span>

      </a>

      <a href=https://www.tiktok.com/@mariacurtains?_r=1&_t=ZS-96VlNUcKXcS
      target="_blank">

        <i class="fa-brands fa-tiktok"></i>

        <span>
          TikTok
        </span>

      </a>

    </div>

  </div>

  <div class="footer-bottom">

    © 2026 Maria Curtains. All Rights Reserved.

  </div>

</footer>



<a
href="https://wa.me/254724361914?text=Hello%20Maria%20Curtains!%20I%20have%20a%20question%20about%20your%20products."
class="whatsapp-float"
target="_blank"
>

  <div class="whatsapp-text">
    Contact Us
  </div>

  <div class="whatsapp-icon">

    <i class="fa-brands fa-whatsapp"></i>

  </div>

</a>

<script>
function toggleMenu() {
  document.getElementById("navMenu").classList.toggle("open");
}
</script>
</body>
</html>