<?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 == 'pricerule.cancel' || document.formvalidator.isValid(document.getElementById('pricerule-form'))) {
			Joomla.submitform(task, document.getElementById('pricerule-form'));
		}
		else {
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
</script>

<form action="<?php echo JRoute::_('index.php?option=com_djcatalog2&view=pricerule&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="pricerule-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('name'); ?>
			<?php echo $this->form->renderField('operation'); ?>
			<?php echo $this->form->renderField('type'); ?>
			<?php echo $this->form->renderField('calc_type'); ?>
			<?php echo $this->form->renderField('value'); ?>
			<?php echo $this->form->renderField('min_price'); ?>
			<?php echo $this->form->renderField('buy_x_count'); ?>
			<?php echo $this->form->renderField('change_old_price'); ?>
			<?php echo $this->form->renderField('product_id'); ?>
			<?php echo $this->form->renderField('labels'); ?>
			<?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('extra_fields'); ?>
			<?php echo $this->form->renderField('deliveries'); ?>
			<?php echo $this->form->renderField('payments'); ?>
			<?php echo $this->form->renderField('countries'); ?>
			<?php echo $this->form->renderField('postcodes'); ?>
			<?php echo $this->form->renderField('min_orders'); ?>
			<?php echo $this->form->renderField('max_orders'); ?>
			<?php echo $this->form->renderField('user_id'); ?>
			<?php echo $this->form->renderField('customer_groups'); ?>
		</fieldset>
		</div>
		
		<div class="col-md-6 form-horizontal well">
			<fieldset>
				<legend><?php echo JText::_('COM_DJCATALOG2_PUBLISHING_OPTIONS'); ?></legend>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('id'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('id'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('published'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('published'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('start_date'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('start_date'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('expire_date'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('expire_date'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('created'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('created'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('created_by'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('created_by'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('modified'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('modified'); ?></div>
			</div>
			<div class="control-group">
				<div class="control-label"><?php echo $this->form->getLabel('modified_by'); ?></div>
				<div class="controls"><?php echo $this->form->getInput('modified_by'); ?></div>
			</div>
			</fieldset>
		</div>
	<input type="hidden" name="task" value="" />
	<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
	</div>
	<div class="clr"></div>
	</div>
</form>
