<?php
$this->PageTitle = 'atas-edicao';

$botoes = (User::canUpdate()) ? '{view} {update}' : '{view}';

if (User::isAdmin()) {
	$botoes .= ' {delete}';
}

$imagem = (User::canCreate() ) ? FaHtml::iconNovo() : FaHtml::iconBlank();

$this->menu = array(
		array('label'=> $imagem, 'url'=>array('create'), 'linkOptions'=>array('target' => '_blank', 'class' => 'novo')),
		array('label'=>FaHtml::iconSetaClose(), 'url'=>'#', 'linkOptions'=>array('class' => 'search-button')),
		array('label' => FaHtml::iconRefresh(), 'url' => 'javascript:void(0);', 'linkOptions' => array('onclick' => 'reloadFrame();', 'class' => 'refresh-button')),
	);
?>
<?php
$dataProvider = $model->search();
?>
<div class="search-form" <?php if($dataProvider->totalItemCount > 0) echo 'style="display: none;"'; ?> >
<?php $this->renderPartial('_search', array(
	'model' => $model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('ext.Utils.widgets.CrmGridView', array(
	'id' => 'admin-grid',
	'afterAjaxUpdate'=>'updated',
	'pager' => Util::getPagerDefaultConfig(),
	'dataProvider' => $dataProvider,
	'columns' => array(
		'ATE_IDEDICAO',
		array(
			'name'=>'ATE_IDATA',
			'value'=>'GxHtml::valueEx($data->Ata)',
		),
		'ATE_DATA',
		'ATE_ASSUNTO',
		'ATE_CONTEUDO',
		'ATE_IDFUNCIONARIO',
		array(
			'class' => 'CButtonColumn',
			'template'=>$botoes,
			'viewButtonOptions'=>array('target'=>'_blank'),
			'updateButtonOptions'=>array('target'=>'_blank'),
			'buttons'=>array(
				'view' => array(
					'label'=>'Exibir',
					'url'=>'Yii::app()->createUrl("atas-edicao/view", array("id"=>$data->ATE_IDEDICAO))',
				),
				'update' => array(
					'label'=>'Editar',
					'url'=>'Yii::app()->createUrl("atas-edicao/update", array("id"=>$data->ATE_IDEDICAO))',
				),
				'delete' => array(
					'label'=>'Excluir',
					'url'=>'Yii::app()->createUrl("atas-edicao/delete", array("id"=>$data->ATE_IDEDICAO))',
				),
			),			
		),
	),
));