<?php
/**
 * Game Events
 *
 * @link       https://anwp.pro
 * @since      0.7.1
 *
 * @package    Sports_Leagues
 * @subpackage Sports_Leagues/admin/views
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Must check that the user has the required capability
if ( ! current_user_can( 'manage_options' ) ) {
	wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'sports-leagues' ) );
}

$app_id = apply_filters( 'sports-leagues/event-config/vue_app_id', 'sl-admin-events' );
?>
<script type="text/javascript">
	window.slEventsData = <?php echo wp_json_encode( sports_leagues()->data->get_events_data() ); ?>;
</script>
<div class="wrap anwp-b-wrap">
	<div class="anwp-mb-4">
		<div class="anwp-d-flex anwp-items-center anwp-mb-2">
			<h1 class="anwp-my-0 anwp-mr-2"><?php esc_html_e( 'Event Configuration', 'sports-leagues' ); ?></h1>
			<a href="<?php echo esc_url( 'https://anwp.pro/docs/sports-leagues/4-core-features/game-events/' ); ?>"
			   target="_blank"
			   class="anwp-sl-help-header-link"
			   title="<?php esc_attr_e( 'Click to view documentation', 'sports-leagues' ); ?>">?</a>
		</div>
		<p class="anwp-mt-0 anwp-mb-0 anwp-text-base anwp-text-gray-600">
			<?php esc_html_e( 'Define game events (goals, cards, fouls, substitutions) and control how they appear in match displays.', 'sports-leagues' ); ?>
		</p>
	</div>

	<div class="anwp-mb-4 anwp-p-3 anwp-bg-blue-50 anwp-border anwp-border-blue-400 anwp-rounded anwp-w-max-800">
		<div class="anwp-d-flex anwp-items-start anwp-gap-2">
			<span class="dashicons dashicons-info-outline anwp-dashicons-18 anwp-text-blue-600 anwp-shrink-0" style="margin-top: 2px;"></span>
			<div class="anwp-text-sm anwp-text-gray-700">
				<strong><?php esc_html_e( 'Planning tip:', 'sports-leagues' ); ?></strong>
				<?php
				printf(
					/* translators: %1$s, %2$s, %3$s, %4$s: event type names (goal, card, foul, substitution) */
					esc_html__( 'Common events include %1$s (scoring), %2$s (penalties/warnings), %3$s (rule violations), and %4$s (player exchanges). Each event can display player name, icon, and time in different page locations.', 'sports-leagues' ),
					'<strong>' . esc_html__( 'goal', 'sports-leagues' ) . '</strong>',
					'<strong>' . esc_html__( 'card', 'sports-leagues' ) . '</strong>',
					'<strong>' . esc_html__( 'foul', 'sports-leagues' ) . '</strong>',
					'<strong>' . esc_html__( 'substitution', 'sports-leagues' ) . '</strong>'
				);
				?>
			</div>
		</div>
	</div>

	<div id="<?php echo esc_attr( $app_id ); ?>"></div>

	<?php do_action( 'sports-leagues/event-config/after_config' ); ?>
</div>
