<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/**
 * Provide an admin area view for the plugin.
 *
 * This file is used to markup the admin-facing aspects of the plugin.
 *
 * @link       https://webequipe.com
 * @since      1.0.0
 *
 * @package    Webequipe_Spin_Win_Wheel
 * @subpackage Webequipe_Spin_Win_Wheel/admin/partials
 */
?>

<div class="wrap wsww-winner-list-page">
	<h1 class="wp-heading-inline"><?php esc_html_e( 'Winner List', 'webequipe-spin-win-wheel' ); ?></h1>

	<?php
	// Display success messages passed via query string
	if ( isset( $_GET['inserted'] ) ) {
		$webequipe_sww_nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
		if ( wp_verify_nonce( $webequipe_sww_nonce, 'wsww-message-display' ) ) {
			?>
			<div class="notice notice-success">
				<p><?php esc_html_e( 'Spin has been added successfully!', 'webequipe-spin-win-wheel' ); ?></p>
			</div>
			<?php
		}
	}

	if ( isset( $_GET['spin-deleted'] ) ) {
		$webequipe_sww_nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
		if ( wp_verify_nonce( $webequipe_sww_nonce, 'wsww-message-display' ) ) {
			$webequipe_sww_spin_deleted = sanitize_text_field( wp_unslash( $_GET['spin-deleted'] ) );
			if ( 'true' === $webequipe_sww_spin_deleted ) {
				?>
				<div class="notice notice-success">
					<p><?php esc_html_e( 'Spin has been deleted successfully!', 'webequipe-spin-win-wheel' ); ?></p>
				</div>
				<?php
			}
		}
	}
	?>

	<form action="" method="post">
		<?php
		wp_nonce_field( 'wsww_winner_list_sort', 'wsww_winner_list_sort_nonce' );
		$webequipe_sww_table = new Webequipe_Spin_Win_Wheel_Winner_List();
		$webequipe_sww_table->process_bulk_action();
		$webequipe_sww_table->prepare_items();
		$webequipe_sww_table->display();
		?>
	</form>
</div>
