<?php Yii::app()->clientScript->registerScript('addremoveGroup',"
$('#addOneMore').live('click',function()
{
$('#productGroupTable tr:last').after($('#tableRowRepeatable').clone().find('input').val('').end());
}
);

$('#removeOne').live('click',function()
{
if($('#productGroupTable tr').length>2)
$(this).closest('tr').remove();
});

"); ?>
<div id="communicationsbox" style="height:525px; background-color:#f7eee1;">
  <?php
    foreach(Yii::app()->user->getFlashes() as $key => $message) {
        echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
    }
?>
<div id="form_wrapper">
  <?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-group-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    ),
)); ?>
    <div id="row"><br>
      <br>
      <table id="productGroupTable" width="800" cellspacing="2" cellpadding="3" border="0" style="border:1px #999 solid">
        <tbody>
          <tr>
            <td width="100" align="right"><?php echo $form->labelEx($model,'user_group_id'); ?></td>
            <td width="400">
			<?php echo $form->dropDownList($model,'user_group_id',UserGroup::getGroups()); ?> 
			<?php echo $form->error($model,'user_group_id'); ?>
			</td>
          </tr>
          <tr  id="tableRowRepeatable">
            <td align="right"></td>
            <td>
            <?php echo $form->labelEx($model,'product_group_name'); ?>
            <?php if($model->isNewRecord): ?>
			<?php echo $form->textField($model,'product_group_name',array('name'=>'productGroupName[]','id'=>'','size'=>20,'maxlength'=>255)); ?><br/>
            <?php echo $form->labelEx($model,'description'); ?>
			<?php echo $form->textArea($model,'description',array('style'=>'width: 427px; height: 103px;','name'=>'description[]')); ?><br/>
            <?php echo $form->labelEx($model,'product_group_image'); ?>
			<?php echo $form->fileField($model,'product_group_image',array('name'=>'productGroupImage[]')); ?><br/>
             <?php echo $form->labelEx($model,'product_group_icon'); ?>
			<?php echo $form->fileField($model,'product_group_icon',array('name'=>'productGroupImage_icon[]')); ?><br/>
            <?php echo $form->labelEx($model,'show_in_partner'); ?>
            <?php echo $form->dropDownList($model, 'show_in_partner',array('name'=>'show_in_partner[]','Y'=>'Yes','N'=>'No')); ; ?>
            <?php else: ?>
			<?php echo $form->textField($model,'product_group_name',array('size'=>20,'maxlength'=>255)); ?>
            <?php echo $form->error($model,'product_group_name'); ?><br/>
            <?php echo $form->labelEx($model,'description'); ?>
			<?php echo $form->textArea($model,'description',array('style'=>'width: 427px; height: 103px;')); ?><br/>
             <?php echo $form->labelEx($model,'product_group_image'); ?>
			<?php echo $form->fileField($model,'product_group_image'); ?><br/>
             <?php echo $form->labelEx($model,'product_group_icon'); ?>
			<?php echo $form->fileField($model,'product_group_icon'); ?>
            <?php echo $form->error($model,'product_group_image'); ?><br/>
            <?php echo $form->labelEx($model,'show_in_partner'); ?>
            <?php echo $form->dropDownList($model, 'show_in_partner',array('Y'=>'Yes','N'=>'No')); ; ?>
			<?php echo $form->error($model,'show_in_partner'); ?>
            </td>
            <td>
            <?php if($model->product_group_image!=''): ?>
			<?php echo CHtml::image(Yii::app()->request->baseUrl.'/media/product_group_images/'.$model->product_group_image,"image",array("width"=>'200px')); ?><br/>
            <?php endif; ?>
            <?php if($model->product_group_icon!=''): ?>
			<?php echo CHtml::image(Yii::app()->request->baseUrl.'/media/product_group_images/'.$model->product_group_icon,"image",array("width"=>'200px')); ?><br/>
            <?php endif; ?>
            </td>
			<?php endif; ?>
			
            <?php if($model->isNewRecord): ?>
              &nbsp;&nbsp;&nbsp;<a id="addOneMore" href="javascript:;"><img width="15" height="15" class="plus_position" alt="pluse" src="images/admin/green-plus-sign-md.png"></a>&nbsp;&nbsp;&nbsp;<a id="removeOne" href="javascript:;"><img width="15" height="15" class="plus_position" src="images/admin/green--sign-md.png"></a><?php endif; ?></td>
          </tr>
          <tr>
          <td align="right"></td>
          <td>
			</td>
        </tr>
          
          
          
          
        </tbody>
      </table>
      <?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save'); ?>
    </div>
    <br>
    <br>
    <br>
 <?php $this->endWidget(); ?>
</div>
</div>