ok
Direktori : /proc/self/root/home2/selectio/www/y1jobportal.in/admin/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/y1jobportal.in/admin/data-tables/customer-dt.php |
<?php include("../api/config/config.php"); $requestData= $_REQUEST; $condition=''; if(isset($_POST['Process_status']) && $_POST['Process_status']!='all' && $_POST['Process_status']!='' && $_POST['Process_status']!=0){ $condition.=" and customer.process=".$_POST['Process_status']; } if(isset($_POST['district_id']) && $_POST['district_id']!='all' && $_POST['district_id']!='' && $_POST['district_id']!=0){ $condition.=" and customer.district_id=".$_POST['district_id']; } if(isset($_POST['state_id']) && $_POST['state_id']!='all' && $_POST['state_id']!='' && $_POST['state_id']!=0){ $condition.=" and customer.state_id=".$_POST['state_id']; } if(isset($_POST['category_id']) && $_POST['category_id']!='all' && $_POST['category_id']!='' && $_POST['category_id']!=0){ $condition.=" and customer.category_id=".$_POST['category_id']; } if(isset($_POST['subcategory']) && $_POST['subcategory']!='all' && $_POST['subcategory']!='' && $_POST['subcategory']!=0){ $condition.=" and customer.subcategory_id=".$_POST['subcategory']; } $city = $_SESSION['y1_jobs']['city'] ?? null; if($_SESSION['y1_jobs']['role_json'] == 2){ $condition.= " and district.id IN ($city)" ; } // Fetch Database column Details $columns = array( 0 =>'id', 1 =>'id', 2 =>'firstname', 3 =>'mobile', 4 =>'email', 5 =>'password', 6 =>'city', 7 =>'address', ); /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT customer.*,category.name AS category_name ,sub_category.name AS subcategory_name, state.state_name AS state_name, district.district_name AS district_name FROM `customer` LEFT JOIN category ON customer.category_id=category.id LEFT JOIN sub_category ON sub_category.id=customer.subcategory_id LEFT JOIN state ON state.id=customer.state_id LEFT JOIN district ON district.id=customer.district_id WHERE 1=1 $condition ORDER BY customer.id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT customer.*,category.name AS category_name ,sub_category.name AS subcategory_name, state.state_name AS state_name, district.district_name AS district_name FROM `customer` LEFT JOIN category ON customer.category_id=category.id LEFT JOIN sub_category ON sub_category.id=customer.subcategory_id LEFT JOIN state ON state.id=customer.state_id LEFT JOIN district ON district.id=customer.district_id WHERE 1=1 $condition"; if( !empty($requestData['search']['value']) ) { $sql.=" AND ( customer.subcategory_id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR customer.state_id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR customer.cust_phone LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR customer.district_id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR category.name LIKE '%".$requestData['search']['value']."%' ) "; } $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalFiltered = $statement->rowCount(); /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=$requestData['start']+1; foreach($query as $row ) { // preparing an array $nestedData=array(); $action= "<div class='text-center'><div class='btn-group'>"; $action.="<a style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' href='edit-customer.php?id=".$row["id"]."' title='Edit District' class='tip btn btn-warning btn-xs'> <i class='bi bi-pencil'></i> </a> "; $action.=" <button style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' title='Delete District Details' onClick='delete_customer(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='bi bi-trash3'></i> </button>"; $action.="</div></div>"; if(isset($row['status'])=="1"){$status="<span class='span-success'> Active </span>"; } else{$status="<span class='span-danger'> In-Active </span>";} $process_status = ''; if($row['process']==0 || $row['process']==''){ $process_status.="<b> Not Updated </b>";} else if($row['process']==1){ $process_status.="<b> Mobile No Verified</b>";} else if($row['process']==2){ $process_status.="<b> Personal Information Collect</b>";} else if($row['process']==3){ $process_status.="<b> Category Verified</b>";} else if($row['process']==4){ $process_status.="<b> Payment Completed</b>";} else if($row['process']==5){ $process_status.="<b> Job Assigned</b>";} $nestedData[] = $action; $nestedData[] = $i; $nestedData[] = $row["cust_firstname"]; $nestedData[] = $row["cust_phone"]; $nestedData[] = $row["email"]; $nestedData[] = $row["category_name"]; $nestedData[] = $row["subcategory_name"]; $nestedData[] = $row["state_name"]; $nestedData[] = $row["district_name"]; $nestedData[] = $process_status; $nestedData[] = $status; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. "recordsTotal" => intval( $totalData ), // total number of records "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData "data" => $data // total data array ); echo json_encode($json_data); // send data as json format ?>