ok

Mini Shell

Direktori : /home2/selectio/public_html/y1jobportal.in/admin/api/
Upload File :
Current File : /home2/selectio/public_html/y1jobportal.in/admin/api/get-subcategory-api.php

<?php include "config/config.php";

// Get Job Details Starts Here 
if($_POST['type']=="get_job_details"){
    
    $cond="";
    $client_id = $_POST['client_id'];
    if($client_id!=""){
        $cond="and jv.client_id=$client_id";
    }
    
        $statement = $pdo->prepare("SELECT jv.*,sub_category.name as sub_category_name
                                    FROM `tbl_job_vacancy` jv
                                    LEFT JOIN sub_category ON sub_category.id=jv.sub_category
                                    WHERE jv.status=1 $cond ");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    
		    
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Job Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}
// Get Job Details Enndss Here


if($_POST['type']=="get_subcategory"){
    $category_id = $_POST['category_id'];

$where="";
    
        $statement = $pdo->prepare("SELECT * FROM `sub_category` WHERE category_id=$category_id");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    
		    
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Subcategory Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}

if($_POST['type']=="get_category"){
$where="";
    
        $statement = $pdo->prepare("SELECT * FROM `category` WHERE status=1");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    
		    
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="category Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}


if($_POST['type']=="get_jobs_availabilty"){
   
    $condtions = '';
    $company_conditions = '';
    $datas = '';
    
    // $district_id = $_POST['district_id'];
    $state_id = $_POST['state_id'];
    $JobSubcategory = $_POST['JobSubcategory'];
    $category_ids = $_POST['category_ids'];
    $sub_category = $_POST['sub_category'];
    $client_id = $_POST['client_id'];
    
        if($JobSubcategory!=""){
            $condtions.= ' AND c.subcategory_id='.$JobSubcategory;  
        }
        if($state_id!=""){
            $condtions.= ' AND c.state_id='.$state_id;    
        }
        // if($district_id!=""){
        //     $condtions.= ' AND c.district_id='.$district_id;    
        // }
        if($category_ids!=""){
            $condtions.= ' AND c.category_id='.$category_ids;     
        }
        
        if($sub_category !=""){
            $condtions.= ' AND c.subcategory_id='.$sub_category;  
        }

        $datas='';
        

        

        $employess = $pdo->prepare("SELECT c.*,
        sdt.no_of_interviews as intr ,
        sdt.status as status,
        category.name as category_name,
        sub_category.name as sub_category_name,
        state.state_name,
        district.district_name
        FROM `customer` c
        LEFT JOIN category ON category.id=c.category_id
        LEFT JOIN sub_category ON sub_category.id=c.subcategory_id
        LEFT JOIN state ON state.id=c.state_id
        LEFT JOIN district ON district.id=c.district_id
        LEFT JOIN tbl_subscription_details sdt ON sdt.customer_id=c.id
        WHERE 1=1 and c.process = 4 and sdt.no_of_interviews  > 0
        ".$condtions);
        
        // i have remove the  no of interviews
        // WHERE 1=1 and c.process = 4 and sdt.no_of_interviews  > 0
		
		$employess->execute();
		$employess_result = $employess->fetchAll(PDO::FETCH_ASSOC);
		$total_employess = $employess->rowCount();
		
		
		$datas.= '<div class="row" style="margin-top: 2%;" >
		
		
        				    	     <div class="col-md-12">
        				    	         <h6>Employee Details</h6>
        				    	         <div class="card" style="margin: 0px 10px 30px 10px; box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;">
    		                                <div class="card-body">
                				    	         <table class="table table-striped">
                				    	             <tr>
                				    	                 <th>Select</th>
                				    	                 <th>Name</th>
                				    	                 <th>Mobile No</th>
                				    	                 <th>Category</th>
                				    	                 <th>Subcategory</th>
                				    	                 <th>State</th>
                				    	                 <th>District</th>
                				    	                 <th>Available Interviews</th>
                				    	             </tr>';
                				    	             if($total_employess > 0){
                				    	                 foreach($employess_result as $employess_data){
                                                               $datas .= '<tr>
                                                               <td>
                                                                      
                                                                           <input value="'.$employess_data["id"].'" name="assign_ids" type="checkbox" >
                                                                          ';
                                                       
                                                          $datas .= '</td>
                				    	                 <td>'.$employess_data["cust_firstname"].'</td>
                				    	                 <td>'.$employess_data["cust_phone"].'</td>
                				    	                 <td>'.$employess_data["category_name"].'</td>
                				    	                 <td>'.$employess_data["sub_category_name"].'</td>
                				    	                 <td>'.$employess_data["state_name"].'</td>
                				    	                 <td>'.$employess_data["district_name"].'</td>
                				    	                 <td>'.$employess_data["intr"].'</td>
                				    	             </tr>';
                				    	                 }
                				    	             }else{ 
                				    	               $datas.= '<tr>
                				    	                    <td colspan="7">No Datas Found</td> 
                				    	               </tr>';
                				    	             }
                				    	             
                				    	         $datas.='</table>
        				    	            </div>
        				    	         </div>
        				    	     </div>
        				    	     
        				    	     
        				    	         
        				 </div>
        				 
        				 
        				 <!-- Footer Job Assign Starts Here -->
        				 <div class="row">
        				    <div class="col-md-4">
        				        <label>Interview Date</label>
        				        <input type="date" class="form-control" id="interview_date" value="'.date('Y-m-d').'">
        				    </div>
        				    <div class="col-md-6">
        				        <button class="btn btn-success btn-xs" onclick="JobAssign()" style="margin-top: 13px;">Job Assign</button>
        				    </div>
        				 </div>
        				 <!-- Footer Job Assign Endsss Here -->
        				 ';
		
		
		if($employess_result){
		    
		    
		    $response['data']=$datas;
		    $response['error']=false;
		    $response['message']="employee Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}







if($_POST['type']=="get_client"){
    $category_id = $_POST['client_id'];
    
    
// if($_SESSION['y1_jobs']['role_json'] ==2 ){
//     $districtid = $_SESSION['y1_jobs']['city'] ?? NULL ;
// }

// $condition="";
// if($districtid!="" && $districtid!=NULL ){
//     $condition.=" and client.district_id = ".$districtid;
// }


    // SELECT * FROM `client` WHERE 
$statement = $pdo->prepare("SELECT * FROM `client` WHERE payment_status = 1 and category_id = ? ");
$statement->execute([$category_id]);

		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    
		    
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Client Details Fetched Successfully";
		}else{
		    $response['count']=0;
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}

?>

Zerion Mini Shell 1.0