<?php
/**
 * Baby born results.
 *
 * @link       https://belovdigital.agency
 * @since      1.0.0
 *
 * @package    ultimate-pregnancy-ovulation-calculator
 * @subpackage ultimate-pregnancy-ovulation-calculator/public/partials
 *
 * @global array $atts (input data)
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
?>

<div class="ulpc-result__pregnancy">
	<div class="ulpc-result__pregnancy-wrapper">
		<div class="ulpc-result__pregnancy-summary ulpc-result__pregnancy-summary--baby-born">

			<div class="ulpc-result__pregnancy-image ulpc-result__pregnancy-image--baby-born">
				<img src="<?php echo esc_url( ULPC_PLUGIN_URL . 'public/images/baby-born.jpg' ); ?>" alt="<?php esc_attr_e( 'Future pregnancy planning', 'ultimate-pregnancy-ovulation-calculator' ); ?>">
			</div>

			<div class="ulpc-result__pregnancy-disclaimer">
				<?php esc_html_e( '* the results of this calculator are estimations only', 'ultimate-pregnancy-ovulation-calculator' ); ?>
			</div>



		</div>
		<div class="ulpc-result__pregnancy-content ulpc-result__pregnancy-content--baby-born">

			<div class="ulpc-result__baby-born">

				<div class="ulpc-result__baby-born-content">

					<p class="ulpc-result__baby-born-title">
						<?php esc_html_e( 'It looks like the baby is already born!', 'ultimate-pregnancy-ovulation-calculator' ); ?>
					</p>

					<div class="ulpc-result__baby-born-icon">
						<img src="<?php echo esc_url( ULPC_PLUGIN_URL . 'public/images/baby-born-icon.png' ); ?>" alt="">
					</div>

					<div class="ulpc-result__baby-born-age">
						<?php
						switch ( $result['babyAge']['format'] ) {
							case 'weeks':
								echo esc_html( $result['babyAge']['weeks'] ) . ' ' . esc_html__( 'weeks and', 'ultimate-pregnancy-ovulation-calculator' ) . ' ' . esc_html( $result['babyAge']['days'] ) . ' ' . esc_html__( 'days', 'ultimate-pregnancy-ovulation-calculator' );
								break;
							case 'months':
								echo esc_html( $result['babyAge']['months'] ) . ' ' . esc_html__( 'months and', 'ultimate-pregnancy-ovulation-calculator' ) . ' ' . esc_html( $result['babyAge']['days'] ) . ' ' . esc_html__( 'days', 'ultimate-pregnancy-ovulation-calculator' );
								break;
							case 'years':
								echo esc_html( $result['babyAge']['years'] ) . ' ' . esc_html__( 'years and', 'ultimate-pregnancy-ovulation-calculator' ) . ' ' . esc_html( $result['babyAge']['months'] ) . ' ' . esc_html__( 'months', 'ultimate-pregnancy-ovulation-calculator' );
								break;
						}
						?>
					</div>

				</div>

				<div class="ulpc-result__baby-born-footer">

					<div class="ulpc-result__baby-born-row">
						<p class="ulpc-result__baby-born-row-title <?php echo $is_custom_font ? 'ulpc-custom-font' : ''; ?>">
							<?php echo esc_html__( '🎉 Birth date', 'ultimate-pregnancy-ovulation-calculator' ); ?>
						</p>
						<p class="ulpc-result__baby-born-row-text">
							<?php echo esc_html( $ulpc->format_date( $result['dueDate'], $calculator_data['dateFormat'] ) ); ?>
						</p>
					</div>

					<?php
					if ( isset( $result['conceptionDate'] ) && $result['conceptionDate'] ) :
						$conception_date_title = 'conception_date' === $calculator_data['calculatorMethod'] ? __( '❤️‍🔥 Conception date:', 'ultimate-pregnancy-ovulation-calculator' ) : __( '❤️‍🔥 Estimated conception date:', 'ultimate-pregnancy-ovulation-calculator' );
						?>
						<div class="ulpc-result__baby-born-row">
							<p class="ulpc-result__baby-born-row-title <?php echo $is_custom_font ? 'ulpc-custom-font' : ''; ?>">
								<?php echo esc_html( $conception_date_title ); ?>
							</p>
							<p class="ulpc-result__baby-born-row-text">
								<?php echo esc_html( $ulpc->format_date( $result['conceptionDate'], $calculator_data['dateFormat'] ) ); ?>
							</p>
						</div>
					<?php endif; ?>

				</div>

			</div>


		</div>

	</div>
</div>
