<?php

/**
 * Conditional Logic Settings Wrapper.
 *
 * Shows disabled fields with PRO badge for free users, actual settings for premium users.
 *
 * @since   4.4.0
 * @package Extra Product Options for WooCommerce
 *
 * Available Variables (from element-form.php):
 * @var array  $epofw_field_data        The field/element data array.
 * @var string $epofw_field_type        The field type (text, select, etc.).
 * @var string $epofw_field_name_prefix The form field name prefix.
 * @var string $epofw_field_id          The field ID/key.
 * @var array  $epofw_fields_list       List of available fields for conditional logic.
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
// Get premium field data for disabled state.
$epofw_prem_data = epofw_get_premium_field_data();
?>

<div class="epofw-tab-content" data-tab="conditional-logic">
	<div class="epofw-onboarding-hint">
		<div class="epofw-onboarding-hint-content">
			<span class="epofw-onboarding-icon"><i class="dashicons dashicons-info-outline"></i></span>
			<span class="epofw-onboarding-text"><?php 
esc_html_e( 'Create dynamic forms by showing or hiding this field based on other field values. Build complex logic rules with multiple conditions.', 'extra-product-options-for-woocommerce' );
?></span>
		</div>
		<?php 
epofw_render_tutorial_buttons( 'conditional_logic', 'small', true );
?>
	</div>
	<?php 
// Free users: Show disabled fields with PRO badge.
?>
		<div class="epofw-form-group<?php 
echo esc_attr( $epofw_prem_data['class'] );
?>">
			<div class="epofw-field-label">
				<label for="enable_conditional_logic"><?php 
esc_html_e( 'Enable Conditional Logic', 'extra-product-options-for-woocommerce' );
echo wp_kses( $epofw_prem_data['badge'], epofw_get_badge_allowed_html() );
?></label>
				<div class="epofw-field-description">
					<?php 
esc_html_e( 'Enable this option to show or hide this field based on conditions from other fields.', 'extra-product-options-for-woocommerce' );
?>
				</div>
			</div>
			<div class="epofw-field-input">
				<input type="checkbox" id="enable_conditional_logic" value="on" class="epofw-has-sub" data-nextfe="epofw_cl_preview"<?php 
echo esc_attr( $epofw_prem_data['disabled'] );
?>>
				<label for="enable_conditional_logic" class="toggle-switch"></label>
			</div>
		</div>

		<div class="epofw-conditional-logic-container<?php 
echo esc_attr( $epofw_prem_data['class'] );
?>" id="epofw_cl_preview">
			<div class="epofw-field-description epofw-field-description-full-width">
				<?php 
esc_html_e( 'Configure conditions to control when this field is displayed. Add multiple conditions to create complex logic rules.', 'extra-product-options-for-woocommerce' );
?>
				<br><em><?php 
esc_html_e( 'Note: Text-based fields (text, textarea, password) require exact value matching.', 'extra-product-options-for-woocommerce' );
?></em>
			</div>
			<div class="epofw_logical_field_main_group">
				<?php 
esc_html_e( 'Show this field if', 'extra-product-options-for-woocommerce' );
?>
				<div class="epofw_logical_field_group epofw_logical_field_data">
					<div class="epofw_logical_field_option epofw_logical_field opt-dcls">
						<select disabled class="epofw_conditional_logic_options epofw-form-control">
							<option><?php 
esc_html_e( 'Select Field', 'extra-product-options-for-woocommerce' );
?></option>
						</select>
					</div>
					<div class="epofw_logical_field_operator epofw_logical_field opt-dcls">
						<select disabled class="epofw-form-control">
							<option><?php 
esc_html_e( 'is', 'extra-product-options-for-woocommerce' );
?></option>
						</select>
					</div>
					<div class="epofw_logical_field_list epofw_logical_field opt-dcls">
						<select disabled class="epofw-form-control">
							<option><?php 
esc_html_e( 'Select Value', 'extra-product-options-for-woocommerce' );
?></option>
						</select>
					</div>
					<div class="opt-action opt-dcls">
						<a href="#" class="remove-opt-btn" style="pointer-events: none; opacity: 0.5;">
							<span class="dashicons dashicons-trash"></span>
						</a>
					</div>
				</div>
			</div>
			<button type="button" class="epofw-btn epofw-btn-secondary" disabled>
				<i class="dashicons dashicons-plus"></i>
				<?php 
esc_html_e( 'Add Condition', 'extra-product-options-for-woocommerce' );
?>
			</button>
		</div>
		<?php 
?>
</div>
