<?php

/**
 * Stepper page template
 *
 * This file is used to markup the configurator stepper template.
 *
 * @link       https://wpconfiguratorbuilder.com
 * @since      1.0.0
 *
 * @package    wcb-configurator-builder
 * @subpackage wcb-configurator-builder/public/templates
 */

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

$class = wpcb_get_template_shortcode_class();
$wrapper_class = 'wpcb-configurator-wrapper';
if ( 'popup' === get_post_meta( $wpcb_configuration_id, '_template_display', true ) ) {
	$class .= ' wpcb-template-popup';
	$wrapper_class = 'wpcb-configurator-popup-wrapper';
}

$config_name = isset( $_GET['wpcb_result'] ) ? sanitize_text_field( $_GET['wpcb_result'] ) : '';
if ( '' !== $config_name && function_exists( 'wpcb_configurator_form_review_page' ) ) :

	wpcb_configurator_form_review_page();

else :

/**
 * Start template display
 * 
 * @hooked wpcb_configurator_woocommerce_notices - 10
 * @hooked wpcb_configurator_popup_button - 20
 */

do_action( 'wpcb_before_template' );
?>

<div id="wpcb-configuration-<?php echo esc_attr( $wpcb_configuration_id ); ?>" class="<?php echo esc_attr( $class ); ?>">

	<?php
	/**
 	 * Start template wrapper display
	 * 
	 * @hooked -
	 */
	do_action( 'wpcb_before_template_wrapper' );
	?>

	<div class="<?php echo esc_attr( $wrapper_class ); ?>" data-wpcb-id="<?php echo esc_attr( $wpcb_configuration_id ); ?>">

		<div class="wpcb-configurator-topbar">

			<?php

			do_action( 'wpcb_template_top_bar' );
			?>

			<?php include WPCB_BASE . 'public/blocks/product-summary.php'; ?>

			<?php include WPCB_BASE . 'public/blocks/step-list.php'; ?>

		</div>

		<?php
		/**
		 * Template visuals display
		 * 
		 * @hooked wpcb_template_gallery_wrapper - 10
		 * @hooked wpcb_template_gallery_actions - 20
		 * @hooked wpcb_template_gallery_main - 30
		 * @hooked wpcb_template_gallery_nav - 40
		 * @hooked wpcb_template_gallery_wrapper_close - 50
		 */

		do_action( 'wpcb_template_visuals' );
		?>

		<div class="wpcb-configurator-options">

			<?php
			/**
			 * Start template form display
			 * 
			 * @hooked -
			 */
			do_action( 'wpcb_before_template_form_options' );
			?>
			
			<?php
			/**
			 * Template form display
			 * 
			 * @hooked wpcb_template_form_options_list - 10
			 */

			do_action( 'wpcb_template_form_options' );
			?>

			<?php include WPCB_BASE . 'public/blocks/step-buttons.php'; ?>

			<?php
			/**
			 * End template form display
			 * 
			 * @hooked -
			 */
			do_action( 'wpcb_after_template_form_options' );
			?>
			
		</div>

		<div class="wpcb-configurator-bottombar">

			<?php

			do_action( 'wpcb_template_bottom_bar' );
			?>

			<?php include WPCB_BASE . 'public/blocks/form-totals.php'; ?>

			<?php include WPCB_BASE . 'public/blocks/form-actions.php'; ?>

		</div>

	</div>

	<?php
	/**
 	 * End template wrapper display
	 * 
	 * @hooked -
	 */
	do_action( 'wpcb_after_template_wrapper' );
	?>

</div>

<?php
/**
 * End template display
 * 
 * @hooked -
 */
do_action( 'wpcb_after_template' );

endif;
