<?php
/**
 * jeGroupBuy package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2010 - 2011 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
$doc 		= & JFactory::getDocument();
$editor		= & JFactory::getEditor();

$path		= JURI::root();

$js  		= JURI::base().'components/com_jegroupbuy/assets/js/validate.js';
$doc->addScript($js);


$js =$path.'administrator/components/com_jegroupbuy/assets/js/discount.js';
$doc->addScript($js);

?>
<script type="text/javascript" src="<?php echo $path; ?>components/com_jegroupbuy/assets/js/test.js"></script>
<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

<div class="col width-60">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'JE_GROUPBUY_DETAILS' ); ?></legend>

		<table class="admintable" width="100%">
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_TITLE' ); ?> * :
				</label>
			</td>
			<td >
				<input class="required" type="text" name="title" id="title" size="60" maxlength="255" value="<?php echo $this->row->title; ?>" />
				<span id="title-error"></span>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_ALIAS' ); ?>:
				</label>
			</td>
			<td >
				<input class="inputbox" type="text" name="alias" id="alias" size="60" maxlength="255" value="<?php echo $this->row->alias; ?>" />
			</td>
		</tr>

		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_CATEGORY' ); ?> * :
				</label>
			</td>
			<td >
				<?php echo JHTML::_('select.genericlist', $this->category, 'catid', 'class="required"', 'value', 'text', $this->row->catid) ?>
				<span id="catid-error"></span>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_STORE_NAME' ); ?> * :
				</label>
			</td>
			<td >
				<?php echo JHTML::_('select.genericlist', $this->shopname, 'store_id', 'class="required"', 'value', 'text', $this->row->store_id) ?>
				<span id="store_id-error"></span>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_STATE' ); ?>:
				</label>
			</td>
			<td >
				<?php
					$published = ($this->row->id) ? $this->row->published : 1;
					echo JHTML::_('select.booleanlist',  'published', '', $published );
				?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_FEATURED' ); ?>:
				</label>
			</td>
			<td >
				<?php
					$featured = ($this->row->id) ? $this->row->featured : 0;
					echo JHTML::_('select.booleanlist',  'featured', '', $featured );
				?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_PRODUCT_IMAGE' ); ?>:
				</label>
			</td>
			<td >
				<?php echo $this->lists["imageurl"]; ?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_PRODUCT_ID' ); ?>:
				</label>
			</td>
			<td >
				<?php echo $this->row->id; ?>
			</td>
		</tr>
		<tr>
			<td class="key" valign="top">
				<label for="name">
					<?php echo JText::_( 'JE_GROUPBUY_PRODUCT_DESC' ); ?>:
				</label>
			</td>
			<td >
				<?php
						//Editor parameters : areaname, content, width, height, cols, rows
						echo $editor->display( 'description',  $this->row->description , '95%', '300', '75', '30' ) ;
				?>
			</td>
		</tr>
		</table>
	</fieldset>
</div>

<div class="col width-40">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'JE_GROUPBUY_EXTRA_FIELDS' ); ?></legend>
			<?php
				JHTML::_('behavior.tooltip');
				jimport('joomla.html.pane');
				// TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
				$pane1 = &JPane::getInstance('sliders', array('allowAllClose' => true));
				echo $pane1->startPane("menu-pane11");
				echo $pane1->startPanel(JText :: _('JEGROUPBUY_PRODUCTS'), "param-page");
			?>
			<table class="admintable" width="100%">
			<tr>
				<td class="key" >
					<label for="name" id="product_price-errormsg">
						<?php echo JText::_( 'JE_GROUPBUY_PRODUCT_PRICE' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="product_price" id="product_price" size="15" maxlength="70" value="<?php echo $this->row->product_price; ?>" " />
					<span id="product_price-error"></span>
				</td>
			</tr>
			<tr>
				<td class="key" >
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_CURRENCY_SYMBOL' ); ?>  :
					</label>
				</td>
				<td >
					<?php echo JHTML::_( 'select.genericlist', $this->currencylist, 'currencysymbol', '' ,'value' ,'text', $this->row->currencysymbol ); ?>
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_DISCOUNT_PER' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="product_discount" id="product_discount" size="15" maxlength="70" value="<?php echo $this->row->product_discount; ?>" onblur ="javascript: return discount();"/>
					<span id="product_discount-error"></span>
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_YOU_SAVE' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="you_save" id="you_save" size="15" maxlength="70" value="<?php echo $this->row->you_save;?>"  readonly="readonly"/>
					<span id="you_save-error"></span>
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_COUPON_CODE' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="coupon_code" id="coupon_code" size="15" maxlength="70" value="<?php echo $this->row->coupon_code; ?>" />
					<span id="coupon_code-error"></span>
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_DEAL_PRICE' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="deal_price" id="deal_price" size="15" maxlength="70" value="<?php echo $this->row->deal_price; ?>" readonly="readonly"/>
					<span id="deal_price-error"></span>
				</td>
			</tr>

			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_DEAL_AVAILABLE_DAT' ); ?> * :
					</label>
				</td>
				<td >
					<?php echo JHTML::_('calendar', $this->row->deal_to_date, 'deal_to_date', 'deal_to_date', '%d-%m-%Y', array('class' => "required")); ?>
					<span id="deal_to_date-error"></span>
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_TOTAL_BOUGHTS' ); ?> * :
					</label>
				</td>
				<td >
					<input class="required" type="text" name="total_bought" id="total_bought" size="15" maxlength="70" value="<?php echo $this->row->total_bought; ?>" />
					<span id="total_bought-error"></span>
				</td>
			</tr>

			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_MAP_WIDTH' ); ?>:
					</label>
				</td>
				<td >
					<input class="inputbox" type="text" name="gmap_width" id="gmap_width" size="15" maxlength="70" value="<?php echo $this->row->gmap_width; ?>" />
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_MAP_HEIGHT' ); ?>:
					</label>
				</td>
				<td >
					<input class="inputbox" type="text" name="gmap_height" id="gmap_height" size="15" maxlength="70" value="<?php echo $this->row->gmap_height; ?>" />
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_MAP_LATITUDE' ); ?>:
					</label>
				</td>
				<td >
					<input class="inputbox" type="text" name="gmap_latitude" id="gmap_latitude" size="15" maxlength="70" value="<?php echo $this->row->gmap_latitude; ?>" />
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_MAP_LONGITUDE' ); ?>:
					</label>
				</td>
				<td >
					<input class="inputbox" type="text" name="gmap_longitude" id="gmap_longitude" size="15" maxlength="70" value="<?php echo $this->row->gmap_longitude; ?>" />
				</td>
			</tr>
			<tr>
				<td class="key">
					<label for="name">
						<?php echo JText::_( 'JE_GROUPBUY_MAP_ZOOM' ); ?>:
					</label>
				</td>
				<td >
					<input class="inputbox" type="text" name="gmap_zoom" id="gmap_zoom" size="15" maxlength="70" value="<?php echo $this->row->gmap_zoom; ?>" />
				</td>
			</tr>
			</table>
			<?php
				echo $pane1->endPanel();
			?>
	</fieldset>
</div>
<div class="clr"></div>

<input type="hidden" name="option" id="option" value="com_jegroupbuy" />
<input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />
<input type="hidden" name="task" id="task" value="" />
<input type="hidden" name="controller" id="controller" value="products" />
<input type="hidden" id="view" name="view" value="products"/>
<input type="hidden" id="jegroupbuy-sitepath" name="jegroupbuy-sitepath" value="<?php echo $path; ?>"/>
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<p class="copyright" align="center">
	<?php require_once( JPATH_COMPONENT . DS . 'copyright' . DS . 'copyright.php' ); ?>
</p>