<div class="row">
    <div class="col-lg-12">
        <ol class="breadcrumb">
            <?php      
            $currentAction = '';
            $agregarNuevo = '';
            if($action =='edit'){
                $categoryAction = 'Editar merma ';
                $currentAction = "<li class='active'><i class='fa fa-pencil'></i> ".$_translator->_getTranslation('Editar')."</li>";
                $agregarNuevo = "<a href='Waste.php' class='btn btn-md btn-default'><i class='fa fa-plus'></i> ".$_translator->_getTranslation('Agregar merma')."</a>";
                $agregarNuevo .= '<hr>';
            }elseif($action =='' || $action =='insert'){
                $categoryAction = 'Agregar merma ';
                $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-tags"></i> <?php echo $_translator->_getTranslation('Mermas')?></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-tags'></i><?php echo $_translator->_getTranslation($categoryAction);?></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-lg-6">
                    <?php 
                    echo $_form->showElement('date');
                    echo $_form->showElement('quantity');
                    echo $_form->showElement('reason');
                    ?>
                    <div class="text-right">
                        <?php $element = $_form->getElement('send'); echo $_form->createOnlyElement($element);?>
                        <?php $element = $_form->getElement('cancelar'); echo $_form->createOnlyElement($element);?>                               
                    </div>
                </div>      
                <?php echo $_form->closeForm();?>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <hr/>
                    <div class='table-responsive'>
                    <table id="tblWaste" class="table table-striped table-hover table-condensed">
                        <thead>
                            <th class="text-center col-md-1">Accion</th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('No.');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Fecha');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Cantidad');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Unidad');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Usuario');?></th>
                            <th class="text-center"><?php echo $_translator->_getTranslation('Status');?></th>
                        </thead>
                        <tbody>
                        <?php 
                            if($_listaWaste){
                                foreach($_listaWaste as $waste){?>
                                    <tr>
                                        <td>
                                            <a href="Waste.php?action=edit&id=<?php echo $waste['id']?>"><i class="fa fa-pencil btn btn-sm btn-default"></i></a>
                                            <a onclick="return deleteRegistry('Waste.php?action=delete&id=<?php echo $waste['id']?>')" 
                                               href="#"><i class="fa fa-trash btn btn-sm btn-danger"></i></a>
                                        </td>
                                        <td class="text-center"><?php echo $waste['id']?></td>
                                        <td class="text-center"><?php echo $waste['formated_date']?></td>
                                        <td class="text-center"><?php echo $waste['quantity']?></td>
                                        <td class="text-center"><?php echo $waste['um']?></td>
                                        <td class="text-center"><?php echo $waste['user_name']?></td>
                                        <td class="text-center"><?php echo $waste['status_name']?></td>
                                    </tr><?php
                                }                   
                            }?>
                        </tbody>
                    </table>
                    </div>
                </div>
            </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" language="javascript">
    $('#date').datetimepicker({format: 'MM/DD/YYYY'});      
    $('#tblWaste').DataTable({
        paginate:true,
        filter:true,
        pageLength: 100
    });
    $('#tblWaste')
            .removeClass( 'display' )
            .addClass('table table-striped table-bordered');
</script>