<?php
/**
 * Waitlist form on single product page.
 *
 * @var array $data Data for render form.
 *
 * @package xts-theme
 */

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

$wrapper_classes = ! isset( $data ) ? ' xts-wtl-is-template xts-hide' : '';
$submit_attr     = '';

if ( ! empty( $data['product_id'] ) ) {
	$submit_attr = sprintf(
		'data-product-id=%s',
		esc_attr( $data['product_id'] )
	);
}
?>

<div class="xts-wtl-form<?php echo esc_attr( $wrapper_classes ); ?>" data-state="signed">
	<p>
		<?php esc_html_e( 'We added you to this product\'s waitlist and we\'ll send you an email when the product is available.', 'xts-theme' ); ?>
	</p>

	<?php do_action( 'xts_before_waitlist_submit' ); ?>

	<a href="#" class="button xts-wtl-unsubscribe" <?php echo wp_kses( $submit_attr, true ); ?>>
		<?php esc_html_e( 'Leave Waitlist', 'xts-theme' ); ?>
	</a>

	<?php do_action( 'xts_after_waitlist_submit' ); ?>

	<div class="xts-loader-overlay xts-fill"></div>
</div>
