<?php 
	
	include_once("../view/header-footer/header.php");    
	include_once("../all-ajax/inner-header.php"); 
?>   

<script src="<?php echo ROOTPATH;?>/view/js/tab/reply_ads.js"></script>        
<script>
var last; 
$(document).ready(function(){      
	
	site_id = '<?php echo $_REQUEST['site_id']; ?>';
	job_city_id = '<?php echo $job_city_id; ?>';
	job_id = '<?php echo $job_id; ?>';
	
	$(".send_email").hide();
	$(".view_emp_contact").hide();
	
	$(".comboText").click(function(){
		$(this).next().slideDown();
	});

	$("#clear_job_locality").click(function(){ 
	
		$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {clear_job_locality:1},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id);  
			$("#locality_placed").html('');  
			location.reload();
		}
		}); 
	});	
	
	$("#clear_all_job_filers").click(function(){ 
	
		$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {clear_all_job_filers:1},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id); 
			location.reload();
		}
		}); 
	});	
	
	$("#clear_gender_filter").click(function(){ 
	
		$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {clear_gender_filter:1},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id);
			location.reload();
		}
		}); 
	});
	
	$("#clear_profile_search").click(function(){ 
	
		$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {clear_profile_search:1},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id);
			location.reload();
		}
		}); 
	});
	
	$("body").click(function(e) 
	{    
		
		if ( e.target.id == "job-locality" || $(e.target).parents("#suggesstion_comboText").size() ) 
		{ 
             //alert("Inside div");   
        } else 
		{   
			 
			 
			$("#job-locality").val('');
			$("#suggesstion_comboText").slideUp(500);
        }   
    });	
    
    $("#job-locality").keyup(function() 
	{  
		city_id = '<?php echo $_REQUEST['city_id']; ?>';  
		$.ajax({	
			type: "POST",
			//url: URL+"/all-ajax/job.php", 
			url: URL+"/all-ajax/reply_ads.php", 
			//data: {job_locality:1,keyword:$(this).val(),city_id:$("#search_city_id_hidden").val()},
			data: {search_locality:1,keyword:$(this).val(),city_id:city_id},
			beforeSend: function(){ 
			},
			success: function(data)
			{  
				$("#job-locality-ul").hide();
				var obj = jQuery.parseJSON(data);  
				if(obj==null || obj=='null')
				{  
					$("#suggesstion_comboText").hide();
					$("#job-locality-ul").hide();
					
				}else
				{  	
					source_first_name = obj[0].location_name; 
					source_list = '<ul>'; 
					
					for(i=0;i<obj.length;i++)			
						source_list +='<li><a onClick=search_by_locality("'+obj[i].id+'","'+encodeURIComponent(obj[i].location_name)+'") href="javascript:void(0)">'+obj[i].location_name+'</a></li>';   
					
					source_list +='</ul>';   
					$("#suggesstion_comboText").show();
					$("#suggesstion_comboText").html(source_list);    
				}    
			
			}
		}); 
	});
    
    
    // send sms
	$("#send_sms_frm").submit(function( event )  
	{ 	 
		if($('#send_sms_frm').valid())  
		{ 
			var formData=$('#send_sms_frm').serialize();  
			$.ajax({	
			type: "POST",
			url: URL+"/all-ajax/reply_ads.php", 
			data: {send_sms_emp:1,formData:formData},	
					beforeSend: function(){
						
					},
					success: function(data){  					  
					$('#emp_send_sms').modal('hide');	
					alert("SMS Sent Successfully!!!");
					//location.reload();
				}  
			});  
			return false; 			
	    }
		//event.preventDefault();  
	});
    
    // send email
	$("#send_email_frm").submit(function( event )  
	{ 	 
		if($('#send_email_frm').valid())  
		{ 
			var formData=$('#send_email_frm').serialize();  
			$.ajax({	
			type: "POST",
			url: URL+"/all-ajax/reply_ads.php", 
			data: {send_email_emp:1,formData:formData},	
					beforeSend: function(){
						
					},
					success: function(data){  					  
					$('#emp_send_email').modal('hide');	
					alert("Email Sent Successfully!!!");
					//location.reload();
				}  
			});  
			return false; 			
	    }
		//event.preventDefault();  
	});

    
});      




