<?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("-");    
				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">Reply To My Ads</div> 
	<!--<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($user_jobs!='')
	{
	  foreach($all_ads_data as $dt)
		{          
	?> 	
    	<ul class="resList">		
		
        	<li> 
            	<h2><a href="" target="_blank"><?php echo $dt->name;?></a> </h2>
				
                <!--<div class="labelSpel">URGENT</div>
                <div class="resultType">
                    <div class="resultTypeIcon"><img src="<?php echo ROOTPATH;?>/view/images/clock1.png" alt="img"></div>
                    <span>Monthly <em><?php echo $dt->min_salary;?> - <?php echo $dt->max_salary;?></em> </span>
                </div>
                <div class="resultType">
                	<div class="resultTypeIcon"><img src="<?php echo ROOTPATH;?>/view/images/clock1.png" alt="img"></div>
                    <span>Job Type <em><?php echo $type;?></em> </span>
                </div>
                <div class="resultType">
                    <div class="resultTypeIcon"><img src="<?php echo ROOTPATH;?>/view/images/clock1.png" alt="img"></div>
                    <span>Company <em><?php echo $dt->company;?></em> </span>
                </div>
                <div class="resultType">
                	<div class="resultTypeIcon"><img src="<?php echo ROOTPATH;?>/view/images/clock1.png" alt="img"></div>
                    <span>Experience <em><?php if($dt->expr!='') echo $dt->expr; else echo "Not Mentioned"; ?></em> </span>
                </div>-->
                <!-- <span class="designation"><?php echo $role->name;?> -<em><?php echo $dt1->name;?></em>
				 </span>-->
				 
				 <?php
				  /*$stmt =  $conn->prepare("select name from all_cities  WHERE  id=$dt->city_id");    
				  $stmt->execute();   
			      $city_result = $stmt->fetch(PDO::FETCH_OBJ);*/				  
				 ?>
				 <span class="loaction"><?php echo $dt->heading;?> - <?php echo $dt->city_name;?> </span>
				 <div class="applyLeft">
				Contact No:- <b><?php echo $dt->mobile;?></b><br>Email Id:- <b><?php echo $dt->email;?></b><br> </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 
		}
	  }	
	?> 
	<div class="clear"></div> 
</li> 
        <!--</ul>-->
    </div>
<div class="clear"></div>
</div>
<br>

</div>


	<!-- Modal -->
<div class="modal fade" id="edit-alert-model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog " role="document">
<div class="modal-dialog" role="document">
    <div class="modal-content">
	  <form method="post">	
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Step 1 / 2 - Free Job application</h4>
        </div> 
	   <div id="placed_alertform"></div> 
	   <div class="modal-footer textLeft">
	   <button type="button" class="btn btn-blk" data-dismiss="modal">Close</button>
	   <input type="submit" name="submit_edit" class="btn btn-primary" value="Update Alert">
       <span> Beware of fraud agents! do not pay money to get a job</span>
       <em>Quikr will not be responsible for any payment made to a third-party. All Terms of Use are applicable. </em>  
      </div>
	  <input type="hidden" name="city_id"   id="city_id"  value="">
	  <input type="hidden" name="alert_id"  id="alert_id"  value="">
	  
	  </form>
    </div>
  </div>
  </div>
</div>


<!-- Modal -->
<div class="modal fade" id="create_alert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog " role="document">
<div class="modal-dialog" role="document">
    <div class="modal-content">
	  <form method="post" id="create_alert_job"  autocomplete="off" >
	 <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Step 1 / 2 - Free Job application</h4>
      </div>
      <div class="modal-body">
	   <p class="dottedLine">
		<span>For job</span>
