Newer
Older
ournorth2021 / admin / views / agenda.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> Agenda</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=agenda/detalle">
		<button type="button" class="btn btn-warning btn-md " style="margin-bottom:15px">
			<i class="fa fa-plus btn-left"></i> Crear Agenda
		</button>
	</a>
</div>

<table class="table table-bordered">
	<thead class="thead-dark">
	<tr>
		<th scope="col" width="15">#</th>
		<th scope="col" width="150">Día</th>
		<th scope="col" width="150">Hora</th>
		<th scope="col" width="150">Hora Termina</th>
        <th scope="col" >Título</th>
		<th scope="col" width="100"></th>
	</tr>
	</thead>
    
	<tbody id="tabla_lista">
	<?php
		$count = 1;
		$query = mysqli_query($connect,"SELECT * FROM Agenda WHERE id_evento = 1 GROUP BY dia ORDER BY dia ASC ");
		while($data = mysqli_fetch_array($query)){
			
			$queryEvento = mysqli_query($connect,"SELECT * FROM Agenda WHERE id_evento = 1 AND dia = '".$data["dia"]."' ORDER BY id ASC ");
			while($dataEvento = mysqli_fetch_array($queryEvento)){
				
				echo '
				<tr>
					<th scope="row">'.$count.'</th>
					<td>'.$dataEvento["dia"].'</td>
					<td>'.$dataEvento["hora_inicia"].'</td>
					<td>'.$dataEvento["hora_termina"].'</td>
					<td>'.$dataEvento["actividad"].'</td>
					<td>
						<a href="?pg=agenda/detalle&id='.$dataEvento["id"].'">
						<button type="button" class="btn btn-success btn-sm">
							<i class="fa fa-edit"></i>
						</button>
						</a>
						<button type="button" class="btn btn-danger btn-sm"  onclick="Eliminar('.$dataEvento["id"].')">
							<i class="fa fa-times"></i>
						</button>
					</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>