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


<table class="table table-bordered table-sm">
	<thead class="thead-dark">
	<tr>
		<th scope="col">#</th>
		<th scope="col">Canal</th>
        <th scope="col">Estado</th>
		<th scope="col" style="width: 140px; text-align:center">
        </th>
	</tr>
	</thead>
    
	<tbody id="tabla_lista">
	<?php
		$count = 1;
		$query = mysqli_query($connect,"SELECT * FROM Live ORDER BY id DESC ");
		while($data = mysqli_fetch_array($query)){
			
			$text_estado = '';
			if($data["estado"] == 1){ $text_estado = 'Activo'; }
			if($data["estado"] == 2){ $text_estado = 'Inactivo'; }

			echo '
			<tr>
				<th scope="row">'.$count.'</th>
				<td>'.$data["nombre"].'</td>
				<td>'.$text_estado.'</td>
				<td align="center">
					<a href="?pg=live/detalle&id='.$data["id"].'">
                    <button type="button" class="btn btn-success btn-sm">
						<i class="fa fa-edit"></i>
					</button>
                    </a>
                    <a href="?pg=live/previo&id='.$data["id"].'">
                    <button type="button" class="btn btn-warning btn-sm">
						<i class="fa fa-eye"></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 = 'https://ganadeuna.com/admin/api/';

function Ficha(id){
	jQuery.ajax({
		url: api+"ficha_noticia.php",
		type:'post',
		data: {id: id, url:"?pg=candidatos"},
		}).done(function (resp){
			$("#formulario").html(resp);
		})
		.fail(function(resp) {
			console.log(resp);
		})
		.always(function(resp){
		}
	);
}
var activar = false;
function Eliminar_Candidato(id){
	if(activar == false){
		$("#modal_body").html('Estas a punto de eliminar un candidato, 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_Candidato('+id+')">Eliminar</button>');
		$("#modal_general").modal('show');
	}
	else{
	
		jQuery.ajax({
			url: api+"eliminar_noticia.php",
			type:'post',
			data: {id: id, url:"?pg=noticias"},
			}).done(function (resp){
				$("#xscript").html(resp);
			})
			.fail(function(resp) {
				console.log(resp);
			})
			.always(function(resp){
			}
		);
		
	}
}

var formulario = $("#formulario").html();
function Setear(){
	$("#formulario").html(formulario);
}

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


</script>

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