Commit d35c425a by Jansa Jose

Merge branch 'master' into 'local_production'

Master See merge request !193
parents c0a24a45 3f02efd5
...@@ -23,14 +23,15 @@ ...@@ -23,14 +23,15 @@
$this->load->model('Webservice_model'); $this->load->model('Webservice_model');
$this->load->library('form_validation'); $this->load->library('form_validation');
//define("PAYSTACK_SECRET_KEY", "sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273"); define("PAYSTACK_SECRET_KEY", "sk_live_ac1f5350a42852fd3439fdac8ba1d434f1c42360");
define("PAYSTACK_SECRET_KEY", "sk_test_dae3d816baeeabcab5063def4aad5fe546e9758d"); date_default_timezone_set('Asia/Kolkata');
} }
// customer_login // customer_login
public function customer_login(){ public function customer_login(){
header('Content-type: application/json'); header('Content-type: application/json');
$post = file_get_contents("php://input"); $post = file_get_contents("php://input");
$postData = json_decode($post, true); $postData = json_decode($post, true);
//pr($postData);
$this->load->model('Customer_model'); $this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Required Fields are empty.'); $respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) || if(!isset($postData['email']) || empty($postData['email']) ||
...@@ -423,6 +424,7 @@ ...@@ -423,6 +424,7 @@
} }
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
// addCustomerCar // addCustomerCar
public function addCustomerCar(){ public function addCustomerCar(){
header('Content-type: application/json'); header('Content-type: application/json');
...@@ -2781,11 +2783,11 @@ ...@@ -2781,11 +2783,11 @@
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$new_time = date("Y-m-d H:i:s",strtotime("+10 minutes", strtotime($value['datetime']))); $new_time = date("Y-m-d H:i:s",strtotime("+10 minutes", strtotime($value['datetime'])));
if(strtotime($current_time) > strtotime($new_time)){ if(strtotime($current_time) > strtotime($new_time)){
if($this->db->update('transaction',array('status'=>'0'))){ if($this->db->update('transaction',array('status'=>'0'),array('id'=>$value['id']))){
if($value['payment_for'] == '1'){ if($value['payment_for'] == '1'){
$this->db->update('bookings',array('status'=>'7')); $this->db->update('bookings',array('status'=>'7'),array('booking_id'=>$value['booking_id']));
}else{ }else{
$this->db->update('orders',array('status'=>'9')); $this->db->update('orders',array('status'=>'9'),array('booking_id'=>$value['booking_id']));
} }
} }
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
$this->load->model('Webservice_mechanic_model'); $this->load->model('Webservice_mechanic_model');
$this->load->library('form_validation'); $this->load->library('form_validation');
define("PAYSTACK_SECRET_KEY", "sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273"); define("PAYSTACK_SECRET_KEY", "sk_live_ac1f5350a42852fd3439fdac8ba1d434f1c42360");
} }
// customer_login // customer_login
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
public function get_todays_services(){ public function get_todays_services(){
header('Content-type: application/json'); header('Content-type: application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ if(!isset($headers['auth']) || empty($headers['auth'])){
$respArr['status'] = 'error'; $respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required'; $respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
$authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['Auth']); $authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
echo json_encode($authRes);exit; echo json_encode($authRes);exit;
} }
...@@ -102,12 +102,12 @@ ...@@ -102,12 +102,12 @@
public function services_details(){ public function services_details(){
header('Content-type: application/json'); header('Content-type: application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ if(!isset($headers['auth']) || empty($headers['auth'])){
$respArr['status'] = 'error'; $respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required'; $respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
$authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['Auth']); $authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
echo json_encode($authRes);exit; echo json_encode($authRes);exit;
} }
...@@ -125,12 +125,12 @@ ...@@ -125,12 +125,12 @@
public function get_service_history(){ public function get_service_history(){
header('Content-type: application/json'); header('Content-type: application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ if(!isset($headers['auth']) || empty($headers['auth'])){
$respArr['status'] = 'error'; $respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required'; $respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
$authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['Auth']); $authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
echo json_encode($authRes);exit; echo json_encode($authRes);exit;
} }
...@@ -183,12 +183,12 @@ ...@@ -183,12 +183,12 @@
public function logout(){ public function logout(){
header('Content-type: application/json'); header('Content-type: application/json');
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ if(!isset($headers['auth']) || empty($headers['auth'])){
$respArr['status'] = 'error'; $respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required'; $respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit; echo json_encode($respArr);exit;
} }
$authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['Auth']); $authRes = $this->Webservice_mechanic_model->get_mechanic_authtoken($headers['auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
echo json_encode($authRes);exit; echo json_encode($authRes);exit;
} }
......
...@@ -59,11 +59,15 @@ class Booking_model extends CI_Model { ...@@ -59,11 +59,15 @@ class Booking_model extends CI_Model {
$this->db->insert('customer_vehicle',$insert_array); $this->db->insert('customer_vehicle',$insert_array);
$last_id = $this->db->insert_id(); $last_id = $this->db->insert_id();
} }
$time = (!is_numeric($postData['schedule_date']['time']))?
$postData['schedule_date']['time']:
date('h:i A',($postData['schedule_date']['time'])/1000);
$book_data = array('cost' => $postData['cost'], $book_data = array('cost' => $postData['cost'],
'mileage' => $vehData['milage'], 'mileage' => $vehData['milage'],
'customer_id' => $postData['customer_id'], 'customer_id' => $postData['customer_id'],
'scheduled_date' => $postData['schedule_date']['date'], 'scheduled_date' => $postData['schedule_date']['date'],
'scheduled_time' => date('h:i A',($postData['schedule_date']['time'])/1000), 'scheduled_time' => $time,
'issues_selected' => json_encode($selected_issues), 'issues_selected' => json_encode($selected_issues),
'customer_veh_id' => $last_id, 'customer_veh_id' => $last_id,
'custom_issue_data'=> json_encode($postData['optionalData']), 'custom_issue_data'=> json_encode($postData['optionalData']),
...@@ -103,7 +107,8 @@ class Booking_model extends CI_Model { ...@@ -103,7 +107,8 @@ class Booking_model extends CI_Model {
FROM bookings AS BK FROM bookings AS BK
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id = BK.customer_veh_id) INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id = BK.customer_veh_id)
WHERE $cond WHERE $cond
GROUP BY BK.booking_id"; GROUP BY BK.booking_id
ORDER BY BK.booking_id DESC";
$bookData = $this->db->query($sql); $bookData = $this->db->query($sql);
if(empty($bookData)){ if(empty($bookData)){
return 0; return 0;
......
...@@ -162,7 +162,7 @@ class Mechanic_model extends CI_Model { ...@@ -162,7 +162,7 @@ class Mechanic_model extends CI_Model {
LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1') LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1')
WHERE AU.status='1' WHERE AU.status='1'
-- GROUP BY ME.mechanic_id -- GROUP BY ME.mechanic_id
-- HAVING distance<30"; HAVING distance<10";
$mechData = $this->db->query($sql); $mechData = $this->db->query($sql);
if(empty($mechData) || empty($mechData = $mechData->result_array())){ if(empty($mechData) || empty($mechData = $mechData->result_array())){
......
...@@ -82,7 +82,7 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -82,7 +82,7 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$this->db->order_by('BUK.scheduled_date','ASC'); $this->db->order_by('BUK.scheduled_date','ASC');
} }
$this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,BUK.status,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount,BUK.cost,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data,CSTVEH.car_loc_lat as cust_lat,CSTVEH.car_loc_lng as cust_lng,CSTVEH.car_location as cust_address"); $this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,BUK.status,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount,BUK.cost,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data,CSTVEH.car_loc_lat as cust_lat,CSTVEH.car_loc_lng as cust_lng,CSTVEH.car_location as cust_address,BUK.car_loc_lat,BUK.car_loc_lng,BUK.car_location");
$this->db->from('bookings as BUK'); $this->db->from('bookings as BUK');
$this->db->join('customers as CUST','CUST.customer_id = BUK.customer_id'); $this->db->join('customers as CUST','CUST.customer_id = BUK.customer_id');
$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');
...@@ -106,6 +106,14 @@ public function getBookedService($postData = array(),$start = '',$per_page = '', ...@@ -106,6 +106,14 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
$bookData[$key]['service_message'] = (isset($custom_issue_data->optionlaDescription))?$custom_issue_data->optionlaDescription:''; $bookData[$key]['service_message'] = (isset($custom_issue_data->optionlaDescription))?$custom_issue_data->optionlaDescription:'';
$bookData[$key]['total_amount'] = ($value['type'] == '1')?$value['amount']:$value['cost']; $bookData[$key]['total_amount'] = ($value['type'] == '1')?$value['amount']:$value['cost'];
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data'],$bookData[$key]['amount'],$bookData[$key]['cost']); unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data'],$bookData[$key]['amount'],$bookData[$key]['cost']);
if($value['type'] == '2'){
// unset($bookData[$key]['cust_lat'],$bookData[$key]['cust_lng'],$bookData[$key]['cust_address']);
$bookData[$key]['cust_lat'] = $bookData[$key]['car_loc_lat'];
$bookData[$key]['cust_lng'] = $bookData[$key]['car_loc_lng'];
$bookData[$key]['cust_address'] = $bookData[$key]['car_location'];
}
unset($bookData[$key]['car_loc_lat'],$bookData[$key]['car_loc_lng'],$bookData[$key]['car_location']);
if(!empty($issues_selected)){ if(!empty($issues_selected)){
$new = array(); $new = array();
foreach ($issues_selected as $issue_key => $issue_value) { foreach ($issues_selected as $issue_key => $issue_value) {
......
...@@ -456,8 +456,8 @@ class Webservice_model extends CI_Model { ...@@ -456,8 +456,8 @@ class Webservice_model extends CI_Model {
FROM mechanic AS ME FROM mechanic AS ME
INNER JOIN admin_users AS AU ON (AU.id=ME.mechanic_id) INNER JOIN admin_users AS AU ON (AU.id=ME.mechanic_id)
LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1') LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1')
WHERE AU.status='1' WHERE AU.status='1'
-- HAVING distance<30 HAVING distance<10
".$limt; ".$limt;
$mechData = $this->db->query($sql); $mechData = $this->db->query($sql);
if(empty($mechData) || empty($mechData = $mechData->result_array())){ if(empty($mechData) || empty($mechData = $mechData->result_array())){
......
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