<?php

echo $js;
?>

<div class="row">
    <div class="col-lg-12">
        <div class="page-title">
            <h1> Eventos
                <small><i class="fa fa-arrow-right"></i> Gestión de Eventos</small>
                <?php 
if (permisoEvento("ingresar")) {
    ?>
                <div class="pull-right">
                    <a href="#" id="nueva" class="btn btn-green btn-square">
                        <i class="fa fa-plus"></i>
                        Nuevo Evento
                    </a>
                </div>
                <?php 
}
?>
            </h1>
            <ol class="breadcrumb">
                <li><i class="fa fa-dashboard"></i><a href="<?php 
echo site_url();
?>
"> Inicio </a></li>
                <li><i class="fa fa-bell"></i> Eventos </li>
                <li class="active"><i class="fa fa-bell"></i> Ingreso </li>
            </ol>
        }
        ?>
                            <?php 
        if (permisoEvento("eliminar")) {
            ?>
                                    <a data="<?php 
            echo $row["eme_ia_id"];
            ?>
" class="alarma-eliminar btn btn-xs btn-danger" href="#">
                                        <i class="fa fa-trash"></i>
                                    </a>
                            <?php 
        }
        ?>
                            <?php 
        if (permisoEvento("editar") and ($row['est_ia_id'] == 1 or $row['est_ia_id'] == 2)) {
            ?>
                                <a title="Finalizar" class="btn btn-xs btn-warning emergencia-cerrar" type="button" data="<?php 
            echo $row["eme_ia_id"];
            ?>
" href="javascript:void(0)">
                                    <i class="fa fa-thumb-tack"></i>
                                </a>
                            <?php 
        }
        ?>
                        </div>
                    </div>
                </td>
                
            </tr>
        if (permisoEvento("finalizar")) {
            ?>

                                <button title="Finalizar emergencia" class="btn btn-xs btn-warning emergencia-cerrar" type="button" data="<?php 
            echo $row["eme_ia_id"];
            ?>
" href="#">
                                    <i class="fa fa-thumb-tack"></i> 
                                </button>

                            <?php 
        }
        ?>

                            <?php 
        if (permisoEvento("reporte")) {
            ?>

                                <button title="Reporte" class="btn btn-xs btn-info emergencia-reporte" type="button"  data="<?php 
            echo $row["eme_ia_id"];
            ?>
" data-rel="<?php 
            echo $row["eme_ia_id"];
            ?>
" href="#">
                                    <i class="fa fa-file-text-o"></i>
                                </button>

                            <?php 
        }
        ?>
                         <li class="divider"></li>
                     <?php 
 }
 ?>
                     <li class="dropdown-submenu">
                         <a href="javascript:void(0)"><i class="fa fa-upload"></i> Exportar</a>
                         <ul class="dropdown-menu">
                             <li class="divider"></li>
                             <li>
                                 <a  id="btn-exportar-kml" href="javascript:void(0)"> <i class="fa fa-map"></i> Kmz </a>
                             </li>
                             <li class="divider"></li>
                         </ul>
                     </li>
                     <?php 
 if (permisoEvento("guardar")) {
     ?>
                     <li class="divider"></li>
                     <li class="dropdown-submenu">
                         <a href="javascript:void(0)"><i class="fa fa-download"></i> Importar</a>
                         <ul class="dropdown-menu">
                             <li class="divider"></li>
                             <li>
                                 <a  id="btn-importar-kml" href="javascript:void(0)"> <i class="fa fa-map"></i> Kml/Kmz </a>
                             </li>
                             <!--<li>
                                 <a id="btn-importar-excel" href="#"> <i class="fa fa-table"></i> Excel </a>
                             </li>-->
                             <li class="divider"></li>
                         </ul>
                     </li>
                            <div id="contendor-grilla-emergencia" class="table-responsive">
                                <div class="col-lg-12 text-center">
                                    <i class="fa fa-4x fa-spin fa-spinner"></i>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
            <?php 
}
?>
            
            <?php 
if (permisoEvento("ver")) {
    ?>
                <div class="row top-spaced">
                    <div class="col-lg-12">
                        <div class="portlet portlet-default">
                            <div class="portlet-heading">
                                <div class="portlet-title">
                                    <h4><i class="fa fa-list-ul"></i> Eventos en Alerta</h4>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                            <div class="portlet-body" >
                                <div id="contendor-grilla-alarma" class="table-responsive">
                                    <div class="col-lg-12 text-center">
                                        <i class="fa fa-4x fa-spin fa-spinner"></i>
                                    </div>
                <div class="col-lg-3 text-right">
                    <strong>MOVER:</strong>
                </div>
                <div class="col-lg-3 text-left">
                    <select name="editar_mover" id="editar_mover" class="form-control">
                        <option value="No" selected>No</option>
                        <option value="1">Al frente</option>
                        <option value="1">Al fondo</option>
                    </select>
                </div>
            </div>-->
            <?php 
// }
?>
            <?php 
if ($editar_forma && permisoEvento("editar")) {
    ?>
            <div class="row top-spaced">
                <div class="col-lg-3 text-right">
                    <strong>EDITAR FORMA:</strong>
                </div>
                <div class="col-lg-3 text-left">
                    <select name="editar_forma" id="editar_forma" class="form-control">
                        <option value="No">No</option>
                        <option value="Si">Si</option>
                    </select>
                </div>
            </div>
            <?php 
}
?>
                        
                    <?php 
        if (permisoEvento("editar") and ($row['est_ia_id'] == 1 or $row['est_ia_id'] == 2) and in_array($row['reg_ia_id'], $regiones_usuario)) {
            ?>
                        <a title="Finalizar" class="btn btn-xs btn-warning emergencia-finalizar" type="button" data-rel="<?php 
            echo $row["eme_ia_id"];
            ?>
" href="javascript:void(0)">
                            <i class="fa fa-thumb-tack"></i>
                        </a>
                    <?php 
        }
        ?>
                        
                    <?php 
        if (permisoEvento("eliminar") and $row['est_ia_id'] < 2 and in_array($row['reg_ia_id'], $regiones_usuario)) {
            ?>
                            <a data="<?php 
            echo $row["eme_ia_id"];
            ?>
" class="alarma-eliminar btn btn-xs btn-danger" href="#">
                                <i class="fa fa-trash"></i>
                            </a>
                    <?php 
        }
        ?>
                    </div>
                </td>
                
            </tr>
            <?php