<?php include('casa/setup.casa.php');
$titulo = 'Crear Registro Nuevo Cliente';
include('inc_head.php');
?>
<style>
.input-group-text{
	color:white;
	text-align:left;
	font-weight:bold;
}	
</style>
</head>
<body>
	<div class="wrapper">
	
	<?php include('inc_menu.php');?>

		<div class="main-panel">
			<div class="content">
				
				<div class="page-inner">						
				<div class="row">
					<div class="col-md-12">
						<form>
							<div class="card">
								<div class="card-header">
									<div class="card-title"><?php echo $titulo;?></div>
								</div>
								<div class="card-body">
									<div class="row">										
										<div class="col-md-4">														
											<div class="form-group">
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Nombres:</span></div>												
													<input id='txtNombre' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Apellidos:</span></div>												
													<input id='txtApellidos' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">C.I.:</span></div>												
													<input id='txtCI' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Celular:</span></div>												
													<input id='txtCelular' type="text" class="form-control">
												</div>																																																																																																																																																																																																																																												
											</div>																																																						
										</div>		
										<div class="col-md-4">														
											<div class="form-group">
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">M2:</span></div>												
													<input id='txtM2' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Lote:</span></div>												
													<input id='txtLote' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Modalidad:</span></div>												
													<input id='txtModalidad' type="text" class="form-control">
												</div>																																																																																																											
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Promo:</span></div>												
													<input id='txtPromo' type="text" class="form-control">
												</div>																																																																																																																																																																																																																																												
											</div>																																																						
										</div>																													
										<div class="col-md-4">														
											<div class="form-group">																																																																																																																				
												<div class="input-group mb-2">													
													<div class="input-group-prepend">
														<span class="input-group-text bg-dark">Fecha Limite de Aviso:</span></div>												
														<select id="txtFechaLimite" class="form-control">
															<option value="">Seleccionar Fecha limite</option>
															<?php 
															for($i=1;$i<31;$i++){
																echo '<option id="'.$i.'">'.$i.'</option>';
															}
															?>
														</select>
												</div>																																																																																																																																																																																																																																												
											</div>																																																						
										</div>
									</div>
								</div>
								<div class="card-action"><center>
									<div id='res'></div>
									<a href='<?php echo PATH_HOME.'clientes/listado'; ?>' class="btn btn-info"><b> CANCELAR </b></a>
									<button class="btn btn-dark" type='submit'><b> GUARDAR DATOS </b></button>	</center>								
								</div>
							</div>
						</form>
						</div>
					</div>
				</div>
				
			</div>
			<?php include('inc_pie.php');?>
		</div>
		
		
	</div>
</body>
</html>
<script>
$('form').on('submit', function(event) {
  event.preventDefault();

  $.post('<?php echo PATH_HOME.'clientes-ins2/'. sha1(uniqid()); ?>',{
	 'txtNombre': $('#txtNombre').val(), 
	 'txtApellidos': $('#txtApellidos').val(), 
	 'txtCI': $('#txtCI').val(), 
	 'txtCelular': $('#txtCelular').val(), 
	 'txtM2': $('#txtM2').val(), 
	 'txtLote': $('#txtLote').val(), 
	 'txtModalidad': $('#txtModalidad').val(), 
	 'txtPromo': $('#txtPromo').val(), 
	 'txtFechaLimite': $('#txtFechaLimite').val(), 	 
	 'MxEncoder': '<?php echo sha1(uniqid()); ?>'
  },function(data){
    $('#res').html(data);
  });  
});
</script>