Commit 5bdd3c30 by Jansa Jose

book service api

parent 5be93fc5
......@@ -1087,15 +1087,15 @@
$err = 1;
$msg = 'Time is Required';
}
else if(!isset($postData['total_cost']) || empty($postData['total_cost'])){
$err = 1;
$msg = 'Total Cost is Required';
}
}
if(!isset($postData['booking_id']) || empty($postData['booking_id'])){
$err = 1;
$msg = 'Booking Id is Required';
}
else if(!isset($postData['total_cost']) || empty($postData['total_cost'])){
$err = 1;
$msg = 'Total Cost is Required';
}
else if(!isset($postData['mechanic_id']) || empty($postData['mechanic_id'])){
$err = 1;
$msg = 'Mechanic Id is Required';
......
......@@ -301,15 +301,16 @@ class Webservice_model extends CI_Model {
$issues = (isset($postData['is_emergency']) && !empty($postData['is_emergency']))?'':json_encode($postData['service_id']);
$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'];
$insert_array = array(
'cost'=>$postData['total_cost'],
'cost'=>$cost,
'scheduled_date'=>$date,
'scheduled_time'=>$time,
'issues_selected'=>$issues
);
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'=>$postData['total_cost'],'status'=>'0'));
$this->db->insert("mechanic_booking",array('booking_id'=>$postData['booking_id'],'mechanic_id'=>$postData['mechanic_id'],'amount'=>$cost,'status'=>'0'));
$this->db->select("bookings.scheduled_time,bookings.scheduled_date,customer_vehicle.car_model as vehicle_model,customer_vehicle.car_maker as vehicle_make,customer_vehicle.car_model_year as vehicle_year,customer_vehicle.vehicle_data,TRIM(concat(mechanic.first_name,' ',IFNULL(mechanic.last_name,''))) as mechanic_name,mechanic_shop.shop_name as mechanic_shop,mechanic.address,mechanic.phone,admin_users.profile_image as image,bookings.mileage,bookings.issues_selected");
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
......@@ -714,15 +715,14 @@ class Webservice_model extends CI_Model {
$result = $this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS count,PRD.*,PI.image".$cartSel."
FROM products AS PRD
LEFT JOIN cardetails AS CRD ON (PRD.cardetail_id=CRD.id)
LEFT JOIN product_cars AS CRD ON (PRD.product_id=CRD.product_id)
LEFT JOIN product_rating AS REV ON (REV.product_id=PRD.product_id)
LEFT JOIN vehicles_model AS VEHM ON (VEHM.veh_modal_id=CRD.veh_modal_id)
LEFT JOIN vehicles_model AS VEHM ON (VEHM.veh_modal_id=CRD.veh_model_id)
LEFT JOIN product_images AS PI ON (PI.id=
(SELECT MIN(id) FROM product_images
WHERE product_id=PRD.product_id AND PRD.status='1')) ".$cartJoin."
WHERE $where PRD.status='1'
GROUP BY PRD.product_id,PI.product_id $lmt");
//pr($this->db->last_query());
if(!empty($result) && $result->num_rows() > 0){
$result = $result->result_array();
foreach ($result as $key => $value) {
......
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