<div class="row">
    <div class="col-lg-12">
        <ol class="breadcrumb">
            <?php      
            $currentAction = '';
            $agregarNuevo = '';
            if($action =='edit'){ 
                $registerAction = 'Editar Estacion ';
                $currentAction = "<li class='active'><i class='fa fa-pencil'></i> ".$_translator->_getTranslation('Editar')."</li>";
                $agregarNuevo = "<a href='Station.php' class='btn btn-md btn-default'><i class='fa fa-plus'></i> ".$_translator->_getTranslation('Agregar estacion')."</a>";
                $agregarNuevo .= '<hr>';                
            }elseif($action =='' || $action =='insert'){
                $registerAction = 'Agregar Estacion ';
                $currentAction = "<li class='active'><i class='fa fa-plus'></i> ".$_translator->_getTranslation('Agregar')."</li>";
            } ?>
            <li><i class="fa fa-dashboard"></i>  <a href="<?php echo ROOT_HOST?>/Controller/Home.php"><?php echo $_translator->_getTranslation('Home')?></a></li>
            <li class="active"><i class="fa fa-laptop"></i> <?php echo $_translator->_getTranslation('Estaciones')?></li>
            <?php echo $currentAction?>
        </ol>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div id="flashmessenger"><?php $flashmessenger->showMessage();?></div>
        <div class="box">
            <div class="box-header"> 
                <h3><i class='fa-fw fa fa-laptop'></i><?php echo $_translator->_getTranslation($registerAction);?></h3>
                <div class='box-icon'><i class='icon fa fa-tasks'></i></div>
            </div>
            <div class='box-content'>
                <div class="row">
                    <div class="col-md-12 col-xs-12 text-right">
                        <?php echo $agregarNuevo;?>                        
                        <div class="clear"></div>
                    </div> 
                    <?php 
                    echo $_form->openForm();
                    echo $_form->showActionController();
                    echo $_form->showId();
                    ?>
                    <div class="col-md-11">
                        <?php echo $_form->showElement('nombre');?>
                        <?php echo $_form->showElement('token');?>
                        <?php echo $_form->showElement('tipo');?>
                        <?php echo $_form->showElement('sucursal');?>
                        <?php echo $_form->showElement('status');?>
                        <div class="form-group">
                            <div class="col-md-3"></div>
                            <div class="col-md-8 p-r-0 text-right">
                                <?php $element = $_form->getElement('send'); echo $_form->createOnlyElement($element);?>
                                <?php $element = $_form->getElement('cancelar'); echo $_form->createOnlyElement($element);?>                               
                            </div>
                        </div>
                    </div>      
                    <?php echo $_form->closeForm();?>
                </div>
                <div class="row">
                    <div class="col-lg-12">
                        <h3><?php echo $_translator->_getTranslation('Lista estaciones')?></h3>
                        <hr/>
                        <div class='table-responsive'>
                        <table id="tblEstaciones" class="table table-striped table-hover table-condensed">
                            <thead>
                            <th class="text-center col-md-1"><?php echo $_translator->_getTranslation('Accion');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Nombre');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Token');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Tipo');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Sucursal');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Status');?></th>
                            </thead>
                            <tbody>
                            <?php 
                                if($_listaEstaciones){
                                    foreach($_listaEstaciones as $estacion){?>
                                        <tr>
                                            <td>
                                            <a href="Station.php?action=edit&id=<?php echo $estacion['id']?>"><i class="fa fa-pencil btn btn-sm btn-default"></i></a>
                                            <a onclick="return deleteRegistry('Station.php?action=delete&id=<?php echo $estacion['id']?>')" 
                                               href="#"><i class="fa fa-trash btn btn-sm btn-danger"></i></a>
                                            </td>
                                            <td class="text-center"><?php echo $estacion['nombre']?></td>
                                            <td class="text-center"><?php echo $estacion['token']?></td>
                                            <td class="text-center"><?php echo $estacion['tipo']?></td>
                                            <td class="text-center"><?php echo $estacion['sucursal']?></td>
                                            <td class="text-center"><?php echo $estacion['status']?></td>
                                        </tr><?php
                                    }                   
                                }?>
                            </tbody>
                        </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('#tipo,#status,#sucursal').select2();
    
    $('#tblEstaciones').DataTable({
        paginate:true,
        filter:true,
        pageLength: 100
    });

    $('#tblProductos')
            .removeClass( 'display' )
            .addClass('table table-striped table-bordered');    
</script>