<?php      
function form_quienes($mysqli, $id){

	if ($id>0){
		$rs = $mysqli->query("select * from tb_quienes  where  id_contenido='1'");
		$rows = $rs->fetch_assoc();

		$contenido = $rows['contenido'];
		$foto1 = $rows['foto1'];
		
	}
	?>	
	<div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Quienes somos</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="../index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Quienes somos</li>
			</ol>
		</div>
	</div>
        <div class="content-body"><!-- Description -->
	
	
	      <div class="col-md-12">
			<div class="card">
				
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="card-text">
							<p>Información de página quienes somos</p>
						</div>
						<form class="m-t" role="form" action="act.php" method="post" enctype="multipart/form-data">
						   <input type="hidden" name="id" id="id" value="<?=$id?>">
						   <input type="hidden" name="tb_cc" id="tb_cc" value="1">						
						   <div class="form-actions" align="right"></div>						
							 <div class="form-body">														
								<div class="form-group  row"><label class="col-sm-12 col-form-label">Contenido</label></div>
								<div class="form-group  row"><div class="col-sm-12"><textarea  id="elm1" name="quienes_somos"><?=$contenido?></textarea></div></div>											
																			
								<div class="form-group  row"><label class="col-sm-12 col-form-label">Fotografía</label></div>
								<div class="form-group  row"><div class="col-sm-6"><input type="file" name="foto1" id="foto1" class="form-control"></div></div>											
							</div>
							<br><br>
							
							<div class="form-body">														
								<div class="form-group  row"><div class="col-sm-6"><?php 	if ($foto1!=NULL){ ?><img src="img/<?=$foto1?>" width="100%" ><?php } ?></div></div>											
							</div>
							
							
							<br><br>
							<div class="form-actions" align="right">                                						
								<button type="submit" class="btn btn-success">
									<i class="fa fa-check"></i> Grabar
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		</div>
     	
	<?php

}
function form_terminos($mysqli, $id){

	if ($id>0){
		$rs = $mysqli->query("select * from tb_terminos  where  id_contenido='1'");
		$rows = $rs->fetch_assoc();

		$contenido = $rows['contenido'];
		$foto1 = $rows['foto1'];
		
	}
	?>	
	<div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Términos y condiciones</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="../index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Términos y condiciones</li>
			</ol>
		</div>
	</div>
        <div class="content-body"><!-- Description -->
	
	
	      <div class="col-md-12">
			<div class="card">
				
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="card-text">
							<p>Información de página términos y condiciones</p>
						</div>
						<form class="m-t" role="form" action="act.php" method="post" enctype="multipart/form-data">
						   <input type="hidden" name="id" id="id" value="<?=$id?>">
						   <input type="hidden" name="tb_cc" id="tb_cc" value="2">						
						   <div class="form-actions" align="right"></div>						
							 <div class="form-body">														
								<div class="form-group  row"><label class="col-sm-12 col-form-label">Contenido</label></div>
								<div class="form-group  row"><div class="col-sm-12"><textarea  id="elm1" name="terminos"><?=$contenido?></textarea></div></div>											
																			
								<div class="form-group  row"><label class="col-sm-12 col-form-label">Fotografía</label></div>
								<div class="form-group  row"><div class="col-sm-6"><input type="file" name="foto1" id="foto1" class="form-control"></div></div>											
							</div>
							<br><br>
							
							<div class="form-body">														
								<div class="form-group  row"><div class="col-sm-6"><?php 	if ($foto1!=NULL){ ?><img src="img/<?=$foto1?>" width="100%" ><?php } ?></div></div>											
							</div>
							
							
							<br><br>
							<div class="form-actions" align="right">                                						
								<button type="submit" class="btn btn-success">
									<i class="fa fa-check"></i> Grabar
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		</div>
     	
	<?php

}
function lista_fotos($mysqli){
    ?>	
    <div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Galería</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="<?_GetDomain?>index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Galería</li>
			</ol>
		</div>
	</div>
    <div class="content-body">
        <div class="row">
            <div class="col-12">
                <div class="card">						
                    <div class="card-content">
                        <div class="card-body card-dashboard">
                            <table width="100%" border="0">
                            <tr>
                                <td><p class="card-text">Información de galería</p></td>
                                <td align="right"><a href="formulario.php?p=1&id=0" class="btn btn-info" style="padding:3px" title="Editar"> + Agregar</a> </td>
                            </tr>
                            </table>

                        </div>
                        <div class="table-responsive">
                            <table class="table table-bordered mb-0">
                                <thead>
                                    <tr>			
										<th width="80%">Imagen</th>									
                                        <th width="20%" align="center">Acción</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php
                                $i=1;
                                
								$rs = getFotos($mysqli);
								while ($rows = $rs->fetch_assoc()){
								    $id_serial = $rows['id_serial'];
									$foto      = $rows['foto'];
									?>
                                    <tr>                                        
                                        <td><img src="fotos/<?=$foto?>" width="100px"></td>
                                        <td align="center">                                       
                                            <a href="formulario.php?p=1&id=<?=$id_serial?>" class="btn btn-warning" style="padding:5px"  title="Editar"> <i class="ri-pencil-fill"></i></a>&nbsp;&nbsp;
											<a href="#" class="btn btn-danger" style="padding:5px" title="Eliminar"  data-bs-toggle="modal" data-bs-target="#exampleModal<?=$i?>"> <i class="ri-delete-bin-line"></i></a>                                   		
                                        </td>
                                    </tr>
									<div class="modal" tabindex="-1" role="dialog" id="exampleModal<?=$i?>">
										<div class="modal-dialog" role="document">
										<div class="modal-content">
											<div class="modal-header">
											<h5 class="modal-title">Eliminar fotografía</h5>
											<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
												<span aria-hidden="true">&times;</span>
											</button>
											</div>
											<div class="modal-body">
											<p>¿Está seguro de eliminar este registro?</p>
											</div>
											<div class="modal-footer">
											<button type="button" class="btn btn-danger" onclick="proc_elim(3,'<?=$id_serial?>')">Si, eliminar</button>
											<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>
											</div>
										</div>
										</div>
									</div>
									<?php
									$i++;
								}
								?>	                                    											
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	
    <?php
} 