MECHANICAL ELECTRICAL ECE EEE EI CS IT CHEMICAL DIPLOMA DEGREE ENGINEERING JOBS ...
		</p>		
		<div class="row">
		<!--<div class="col-md-6">
     	<input class="loginInput" type="text" placeholder="Name" name="apply_name"  id="apply_name" value="<?php echo $login_details->name; ?>" />	
		</div>-->
		<div class="col-md-6">
       <div class="comboOut"> 		
		<label>Type</label>  
			<select name="type" class="comboText"> 
			<option value="3" >Full Time</option>
			<option value="2" >Part Time</option>
			<option value="1" >Work From Home</option>
			<option value="4" >Internships</option>
			</select>
		  </div>		 
		</div>
		
		<div class="col-md-6">
		<div class="comboOut">
		<label>Role<span>*</span></label>
			<input type="text" placeholder="Enter Role" class="comboText"  placeholder="E.q. Marketing" id="job-category"  name="job_category">
			<ul id="job-category-sugeetion">
				<?php 
		    	foreach($job_categories as $key=>$dt)
				{   
					$stmt =  $conn->prepare("select  name, id  from sub_job_categories   where category_id=:category_id  ");         
					$stmt->bindValue(':category_id', $dt->id, PDO::PARAM_INT); 
					$stmt->execute();   
					$sub_job_categories = $stmt->fetchAll(PDO::FETCH_OBJ);
					
				?> 
					<a href="javascript:void(0)">
						<li onclick="select_role_post_job('<?php echo $dt->name;?>',<?php echo $dt->id;?>)" ><?php echo $dt->name;?></li> 
					</a>
				<?php } ?>
			</ul> 
			<input type="hidden"  id="job_cat_val" name="job_cat_val"  value=""/>
		 </div>
		 <div id="job-category-sugeetion-ajax"></div>
        </div>
		
		</div><div class="row">
		
		<div class="col-md-6">
		 <div class="comboOut"><br>
          <label>City  <span> * </span> </label>   
			<input type="text"  placeholder="E.q. Nashik" id="select_city" name="select_city" value="<?php echo $_COOKIE['search_city_name'];?>"  class="comboText">  
			<ul id="ul-city-id-ajax">
					<?php 
					$stmt =  $conn->prepare("select id,name from all_cities order by  state_code desc ");          
					$stmt->execute();   
					$city_id = $stmt->fetchAll(PDO::FETCH_OBJ);
					foreach($city_id as $dt)
					{
					?>
					<a href="javascript:void(0)">
						<li onclick="select_sub_loctns('<?php echo $dt->name;?>',<?php echo $dt->id;?>)" ><?php echo $dt->name;?></li> 
					</a>
				<?php } ?>
			</ul> 
			<input type="hidden"   id="search_city_hidden" name="search_city_hidden" value="<?php echo $_COOKIE['search_city_id'];?>"  class="inputText">			
		</div>
		<div id="city-id-ajax"></div> 
		</div>
		
		<div class="col-md-6">
		<div class="comboOut"><br>
       <label>Localities <span>*</span> (Upto 5)</label>
			<input type="text"  placeholder="E.q. Shalimar" id="select-sub-locations" name="select-sub-locations" class="comboText">
			<ul id="ul-location-ajax">
				<?php 
				   
					$stmt =  $conn->prepare("select  location_name, id  from city_lacations   where city_id=:city_id");     
					$stmt->bindValue(':city_id', $_COOKIE['search_city_id'], PDO::PARAM_INT); 
					$stmt->execute();   
					$location_name = $stmt->fetchAll(PDO::FETCH_OBJ); 
                    foreach($location_name as $dt)
					{ 
				?> 
					<a href="javascript:void(0)">
						<li onclick="select_location_post_job('<?php echo $dt->location_name;?>',<?php echo $dt->id;?>)" ><?php echo $dt->location_name;?></li> 
					</a>
				<?php } ?>
			</ul>  
			<span id="locality_placed">	</span>	 
			<input type="hidden"  id="locations_val" name="locations_val"  value=""/> 
		</div>
		<div id="job-loction-sugeetion-ajax"></div>  
		</div>
		
		</div>
      </div>
      <div class="modal-footer textLeft">
	    <button type="button" class="btn btn-blk" data-dismiss="modal">Close</button>
        <!--<button type="button" class="btn btn-primary" onclick="apply_for_job();">Save</button>-->
		<input class="btn btn-primary" type="submit" name="submit_alert"  value="Create Alert"  id="submit_job" />
       <span> Beware of fraud agents! do not pay money to get a job</span>
       <em>Quikr will not be responsible for any payment made to a third-party. All Terms of Use are applicable. </em>
	   
	   
      </div>	
   </form>	  
    </div>
  </div>
  </div>
</div>


<script type="text/javascript" src="<?php echo ROOTPATH;?>/view/js/tab/MyDetails.js"> </script>
<?php include_once("../view/header-footer/footer.php");  