<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) 2012 DJ-Extensions.com LTD, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

// no direct access
defined('_JEXEC') or die;

//Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');
Joomla\CMS\Factory::getDocument()->getWebAssetManager()->useScript('form.validate');
////Joomla\CMS\HTML\HTMLHelper::_('formbehavior.chosen', 'select');

?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'coupon.cancel' || document.formvalidator.isValid(document.getElementById('coupon-form'))) {
			Joomla.submitform(task, document.getElementById('coupon-form'));
		}
		else {
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
</script>

<form action="<?php echo JRoute::_('index.php?option=com_djcatalog2&view=coupon&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="coupon-form" class="form-validate" enctype="multipart/form-data">
	<div class="row row-fluid">
		<div class="col-md-6 form-horizontal well">
		<fieldset>
			<legend><?php echo empty($this->item->id) ? JText::_('COM_DJCATALOG2_NEW') : JText::_('COM_DJCATALOG2_EDIT'); ?></legend>
			<?php echo $this->form->renderField('code'); ?>
			<?php echo $this->form->renderField('description'); ?>
			<?php echo $this->form->renderField('type'); ?>
			<?php echo $this->form->renderField('value'); ?>
			<?php echo $this->form->renderField('reuse'); ?>
			<?php echo $this->form->renderField('reuse_limit'); ?>
			<?php echo $this->form->renderField('reuse_count'); ?>
			<?php echo $this->form->renderField('user_reuse'); ?>
			<?php echo $this->form->renderField('user_reuse_limit'); ?>
			<?php echo $this->form->renderField('product_id'); ?>
			<?php echo $this->form->renderField('category_id'); ?>
			<?php echo $this->form->renderField('producer_id'); ?>
			<?php echo $this->form->renderField('excluded_product_id'); ?>
			<?php echo $this->form->renderField('user_id'); ?>
		</fieldset>
		</div>
		
		<div class="col-md-6 form-horizontal well">
			<fieldset>
				<legend><?php echo JText::_('COM_DJCATALOG2_PUBLISHING_OPTIONS'); ?></legend>
				<?php echo $this->form->renderField('id'); ?>
				<?php echo $this->form->renderField('published'); ?>
				<?php echo $this->form->renderField('start_date'); ?>
				<?php echo $this->form->renderField('expire_date'); ?>
				<?php echo $this->form->renderField('created'); ?>
				<?php echo $this->form->renderField('created_by'); ?>
				<?php echo $this->form->renderField('modified'); ?>
				<?php echo $this->form->renderField('modified_by'); ?>
			</fieldset>
		</div>
	<input type="hidden" name="task" value="" />
	<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
	</div>
	<div class="clr"></div>
	</div>
</form>
