Commit 3e57f196 by Jansa Jose

Merge branch 'master' into 'dev_production'

Master See merge request !155
parents 9061518e 22098448
<?php
defined('BASEPATH')OR exit('No direct script access allowed');
defined('BASEPATH') OR exit('No direct script access allowed');
header('Content-Type: text/html; charset=utf-8');
if(isset($_SERVER['HTTP_ORIGIN'])) {
......@@ -1273,7 +1273,7 @@
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$postData['customer_id'] = $authRes['data'];
$postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->rate_mechanic($postData);
echo json_encode($result);exit;
}
......@@ -1430,6 +1430,12 @@
}
send_mail($subject,$email_id,$message);
}
$fcm_data = $this->Webservice_model->getfcmData($ref,$mobile);
if($fcm_data['status'] == "success"){
$fcm_data['data']['title'] = "CarFixxers";
$fcm_data['data']['message'] = "A New Service Available";
$this->push_sent_cancel($fcm_data['data']);
}
if($mobile == '1'){
redirect('Webservices/mobPaySuccess');
} else {
......@@ -1443,6 +1449,28 @@
}
}
}
public function push_sent_cancel($fcm_data=array()) {
$settings = getSettings();
$key = $settings['app_id'];
if(empty($key) || empty($fcm_data)){
return;
}
$data = "{ \"notification\": { \"title\": \"".$fcm_data['title']."\", \"text\": \"".$fcm_data['message']."\", \"sound\": \"default\" }, \"time_to_live\": 60, \"data\" : {\"response\" : {\"status\" : \"success\", \"data\" : {\"service_id\" : \"".$fcm_data['booking_id']."\", \"type\" : \"".$fcm_data['service_type']."\"}}}, \"collapse_key\" : \"trip\", \"priority\":\"high\", \"to\" : \"".$fcm_data['device_id']."\"}";
$ch = curl_init("https://fcm.googleapis.com/fcm/send");
$header = array('Content-Type: application/json', 'Authorization: key='.$key);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
//Search Products
public function productSearch(){
header('Content-type:application/json');
......@@ -2705,5 +2733,40 @@
}
echo json_encode($respArr);exit;
}
public function forgot_password(){
header('Content-Type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($postData['email']) || empty($postData['email'])){
$respArr['status'] = "error";
$respArr['message'] = "Email Id is Required";
echo json_encode($respArr);exit;
}
$respArr = $this->Webservice_model->forgot_password($postData['email']);
echo json_encode($respArr);exit;
}
public function change_password(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($postData['email']) || empty($postData['email'])){
$respArr['status'] = "error";
$respArr['message'] = "Email Id is Required";
echo json_encode($respArr);exit;
}
else if(!isset($postData['password']) || empty($postData['password'])){
$respArr['status'] = "error";
$respArr['message'] = "Password is Required";
echo json_encode($respArr);exit;
}
$respArr = $this->Webservice_model->change_password($postData);
echo json_encode($respArr);exit;
}
}
?>
......@@ -151,7 +151,7 @@
$postData = json_decode($post, true);
$postData['mechanic_id'] = $authRes['data']['mechanic_id'];
$bookDataCount = $this->Webservice_mechanic_model->getBookedService($postData,0,0,0,3);
$bookDataResult = $this->Webservice_mechanic_model->getBookedService($postData,$start,$per_page,0,3);
$bookDataResult=$this->Webservice_mechanic_model->getBookedService($postData,$start,$per_page,0,3);
$total = 0;
if($bookDataCount['status'] == 'success'){
$total = count($bookDataCount['data']);
......
......@@ -113,6 +113,9 @@ class Booking_model extends CI_Model {
$bookDetails = array();
$bookData = $bookData->result();
foreach($bookData AS $book) {
if(empty($book->scheduled_date) || empty($book->scheduled_time)){
continue;
}
$bookMechData=$this->db->query("SELECT * FROM mechanic_booking
WHERE booking_id='$book->booking_id' AND status!='2'");
if(!empty($bookMechData)){
......
......@@ -86,7 +86,7 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
// $where['BUK.scheduled_date'] = date("Y-m-d", strtotime('tomorrow'));
// }
$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 as total_amount,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");
$this->db->from('bookings as BUK');
$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');
......@@ -97,34 +97,42 @@ public function getBookedService($postData = array(),$start = '',$per_page = '',
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$this->db->order_by('BUK.booking_id','DESC');
$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;
}else{
$new[$issue_key]['description'] = $issue_data->default_description;
$new[$issue_key]['service_fee'] = $issue_data->default_service_fee;
$bookData[$key]['trim'] = json_decode($value['vehicle_data'])->trim;
$bookData[$key]['engine_no'] = json_decode($value['vehicle_data'])->engine;
$bookData[$key]['service_image'] = (isset($custom_issue_data->optionalImages))?$custom_issue_data->optionalImages:[];
$bookData[$key]['service_message'] = (isset($custom_issue_data->optionlaDescription))?$custom_issue_data->optionlaDescription:'';
$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']);
if(!empty($issues_selected)){
$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]['issue_name'] = $issue_data->issue_category;
}
$new[$issue_key]['issue_name'] = $issue_data->issue_category;
$bookData[$key]['service_name'] = $new;
}
$bookData[$key]['service_name'] = $new;
}
}
$respArr['status'] = 'success';
......@@ -177,7 +185,7 @@ public function start_service($postData = array(),$type = 0){
return $respArr;
}
$status = ($type == '1')?3:6;
$cost = ($postData['emergency'] == '2')?$postData['amount']:'';
$cost = ($postData['emergency'] == '2')?$postData['amount']:0;
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";
......
......@@ -95,6 +95,10 @@
<label>Web Url</label>
<input type="text" name="web_url" class="form-control required" placeholder="Enter Web Url" value="<?= $data['web_url'] ?>">
</div>
<div class="form-group col-xs-4">
<label>App Id</label>
<input type="text" name="app_id" class="form-control required" placeholder="Enter App Id" value="<?= $data['app_id'] ?>">
</div>
</div>
</div>
<div class="box-footer" style="padding-left:46%">
......
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