<?php 
	include_once("../view/header-footer/header.php");   
	include_once("../all-ajax/General-header.php");   
?>     
<!--<script src="https://www.google.com/recaptcha/api.js" async defer></script>-->
<script>  
var loc_val = new Array();
var loc_id = new Array();
var loc_ct = 0;
$(document).ready(function()
{ 
    var reg_cnt="<?php echo $val; ?>";
    if(reg_cnt==1)
    {
        $("#registerfrm2").show();
        $("#registerfrm1").hide();
    }
    else 
    {
      $("#registerfrm1").show();
      $("#registerfrm2").hide();
    }
    
    $("#registerfrm1").validate({ 
			
			errorElement:'div',
			rules:{ 
		     Reg_name:{
				 required:true,
				 minlength:3,
				 maxlength:35
				},	

			Reg_email:{
				required: true,
				email: true,
				remote: URL+"/all-ajax/value_check.php"
				},

		     Reg_mob:{
                    required:true,
				    number:true,
				    minlength:10,
				    maxlength:10,					
                    remote: URL+"/all-ajax/value_check.php"					 
                },
				
			Reg_password: {
                 required:true,
                 minlength:5 
                },
				
			Reg_Userterms:{
				 required:true				
				}/*,

            entered_OTP:{
                    required:true,
				    number:true				    			 
               }*/				
			},
			messages:{	

				Reg_name:{					
                  required:"Please enter name",
				  minlength : "Please enter minimum 3 characters name",
				  maxlength : "Max 35 characters are allowed"  					
				},   
				
				Reg_email:{
				 required:"Please enter email id",	
				 remote: "This email is already registered"							
				}, 
				
				Reg_mob:{
				required:"Please enter mobile no",	
				minlength : "Please enter minimum 10 digits",
				maxlength : "Max 10 digits are allowed",
				remote: "This number is already registered"				
			   },
			   
			   Reg_password:{
				required:"Please enter Password",
				minlength : "Please enter minimum 5 charaters"
			   },
			   
			   Reg_Userterms:{					
                  required:"Please select terms and conditions"				  		
				}/*,

               entered_OTP:{
				 required:"Please enter an OTP"					
			   }*/			   
            }			  
		});	
    
    
    
    $("#show_Regpwd").click(function() 
	{
		if($(this).hasClass('fa fa-eye-slash'))
		{           
			$(this).removeClass('fa fa-eye-slash');
			$(this).addClass('fa fa-eye');
            $('#Reg_password').attr('type','password');			
		}
		else
		{ 
		  $(this).removeClass('fa fa-eye');  
		  $(this).addClass('fa fa-eye-slash');
		  $('#Reg_password').attr('type','text'); 
		}
    });	
    
    $("#job-category-sugeetion").hide();
	$("#job-category").click(function()
	{
		//$(this).next().slideDown(); 
			job_cat_set = 0;
	});
    
    $("#job-category").keyup(function() 
	{  
		//$("#job-role-ul").hide();
		
		$("#job-sub-category").hide();
		$("#job-sub-category").html('');
		$("#job_cat_val").val('');
		$.ajax({	
			type: "POST",
			url: URL+"/all-ajax/job.php", 
			data: {select_job_categoryProfile:1,keyword:$(this).val()},
			beforeSend: function(){ 
			},
			success: function(data)
			{  
				var obj = jQuery.parseJSON(data);  
				if(obj==null || obj=='null')
				{  
					$("#job-category-sugeetion").hide(); 
					$("#job-category-sugeetion-ajax").hide();
					//$("#job-role-ul").show();		
				}else
				{  	
					source_first_name = obj[0].name; 
					source_list = '<ul class="menu-box">'; 
					
					for(i=0;i<obj.length;i++)			  
					source_list +='<a href="javascript:void(0)"><li onclick=select_role_post_job("'+encodeURIComponent(obj[i].catName)+'","'+obj[i].id+'","'+obj[i].originId+'") >'+obj[i].name+'</li></a>' 
					
					source_list +='</ul>';   
					 
					$("#job-category-sugeetion-ajax").show();
					$("#job-category-sugeetion-ajax").html(source_list);
                    $("#job-category-sugeetion").hide();					
				}   
				
			}
		}); 
	});
	
	$("#registerfrm1").submit(function(event)  
	{ 	 
	    $("#Reg_SuccessMsg").html("");
		$("#Reg_msg").html(""); 
		if ($('#registerfrm1').valid())  
		{ 
		    $( "#submit_UserReg" ).addClass("disableloginbtn" );    
		    if($("#job_cat_val").val()=='')
            {
                $("#submit_UserReg").removeClass("disableloginbtn"); 
                $("#job-category").val('');
                alert("Kindly Select Job Preferences");
                event.preventDefault();
            }
            else
            {
                $.ajax({	
                type: "POST",
                url: URL+"/all-ajax/login-ajax.php",
                data: {check_UserOTP_count:1,registered_mob:$("#Reg_mob").val()},
                beforeSend: function(){ 
                    $('#submit_UserReg').addClass('disableloginbtn');
                },
                success: function(val)
                {
                    if(val==3)
                    {
                        $("#Reg_msg").html("Your today's OTP limit has been exceeded");
                        $("#Reg_mob").val("");
                        $("#registerfrm1").validate().resetForm();
                        $('#submit_UserReg').removeClass('disableloginbtn');
                        $.ajax({	
                			type: "POST",
                			url: URL+"/all-ajax/login-ajax.php",
                			data: {unset_UserReg:1},	
        					beforeSend: function(){
        					},
                            success: function(val)
                            {
                            }  
                		});
                    }      
                    else if(val==1)
                    {
                		var formData = $('#registerfrm1').serialize();  // i have taken all form in serialized format here...
                		$.ajax({	
                			type: "POST",
                			url: URL+"/all-ajax/login-ajax.php",
                			data: {check_UserReg:1,formData:formData},	
                					beforeSend: function(){
                						$('#submit_UserReg').addClass('disableloginbtn');
                					},
                				  success: function(val)
                				  { 			  
                				     $('#submit_UserReg').removeClass('disableloginbtn');
                					if(val==1)
                					{
                                        $("#RegEntered_OTP_label").html("Enter OTP which is sent to "+$("#Reg_mob").val());
                						$("#registerfrm1").hide();
                						$("#registerfrm2").show();
                						$("#Reg_resendOTP").show();
                						$("#Reg_div").hide(); 	
                						/*var timeLeft = 30;
                						var elem = document.getElementById('Reg_div');
                						var timerId = setInterval(countdown2, 1000);
                						function countdown2() {						  
                						  $("#Reg_div").show();
                						  if (timeLeft == 0) {
                						   clearTimeout(timerId);
                						   $("#Reg_resendOTP").show();
                						   $("#Reg_div").hide();
                						  }
                						  else {				
                							elem.innerHTML = timeLeft + ' seconds remaining';
                							timeLeft--;	                				
                						  }			  
                						}*/						
                					}
                					else
                					{
                						if(val==7)
                						{
                							 $("#Reg_msg").html("Some error occured. please try again");
                    						event.preventDefault();  
                							
                						}
                					}				
                				}  
                		    });   
                          }
                        } 
                    });
            }
	    }
	    event.preventDefault();
	});
	
	$("#Regsubmit_OTP").click(function(e) 
	{
		var otpReg = /^\d{4}$/; 
		
		$("#Reg_SuccessMsg").html("");
		$("#Reg_msg").html("");
		
		if( ($("#RegEntered_OTP").val()!='') && ($("#RegEntered_OTP").val().match(otpReg)))
		{ 
            $("#Reg_div").hide();
            $("#Reg_resendOTP").hide();
			$.ajax({	
			type: "POST",
			url: URL+"/custom_function/EmailConfigure.php",
			data: {submit_UserRegOTP:1,RegEntered_OTP:$("#RegEntered_OTP").val()},
			beforeSend: function(){ 
			    $('#Regsubmit_OTP').addClass('disableloginbtn');
			},
			success: function(data)
			{               		
			    $('#Regsubmit_OTP').removeClass('disableloginbtn');
        		$("#Reg_SuccessMsg").html("");
        		$("#Reg_msg").html("");
			   if(data==1)
			   {
			       $("#registerfrm1").show();
                   $("#registerfrm2").hide();
                   $("#Reg_SuccessMsg").html("Registration successfully Done!!!");
                   $("#registerfrm1").validate().resetForm();
                   $("#registerfrm2").validate().resetForm();
			   }
			  else if(data==0)
			  {
			    $("#Reg_div").show(); 
				$("#RegEntered_OTP").val('');
				$("#Reg_msg").html("Wrong OTP!!! Please enter correct OTP");
			  }
			}			
		  });  
		}
		else
		{
			$("#RegEntered_OTP").val('');
			$("#Reg_msg").html("Enter 4 digit number!!!");
			$("#Reg_SuccessMsg").html("");
		}
	}); 
	
	$("#Reg_resendOTP").click(function(e)
	{
	   //$("#Reg_resendOTP").hide();	
	   $("#Reg_SuccessMsg").html("");
	   $("#Reg_msg").html("");
		
	   $.ajax({	
		type: "POST",
		url: URL+"/all-ajax/login-ajax.php",
		data: {check_UserRegOTP:1},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
		    if(data==3)
            {
            	$("#Reg_msg").html("Your today's OTP limit has been exceeded"); 
            	$("#Reg_resendOTP").hide();		
    			$("#Reg_div").hide();
    			
    			$.ajax({	
        			type: "POST",
        			url: URL+"/all-ajax/login-ajax.php",
        			data: {unset_UserReg:1},	
					beforeSend: function(){
					},
                    success: function(val)
                    {
                    }  
        		});
            }
            else if(data==1) 
            {
                $("#Reg_SuccessMsg").html("OTP sent to your number");
    		    /*var timeLeft = 30;
                var elem = document.getElementById('Reg_div');
    			var timerId = setInterval(countdown1, 1000);
    		    function countdown1() {
    			  $("#Reg_div").show();
    			  if (timeLeft == 0) {
    			   clearTimeout(timerId);
    			   $("#Reg_resendOTP").show();
    			   $("#Reg_div").hide();
    			  }
    			  else {				
    				elem.innerHTML = timeLeft + ' seconds remaining';
    				timeLeft--;	                				
    			  }			  
    			}*/	
            }
		  }
	    }); 	
    });
    
});    
    
    function select_loc_id(val) 
    {      
    	var v='';  
    	loc_val.splice(val, 1); 
    	loc_id.splice(val, 1);  
    	 
    	if(loc_val.length > 0)
    	{
    	   var res = loc_id.join(",");  
    	   $("#locations_val").val(res);  
    	
    	  for (var i = 0, len = loc_val.length; i < len; i++) 
    		v += '<a  href=javascript:void(0) onclick=select_loc_id("'+i+'") >'+loc_val[i]+' X </a>';   
    		
    		$("#locality_placed").html(v);   
    	    loc_ct--;
    	}
    	else alert("At least one job preference required");
    }

    function select_role_post_job(name,val,originId) 
    {   
    	new_name =   name.replace(new RegExp("%20", "g"), ' ');     
    	new_name =   new_name.replace(new RegExp("%2F", "g"), ' ');     
    	$("#job-category").val(new_name);
    	$("#job-category-sugeetion-ajax").hide(400);    
    	$("#job-category").next().slideUp();
    	$("#job_cat_val").val(val);
     
    	
        if(loc_id.indexOf(val) < 0)
        {
         	var v='';
        	new_name =   name.replace(new RegExp("%20", "g"), ' ');     
        	new_name =   new_name.replace(new RegExp("%2F", "g"), ' ');     
        	$("#select-sub-locations").val(new_name);
        	$("#job-loction-sugeetion-ajax").hide(400);    
        	$("#select-sub-locations").next().slideUp();  
        	 
        	
        	loc_val.push(new_name); 
        	loc_id.push(val);  
        	var res = loc_id.join(",");   
        	$("#locations_val").val(res);  
        	
        	for (var i = 0, len = loc_val.length; i < len; i++) 
        		v += '<a  href=javascript:void(0) onclick=select_loc_id("'+i+'")  >'+loc_val[i]+' X </a>';
        	 
        	
        	$("#locality_placed").html(v);
        	$("#job-category").next().slideUp();
        	$("#job-category").val(''); 
        	 
        	loc_ct++;  
    	 
        }
        else
    	{
    	    $("#select-sub-locations").next().slideUp();
    	    $("#job-loction-sugeetion-ajax").hide(); 
    	    $("#job-category").val('');
    		alert("Role already added!");
    	}
    }
    
    function get_first_name(val,type)
    {
        var regex = /^[a-zA-Z ]*$/;  
       
        if(type==1)
        {
            if(!val.match(regex))
            {
    		   $("#Reg_msg").html("name allow only alphabets and spaces");
               $('#Reg_name').val('');
            }
        }
    }
    
    

