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

$this->menu=array(
    array('label'=>'Novi unos','url'=>array('create'),'icon'=>'plus'),
    array('label'=>'Stanje','url'=>array('stanje'),'icon'=>'cog'),
    array('label'=>'Tabela Po Korisnicima','url'=>array('tabela'),'icon'=>'user'),
    array('label'=>'Tabela Po Korisnicima NEW','url'=>array('bi/report/admin'),'icon'=>'user'),
);

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

<h1>Evidencija Promena</h1>

<script type="text/javascript">
    jQuery(function ($) {
        $("body").on("dblclick", ".grid-view tbody > tr", function (e) {
            window.location.href = $(this).find('.update').attr('href');
        });
    });
</script>

<div class="search-form" >
<?php
//$this->renderPartial('_search',array(
//	'model'=>$model,
//));
?>
</div><!-- search-form -->

<?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'blagajna-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		//'id',
		//'user_id',
       // 'datum',
        array(
            'name'=>'user_id',
            'value'=>'$data->user->username',
            'filter'=>CHtml::listData(User::model()->findAll(),'id','username'),
        ),
        array(
            'name'=>'znakpromene',
            // 'value'=>'$data->tipPromene->naziv',
            'filter'=>false,
        ),
       // 'suma',
        array(
            'name'=>'suma',
            'footer'=>'Ukupno: ' . $model->getTotal($model->search()->getData(), 'suma').' din',
        ),

        array(
            'name'=>'tip_promene',
            'value'=>'$data->tipPromene->naziv',
            'filter'=>CHtml::listData(Tippromene::model()->findAll(),'id','naziv'),
        ),
       // 'znakpromene',

		'komentar:html',
       // 'vreme',
        array(
            'name'=>'vreme',
           // 'value'=>'$data->tipPromene->naziv',
            'filter'=>false,
        ),
		/*
		'vreme',
		*/
		array(
			'class'=>'bootstrap.widgets.TbButtonColumn',
            'id' => 'pages',
            'header' => CHtml::dropDownList('pageSize', $pageSize,
                                            array(10 => 10, 20 => 20, 50 => 50, 100 => 100, 1000 => 1000, 5000 => 5000),
                                            array('empty' => 'Broj prikaza', 'onchange' => "$.fn.yiiGridView.update('blagajna-grid',{ data:{pageSize: $(this).val() }})")
            ),

        ),
	),
)); ?>
