<?php
/* @var $this PosController */
/* @var $model Pos */

$this->breadcrumbs = array(
    yii::t('default', 'POS') => array('/dashboard/poss'),
    yii::t('default', 'POSs') => array('index'),
);

?>
<div id="flash-msg">
    <br>
    <?php $this->widget('bootstrap.widgets.TbAlert'); ?>
</div>

<?php echo CHtml::link(Yii::t('default', 'Download POS Setup Files'), array('/pos/posSetup'), array('class' => 'btn btn-primary')); ?>

<?php
    $this->widget('ext.bootstrap.widgets.TbGridView', array(
        'id' => 'pos-grid',
        'type' => 'striped',
        'dataProvider' => $model->search(),
        'filter' => $model,
        'columns' => array(
            'name',
            array(
                'name' => 'location_id',
                'value' => '$data->location->code',
            ),
            'installation_date',
            'mac_address',
            array(
                'name' => 'user_id',
                'value' => '$data->user->Identifier',
                'filter' => CHtml::listData(User::getAll(), 'id', 'Identifier')
            ),
            array(
                'name' => 'status',
                'type' => 'html',
                'value' => 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl."/css/flags/".$data->status.".png", "img")  ,"#",array("rel"=>"tooltip","title"=>Yii::t(\'default\',$data->status)))',
                'filter' => array('Active' => Yii::t('default', 'Active'), 'Inactive' => Yii::t('default', 'Inactive')),
                'htmlOptions' => array('style' => 'text-align:center;'),
            ),
            array(
                'class' => 'CButtonColumn',
                'htmlOptions' => array('width' => '60'),
                'afterDelete' => 'function(link,success,data){ if(success) $("#flash-msg").html(data); }',
                'buttons' => array(
                     'view' => array(
                         'visible' => 'Yii::app()->user->checkAccess("Facility Admin")? false:true',
                     ),
                     'update' => array(
                         'visible' => 'Yii::app()->user->checkAccess("Facility Admin")? false:true',
                     ),
                      'delete' => array(
                         'visible' => 'Yii::app()->user->checkAccess("Facility Admin")? false:true',
                     ),
                 ),
            ),
        ),
    ));
?>
