Commit b5a38a64 by Jansa Jose

get booked service

parent 4869bf3e
......@@ -753,7 +753,7 @@
}
//Get Booked Services
public function get_booked_services(){
public function get_allocated_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
......@@ -772,6 +772,25 @@
echo json_encode($bookData);exit;
}
public function get_booked_services(){
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;
}
$bookData = $this->Webservice_model->get_booked_services($authRes['data']['customer_id']);
echo json_encode($bookData);exit;
}
//Add Vehicle Details
public function add_vehicle_details(){
header('Content-type: application/json');
......@@ -1111,7 +1130,7 @@
}
public function booked_service_details(){
public function allocated_service_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
......
......@@ -201,6 +201,29 @@ class Webservice_model extends CI_Model {
return $respArr;
}
public function get_booked_services($id){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($id)){
return $respArr;
}
$this->db->select("bookings.booking_id as id,bookings.scheduled_date as date,bookings.scheduled_time as time");
$this->db->where('scheduled_date >',date('Y-m-d h:i'));
$bookData = $this->db->get_where('bookings',array('bookings.customer_id'=>$id))->result_array();
$respArr['status'] = 'success';
$respArr['message'] = 'success';
if(!empty($bookData) && (count($bookData) > 0)){
foreach ($bookData as $key => $value) {
$bookData[$key]['date'] = (string) strtotime($value['date'])*1000;
$bookData[$key]['date'] = $bookData[$key]['date']."";
}
$respArr['data'] = $bookData;
}else{
$respArr['data'] = [];
}
return $respArr;
}
public function addVehicleDetails($postData = array(),$customer_id = ''){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
......
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