Newer
Older
ournorth2021 / admin / views / stands.php
LuisOlaya on 8 Apr 2021 3 KB primer
<div align="left" style="padding: 10px 0px;">
	<table width="100%">
    	<tr>
        	<td><h5 style="margin-top: 8px;"><i class="fas fa-chevron-right"></i> Stands</h5></td>
            <td align="right" width="200">
            	<input class="form-control" type="text" placeholder="Búsqueda rápida..." id="buscador" />
            </td>
        </tr>
    </table>
</div>

<div align="right">
	<a href="?pg=stand/detalle">
		<button type="button" class="btn btn-warning btn-md " style="margin-bottom:15px">
			<i class="fa fa-plus btn-left"></i> Crear Stand
		</button>
	</a>
</div>

<table class="table table-bordered">
	<thead class="thead-dark">
	<tr>
		<th scope="col" width="15">#</th>
		<th scope="col" width="100">Imágen</th>
        <th scope="col" >Pabellón</th>
        <th scope="col" >Nombre</th>
        <th scope="col" >Estado</th>
		<th scope="col" >Id DB.</th>
        <th scope="col" width="100"></th>
	</tr>
	</thead>
    
	<tbody id="tabla_lista">
	<?php
		$count = 1;
		$query = mysqli_query($connect,"SELECT * FROM Stands ORDER BY id ASC ");
		while($data = mysqli_fetch_array($query)){
            
            $queryPab = mysqli_query($connect,"SELECT * FROM Pabellones WHERE id = '".$data["id_pabellon"]."' ");
            $dataPab = mysqli_fetch_array($queryPab);
			
			$text_estado = '';
			if($data["estado"] == 1){ $text_estado = 'Activo'; }
			if($data["estado"] == 2){ $text_estado = 'Inactivo'; }
				
            echo '
				<tr>
					<th scope="row">'.$count.'</th>
                    <td><img src="'.$recursos_plubico.'/'.$data["imagen"].'" width="100%" /></td>
					<td>'.$dataPab["nombre"].'</td>
                    <td>'.$data["nombre"].'</td>
					<td>'.$text_estado.'</td>
                    <td>'.$data["id"].'</td>
					<td>
						<a href="?pg=stand/detalle&id='.$data["id"].'">
						<button type="button" class="btn btn-success btn-sm">
							<i class="fa fa-edit"></i>
						</button>
						</a>
					</td>
				</tr>
            ';
            $count++;
			
		}
	?>
	</tbody>
</table>

<script>

$(document).ready(function(){
	$("#buscador").on("keyup", function() {
		var value = $(this).val().toLowerCase();
		$("#tabla_lista tr").filter(function() {
		  $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
		});
	});	  
});

var api = '<?php echo $api; ?>';

var activar = false;
function Eliminar(id){
	if(activar == false){
		$("#modal_body").html('Estas a punto de eliminar un expositor, esta acción es irreversible ¿Estás seguro?<br><br>');
		$("#modal_body").append('<button type="button" class="btn btn-danger" style="margin-right: 10px;" onclick="activar = true; Eliminar('+id+')">Eliminar</button>');
		$("#modal_general").modal('show');
	}
	else{
	
		jQuery.ajax({
			url: api+"eliminar_speaker.php",
			type:'post',
			data: {id: id, url:"?pg=speakers"},
			}).done(function (resp){
				$("#xscript").html(resp);
			})
			.fail(function(resp) {
				console.log(resp);
			})
			.always(function(resp){
			}
		);
		
	}
}

function Del_Imagen(elem,tipo){
	$( elem).parent().html('<input type="file" class="form-control" name="image" required>');
}

</script>

<script src="js/functions.js"></script>