function formulario_fotos($mysqli, $id){

	if ($id>0){
		$rs = $mysqli->query("select * from tb_fotos_gale  where  id_serial='$id'");
		$rows = $rs->fetch_assoc();
		$foto = $rows['foto'];
		
	}
	?>	
	<div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Galería</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="../index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Galería</li>
			</ol>
		</div>
	</div>
        <div class="content-body"><!-- Description -->
	      <div class="col-md-12">
			<div class="card">
				
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="card-text">
							<p>Información de galería</p>
						</div>
						<form class="m-t" role="form" action="act.php" method="post" enctype="multipart/form-data">
						   <input type="hidden" name="id" id="id" value="<?=$id?>">
						   <input type="hidden" name="tb_cc" id="tb_cc" value="3">						
						   <div class="form-actions" align="right"></div>						
							 <div class="form-body">														
																			
								<div class="form-group  row"><label class="col-sm-12 col-form-label">Fotografía</label></div>
								<div class="form-group  row"><div class="col-sm-6"><input type="file" name="foto1" id="foto1" class="form-control"></div></div>											
							</div>
							<br><br>
							
							<div class="form-body">														
								<div class="form-group  row"><div class="col-sm-6"><?php if ($foto!=NULL){ ?><img src="fotos/<?=$foto?>" width="100%" ><?php } ?></div></div>											
							</div>
							
							
							<br><br>
							<div class="form-actions" align="right">
							    <a href="index.php?p=3" class="btn btn-warning"><i class="ft-x"></i> Volver</a>                                						
								<button type="submit" class="btn btn-success">
									<i class="fa fa-check"></i> Grabar
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		</div>
	<?php
}

