<?php 
/** 
 * @package JMAP::AIGENERATOR::administrator::components::com_jmap
 * @subpackage views
 * @subpackage aigenerator
 * @subpackage tmpl
 * @author Joomla! Extensions Store
 * @copyright (C) 2021 - Joomla! Extensions Store
 * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html  
 */
defined ( '_JEXEC' ) or die ( 'Restricted access' );
?>
<div id="accordion_aigenerator_details" class="panel panel-info panel-group adminform">
	<div class="panel-heading" data-target="#aigenerator_details"><h4><?php echo JText::_('COM_JMAP_AIGENERATOR_CONTENT_DETAILS' ); ?></h4></div>
	<div class="panel-body panel-collapse" id="aigenerator_details">
		<form action="index.php" method="post" name="adminForm" id="adminForm"> 
			<table class="admintable">
				<tbody>
					<tr>
						<td class="key left_title">
							<span class="editlinktip">
								<label for="keywords_phrase" class="hasPopover" data-content="<?php echo JText::_('COM_JMAP_AIGENERATOR_KEYWORDS_PHRASE_DETAILS');?>">
									<?php echo JText::_('COM_JMAP_AIGENERATOR_KEYWORDS_PHRASE' ); ?>:
								</label>
							</span>
						</td>
						<td class="right_details">
							<input type="text" class="inputbox inputbox-large-fluid" name="keywords_phrase" id="keywords_phrase" data-validation="required" value="<?php echo $this->record->keywords_phrase;?>" />
						</td>
					</tr>
					
					<tr>
						<td class="paramlist_key left_title">
							<span class="editlinktip">
								<label for="api" class="hasPopover" data-content="<?php echo JText::_('COM_JMAP_AIGENERATOR_API_DETAILS');?>">
									<?php echo JText::_('COM_JMAP_AIGENERATOR_API');?>
								</label>
							</span>
						</td>
						<td class="paramlist_value">
							<fieldset id="jform_api" class="btn-group radio" data-bs-toggle="buttons">
								<?php 
									echo $this->lists ['ai_generator_contents_api']
								?>
							</fieldset>
						</td>
					</tr>
					
					<tr>
						<td class="paramlist_key left_title">
							<span class="editlinktip">
								<label for="maxresults" class="hasPopover" data-content="<?php echo JText::_('COM_JMAP_SELECT_MAX_AI_RESULTS_DETAILS');?>">
									<?php echo JText::_('COM_JMAP_SELECT_MAX_AI_RESULTS');?>
								</label>
							</span>
						</td>
						<td class="paramlist_value">
							<fieldset id="jform_max_results" class="btn-group radio" data-bs-toggle="buttons">
								<?php 
									echo $this->lists ['ai_generator_max_results']
								?>
							</fieldset>
						</td>
					</tr>
					
					<?php if(array_key_exists('languages', $this->lists)):?>
						<tr>
							<td class="paramlist_key left_title">
								<span class="editlinktip">
									<label for="languages" class="hasPopover" data-content="<?php echo JText::_('COM_JMAP_SELECT_LANGUAGE_AI_DETAILS');?>">
										<?php echo JText::_('COM_JMAP_SELECT_LANGUAGE_AI');?>
									</label>
								</span>
							</td>
							<td class="paramlist_value">
								<fieldset id="jform_languages" class="btn-group radio" data-bs-toggle="buttons">
									<?php 
										echo $this->lists ['languages']
									?>
								</fieldset>
							</td>
						</tr>
					<?php else:?>
						<tr>
							<td class="paramlist_key left_title">
								<span class="editlinktip">
									<label class="hasPopover" data-bs-content="<?php echo JText::_('COM_JMAP_SELECT_LANGUAGE_AI_DETAILS');?>">
										<?php echo JText::_('COM_JMAP_SELECT_LANGUAGE_AI');?>
									</label>
								</span>
							</td>
							<td class="paramlist_value">
								<?php echo '<img id="language_flag_image" src="' . JUri::root(false) . 'media/mod_languages/images/' . JString::strtolower(JString::str_ireplace('-', '_', $this->defaultLanguageCode)) . '.gif" alt="language_flag" />';?>
								<input type="hidden" name="language" value="<?php echo $this->defaultSefLanguageCode;?>"/>
							</td>
						</tr>
					<?php endif;?>
					
					<tr>
						<td class="paramlist_key left_title">
							<span class="editlinktip">
								<label id="removeimgs-lbl" for="jform_removeimgs" class="hasPopover" data-content="<?php echo JText::_('COM_JMAP_AI_REMOVE_IMAGES_DETAILS');?>">
									<?php echo JText::_('COM_JMAP_AI_REMOVE_IMAGES');?>
								</label>
							</span>
						</td>
						<td class="paramlist_value">
							<fieldset id="jform_removeimgs" class="btn-group radio" data-bs-toggle="buttons">
								<?php 
									$arr = array(
										JHtml::_('select.option',  1, JText::_('JENABLED' ) ),
										JHtml::_('select.option',  0, JText::_('JDISABLED' ) )
									);
									echo JHtml::_('select.radiolist', $arr, 'removeimgs', '', 'value', 'text', $this->record->removeimgs, 'removeimgs_');
								?>
							</fieldset>
						</td>
					</tr>
					
					<tr class="openai-params">
						<td class="paramlist_key left_title">
							<span class="editlinktip">
								<label id="removeimgs-lbl" for="jform_removeimgs" class="hasPopover" data-bs-content="<?php echo JText::_('COM_JMAP_AI_TEMPERATURE_DETAILS');?>">
									<?php echo JText::_('COM_JMAP_AI_TEMPERATURE');?>
								</label>
							</span>
						</td>
						
						<td class="paramlist_value">
							<fieldset id="jform_temperature" class="btn-group radio" data-bs-toggle="buttons" aria-describedby="jform_temperature_arialbl">
								<?php 
									echo $this->lists ['temperature'];
								?>
							</fieldset>
						</td>
					</tr>
				</tbody>
			</table>
			<input type="hidden" name="option" value="<?php echo $this->option?>" />
			<input type="hidden" name="id" value="<?php echo $this->record->id; ?>" />
			<input type="hidden" name="task" value="" />
		</form>
	</div>
