<?php

	session_start();
	error_reporting(0);
	$varsesion= $_SESSION['usuario'];

	if($varsesion == null || $varsesion= ''){
		echo 'Usted no tiene Autorizacion, favor de iniciar sesion';
		die();
	}


	require 'cn2.php';

	$where ="";

	$sql= "select * from v_phone2";

	if(!empty($_POST))
	{
		$valor = $_POST['campo'];
		if(!empty($valor)){
			$where = "WHERE tel_user LIKE '%$valor%'";
		}
	}
	
	$sql="select * from v_phone2 $where";
	$resultado= $mysqli->query($sql);
	//$sqld= "select * from v_phone p LEFT JOIN usuarios u on p.t_id = u.id  $where";
	//$sql = "select u.id, u.nombre, p.t_sucursal,p.t_area,p.t_serie,p.t_modelo,p.t_imei,p.t_num from v_phone p RIGHT JOIN usuarios u on p.t_id = u.id";
	
    //$todo=$mysqli->query($sql);

?>


<html lang="es">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		
		
	    <meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/bootstrap-theme.css" rel="stylesheet">
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
		<!--<link rel="stylesheet" type="text/css" href="css/estilos.css">-->
		<!--<link href="css/jquery.dataTables.min.css" rel="stylesheet">-->	
		<!--<script src="js/jquery-3.1.1.min.js"></script>-->
		<!--<script src="js/jquery.dataTables.min.js"></script>-->
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<!--<script src="js/bootstrap.min.js"></script>-->		
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
        <style> 
        tr:nth-child(odd){
	background-color: #f2f2f2;
}
tr:nth-child(even){
	background-color: #fbfbfb;
}
tr: hover{
	background-color: #EBF8FC;
}
</style>

