<style>.form-horizontal .form-group {
    margin-right: 0;
    margin-left:0;
}</style>
<div class="header-heading">
	<div class="container">
		<h1>Candidate Info</h1>
		<div class="heading-icon">
			<img src="<?= HTTP_ICON_PATH;?>icon-user.png" alt="" />
		</div>
	</div>
</div>
<?php $age_date  = date('Y-m-d', strtotime('-12 year'));?>
<div class="container container-top" style="min-height:400px;">

	<div class="col-sm-6" style="margin:auto;float:none;background-color: #f5f6d4;padding: 35px;">
		<div class="row">
			<form id="student_login" class="form-horizontal" action="form">
				 
				<div class="col-sm-12">
						<div class="form-group form-group-margin">
							 <label for="inputFirstname" class="no-mobile-display">Name</label>
							 <input type="text" name="f_name" value="" class="form-control ajax-convert-lable field-required "  id="f_name" placeholder="Name">
						</div>
					</div>
				 
				<div class="col-sm-12">
					<div class="form-group form-group-margin">
						 <label for="inputLastname" class="no-mobile-display">Father Name</label>
						 <input type="text" name="l_name" value="" class="form-control ajax-convert-lable field-required " id="l_name" placeholder="Father Name">
					</div>
				</div>
			 
				 <div class="col-sm-12">
					<div class="form-group form-group-margin">
						<label for="inputUserage" class="no-mobile-display">Date of Birth</label>
						<input style="padding:0;" type="date" name="age" value="" class="form-control ajax-convert-lable field-required " data-placeholder="Age" id="age" placeholder="">
					</div>
				</div>
				 
				<div class="col-sm-12">
					<div class="form-group form-group-margin gender">
						<label for="inputGender" class="no-mobile-display">Gender </label><br>
						<label class="label-male">
							<input style="margin-right:5px;" type="radio" name="optradio" value="Male" checked>Male</label> 
						<label style="margin-left:15px;" class="label-female">
							<input style="margin-right:5px;" type="radio" name="optradio" value="Female">Female</label>
					</div>
				</div>
				<div class="col-sm-12">
					<div class="form-group form-group-margin gender">
						<label for="inputGender" class="no-mobile-display">You can choose your preferred language for this test.</label><br>
						<label class="label-male">
							<input style="margin-right:5px;" type="radio" name="language" value="1" checked>English</label> 
						<label style="margin-left:15px;" class="label-female">
							<input style="margin-right:5px;" type="radio" name="language" value="2">Hindi</label>
					</div>
				</div>	
			 
				<div class="col-sm-12">
					<div class="text-right">
					<a  class="btn btn-lg btn-primary CustomBtn" type="submit">Next</a>
					</div>
				</div>
			</form>
		
		
		</div>	 
	</div>

</div>

<script>
	$(document).on('click','#IsAcceptTest',function(){
		$(this).attr('disabled',true);
		window.location.href=HTTP_PATH +'students/accept_test';
		
	});
	var js_date='<?=$age_date?>';
	
	$(document).on('focusout','#age',function(){
		var age=$.trim($('#age').val());
		if(age!=""){
			if(js_date < age){				
				alert('<?=$this->lang->line('msg_kid')?>');
				$('#age').val('');
			}
		}
	});
	
	$(document).on('click','.CustomBtn',function(){
		var age=$.trim($('#age').val());
		
		if($('#f_name').val()=="" || $('#l_name').val()=="" || age==""){
			alert('All fields are required');
		}else if(js_date < age){
			alert('<?=$this->lang->line('msg_kid')?>');
			$('#age').val('');
		}else{
			var data = $("#student_login").serialize();
				
			$.ajax({
				url: HTTP_PATH+"students/profile",
				data: data,
				type: "POST",
				dataType : "JSON",
				success: function(msg) {
					var data = msg;
					 
					if(data['success']==true){						 
							window.location.href = HTTP_PATH +'students';
						 
					}				
				}
			});
		}
	});
	
 
</script>