<?php
/*
 * Software Name: Eorisis Pixels
 * Software URI: https://eorisis.com/shop/software/joomla/pixels
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
defined('_JEXEC') or die;

use com_eorisis_pixels\framework\lib\core\cms\form as cms_form;

// Updates

$tab = new \com_eorisis_pixels\framework\lib\core\cms\tab;

cms_form::add_validator();
\com_eorisis_pixels\framework\lib\core\cms\session::add_keep_alive();

$is_j4 = version_compare(JVERSION, 4, '>=');
if ($is_j4)
{
	\com_eorisis_pixels\framework\lib\core\model\jquery::load();
}
else
{
	cms_form::add_tabstate();
	\com_eorisis_pixels\framework\lib\core\model\toolbar::add_button_js($this->view_name);
}

$fieldsets = $this->form->getFieldsets();
$action_uri = \com_eorisis_pixels\framework\lib\core\cms\uri::component_route($this->view_name, 'edit', (int)$this->item->id);

if ($this->notifications)
{
	print '<div class="eorisis">'.$this->notifications.'</div>';
}
?>
<form name="adminForm" id="<?php print $this->view_name; ?>-form" action="<?php print $action_uri; ?>" class="form-validate eorisis-form-container" method="post">
	<div<?php print $is_j4 ? '' : ' class="form-horizontal"'; ?>>
		<?php
		// Tabs Start
		print $tab->start($fieldsets);

		// Tabs loop
		foreach ($fieldsets as $fieldset)
		{
			// Tab Item
			print $tab->add($fieldset->name, $fieldset->label); ?>
			<div class="row<?php print $is_j4 ? '' : '-fluid'; ?>">
				<div class="<?php print $is_j4 ? 'col-md' : 'span9'; ?>">
					<div class="card">
						<div class="card-body">
							<fieldset class="adminform">
								<?php
								$fields = $this->form->getFieldset($fieldset->name);
								foreach ($fields as $field)
								{
									print $field->renderField();
								} ?>
							</fieldset>
						</div>
					</div>
				</div>
			</div>
			<?php print $tab->end();
		}

		// Tabs End
		print $tab->set_end(); ?>
	</div>
	<?php
	print cms_form::token();
	print \com_eorisis_pixels\framework\lib\core\view\form::hidden('task');
	print cms_form::return_cmd();
	print cms_form::forced_language(); ?>
</form>
