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

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

<div class="ulpc-result__ovulation">
	<div class="ulpc-result__ovulation-wrapper">
		<div class="ulpc-result__ovulation-content">
			<div class="ulpc-result__ovulation-calendar"></div>
			<div class="ulpc-result__ovulation-info">
				<div class="ulpc-result__ovulation-info-wrapper">
					<div class="ulpc-result__ovulation-info-item">
						<span class="ulpc-result__ovulation-legend ulpc-result__ovulation-legend--fertile"></span>
						<?php esc_html_e( 'Fertile Window:', 'ultimate-pregnancy-ovulation-calculator' ); ?> <?php echo esc_html( $result['currentCycle']['fertileWindowStart'] ); ?> - <?php echo esc_html( $result['currentCycle']['fertileWindowEnd'] ); ?>
					</div>
					<div class="ulpc-result__ovulation-info-item">
						<span class="ulpc-result__ovulation-legend ulpc-result__ovulation-legend--ovulation"></span>
						<?php esc_html_e( 'Most Probable Ovulation Date:', 'ultimate-pregnancy-ovulation-calculator' ); ?> <?php echo esc_html( $result['currentCycle']['ovulationDate'] ); ?>
					</div>
					<div class="ulpc-result__ovulation-info-item">
						<span class="ulpc-result__ovulation-legend ulpc-result__ovulation-legend--pregnancy-test"></span>
						<?php esc_html_e( 'Pregnancy Test Date:', 'ultimate-pregnancy-ovulation-calculator' ); ?> <?php echo esc_html( $result['currentCycle']['pregnancyTestDate'] ); ?>
					</div>
					<div class="ulpc-result__ovulation-info-item">
						<span class="ulpc-result__ovulation-legend ulpc-result__ovulation-legend--period"></span>
						<?php esc_html_e( 'Period, Next Start:', 'ultimate-pregnancy-ovulation-calculator' ); ?> <?php echo esc_html( $result['currentCycle']['nextPeriodStart'] ); ?>
					</div>
				</div>
			</div>


		</div>

		<div class="ulpc-result__ovulation-visual">

			<div class="ulpc-result__ovulation-visual-data"></div>

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

		</div>

	</div>

	<div class="ulpc-result__ovulation-cycles">
		<table class="ulpc-table">
			<thead>
				<tr>
					<th><?php esc_html_e( 'Period', 'ultimate-pregnancy-ovulation-calculator' ); ?></th>
					<th><?php esc_html_e( 'Period Start', 'ultimate-pregnancy-ovulation-calculator' ); ?></th>
					<th><?php esc_html_e( 'Fertile Window', 'ultimate-pregnancy-ovulation-calculator' ); ?></th>
					<th><?php esc_html_e( 'Estimated Due Date', 'ultimate-pregnancy-ovulation-calculator' ); ?></th>
				</tr>
			</thead>
			<tbody>
				<?php
				$i = 1;
				foreach ( $result['cycles'] as $cycle ) :
					?>
					<tr>
						<td><?php echo esc_html( $i ); ?></td>
						<td><?php echo esc_html( $cycle['periodStart'] ); ?></td>
						<td><?php echo esc_html( $cycle['fertileWindowStart'] ); ?> - <?php echo esc_html( $cycle['fertileWindowEnd'] ); ?></td>
						<td><?php echo esc_html( $cycle['estimatedDueDate'] ); ?></td>
					</tr>
					<?php
					$i++;
				endforeach;
				?>
			</tbody>
		</table>
	</div>
</div>
