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

// Get today's date
$today = new DateTime();
// Clone for previous and next year
$prevYear = clone $today;
$nextYear = clone $today;
// Modify dates
$prevYear->modify('-1 year');
$nextYear->modify('+1 year');
// Format as YYYY-MM-DD
$today = $today->format('Y-m-d');
$previous_year = $prevYear->format('Y-m-d');
$next_year = $nextYear->format('Y-m-d');
$is_basic_tier = class_exists( 'SftcyWordformFeatures' ) && 'basic' === SftcyWordformFeatures::wordform_get_product_tier();
?>

<div id="<?php echo esc_attr( $element_wrapper_id ); ?>" class="wordform-date-field-options-wrapper show-hide-common-class-all-options-wrapper-element" data-wrapper-element-type = "date" data-element-index-val="<?php echo esc_attr( $element_index ); ?>" >	

	<h4><?php esc_html_e( 'Field Required:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-required-ul">
		<li>
			<input class="required-checkbox" type="checkbox" /><?php esc_html_e( 'Required', 'wordform-pro' ); ?>
			<small>( <?php esc_html_e( 'Check if Required', 'wordform-pro' ); ?> )</small>
		</li>
	</ul>
	<hr/>

	<h4><?php esc_html_e( 'Date Label:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-input-label">	
		<li>				    
			<input class="wordform-date-label-name" type="text" placeholder="Date Label" />
		</li>
	</ul>	
	<hr/>

	<h4><?php esc_html_e( 'Placeholder Text:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-date-placeholder-text">	
		<li>				    
			<input  class="date-placeholder-show-checkbox" type="checkbox" checked /><?php esc_html_e( 'Show', 'wordform-pro' ); ?>
            <small><em>( <?php esc_html_e( 'Checked to show placeholder Text', 'wordform-pro' ); ?> )</em></small>
		</li>
		<li>				    
			<input class="wordform-date-placeholder-text-input" type="text" placeholder="Pick a date from calendar" />
		</li>        
	</ul>	
	<hr/>
	
	<ul class="wordform-input-label wordform-options-date-settings-values-ul-wrapper">	
		<li>
			<h4 class="wordform-date-display-header-h4"><?php esc_html_e( 'Date Display Format:', 'wordform-pro' ); ?></h4>
			<select class="wordform-default-date-display-format">
				<option value="yy-mm-dd">YYYY-MM-DD (ISO 8601, International)</option>
				<option value="yy/mm/dd">YYYY/MM/DD (China, Korea, Hungary)</option>
				<option value="yy.dd.mm">YYYY.DD.MM (Eastern Europe)</option>
				<option value="dd/mm/yy">DD/MM/YYYY (Most of Europe, Asia, Africa)</option>
				<option value="dd-mm-yy">DD-MM-YYYY (Europe)</option>
				<option value="dd.mm.yy">DD.MM.YYYY (Germany, Eastern Europe)</option>
				<option value="mm/dd/yy">MM/DD/YYYY (USA, Philippines)</option>
				<option value="mm-dd-yy">MM-DD-YYYY (USA)</option>
				<option value="d/m/yy">D/M/YYYY (Europe short)</option>
				<option value="m/d/yy">M/D/YYYY (US short)</option>
				<option value="d M yy">D Mon YYYY (UK short)</option>
				<option value="d MM yy">D Month YYYY (UK long)</option>
				<option value="dd M yy">DD Mon YYYY</option>
				<option value="dd MM yy">DD Month YYYY</option>
				<option value="M d, yy">Mon D, YYYY (US short long)</option>
				<option value="MM d, yy">Month D, YYYY (US long)</option>
				<option value="d M, yy">D Mon, YYYY</option>
				<option value="d MM, yy">D Month, YYYY</option>
				<option value="DD, d M yy">Day, D Mon YYYY</option>
				<option value="DD, d MM yy">Day, D Month YYYY</option>
				<option value="D, M d, yy">ShortDay, Mon D, YYYY</option>
				<option value="D, MM d, yy">ShortDay, Month D, YYYY</option>
				<option value="DD d M yy">FullDay D Mon YYYY</option>
				<option value="DD d MM yy">FullDay D Month YYYY</option>
				<option value="yy M d">YYYY Mon D (Asia long)</option>
				<option value="yy MM d">YYYY Month D</option>
				<option value="yy M dd">YYYY Mon DD</option>
				<option value="yy MM dd">YYYY Month DD</option>
				<option value="d.m.yy">D.M.YYYY (Germany, Europe short)</option>
				<option value="d-m-yy">D-M-YYYY (Europe short)</option>
				<option value="m.d.yy">M.D.YYYY (US short)</option>
				<option value="m-d-yy">M-D-YYYY (US short)</option>
				<option value="DD, d M, yy">FullDay, D Mon, YYYY</option>
				<option value="DD, d MM, yy">FullDay, D Month, YYYY</option>
				<option value="D, M d yy">ShortDay, Mon D YYYY</option>
				<option value="D, MM d yy">ShortDay, Month D YYYY</option>
			</select>
		</li>
		<li>				    
            <label><?php esc_html_e( 'Default Date:', 'wordform-pro' ); ?></label><br/>    			
			<input class="wordform-date-default-value" type="text" value="" placeholder="Pick a date from calendar" />						
			<input class="wordform-date-hidden-raw-format-default-value" type="hidden" value="" />			
		</li>
		<li>				    
			<input  class="date-default-value-show-checkbox" type="checkbox" checked /><?php esc_html_e( 'Show', 'wordform-pro' ); ?>
            <small><em>( <?php esc_html_e( 'Display the selected date to users.', 'wordform-pro' ); ?> )</em></small>
		</li>
	</ul>		
	<hr/>

	<?php if ( $is_basic_tier ) { ?>
	<div class="wordform-upgrade-hint-box">
		<strong><?php esc_html_e( 'Free version note:', 'wordform' ); ?></strong>
		<?php esc_html_e( 'Date limits and calendar color theming are available in WordForm Pro.', 'wordform' ); ?>
	</div>
	<hr/>
	<?php } ?>

	<?php if ( ! $is_basic_tier ) { ?>
	<h4><?php esc_html_e( 'Date Limits:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-input-label wordform-date-limits-options-group">
		<li>
			<label><?php esc_html_e( 'Minimum Date:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-date-min-date-value" type="text" value="" placeholder="YYYY-MM-DD" />
		</li>
		<li>
			<label><?php esc_html_e( 'Maximum Date:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-date-max-date-value" type="text" value="" placeholder="YYYY-MM-DD" />
		</li>
		<li>
			<input class="wordform-date-disable-past-checkbox" type="checkbox" />
			<?php esc_html_e( 'Disable Past Dates', 'wordform-pro' ); ?>
			<br/><small><em><?php esc_html_e( 'Applies relative to today. Use this when the earliest allowed date should move forward automatically every day.', 'wordform-pro' ); ?></em></small>
		</li>
		<li>
			<input class="wordform-date-disable-future-checkbox" type="checkbox" />
			<?php esc_html_e( 'Disable Future Dates', 'wordform-pro' ); ?>
			<br/><small><em><?php esc_html_e( 'Applies relative to today. Use this when only today or earlier dates should remain selectable automatically.', 'wordform-pro' ); ?></em></small>
		</li>
		<li><small><em><?php esc_html_e( 'Use Min/Max Date for fixed boundaries. Use Disable Past/Future for moving boundaries based on today. Both can be combined, and the stricter limit will apply.', 'wordform-pro' ); ?></em></small></li>
	</ul>
	<hr/>

	<h4><?php esc_html_e( 'Calendar Theme:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-input-label wordform-calendar-theme-options-group">
		<li>
			<label><?php esc_html_e( 'Accent Color:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-date-calendar-accent-color" type="color" value="#2563eb" />
			<small><em>( <?php esc_html_e( 'Used for the selected day and calendar header.', 'wordform-pro' ); ?> )</em></small>
		</li>
		<li>
			<label><?php esc_html_e( 'Background Color:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-date-calendar-surface-color" type="color" value="#ffffff" />
			<small><em>( <?php esc_html_e( 'Calendar popup background color.', 'wordform-pro' ); ?> )</em></small>
		</li>
		<li>
			<label><?php esc_html_e( 'Text Color:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-date-calendar-text-color" type="color" value="#0f172a" />
			<small><em>( <?php esc_html_e( 'Used for calendar day and label text.', 'wordform-pro' ); ?> )</em></small>
		</li>
	</ul>
	<?php } ?>
</div><!-- /.wordform-date-field-options-wrapper -->
