<?php

session_start();
require('../../Operaciones/Admin_operacion.php');
if(isset($_SESSION['Login'])){
	$Id	=$_SESSION['Login'];
}else {
	session_start();
	session_destroy();
	header('location: ../index.php?error=acceso');
}
$Id_Reg=$_POST['idReg'];
$datoA = new Admin_P();
$dato = $datoA->UsrAut($Id_Reg);

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
	#Pantalla {
		margin: 0px auto;
		padding: 15px;
	}
</style>
</head>

<body>
<div id="Pantalla">
<form id="Edit_Auto">
<table class="customers">
   <tbody>
    <tr>
      <th colspan="2">.:  Personal Autorizado :.
        <input type="hidden" name="Opc" id="Opc" value="1"><input type="hidden" name="Id_Reg" id="Id_Reg" value="<?= $Id_Reg ?>"></th>
    </tr>
    <tr align="center">
      <td colspan="2"></td>
      </tr>
    <tr>
      <td width="130">Apellido Paterno * :</td>
      <td width="62"><input type="text" name="A_Paterno" id="A_Paterno" max="50" maxlength="50" value="<?= $dato['Apellido_P']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Apellido Materno * :</td>
      <td><input type="text" name="A_Materno" id="A_Materno" max="50" maxlength="50" value="<?= $dato['Apellido_M']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Nombre * :</td>
      <td><input type="text" name="Nombre" id="Nombre" max="50" maxlength="50" value="<?= $dato['Nombre']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Dirección :</td>
      <td><input type="text" name="Direcc" id="Direcc" max="300" maxlength="300" placeholder="Max 300 caracteres" value="<?= $dato['Direccion']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Col :</td>
      <td><input type="text" name="Col" id="Col" max="30" maxlength="30" value="<?= $dato['Col']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Municipio :</td>
      <td><?= $datoA->MuniSelect($dato['IdMpio']) ?> </td>
    </tr>
    <tr>
      <td>C.P. :</td>
      <td><input type="text" name="Cp" id="Cp" max="5" maxlength="5" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"  value="<?= $dato['Cp']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Teléfono :</td>
      <td><input type="text" name="Tel" id="Tel" max="10" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"  maxlength="10" value="<?= $dato['Telefono']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Correo :</td>
      <td><input type="text" name="Correo" id="Correo" max="70" maxlength="70" value="<?= $dato['Correo']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td>Institucional :
        <input type="checkbox" name="ActInst" id="ActInst">
        <label for="checkbox"> </label></td>
      <td><input type="text" name="Inst" id="Inst" max="70" maxlength="70" value="<?= $dato['Institucion']?>" autocomplete="off" readonly></td>
    </tr>
    <tr>
      <td>Cargo :</td>
      <td><input type="text" name="Cargo" id="Cargo" max="70" maxlength="70" value="<?= $dato['Cargo']?>" autocomplete="off"></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><button type="button" onClick="ActAut(<?= $Id_Reg ?>)">Actualizar</button></td>
      </tr>
   </tbody>
</table>
</form>
</div>
	<script>
		
		document.querySelector('#ActInst').addEventListener("click",(e)=>{
			const Inst_=document.querySelector('#Inst');
				Inst_.value='';
			if(document.querySelector('#ActInst').checked){
				Inst_.readOnly=false
				Inst_.placeholder='Captura el Instituto Max 70';
			}else{
				Inst_.readOnly=true;
				Inst_.placeholder='';
			}
		})
	</script>
</body>
</html>