<?php

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

global $bookyourtravel_theme_admin;
?>
<div class="wrap bookyourtravel-licence-wrap bookyourtravel-wrap">
  <?php $bookyourtravel_theme_admin->render_admin_screen_tabs('license'); ?>
  <?php
    global $bookyourtravel_theme_globals;
    if (!$bookyourtravel_theme_globals->is_activation_completed()) {
  ?>
	<div class="licence-activation">
		<h3><?php esc_html_e("Please activate your BookYourTravel theme.", "bookyourtravel"); ?></h3>
    <form class="licence-form">
      <div class="input">
        <label for="licence_purchase_code"><?php esc_html_e("Enter your purchase code", "bookyourtravel"); ?></label>
        <input required type="text" id="licence_purchase_code" name="licence_purchase_code">
        <a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code" target="_blank"><?php esc_html_e("Where is my purchase code?", "bookyourtravel"); ?></a>
      </div>
      <div class="input">
        <button class="button button-primary button-activate" type="submit">
          <span><?php esc_html_e("Activate", "bookyourtravel"); ?></span>
        </button>
        <img src="<?php echo BookYourTravel_Theme_Utils::get_file_uri('/images/contact-ajax-loader.gif'); ?>" alt="loading" class="processing hidden">
      </div>
    </form>
    <div class="licence-success success hidden">
      <p><?php esc_html_e("Thank you for activating BookYourTravel. You can now enjoy all the features of the theme.", "bookyourtravel"); ?></p>
    </div>
    <div class="licence-error error hidden"><h3><?php esc_html_e("Invalid purchase code. Please try again.", "bookyourtravel"); ?></h3></div>
	</div>
  <?php } else { ?>
    <div class="licence-success">
      <p><?php esc_html_e("Thank you for activating BookYourTravel. You can now enjoy all the features of the theme.", "bookyourtravel"); ?></p>
      <div class="licence-deactivation">
        <form class="remove-licence-form">
          <div class="input">
            <button class="button button-primary button-deactivate" type="submit">
              <span><?php esc_html_e("Disconnect purchase code", "bookyourtravel"); ?></span>
            </button>
            <img src="<?php echo BookYourTravel_Theme_Utils::get_file_uri('/images/contact-ajax-loader.gif'); ?>" alt="loading" class="processing hidden">
          </div>
        </form>
        <div class="licence-error error hidden"><h3><?php esc_html_e("An error occurred. Please try again.", "bookyourtravel"); ?></h3></div>
      </div>
    </div>
  <?php } ?>
  <?php $bookyourtravel_theme_admin->render_admin_screen_footer('licence'); ?>
</div>