</script> 
<div class="clearfix"></div>



<div class="inner-head">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
<h2>Register Here</h2>
            </div>
        </div>
    </div>
</div>


<div class="container">
        <div class="row">
        <div class="col-md-12 p0">

 

 
 
<div id="body">
<div class="wrapper"> 
<div class="col-md-9 bottom">
    <div class="white-box" style="padding:0 20px">
        <div id="dataRight" class="noRightBor job-filter">
        	<ul class="resList resList">
                <li class="completeProf">
                	<!--<h3 class="postJob"></h3>-->	
                	<?php 
                    
                   /* if($_SESSION['$msg']){ ?><h4 class="postJob"><?php echo $_SESSION['$msg'];?></h4>
                    <?php unset($_SESSION['$msg']); }*/ ?>
                    <h4 id="Reg_SuccessMsg" style="color:green;"></h4>
                    
                    <span id="Reg_msg" style="color:red;"></span>
                    
                    <form method="post"  id="registerfrm1" autocomplete="off" enctype="multipart/form-data" ><!--action="<?php echo ROOTPATH;?>/custom_function/EmailConfigure.php" -->  <br>
                	<div class="row postJobForm p-2">
                		<div class="floating-label botLine feild-group">
                			<input type="text" name="Reg_name"  id="Reg_name"  onchange="get_first_name(this.value,1);" Placeholder="" value="" class="salary floating-input mob num inputText">
                				<label>Name</label>
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                			<input type="text"  name="Reg_email"  id="Reg_email" Placeholder="" value=""   class="salary floating-input mob num inputText">
                			<label>Email ID</label>
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                			<input type="text"  name="Reg_mob"  id="Reg_mob" value="" Placeholder=""  class="salary floating-input mob num inputText">
                			<label>Mobile No</label>
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                		    <a href="javascript:void(0);" id="Reg_pwd"><i id="show_Regpwd" class="fa fa-eye" aria-hidden="true"></i></a>
                			<input type="text"  maxlength="30" name="Reg_password" id="Reg_password" value="" Placeholder="" class="salary floating-input mob num inputText">
                			<label>Password</label>
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                		    <input type="text"  name="profile_city_search"  id="profile_city_search" Placeholder="" value="Nashik"   class="salary floating-input mob num inputText" readonly>
                			<label>City</label>
                		</div>    
                		
                		<div class="floating-label botLine feild-group">
                			<input type="text"  id="job-category"  name="job_category" value="" Placeholder=""  class="salary floating-input mob num inputText">
                			<label>Job Preferences eg Marketing, IT Software</label>
                			<div class="clearfix"></div>
                			<ul id="job-category-sugeetion" class="menu-box-2"></ul> 
            			    <div id="job-category-sugeetion-ajax"></div> 
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                		    <input type="hidden"  id="locations_val" name="locations_val"  value=""/>
                            <input type="hidden" id="job_cat_val" name="job_cat_val" value=""/>
                            <span id="locality_placed" class="local-tabs"> </span>
                		</div>
                		
                		<div class="floating-label botLine feild-group">
                			<input class="checkBox" type="checkbox" name="Reg_Userterms" value="1" id="Reg_Userterms"/> <span class="iam" id="iam">I am agree with the <a href="<?php echo ROOTPATH;?>/UserServices/terms_use.php" target="_blank"   > <u>terms and conditions</u></a></span>
                		</div>
                		<!--<div class="col-lg-12 feild-group p0">
                		    <div class="g-recaptcha" data-sitekey="6LexB94ZAAAAAFuIJeyhdCZ5hOpCX4PFG3aNNWac"></div>
                		</div>-->
                		<div class="col-lg-12 feild-group p0">
                			<input type="submit"   name="submit_UserReg"  value="Create Account"  id="submit_UserReg"   class="btn btn-feedback">
                		</div>
                	</div>	
                	</form>
                	
                	<form method="post"  id="registerfrm2" autocomplete="off" enctype="multipart/form-data" ><br>
                	<div class="row postJobForm p-2">	
                		<div class="floating-label botLine feild-group">
                			<input type="text"  name="RegEntered_OTP"  id="RegEntered_OTP" Placeholder="" value=""   class="salary floating-input mob num inputText">
                			<label id="RegEntered_OTP_label">Enter OTP</label>
                			
                			<span id="Reg_div"></span>
                            <center><a href="javascript:void(0);" id="Reg_resendOTP">Resend OTP</a></center>
                		</div>
                		
                		<div class="col-lg-12 feild-group p0">
                			<input type="button"   name="Regsubmit_OTP"  value="Submit"  id="Regsubmit_OTP"   class="btn btn-feedback">
                		</div>
                    </div>
                    </form>
                </li> 
            </ul>
        </div>
        
        <div class="clearfix"></div>
     </div>
   </div>
   <div class="col-md-3">
       <h2 style="color: #c30043;">Get in Touch with us</h2>
       <p>Feel free to get in touch with us</p>
<img src="<?php echo ROOTPATH;?>/view/images/contactus.jpg" alt="Netbuttrfly Images" class="img-responsive img"  width="80%" style="margin-top:0px;">
</div>
<div class="col-md-3 white-box" style="margin-top:20px;padding-left:20px;">
 
<p style="padding:0 7px"><font style="font-size:16px;"><i class="fa fa-envelope"></i> support@netbuttrfly.com<br><i class="fa fa-phone" aria-hidden="true"></i> : <b>0253-4025031, 8888094444</b></font></p>     
</div>
  </div>
  
</div>

</div>

</div>

    <!--</div>-->
</div>
 

	 

<?php include_once("../view/header-footer/footer.php");  