<?php if (!defined('ABSPATH'))
	exit; ?>

<?php

$license_key = get_option('polylai_credits_license');
$nonce = wp_create_nonce('polylai_credits_license_nonce');

?>
<script>
	window.license_nonce = "<?php echo $nonce ?>";
</script>
<div class="polylai-modal-bg" x-show="showEnterLicense" id="polylai-credits-license">
	<div class="polylai-modal-dialog">
		<div class="polylai-modal-header">
			<h4><?php _e('PolylAI Credits license', 'ai-translator-for-polylang'); ?></h4>
			<span class="dashicons dashicons-no polylaitr-close" x-on:click="showEnterLicense = false"></span>
		</div>
		<div class="polylai-modal-body">
			<p><?php _e('Enter your license key to redeem your credits:', 'ai-translator-for-polylang'); ?></p>
			<p class="mt-4">
				<input x-model="licenseText" type="text" name="polylai_credits_license" value="<?php echo esc_attr($license_key) ?>"
					class="regular-text" placeholder="<?php _e('License key', 'ai-translator-for-polylang'); ?>">
			</p>
			<p id="polylai-credits-license-error" class="mt-4 text-red-500"></p>
		</div>
		<div class="polylai-modal-footer">
			<input x-on:click="saveLicense" class="button button-primary" type="button"
				value="<?php esc_attr_e('Save'); ?>" />
		</div>
	</div>
</div>