Commit 30c6fdd9 by Jansa Jose

brand details

parent 07cb5416
...@@ -1611,6 +1611,25 @@ ...@@ -1611,6 +1611,25 @@
echo json_encode($result);exit; echo json_encode($result);exit;
} }
public function brand_details(){
header('Content-type:application/json');
$headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$result = $this->Webservice_model->getBrands('1');
echo json_encode($result);exit;
}
//Search Product By Brand //Search Product By Brand
public function productSearchbyBrand(){ public function productSearchbyBrand(){
header('Content-type:application/json'); header('Content-type:application/json');
...@@ -2745,6 +2764,29 @@ ...@@ -2745,6 +2764,29 @@
$result = $this->Webservice_model->socialLogin($postData); $result = $this->Webservice_model->socialLogin($postData);
echo json_encode($result);exit; echo json_encode($result);exit;
} }
public function getCustRemainders(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getCustRemainders($postData);
echo json_encode($result);exit;
}
public function changeReminderStatus(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$this->load->model('Vehicle_model');
$result = $this->Vehicle_model->changeReminderStatus($postData);
echo json_encode($result);exit;
}
} }
......
...@@ -208,9 +208,9 @@ class Booking_model extends CI_Model { ...@@ -208,9 +208,9 @@ class Booking_model extends CI_Model {
BK.customer_veh_id,BK.scheduled_date,BK.scheduled_time,BK.cost,BK.status,BK.mileage, BK.customer_veh_id,BK.scheduled_date,BK.scheduled_time,BK.cost,BK.status,BK.mileage,
BK.issues_selected,VEH.car_name,BK.custom_issue_data,VEH.car_model,VEH.car_maker, BK.issues_selected,VEH.car_name,BK.custom_issue_data,VEH.car_model,VEH.car_maker,
VEH.car_model_year,VEH.car_vin,VEH.vehicle_data,BK.car_location,BK.car_loc_lat, VEH.car_model_year,VEH.car_vin,VEH.vehicle_data,BK.car_location,BK.car_loc_lat,
BK.car_loc_lng,CUST.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone, BK.car_loc_lng,CUST.first_name AS custFirstName,CUST.last_name AS custLastName,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth,CUSQTE.custom_id, CUST.phone,CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth,
MBK.status AS mech_status CUSQTE.custom_id,MBK.status AS mech_status
FROM bookings AS BK FROM bookings AS BK
INNER JOIN mechanic_booking AS MBK ON (MBK.booking_id=BK.booking_id) INNER JOIN mechanic_booking AS MBK ON (MBK.booking_id=BK.booking_id)
INNER JOIN customers AS CUST ON (CUST.customer_id=BK.customer_id) INNER JOIN customers AS CUST ON (CUST.customer_id=BK.customer_id)
......
...@@ -132,7 +132,7 @@ class Vehicle_model extends CI_Model { ...@@ -132,7 +132,7 @@ class Vehicle_model extends CI_Model {
return $last_id; return $last_id;
} }
function updateVehModel($model_id = '', $model_data = array()){ public function updateVehModel($model_id = '', $model_data = array()){
if(empty($model_id) || empty($model_data)){ if(empty($model_id) || empty($model_data)){
return 0; return 0;
} }
...@@ -140,5 +140,16 @@ class Vehicle_model extends CI_Model { ...@@ -140,5 +140,16 @@ class Vehicle_model extends CI_Model {
return ($status)?1:0; return ($status)?1:0;
} }
public function changeReminderStatus($postData = array()){
$respArr = array('status'=>'error');
if(empty($postData)){
$respArr['message'] = 'All Field is Required';
}
if($this->db->update('customer_vehicle',array('enable_notification'=>$postData['status']),array('customer_veh_id'=>$postData['customer_veh_id']))){
$respArr['status'] = 'success';
}
return $respArr;
}
} }
?> ?>
\ No newline at end of file
...@@ -690,16 +690,21 @@ class Webservice_model extends CI_Model { ...@@ -690,16 +690,21 @@ class Webservice_model extends CI_Model {
return $respArr; return $respArr;
} }
public function getBrands(){ public function getBrands($type='0'){
$respArr = array('status'=>'error'); $respArr = array('status'=>'error');
$prdt_brand = $this->db->get_where('product_brand',array('status'=>'1'))->result(); $prdt_brand = $this->db->get_where('product_brand',array('status'=>'1'))->result();
if(count($prdt_brand) > 0){ if(count($prdt_brand) > 0){
$query = $this->db->query("SELECT MIN(amount) AS minamount, MAX(amount) AS maxamount $query = $this->db->query("SELECT MIN(amount) AS minamount, MAX(amount) AS maxamount
FROM products WHERE status='1'")->row(); FROM products WHERE status='1'")->row();
$respArr['status'] = 'success'; $respArr['status'] = 'success';
$respArr['brands'] = $prdt_brand; if($type == '0'){
$respArr['minamount'] = $query->minamount; $respArr['minamount'] = $query->minamount;
$respArr['maxamount'] = $query->maxamount; $respArr['maxamount'] = $query->maxamount;
$respArr['brands'] = $prdt_brand;
}else{
$respArr['data'] = $prdt_brand;
}
} }
return $respArr; return $respArr;
} }
...@@ -1347,7 +1352,54 @@ class Webservice_model extends CI_Model { ...@@ -1347,7 +1352,54 @@ class Webservice_model extends CI_Model {
$respArr['status'] = 1; $respArr['status'] = 1;
return $respArr; return $respArr;
} }
}
public function getCustRemainders($postData=array()){
$respArr = array('status'=>'error');
if(empty($cust_id = $postData['customer_id'])){
$respArr['message'] = 'Customer Id is Required' ;
}
$new = array();
$result = $this->db->get_where('customer_vehicle',
array('customer_id'=>$cust_id,'enable_notification'=>'1','status'=>'1'));
if(!empty($result) && !empty($result = $result->result_array())){
foreach ($result AS $veh_value) {
$veh_id = $veh_value['customer_veh_id'];
$this->db->where('customer_veh_id',$veh_id);
$this->db->where_in('status',array('1','3'));
$this->db->order_by('booking_id','DESC');
$lstBok = $this->db->get("bookings");
$lastMainDate = $veh_value['last_maintenance_date'];
if(!empty($lstBok) && $lstBok->num_rows() > 0 && !empty($lstBok = $lstBok->row_array())){
if(strtotime($lstBok['scheduled_date']) > strtotime($lastMainDate)){
$lastMainDate = $lstBok['scheduled_date'];
}
}
if(empty($lastMainDate)){
continue;
}
$interval = (!empty($veh_value['maintanence_interval']))?$veh_value['maintanence_interval']:6;
$newMainDate = strtotime(date("Y-m-d", strtotime($lastMainDate)) . " +".$interval." month");
$remindDate = strtotime(date("Y-m-d", $newMainDate) . " -10 days");
if(strtotime(date('Y-m-d')) >= $remindDate){
$veh_value['last_maintenance_date'] = $lastMainDate;
$veh_value['next_maintenance_date'] = date('Y-m-d',$newMainDate);
$new[] = $veh_value;
}
}
if(count($new) > 0){
$respArr['status'] = 'success';
$respArr['data'] = $new;
}
}
return $respArr;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment