<?php
namespace SPAATG;
use SPAATG\ShortPixelLogger\ShortPixelLogger as Log;
use SPAATG\Helper\UiHelper as UiHelper;

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

?>
<hr class='wp-header-end'>

<div class="wrap is-spaatg-settings-page is-shortpixel-settings-page <?php echo esc_attr($this->view_mode); ?> ">

<header>
	  <h1>
	      <?php echo wp_kses(UIHelper::getIcon('res/images/illustration/logo_settings.svg'), array('img' => array('src' => array(), 'class' => array(), 'width' => array(), 'height' => array(), 'alt' => array()))); ?>
	  </h1>
  <div class='top-buttons'>
    <?php if ( !$view->key->hide_api_key ) { ?>
	      <a class='header-button' href="<?php echo esc_url($view->key->apiKey ? 'https://shortpixel.com/login/' . rawurlencode($view->key->apiKey) . '/dashboard' : 'https://shortpixel.com/login'); ?>" target="_blank" rel="noopener noreferrer">
	          <i class='shortpixel-icon user'></i><name><?php esc_html_e('ShortPixel Account','shortpixel-ai-alt-text-generator'); ?></name>
	      </a>
	    <?php } ?>
	    <!--<button><i class='shortpixel-icon notifications'></i><?php esc_html_e('Notifications','shortpixel-ai-alt-text-generator'); ?></button>-->
  </div>
</header>


<?php //$this->loadView('settings/part-header'); ?>

	  <input type='checkbox' name='heavy_features' value='1' <?php checked((bool) $this->disable_heavy_features); ?> class='shortpixel-hide' />

<article class='spaatg-settings shortpixel-settings'>
  <?php if ('page-quick-tour' === $this->view_mode && $view->key->is_verifiedkey) {
      $this->loadView('settings/part-quicktour');
  } ?>

  <label class='mobile-menu closed'>
	    <span class='open'><?php echo wp_kses(UIHelper::getIcon('res/images/icon/accordion.svg'), array('img' => array('src' => array(), 'class' => array(), 'width' => array(), 'height' => array(), 'alt' => array()))); ?></span>
	    <span class='close'><?php echo wp_kses(UIHelper::getIcon('res/images/icon/close.svg'), array('img' => array('src' => array(), 'class' => array(), 'width' => array(), 'height' => array(), 'alt' => array()))); ?></span>
    <input type='checkbox'></label>
 <menu>
			<ul>
				<li>
	          <?php echo wp_kses_post($this->settingLink([
	            'part' => 'account',
	            'title' => __("Account & Settings", "shortpixel-ai-alt-text-generator"),
	            'icon' => 'shortpixel-icon user'])); ?>
        </li>
        <li>
	            <?php echo wp_kses_post($this->settingLink([
	                'part' => 'ai',
	                'title' => __('AI Image SEO', 'shortpixel-ai-alt-text-generator'),
	                'icon' => 'shortpixel-icon ai'
	            ])); ?>
        </li>
        <li>
	          <?php echo wp_kses_post($this->settingLink([
	            'part' => 'preview',
	            'title' => __("Preview/Testing", "shortpixel-ai-alt-text-generator"),
	            'icon' => 'shortpixel-icon eye'])); ?>
        </li>
        <li>
	          <?php echo wp_kses_post($this->settingLink([
	            'part' => 'help',
	            'title' => __("Help Center", "shortpixel-ai-alt-text-generator"),
	            'icon' => 'shortpixel-icon help-circle'])); ?>
        </li>

        <?php
          if (Log::debugIsActive())
          { ?>
        <li class='is-advanced'>
	          <?php echo wp_kses_post($this->settingLink([
	              'part' => 'debug',
	              'title' => __("Debug", "shortpixel-ai-alt-text-generator"),
	              'icon' => 'shortpixel-icon debug'])); ?>
        </li>
        <?php } ?>

			</ul>
			<div class="adv_switcher is-hidden-visual">
				<?php esc_html_e('Advanced Mode','shortpixel-ai-alt-text-generator');?>
                		<label class="adv_switch" id="viewmode-toggles">
									<input type="checkbox" <?php checked('advanced', $this->view_mode); ?> >
					<span class="adv_slider"></span>
            		    	</label>
			</div>

