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

<script>  

login_url_val = "<?php echo $login_url_val;?>"; 

$(document).ready(function(){ 

if(login_url_val==1)
{ 
	$("#login").modal({
	show: 'true',
	backdrop: 'static',
	keyboard:true
	});  
}


$('#select-all').click(function(event) {    
    if(this.checked) 
	{
        // Iterate each checkbox
        $(':checkbox').each(function() 
		{  
			this.checked = true;         
        });  
    }else
	{
		$(':checkbox').each(function() {
            this.checked = false;                        
        });
	}
});  

	$('.selectDelete').click(function(event) {      
		var idGranted= Array();     
		var cityidGranted= Array();     
		$("input:checkbox").each(function(){
			var $this = $(this); 
			if($this.is(":checked"))
			{ 
				var res = $this.attr("id").split("-");    
				if($.isNumeric(parseInt(res[1])))
				{
					idGranted.push(parseInt(res[1]));    
					cityidGranted.push(parseInt(res[2]));    
				}
			}
		}); 

		id_send = idGranted.join(',');	
		city_send = cityidGranted.join(',');	
		var r = confirm("Do you really want to delete selected alerts !");
		if (r == true) 
		{  
		$.ajax({
			type: "POST",
			url: '../all-ajax/MyDetails.php', 
			data: {delete_all_alert:1,city_id:city_send,id:id_send},	  
			beforeSend: function(){
				//$("#search-box").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
			},
			success: function(data)
			{   	  
				location.reload();	 
			}
		});  
		}	  
	});

    $("#create_alert_job").validate({
		
			errorElement:'div',
			rules:{ 
				
				job_category:{
					required:true								
				},
				select_city:{
					required:true						
				}		
			},
			messages:{	

				job_category:{
					required:"Kindly Select Role"					
				},	
					
				select_city:{
					required:"Kindly Select City"					
				}				 
			}
		});	
    
});      

function edit_alert(city_id,id)
{
	$.ajax({
		type: "POST",
		url: '../all-ajax/MyDetails.php', 
		data: {edit_alert:1,city_id:city_id,id:id},	  
		beforeSend: function(){
			//$("#search-box").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
		},
		success: function(data)
		{   	  
				$("#edit-alert-model").modal({
				show: 'true',
				backdrop: 'static',
				keyboard:true
				});   
				$("#placed_alertform").html(data);   
				$("#city_id").val(city_id);   
				$("#alert_id").val(id);    
		}
	});  
}

function del_alert(city_id,id)
{
	var r = confirm("Do you really want to delete alert !");
	if (r == true) 
	{  
	$.ajax({
		type: "POST",
		url: '../all-ajax/MyDetails.php', 
		data: {delete_alert:1,city_id:city_id,id:id},	  
		beforeSend: function(){
			//$("#search-box").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
		},
		success: function(data)
		{   	  
			location.reload();	 
		}
	});  
	}
}


function search_by_category(val,name,id)
{ 	
	//$("#job-sub-category-span"+val).show();	
	//$("#job-sub-category-span"+last).hide();	
	//last = val;   
	var new_name = name.split(' ');	 
	new_name1 =   new_name[0].replace(new RegExp("%20", "g"), '_');        
	new_name1 =   new_name1.replace(new RegExp("%2F", "g"), '_');        
	$.ajax({	
	type: "POST",
	url: URL+"/all-ajax/job.php", 
	data: {set_filter_session:1,val:1,type:1},
	beforeSend: function(){ 
	},
	success: function(data)
	{  
			 
			window.location.href = URL+"/jobs/<?php echo $_REQUEST["keyword1"];?>/"+new_name1+"-"+id+"";
			$("#MyIframeDivs").load("../basic-search.php?keyword1=<?php echo $_REQUEST['keyword1'];?>&keyword2=<?php echo $_REQUEST['keyword2'];?>&get_data=1"); 
	}
	});  
	
}

</script>

<div id="body">
<div class="wrapper">
	<div class="bradeCrubs">
	<a href="<?php echo ROOTPATH;?>">Home</a>
	<a href="<?php echo ROOTPATH;?>/MyDetails/">My Account</a>
	<a href="<?php echo ROOTPATH;?>/MyDetails/all-alerts.php" class="current">Alerts</a>
	</div>   
		<?php include_once("side-menu.php");  ?> 
    <div id="dataRight">
    <div class="leftHead">View Applications</div><br><br>
	<!--<a href="javascript:void(0)" class="rightLink">Create New Alert</a>-->
	<!--<a data-toggle="modal" id="create_new_alert" data-target="#create_alert" class="rightLink" onclick="create_alert(<?php echo $dt->id;?>)" href="javascript:void(0);">Create New Alert</a>-->
	<!--<ul class="resList">-->
<li>
	<?php 
	if($row!='')
	{
	   foreach($row as $dt)
		{          
		    $old_date = $dt->date;
			$old_date_timestamp = strtotime($old_date);
			$date = date("d-M-Y g:i A", $old_date_timestamp);
	?> 	
    	<ul class="resList">		
		
        	<li> 
            	<h2><a href="" target="_blank"><?php echo $dt->name;?></a> </h2>
								 
				 <?php
				  $stmt =  $conn->prepare("select name from all_cities  WHERE  id=$dt->job_city_id");    
				  $stmt->execute();   
			      $city_result = $stmt->fetch(PDO::FETCH_OBJ);				  
				 ?>
				 <span class="loaction"><?php echo $city_result->name;?> </span>
				 <div class="applyLeft">
				Contact No:- <b><?php echo $dt->mobile;?></b><br>Email Id:- <b><?php echo $dt->email;?></b><br>
                Date:- <b><?php echo $date;?></b>
				</div>
				
                 <div class="applyRight">
                 	<span>Phone verified</span>
                    <!-- <input name="" type="button" value="Apply" class=" btn applyButt"> -->
					<!--<a data-toggle="modal" id="applyrecords" data-target="#apply" class=" btn applyButt" onclick="apply_records(<?php echo $dt->id;?>)">Apply</a>-->
                 </div>
				 
            </li>         
        </ul>
   
	
	<?php 
		}
	  }
	  else {
	?> 
	No Record Found
	<?php } ?>
	<div class="clear"></div> 
</li> 
        <!--</ul>-->
    </div>
<div class="clear"></div>
</div>
<br>

</div>





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