<?php 
$title = "Professional Event Photography";
$desc = "ProPix is a professional digital photography company specializing in dance, sporting, corporate, and real estate photography. We travel all over the United States to photograph a variety of events.";
$page_css = "/css/events.css";

include($_SERVER["DOCUMENT_ROOT"] ."/header.php");
require($_SERVER["DOCUMENT_ROOT"] ."/../propixconfig/db_config.php");

//Get a list of the recent events
$query_events = mysqli_query($con,"SELECT * FROM events WHERE (status = 'online' OR video_status = 'online') ORDER BY date DESC LIMIT 10");

mysqli_close($con);

?>
<div class="events-page">
	<div class="container">
		<section class="events-hero">
			<p class="events-kicker">ProPix Events</p>
			<h1>Find your photos fast</h1>
			<p>Browse recent events, book us for your recital, or explore custom products and keepsakes.</p>
			<div class="events-hero__actions">
				<a class="btn btn-light" href="https://<?php echo $_SERVER["HTTP_HOST"];?>/company-list.php">Find your event</a>
				<a class="btn btn-outline-light" href="https://<?php echo $_SERVER["HTTP_HOST"];?>/products.php">Custom products</a>
			</div>
		</section>

		<div class="row g-4">
			<div class="col-12 col-lg-7">
				<div class="card events-card h-100">
					<a href="https://<?php echo $_SERVER["HTTP_HOST"];?>/company-list.php">
						<img src="/media/images/home/events1.jpg" alt="find your event" class="card-img-top" />
					</a>
					<div class="card-body">
						<h2 class="h4 mb-2">
							<a class="events-card-link" href="https://<?php echo $_SERVER["HTTP_HOST"];?>/company-list.php">Find your event</a>
						</h2>
						<p class="text-muted mb-3">Search by company and access photos or videos from recent events.</p>
						<a class="btn btn-primary btn-sm" href="https://<?php echo $_SERVER["HTTP_HOST"];?>/company-list.php">Browse events</a>
					</div>
				</div>
			</div>
			<div class="col-12 col-lg-5">
				<div class="row g-4">
					<div class="col-12">
						<div class="card events-card h-100">
							<a href="https://1drv.ms/xs/s!AgWLWsPkQYCM-nPjQtlyeEMWR-ca">
								<img src="https://propixevents.com/media/images/home/recitals2.jpg" alt="book us for a recital" class="card-img-top" />
							</a>
							<div class="card-body">
								<h2 class="h5 mb-2">
									<a class="events-card-link" href="https://1drv.ms/xs/s!AgWLWsPkQYCM-nPjQtlyeEMWR-ca">Book us for your recital</a>
								</h2>
								<p class="text-muted mb-0">Share your details and we will follow up quickly.</p>
							</div>
						</div>
					</div>
					<div class="col-12">
						<div class="card events-card h-100">
							<a href="https://<?php echo $_SERVER["HTTP_HOST"];?>/products.php">
								<img src="/media/images/home/products2.jpg" alt="custom products" class="card-img-top" />
							</a>
							<div class="card-body">
								<h2 class="h5 mb-2">
									<a class="events-card-link" href="https://<?php echo $_SERVER["HTTP_HOST"];?>/products.php">Custom products</a>
								</h2>
								<p class="text-muted mb-0">Posters, prints, and keepsakes designed for your memories.</p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="card events-card mt-4">
			<div class="card-header">Recent Events</div>
			<div class="table-responsive">
				<table class="table table-striped mb-0">
					<thead class="table-light">
						<tr>
							<th>Date</th>
							<th>Company</th>
							<th>Event</th>
							<th>Links</th>
						</tr>
					</thead>
					<tbody>
<?php 
      
        while($row_events = mysqli_fetch_array($query_events)){
		echo "<tr>";
		echo "<td>". htmlspecialchars($row_events['date']) . "</td>";
		echo "<td>". htmlspecialchars($row_events['company']) . "</td>";
		echo "<td>". htmlspecialchars($row_events['event']) . "</td>";
		echo "<td>";
			if ($row_events['status'] == 'online'){
				echo ' <a href="'. htmlspecialchars($row_events['link']) .'" class="btn btn-sm btn-primary">PHOTOS</a>';
			}
			if ($row_events['video_status'] == 'online'){
				echo ' <a href="'. htmlspecialchars($row_events['video_link']) .'" class="btn btn-sm btn-success">VIDEOS</a>';
			}
		echo "</td>";
		echo "</tr>";
    }
?>
					</tbody>
				</table>
			</div>
		</div>

		<div class="card events-card events-follow mt-4">
			<div class="card-body">
				<div class="d-flex gap-2">
					<a href="https://facebook.com/propixphotovideo"><img src="/media/images/home/facebook.png" alt="Follow us on Facebook" class="events-social-icon" /></a>
					<a href="https://twitter.com/ProPixPhotoVid"><img src="/media/images/home/twitter.png" alt="Follow us on Twitter" class="events-social-icon" /></a>
				</div>
				<div>
					<h2 class="h5 mb-1">Follow us</h2>
					<p class="mb-0">Get the latest news on events and special offers.</p>
				</div>
			</div>
		</div>
	</div>
</div>
<?php 
include($_SERVER["DOCUMENT_ROOT"] ."/footer.php");
?>