function form_contacto($mysqli, $id){
	if ($id>0){
		$rs = $mysqli->query("select * from tb_contacto  where  id_serial='1'");
		$rows = $rs->fetch_assoc();
		$telefonos = $rows['telefonos'];
		$email = $rows['email'];
		$facebook = $rows['facebook'];
		$instagram = $rows['instagram'];
		$youtube = $rows['youtube'];
	}
	?>	
	<div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Información de Contacto</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="../index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Contacto</li>
			</ol>
		</div>
	</div>
        <div class="content-body"><!-- Description -->
	      <div class="col-md-8 offset-2">
			<div class="card">
				
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="card-text">
							<p>Información de contacto</p>
						</div>
						<form class="m-t" role="form" action="act.php" method="post" enctype="multipart/form-data">
						   <input type="hidden" name="id" id="id" value="<?=$id?>">
						   <input type="hidden" name="tb_cc" id="tb_cc" value="4">						
						   <div class="form-actions" align="right"></div>						
							 <div class="form-body">														
								<div class="form-group  row">
									<label class="col-sm-3 col-form-label">Teléfonos</label>
									<div class="col-sm-9"><input type="text" class="form-control" name="telefonos" id="telefonos" value="<?=$telefonos?>"></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">E-mail</label>
									<div class="col-sm-9"><input type="text" class="form-control" name="email" id="email" value="<?=$email?>"></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">Facebook</label>
									<div class="col-sm-9"><input type="text" class="form-control" name="facebook" id="facebook" value="<?=$facebook?>"></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">Instagram</label>
									<div class="col-sm-9"><input type="text" class="form-control" name="instagram" id="instagram" value="<?=$instagram?>"></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">Youtube</label>
									<div class="col-sm-9"><input type="text" class="form-control" name="youtube" id="youtube" value="<?=$youtube?>"></div>
							 	</div>											
							</div>												
																			
							
							<br><br>
							
							<div class="form-actions" align="right">                                						
								<button type="submit" class="btn btn-success">
									<i class="fa fa-check"></i> Grabar
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		</div>
	<?php
}

function form_etiquetas($mysqli, $id){
	if ($id>0){
		$rs = $mysqli->query("select * from tb_etiquetas  where  id_serial='1'");
		$rows = $rs->fetch_assoc();
		$titulo = $rows['titulo'];
		$descripcion = $rows['descripcion'];
		$keywords = $rows['keywords'];
		
	}
	?>	
	<div class="page-title-box d-flex align-items-center justify-content-between">
		<h4 class="mb-0">Etiquetas</h4>
		<div class="page-title-right">
			<ol class="breadcrumb m-0">
				<li class="breadcrumb-item"><a href="../index.php">Escritorio</a></li>
				<li class="breadcrumb-item active">Etiquetas</li>
			</ol>
		</div>
	</div>
        <div class="content-body"><!-- Description -->
	      <div class="col-md-10 offset-1">
			<div class="card">
				
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="card-text">
							<p>Información de etiquetas</p>
						</div>
						<form class="m-t" role="form" action="act.php" method="post" enctype="multipart/form-data">
						   <input type="hidden" name="id" id="id" value="<?=$id?>">
						   <input type="hidden" name="tb_cc" id="tb_cc" value="5">						
						   <div class="form-actions" align="right"></div>						
							 <div class="form-body">														
								<div class="form-group  row">
									<label class="col-sm-3 col-form-label">Título</label>
									<div class="col-sm-9"><textarea name="titulo" id="titulo" class="form-control" rows="3"><?=$titulo?></textarea></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">Descripción</label>
									<div class="col-sm-9"><textarea name="descripcion" id="descripcion" class="form-control"  rows="5"><?=$descripcion?></textarea></div>
							 	</div>
								 <div class="form-group  row" style="margin-top: 10px;">
									<label class="col-sm-3 col-form-label">Keywords</label>
									<div class="col-sm-9"><textarea name="keywords" id="keywords" class="form-control"  rows="13"><?=$keywords?></textarea></div>
							 	</div>																		
							</div>												
																			
							
							<br><br>
							
							<div class="form-actions" align="right">                                						
								<button type="submit" class="btn btn-success">
									<i class="fa fa-check"></i> Grabar
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		</div>
	<?php
}
?>          
