<?php

/*
Template Name: Booking Page
*/
if (!empty($_GET['overview'])) {
    $modify_url = get_permalink() . '/?' . str_replace('&overview=true', '', $_SERVER['QUERY_STRING']);
    $booking = new BonsaiBooking($_GET['_est_property_id'], $_GET['_est_guests'], $_GET['_est_start'], $_GET['_est_end']);
    $booking->checkBooking();
    if (empty($_GET['_est_name'])) {
        $booking->errors->addError('Please tell us your name', 'To complete your booking we need to know your name, please full the field out', 'Name', __LINE__);
    }
    if (empty($_GET['_est_email'])) {
        $booking->errors->addError('Please tell us your email', 'To complete your booking we need to know your email, please full the field out', 'Email', __LINE__);
    }
    if ($booking->errors->hasError()) {
        $_SESSION['booking'] = $booking;
        header('Location: ' . $modify_url);
    }
}
get_header();
?>
<div class='row mt44'>
	<div class='large-9 small-12 columns centered small-centered'>
		<h1 class='floating-title mb44'><?php 
the_title();
?>
</h1>

<?php 
if (!empty($_GET['_est_property_id']) and empty($_GET['est_success'])) {