<?php
/**
 * @package DJ-Events
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 * @developer Szymon Woronowski - szymon.woronowski@design-joomla.eu
 *
 */

defined('_JEXEC') or die('Restricted access');
JHtml::_('formbehavior.chosen', 'select');
if (version_compare(JVERSION, '4', '<')) { // Joomla 3) { // first must be the zoomer script
    JHtml::_('behavior.tooltip');
    JHtml::_('behavior.formvalidation');
    ?>
    <script type="text/javascript">
        Joomla.submitbutton = function (task) {
            if (task == 'category.cancel' || document.formvalidator.isValid(document.getElementById('edit-form'))) {
                Joomla.submitform(task, document.getElementById('edit-form'));
            } else {
                alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
            }
        }
    </script>
    <?php
}else {
    JHtml::_('behavior.formvalidator');
}

?>


<form action="<?php echo JRoute::_('index.php?option=com_djevents&view=category&layout=edit&id=' . (int)$this->item->id); ?>"
      method="post" name="adminForm" id="edit-form" class="form-validate" enctype="multipart/form-data">
    <div class="<?php echo $this->classes->row ?>">
        <div class="<?php echo $this->classes->col ?>12 form-horizontal">
            <fieldset>
                <legend><?php echo empty($this->item->id) ? JText::_('COM_DJEVENTS_NEW') : JText::_('COM_DJEVENTS_EDIT'); ?></legend>

                <?php echo $this->form->getField('name')->renderField(); ?>
                <?php echo $this->form->getField('alias')->renderField(); ?>
                <?php echo $this->form->getField('id')->renderField(); ?>
                <?php echo $this->form->getField('icon_type')->renderField(); ?>
                <?php echo $this->form->getField('fa_icon')->renderField(); ?>
                <?php echo $this->form->getField('image_icon')->renderField(); ?>
                <?php echo $this->form->getField('icon_color')->renderField(); ?>
                <?php echo $this->form->getField('icon_bg')->renderField(); ?>
                <?php echo $this->form->getField('created')->renderField(); ?>
                <?php echo $this->form->getField('created_by')->renderField(); ?>
                <?php echo $this->form->getField('description')->renderField(); ?>

                <?php
                $fieldSets = $this->form->getFieldsets('params');
                foreach ($fieldSets as $name => $fieldSet) {
                    ?>
                    <?php
                    if (isset($fieldSet->description) && trim($fieldSet->description)) :
                        echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
                    endif;
                    ?>
                    <?php foreach ($this->form->getFieldset($name) as $field) { ?>
                        <?php echo $field->renderField(); ?>
                    <?php } ?>
                <?php } ?>

            </fieldset>

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