<?php if (false == $view->is_unlimited && false === $view->hide_banner): ?>
          <div class='upgrade-banner'>
              <div class="robo-container">
                  <div class="robo-from-banner">
                      <img src="<?php echo esc_url(wpSPAATG()->plugin_url('res/img/robo-slider.png')); ?>" alt="" aria-hidden="true">
                  </div>
	                  <h2><?php esc_html_e('Upgrade to ShortPixel Unlimited', 'shortpixel-ai-alt-text-generator'); ?> </h2>
              </div>
              <div class="banner-line-container">
                  <span class="shortpixel-icon ok"></span>
	                  <p><?php esc_html_e('Unlimited credits ', 'shortpixel-ai-alt-text-generator'); ?></p>
              </div>
              <div class="banner-line-container">
                  <span class="shortpixel-icon ok"></span>
	                  <p><?php esc_html_e('Unlimited websites ', 'shortpixel-ai-alt-text-generator'); ?></p>
              </div>
              <div class="banner-line-container">
                  <span class="shortpixel-icon ok"></span>
	                  <p><?php esc_html_e('Unlimited AI image SEO generation ', 'shortpixel-ai-alt-text-generator'); ?></p>
              </div>
              <div class="banner-line-container">
                  <span class="shortpixel-icon ok"></span>
	                  <p><?php esc_html_e('Bulk SEO generation for your Media Library ', 'shortpixel-ai-alt-text-generator'); ?></p>
              </div>
              <div class="banner-line-container">
                  <span class="shortpixel-icon ok"></span>
	                  <p><?php esc_html_e('Alt text, captions, descriptions and titles ', 'shortpixel-ai-alt-text-generator'); ?></p>
              </div>
              <div class='banner-upgrade-button'>
                  <a class="button button-primary" id="upgrade" href="https://shortpixel.com/ms/af/KZYK08Q28044" target="_blank" rel="noopener noreferrer">
                      <i class="shortpixel-icon cart"></i>
	                      <?php esc_html_e('Upgrade Now', 'shortpixel-ai-alt-text-generator'); ?>
                  </a>
              </div>
          </div>
<?php endif; ?>



		</menu>
		<section class="wrapper">
      <form name='spaatg_options' action='<?php echo esc_url(add_query_arg('noheader', 'true')) ?>'  method='post' id='spaatg_options' class='spaatg-options spaatg-options-legacy'>

        <input type='hidden' name='display_part' value="<?php echo esc_attr($this->display_part) ?>" />
        <?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>

          <?php $this->loadView('settings/part-account'); ?>
          <?php $this->loadView('settings/part-ai'); ?>
          <?php $this->loadView('settings/part-preview'); ?>
          <?php $this->loadView('settings/part-help'); ?>

					<?php $this->loadView('settings/part-nokey'); ?>
      </form>
          <?php
            if (Log::debugIsActive())
            {
              $this->loadView('settings/part-debug');
            }
            ?>
		</section>
</article>


    <section class='ajax-save-done'>
        <div class="icon-container">
            <span class="shortpixel-icon ok" aria-hidden="true"></span>
        </div>
        <div class="text-container">
	            <h2><?php esc_html_e('Settings successfully saved! ', 'shortpixel-ai-alt-text-generator'); ?></h2>
	            <h3 class='after-save-notices'><span class='notice_count'>X</span> <?php esc_html_e('new notices', 'shortpixel-ai-alt-text-generator'); ?></h3>
        </div>
    </section>

<?php $this->loadView('snippets/part-inline-modal'); ?>
