<?php
	require_once(__DIR__ . "/../config/DB/Database.php");
	require_once(__DIR__ . "/../modelos/usuario.php");
	$usuario = new usuario();
	$users_list = $usuario->index();
	?>

	<!-- Modal -->
	<div class="modal fade" id="nuevoCliente" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel"><i class='glyphicon glyphicon-edit'></i> Agregar nuevo cliente</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" method="post" id="guardar_cliente" name="guardar_cliente">
						<div id="resultados_ajax"></div>
						<div class="form-group">
							<label for="nombre" class="col-sm-3 control-label">Cliente</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="nombre" name="nombre" required>
							</div>
						</div>
						<div class="form-group">
							<label for="telefono" class="col-sm-3 control-label">Población</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="telefono" name="telefono">
							</div>
						</div>



						<div class="form-group">
							<label for="direccion" class="col-sm-3 control-label">Direccion</label>
							<div class="col-sm-8">
								<textarea class="form-control" id="direccion" name="direccion" maxlength="255"></textarea>

							</div>


						</div>

						<div class="form-group">
							<label for="email" class="col-sm-3 control-label">Promotor Asignado</label>
							<div class="col-sm-8">
								<select class="form-control" id="email" name="email" required>
									<option selected disabled value="0">Seleccionar Promotor</option>
									<?php foreach ($users_list as $user) : ?>
										<option value="<?php echo $user->user_id; ?>">
											<?php echo $user->firstname . ' ' . $user->lastname; ?>
										</option>
									<?php endforeach; ?>
								</select>
								<input id="email" type='hidden'>
							</div>
						</div>



						<div class="form-group">
							<label for="estado" class="col-sm-3 control-label">Estado</label>
							<div class="col-sm-8">
								<select class="form-control" id="estado" name="estado" required>
									<option selected disabled value="99">-- Selecciona estado --</option>
									<option value="1">Activo</option>
									<option value="0">Inactivo</option>
								</select>
							</div>
						</div>
						
							<div class="form-group">
							<label for="tnegocio" class="col-sm-3 control-label">Tipo de negocio</label>
							<div class="col-sm-8">
								<select class="form-control" id="tnegocio" name="tnegocio" required>
									<option selected disabled value="99">-- Selecciona tnegocio --</option>
									<option value="CDC">CDC</option>
									<option value="LICORERIA">LICORERIA</option>
									<option value="MEDIO MAYORISTA">MEDIO MAYORISTA</option>
									<option value="MAYORISTA">MAYORISTA</option>
								</select>
							</div>
						</div>




				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
					<button type="submit" class="btn btn-primary" id="guardar_datos">Guardar datos</button>
				</div>
				</form>
			</div>
		</div>
	</div>