<?php

	use Tech360\Utils as Utils;
	$contact_info = [ 'office_address', 'phone_number', 'toll_free_number', 'email' ];

?>

<div class="header-image position-relative" style="<?php Utils::_header_style( get_the_ID() ) ?>">
	<div class="container position-relative z-index-1">
		<div class="row">
			<div class="col-md-6">
				<h1 class="text-light"><?php the_title() ?></h1>
			</div>
		</div>
	</div>
<?php
if( get_field( 'header_overlay_opacity' ) ) {
	$overlay_style = [ 'background-color: #000' ];
	$overlay_style[] = sprintf( 'opacity: %s', ( intval( get_field( 'header_overlay_opacity' ) ) / 100 ) );
?>
	<span class="bg-overlay" style="<?php echo implode( '; ', $overlay_style ) ?>"></span>
<?php
}
?>
</div>

<?php
if( ! empty( get_the_content() ) ) {
	$contact_div_class = 'contact container pb-5';
?>
<div id="page-main-content" class="container py-5">
	<div class="row">
		<div class="col">
			<?php the_content() ?>
		</div>
	</div>
</div>
<?php
} else {
	$contact_div_class = 'contact container py-5';
}
?>

<div class="<?php echo $contact_div_class ?>">
	<div class="row">
		<div class="col-md-6">
			<?php
			if( Utils::wpcf7_exists( 'Contact' ) ) {
			?>
			<h2><?php esc_html_e( 'Get it touch', 'tech360' ) ?></h2>
			<p><?php esc_html_e( 'We\'d like to hear from you! Fill in the form below and we will respond as soon as possible.', 'tech360' ) ?></p>
			<div class="mt-3">
				<?php echo do_shortcode( '[contact-form-7 title="Contact"]' ) ?>
			</div>
			<?php
			}
			?>
		</div>
		<div class="col-md-6 mt-4 mt-md-0">
			<h4><?php echo get_bloginfo( 'name' ) ?></h4>
			<?php
			if( Utils::has_contact_info( $contact_info ) ) {
			?>
			<ul class="contact-info mt-4">
				<?php Utils::render_contact_info_list_tags( $contact_info ) ?>
			</ul>
			<?php
			}
			?>
			<?php
			if( ! empty( get_option( 'google_map' ) ) ) {
			?>
			<div class="mt-4 embed-responsive embed-responsive-4by3">
				<?php echo get_option( 'google_map' ) ?>
			</div>
			<?php
			}
			?>
		</div>
	</div>
</div>
