Commit 7b8c60ab by Jansa Jose

Merge branch 'master' into 'local_production'

changes in webservice See merge request !98
parents 68814c53 469b808f
......@@ -66,15 +66,19 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$respArr['message'] = "All Field is Required";
return $respArr;
}
if($status == 1){
$stat = array('1','6');
}else{
$stat = array('3');
}
$where = array('BUK.status'=>$status,'MCHBUK.mechanic_id'=>$postData['mechanic_id']);
if(isset($postData['service_id']) && !empty($postData['service_id'])){
$where['BUK.booking_id'] = $postData['service_id'];
}
if($type == 1){
//$where['BUK.scheduled_date'] = date('Y-m-d');
$this->db->where('BUK.scheduled_date >=', date('Y-m-d'));
$this->db->order_by('BUK.scheduled_date','ASC');
$this->db->where('BUK.scheduled_date >=', date('Y-m-d'));
$this->db->order_by('BUK.scheduled_date','ASC');
}
// else if($type == 2){
// $where['BUK.scheduled_date'] = date("Y-m-d", strtotime('tomorrow'));
......@@ -86,67 +90,64 @@ 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('mechanic_booking as MCHBUK','MCHBUK.booking_id = BUK.booking_id');
$this->db->join('mechanic AS MCH','MCHBUK.mechanic_id=MCH.mechanic_id');
$this->db->where_in("BUK.status",$stat);
$this->db->where($where);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
$this->db->limit($per_page,$start);
}
$bookData = $this->db->get();
if(!empty($bookData) && $bookData->num_rows() > 0){
$bookData = $bookData->result_array();
foreach ($bookData as $key => $value) {
$issues_selected = json_decode($value['issues_selected']);
$custom_issue_data = json_decode($value['custom_issue_data']);
$bookData[$key]['service_image'] = $custom_issue_data->optionalImages;
$bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription;
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$new = array();
foreach ($issues_selected as $issue_key => $issue_value) {
$sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='".$postData['mechanic_id']."' AND MI.status='1')
WHERE IC.status='1' AND IC.issue_cat_id='".$issue_value->sub_issue_id."'";
$issue_data = $this->db->query($sql)->row();
if(!empty($issue_data)){
if($issue_data->custom_description != '' && $issue_data->custom_service_fee != ''){
$new[$issue_key]['description'] = $issue_data->custom_description;
$new[$issue_key]['service_fee'] = $issue_data->custom_service_fee;
$bookData = $bookData->result_array();
foreach ($bookData as $key => $value) {
$issues_selected = json_decode($value['issues_selected']);
$custom_issue_data = json_decode($value['custom_issue_data']);
$bookData[$key]['service_image'] = $custom_issue_data->optionalImages;
$bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription;
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$new = array();
foreach ($issues_selected as $issue_key => $issue_value) {
$sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='".$postData['mechanic_id']."' AND MI.status='1')
WHERE IC.status='1' AND IC.issue_cat_id='".$issue_value->sub_issue_id."'";
$issue_data = $this->db->query($sql)->row();
if(!empty($issue_data)){
if($issue_data->custom_description != '' && $issue_data->custom_service_fee != ''){
$new[$issue_key]['description'] = $issue_data->custom_description;
$new[$issue_key]['service_fee'] = $issue_data->custom_service_fee;
}else{
$new[$issue_key]['description'] = $issue_data->default_description;
$new[$issue_key]['service_fee'] = $issue_data->default_service_fee;
$new[$issue_key]['description'] = $issue_data->default_description;
$new[$issue_key]['service_fee'] = $issue_data->default_service_fee;
}
$new[$issue_key]['issue_name'] = $issue_data->issue_category;
}
$bookData[$key]['service_name'] = $new;
}
$bookData[$key]['service_name'] = $new;
}
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $bookData;
}
}
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $bookData;
}
return $respArr;
return $respArr;
}
public function mechanic_logout($mechanic_id){
$respArr = array('status'=>'error');
$status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id));
if($status){
$respArr['status'] = "success";
$respArr['message'] = "Logged Out Successfully";
$respArr = array('status'=>'error');
$status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id));
if($status){
$respArr['status'] = "success";
$respArr['message'] = "Logged Out Successfully";
}
return $status;
}
public function forgot_password($username){
$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'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username Doesnot Exist";
return $respArr;
$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'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username Doesnot Exist";
return $respArr;
}
$respArr['status'] = "success";
$respArr['message'] = "success";
......@@ -154,36 +155,32 @@ public function forgot_password($username){
return $respArr;
}
public function change_password($postData = array())
{
$respArr = array('status'=>'error');
$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())){
$respArr['message'] = "Username doesnot Exist";
return $respArr;
}
if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){
$respArr['status'] = "success";
$respArr['message'] = "Password Updated Successfully";
}
public function change_password($postData = array()){
$respArr = array('status'=>'error');
$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())){
$respArr['message'] = "Username doesnot Exist";
return $respArr;
}
if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){
$respArr['status'] = "success";
$respArr['message'] = "Password Updated Successfully";
}
return $respArr;
}
public function start_service($postData = array(),$type = 0){
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
$status = ($type == '1')?3:6;
$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']))){
$respArr['status'] = "success";
$respArr['message'] = ($type == '1')?"Service Completed Successfully":"Service Started Successfully";
}
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
$status = ($type == '1')?3:6;
$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']))){
$respArr['status'] = "success";
$respArr['message'] = ($type == '1')?"Service Completed Successfully":"Service Started Successfully";
}
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