<?php
if (isset($conexion)) {
    ?>
	<div id="nuevoPaciente" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title"><i class='fa fa-edit'></i> Nuevo Miembro</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" method="post" id="guardar_paciente" name="guardar_paciente">
						<div id="resultados_ajax"></div>
						<div class="row">
							<div class="col-md-6">
								<div class="form-group">
									<label for="nombre" class="control-label">Nombres:</label>
									<input type="text" class="form-control UpperCase" id="nombre" name="nombre" autocomplete="off" required>
								</div>
							</div>
							<div class="col-md-6">
								<div class="form-group">
									<label for="apellido" class="control-label">Apellidos:</label>
									<input type="text" class="form-control UpperCase" id="apellido" name="apellido" autocomplete="off" required>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-md-12">
								<div class="form-group">
									<label for="direccion" class="control-label">Direcci&oacute;n:</label>
									<textarea class="form-control UpperCase"  id="direccion" name="direccion" maxlength="255" autocomplete="off"></textarea>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-md-4">
								<div class="form-group">
									<label for="tipo" class="control-label">Familia:</label>
									<select class="form-control" id="family" name="family" onchange="showDiv(this)">
										<option value="">-- Selecciona --</option>
										<?php

    $query_family = mysqli_query($conexion, "select * from familias order by nombre");
    while ($rw = mysqli_fetch_array($query_family)) {
        ?>
													<option value="<?php echo $rw['id_familia']; ?>"><?php echo $rw['nombre']; ?></option>
													<?php
}
    ?>
									</select>
								</div>
							</div>
							<div class="col-md-4">
								<div class="form-group">
									<label for="telefono" class="control-label">Telefono</label>
									<input type="text" class="form-control" id="telefono" name="telefono" autocomplete="off" required>
								</div>
							</div>
							<div class="col-md-4">
								<div class="form-group">
									<label for="documento" class="control-label">C&eacute;dula</label>
									<input type="text" class="form-control" id="documento" name="documento" autocomplete="off">
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-md-6">
								<div class="form-group">
									<label for="nacimiento" class="control-label">Fecha de Nacimento</label>
									<input type="date" class="form-control" id="nacimiento" name="nacimiento" required>
								</div>
							</div>
							<div class="col-md-6">
								<div class="form-group">
									<label for="sexo" class="control-label">Sexo:</label>
									<select class="form-control" id="sexo" name="sexo" required>
										<option value="">-- Selecciona --</option>
										<option value="1" selected>Masculino</option>
										<option value="0">Femenino</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-md-8">
								<div class="form-group">
									<label for="encargado" class="control-label">Email:</label>
									<input type="email" class="form-control" id="email" name="email" autocomplete="off">
								</div>
							</div>
							<div class="col-md-4">
								<div class="form-group">
									<label for="estado" class="control-label">Estado:</label>
									<select class="form-control" id="estado" name="estado" required>
										<option value="">-- Selecciona --</option>
										<option value="1" selected>Activo</option>
										<option value="0">Inactivo</option>
									</select>
								</div>
							</div>
						</div>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-secondary btn-rounded waves-effect" data-dismiss="modal">Cerrar</button>
						<button type="submit" class="btn btn-primary btn-rounded waves-effect waves-light" id="guardar_datos">Guardar</button>
					</div>
				</form>
			</div>
		</div>
	</div><!-- /.modal -->
	<?php
}
?>