JezK
Edit File: mywarehouse-ajax.php
<?php include_once("adminObj.php"); // include('../../app/checkSession.php'); $data =array(); $limit = ""; $tableColumns = array('umw.warehouse_name','umw.warehouse_number','uws.warehouse_status','umw.warehouse_city','umw.uflexit_percent'); if (isset($_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' ) { $limit = "OFFSET ".$adminObj->db->escape($_GET['iDisplayStart'] )." LIMIT ". $adminObj->db->escape($_GET['iDisplayLength'] ); } $order="Order by warehouse_id desc"; $whereCondition = ""; if ( $_GET['sSearch'] != "" ) { $whereCondition = "WHERE ("; for ( $i=0 ; $i<count($tableColumns) ; $i++ ) { $whereCondition .= $tableColumns[$i]." ILIKE '%".$adminObj->db->escape($_GET['sSearch'] )."%' OR "; } $whereCondition = substr_replace( $whereCondition, "", -3 ); $whereCondition .= ') '; } $sql= "select umw.*,uws.warehouse_status from uflexit_master_wareHouse as umw join uflexit_warehouse_status as uws on uws.status_type=umw.warehouse_status $whereCondition $order $limit "; // echo $sql; // exit; $rows = $adminObj->db->get_results($sql); $rows = $rows ? $rows : array(); $totalRecord = $rows ? count($rows) : 0; $count_result = $adminObj->db->get_results("select umw.*,uws.warehouse_status from uflexit_master_wareHouse as umw join uflexit_warehouse_status as uws on uws.status_type=umw.warehouse_status $whereCondition "); //~ print_r($count_result[0]['count']); //~ $res_rec=get_results($count_result); $rows1 = $count_result ? $count_result : array(); $totalRecords = $rows1 ? count($rows1) : 0; //~ exit; //~ // $count_result = $wareHouseAdminObj->db->get_results("SELECT count(*) from uflexit_master_wareHouse ".$whereCondition); // $res_rec=mysqli_fetch_array($count_result); // $totalRecords =$count_result[0]['count']; // print_r($totalRecords);exit; if($totalRecord>0) { $j=1; foreach($rows as $fetch) { //~ $active = "non active"; //~ if($fetch['warehouse_status']==1) //~ { //~ $active= "active"; //~ } $color = ""; $statusHTML =""; if ($fetch['warehouse_status'] == 'Pending'){ // $active = "Pending"; $color = 'text-warning'; $statusHTML = '<a class="p-2 actionCls" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-success" aria-hidden="true"></i></a> <a class="p-2 actionCls" href="warehouseReject.php?id='.$fetch["warehouse_id"].'"><i title="Reject" class="fa fa-times-circle-o text-danger" aria-hidden="true"></i>'; }else if($fetch['warehouse_status'] == "Active"){ // $active = "Active"; $color = 'text-success'; //~ $statusHTML = ' <a class="p-2" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Pending" class="fa fa-check-circle text-warning" aria-hidden="true"></i></a> //~ <a class="p-2" href="warehouseInactive.php?id='.$fetch["warehouse_id"].'><i title="Inactive" class="fa fa-circle text-warning" aria-hidden="true"></i></a>'; $statusHTML = '<a class="p-2 actionCls" href="warehouseInactive.php?id='.$fetch["warehouse_id"].'"><i title="Block" class="fa fa-ban text-danger" aria-hidden="true"></i></a>'; }else if($fetch['warehouse_status'] == "Rejected"){ // $active = "Reject"; // $color = 'text-danger'; // $statusHTML = ' <a class="p-2" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-primary" aria-hidden="true"></i></a>'; }else if($fetch['warehouse_status'] == "Block"){ // $active = "Block"; $color = 'text-danger'; $statusHTML = ' <a class="p-2 actionCls" href="warehouseActive.php?id='.$fetch["warehouse_id"].'"><i title="Active" class="fa fa-check-circle text-primary" aria-hidden="true"></i</a> '; } // $fetch['status'] = $active; $fetch['id'] = (1*$_GET['iDisplayStart'])+$j; $j++; $statusHTML .="<input type='hidden' value='".$fetch["warehouse_id"]."' class='warehouseId'>"; //~ $fetch['action']='<small class="d-inline-flex tableData smallFont"> //~ <a href="warehouse_details.php?wid='.$fetch["warehouse_id"].'" class="pr-2" title="More"><img src="images/more.png" /></a> //~ <a href="edit-warehouse.php?wid='.$fetch["warehouse_id"].'" title="Edit"><img src="images/edit.png" /></a> //~ </small>'; $fetch['action'] =$statusHTML; if($fetch['uflexit_percent'] == "") { $uflexit_percent = 0; } else{ $uflexit_percent = $fetch['uflexit_percent']; } $fetch['percent'] = '<div class=""><input type="text" class="uflexitPercent" style="width:45px" id="uflexitPercent'.$fetch['warehouse_id'].'" value="'.$uflexit_percent.'" readOnly><img src="./images/edit.svg" alt="" height="18px" class="pl-2 editPercent" onClick="editPercent('.$fetch['warehouse_id'].')" id="percentage'.$fetch['warehouse_id'].'"><img src="./images/accept.svg" alt="" height="18px" class="pl-2 submitPercent d-none" onClick="submitUflexitPercent('.$fetch['warehouse_id'].');" id="updatePercent'.$fetch['warehouse_id'].'"> </div>'; $data[]=$fetch; } } $data = ["sEcho" => intval($_GET['sEcho']), "iTotalRecords" => $totalRecord, "iTotalDisplayRecords" => $totalRecords, "aaData" => $data ]; echo json_encode($data); exit; ?>