Commit 7b8c60ab by Jansa Jose

Merge branch 'master' into 'local_production'

changes in webservice See merge request !98
parents 68814c53 469b808f
...@@ -66,11 +66,15 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -66,11 +66,15 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$respArr['message'] = "All Field is Required"; $respArr['message'] = "All Field is Required";
return $respArr; return $respArr;
} }
if($status == 1){
$stat = array('1','6');
}else{
$stat = array('3');
}
$where = array('BUK.status'=>$status,'MCHBUK.mechanic_id'=>$postData['mechanic_id']); $where = array('BUK.status'=>$status,'MCHBUK.mechanic_id'=>$postData['mechanic_id']);
if(isset($postData['service_id']) && !empty($postData['service_id'])){ if(isset($postData['service_id']) && !empty($postData['service_id'])){
$where['BUK.booking_id'] = $postData['service_id']; $where['BUK.booking_id'] = $postData['service_id'];
} }
if($type == 1){ if($type == 1){
//$where['BUK.scheduled_date'] = date('Y-m-d'); //$where['BUK.scheduled_date'] = date('Y-m-d');
$this->db->where('BUK.scheduled_date >=', date('Y-m-d')); $this->db->where('BUK.scheduled_date >=', date('Y-m-d'));
...@@ -86,6 +90,7 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -86,6 +90,7 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$this->db->join('customer_vehicle as CSTVEH','CSTVEH.customer_veh_id = BUK.customer_veh_id'); $this->db->join('customer_vehicle as CSTVEH','CSTVEH.customer_veh_id = BUK.customer_veh_id');
$this->db->join('mechanic_booking as MCHBUK','MCHBUK.booking_id = BUK.booking_id'); $this->db->join('mechanic_booking as MCHBUK','MCHBUK.booking_id = BUK.booking_id');
$this->db->join('mechanic AS MCH','MCHBUK.mechanic_id=MCH.mechanic_id'); $this->db->join('mechanic AS MCH','MCHBUK.mechanic_id=MCH.mechanic_id');
$this->db->where_in("BUK.status",$stat);
$this->db->where($where); $this->db->where($where);
if($start != 0 || $per_page != 0){ if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start); $this->db->limit($per_page,$start);
...@@ -100,7 +105,6 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -100,7 +105,6 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription; $bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription;
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']); unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$new = array(); $new = array();
foreach ($issues_selected as $issue_key => $issue_value) { foreach ($issues_selected as $issue_key => $issue_value) {
$sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee $sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC FROM issues_category AS IC
...@@ -118,20 +122,18 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -118,20 +122,18 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
} }
$new[$issue_key]['issue_name'] = $issue_data->issue_category; $new[$issue_key]['issue_name'] = $issue_data->issue_category;
} }
$bookData[$key]['service_name'] = $new; $bookData[$key]['service_name'] = $new;
} }
} }
$respArr['status'] = 'success'; $respArr['status'] = 'success';
$respArr['message'] = 'success'; $respArr['message'] = 'success';
$respArr['data'] = $bookData; $respArr['data'] = $bookData;
} }
return $respArr; return $respArr;
} }
public function mechanic_logout($mechanic_id){ public function mechanic_logout($mechanic_id){
$respArr = array('status'=>'error'); $respArr = array('status'=>'error');
$status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id)); $status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id));
if($status){ if($status){
$respArr['status'] = "success"; $respArr['status'] = "success";
...@@ -142,7 +144,6 @@ public function mechanic_logout($mechanic_id){ ...@@ -142,7 +144,6 @@ public function mechanic_logout($mechanic_id){
public function forgot_password($username){ public function forgot_password($username){
$respArr = array('status'=>'error'); $respArr = array('status'=>'error');
$result = $this->db->query("SELECT MCH.phone as phone_number,AU.username as user_name FROM admin_users AS AU INNER JOIN mechanic AS MCH ON MCH.mechanic_id = AU.id WHERE AU.username LIKE '$username'"); $result = $this->db->query("SELECT MCH.phone as phone_number,AU.username as user_name FROM admin_users AS AU INNER JOIN mechanic AS MCH ON MCH.mechanic_id = AU.id WHERE AU.username LIKE '$username'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){ if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username Doesnot Exist"; $respArr['message'] = "Username Doesnot Exist";
...@@ -154,16 +155,13 @@ public function forgot_password($username){ ...@@ -154,16 +155,13 @@ public function forgot_password($username){
return $respArr; return $respArr;
} }
public function change_password($postData = array()) public function change_password($postData = array()){
{
$respArr = array('status'=>'error'); $respArr = array('status'=>'error');
$result = $this->db->query("SELECT * FROM admin_users WHERE username LIKE '".$postData['user_name']."'"); $result = $this->db->query("SELECT * FROM admin_users WHERE username LIKE '".$postData['user_name']."'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){ if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username doesnot Exist"; $respArr['message'] = "Username doesnot Exist";
return $respArr; return $respArr;
} }
if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){ if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){
$respArr['status'] = "success"; $respArr['status'] = "success";
$respArr['message'] = "Password Updated Successfully"; $respArr['message'] = "Password Updated Successfully";
...@@ -176,7 +174,6 @@ public function start_service($postData = array(),$type = 0){ ...@@ -176,7 +174,6 @@ public function start_service($postData = array(),$type = 0){
if(empty($postData)){ if(empty($postData)){
return $respArr; return $respArr;
} }
$status = ($type == '1')?3:6; $status = ($type == '1')?3:6;
$cost = ($postData['emergency'] == '2')?$postData['amount']:''; $cost = ($postData['emergency'] == '2')?$postData['amount']:'';
if($this->db->update('bookings',array('service_type'=>$postData['emergency'],'cost'=>$cost,'status'=>$status),array('booking_id'=>$postData['service_id']))){ if($this->db->update('bookings',array('service_type'=>$postData['emergency'],'cost'=>$cost,'status'=>$status),array('booking_id'=>$postData['service_id']))){
......
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