function search_by_profile(val)
{
    $.ajax({	
	type: "POST",
	url: URL+"/all-ajax/reply_ads.php", 
	data: {search_by_profile:1,val:val,remove:$('#profile_search'+val).is(':checked')},
	beforeSend: function(){ 
	},
	success: function(data)
	{  
		$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id); 
	}
	});
	
}


function search_by_gender(val)
{ 	 
	$.ajax({	
	type: "POST",
	url: URL+"/all-ajax/reply_ads.php", 
	data: {search_by_gender:1,val:val,remove:$('#gender'+val).is(':checked')},
	beforeSend: function(){ 
	},
	success: function(data)
	{  
		$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id); 
	}
	});	
}   

function search_by_locality(val,name)
{
	new_name =   name.replace(new RegExp("%20", "g"), ' ');  
	$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {search_by_locality:1,val:val,name:new_name},
		beforeSend: function(){ 
		},
		success: function(data)
		{  
            if(data=='false')
               alert("Location already added!"); 
			else 
			{
			    $("#job-locality").val(''); 
    		    $("#suggesstion_comboText").hide();
    			$("#job-locality-ul").hide();
    			$("#locality_placed").html(data);  
    			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id);
			}
		}
	}); 
}

	
function reply_remove_locality(loc)
{ 
	new_name = loc.replace(new RegExp("%20", "g"), ' ');   
	$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {reply_remove_locality:1,name:new_name},
		beforeSend: function(){ 
		},
		success: function(data)
		{     
			$("#locality_placed").html(data);  
			$("#MyIframeDivs").load("applicationLoad.php?site_id="+site_id+"&job_city_id="+job_city_id+"&job_id="+job_id); 
		}
	});  
	 
}

function unlock_credit(id,city_id,job_id,key)
{
    $.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {unlock_credit:1,val:id,city_id:city_id,job_id:job_id},
		beforeSend: function(){ 
		},
		success: function(data)
		{ 
		    if(data==1)
		    {
		        $("#unlockcredit_btn"+key).addClass("disableloginbtn"); 
		        $("#credit_used"+key).hide(200); 
		        $("#send_email"+key).show();
		        $("#view_emp_contact"+key).show();
		        //location.reload();
		    }
		    else if(data==2)
		    {
		        alert("Your monthly unlock credit limit has been over!!!");
		        //location.reload();
		    }
		}
	});
}	

function send_sms(id)
{
    $("#send_sms_frm").closest('form').find("input[type=text], textarea").val("");	
    $("#emp_id").val(id);
    $("#emp_send_sms").modal({
		show: 'true',
		backdrop: 'static',
		keyboard:false
	});
} 

function send_email(id)
{
    $("#send_email_frm").closest('form').find("input[type=text], textarea").val("");	
    $("#emp_id").val(id);
    $("#emp_send_email").modal({
		show: 'true',
		backdrop: 'static',
		keyboard:false
	});
}    


function view_emp_contact(id)
{
    $("#emp_view_contact").modal({
		show: 'true',
		backdrop: 'static',
		keyboard:false
	});
	
	$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {view_emp_contact:1,val:id},
		beforeSend: function(){ 
		},
		success: function(data)
		{
		    var obj = jQuery.parseJSON(data);  
			if(obj!=null || obj!='')
			{
			    $("#emp_name").val(obj['name']);
			    $("#emp_email").val(obj['email']);
			    $("#emp_phone").val(obj['phone']);
			}    
		}
	}); 
}

