<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template files receive local context variables from their controller.
namespace SPAATG;

use SPAATG\Controller\Optimizer\OptimizeAiController;
if ( ! defined( 'ABSPATH' ) ) {
 exit; // Exit if accessed directly.
}

$approx = $this->view->approx;
?>


<section class='panel selection' data-panel="selection" data-status="loaded" >
  <div class="panel-container">
	 <?php $this->loadView('bulk/part-progressbar', false,  ['part' => 'selection']); ?>

      <div class='load wrapper' >
         <div class='loading'>
             <span><img src="<?php echo esc_url(\wpSPAATG()->plugin_url('res/img/bulk/loading-hourglass.svg')); ?>" /></span>
             <span>
             <p><?php esc_html_e('Please wait, ShortPixel is checking the images for AI SEO generation...','shortpixel-ai-alt-text-generator'); ?><br>
               <span class="number" data-stats-total="total">x</span> <?php esc_html_e('items found', 'shortpixel-ai-alt-text-generator'); ?></p>
           </span>
         </div>


				 <div class='loading skip'>
					<nav>
						 <span><p><button class='button' data-action="SkipPreparing"><?php esc_html_e('Start now', 'shortpixel-ai-alt-text-generator'); ?></button></p>

					 </span>
					 <span>
							 <p><?php esc_html_e("Clicking this button will start AI SEO generation for the items already added to the queue. The remaining items can be processed in a new bulk.",'shortpixel-ai-alt-text-generator'); ?></p>
						</span>
					</nav>
				</div>

        <div class='loading overlimit'>
	              <p><?php esc_html_e('ShortPixel has detected that there are no more resources available during preparation. The plugin will try to complete the process, but may be slower. Increase memory, disable heavy plugins or reduce the number of prepared items per load.', 'shortpixel-ai-alt-text-generator'); ?></p>

        </div>
      </div>

       <div class="interface wrapper">

	   <h3 class="heading">
        <?php esc_html_e('ShortPixel Bulk AI SEO Generation - Select Images', 'shortpixel-ai-alt-text-generator'); ?>
      </h3>

      <p class='description'><?php esc_html_e('Select the images for which ShortPixel should generate AI SEO data: alt text, captions, descriptions and titles.','shortpixel-ai-alt-text-generator'); ?></p>
				 <div class="option-block">

		         <div class="media-library optiongroup hidden">
		            <input type="checkbox" class="switch" id="media_checkbox" checked>
		            <span class="hidden" data-check-approx-total><?php echo esc_html($approx->total->images) ?></span>
		         </div>

				<?php
				$optimizeAiController = OptimizeAiController::getInstance(); 
				if (true === $optimizeAiController->isAiEnabled()):  ?>
			 <div class='ai-images optiongroup'>
				<div class='switch_button'>
				<label>
		               <input type="checkbox" class="switch" id="aipreserve_checkbox" name="aipreserve_checkbox" />
		               <div class="the_switch">&nbsp; </div>
	             </label>
				 <h4><label for="aipreserve_checkbox">
					<?php printf(esc_html__('Prevent overriding any of the existing data with the one generated by AI', 'shortpixel-ai-alt-text-generator'), '<a href="options-general.php?page=spaatg-settings&part=account">', '</a>' ); ?>
				 </label></h4>

				</div>	

			 </div>

			<?php endif ?>

				</div> <!-- // option top block -->

	 	 	 <div class="option-block all-round hidden" data-check-visibility="false" data-control="data-check-approx-total">
       <div class='optiongroup'>
          <h3><?php esc_html_e('No images found', 'shortpixel-ai-alt-text-generator'); ?></h3>
          <p><?php esc_html_e('ShortPixel Bulk couldn\'t find any images that need AI SEO generation.','shortpixel-ai-alt-text-generator'); ?></p>
       </div>

			 </div>

      <nav>
        <button class="button" type="button" data-action="FinishBulk">
					<span class='dashicons dashicons-arrow-left'></span>
					<p><?php esc_html_e('Back', 'shortpixel-ai-alt-text-generator'); ?></p>
				</button>

        <button class="button-primary button" type="button" data-action="CreateBulk" data-panel="summary" data-check-disable data-control="data-check-total-total">
					<span class='dashicons dashicons-arrow-right'></span>
					<p><?php esc_html_e('Calculate', 'shortpixel-ai-alt-text-generator'); ?></p>
				</button>
      </nav>

    </div> <!-- interface wrapper -->
  </div><!-- container -->
</section>