</head>
<body>
	<!--<header>
		<nav class="navbar-inverse navbar-static-top" role="navigation">
		
		<div class="container">
			<div class="navbar-header">
				
				<strong><a href="index.php" class="navbar-brand">BUSCADOR DE CORREOS VOLVO</a></strong>
				<div class="col-md-6">
					<img src="imagenes/logovolvo.png" style="height: 60px; position: absolute; top: -50px; left: -95px;">
				</div>


			</div>
			<!--Inicia Menu
			<div class="collapse navbar-collapse" id="navegacion">
				<ul class="navbar navbar-nav">
					<li><a href="index.php"><span class="glyphicon glyphicon-home"></span> Inicio</a></li>
					<li class="divider-vertical"></li>
					<li><a href="regis.php"><span class="glyphicon glyphicon-search"></span> Usuarios </a></li>	
					<li class="divider-vertical"></li>
					<li><a href="consul.php"><span class="glyphicon glyphicon-user"></span> Consultores</a></li>
					<li class="divider-vertical"></li>
					<li><a href="bdispo.php"><span class="glyphicon glyphicon-hdd"></span> Equipos</a></li>
					<li class="divider-vertical"></li>
					<li><a href="antenas.php"><span class="glyphicon glyphicon-signal"></span> Antenas</a></li>
					<li class="divider-vertical"></li>
					<li><a href="correos.php"><span class="glyphicon glyphicon-envelope"></span> Correos</a></li>
					<li class="divider-vertical"></li>
					<li><span style="text-align: right; color: #c7c7c7; padding: 50px;">Bienvenido: <?php echo $_SESSION['usuario'] ?> </span></li>
					
					<li><a style="text-align: right;" href="close_sesion.php" data-toggle="modal" data-target="#confirm-delete"><span class="glyphicon glyphicon-lock" style="color: #FF0000;">Cerrar Sesion</span></a></li>
					
				</ul>
				
			</div><!--Termina el Menu
		</div><!--Inicia nvbarinversa
		</nav><!--Termina navbar
		

	</header>-->
     <nav class="navbar navbar-inverse">
        <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.php"><strong>INVENTARIO VOLVO</strong></a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="bdispo.php"><span class="glyphicon glyphicon-hdd"></span> Equipos <span class="sr-only">(current)</span></a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> Personal<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="regis.php">Usuarios</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="consul.php">Consultores</a></li>
            
          </ul>
        </li>
        <li><a href="imp.php"><span class="glyphicon glyphicon-print"></span> Impresoras</a></li>
        <li><a href="antenas.php"><span class="glyphicon glyphicon-signal"></span> Antenas</a></li>
        <li><a href="cel.php"><span class="glyphicon glyphicon-phone"></span> Celulares</a></li>
        <li><a href="correos.php"><span class="glyphicon glyphicon-envelope"></span> Correos</a></li>
      </ul>
      
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.php">Bienvenido: <?php echo $_SESSION['usuario'] ?> </a></li>
        <li><a style="text-align: right;" href="close_sesion.php" data-toggle="modal" data-target="#confirm-delete"><span class="glyphicon glyphicon-lock" style="color: #FF0000;">Cerrar Sesion</span></a></li>
        
        <!--<li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
        
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>-->
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>


	<div class="container">
		<div class="row">
			<h2 style="text-align: center"><strong>CELULARES VOLVO</strong></h2>

			<!--<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
					<b>SUCURSAL: </b>
					<select name="campo">
					    <option value="">.......</option>
					    <option value="Volvo Minerva">Volvo Minerva</option>
					    <option value="Volvo Morelia">Volvo Morelia</option>
					    <option value="Volvo Galerias">Volvo Galerias</option>
					    <option value="Volvo Bosques">Volvo Bosques</option>
					    <option value="Volvo Queretaro">Volvo Queretaro</option>
					</select>
					
					
					<input type="submit" id="enviar" name="enviar" value="Buscar" class="btn btn-info" />
			</form>-->
			<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
					<b>Usuario: </b><input type="text" id="campo" name="campo" />
					<input type="submit" id="enviar" name="enviar" value="Buscar" class="btn btn-info" />
			</form>
		</div>
		<div>
			<form action="rphone.php">
				<button type="button" class="btn btn-info btn-lg " data-toggle="modal" data-target="#myModal3" style="padding:4px 12px; cursor: pointer;color: #fff;background: crimson; margin: auto;">Nuevo Registro</button>
			</form>
		</div>
		
		<div id="myModal3" class="modal fade" role="dialog">
            <div class="modal-dialog">

            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title"><strong>REGISTRO DE CELULAR</strong></h4>
                </div>
            <div class="modal-body">
		
		        <form action="celphone.php" method="post" class="form-registro" onsubmit="return validar();">
		            <div class="contenedor-inputs">
			            
			            <!--<input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="t_id" name="t_id" placeholder="ID" class="input-48">-->
		                <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_user" name="tel_user" placeholder="Usuario" class="input-48">
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_sucursal" name="tel_sucursal" placeholder="Sucursal" class="input-100" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_area" name="tel_area" placeholder="Area" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_equipo" name="tel_equipo" placeholder="Equipo" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_imei" name="tel_imei" placeholder="IMEI" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_num" name="tel_num" placeholder="Numero" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_sim" name="tel_sim" placeholder="SIM" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_costo" name="tel_costo" placeholder="Costo" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray;" type="text" id="tel_acce" name="tel_acce" placeholder="Accesorios" class="input-48" required>
			            <input style="font-size: 12px;margin-bottom: 12px;padding: 12px;border-radius: 3px;border: 1px solid darkgray; padding: 10px 40px; margin: auto; background: crimson; color: #fff; text-align: center" type="submit" value="Registrar" class="btn-registro">
		
		
		            </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>

            </div>
        </div>
		</div>
		
		<div>
			<form action="exportarcel.php">
				<input style="padding:4px 12px; cursor: pointer;color: #fff;background: #084B8A; margin: auto;" type="submit" value="Exportar Registro">
			</form>
		</div>
		
		<br>

		<div class="row table-responsive">
			<table class="display" id="mitabla" style="border-color: #337ab7;">
			<thead>
				<tr style="color: #fff; background-color: #7B7B7C; border-color: #337ab7; font-size: 75%;">
					<th style="padding: 10px; text-align: center;">ID</th>
					<th style="padding: 15px; text-align: center;">USUARIO</th>
					<th style="padding: 15px; text-align: center;">SUCURSAL</th>
					<th style="padding: 15px; text-align: center;">AREA</th>
					<th style="padding: 10px; text-align: center;">EQUIPO</th>
					<th style="padding: 10px; text-align: center;">IMEI</th>
					<th style="padding: 10px; text-align: center;">NUMERO</th>
					<th style="padding: 10px; text-align: center;">SIM</th>
				    <th style="padding: 10px; text-align: center;">COSTO</th>
				    <th style="padding: 10px; text-align: center;">ACCESORIOS</th>
				
				</tr>
			</thead>
			<tbody>
				<?php while($row= $resultado->fetch_array(MYSQLI_ASSOC)) {?>
				<tr style="font-size: 80%;border-bottom: 2px solid #7B7B7C;">
						<td style="text-align: center;  font-weight: bold;"><?php echo $row['tel_id']; ?></td>
						<td style="text-align: center; padding: 10px; font-weight: bold;"><?php echo $row['tel_user']; ?></td>
						<td style="text-align: center; padding: 10px;"><?php echo $row['tel_sucursal']; ?></td>
						<td style="text-align: center; padding: 10px;"><?php echo $row['tel_area']; ?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_equipo'];?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_imei'];?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_num'];?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_sim'];?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_costo'];?></td>
						<td style="text-align: center; padding: 15px;"><?php echo $row['tel_acce'];?></td>
					
						
						<td><a href="ecel.php?tel_imei=<?php echo $row['tel_imei']; ?>"><span class="glyphicon glyphicon-pencil" style="padding: 15px;"></span></a></td>
						<td><a href="#" data-href="eliminarcel.php?tel_imei=<?php echo $row['tel_imei']; ?>" data-toggle="modal" data-target="#confirm-delete"><span class="glyphicon glyphicon-trash" style="color: #FF0000;"></span></a>
						</td>
				</tr>
				<?php } ?>
			</tbody>	
			</table>
		</div>

	</div>

	<!--<footer >
		<div class="container-footer-all">
		<div class="container-body">
			<div class="colum1">
				<div class="row0">
					<img src="imagenes/logovolvo.png">
					<p>VOLVO Minerva</p>
				</div>
				
			</div>
			
			<div class="colum3">
				
				<div class="row2">
					<img src="imagenes/icono-casa.png">
					<label>Av. Vallarta No. 2750, Col. Arcos Sur, Guadalajara, Jalisco, CP 44150</label>
				</div>
				<div class="row2">
					<img src="imagenes/icono-telefono.png">
					<label>EXT: 2125 2126</label>
				</div>
				
			</div>
					
		</div>
		<div class="container-footer">
			<div class="copy">
				© 1998-2019 Volvo Car Corporation (o sus filiales y/o empresas licenciadoras, cuando así se indique)
			</div>
		</div>
		</div>
	</footer>-->

    <div class="footer" style="position: ; width:100%; height:120px; background-color:#363636; bottom:0;">
	    
	    <div class="container">
	     
	        <div style="text-align:center; color:#D2D2D2;">
	            	<label>Av. Vallarta No. 2750, Col. Arcos Sur, Guadalajara, Jalisco, CP 47150.</label>
	            	<label>Tel. 01 (33) 32088080, EXT: 2155 , 2156</label>
	            	<p>© 1998-2019 Volvo Car Corporation (o sus filiales y/o empresas licenciadoras, cuando así se indique)</p><br />
	            	
	            
	        </div>
	        <div style="text-align:center; font-size:25px; color:#D2D2D2;">
	            	<p><strong>VOLVO SUECIA CAR MINERVA</strong></p>
	        </div>

	    </div>
	</div>
    
	<!-- Modal -->
		<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">Eliminar Registro</h4>
					</div>
					
					<div class="modal-body">
						¿Desea eliminar este registro?
					</div>
					
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
						<a class="btn btn-danger btn-ok">Delete</a>
					</div>
				</div>
			</div>
		</div>

		<script>
			$('#confirm-delete').on('show.bs.modal', function(e) {
				$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
				
				$('.debug-url').html('Delete URL: <strong>' + $(this).find('.btn-ok').attr('href') + '</strong>');
			});
		</script>	
</body>
</html>