/*function job_locality(val)  //single location filter
{
	$.ajax({	
		type: "POST",
		url: URL+"/all-ajax/reply_ads.php", 
		data: {search_by_locality:1,val:val},
		beforeSend: function(){ 
		},
		success: function(data)
		{   
			$("#MyIframeDivs").load("applicationLoad.php"); 
			location.reload();
		}
	}); 
}*/
</script> 
<?php include_once("../all-ajax/inner-header.php");  ?> 
<div id="body" class="grey-bg">
<div class="wrapper">
<div class="bradeCrubs">
<!--<a href="<?php echo ROOTPATH;?>/MyDetails/ads.php">Home</a>
<a href="javascript:void(0);">Job</a>-->
 <a href="<?php echo ROOTPATH;?>/MyDetails/search_candidate.php?id=<?php echo $applyjobid;?>&city_id=<?php echo $applycityid;?>&site_id=<?php echo $_COOKIE['site_custom_id']; ?>" target="_blank" class="current"><b>Search Candidates</b></a>
<a href="javascript:void(0);" class="current"><b><?php echo $job_applied_cnt; ?> applicants</b></a> 


</div>
<div class="col-md-2 plr bottom newLeft">
	<div id="dataLeft" class="job-filter">
    <div class="filterHead">Filter jobs 
    <a class="clearAll" href="javascript:void(0)" id="clear_all_job_filers">Clear All</a>
    </div>
    <div class="panel-group" id="accordion">
    
	
    <div class="panel panel-default" id="locality">
      <div class="panel-heading">
        <h4 data-toggle="collapse" data-parent="#accordion" href="#collapse2" class="panel-title expand">
            <div class="right-arrow pull-right">+</div>
          <a href="#">Locality</a>
	    </h4>
      </div>
      <div id="collapse2" class="panel-collapse collapse">   
        <div class="panel-body">  
			 <!-- combo-box  -->
			 <a href="javascript:void(0)" class="cleFilter" id="clear_job_locality">Clear Filter</a> 
			<div class="">
				<input type="text" class="location-name local-input" placeholder="E.q. Shalimar" id="job-locality" > 
				<ul id="job-locality-ul">
				<?php 
				$stmt =  $conn->prepare("select id,location_name from city_lacations  where city_id=:city_id");	  
				$stmt->bindValue(':city_id', $applycityid , PDO::PARAM_INT); 
				//$stmt->bindValue(':city_id', $_REQUEST['city_id'] , PDO::PARAM_INT); 
				$stmt->execute();   
				$city_locations = $stmt->fetchAll(PDO::FETCH_OBJ); 
				foreach($city_locations as $dt) 
				{
				?> 
					<li><a href="javascript:void(0)" onClick="search_by_locality(<?php echo $dt->id;?>,'<?php echo $dt->location_name;?>')"><?php echo $dt->location_name;?></a></li> 
				<?php } ?>
				</ul>
				
			</div>
			<div class="col-md-8">
				<span id="locality_placed" class="local-tabs-2">
						<?php 
						$test_array = explode(",",$_SESSION['replysearch_by_locality_name']);
						array_pop($test_array); 
						foreach($test_array as $dt) 
							$val .= $dt.'<a href=javascript:void(0) onclick=reply_remove_locality("'.str_replace(" ","%20",$dt).'")> X</a> <br>';
							
						echo $val;
						?> 
					</span>	
			</div>
			
			<div  id="suggesstion_comboText" class="locality-list"></div>
				<?php 				
				$stmt=$conn->prepare("select id,city_id,location_name from city_lacations where city_id=:city_id order by  id asc");  
				$stmt->bindValue(':city_id', $applycityid , PDO::PARAM_INT); 
				//$stmt->bindValue(':city_id', $_REQUEST['city_id'], PDO::PARAM_INT);	
				$stmt->execute();   
				$city_locations_res = $stmt->fetchAll(PDO::FETCH_OBJ);	
				?>	   
				<!--<select name="location_id" id="job_locality" class="comboText local-input" onchange="job_locality(this.value);"> 
					<option value="0" selected="selected">Location List </option> 
					<?php
					foreach($city_locations_res as $dt)
					{  
					     if($_SESSION['search_by_locality_val']){
					?>	
					<option value="<?php echo $dt->id; ?>" class="comboText" <?php  if($_SESSION['search_by_locality_val']==$dt->id) echo "selected=selected";?>><?php echo $dt->location_name; ?></option>
					<?php } else {
					?>
				    <option value="<?php echo $dt->id; ?>" class="comboText"><?php echo $dt->location_name; ?></option>
					<?php
					  }
					}
					?>
				</select>-->
			
			<!--  combo-box  -->  
        </div>
      </div>
    </div>
	
	<div class="panel panel-default">
      <div class="panel-heading">
        <h4 data-toggle="collapse" data-parent="#accordion" href="#collapse5" class="panel-title expand">
            <div class="right-arrow pull-right">+</div>
          <a href="#">Gender</a>
        </h4>
      </div>
      <div id="collapse5" class="panel-collapse collapse">
        <div class="panel-body pad">
			<a href="javascript:void(0)"class="cleFilter" id="clear_gender_filter">Clear Filter</a> 
        	<ul class="innUl job-filter list-gender">   
				<li><input type="radio" name="gender" id="gender1" onclick="search_by_gender(1)" <?php if($_SESSION['search_by_gender']==1) echo 'checked=checked'; ?> /> &nbsp;Male </li>
				
				<li> <input type="radio" name="gender" id="gender2" onclick="search_by_gender(2)" <?php if($_SESSION['search_by_gender']==2) echo 'checked=checked'; ?>  /> &nbsp;Female </li>
				
				<li><input type="radio" name="gender" id="gender3" onclick="search_by_gender(3)" <?php if($_SESSION['search_by_gender']==3) echo 'checked=checked'; ?>  /> &nbsp;Transgender </li>
            </ul>
        </div>
      </div>
    </div>
    
    <div class="panel panel-default">
      <div class="panel-heading">
        <h4 data-toggle="collapse" data-parent="#accordion" href="#collapse6" class="panel-title expand">
            <div class="right-arrow pull-right">+</div>
          <a href="javascript:void(0);">Profile Freshness</a>
        </h4>
      </div>
      <div id="collapse6" class="panel-collapse collapse">
        <div class="panel-body pad">
			<a href="javascript:void(0)"class="cleFilter" id="clear_profile_search">Clear Filter</a>
			<?php
			$profile_val_array = explode(",",$_SESSION['search_by_profile_val']); 
		    array_pop($profile_val_array);
			?>
        	<ul class="innUl job-filter list-gender">   
				<li><input type="checkbox" name="profile_search" id="profile_search1" onclick="search_by_profile(1)" <?php if(in_array(1,$profile_val_array)) echo 'checked=checked'; ?> /> &nbsp;With mobile verified only </li><!-- onclick="search_by_profile(1)"-->
				<li><input type="checkbox" name="profile_search" id="profile_search2" onclick="search_by_profile(2)" <?php if(in_array(2,$profile_val_array)) echo 'checked=checked'; ?>  /> &nbsp;With email verified only </li>
				<li><input type="checkbox" name="profile_search" id="profile_search3" onclick="search_by_profile(3)" <?php if(in_array(3,$profile_val_array)) echo 'checked=checked'; ?>  /> &nbsp;with resume only </li>
            </ul>
        </div>
      </div>
    </div>
	
	<!--
	
	<div class="panel panel-default">
      <div class="panel-heading">
        <h4 data-toggle="collapse" data-parent="#accordion" href="#collapse3" class="panel-title expand">
            <div class="right-arrow pull-right">+</div>
          <a href="#">Monthly Salay</a>
        </h4>
      </div>
      <div id="collapse3" class="panel-collapse collapse">
        <div class="panel-body">
			<a href="javascript:void(0)"class="cleFilter" id="clear_job_price">Clear Filter</a> 
        	<ul class="innUl">  
				<li><input type="radio" name="month-salary" class="month-salary" value="5000" <?php if($_SESSION['month_salary_val']==5000) echo 'checked=checked'; ?> />5,000 & above    </li>   
				<li><input type="radio" name="month-salary" class="month-salary"  value="6000" <?php if($_SESSION['month_salary_val']==6000) echo 'checked=checked'; ?> />6,000 & above       </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="7000" <?php if($_SESSION['month_salary_val']==7000) echo 'checked=checked'; ?> />7,000 & above       </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="8000" <?php if($_SESSION['month_salary_val']==8000) echo 'checked=checked'; ?> />8000 & above        </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="9000" <?php if($_SESSION['month_salary_val']==9000) echo 'checked=checked'; ?> />9,000 & above        </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="10000" <?php if($_SESSION['month_salary_val']==10000) echo 'checked=checked'; ?> />10,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="12000" <?php if($_SESSION['month_salary_val']==12000) echo 'checked=checked'; ?> />12,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="15000" <?php if($_SESSION['month_salary_val']==15000) echo 'checked=checked'; ?> />15,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="18000" <?php if($_SESSION['month_salary_val']==18000) echo 'checked=checked'; ?> />18,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="25000" <?php if($_SESSION['month_salary_val']==25000) echo 'checked=checked'; ?> />25,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="30000" <?php if($_SESSION['month_salary_val']==30000) echo 'checked=checked'; ?> />30,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="40000" <?php if($_SESSION['month_salary_val']==40000) echo 'checked=checked'; ?> />40,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="50000" <?php if($_SESSION['month_salary_val']==50000) echo 'checked=checked'; ?> />50,000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="70000" <?php if($_SESSION['month_salary_val']==70000) echo 'checked=checked'; ?> />70000 & above     </li>
				<li><input type="radio" name="month-salary" class="month-salary"  value="100000" <?php if($_SESSION['month_salary_val']==100000) echo 'checked=checked'; ?> />1,00,000 & above     </li>
 
                 
            </ul>
        </div>
      </div>
    </div>
	
		
	<?php 
		$test_array = explode(",",$_SESSION['search_by_type_val']); 
		array_pop($test_array);     
	?> 
	<div class="panel panel-default">
      <div class="panel-heading">
        <h4 data-toggle="collapse" data-parent="#accordion" href="#collapse4" class="panel-title expand">
            <div class="right-arrow pull-right">+</div>
          <a href="#">Job Type</a>
        </h4>
      </div>
      <div id="collapse4" class="panel-collapse collapse">
        <div class="panel-body pad">
        	<ul class="innUl work-type">   
				<li><input type="checkbox" name="job-type" id="job-type3" onclick="search_by_type(3)" <?php if(in_array(3,$test_array)) echo 'checked=checked'; ?> /> &nbsp;Full Time      </li>
				
				<li> <input type="checkbox" name="job-type" id="job-type2" onclick="search_by_type(2)" <?php if(in_array(2,$test_array)) echo 'checked=checked'; ?>  /> &nbsp;Part Time  </li>
				
				<li><input type="checkbox" name="job-type" id="job-type1" onclick="search_by_type(1)" <?php if(in_array(1,$test_array)) echo 'checked=checked'; ?>  /> &nbsp;Work From  Home  </li>
				
				<li> <input type="checkbox" name="job-type" id="job-type4" onclick="search_by_type(4)"<?php if(in_array(4,$test_array)) echo 'checked=checked'; ?>   />&nbsp;Internship </li>  
            </ul>
        </div>
      </div>
    </div>-->
	
   
  </div> 
    
    </div>
    </div>
   <div id="MyIframeDivs" class="col-md-10 newRigth"> <?php include_once 'applicationLoad.php';	?></div>   
<div class="clear"></div>
</div>
<div class="col-md-3 plr">
    <div class="add-box">
			<img src="http://www.goldenglassqatar.com/view/images/a.jpg" width="100%">
			<img src="http://www.goldenglassqatar.com/view/images/b.jpg" width="100%">
			<img src="http://www.goldenglassqatar.com/view/images/c.jpg" width="100%">
	</div>
	</div>
<br>

    
 <input type="hidden" value="<?php echo  $_REQUEST['city_id'];//$applycityid;?>" id="search_city_id_hidden" name="search_city_id_hidden" />

</div>



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