File: /home/spacei/public_html/wp-content/themes/mwt-spacei/archive-spaces.php
<?php
// echo '<pre>';
// print_r($_GET);
// exit;
get_header();
global $wpdb;
$tbl_mwt_locations = $wpdb->prefix . "mwt_locations";
$tbl_mwt_space_locations = $wpdb->prefix . "mwt_space_locations";
$tbl_mwt_industries = $wpdb->prefix . "mwt_industries";
$tbl_mwt_space_industries = $wpdb->prefix . "mwt_space_industries";
$tbl_mwt_people = $wpdb->prefix . "mwt_people";
$tbl_mwt_space_people = $wpdb->prefix . "mwt_space_people";
$sel_srch_location = array();
$sel_srch_industry = array();
$sel_srch_people = array();
if(isset($_GET['srch_location'])){
$sel_srch_location = $_GET['srch_location'];
}
if(isset($_GET['srch_industry'])){
$sel_srch_industry = $_GET['srch_industry'];
}
if(isset($_GET['srch_people'])){
$sel_srch_people = $_GET['srch_people'];
}
// Get location details for filter box
$qry = " SELECT DISTINCT c.id, c.name
FROM $tbl_mwt_space_locations cc
INNER JOIN $tbl_mwt_locations c
ON cc.location_id = c.id
AND c.status = 1
ORDER BY c.name ASC
";
$results = $wpdb->get_results($qry);
$location_list = array();
$cnt = 0;
foreach ($results as $location) {
$location_list[$cnt]['id'] = $location->id;
$location_list[$cnt]['name'] = $location->name;
$cnt++;
}
// Get industry details for filter box
$qry = " SELECT DISTINCT u.id, u.name
FROM $tbl_mwt_space_industries cu
INNER JOIN $tbl_mwt_industries u
ON cu.industry_id = u.id
AND u.status = 1
ORDER BY u.name ASC
";
$results = $wpdb->get_results($qry);
$industry_list = array();
$cnt = 0;
foreach ($results as $industry) {
$industry_list[$cnt]['id'] = $industry->id;
$industry_list[$cnt]['name'] = $industry->name;
$cnt++;
}
// Get people details for filter box
$qry = " SELECT DISTINCT u.id, u.name
FROM $tbl_mwt_space_people cu
INNER JOIN $tbl_mwt_people u
ON cu.people_id = u.id
AND u.status = 1
ORDER BY u.name ASC
";
$results = $wpdb->get_results($qry);
$people_list = array();
$cnt = 0;
foreach ($results as $people) {
$people_list[$cnt]['id'] = $people->id;
$people_list[$cnt]['name'] = $people->name;
$cnt++;
}
?>
<section class="search-section filter-area text-left">
<div class="container">
<div class="row">
<div class="col-xl-3 col-lg-4 col-sm-6">
<div class="filter-box" data-aos="fade-left" data-aos-easing="linear" data-aos-duration="800"> <!-- Filer box -->
<form name="filter-box" id="filter-box">
<div class="accordion accordion-flush" id="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="true" aria-controls="flush-collapseOne">Location</button>
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse show" aria-labelledby="flush-headingOne" data-bs-parent="#accordion">
<div class="accordion-body">
<?php foreach($location_list as $row){ ?>
<input type="checkbox" name="srch_location[]" id="srch_location_<?php echo $row['id'] ?>" value="<?php echo $row['id'] ?>" <?php if( in_array($row['id'],$sel_srch_location)){ echo ' checked'; } ?>>
<label for="srch_location_<?php echo $row['id'] ?>"><?php echo $row['name']; ?></label><br>
<?php } ?>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingTwo">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="true" aria-controls="flush-collapseTwo">
Industry
</button>
</h2>
<div id="flush-collapseTwo" class="accordion-collapse collapse show" aria-labelledby="flush-headingTwo" data-bs-parent="#accordion">
<div class="accordion-body">
<?php foreach($industry_list as $row){ ?>
<input type="checkbox" name="srch_industry[]" id="srch_industry_<?php echo $row['id'] ?>" value="<?php echo $row['id'] ?>" <?php if( in_array($row['id'],$sel_srch_industry)){ echo ' checked'; } ?>>
<label for="srch_industry_<?php echo $row['id'] ?>"><?php echo $row['name'] ?></label><br>
<?php } ?>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingThree">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="true" aria-controls="flush-collapseThree">
People
</button>
</h2>
<div id="flush-collapseThree" class="accordion-collapse collapse show" aria-labelledby="flush-headingThree" data-bs-parent="#accordion">
<div class="accordion-body">
<?php foreach($people_list as $row){ ?>
<input type="checkbox" name="srch_people[]" id="srch_people_<?php echo $row['id'] ?>" value="<?php echo $row['id'] ?>" <?php if( in_array($row['id'],$sel_srch_people)){ echo ' checked'; } ?>>
<label for="srch_people_<?php echo $row['id'] ?>"><?php echo $row['name'] ?></label><br>
<?php } ?>
</div>
</div>
</div>
</div>
<?php if(isset($_GET['start_date'])){ ?>
<input type="hidden" name="start_date" id="start_date" value="<?php echo $_GET['start_date']; ?>" />
<?php } ?>
<?php if(isset($_GET['end_date'])){ ?>
<input type="hidden" name="end_date" id="end_date" value="<?php echo $_GET['end_date']; ?>" />
<?php } ?>
</form>
</div>
</div>
<div class="col-xl-9 col-lg-8 col-sm-6 search-result-section" data-aos="fade-right" data-aos-easing="linear" data-aos-duration="1000">
<div id="loader">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="lading"></div>
</div>
<div class="row" id="content_middle_box">
<!-- Search result goes here -->
</div>
</div>
</div>
</div>
</section>
<section class="contact-section text-center">
<div class="container">
<div class="row">
<div class="col-md-12" data-aos="fade-down" data-aos-easing="linear" data-aos-duration="800">
<h2 class="text-black pb-4">Want to know <br>more contact us.</h2>
<a href="/contact-us" class="adv-search-btn">Contact us</a>
</div>
</div>
<div class="row mt-50">
<div class="col-md-4">
<div class="contact-box" data-aos="fade-right" data-aos-easing="linear" data-aos-duration="800">
<img src="/wp-content/themes/mwt-spacei/assets/images/call-ico.png">
<h3>Call Us</h3>
<p>PH : <a href="#">+00 123 456</a><br><a href="#">CS : +00 321 654</a></p>
</div>
</div>
<div class="col-md-4">
<div class="contact-box" data-aos="fade-right" data-aos-easing="linear" data-aos-duration="1200">
<img src="/wp-content/themes/mwt-spacei/assets/images/mail-ico.png">
<h3>Email Us</h3>
<p><a href="#">marketing@icore.com</a><br><a href="#">contact@icore.com</a></p>
</div>
</div>
<div class="col-md-4">
<div class="contact-box" data-aos="fade-right" data-aos-easing="linear" data-aos-duration="1400">
<img src="/wp-content/themes/mwt-spacei/assets/images/location-ico.png">
<h3>Office</h3>
<p>PO Box 2314 Gotham Street West<br>Metropolis 8007 USA</p>
</div>
</div>
</div>
</div>
</section>
<script type="text/javascript">
$(function () {
$("#loader").hide();
$("#filter-box").submit(function (e) {
$.ajaxSetup({
global: false,
type: "GET",
url: "<?php echo get_template_directory_uri(); ?>/ajax-spaces.php",
beforeSend: function () {
$("#content_middle_box").html("");
$("#loader").show();
},
complete: function () {
$("#loader").hide();
}
});
$.ajax({
data: $("#filter-box").serialize(),
success: function (r) {
$("#content_middle_box").html(r);
}
});
e.preventDefault();
});
$("#filter-box input").click(function () {
$("#start_date").attr('disabled','disabled');
$("#end_date").attr('disabled','disabled');
$("#filter-box").submit();
});
$("#filter-box").submit();
});
</script>
<style>
.space-not-found{
text-align: center;
color: #e94e38;
margin-top: 100px;
font-weight: bold;
}
#loader {
bottom: 0;
height: 175px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
width: 175px;
}
#loader {
bottom: 0;
height: 175px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
width: 175px;
margin-top: 100px;
}
#loader .dot {
bottom: 0;
height: 100%;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
width: 87.5px;
}
#loader .dot::before {
border-radius: 100%;
content: "";
height: 87.5px;
left: 0;
position: absolute;
right: 0;
top: 0;
transform: scale(0);
width: 87.5px;
}
#loader .dot:nth-child(7n+1) {
transform: rotate(45deg);
}
#loader .dot:nth-child(7n+1)::before {
animation: 0.8s linear 0.1s normal none infinite running load;
background: #00ff80 none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+2) {
transform: rotate(90deg);
}
#loader .dot:nth-child(7n+2)::before {
animation: 0.8s linear 0.2s normal none infinite running load;
background: #00ffea none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+3) {
transform: rotate(135deg);
}
#loader .dot:nth-child(7n+3)::before {
animation: 0.8s linear 0.3s normal none infinite running load;
background: #00aaff none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+4) {
transform: rotate(180deg);
}
#loader .dot:nth-child(7n+4)::before {
animation: 0.8s linear 0.4s normal none infinite running load;
background: #0040ff none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+5) {
transform: rotate(225deg);
}
#loader .dot:nth-child(7n+5)::before {
animation: 0.8s linear 0.5s normal none infinite running load;
background: #2a00ff none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+6) {
transform: rotate(270deg);
}
#loader .dot:nth-child(7n+6)::before {
animation: 0.8s linear 0.6s normal none infinite running load;
background: #9500ff none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+7) {
transform: rotate(315deg);
}
#loader .dot:nth-child(7n+7)::before {
animation: 0.8s linear 0.7s normal none infinite running load;
background: magenta none repeat scroll 0 0;
}
#loader .dot:nth-child(7n+8) {
transform: rotate(360deg);
}
#loader .dot:nth-child(7n+8)::before {
animation: 0.8s linear 0.8s normal none infinite running load;
background: #ff0095 none repeat scroll 0 0;
}
#loader .lading {
/* background-image: url("<?php echo get_template_directory_uri(); ?>/assets/images/loading.gif"); */
background-position: 50% 50%;
background-repeat: no-repeat;
bottom: -40px;
height: 20px;
left: 0;
position: absolute;
right: 0;
width: 180px;
}
@keyframes load {
100% {
opacity: 0;
transform: scale(1);
}
}
@keyframes load {
100% {
opacity: 0;
transform: scale(1);
}
}
</style>
<?php get_footer();?>