<?php 
	include_once("../view/header-footer/header.php");     
	include_once("../all-ajax/inner-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("-");    
				//console.log(res[2]);
				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_ads: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();	 
			}
		});  
		}	  
	}); 
});      

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

function del_ads(city_id,id)
{
	var r = confirm("Do you really want to delete ads !");
	if (r == true) 
	{  
	$.ajax({
		type: "POST",
		url: '../all-ajax/MyDetails.php', 
		data: {delete_ads: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();	 
		}
	});  
	}
}


</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/ads.php" class="current">My Ads</a>
	</div>   
		<?php include_once("side-menu.php");  ?> 
    <div id="dataRight">
    <div class="leftHead">My Ads</div> 
	<!--<a href="javascript:void(0)" class="rightLink">Create New Alert</a>-->
	<ul class="resList">
<li>
	<h3 class="postJobMin"><a class="btn" href="javascript:void(0)">All Ads</a></h3>
	<h3 class="postJobMin"><a class="btn btn-blk" href="javascript:void(0)">Matching ads</a></h3>	
	<?php 
	 if($user_jobs!='')
	 {
	?>
	<div class="alertOut">
	<div class="alertDiv1">
		<h3 class="alertHead">Ads Name</h3>
	 
	</div>
	<div class="alertDiv2">
		<h3 class="alertHead">Subscribed Date</h3>
 
	</div>
	<div class="alertDiv3">
		<h3 class="alertHead">Actions</h3> 
	</div>
	</div> 
	<p class="selectAll">
		<span><input type="checkbox" id="select-all"> &nbsp; Select All </span>
		<!--<span class="selectCount">0</span>-->
		<span class="selectDelete">Delete</span>
	</p>

    <?php   
	foreach($all_ads_data as $dt)
	 {			
	?> 	 
	<div class="alertOut">
	<div class="alertDiv1"> 
		<div class="ckeckOur">
		<div class="ckeckBox">
			<!--<input type="checkbox" id="chk_<?php echo $dt->id;?>">-->
			<input type="checkbox" id="chk-<?php echo $dt->id;?>-<?php echo $dt->city_id;?>">
		</div>
			<img src="<?php echo ROOTPATH;?>/view/images/fevicon.png" class="addImg" />
			<div class="adDisc"><?php  echo $dt->heading;?></div>
		</div>
	</div>
	<div class="alertDiv2"><?php echo $dt->posted_date; ?>
	</div>
	<div class="alertDiv3">		 
		<!--<a href="<?php echo ROOTPATH.'/jobs/'.$_COOKIE['search_city_name'].'/'.$dt->heading.'-'.$dt->cate_id;?>">Matching </a>-->
		<a href="<?php echo ROOTPATH?>/jobs/edit_ads.php?id=<?php echo $dt->id;?>&city_id=<?php echo $dt->city_id;?>">Edit</a>|
		<a href="javascript:void(0)"  onclick="del_ads(<?php echo $dt->city_id;?>,<?php echo $dt->id;?>)">Delete </a>|
		<a href="<?php echo ROOTPATH?>/MyDetails/view_application.php?id=<?php echo $dt->id;?>&city_id=<?php echo $dt->city_id;?>"" target="_blank">View Applications</a>
	</div>
	</div>
	<?php 
		} 
	} 
	?> 	 
	<div class="clear"></div> 
</li> 
        </ul>
    </div>
	
<div class="clear"></div>
</div>
<br>

</div>

	


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