Commit bcd66733 by Jansa Jose

add car location

parent 0672de6e
......@@ -168,12 +168,13 @@ class Webservice_model extends CI_Model {
$this->db->join("mechanic_booking","mechanic_booking.booking_id = bookings.booking_id");
$this->db->join("mechanic","mechanic_booking.mechanic_id = mechanic.mechanic_id");
$this->db->join("mechanic_shop","mechanic_shop.shop_id = mechanic.shop_id","left");
$this->db->where('scheduled_date >',date('Y-m-d h:i'));
// $this->db->where('scheduled_date >',date('Y-m-d h:i'));
$this->db->where('bookings.status !=','0');
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$this->db->group_by('id');
$this->db->order_by('id','DESC');
$bookData = $this->db->get_where('bookings',$where)->result_array();
$respArr['status'] = 'success';
$respArr['message'] = 'success';
......@@ -338,13 +339,19 @@ class Webservice_model extends CI_Model {
$date =(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?date('Y-m-d'):date('Y-m-d',$postData['date']/1000);
$time = (isset($postData['is_emergency']) && !empty($postData['is_emergency']))?date('h:i A'):$postData['time'];
$cost = (isset($postData['is_emergency']) && !empty($postData['is_emergency']))?0:$postData['total_cost'];
$car_location = (isset($postData['location']) && !empty($postData['location']))?$postData['location']:'';
$car_loc_lat = (isset($postData['location_lat']) && !empty($postData['location_lat']))?$postData['location_lat']:'';
$car_loc_lng = (isset($postData['location_long']) && !empty($postData['location_long']))?$postData['location_long']:'';
$insert_array = array(
'cost'=>$cost,
'scheduled_date'=>$date,
'scheduled_time'=>$time,
'issues_selected'=>$issues,
'service_type'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?2:1,
'status'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?1:5
'status'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?1:5,
'car_location'=> $car_location,
'car_loc_lat'=>$car_loc_lat,
'car_loc_lng'=>$car_loc_lng
);
if($this->db->update('bookings',$insert_array,array('booking_id'=>$postData['booking_id']))){
$this->db->insert("mechanic_booking",array('booking_id'=>$postData['booking_id'],'mechanic_id'=>$postData['mechanic_id'],'amount'=>$cost,'status'=>'0'));
......
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