</div>
	
<div id="accordion_aigenerator_contents_results" class="panel panel-info panel-group adminform">
	<div class="panel-heading" data-target="#contents_results"><h4><?php echo JText::_('COM_JMAP_AIGENERATOR_GENERATED_CONTENTS' ); ?></h4></div>
	<?php if(!$this->record->contents):?>
		<div class="panel-body panel-collapse" id="contents_results">	
			<div class="text-center">
		        <span class="icon-list"></span>
		        <h1 class="ai-maintitle"><?php echo JText::_('COM_JMAP_AIGENERATOR_NOCONTENTS')?></h1>
		        <div>
		            <p class="ai-subtitle">
		            	<?php echo JText::_('COM_JMAP_AIGENERATOR_NOCONTENTS_DETAILS')?>   
					</p>
		            <div>
 						 <a id="generatebutton" class="btn btn-primary btn-large"><?php echo JText::_('COM_JMAP_AIGENERATOR_GENERATE_CONTENTS')?></a>
					</div>
		        </div>
		    </div>
		</div>
	<?php else:?>
		<div class="panel-body" id="contents_results">	
			<?php foreach ($this->record->contents as $content):?>
				<div class="panel text-black bg-light">
					<div class="panel-heading hasPopover" data-content="<?php echo JText::_('COM_JMAP_AIGENERATOR_COPY_CONTENT');?>"><span class="icon-copy"></span><h4> <?php echo $content['title']; ?></h4></div>
					<div class="panel-body card-block">
						<?php echo $content['content'];?>
					</div>
					<div class="panel-footer">
						<button class="btn btn-primary btn-small create-article hasPopover" data-content="<?php echo JText::_('COM_JMAP_AIGENERATOR_CREATE_ARTICLE_DESC');?>"><span class="icon-new"></span> <?php echo JText::_('COM_JMAP_AIGENERATOR_CREATE_ARTICLE');?></button>
						<button class="btn btn-primary btn-small create-module hasPopover" data-content="<?php echo JText::_('COM_JMAP_AIGENERATOR_CREATE_MODULE_DESC');?>"><span class="icon-new"></span> <?php echo JText::_('COM_JMAP_AIGENERATOR_CREATE_MODULE');?></button>
					</div>
				</div>
			<?php endforeach;?>
		</div>
	<?php endif;?>
</div>