<?php
$this->breadcrumbs=array(
	'Products'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Product', 'url'=>array('index')),
	array('label'=>'Create Product', 'url'=>array('create')),
);

/*Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('product-grid', {
		data: $(this).serialize()
	});
	return false;
});
");*/
?>

<div id="communbox" style="width:885px; float:left;">
<div id="headlines" style="width: 99%; padding-left:2%;"><img src="images/admin/bg.png" width="12" height="7" class="right5"/>
<?php
if($_GET['isFeaturedItem']=='Y')
	echo 'Featured Items';
else if($_GET['isIntoPromotion']=='Y')
	echo 'Promotions';
else
	echo 'Manage Products';
?>
</div>
<div id="communicationsbox" style="height:525px; background-color:#f7eee1;">
<div id="form_wrapper">

<?php //echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php //$this->renderPartial('_search',array(	'model'=>$model,)); ?>
</div><!-- search-form -->
<?php
    foreach(Yii::app()->user->getFlashes() as $key => $message) {
        echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
    }
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'product-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'header'=>'Sl.No.',
			'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
			'htmlOptions'=>array('width'=>'5px'),
		),
		'product_name',
		array(
			'name'=>'userGroup_search_groupname',
			'value'=>'$data->userGroup->group_name',
			'filter'=>UserGroup::getGroups(),
			'type'=>'raw'
		),		
		array(
			'name'=>'productGroup_search_groupname',
			'value'=>'$data->productGroup->product_group_name',
			'filter'=>ProductGroup::getProductGroup(null,true),
			'type'=>'raw'
		),

		array(
			'name'=>'productCategory_search_categoryname',
			'value'=>'($data->product_category_id!=0)?$data->productCategory->category_name:"No Category"',
			'filter'=>ProductCategory::getProductCategory(null,null,true),
			'type'=>'raw'
		),
		/*
		'isIntoPromotion',
		'rewardPoints',
		'promotionForm',
		'isFeaturedItem',
		'specifications',
		'overview',
		'description',
		'created',
		'isActive',
		'isDelete',
		*/
		array(
			 'header'=>'Actions',
			 'template'=>'{update}{delete}',
			'class'=>'CButtonColumn',
		),
	),
)); ?>
</div>
</div>
</div>
