<?php
/**
 * @package     CMGiftCard
 * @subpackage  com_cmgiftcard
 * @copyright   Copyright (C) 2016-2024 CMExension
 * @license     GNU General Public License version 2 or later
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;

HTMLHelper::_('behavior.formvalidator');

if (version_compare(JVERSION, '4.0.0-alpha1', '<'))
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

Factory::getDocument()->addScriptDeclaration('
	Joomla.submitbutton = function(task) {
		if (task == "design.cancel" || document.formvalidator.isValid(document.getElementById("design-form"))) {
			Joomla.submitform(task, document.getElementById("design-form"));
		}
	};
');
?>

<form action="<?php echo Route::_('index.php?option=com_cmgiftcard&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="design-form" class="form-validatec form-horizontal">
	<?php
	echo $this->form->renderField('title');
	echo $this->form->renderField('card_type');
	echo $this->form->renderField('image');
	echo $this->form->renderField('published');
	echo $this->form->renderField('created');
	echo $this->form->renderField('created_by');
	echo $this->form->renderField('modified');
	echo $this->form->renderField('modified_by');
	?>

	<input type="hidden" name="task" value="" />
	<?php echo HTMLHelper::_('form.token'); ?>
</form>
