<?php if ( ! defined( 'FW' ) ) {
	die( 'Forbidden' );
}

$mobile_classes ='';

$mobile_classes .=  $atts['hide_on_desktop'] == 'true' ? 'hidden-md hidden-lg ' : '';
$mobile_classes .=  $atts['hide_on_mobile'] == 'true' ? 'hidden-xs hidden-sm' : '';

$show_countdown = $atts['show_countdown'];

// WOW Animation
$wow_classes = '';
$wow_data = '';

if ( isset($atts['animation_on_scroll']) && $atts['animation_on_scroll']['animation_enable'] == 'yes') {
	$wow_classes = 'is-wow ' . $atts['animation_on_scroll']['yes']['animation_type'];

	if ( isset($atts['animation_on_scroll']['yes']['animation_delay']) ) {
		$wow_data =  'data-wow-delay="' . ($atts['animation_on_scroll']['yes']['animation_delay'] / 1000) . 's"';
	}
	
}
?>

<div id="shortcode-<?php echo esc_attr($atts['id']); ?>" class="UpcomingBookWrapper pos-r <?php echo esc_attr($mobile_classes); ?> <?php echo esc_attr($wow_classes); ?>" <?php echo wp_kses_post($wow_data); ?>>

	<?php if ( $atts['book_image'] ) : ?>
	<div class="upcoming-book-image">
		<img src="<?php echo esc_url($atts['book_image']['url']); ?>" alt="">
	</div>
	<?php endif; ?>
	<div class="upcoming-book-content text-center">
		<?php if ( $atts['above_title_text'] ) : ?>
		<div class="special-link mb-60"><?php echo wp_kses_post($atts['above_title_text']); ?></div>
		<?php endif; ?>
		<?php if ( $atts['book_title'] ) : ?>
		<div class="ElementHeading">
			<h2 class="element-title"><?php echo wp_kses_post($atts['book_title']); ?></h2>
		</div>
		<?php endif; ?>
		<?php if ( $atts['book_short_description'] ) : ?>
		<div class="upcoming-book-description mb-60">
			<?php echo do_shortcode($atts['book_short_description']); ?>
		</div>
		<?php endif; ?>
		<div class="upcoming-book-release-date">
			<?php if ( $show_countdown['show_countdown'] == 'true' ) : ?>
				<?php 
				$release_date = new DateTime($show_countdown['true']['release_datetime']);
				$parm_release_date = $release_date->format('Y/m/d h:i:s');
				?>
				<div class="is-countdown" data-release-date="<?php echo esc_attr($parm_release_date); ?>"></div>
				<?php if ( $show_countdown['true']['expired_text'] ) : ?>
					<span class="countdown-expired-text countdown-text font-subheading"><?php echo wp_kses_post($show_countdown['true']['expired_text']); ?></span>
				<?php endif; ?>
			<?php elseif ( $show_countdown['show_countdown'] == 'false' && $show_countdown['false']['release_text'] ) : ?>
				<span class="countdown-text font-heading"><?php echo wp_kses_post($show_countdown['false']['release_text']); ?></span>
			<?php endif; ?>
		</div>

	</div> <!-- end upcoming-book-content -->

</div><!-- end UpcomingBookWrapper -->