<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
<?php
$accepted_version = (int) ( $creator['rights']['accepted_version'] ?? 0 );
$current_version  = (int) ( $creator['rights']['current_version'] ?? 1 );
?>
<div class="ugcify-portal-grid ugcify-portal-grid--two">
	<article class="ugcify-portal-card">
		<div class="ugcify-portal-section__header">
			<div>
				<h3 class="ugcify-portal-section__title"><?php esc_html_e( 'Rights status', 'ugcify' ); ?></h3>
				<p class="ugcify-portal-section__description"><?php esc_html_e( 'Uploads stay blocked until the latest creator rights text is accepted.', 'ugcify' ); ?></p>
			</div>
		</div>

		<dl class="ugcify-portal-definition-list">
			<div>
				<dt><?php esc_html_e( 'Accepted version', 'ugcify' ); ?></dt>
				<dd><?php echo esc_html( (string) $accepted_version ); ?></dd>
			</div>
			<div>
				<dt><?php esc_html_e( 'Current version', 'ugcify' ); ?></dt>
				<dd><?php echo esc_html( (string) $current_version ); ?></dd>
			</div>
		</dl>

		<form method="post" class="ugcify-portal-inline-actions is-vertical">
			<?php wp_nonce_field( 'ugcify_influencer_portal_form', 'ugcify_influencer_nonce' ); ?>
			<input type="hidden" name="ugcify_influencer_action" value="update_profile">
			<input type="hidden" name="rights_agreed" value="1">
			<button type="submit" class="ugcify-portal-button is-primary"><?php esc_html_e( 'Accept Current Terms', 'ugcify' ); ?></button>
		</form>
	</article>

	<article class="ugcify-portal-card ugcify-portal-agreement">
		<div class="ugcify-portal-agreement__header">
			<strong><?php echo esc_html( sprintf( __( 'Rights agreement version %d', 'ugcify' ), $current_version ) ); ?></strong>
		</div>
		<div class="ugcify-portal-agreement__body"><?php echo wp_kses_post( $creator['rights']['current_text'] ?? '' ); ?></div>
	</article>
</div>