<?php

/**
 * Cards option
 * 
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

$class = '';
if ( $swatch_html ) {
	$class = ' wpcb-option-item--image-' . $wpcb_field['field']['thumbnail_position'];
}
?>
<div class="wpcb-option-item<?php echo esc_attr( $class ); ?>">
	<?php
	if ( $swatch_html ) :
		?>
		<div class="wpcb-option-thumbnail">
			<?php
			echo wp_kses_post( $zoom_html );
			echo wp_kses_post( $swatch_html );
			?>
		</div>
		<?php
		if ( function_exists( 'wpcb_get_option_stock_html' ) ) :
			$stock_html = wpcb_get_option_stock_html( $wpcb_option );
			echo wp_kses_post( $stock_html );
		endif;
	elseif ( $show_input ):
		?>
		<div class="wpcb-option-input wpcb-option-input-<?php echo esc_attr( $input_type ); ?>"></div>
		<?php
	endif;
	?>
	<div class="wpcb-option-details">
		<div class="wpcb-option-header">
			<p class="wpcb-option-label"<?php echo wp_kses_data( $inline_style ); ?>>
				<?php echo esc_attr( $wpcb_option['label'] ); ?>
			</p>
			
			<?php if ( isset( $wpcb_option['description'] ) && '' !== $wpcb_option['description'] ) : ?>

				<button data-id="<?php echo esc_attr( $wpcb_option_id ); ?>" class="wpcb-view-option-details">
					<?php echo wp_kses( wpcb_get_icon( 'info' ), wpcb_get_icon_kses_args() ); ?>
				</button>

			<?php endif; ?>

		</div>

		<?php
		echo wp_kses_post( wpcb_get_option_note_html( $wpcb_option ) );

		if ( ! isset( $wpcb_field['field']['price_hidden'] ) || 'yes' !== $wpcb_field['field']['price_hidden'] ) {
			wpcb_display_option_price_wrapper_html( $wpcb_option, true );
		}
		?>
		
	</div>
	<div class="wpcb-option-content">
		<?php
		if ( ! $swatch_html ) {
			if ( function_exists( 'wpcb_get_option_stock_html' ) ) :
				$stock_html = wpcb_get_option_stock_html( $wpcb_option );
				echo wp_kses_post( $stock_html );
			endif;
		}
		?>
	</div>
</div>