<?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-datetime-field-options-wrapper show-hide-common-class-all-options-wrapper-element" 
	data-wrapper-element-type="datetime" 
	data-element-index-val="<?php echo esc_attr( $element_index ); ?>">

	<!-- Required Field -->
	<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/>

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

	<!-- Placeholder -->
	<h4><?php esc_html_e( 'Placeholder Text:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-datetime-placeholder-text">	
		<li>				    
			<input class="datetime-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-datetime-placeholder-text-input" type="text" placeholder="Select date & time" />
			<br/><small><em>( <?php esc_html_e( 'When Default DateTime selection None, Placeholder Text will be shown to Users.', 'wordform-pro' ); ?> )</em></small>
		</li>        
	</ul>	
	<hr/>
	
	<!-- Display Format & Default Value -->
	<ul class="wordform-input-label wordform-options-datetime-settings-values-ul-wrapper">	
		<li>
			<h4 class="wordform-datetime-display-header-h4">
				<?php esc_html_e( 'Time Display Mode:', 'wordform-pro' ); ?>
			</h4>
			<select class="wordform-datetime-time-display-mode">
				<option value="24h" selected="selected">24h</option>
				<option value="12h">12h</option>
			</select>
			<br/><small><em>( <?php esc_html_e( 'Controls whether the time portion uses 24-hour or AM/PM display by default.', 'wordform-pro' ); ?> )</em></small>
			<hr>
		</li>

		<li>
			<h4 class="wordform-datetime-display-header-h4">
				<?php esc_html_e( 'Date Display Layout:', 'wordform-pro' ); ?>
			</h4>
            <select class="wordform-default-datetime-display-format">
                <option value="yy-mm-dd HH:mm" selected="selected">YYYY-MM-DD HH:mm (ISO 24h)</option>
                <option value="yy/mm/dd HH:mm">YYYY/MM/DD HH:mm (Asia)</option>
				<option value="yy/mm/dd hh:mm TT">YYYY/MM/DD hh:mm AM/PM (Asia)</option>
                <option value="dd/mm/yy HH:mm">DD/MM/YYYY HH:mm (Europe, Asia)</option>
                <option value="mm/dd/yy hh:mm TT">MM/DD/YYYY hh:mm AM/PM (US)</option>
                <option value="dd-mm-yy HH:mm">DD-MM-YYYY HH:mm (Europe short)</option>
                <option value="dd.mm.yy HH:mm">DD.MM.YYYY HH:mm (Germany short)</option>
                <option value="yy.mm.dd HH:mm">YYYY.MM.DD HH:mm (Japan/Korea)</option>
                <option value="M d, yy HH:mm">Mon D, YYYY HH:mm (Short US)</option>
                <option value="MM d, yy hh:mm TT">Month D, YYYY hh:mm AM/PM (US long)</option>
                <option value="d M yy HH:mm">D Mon YYYY HH:mm (UK short)</option>
                <option value="d MM yy HH:mm">D Month YYYY HH:mm (UK long)</option>
                <option value="yy M d HH:mm">YYYY Mon D HH:mm (Asia long)</option>
                <option value="yy MM d HH:mm">YYYY Month D HH:mm (Asia very long)</option>
            </select>
			<br/><small><em>( <?php esc_html_e( 'Controls the date layout only. The time style comes from Time Display Mode above.', 'wordform-pro' ); ?> )</em></small>
            <hr>
		</li>

        <li>
            <h4 class="wordform-datetime-default-value-header-h4">				    
                <?php esc_html_e( 'Default Datetime:', 'wordform-pro' ); ?>
            </h4>  

            <div class="wordform-datetime-input-wrapper">
                <input class="wordform-datetime-default-value" type="text" placeholder="Select date & time" />
                <span class="wordform-datetime-icon-wrapper">
                    <i class="fa fa-calendar"></i>
                    <i class="fa fa-clock"></i>
                </span>
            </div>

            <input class="wordform-datetime-hidden-raw-format-default-value" type="hidden" value="" />			
            <hr>
        </li>

		<li>				    
			<input class="datetime-default-value-show-radio" value="setDateTime" type="radio" />
			<?php esc_html_e( 'Show selected DateTime', 'wordform-pro' ); ?><br/>            
		</li>
		<li>
			<input class="datetime-default-value-show-radio" value="currentDateTime" type="radio" checked="checked" />				    			
			<?php esc_html_e( 'Show always current DateTime', 'wordform-pro' ); ?><br/>            
		</li>
		<li>				    
			<input class="datetime-default-value-show-radio" value="none" type="radio" />
			<?php esc_html_e( 'None', 'wordform-pro' ); ?><br/>            
		</li>
		<li>
			<small><em>( <?php esc_html_e( 'Based on selecttion DateTime will be shown to users.', 'wordform-pro' ); ?> )</em></small>
			<hr/>
		</li>

		<li>				    
			<input class="wordform-datetime-display-format-hint-show-checkbox" type="checkbox" checked />
			<?php esc_html_e( 'Show DateTime Format Hint.', 'wordform-pro' ); ?>
			<br/><small><em>( <?php esc_html_e( 'Next to label name DateTime display format.', '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( 'Datetime limits, moving date rules, and calendar theming are available in WordForm Pro.', 'wordform' ); ?>
	</div>
	<hr/>
	<?php } ?>

	<?php if ( ! $is_basic_tier ) { ?>
	<h4><?php esc_html_e( 'Datetime Limits:', 'wordform-pro' ); ?></h4>
	<ul class="wordform-input-label wordform-datetime-limits-options-group">
		<li>
			<label><?php esc_html_e( 'Minimum Datetime:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-datetime-min-datetime-value" type="text" value="" placeholder="YYYY-MM-DD HH:mm" />
		</li>
		<li>
			<label><?php esc_html_e( 'Maximum Datetime:', 'wordform-pro' ); ?></label><br/>
			<input class="wordform-datetime-max-datetime-value" type="text" value="" placeholder="YYYY-MM-DD HH:mm" />
		</li>
		<li>
			<input class="wordform-datetime-disable-past-checkbox" type="checkbox" />
			<?php esc_html_e( 'Disable Past Datetimes', 'wordform-pro' ); ?>
			<br/><small><em><?php esc_html_e( 'Applies relative to the current date and time. Use this when the earliest allowed datetime should move forward automatically.', 'wordform-pro' ); ?></em></small>
		</li>
		<li>
			<input class="wordform-datetime-disable-future-checkbox" type="checkbox" />
			<?php esc_html_e( 'Disable Future Datetimes', 'wordform-pro' ); ?>
			<br/><small><em><?php esc_html_e( 'Applies relative to the current date and time. Use this when only current or earlier datetimes should remain selectable automatically.', 'wordform-pro' ); ?></em></small>
		</li>
		<li><small><em><?php esc_html_e( 'Use Min/Max Datetime for fixed boundaries. Use Disable Past/Future for moving boundaries based on the current date and time. 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-datetime-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-datetime-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-datetime-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-datetime-field-options-wrapper -->
