Commit 5c184d65 by Tobin

Merge branch 'master' into 'local_production'

Master See merge request !43
parents ebb43da9 238e55f8
<?php
defined('BASEPATH')OR exit('No direct script access allowed');
header('Content-Type: text/html; charset=utf-8');
// Allow from any origin
if(isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}
class Webservices extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Webservice_model');
$this->load->library('form_validation');
$auth = '';
$class = $this->router->fetch_class();
$method = $this->router->fetch_method();
if($this->input->server('REQUEST_METHOD') == 'GET')
$postdata = json_encode($_GET);
else if ($this->input->server('REQUEST_METHOD') == 'POST')
$postdata = file_get_contents("php://input");
if (isset(apache_request_headers()['Auth'])) {
$auth = apache_request_headers()['Auth'];
}
}
// customer_login
public function customer_login(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
echo json_encode($respArr);exit;
}
$custResp = $this->Customer_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = '1';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '3'){
$respArr['status'] = '3';
$respArr['message'] = 'Invalid Password';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_forgot_password
public function customer_forgot_password(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(empty($postData) || !isset($postData['email']) || empty($postData['email'])){
echo json_encode($respArr);exit;
}
$custResp = $this->Customer_model->genCustForgotPassLink($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
/*
MAIL SENT CONFIGARATION -- TODO
*/
$respArr['status'] = '1';
$respArr['message'] = 'Password Reset Email has been sent';
}
echo json_encode($respArr); exit;
}
// customer_registration
public function customer_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
if(isset($postData['phone']) && empty($postData['phone'])){
unset($postData['phone']);
}
unset($postData['promocode']);
$custResp = $this->Customer_model->createCustomer($postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp == '1'){
$custResp = $this->Customer_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = '1';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp == '3'){
$respArr['status'] = '2';
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_registration
public function service_provider_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createServiceProvider($postData);
if($custResp == '0'){
$respArr['message'] = 'Something went wrong.';
} else if($custResp == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
} else if($custResp == '2'){
$respArr['message'] = 'Email Address already in use';
} else if($custResp == '3'){
$respArr['message'] = 'Phone already in use';
}
echo json_encode($respArr); exit;
}
// getGeneralIssues
public function getGeneralIssues(){
header('Content-type: application/json');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
$this->load->model('Issue_model');
$issue_data = $this->Issue_model->getGeneralIssues();
if(!empty($issue_data)){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
$respArr['issue_data'] = $issue_data;
}
echo json_encode($respArr); exit;
}
// getNearByMechanics
public function getNearByMechanics(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Mechanic_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['pickup_data']) || !isset($postData['sub_issues']) ||
empty($postData['pickup_data']) || empty($postData['sub_issues']) ){
echo json_encode($respArr); exit;
}
$mechanic_data = $this->Mechanic_model->getNearByMechanics($postData['pickup_data'],$postData['sub_issues']);
if(!empty($mechanic_data)){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
$respArr['mechanic_data'] = $mechanic_data;
}
echo json_encode($respArr); exit;
}
// scheduleNow
public function scheduleNow(){
header('Content-type: application/json');
$postData = $_POST;
$optionalData = array('optionlaDescription'=>'','optionalImages'=>array(),'optionalVideos'=>array());
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || empty($postData = json_decode($postData['data'],true)) ||
!isset($postData['cost']) || empty($postData['cost']) ||
!isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['mechanic_id']) || empty($postData['mechanic_id']) ||
!isset($postData['pickup_data']) || empty($postData['pickup_data']) ||
!isset($postData['vechile_info']) || empty($postData['vechile_info']) ||
!isset($postData['schedule_date']) || empty($postData['schedule_date']) ||
!isset($postData['selected_issues']) || empty($postData['selected_issues'])){
echo json_encode($respArr);exit;
}
$optionalData['optionlaDescription'] = (isset($postData['optionalDescription']) &&
!empty($postData['optionalDescription']))?
$postData['optionalDescription']:'';
if(isset($_FILES) && !empty($_FILES)){
foreach ($_FILES as $fileIndex => $optImgs) {
if(empty($optImgs) || !isset($optImgs['name']) || empty($optImgs['name'])){
continue;
}
$this->load->library('upload');
$config = set_upload_service("assets/uploads/services");
$config['file_name'] = 'optionalImages'.$postData['customer_id'].date('dmYHis');
$this->upload->initialize($config);
if($this->upload->do_upload($fileIndex)){
$upload_data = $this->upload->data();
$optionalData['optionalImages'][] = $config['upload_path']."/".$upload_data['file_name'];
}
}
}
$this->load->model('Booking_model');
$postData['optionalData'] = $optionalData;
$status = $this->Booking_model->scheduleBooking($postData);
if($status){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
}
echo json_encode($respArr); exit;
}
// edit_customer_profile
public function edit_customer_profile(){
header('Content-type: application/json');
$postData = $_POST;
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || empty($postData = json_decode($postData['data'],true)) ||
!isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone';
}
else if(!isset($postData['address']) || empty($postData['address'])){
$err = 1;
$msg = 'Provide valid Address';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
if(isset($_FILES) && !empty($_FILES) &&
isset($_FILES['profile_image']) && !empty($_FILES['profile_image'])){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = $postData['customer_id']."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('profile_image')){
$upload_data = $this->upload->data();
$postData['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
$customer_id = $postData['customer_id'];
if(isset($postData['password']) && !empty($postData['password']) &&
isset($postData['cpassword']) && !empty($postData['cpassword']) &&
$postData['password'] == $postData['cpassword']){
$postData['password'] = md5($postData['password']);
} else {
unset($postData['password']);
}
unset($postData['cpassword']);
unset($postData['customer_id']);
$custResp = $this->Customer_model->updateCustomer($customer_id,$postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Profile successfully updated';
$respArr['profile_image'] = (isset($postData['profile_image']) && !empty($postData['profile_image']))?$postData['profile_image']:'';
echo json_encode($respArr);exit;
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp == '3'){
$respArr['status'] = '3';
$respArr['message'] = 'Phone Number already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customerVechiles
function customerVechiles(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$vehData = $this->Vehicle_model->getCustVechiles($postData);
if($vehData != '0'){
$respArr['status'] = 1;
$respArr['message'] = 'success';
$respArr['vehData'] = $vehData;
}
echo json_encode($respArr);exit;
}
// getCustBookDetails
function getCustBookDetails(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Booking_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$status = (isset($postData['status']) && !empty($postData['status']))?$postData['status']:'';
$bookingDetails = $this->Booking_model->getCustBookDetails($postData,$status);
if($bookingDetails != '0'){
$respArr['status'] = 1;
$respArr['message'] = 'success';
$respArr['bookData'] = $bookingDetails;
}
echo json_encode($respArr);exit;
}
// cancelBooking
function cancelBooking(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Booking_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['booking_id']) || empty($postData['booking_id'])){
echo json_encode($respArr);exit;
}
$status=$this->Booking_model->changeBookStatus($postData['customer_id'],$postData['booking_id'],'3');
if($status){
$respArr['status'] = 1;
$respArr['message'] = 'success';
}
echo json_encode($respArr);exit;
}
// deleteCustomerCar
function deleteCustomerCar(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['customer_veh_id']) || empty($postData['customer_veh_id'])){
echo json_encode($respArr);exit;
}
$status = $this->Vehicle_model->changeCustomerCarStatus($postData['customer_id'],
$postData['customer_veh_id'],'2');
if($status){
$respArr['status'] = 1;
$respArr['message'] = 'success';
}
echo json_encode($respArr);exit;
}
// addCustomerCar
function addCustomerCar(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$param = "";
$searchType = $postData['type'];
$searchData = $postData['vehicleData'];
$locationData = $postData['location'];
$vehicle_data['status'] = '1';
$vehicle_data['customer_id'] = $postData['customer_id'];
$vehicle_data['car_loc_lat'] = $locationData['location_lat'];
$vehicle_data['car_loc_lng'] = $locationData['location_lng'];
$vehicle_data['car_location'] = $locationData['location'];
$this->load->model('Settings_model');
$settings = $this->Settings_model->settings_viewing();
$searchData = $postData['vehicleData'];
if($searchType == 1 &&
isset($searchData['car_maker']) && !empty($searchData['car_maker']) &&
isset($searchData['modelName']) && !empty($searchData['modelName']) &&
isset($searchData['modelYear']) && !empty($searchData['modelYear'])){
$vehicle_data['car_maker'] = $searchData['car_maker'];
$vehicle_data['car_model'] = $searchData['modelName'];
$vehicle_data['car_model_year'] = $searchData['modelYear'];
$param = "?format=json&key=".urlencode($settings['vin_audit_api'])."&year=".
urlencode($searchData['modelYear'])."&make=".urlencode($searchData['car_maker']).
"&model=".urlencode($searchData['modelName']);
}
else if($searchType == 2 && isset($searchData['vin']) && !empty($searchData['vin'])){
$vehicle_data['car_vin'] = $searchData['vin'];
$param = "?format=json&key=".urlencode($settings['vin_audit_api']).
"&vin=".urlencode($searchData['vin']);
}
if(!empty($param)){
$vehData=file_get_contents("https://specifications.vinaudit.com/getspecifications.php".$param);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
echo json_encode($return_arr);exit;
}
if(!isset($vehData['success']) || empty($vehData['success']) || $vehData['success'] == false){
$return_arr['status'] = 2;
$return_arr['message'] = 'No Data Found.';
echo json_encode($return_arr);exit;
}
if($searchType == 2){
$vehicle_data['car_model'] = $vehData['attributes']['Model'];
$vehicle_data['car_maker'] = $vehData['attributes']['Make'];
$vehicle_data['car_model_year'] = $vehData['attributes']['Year'];
$vehData['vehicle']= $vehData['attributes']['Year'].' '.$vehData['attributes']['Make'].' '.
$vehData['attributes']['Model'].' '.$vehData['attributes']['Trim'];
}
$vehicle_data['car_name'] = $vehData['vehicle'];
$vehicle_data['vehicle_data'] = json_encode($vehData);
$car_id = $this->Vehicle_model->addVehicle($vehicle_data);
if(!empty($car_id)){
$return_arr['status'] = '1';
$return_arr['car_id'] = $car_id;
$return_arr['veh_data'] = $vehData;
}
}
echo json_encode($return_arr);exit;
}
/*********************************************************************************/
/************************************Mobile API's*********************************/
//Mobile Number Availability
public function mobile_number_availability(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'error','error'=>'901','message'=>'Something went wrong.');
if(!isset($postData['phone']) || empty($postData['phone']) && !isset($postData['country_code']) || empty($postData['country_code'])){
$respArr = array('status'=>'0','error'=>'903','message'=>'Required Fields are empty.');
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkMobAvailability($postData);
if(!empty($custResp)){
$respArr = $custResp;
}
echo json_encode($respArr);exit;
}
//User Login
public function user_login(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Password';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_registration
public function user_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['name']) || empty($postData['name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['country_code']) || empty($postData['country_code'])){
$err = 1;
$msg = 'Provide a Country Code';
}
else if(!isset($postData['phone']) && empty($postData['phone'])){
$err = 1;
$msg = 'Provide a Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createCustomer($postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
//Get Booked Services
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->getBookedService($authRes['data']['customer_id']);
echo json_encode($bookData);exit;
}
//Add Vehicle Details
public function add_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$err = 0;$msg = '';
if(empty($postData)){
$respArr = array('status'=>0,'error'=>'901','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
if(!isset($postData['vehicle_year']) || empty($postData['vehicle_year'])){
$err = 1;
$msg = 'Provide a Vehicle year';
}
else if(!isset($postData['vehicle_make']) || empty($postData['vehicle_make'])){
$err = 1;
$msg = 'Provide a Vehicle Make';
}
else if(!isset($postData['vehicle_model']) || empty($postData['vehicle_model'])){
$err = 1;
$msg = 'Provide a Vehicle Model';
}
else if(!isset($postData['engine_no']) || empty($postData['engine_no'])){
$err = 1;
$msg = 'Provide an Engine Number';
}
else if(!isset($postData['vehicle_trim']) && empty($postData['vehicle_trim'])){
$err = 1;
$msg = 'Provide a Vehicle Trim';
}
else if(!isset($postData['mileage']) && empty($postData['mileage'])){
$err = 1;
$msg = 'Provide a Mileage';
}
else if(!isset($postData['car_loc_lat']) && empty($postData['car_loc_lat'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_loc_lng']) && empty($postData['car_loc_lng'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_location']) && empty($postData['car_location'])){
$err = 1;
$msg = 'Car Location is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->addVehicleDetails($postData,$authRes['data']['customer_id']);
echo json_encode($respData);exit;
}
//Get Services
public function get_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$serviceresult = $this->Webservice_model->get_service_list($postData,0,0);
$serviceList = $this->Webservice_model->get_service_list($postData,$start,$per_page);
$service = array();
$total = 0;
if($serviceresult['status'] == 'success'){
$total = count($serviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($serviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'services' => $serviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}
echo json_encode($respArr);exit;
}
//Get Vehicle Details
public function get_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
else if(!isset($postData['bar_code']) && !empty($postData['bar_code'])){
$respArr['message'] = 'Barcode is Required.';
echo json_encode($respArr);exit;
}
$settings = getSettings();
$param = "?format=json&key=".urlencode($settings['vin_audit_api']).
"&vin=".urlencode($postData['bar_code']);
$vehData=file_get_contents("https://specifications.vinaudit.com/getspecifications.php".$param);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
echo json_encode($respArr);exit;
}
if(!isset($vehData['success']) || empty($vehData['success']) || $vehData['success'] == false || !isset($vehData['attributes']) || empty($vehData['attributes'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Vin Number.';
echo json_encode($respArr);exit;
}
$respArr['status'] = 'success';
$respArr['data'] = $vehData['attributes'];
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
//Search Sub Services
public function search_sub_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$subserviceresult = $this->Webservice_model->search_sub_services($postData,0,0);
$subserviceList = $this->Webservice_model->search_sub_services($postData,$start,$per_page);
$service = array();
$total = 0;
if($subserviceresult['status'] == 'success'){
$total = count($subserviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($subserviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'sub_services' => $subserviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else if($subserviceList['status'] == 'error'){
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'sub_services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = $subserviceList;
$respArr['status'] = 'error';
}
echo json_encode($respArr);exit;
}
//Book Service
public function book_service(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
if(empty($postData)){
$respArr = array('status'=>'error','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
$err = 0;
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';
}
else if(!isset($postData['date']) || empty($postData['date'])){
$err = 1;
$msg = 'Date is Required';
}
else if(!isset($postData['time']) && empty($postData['time'])){
$err = 1;
$msg = 'Time is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->book_service($postData);
echo json_encode($respData);exit;
}
//Get Booking Summary
public function get_booking_summary(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$res = $this->Webservice_model->get_booking_summary($postData);
echo json_encode($res);exit;
}
//Get Mechanics
public function get_mechanics(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$err = 0;
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$err = 1;
$msg = 'Service Id is Required';
}
else if(!isset($postData['location']) || empty($postData['location'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lat']) || empty($postData['location_lat'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lng']) || empty($postData['location_lng'])){
$err = 1;
$msg = 'Location is Required';
}
if($err == 1){
$respArr['status'] = 'error';
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0);
$mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page);
$total = 0;
if($mechanicsList['status'] == 'success'){
$total = count($mechanicsListcount['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($mechanicsList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'mechanics' => $mechanicsList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'mechanics' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}
echo json_encode($respArr);exit;
}
//Add Service Details
public function add_service_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_POST;
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;
}
if(isset($_FILES['images']) && !empty($_FILES['images'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['images']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$files['images']['name'][$i];
$this->upload->initialize($config);
$_FILES['images']['name'] = $files['images']['name'][$i];
$_FILES['images']['type'] = $files['images']['type'][$i];
$_FILES['images']['tmp_name'] = $files['images']['tmp_name'][$i];
$_FILES['images']['error'] = $files['images']['error'][$i];
$_FILES['images']['size'] = $files['images']['size'][$i];
if($this->upload->do_upload('images'))
{
$imagedata= $this->upload->data();
$new[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
print json_encode($res);
exit();
}
}
$postData['image'] = $new;
}
if(isset($_FILES['videos']) && !empty($_FILES['videos'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['videos']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$_FILES['videos']['name'][$i];
$this->upload->initialize($config);
$_FILES['videos']['name'] = $files['videos']['name'][$i];
$_FILES['videos']['type'] = $files['videos']['type'][$i];
$_FILES['videos']['tmp_name'] = $files['videos']['tmp_name'][$i];
$_FILES['videos']['error'] = $files['videos']['error'][$i];
$_FILES['videos']['size'] = $files['videos']['size'][$i];
if($this->upload->do_upload('videos'))
{
$imagedata= $this->upload->data();
$video[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
echo json_encode($res);
exit();
}
}
$postData['video'] = $video;
}
$addServiceDetails = $this->Webservice_model->add_service_details($postData);
echo json_encode($addServiceDetails);exit();
}
//Remove Booking
public function remove_booking(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$removed = $this->Webservice_model->remove_booking($postData);
echo json_encode($removed);
}
//Get Service
public function get_service(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
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;
}
$getServices = $this->Webservice_model->get_service($postData);
echo json_encode($getServices);exit;
}
public function rate_mechanic(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
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;
}
$postData['customer_id'] = $authRes['data'];
$result = $this->Webservice_model->rate_mechanic($postData);
echo json_encode($result);exit;
}
}
?>
......@@ -75,14 +75,10 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
// 'hostname' => 'localhost',
// 'username' => 'techlabz_frank',
// 'password' => 'Golden_123',
// 'database' => 'techlabz_nemt_backend',
'hostname' => '192.168.140.123',
'username' => 'root',
'hostname' => 'localhost',
'username' => 'techlabz_dcarfix',
'password' => 'Golden_123',
'database' => 'tobin_dcarfixers',
'database' => 'techlabz_dcarfixers',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
......
......@@ -36,17 +36,21 @@ class Bookings extends CI_Controller {
$template['menu'] = "Bookings Management";
$template['smenu'] = "View Bookings";
$template['mechanic_id'] = $mechanic_id;
$template['mechanic_id'] = ($this->session->userdata('user_type')==1 &&
empty($mechanic_id))?'':$mechanic_id;
$template['mechanic_data'] = $mechanic_data;
$template['bookingData'] = $this->Booking_model->getMechBookings($mechanic_id,'','0,1,3,4');
//pr($template['bookingData']);
$this->load->view('template',$template);
}
public function changeBookingStatus($booking_id = '', $status = '', $mechanic_id = ''){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
$mechanic_id = ($this->session->userdata('user_type') == 1 && !empty($mechanic_id))?$mechanic_id:'';
if(empty($booking_id) || $status == ''){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Bookings/listBookings'));
redirect(base_url('Bookings/listBookings/'.$mechanic_id));
}
$booking_id = decode_param($booking_id);
......@@ -64,13 +68,44 @@ class Bookings extends CI_Controller {
echo json_encode($return_arr);exit;
}
$booking_id = decode_param($_POST['booking_id']);
$bookingData = $this->Booking_model->getMechBookings('',$booking_id,'0,1,3,4');
$mechanic_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):'';
$bookingData = $this->Booking_model->getMechBookings($mechanic_id,$booking_id,'0,1,3,4');
if(!empty($bookingData)){
$return_arr['status'] = 1;
$return_arr['data'] = $bookingData;
echo json_encode($return_arr);exit;
}
echo json_encode($return_arr);exit;
}
public function insertCustomQuote(){
$return_arr = array('status'=>'error');
parse_str($_POST['data'], $output);
if(!isset($output) || empty($output)){
echo json_encode($return_arr);exit;
}
$return_arr = $this->Booking_model->insertCustomQuote($output);
echo json_encode($return_arr);exit;
}
public function getCustomData(){
$return_arr = array('status'=>'0');
if(!isset($_POST) || empty($_POST) || !isset($_POST['custom_id']) || empty($_POST['custom_id']) ||
empty(decode_param($_POST['custom_id']))){
echo json_encode($return_arr);exit;
}
$custom_booking_id = decode_param($_POST['custom_id']);
// print_r($custom_booking_id);exit();
$CustData = $this->Booking_model->getCustomData($custom_booking_id);
if(!empty($CustData)){
$return_arr['status'] = 1;
$return_arr['data'] = $CustData;
echo json_encode($return_arr);exit;
}
echo json_encode($return_arr);exit;
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Brand extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Brand_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function addbrand(){
$template['page'] = 'Brand/addBrand';
$template['pTitle'] = "Add Brand";
$template['pDescription'] = "Add Brand";
$template['menu'] = "Brand Management";
$template['smenu'] = "View Brands";
$template['brand_data'] = $this->Brand_model->getbrand();
$this->load->view('template',$template);
}
public function viewBrand(){
$template['page'] = 'Brand/viewBrands';
$template['menu'] = 'brand Management';
$template['smenu'] = 'View brands';
$template['pTitle'] = "View brands";
$template['pDescription'] = "View and Manage brands";
$template['brand_data'] = $this->Brand_model->getbrand('',1);
$this->load->view('template',$template);
}
function changeStatus($brand_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewBrand'));
}
$status = $this->Brand_model->changeStatus($brand_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Brand/viewBrand'));
}
public function createbrand(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Brand/addbrand'));
}
if($err == 0 && (!isset($_POST['brand_name']) || empty($_POST['brand_name']))){
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['brand_logo']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('brand_logo')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['brand_logo'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Brand/addbrand'));
}
$status = $this->Brand_model->addbrand($_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Brand/viewBrand'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Brand/addbrand'));
}
}
public function editbrand($brand_id){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Brand/viewBrand'));
}
$template['page'] = 'Brand/addBrand';
$template['menu'] = 'brand Management';
$template['smenu'] = 'Edit brand';
$template['pTitle'] = "Edit brand";
$template['pDescription'] = "Update brand Data";
$template['brand_id'] = encode_param($brand_id);
$template['brand_data'] = $this->Brand_model->getbrand($brand_id,1);
$this->load->view('template',$template);
}
public function updatebrand($brand_id = ''){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !isset($_POST) || empty($_POST) || !is_numeric(decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewBrand'));
}
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Brand/addbrand'));
}
if($err == 0 && (!isset($_POST['brand_name']) || empty($_POST['brand_name']))){
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['brand_logo']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('brand_logo')){
$upload_data = $this->upload->data();
$_POST['brand_logo'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Brand/addbrand'));
}
$status = $this->Brand_model->updateBrand(decode_param($brand_id),$_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Brand/viewBrand'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Brand/editbrand/'.$brand_id));
}
}
}
?>
\ No newline at end of file
......@@ -336,7 +336,7 @@ class Issue extends CI_Controller {
}
}
function viewMappedIssues($mechanic_id = ''){
public function viewMappedIssues($mechanic_id = ''){
if(!empty($mechanic_id)){
$mechanic_id = (!is_numeric($mechanic_id))?decode_param($mechanic_id):$mechanic_id;
}
......@@ -364,7 +364,7 @@ class Issue extends CI_Controller {
$this->load->view('template',$template);
}
function changeMappedIssueStatus($mechanic_id = '',$issue_id = '',$status = '1'){
public function changeMappedIssueStatus($mechanic_id = '',$issue_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($issue_id) || !is_numeric($issue_id = decode_param($issue_id)) ||
empty($mechanic_id) || !is_numeric($mechanic_id = decode_param($mechanic_id))){
......
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Mailtemplate extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Mailtemplate_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
if($this->session->userdata['user_type'] != 1){
$flashMsg = array('message'=>'Access Denied You don\'t have permission to access this Page',
'class'=>'error');
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url());
}
}
public function index() {
$template['page'] = 'Notification/notification';
$template['menu'] = "Notification Templates";
$template['smenu'] = "Change Notification Templates";
$template['pTitle'] = "Notification Templates";
$template['page_head'] = "Notification Templates";
$template['pDescription'] = "Change Notification Templates";
$template['notificationData'] = $this->Mailtemplate_model->getNotifData();
$this->load->view('template',$template);
}
public function changeNotifData(){
$url = 'Mailtemplate/index';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url($url));
}
if(!isset($_POST['customer_registration_mail']) || empty($_POST['customer_registration_mail'])){
unset($_POST['customer_registration_mail']);
}
if(!isset($_POST['cancel_booking']) || empty($_POST['cancel_booking'])){
unset($_POST['cancel_booking']);
}
if(!isset($_POST['mechanic_activation_mail']) || empty($_POST['mechanic_activation_mail'])){
unset($_POST['mechanic_activation_mail']);
}
if(!isset($_POST['success_booking']) || empty($_POST['success_booking'])){
unset($_POST['success_booking']);
}
$status = $this->Mailtemplate_model->updateNotif($_POST);
if($status){
$flashMsg['class'] = 'success';
$flashMsg['message'] = 'Settings Successfully Updated..!';
}
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url($url));
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Orders extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Order_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function listOrders(){
$template['page'] = 'Orders/list_orders';
$template['pTitle'] = "View Orders";
$template['pDescription'] = "View and Manage Orders";
$template['menu'] = "Order Management";
$template['smenu'] = "View Orders";
$template['orderData'] = $this->Order_model->getOrders();
$this->load->view('template',$template);
}
public function getOrderData(){
$return_arr = array('status'=>'0');
if(!isset($_POST) || empty($_POST) || !isset($_POST['order_id']) || empty($_POST['order_id']) || empty(decode_param($_POST['order_id']))){
echo json_encode($return_arr);exit;
}
$order_id = decode_param($_POST['order_id']);
$return_arr['order_data'] = $this->Order_model->getOrderDetails($order_id);
$return_arr['product_image'] = $this->Order_model->getProductImage($order_id);
if(!empty($return_arr)){
$return_arr['status'] = 1;
echo json_encode($return_arr);exit;
}
echo json_encode($return_arr);exit;
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Product extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Brand_model');
$this->load->model('Product_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function addProduct(){
$template['page'] = 'Product/addproduct';
$template['pTitle'] = "Add Product";
$template['pDescription'] = "Add Product";
$template['menu'] = "Product Management";
$template['smenu'] = "View Product";
$template['brand_id'] = '';
$template['product_data'] = $this->Product_model->getProduct();
$template['brand_data'] = $this->Brand_model->getbrand('',1);
$this->load->view('template',$template);
}
public function viewProducts(){
$template['page'] = 'Product/viewProduct';
$template['menu'] = 'Product Management';
$template['smenu'] = 'View Product';
$template['pTitle'] = "View Product";
$template['pDescription'] = "View and Manage Product";
$template['product_data'] = $this->Product_model->getProduct('',1);
$this->load->view('template',$template);
}
function changeStatus($brand_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewProducts'));
}
$status = $this->Product_model->changeStatus($brand_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Product/viewProducts'));
}
public function createproduct(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
if($err == 0 && (!isset($_POST['brand_id']) || empty($_POST['brand_id']))){
$err = 1;
$errMsg = 'Please Select a Brand';
}else if($err == 0 && (!isset($_POST['short_description']) || empty($_POST['short_description']))){
$err = 1;
$errMsg = 'Provide a short Description';
}else if($err == 0 && (!isset($_POST['product_name']) || empty($_POST['product_name']))){
$err = 1;
$errMsg = 'Provide a Product Name';
}else if($err == 0 && (!isset($_POST['description']) || empty($_POST['description']))){
$err = 1;
$errMsg = 'Provide a Description';
}else if($err == 0 && (!isset($_POST['about']) || empty($_POST['about']))){
$err = 1;
$errMsg = 'Provide a About';
}else if($err == 0 && (!isset($_POST['amount']) || empty($_POST['amount']))){
$err = 1;
$errMsg = 'Provide a Amount';
}else if($err == 0 && (!isset($_POST['vehYear']) || empty($_POST['vehYear']))){
$err = 1;
$errMsg = 'Select Vehicle Year';
}else if($err == 0 && (!isset($_POST['vehMake']) || empty($_POST['vehMake']))){
$err = 1;
$errMsg = 'Select Vehicle Make';
}else if($err == 0 && (!isset($_POST['vehModel']) || empty($_POST['vehModel']))){
$err = 1;
$errMsg = 'Select Vehicle Model';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
$product_id = $this->Product_model->addProduct($_POST);
if($product_id){
$evtMediaData = array();
if(!empty($files = $_FILES)){
$images = array();
$this->load->library('upload');
$config = set_upload_service("assets/uploads/products");
for ($typ = 0; $typ < count($files['product_image']['name']); $typ++) {
$_FILES['file']['name'] = $files['product_image']['name'][$typ];
$_FILES['file']['type'] = $files['product_image']['type'][$typ];
$_FILES['file']['size'] = $files['product_image']['size'][$typ];
$_FILES['file']['error'] = $files['product_image']['error'][$typ];
$_FILES['file']['tmp_name'] = $files['product_image']['tmp_name'][$typ];
$config['file_name'] = time()."_".$_FILES['file']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('file')){
$imgData = $this->upload->data();
$evtMediaData[] = array(
'product_id'=>$product_id,
'image'=>"assets/uploads/products/".$imgData['file_name']);
}
}
$status = $this->Product_model->addProductImage($evtMediaData);
}
if($status == 1 || $product_id){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/viewProducts'));
}else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/addProduct'));
}
}
}
public function editproduct($product_id){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($product_id) || !is_numeric($product_id = decode_param($product_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/viewProducts'));
}
$template['page'] = 'Product/addProduct';
$template['menu'] = 'Brand Management';
$template['smenu'] = 'Edit brand';
$template['pTitle'] = "Edit brand";
$template['pDescription'] = "Update brand Data";
$template['product_id'] = encode_param($product_id);
$template['brand_data'] = $this->Brand_model->getbrand('',1);
$template['product_data'] = $this->Product_model->getProduct($product_id);
$template['product_image'] = $this->Product_model->getProductImage($product_id);
$template['brand_id'] = $template['product_data']->brand_id;
$this->load->view('template',$template);
}
public function updateproduct($product_id = ''){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($product_id) || !isset($_POST) || empty($_POST) || !is_numeric(decode_param($product_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/viewProducts'));
}
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
if($err == 0 && (!isset($_POST['brand_id']) || empty($_POST['brand_id']))){
$err = 1;
$errMsg = 'Please Select a Brand';
}else if($err == 0 && (!isset($_POST['short_description']) || empty($_POST['short_description']))){
$err = 1;
$errMsg = 'Provide a short Description';
}else if($err == 0 && (!isset($_POST['product_name']) || empty($_POST['product_name']))){
$err = 1;
$errMsg = 'Provide a Product Name';
}else if($err == 0 && (!isset($_POST['description']) || empty($_POST['description']))){
$err = 1;
$errMsg = 'Provide a Description';
}else if($err == 0 && (!isset($_POST['about']) || empty($_POST['about']))){
$err = 1;
$errMsg = 'Provide a About';
}else if($err == 0 && (!isset($_POST['amount']) || empty($_POST['amount']))){
$err = 1;
$errMsg = 'Provide a Amount';
}else if($err == 0 && (!isset($_POST['vehYear']) || empty($_POST['vehYear']))){
$err = 1;
$errMsg = 'Select Vehicle Year';
}else if($err == 0 && (!isset($_POST['vehMake']) || empty($_POST['vehMake']))){
$err = 1;
$errMsg = 'Select Vehicle Make';
}else if($err == 0 && (!isset($_POST['vehModel']) || empty($_POST['vehModel']))){
$err = 1;
$errMsg = 'Select Vehicle Model';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
$existingImages = (isset($_POST['existingImages']) && !empty($_POST['existingImages']))?
$_POST['existingImages']:'';
unset($_POST['existingImages']);
$product = $this->Product_model->updateProduct(decode_param($product_id),$_POST);
if($product){
$evtMediaData = array();
if(!empty($files = $_FILES)){
$images = array();
$this->load->library('upload');
$config = set_upload_service("assets/uploads/products");
for ($typ = 0; $typ < count($files['product_image']['name']); $typ++) {
$_FILES['file']['name'] = $files['product_image']['name'][$typ];
$_FILES['file']['type'] = $files['product_image']['type'][$typ];
$_FILES['file']['size'] = $files['product_image']['size'][$typ];
$_FILES['file']['error'] = $files['product_image']['error'][$typ];
$_FILES['file']['tmp_name'] = $files['product_image']['tmp_name'][$typ];
$config['file_name'] = time()."_".$_FILES['file']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('file')){
$imgData = $this->upload->data();
$evtMediaData[] = array(
'product_id'=>decode_param($product_id),
'image'=>"assets/uploads/products/".$imgData['file_name']);
}
}
$status = $this->Product_model->updateProductImage(decode_param($product_id),$evtMediaData,$existingImages);
}
}
if($status || $product){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/viewProducts'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/editproduct/'.$brand_id));
}
}
public function getProductData(){
$return_arr = array('status'=>'0');
if(!isset($_POST) || empty($_POST) || !isset($_POST['product_id']) || empty($_POST['product_id']) ||
empty(decode_param($_POST['product_id']))){
echo json_encode($return_arr);exit;
}
$product_id = decode_param($_POST['product_id']);
$return_arr['product_data'] = $this->Product_model->getProduct($product_id);
$return_arr['product_image'] = $this->Product_model->getProductImage($product_id);
if(!empty($return_arr)){
$return_arr['status'] = 1;
echo json_encode($return_arr);exit;
}
echo json_encode($return_arr);exit;
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH')OR exit('No direct script access allowed');
header('Content-Type: text/html; charset=utf-8');
defined('BASEPATH')OR exit('No direct script access allowed');
header('Content-Type: text/html; charset=utf-8');
// Allow from any origin
if(isset($_SERVER['HTTP_ORIGIN'])) {
// Allow from any origin
if(isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}
}
class Webservices extends CI_Controller {
class Webservices extends CI_Controller {
public function __construct() {
parent::__construct();
......@@ -38,7 +38,8 @@ class Webservices extends CI_Controller {
if (isset(apache_request_headers()['Auth'])) {
$auth = apache_request_headers()['Auth'];
}
// $this->last_id = set_log($class, $method, $postdata, $auth);
define("PAYSTACK_SECRET_KEY", "sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273");
}
// customer_login
......@@ -187,6 +188,60 @@ class Webservices extends CI_Controller {
echo json_encode($respArr); exit;
}
// Service Provider registration
public function service_provider_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createServiceProvider($postData);
if($custResp == '0'){
$respArr['message'] = 'Something went wrong.';
} else if($custResp == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
} else if($custResp == '2'){
$respArr['message'] = 'Email Address already in use';
} else if($custResp == '3'){
$respArr['message'] = 'Phone already in use';
}
echo json_encode($respArr); exit;
}
// getGeneralIssues
public function getGeneralIssues(){
header('Content-type: application/json');
......@@ -210,7 +265,6 @@ class Webservices extends CI_Controller {
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Mechanic_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['pickup_data']) || !isset($postData['sub_issues']) ||
......@@ -233,7 +287,7 @@ class Webservices extends CI_Controller {
header('Content-type: application/json');
$postData = $_POST;
$optionalData = array('optionlaDescription'=>'','optionalImages'=>array(),'optionalVideos'=>array());
$optionalData=array('optionlaDescription'=>'','optionalImages'=>array(),'optionalVideos'=>array());
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || empty($postData = json_decode($postData['data'],true)) ||
......@@ -270,6 +324,7 @@ class Webservices extends CI_Controller {
$postData['optionalData'] = $optionalData;
$status = $this->Booking_model->scheduleBooking($postData);
if($status){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
......@@ -420,7 +475,7 @@ class Webservices extends CI_Controller {
echo json_encode($respArr);exit;
}
$status=$this->Booking_model->changeBookStatus($postData['customer_id'],$postData['booking_id'],'3');
$status=$this->Booking_model->changeBookStatus($postData['customer_id'],$postData['booking_id'],'4');
if($status){
$respArr['status'] = 1;
......@@ -479,6 +534,7 @@ class Webservices extends CI_Controller {
$settings = $this->Settings_model->settings_viewing();
$searchData = $postData['vehicleData'];
if($searchType == 1 &&
isset($searchData['car_maker']) && !empty($searchData['car_maker']) &&
isset($searchData['modelName']) && !empty($searchData['modelName']) &&
......@@ -530,5 +586,1065 @@ class Webservices extends CI_Controller {
}
echo json_encode($return_arr);exit;
}
}
/*********************************************************************************/
/************************************Mobile API's*********************************/
//Mobile Number Availability
public function mobile_number_availability(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'error','error'=>'901','message'=>'Something went wrong.');
if(!isset($postData['phone']) || empty($postData['phone']) && !isset($postData['country_code']) || empty($postData['country_code'])){
$respArr = array('status'=>'0','error'=>'903','message'=>'Required Fields are empty.');
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkMobAvailability($postData);
if(!empty($custResp)){
$respArr = $custResp;
}
echo json_encode($respArr);exit;
}
//User Login
public function user_login(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Password';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_registration
public function user_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['name']) || empty($postData['name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['country_code']) || empty($postData['country_code'])){
$err = 1;
$msg = 'Provide a Country Code';
}
else if(!isset($postData['phone']) && empty($postData['phone'])){
$err = 1;
$msg = 'Provide a Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createCustomer($postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
//Get Booked Services
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->getBookedService($authRes['data']['customer_id']);
echo json_encode($bookData);exit;
}
//Add Vehicle Details
public function add_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$err = 0;$msg = '';
if(empty($postData)){
$respArr = array('status'=>0,'error'=>'901','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
if(!isset($postData['vehicle_year']) || empty($postData['vehicle_year'])){
$err = 1;
$msg = 'Provide a Vehicle year';
}
else if(!isset($postData['vehicle_make']) || empty($postData['vehicle_make'])){
$err = 1;
$msg = 'Provide a Vehicle Make';
}
else if(!isset($postData['vehicle_model']) || empty($postData['vehicle_model'])){
$err = 1;
$msg = 'Provide a Vehicle Model';
}
else if(!isset($postData['engine_no']) || empty($postData['engine_no'])){
$err = 1;
$msg = 'Provide an Engine Number';
}
else if(!isset($postData['vehicle_trim']) && empty($postData['vehicle_trim'])){
$err = 1;
$msg = 'Provide a Vehicle Trim';
}
else if(!isset($postData['mileage']) && empty($postData['mileage'])){
$err = 1;
$msg = 'Provide a Mileage';
}
else if(!isset($postData['car_loc_lat']) && empty($postData['car_loc_lat'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_loc_lng']) && empty($postData['car_loc_lng'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_location']) && empty($postData['car_location'])){
$err = 1;
$msg = 'Car Location is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->addVehicleDetails($postData,$authRes['data']['customer_id']);
echo json_encode($respData);exit;
}
//Get Services
public function get_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$serviceresult = $this->Webservice_model->get_service_list($postData,0,0);
$serviceList = $this->Webservice_model->get_service_list($postData,$start,$per_page);
$service = array();
$total = 0;
if($serviceresult['status'] == 'success'){
$total = count($serviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($serviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'services' => $serviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}
echo json_encode($respArr);exit;
}
//Get Vehicle Details
public function get_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
else if(!isset($postData['bar_code']) && !empty($postData['bar_code'])){
$respArr['message'] = 'Barcode is Required.';
echo json_encode($respArr);exit;
}
$settings = getSettings();
$param = "?format=json&key=".urlencode($settings['vin_audit_api']).
"&vin=".urlencode($postData['bar_code']);
$vehData=file_get_contents("https://specifications.vinaudit.com/getspecifications.php".$param);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
echo json_encode($respArr);exit;
}
if(!isset($vehData['success']) || empty($vehData['success']) || $vehData['success'] == false || !isset($vehData['attributes']) || empty($vehData['attributes'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Vin Number.';
echo json_encode($respArr);exit;
}
$respArr['status'] = 'success';
$respArr['data'] = $vehData['attributes'];
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
//Search Sub Services
public function search_sub_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$subserviceresult = $this->Webservice_model->search_sub_services($postData,0,0);
$subserviceList = $this->Webservice_model->search_sub_services($postData,$start,$per_page);
$service = array();
$total = 0;
if($subserviceresult['status'] == 'success'){
$total = count($subserviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($subserviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'sub_services' => $subserviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else if($subserviceList['status'] == 'error'){
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'sub_services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = $subserviceList;
$respArr['status'] = 'error';
}
echo json_encode($respArr);exit;
}
//Book Service
public function book_service(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
if(empty($postData)){
$respArr = array('status'=>'error','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
$err = 0;
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';
}
else if(!isset($postData['date']) || empty($postData['date'])){
$err = 1;
$msg = 'Date is Required';
}
else if(!isset($postData['time']) && empty($postData['time'])){
$err = 1;
$msg = 'Time is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->book_service($postData);
echo json_encode($respData);exit;
}
//Get Booking Summary
public function get_booking_summary(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$res = $this->Webservice_model->get_booking_summary($postData);
echo json_encode($res);exit;
}
//Get Mechanics
public function get_mechanics(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
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;
}
$err = 0;
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$err = 1;
$msg = 'Service Id is Required';
}
else if(!isset($postData['location']) || empty($postData['location'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lat']) || empty($postData['location_lat'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lng']) || empty($postData['location_lng'])){
$err = 1;
$msg = 'Location is Required';
}
if($err == 1){
$respArr['status'] = 'error';
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0);
$mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page);
$total = 0;
if($mechanicsList['status'] == 'success'){
$total = count($mechanicsListcount['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($mechanicsList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'mechanics' => $mechanicsList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'mechanics' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}
echo json_encode($respArr);exit;
}
//Add Service Details
public function add_service_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_POST;
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;
}
if(isset($_FILES['images']) && !empty($_FILES['images'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['images']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$files['images']['name'][$i];
$this->upload->initialize($config);
$_FILES['images']['name'] = $files['images']['name'][$i];
$_FILES['images']['type'] = $files['images']['type'][$i];
$_FILES['images']['tmp_name'] = $files['images']['tmp_name'][$i];
$_FILES['images']['error'] = $files['images']['error'][$i];
$_FILES['images']['size'] = $files['images']['size'][$i];
if($this->upload->do_upload('images'))
{
$imagedata= $this->upload->data();
$new[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
print json_encode($res);
exit();
}
}
$postData['image'] = $new;
}
if(isset($_FILES['videos']) && !empty($_FILES['videos'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['videos']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$_FILES['videos']['name'][$i];
$this->upload->initialize($config);
$_FILES['videos']['name'] = $files['videos']['name'][$i];
$_FILES['videos']['type'] = $files['videos']['type'][$i];
$_FILES['videos']['tmp_name'] = $files['videos']['tmp_name'][$i];
$_FILES['videos']['error'] = $files['videos']['error'][$i];
$_FILES['videos']['size'] = $files['videos']['size'][$i];
if($this->upload->do_upload('videos'))
{
$imagedata= $this->upload->data();
$video[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
echo json_encode($res);
exit();
}
}
$postData['video'] = $video;
}
$addServiceDetails = $this->Webservice_model->add_service_details($postData);
echo json_encode($addServiceDetails);exit();
}
//Remove Booking
public function remove_booking(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
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;
}
$removed = $this->Webservice_model->remove_booking($postData);
echo json_encode($removed);
}
//Get Service
public function get_service(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
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;
}
$getServices = $this->Webservice_model->get_service($postData);
echo json_encode($getServices);exit;
}
//Mechanic Rating
public function rate_mechanic(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
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;
}
$postData['customer_id'] = $authRes['data'];
$result = $this->Webservice_model->rate_mechanic($postData);
echo json_encode($result);exit;
}
//Accept Mechanic Quote
public function acceptMechanicQuote(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->acceptMechanicQuote($postData);
echo json_encode($result);exit;
}
//Payment Integration of Mechanic Booking
public function payNow($transId=''){
if(empty($transId)){
$this->fail();
}
$mechData = $this->Webservice_model->getMechAmount($transId);
$amount = $mechData['data']['amount'] * 100;
$callback = base_url().'Webservices/verify_payment/'.$transId.'/1';
$postdata = array('email' => $mechData['emailId'],
'amount' => $amount,
'reference' => $transId,
'callback_url' => $callback);
$this->payStackPayment($postdata);
}
//Payment Integration of Order Booking
public function orderPayNow($orderId=''){
if(empty($orderId)){
$this->fail();
}
$orderData = $this->Webservice_model->getOrderPayDetails($orderId);
if($orderData['status'] == 'success'){
$amount = $orderData['data']->amount * 100;
$callback = base_url().'Webservices/verify_payment/'.$orderId.'/2';
$postdata = array('email' => $orderData['data']->email,
'amount' => $amount,
'reference' => $orderId,
'callback_url' => $callback);
$this->payStackPayment($postdata);
}
}
public function payStackPayment($postdata=array()) {
$url = "https://api.paystack.co/transaction/initialize";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($postdata)); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$headers = [
'Authorization: Bearer '.PAYSTACK_SECRET_KEY,
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$request = curl_exec ($ch);
curl_close ($ch);
$result = array();
if ($request) {
$result = json_decode($request, true);
}
$redir = $result['data']['authorization_url'];
header("Location: ".$redir);
}
public function verify_payment($ref='',$payFor='1') {
if(empty($ref)){
$this->fail();
}
$result = array();
$url = 'https://api.paystack.co/transaction/verify/'.$ref;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt(
$ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer '.PAYSTACK_SECRET_KEY]
);
$request = curl_exec($ch);
curl_close($ch);
if ($request) {
$result = json_decode($request, true);
$status = $this->Webservice_model->transactionResp($ref,$result,$payFor);
if($status){
if($result){
if($result['data']){
if($result['data']['status'] == 'success'){
header("Location:".base_url('Webservices/success/'.$ref.'/'.$payFor));
}else{
header("Location:".base_url('Webservices/fail/'.$ref.'/'.$payFor));
}
}
else{
header("Location: ".base_url('Webservices/fail/'.$ref.'/'.$payFor));
}
}else{
header("Location: ".base_url('Webservices/fail/'.$ref.'/'.$payFor));
}
}
}else{
header("Location: ".base_url('Webservices/fail/'.$ref.'/'.$payFor));
}
}
public function fail($ref='',$payFor='1'){
$settings = getSettings();
if($payFor == '1'){
$url = $settings['web_url']."/dashboard?status=failure&tab=appointment&ref=".$ref;
header("Location:".$url);
}else{
$url = $settings['web_url']."/purchaseHome?status=failure&ref=".$ref;
header("Location:".$url);
}
}
public function success($ref='',$payFor='1'){
if($payFor == '1'){
$this->serviceBookSuccess($ref);
}else{
$this->orderPlacedSuccess($ref);
}
}
public function serviceBookSuccess($ref=''){
$this->db->select('customer_vehicle.car_name,bookings.scheduled_date,bookings.scheduled_time,
customers.email,bookings.cost');
$this->db->from('transaction');
$this->db->join('bookings','transaction.booking_id = bookings.booking_id');
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join('customers','customers.customer_id = bookings.customer_id');
$this->db->where('transaction.id',$ref);
$bookData = $this->db->get()->row();
$subject = "DcarFixxers, Payment Successfull";
$email_id = $bookData->email;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your Payment for the vehicle ".$bookData->car_name." on date ".$bookData->scheduled_date." at ".$bookData->scheduled_time." for amount ".$bookData->cost." is Success
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['success_booking']) && !empty($template['success_booking'])){
$message = str_replace(array('{:car_name}','{:book_date}','{:amount}'),array($bookData->car_name,$bookData->scheduled_date,$bookData->cost),$template['success_booking']);
}
send_mail($subject,$email_id,$message);
$settings = getSettings();
$url = $settings['web_url']."/dashboard?status=success&tab=appointment&ref=".$ref;
header("Location: ".$url);
}
public function orderPlacedSuccess($ref=''){
$settings = getSettings();
$url = $settings['web_url']."/track?status=success&ref=".$ref;
header("Location: ".$url);
}
//Search Products
public function productSearch(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->productSearch($postData);
echo json_encode($result);exit;
}
//Get Brands
public function getBrands(){
header('Content-type:application/json');
$headers = apache_request_headers();
$result = $this->Webservice_model->getBrands();
echo json_encode($result);exit;
}
//Search Product By Brand
public function productSearchbyBrand(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->productSearchbyBrand($postData);
echo json_encode($result);exit;
}
//Single Product Search
public function SingleProductSearch(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->SingleProductSearch($postData);
echo json_encode($result);exit;
}
//Save User Address
public function saveUserAddress(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->saveUserAddress($postData);
echo json_encode($result);exit;
}
//Initiate Order Booking
public function initOrderBooking(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->initOrderBooking($postData);
echo json_encode($result);exit;
}
//Get User Address
public function getUserAddress(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getUserAddress($postData);
echo json_encode($result);exit;
}
//Get User Address By Id
public function getUserAddressById(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getUserAddressById($postData);
echo json_encode($result);exit;
}
//Update User Address
public function updateUserAddress(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->updateUserAddress($postData);
echo json_encode($result);exit;
}
//Get Order Details
public function getOrderDetail(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getOrderDetail($postData);
echo json_encode($result);exit;
}
public function rateProduct(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->rateProduct($postData);
echo json_encode($result);exit;
}
}
?>
......@@ -95,4 +95,21 @@
$unique = md5(uniqid(time().mt_rand(), true));
return $unique;
}
function getNotifTemplate(){
$CI = & get_instance();
$settings = $CI->db->get('notification_templates');
return (!empty($settings))?$settings->row_array():'';
}
function send_mail($subject,$email,$message,$attach=null) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: [email protected] \r\n";
$headers .= "Reply-To: ". $email. "\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$headers .= "X-Priority: 1" . "\r\n";
mail($email, $subject, $message, $headers);
}
?>
\ No newline at end of file
......@@ -14,17 +14,33 @@ class Booking_model extends CI_Model {
!isset($postData['selected_issues']) || empty($postData['selected_issues'])){
return 0;
}
$vehData = $postData['vechile_info'];
$car_name = $vehData['modelYear'].' '.$vehData['maker'].' '.$vehData['modelName'];
$vehJson = array('vehicle' => $car_name,
'attributes' =>
array('Year' => $vehData['modelYear'],
'attributes' => array(
'Year' => $vehData['modelYear'],
'Make' => $vehData['maker'],
'Trim' => $vehData['trim'],
'Model' => $vehData['modelName'],
'Engine' => $vehData['emgine']));
'Engine' => $vehData['emgine']
)
);
$last_date ='';
if(isset($vehData['lastMaintanceDate']) && !empty($vehData['lastMaintanceDate'])){
$last_date = $vehData['lastMaintanceDate'];
}
$last_maintanence_date ='';
if(isset($vehData['maintanenceInterval']) && !empty($vehData['maintanenceInterval'])){
$last_maintanence_date = $vehData['maintanenceInterval'];
}
$last_id = '';
if(isset($postData['customer_vehicle_id']) && !empty($postData['customer_vehicle_id'])){
$last_id = $postData['customer_vehicle_id'];
$this->db->update('customer_vehicle',array('last_maintenance_date'=>$last_date,'maintanence_interval'=>$last_maintanence_date),array('customer_veh_id'=>$postData['customer_vehicle_id']));
}
$insert_array = array('customer_id' => $postData['customer_id'],
'car_name' => $car_name,
......@@ -34,62 +50,115 @@ class Booking_model extends CI_Model {
'car_loc_lng' => $postData['pickup_data']['pickup_lng'],
'car_location' => $postData['pickup_data']['pickup_loc'],
'vehicle_data' => json_encode($vehJson),
'car_model_year'=> $vehData['modelYear'],
'car_model_year' => $vehData['modelYear'],
'last_maintenance_date'=> $last_date,
'maintanence_interval' => (int)$last_maintanence_date,
'status' => '3');
$selected_issues = array();
foreach($postData['selected_issues'] AS $selIssue){
$selected_issues[] = array('issue' =>$selIssue['issue'],
'issue_id' =>$selIssue['issue_id'],
'sub_issue_id' =>$selIssue['sub_issue_id'],
'issue_category' =>$selIssue['issue_category']);
$selected_issues[] = array('issue' => $selIssue['issue'],
'issue_id' => $selIssue['issue_id'],
'sub_issue_id' => $selIssue['sub_issue_id'],
'issue_category' => $selIssue['issue_category']);
}
if($this->db->insert('customer_vehicle',$insert_array)){
if(empty($last_id)){
$this->db->insert('customer_vehicle',$insert_array);
$last_id = $this->db->insert_id();
}
$book_data = array('cost' => $postData['cost'],
'mileage' => $vehData['milage'],
'customer_id' => $postData['customer_id'],
'mechanic_id' => $postData['mechanic_id'],
//'mechanic_id' => $postData['mechanic_id'],
'scheduled_date' => $postData['schedule_date']['date'],
'scheduled_time' => $postData['schedule_date']['time'],
'issues_selected' => json_encode($selected_issues),
'customer_veh_id' => $last_id,
'custom_issue_data'=> json_encode($postData['optionalData']),
'car_loc_lat' => $postData['pickup_data']['pickup_lat'],
'car_loc_lng' => $postData['pickup_data']['pickup_lng'],
'car_location' => $postData['pickup_data']['pickup_loc'],
'is_multiple' => (isset($postData['multiple']))?$postData['multiple']:0,
'status' => '0');
if($this->db->insert('bookings',$book_data)){
return 1;
$insertBookMech = array();
$book_id = $this->db->insert_id();
$mechanic_id = explode(',',$postData['mechanic_id']);
foreach ($mechanic_id AS $mech_id) {
$mech_amt = explode(':',$mech_id);
$insertBookMech[] = array('booking_id'=>$book_id,'mechanic_id'=>$mech_amt[0],'amount'=>$mech_amt[1],'status'=>'0');
}
if(!empty($insertBookMech)){
$this->db->insert_batch('mechanic_booking',$insertBookMech);
}
return 1;
}
return 0;
}
function getCustBookDetails($postData = array(), $status = ''){
$cond = array();
$where_cond = array();
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
return 0;
}
$cond = "BK.customer_id='".$postData['customer_id']."' ";
$cond .= (!empty($status))?"AND BK.status IN (".$status.") ":'';
$sql = "SELECT BK.booking_id,BK.customer_id,BK.mechanic_id,BK.customer_veh_id,BK.scheduled_date,
BK.scheduled_time,BK.cost,BK.status,MECH.first_name,MECH.last_name,VEH.car_name,
BK.status
$sql = "SELECT BK.booking_id,BK.customer_id,BK.customer_veh_id,BK.scheduled_date,
BK.scheduled_time,BK.cost,BK.is_multiple,BK.status,VEH.car_name,VEH.car_maker,
VEH.car_model,VEH.car_model_year,BK.status
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id = BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id = BK.customer_veh_id)
WHERE $cond
GROUP BY BK.booking_id";
$bookData = $this->db->query($sql);
if(empty($bookData)){
return 0;
}
if(!empty($bookData)){
return $bookData->result();
$bookDetails = array();
$bookData = $bookData->result();
foreach($bookData AS $book) {
$bookMechData=$this->db->query("SELECT * FROM mechanic_booking
WHERE booking_id='$book->booking_id' AND status!='2'");
if(!empty($bookMechData)){
$bookMechData = $bookMechData->result();
foreach ($bookMechData AS $mech_value) {
$mechanic_data = $this->db->query("
SELECT ROUND(AVG(MR.rate),2) AS rating,MCH.mechanic_id,MCH.first_name,
MCH.last_name,MCH.phone,CQ.custom_service_quote,MCH.location,
MCH.email_id,CQ.custom_amount,BK.status,BK.amount as mechanic_amount
FROM mechanic_booking AS BK
INNER JOIN mechanic MCH ON BK.mechanic_id=MCH.mechanic_id
INNER JOIN admin_users AU ON AU.id=MCH.mechanic_id
LEFT JOIN custom_quote CQ ON
CQ.mechanic_id=BK.mechanic_id AND
CQ.booking_id=BK.booking_id AND CQ.status='1'
LEFT JOIN mechanic_rating MR ON
MR.mechanic_id=BK.mechanic_id AND MR.status='1'
WHERE AU.status='1' AND BK.mechanic_id='$mech_value->mechanic_id' AND
BK.booking_id='$book->booking_id'");
if(!empty($mechanic_data)){
$mechData = $mechanic_data->row();
$mechData->custom_service_quote = json_decode($mechData->custom_service_quote);
$book->mechanic_data[] = $mechData;
$sTime = strtotime($book->scheduled_date.' '.$book->scheduled_time);
$cTime = strtotime('+1 hour');
if($cTime >= $sTime){
$book->status = '4';
}
return 0;
}
}
}
$bookDetails[] = $book;
}
return $bookDetails;
}
function changeBookStatus($customer_id = '', $booking_id = '', $status = ''){
......@@ -101,36 +170,93 @@ class Booking_model extends CI_Model {
array('status'=>$status),
array('customer_id'=>$customer_id,'booking_id'=>$booking_id));
$this->db->select('customer_vehicle.car_name,bookings.scheduled_date,bookings.scheduled_time,customers.email');
$this->db->from('bookings');
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join('customers','customers.customer_id = bookings.customer_id');
$this->db->where('bookings.booking_id',$booking_id);
$bookData = $this->db->get()->row();
$subject = "DcarFixxers, Cancel Booking";
$email_id = $bookData->email;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your booking for the vehicle ".$bookData->car_name." on date ".$bookData->scheduled_date." at ".$bookData->scheduled_time." is Cancelled.
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['cancel_booking']) && !empty($template['cancel_booking'])){
$message = str_replace(array('{:car_name}','{:book_date}'),array($bookData->car_name,$bookData->scheduled_date),$template['cancel_booking']);
}
send_mail($subject,$email_id,$message);
return $status;
}
function getMechBookings($mechanic_id = '', $booking_id = '', $status = '1'){
if(empty($mechanic_id) && empty($booking_id)){
if($this->session->userdata('user_type') != 1 && empty($mechanic_id)){
return 0;
}
$cond = " BK.status IN (".$status.") ";
$cond .= (!empty($booking_id))?" AND BK.booking_id='".$booking_id."' ":"";
$cond .= (!empty($mechanic_id))?" AND BK.mechanic_id='".$mechanic_id."' ":"";
$sql = "SELECT BK.booking_id,BK.customer_id,BK.mechanic_id,BK.customer_veh_id,BK.scheduled_date,
BK.scheduled_time,BK.cost,BK.status,BK.mileage,BK.issues_selected,VEH.car_name,
BK.custom_issue_data,MECH.first_name AS mechFirstName,VEH.car_model,
MECH.last_name AS mechLastName,VEH.car_maker,VEH.car_model_year,VEH.car_vin,
VEH.vehicle_data,VEH.car_location,VEH.car_loc_lat,VEH.car_loc_lng,
CUST.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth
$cond .= (!empty($mechanic_id))?" AND MBK.mechanic_id='".$mechanic_id."' ":"";
$sql = "SELECT GROUP_CONCAT(DISTINCT(MBK.mechanic_id)) AS mechanic_ids,BK.booking_id,BK.customer_id,
BK.customer_veh_id,BK.scheduled_date,BK.scheduled_time,BK.cost,BK.status,BK.mileage,
BK.issues_selected,VEH.car_name,BK.custom_issue_data,VEH.car_model,VEH.car_maker,
VEH.car_model_year,VEH.car_vin,VEH.vehicle_data,BK.car_location,BK.car_loc_lat,
BK.car_loc_lng,CUST.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth,CUSQTE.custom_id,
MBK.status AS mech_status
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id=BK.mechanic_id)
INNER JOIN mechanic_booking AS MBK ON (MBK.booking_id=BK.booking_id)
INNER JOIN customers AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN admin_users AS ADM ON (ADM.id=BK.mechanic_id)
INNER JOIN admin_users AS ADM ON (ADM.id=MBK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id=BK.customer_veh_id)
LEFT JOIN custom_quote AS CUSQTE on (CUSQTE.booking_id = BK.booking_id
AND CUSQTE.mechanic_id=MBK.mechanic_id)
WHERE $cond AND ADM.status='1' AND CUST.status='1'
GROUP BY BK.booking_id";
$bookData = $this->db->query($sql);
if(!empty($bookData)){
$bookData = (!empty($booking_id))?$bookData->row():$bookData->result();
if(empty($booking_id)){
return $bookData->result();
}
$bookedMechanics = array();
$bookData = $bookData->row();
if(!empty($bookData->mechanic_ids)){
$mechanics = explode(',',$bookData->mechanic_ids);
foreach ($mechanics AS $mech_id) {
$mechanic_data = $this->db->query("
SELECT ROUND(AVG(MR.rate),2) AS rating,MCH.mechanic_id,MCH.first_name,
MCH.last_name,MCH.phone,CQ.custom_service_quote,MCH.location,
MCH.email_id,CQ.custom_amount,
CASE
WHEN BK.status = '0' THEN 'Pending'
WHEN BK.status = '1' THEN 'Accept'
ELSE 'Reject' END as status
FROM mechanic_booking AS BK
INNER JOIN mechanic MCH ON BK.mechanic_id=MCH.mechanic_id
INNER JOIN admin_users AU ON AU.id=MCH.mechanic_id
LEFT JOIN custom_quote CQ ON
CQ.mechanic_id=BK.mechanic_id AND
CQ.booking_id=BK.booking_id AND CQ.status='1'
LEFT JOIN mechanic_rating MR ON
MR.mechanic_id=BK.mechanic_id AND MR.status='1'
WHERE AU.status='1' AND BK.mechanic_id='$mech_id' AND BK.booking_id='$booking_id'");
if(!empty($mechanic_data)){
$mechData = $mechanic_data->row();
$mechData->custom_service_quote = json_decode($mechData->custom_service_quote);
$bookedMechanics[] = $mechData;
}
}
$bookData->mechanic_data = $bookedMechanics;
}
// pr($bookData);
return $bookData;
}
return 0;
......@@ -140,8 +266,76 @@ class Booking_model extends CI_Model {
if(empty($booking_id)){
return 0;
}
$status=$this->db->update('bookings',array('status'=>$status),array('booking_id'=>$booking_id));
if($this->session->userdata('user_type')==1){
if($status == '1'){
$status=$this->db->update('bookings',array('status'=>'0'),array('booking_id'=>$booking_id));
}
else if($status == '4'){
$status=$this->db->update('bookings',array('status'=>'4'),array('booking_id'=>$booking_id));
}
else if($status == '2'){
$this->db->update('bookings',array('status'=>'2'),array('booking_id'=>$booking_id));
}
}else{
$id = $this->session->userdata('id');
if($status == '4'){
$this->db->update('mechanic_booking',
array('status'=>'2'),
array('booking_id'=>$booking_id,'mechanic_id'=> $id));
}
else if($status == '1'){
$this->db->update('mechanic_booking',
array('status'=>'1'),
array('booking_id'=>$booking_id,'mechanic_id'=> $id));
}
else if($status == '2'){
$this->db->update('mechanic_booking',
array('status'=>'2'),
array('booking_id'=>$booking_id,'mechanic_id'=> $id));
}
}
return $status;
}
function insertCustomQuote($data){
$custData = array();$total=0;
$book_id = decode_param($data['booking_id']);
$mechanic_id = ($this->session->userdata('user_type')==2)?$this->session->userdata('id'):'';
unset($data['booking_id']);
for($i=0 ; $i < count($data['description']);$i++){
$custData[$i]['issue_id']=$data['issue_id'][$i];
$custData[$i]['sub_issue_id']=$data['sub_issue_id'][$i];
$custData[$i]['issue_category']=$data['issue_category'][$i];
$custData[$i]['description']=$data['description'][$i];
$custData[$i]['amount']=$data['amount'][$i];
$total += $data['amount'][$i];
}
$book_data = $this->db->get_where('custom_quote',array('booking_id'=>$book_id));
if(!empty($book_data) && $book_data->num_rows() > 0){
$this->db->update('custom_quote',array('custom_service_quote'=>json_encode($custData),'mechanic_id'=>$mechanic_id,'custom_amount'=>$total),array('booking_id'=>$book_id));
$res = array('status'=>'success');
}else{
if($this->db->insert('custom_quote',array('booking_id'=>$book_id,'mechanic_id'=>$mechanic_id,'custom_service_quote'=>json_encode($custData),'custom_amount'=>$total))){
$last_id = $this->db->insert_id();
$res = array('status'=>'success','data'=>encode_param($last_id));
}
}
return $res;
}
public function getCustomData($customid){
$this->db->select('custom_quote.custom_service_quote,custom_quote.custom_amount,bookings.issues_selected');
$this->db->join('bookings','bookings.booking_id = custom_quote.booking_id');
$this->db->where('custom_quote.custom_id',$customid);
$custData = $this->db->get('custom_quote');
if(!empty($custData) && $custData->num_rows() > 0){
$custData = $custData->row_array();
return $custData;
}
return 0;
}
}
?>
<?php
class Brand_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function addBrand($brand_data = array()){
if(empty($brand_data)){
return 0;
}
$status = $this->db->insert('product_brand',$brand_data);
return ($status)?1:0;
}
function getBrand($brand_id = '',$view_all = 0){
$cond = ($view_all != 0)?' status IN (0,1) ':' status IN (1) ';
$cond .= (!empty($brand_id))?" AND brand_id = '$brand_id'":"";
$result = $this->db->query("SELECT * FROM product_brand WHERE $cond");
if(empty($result)){
return;
}
return (empty($brand_id))?$result->result():$result->row();
}
function changeStatus($brand_id = '', $status = '0'){
if(empty($brand_id)){
return 0;
}
$status = $this->db->update('product_brand',array('status'=>$status), array('brand_id'=>$brand_id));
return $status;
}
function updateBrand($brand_id = '', $brand_data = array()){
if(empty($brand_id) || empty($brand_data)){
return 0;
}
$status = $this->db->update('product_brand',$brand_data,array('brand_id'=>$brand_id));
return ($status)?1:0;
}
}
?>
\ No newline at end of file
......@@ -50,6 +50,23 @@ class Customer_model extends CI_Model {
$this->db->query("UPDATE customer_vehicle SET status='1',customer_id='$cust_id'
WHERE customer_veh_id IN ($saved_vehicles)");
}
$subject = "Profile Activation";
$email_id = $customer_data['email'];
//$reset_link = 'https://projects.nuvento.com/admin/Api/verifyMail/'.$unique_id;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your account for the Username ".$email_id." is now Activated.
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['customer_registration_mail']) && !empty($template['customer_registration_mail'])){
$message = str_replace(array('{:email}'),array($email_id),$template['customer_registration_mail']);
}
send_mail($subject,$email_id,$message);
$res = array('status'=>1,'data'=>'');
return ($status)?1:0;;
}
......
<?php
class Mailtemplate_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getCMSdata(){
$cmsData = $this->db->query("SELECT * FROM privacy_policy");
if(!empty($cmsData)){
return $cmsData->row();
}
return 0;
}
public function updateCMS($cmsData = array()){
if(empty($cmsData)){
return 0;
}
$status = $this->db->update('privacy_policy',$cmsData);
return $status;
}
public function getNotifData(){
$notifData = $this->db->query("SELECT * FROM notification_templates");
if(!empty($notifData)){
return $notifData->row();
}
return 0;
}
public function updateNotif($notifData = array()){
if(empty($notifData)){
return 0;
}
$status = $this->db->update('notification_templates',$notifData);
return $status;
}
}
?>
\ No newline at end of file
......@@ -62,7 +62,7 @@ class Mechanic_model extends CI_Model {
$cond .= (!empty($cond))?" AND ":$cond;
$cond .= (!empty($view_all))?" ADMN.status IN (0,1) ":" ADMN.status IN (1) ";
$sql = "SELECT ADMN.username,ADMN.user_type,ADMN.display_name,ADMN.profile_image,ADMN.status,
$sql = "SELECT ADMN.username,ADMN.user_type,TRIM(CONCAT(MECH.first_name,' ' ,IFNULL(MECH.last_name,''))) as display_name,ADMN.profile_image,ADMN.status,
MSH.shop_name, MSH.address AS shop_address, MSH.phone AS shop_phone,
MSH.email_id AS shop_email, MECH.*
FROM mechanic AS MECH
......@@ -107,7 +107,8 @@ class Mechanic_model extends CI_Model {
if(!$status) { return 0; }
$upMecArr = array('city'=>$mechanic_data['city'],'first_name'=>$mechanic_data['first_name'],
'state'=>$mechanic_data['state'],'shop_id'=>$mechanic_data['shop_id'],
'state'=>$mechanic_data['state'],
'shop_id'=>(!empty($mechanic_data['shop_id']) ? $mechanic_data['shop_id'] : '0'),
'address'=>$mechanic_data['address'],'email_id'=>$mechanic_data['email_id'],
'last_name'=>$mechanic_data['last_name'],'phone'=>$mechanic_data['phone'],
'location'=>$mechanic_data['location'],
......@@ -129,8 +130,26 @@ class Mechanic_model extends CI_Model {
if(empty($mechanic_id)){
return 0;
}
$status = $this->db->update('admin_users',array('status'=>$status),array('id'=>$mechanic_id));
return $status;
$resp = $this->db->update('admin_users',array('status'=>$status),array('id'=>$mechanic_id));
if($status == '1'){
$mechData = $this->db->get_where('mechanic',array(' mechanic_id'=>$mechanic_id))->row();
$subject = "Profile Activation";
$email_id = $mechData->email_id;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your account for the Username ".$email_id." is now Activated.
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['mechanic_activation_mail']) && !empty($template['mechanic_activation_mail'])){
$message = str_replace(array('{:user_name}'),array($email_id),$template['mechanic_activation_mail']);
}
send_mail($subject,$email_id,$message);
$res = array('status'=>1,'data'=>'');
}
return $resp;
}
function getNearByMechanics($location_data = array(),$sub_issues = array()){
......@@ -151,6 +170,7 @@ class Mechanic_model extends CI_Model {
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')
WHERE AU.status='1'
-- GROUP BY ME.mechanic_id
-- HAVING distance<30";
$mechData = $this->db->query($sql);
......@@ -161,6 +181,7 @@ class Mechanic_model extends CI_Model {
$estimate = 0;
$mechDataArr = array();
foreach($mechData AS $index => $data){
$data['distance'] = (int)$data['distance'];
if(empty($data['start_time']) || empty($data['end_time'])){
$scheduleTiming = array('09:00 AM','10:00 AM','11:00 AM','12:00 PM','01:00 PM',
'02:00 PM','03:00 PM','04:00 PM','05:00 PM','06:00 PM');
......@@ -174,6 +195,11 @@ class Mechanic_model extends CI_Model {
}
}
$rating = $this->db->query("SELECT round(avg(rate),2) AS rating
FROM mechanic_rating
WHERE mechanic_id='".$data['mechanic_id']."'");
$rating = (!empty($rating) && !empty($rating = $rating->row_array()))?$rating['rating']:'0';
$mechanic_id = $data['mechanic_id'];
$sql = "SELECT ISS.*, IC.*, MI.*
FROM issues_category AS IC
......@@ -200,6 +226,7 @@ class Mechanic_model extends CI_Model {
}
}
$mechData[$index]['rating'] = $rating;
$mechData[$index]['estimate'] = $estimate;
$mechData[$index]['sub_issues'] = $sIssueData;
$mechData[$index]['scheduleTiming'] = $scheduleTiming;
......
<?php
class Order_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getOrders(){
$this->db->select("ORD.format_order_id,ORD.quantity,ORD.amount,ORD.status,PRD.product_name,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,ORD.order_id");
$this->db->from('orders AS ORD');
$this->db->join('products AS PRD','PRD.product_id = ORD.product_id');
$this->db->join('customers AS CUST','CUST.customer_id = ORD.customer_id');
$result = $this->db->get()->result();
if(!empty($result)){
return $result;
}
}
public function getOrderDetails($order_id){
if($order_id == ''){
return 0;
}
$result = $this->db->query("SELECT ORD.*,PRD.product_name,PRD.short_description,PRDB.brand_name,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,
CASE WHEN ORD.status = 0 THEN 'Inactive'
WHEN ORD.status = 1 THEN 'Payment Processing'
WHEN ORD.status = 2 THEN 'Order Places'
WHEN ORD.status = 3 THEN 'Order Packed'
WHEN ORD.status = 4 THEN 'Order Shipped'
WHEN ORD.status = 5 THEN 'Ordered Delivered'
WHEN ORD.status = 6 THEN 'Returned'
WHEN ORD.status = 7 THEN 'Cancelled'
WHEN ORD.status = 8 THEN 'Deleted'
ELSE 'Payment Failed' END AS status
FROM orders AS ORD
JOIN products AS PRD on PRD.product_id = ORD.product_id
JOIN product_brand AS PRDB on PRDB.brand_id = PRD.brand_id
JOIN customers AS CUST on CUST.customer_id = ORD.customer_id
WHERE ORD.order_id = $order_id");
if(empty($result)){
return;
}
return $result->row();
}
public function getProductImage($order_id){
$result = $this->db->query("SELECT PRDI.image FROM orders AS ORD join product_images AS PRDI on PRDI.product_id = ORD.product_id WHERE ORD.order_id = $order_id");
return (empty($result))?'':$result->result();
}
}
?>
<?php
class Product_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function addProduct($product_data = array()){
if(empty($product_data)){
return 0;
}
$cardata = $this->db->get_where('cardetails',array('year'=>$product_data['vehYear'],'make'=>$product_data['vehMake'],'model'=>$product_data['vehModel']))->row();
if($cardata){
$product_data['cardetail_id'] = $cardata->id;
}else{
$this->db->insert('cardetails',array('year'=>$product_data['vehYear'],'make'=>$product_data['vehMake'],'model'=>$product_data['vehModel']));
$product_data['cardetail_id'] = $this->db->insert_id();
}
unset($product_data['vehYear']);
unset($product_data['vehMake']);
unset($product_data['vehModel']);
$status = $this->db->insert('products',$product_data);
$last_id = $this->db->insert_id();
return $last_id;
}
function getProduct($product_id = '',$view_all = 0){
$cond = ($view_all != 0)?' products.status IN (0,1) ':' products.status IN (1) ';
$cond .= (!empty($product_id))?" AND products.product_id = '$product_id'":"";
$result = $this->db->query("SELECT cardetails.make,cardetails.year,cardetails.model,products.*,product_brand.brand_name FROM products join product_brand on product_brand.brand_id = products.brand_id join cardetails on cardetails.id = products.cardetail_id WHERE $cond");
if(empty($result)){
return;
}
return (empty($product_id))?$result->result():$result->row();
}
function changeStatus($product_id = '', $status = '0'){
if(empty($product_id)){
return 0;
}
$this->db->update('product_images',array('status'=>$status),array('product_id'=>$product_id));
$status = $this->db->update('products',array('status'=>$status), array('product_id'=>$product_id));
return $status;
}
function updateProduct($product_id = '', $product_data = array()){
if(empty($product_id) || empty($product_data)){
return 0;
}
$cardata = $this->db->get_where('cardetails',array('year'=>$product_data['vehYear'],'make'=>$product_data['vehMake'],'model'=>$product_data['vehModel']))->row();
if($cardata){
$product_data['cardetail_id'] = $cardata->id;
}else{
$this->db->insert('cardetails',array('year'=>$product_data['vehYear'],'make'=>$product_data['vehMake'],'model'=>$product_data['vehModel']));
$product_data['cardetail_id'] = $this->db->insert_id();
}
unset($product_data['vehYear']);
unset($product_data['vehMake']);
unset($product_data['vehModel']);
$status = $this->db->update('products',$product_data,array('product_id'=>$product_id));
return ($status)?1:0;
}
function addProductImage($imagearray = array()){
if(empty($imagearray)){
return 0;
}
$status = $this->db->insert_batch('product_images',$imagearray);
return ($status)?1:0;
}
function updateProductImage($product_id = '', $imagearray = array(), $existingImages = array()){
if(empty($product_id)){
return 0;
}
if(!empty($existingImages)){
$this->db->query("DELETE FROM product_images
WHERE id NOT IN (".implode(",",$existingImages).") AND product_id=$product_id");
} else {
$this->db->query("DELETE FROM product_images WHERE product_id='$product_id'");
}
if(!empty($imagearray)){
$status = $this->db->insert_batch('product_images',$imagearray);
}
return $status;
}
function getProductImage($product_id = ''){
if(empty($product_id)){
return 0;
}
$status = $this->db->get_where('product_images',array('product_id'=>$product_id))->result_array();
return $status;
}
function getVehdata(){
return $this->db->get_where('cardetails')->result_array();
}
}
?>
\ No newline at end of file
<?php
class Webservice_model extends CI_Model {
class Webservice_model extends CI_Model {
function __construct() {
parent::__construct();
date_default_timezone_set('Asia/Kolkata');
}
public function join_has_driver($request){
$result = array('status' => 'error');
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if(empty($query)){
return $result;
}
if ($query->num_rows() <= 0) {
return $result;
}
$rs = $query->row();
$id = $rs->member_id;
$data = array('users_id' =>$id,
'profile_pic' =>$request['picture'],
'id_proof' =>$request['car_id'],
'car_front' =>$request['car_front'],
'car_back' =>$request['car_back']);
$res = $this->db->insert('drivers',$data);
if($res){
$result = array('status' => 'success');
} else {
$result = array('status' => 'error','message'=>'Already Exist');
}
return $result;
}
public function update_driver_location($request) {
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$data = array('driver_lat' => $request['latitude'],
'driver_lng' => $request['longitude']);
$result = $this->db->where('users_id', $id)->update('drivers', $data);
return $result;
} else {
return false;
}
}
public function registration($data) {
$num = $this->db->where('email_id', $data['email'])->get('users')->num_rows();
if($num > 0) {
$result = array('status' => 'error', 'message' => 'Email Already Exists');
}
else {
$unique_id = $this->generate_unique();
$this->db->insert('users', array('first_name' => $data['first_name'],
'surname' => $data['sur_name'],
'email_id' => $data['email'],
'password' => md5($data['password']),
'profile_image' => $data['profile_photo'],
'phone' => $data['phone'],
// 'is_phone_verified' => '1'
));
$user_id = $this->db->insert_id();
$phone_verified = array(
'phone_verified' => '1'
);
$this->db->where('users_id', $user_id);
$this->db->update('user_profile', $phone_verified);
$data2 = "SELECT * FROM users WHERE id = '$user_id'";
$query = $this->db->query($data2);
$rs2 = $query->row();
$data = array('user_id' => $user_id,
'first_name' =>$rs2->first_name,
'sur_name' =>$rs2->surname,
'phone' => $rs2->phone,
'email'=>$rs2->email_id,
'profile_photo'=>$rs2->profile_image);
$this->EncryptedPatientKey($user_id,$unique_id);
if ($user_id) {
$result = array('status' => 'success', 'user_id' => $user_id, 'auth_token' => $unique_id,'user' => $data,);
} else {
$result = array('status' => 'error');
}
}
return $result;
}
public function generate_unique() {
$unqe = md5(uniqid(time().mt_rand(), true));
return $unqe;
}
public function EncryptedPatientKey($user_id,$unique_id) {
$this->db->insert('auth_table', array('member_id' => $user_id, 'unique_id' => $unique_id));
}
public function check_email_availability($data){
$num = $this->db->where('email_id', $data['email'])->get('users')->num_rows();
$email = $data['email'];
if($num > 0){
$result = array('status' => 'success', 'data'=> array('email' => $email, 'is_email_avaliable'=>false));
}
else{
$result = array('status' => 'success', 'data'=> array('email' => $email, 'is_email_avaliable'=>true));
}
return $result;
}
public function check_phone_availability($data){
$num = $this->db->where('phone', $data['phone'])->get('users')->num_rows();
$phone = $data['phone'];
if($num > 0){
$result = array('status' => 'success', 'data'=> array('phone' => $phone, 'is_phone_avaliable'=>false));
}
else{
$result = array('status' => 'success', 'data'=> array('phone' => $phone, 'is_phone_avaliable'=>true));
}
return $result;
}
public function login($request){
$this->db->where('email_id', $request['email']);
$this->db->where('password', md5($request['password']));
$this->db->where('status', 1);
$query = $this->db->select('*')->from('users')->join('user_profile','user_profile.users_id = users.id')->get();
if ($query->num_rows() > 0) {
$unique_id = $this->generate_unique();
$rs = $query->row();
$is_phone_verified = $rs->phone_verified==1?'true':'false';
$is_driver_status = $rs->is_driver;
//$is_phone_verified = $is_phone==1?'true':'false';
$data = array('user_id' => $rs->id,
'first_name' =>$rs->first_name,
'sur_name' =>$rs->surname,
'phone' => $rs->phone,
'email'=>$rs->email_id,
'profile_photo'=>$rs->profile_image,
'is_driver' => $is_driver_status==1?'true':'false',
'is_phone_verified' => $is_phone_verified
);
$this->EncryptedPatientKey($rs->id,$unique_id);
$result = array('status' => 'success', 'auth_token' => $unique_id,'user' => $data);
} else {
$result = array('status' => 'error');
}
return $result;
}
public function forgot_password($data){
$this->db->where('email_id',$data['email']);
$query = $this->db->get('users');
$rs = $query->row();
if ($rs) {
$username = $query->first_name;
$this->load->helper('string');
$rand_pwd = random_string('alnum', 8);
$password = array(
'password' => md5($rand_pwd)
);
$this->db->where('email_id', $data['email']);
$query = $this->db->update('users', $password);
if ($query) {
$this->load->library('email');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'mail.techlabz.in',
'smtp_port' => 587,
'smtp_user' => '[email protected]', // change it to yours
'smtp_pass' => 'k4$_a4%eD?Hi', // change it to yours
'smtp_timeout' => 20,
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE);
$this->email->initialize($config);
$subject = 'New Mail';
//$this->email->set_newline("\r\n");
$this->email->from('[email protected]', $settings->title);
$this->email->to($data->email);
$this->email->subject("Forget Password");
$this->email->message("New Password is:".$rand_pwd);
$this->email->send();
$rs = $this->email->print_debugger();
return "EmailSend";
}
}
else {
return false;
}
}
public function update_fcm_token($request) {
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$data = array('fcm_token' => $request['fcm_token']);
$result = $this->db->where('users_id', $id)->update('user_profile', $data);
return $result;
} else {
return false;
}
}
public function categories(){
$sql = "SELECT id AS category_id,cat_name as category_name,image AS category_image FROM category WHERE status = '1' ";
$query = $this->db->query($sql);
if ($query->num_rows() >= 0) {
$data = $query->result();
$result = array('status' => 'success','user' => $data);
}
else{
$result = array('status' => 'error');
}
return $result;
}
public function get_user_type($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$driver_id = $rs->member_id;
$sql = "SELECT is_driver,driver_enabled FROM user_profile WHERE users_id = $driver_id";
$query = $this->db->query($sql);
// echo $this->db->last_query();
// die;
$data = $query->result();
$is_driver = $data[0]->is_driver;
$is_driver_enabled = $data[0]->driver_enabled;
if($is_driver=="1"){
$request['is_driver'] = "true";
}else{
$request['is_driver'] = "false";
}
if($is_driver_enabled=="1"){
$request['is_driver_enabled'] = "true";
}else{
$request['is_driver_enabled'] = "false";
}
$result = array('status' => 'success','data' => $request['is_driver'],'res'=>$request['is_driver_enabled']);
}else{
$result = array('status' => 'error');
}
return $result;
}
public function set_user_type($request){
//pr($request);
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$driver_id = $rs->member_id;
$data = array('is_driver'=>$request['is_driver']);
$this->db->where('users_id', $driver_id)->update('user_profile', $data);
$is_driver = $request['is_driver'];
if($is_driver=="1"){
$request['is_driver'] = "true";
}else{
$request['is_driver'] = "false";
}
$result = array('status' => 'success','data' => $request['is_driver']);
}else{
$result = array('status' => 'error');
}
return $result;
}
public function promotions(){
$sql = "SELECT id AS promotion_id,promotion_name,image as promotion_image FROM promotions WHERE status = '1' ";
$query = $this->db->query($sql);
if ($query->num_rows() >= 0) {
$data = $query->result();
// print_r($data);
// exit;
// for($i=0; $i<count($data);$i++)
// {
// $data[$i]->promotion_name = "promotion";
// }
$result = array('status' => 'success','promotions' => $data);
}
else{
$result = array('status' => 'error');
}
return $result;
}
public function popular(){
$sql = "SELECT category.id as popular_id,category.cat_name as popular_name,category.image as popular_image FROM popular JOIN category ON category.id = popular.cat_id WHERE category.status=1 ORDER BY popular.index_no ASC";
$query = $this->db->query($sql);
if ($query->num_rows() >= 0) {
$data = $query->result();
$result = array('status' => 'success','popular' => $data);
}
else{
$result = array('status' => 'error');
}
return $result;
}
public function update_password($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$query = $this->db->query("SELECT * FROM users
WHERE id = '".$id."' AND
password ='".md5($request['old_password'])."'");
if(!empty($query)){
$rs = $query->row();
if($query->num_rows() <= 0){
return array('status' => 'error','message' => 'Password mismatch');
}
}
$query = $this->db->update('users', array('password'=>md5($request['new_password'])),
array('id'=>$id));
if($query){
return array('status' => 'success');
}
}
return array('status' => 'error','message' => 'No data');
}
public function update_phone($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
// print_r($rs);die();
$id = $rs->member_id;
$data = "SELECT * FROM users WHERE id = '$id'";
$query = $this->db->query($data);
$rs = $query->row();
if($query->num_rows() <= 0){
$result = array('status' => 'error','message' => 'No data');
/***************************************************************************************/
/****************************************Mobile API's***********************************/
public function checkMobAvailability($data = array()){
$res = array('status'=>'success', 'message'=>'Mobile Number Available','data'=>array('phone'=>$data['phone'],'is_available'=>true));
if(empty($data)){
$res = array('status'=>'error','error'=>'901','message'=>'Something went wrong.');
return $res;
}
else{
$phone = array(
'phone' => $request['phone']
);
$this->db->where('id', $id);
$query = $this->db->update('users', $phone);
$result = array('status' => 'success');
$result = $this->db->get_where('customers',array('phone'=>$data['phone'],'country_code'=>$data['country_code']));
if(!empty($result) && $result->num_rows() > 0){
$res=array('status'=>'error','error'=>'902','message'=>'Mobile number already in use.');
}
}else{
$result = array('status' => 'error','message' => 'No data');
return $res;
}
return $result;
}
public function notification_update($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if($query->num_rows() > 0){
$rs = $query->row();
$driver_id = $rs->member_id;
$data = array('notification'=>$request['notification_update']);
$this->db->where('id', $driver_id)->update('users', $data);
$result = array('status' => 'success','data' => $request['notification_update'],);
public function checkCustomerLogin($userLogData){
$respArr = array('status'=>0);
if(empty($userLogData)){
return $returnStatus;
}
else{
$result = array('status' => 'error');
$result = $this->db->get_where('customers',array('email'=>$userLogData['email'],'status'=>'1'));
if(empty($result) || $result->num_rows() < 1 || empty($custData = $result->row())){
$respArr['status'] = 2;
return $respArr;
}
return $result;
}
public function get_user_info($request){
$result = array();
$query = $this->db->query("SELECT USR.id,USR.first_name,USR.surname,USR.phone,
USR.profile_image,USR.notification,USR.email_id,DRV.profile_pic,
DRV.earnings,UP.phone_verified,UP.email_verified,UP.driver_enabled,
UP.is_driver,UP.wallet,AP_RATE.rate AS appRate,
DRV_RATE.rate AS drvRate
FROM users AS USR
INNER JOIN auth_table AS AT ON (AT.member_id = USR.id)
INNER JOIN user_profile AS UP ON (UP.users_id = USR.id)
LEFT JOIN drivers AS DRV ON (DRV.users_id = USR.id AND DRV.status = '1')
LEFT JOIN app_rate AS AP_RATE ON (AP_RATE.users_id = USR.id)
LEFT JOIN driver_rate AS DRV_RATE ON (DRV_RATE.users_id = USR.id)
WHERE AT.unique_id = '".$request['auth']."' AND USR.status = '1'
GROUP BY USR.id");
if($query->num_rows() > 0){
$userData = $query->row_array();
$usrOdrCount = $this->db->query("SELECT COUNT(id)
FROM orders
WHERE status = '3' AND users_id = '".$userData."'
GROUP BY users_id");
$drvOdrCount = $this->db->query("SELECT COUNT(id)
FROM orders
WHERE status = '3' AND driver_id = '".$userData."'
GROUP BY status = '3' driver_id");
$usrOdrCount = (!empty($usrOdrCount))?$usrOdrCount->row_array():0;
$drvOdrCount = (!empty($drvOdrCount))?$drvOdrCount->row_array():0;
$userData['user_oder_count'] = (empty($usrOdrCount))?0:$usrOdrCount;
$userData['driver_oder_count'] = (empty($drvOdrCount))?0:$drvOdrCount;
$query = $this->db->select('AVG(NULLIF(rate,0)) as avg_rate')->where('users_id', $userData['id'])->get('user_rate');
if($query->num_rows() > 0){
$res = $query->result();
// pr($res[0]->avg_rate);
$userData['appRate'] = ceil($res[0]->avg_rate);
$this->db->select("customer_id as id,is_otp_verified,phone as phone_number,TRIM(CONCAT(first_name,' ' ,IFNULL(last_name,''))) as user_name");
$result = $this->db->get_where('customers',array('email'=>$userLogData['email'],
'password'=>$userLogData['password'],
'status'=>'1'));
$respArr['status'] = 3;
if(!empty($result) && $result->num_rows() == 1 && !empty($custData = $result->row())){
$authdata = $this->insert_auth($custData->id);
if($authdata){
$custData->auth_token = $authdata;
$respArr['data'] = $custData;
$respArr['status'] = 1;
}
$query1 = $this->db->select('AVG(NULLIF(rate,0)) as avg_rate')->where('driver_id', $userData['id'])->get('driver_rate');
if($query1->num_rows() > 0){
$res = $query1->result();
// pr($res[0]->avg_rate);
$userData['drvRate'] = ceil($res[0]->avg_rate);
}
$respArr = array();
$respArr['is_driver'] = ($userData['is_driver'] == 1)?true:false;
$respArr['is_registered_as_driver'] = ($userData['driver_enabled'] == 1)?true:false;
$respArr['user']['user_id'] = $userData['id'];
$respArr['user']['first_name'] = $userData['first_name'];
$respArr['user']['sur_name'] = $userData['surname'];
$respArr['user']['phone'] = $userData['phone'];
$respArr['user']['email'] = $userData['email_id'];
$respArr['user']['rating'] = $userData['appRate'];
$respArr['user']['total_order'] = $userData['user_oder_count'];
$respArr['user']['wallet'] = $userData['wallet'];
$respArr['user']['notification'] = ($userData['notification'] == 1)?true:false;
$respArr['user']['profile_photo'] = $userData['profile_image'];
$respArr['driver'] = array();
if($userData['driver_enabled']){
$respArr['driver']['user_id'] = $userData['id'];
$respArr['driver']['first_name'] = $userData['first_name'];
$respArr['driver']['sur_name”'] = $userData['surname'];
$respArr['driver']['phone'] = $userData['phone'];
$respArr['driver']['email'] = $userData['email_id'];
$respArr['driver']['rating'] = $userData['drvRate'];
$respArr['driver']['total_order'] = $userData['driver_oder_count'];
$respArr['driver']['wallet'] = $userData['wallet'];
$respArr['driver']['earnings'] = $userData['earnings'];
$respArr['driver']['notification'] = ($userData['notification'] == 1)?true:false;
$respArr['driver']['profile_photo'] = $userData['profile_image'];
}
$result = array('status' => 'success', 'data' => $respArr);
}
else{
$result = array("status" => "error","error" => "No data","message" => "No data");
}
return $result;
}
public function profile_edit_update($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if($query->num_rows() > 0){
$rs = $query->row();
$user_id = $rs->member_id;
$this->db->where('email_id',$request['email']);
$this->db->where('id!=',$user_id);
$res = $this->db->get('users');
if($res->num_rows() == 0){
$data = array('first_name'=>$request['first_name'],
'surname' =>$request['sur_name'],
'email_id' =>$request['email'],
'profile_image'=>$request['profile_photo']);
$this->db->where('id', $user_id)->update('users', $data);
$result = array('status' => 'success');
}else{
$result = array('status' => 'exists');
return $respArr;
}
}else{
$result = array('status' => 'error');
}
return $result;
}
public function add_home_work($request){
$query = $this->db->where('unique_id',$request['auth'])->get('auth_table');
if($query->num_rows()>0){
$rs = $query->row();
if($request['type']==0){
$data = array('users_id'=>$rs->member_id,'location'=>$request['home'],'lat'=>$request['home_latitude'],'lng'=>$request['home_longitude'],'type'=>$request['type'],'status'=>'1');
}else{
$data = array('users_id'=>$rs->member_id,'location'=>$request['work'],'lat'=>$request['work_latitude'],'lng'=>$request['work_longitude'],'type'=>$request['type'],'status'=>'1');
}
$this->db->insert('user_address',$data);
return true;
}else{
return false;
}
}
public function location_details($request){
$query = $this->db->where('unique_id',$request['auth'])->get('auth_table');
if($query->num_rows()>0){
$rs = $query->row();
$cust_id = $rs->member_id;
$data = "SELECT type,location,lat,lng FROM user_address WHERE users_id='$cust_id' AND status='1'";
$query = $this->db->query($data);
$home = $work = array();
function createServiceProvider($provider_data = array()){
if(empty($provider_data))
return 0;
$result = $query->result_array();
if(empty($result)){
return array('status' => 'success', 'data' => array('home' => $home, 'work' => $work));
if(isset($provider_data['email']) && !empty($provider_data['email'])){
$emailChk = $this->db->get_where('admin_users',array('username'=>$provider_data['email'],'status !='=>'2'));
if(!empty($emailChk) && $emailChk->num_rows() > 0){
return 2;
}
}
foreach($result AS $address){
if($address['type'] == '0'){
$home[] = array('name' => $address['location'],
'latitude' =>$address['lat'],
'longitude' =>$address['lng']);
}else{
$work[] = array('name' => $address['location'],
'latitude' =>$address['lat'],
'longitude' =>$address['lng']);
if(isset($provider_data['phone']) && !empty($provider_data['phone'])){
$phoneChk = $this->db->get_where('mechanic',array('phone'=>$provider_data['phone']));
if(!empty($phoneChk) && $phoneChk->num_rows() > 0){
return 3;
}
}
if($result){
$result = array('status' => 'success', 'data' => array('home' => $home, 'work' => $work));
}else{
$result = array('status' => 'error');
$status = $this->db->insert('admin_users',
array('username'=>$provider_data['email'],
'password'=>md5($provider_data['password']),
'display_name'=>$provider_data['first_name'].' '.$provider_data['last_name'],
'user_type'=>'2','status'=>'1'));
if(!$status){
return 0;
}
return $result;
}else{
return false;
$mechanic_id = $this->db->insert_id();
$status = $this->db->insert('mechanic',
array('mechanic_id'=>$mechanic_id,
'city'=>'',
'phone'=>$provider_data['phone'],
'state'=>'',
'shop_id'=>'',
'address'=>'',
'licence'=>'',
'location'=>'',
'email_id'=>$provider_data['email'],
'end_time'=>'',
'last_name'=>$provider_data['last_name'],
'start_time'=>'',
'first_name'=>$provider_data['first_name'],
'location_lat'=>'',
'location_lng'=>'',
'licence_number'=>'',
'licence_exp_date'=>''));
return ($status)?1:0;
}
public function insert_auth($id){
$static_string = time();
$authToken = 'Dcarfixs'.sha1($static_string);
$custData = $this->db->get_where('authtable',array('customer_id'=>$id));
if(!empty($custData) && $custData->num_rows() > 0){
$custData = $custData->row();
$authToken = $custData->authtoken;
} else {
$this->db->insert('authtable',array('customer_id'=>$id,'authtoken'=>$authToken));
}
}
public function user_rating($request){
$query = $this->db->where('unique_id',$request['auth'])->get('auth_table');
if($query->num_rows()>0){
$rs = $query->row();
$cust_id = $rs->member_id;
$data = array('rate'=>$request['rating'],
'orders_id'=>$request['order_id'],
'users_id'=>$request['user_id'],
'driver_id'=>$cust_id);
return $authToken;
}
$res = $this->db->insert('user_rate',$data);
public function createCustomer($customer_data = array()){
$respArr = array('status'=>0);
if(empty($customer_data)){
$respArr['status'] = 0;
return $respArr;
}
if(isset($customer_data['email']) && !empty($customer_data['email'])){
$emailChk = $this->db->get_where('customers',array('email'=>$customer_data['email'],'status !='=>'2'));
if(!empty($emailChk) && $emailChk->num_rows() > 0){
$respArr['status'] = 2;
return $respArr;
}
}
if(isset($customer_data['phone']) && !empty($customer_data['phone'])){
$phoneChk = $this->db->get_where('customers',array('phone'=>$customer_data['phone'],'status !='=>'2'));
if(!empty($phoneChk) && $phoneChk->num_rows() > 0){
$respArr['status'] = 3;
return $respArr;
}
}
$customer_data['first_name'] = $customer_data['name'];
unset($customer_data['name']);
if($this->db->insert('customers',$customer_data)){
$last_id = $this->db->insert_id();
$this->db->select("TRIM(CONCAT(first_name,' ' ,IFNULL(last_name,''))) as name,customer_id as user_id");
$custData = $this->db->get_where('customers',array('customer_id'=>$last_id))->row();
$authdata = $this->insert_auth($last_id);
$custData->auth_token = $authdata;
$respArr['data'] = $custData;
$respArr['status'] = 1;
}
return $respArr;
}
if($res){
$result = array('status' => 'success');
public function get_customer_authtoken($auth = ''){
$respArr = array('status'=>0,'error'=>'901','message'=>'Something Went Wrong.');
if(empty($auth)){
return $respArr;
}
$auth = $this->db->get_where('authtable',array('authtoken'=>$auth));
if(!empty($auth) && $auth->num_rows() >= 1 && !empty($custAuth = $auth->row_array())){
$respArr['status'] = 'success';
$respArr['data'] = $custAuth;
}else{
$result = array('status' => 'error');
$respArr['status'] = 'error';
$respArr['error'] = '902';
$respArr['message'] = 'Authtoken is not Valid';
}
return $respArr;
}
return $result;
public function getBookedService($id = ''){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($id)){
return $respArr;
}
$this->db->select('booking_id as id,scheduled_date as date,scheduled_time as time');
$this->db->where('scheduled_date >',date('Y-m-d h:i'));
$bookData = $this->db->get_where('bookings',array('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']['booked_services'] = $bookData;
}else{
return false;
}
}
public function driver_rating($request){
$query = $this->db->where('unique_id',$request['auth'])->get('auth_table');
if($query->num_rows()>0){
$rs = $query->row();
$cust_id = $rs->member_id;
$data = array('rate'=>$request['rating'],
'orders_id'=>$request['order_id'],
'driver_id'=>$request['driver_id'],
'users_id'=>$cust_id);
$res = $this->db->insert('driver_rate',$data);
if($res){
$result = array('status' => 'success');
$respArr['data']['booked_services'] = [];
}
return $respArr;
}
public function addVehicleDetails($postData = array(),$customer_id = ''){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
return $respArr;
}
$car_name = $postData['vehicle_year'].' '.$postData['vehicle_make'].' '.$postData['vehicle_model'];
$vehJson = array(
'vehicle' => $car_name,
'attributes' => array(
'Year' => $postData['vehicle_year'],
'Make' => $postData['vehicle_make'],
'Trim' => $postData['vehicle_trim'],
'Model' => $postData['vehicle_model'],
'Engine'=> $postData['engine_no']
)
);
$insert_array = array(
'customer_id' => $customer_id,
'car_name' => $car_name,
'car_model' => $postData['vehicle_model'],
'car_maker' => $postData['vehicle_make'],
'car_loc_lat' => $postData['car_loc_lat'],
'car_loc_lng' => $postData['car_loc_lng'],
'car_location' => $postData['car_location'],
'vehicle_data' => json_encode($vehJson),
'car_model_year'=> $postData['vehicle_year'],
'status' => '3'
);
if($this->db->insert('customer_vehicle',$insert_array)){
$last_id = $this->db->insert_id();
$book_data = array(
'mileage' => $postData['mileage'],
'customer_id' => $customer_id,
'customer_veh_id'=> $last_id,
'status' => '5'
);
if($this->db->insert('bookings',$book_data)){
$book_id = $this->db->insert_id();
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data']['booking_id'] = $book_id;
return $respArr;
}
}
return $respArr;
}
public function get_service_list($postData = '',$start,$per_page){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
$this->db->select("issue_id as id,issue as service_name,IF(issue_image != NULL OR issue_image != '' , concat('".base_url()."',issue_image) , '') as icon");
if(!empty($postData['query'])){
$where = "issue LIKE '".$postData['query']."%'";
$this->db->where($where);
}
$this->db->where('status','1');
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$service = $this->db->get('issues');
if(!empty($service) && !empty($serviceData = $service->result_array())){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data']= $serviceData;
}
return $respArr;
}
public function search_sub_services($postData = '',$start,$per_page){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(!isset($postData['service_id']) && empty($postData['service_id'])){
$respArr['status'] = 1;
$respArr['message'] = 'Service Id is Required';
return $respArr;
}
$this->db->select("issue_cat_id as id,issue_category as sub_service_name,IF(issue_cat_image != NULL OR issue_cat_image != '' , concat('".base_url()."',issue_cat_image) , '') as icon");
if(!empty($postData['query'])){
$where = "issue_category LIKE '".$postData['query']."%'";
$this->db->where($where);
}
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$subservice = $this->db->get_where('issues_category',array('status'=>'1','issue_id'=>$postData['service_id']));
if(!empty($subservice) && !empty($subserviceData = $subservice->result_array())){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data']= $subserviceData;
}
return $respArr;
}
public function book_service($postData){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
$respArr['message'] = 'All Field is required';
return $respArr;
}
$insert_array = array('cost'=>$postData['total_cost'],'mechanic_id'=>$postData['mechanic_id'],'scheduled_date'=>date('Y-m-d',$postData['date']/1000),'scheduled_time'=>$postData['time'],'issues_selected'=>json_encode($postData['service_id']));
if($this->db->update('bookings',$insert_array,array('booking_id'=>$postData['booking_id']))){
$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');
$this->db->join('mechanic','bookings.mechanic_id = mechanic.mechanic_id');
$this->db->join('admin_users','admin_users.id = mechanic.mechanic_id');
$this->db->join('mechanic_shop','mechanic_shop.shop_id = mechanic.shop_id','left');
$mech_data = $this->db->get_where('bookings',array('booking_id'=>$postData['booking_id']));
if(!empty($mech_data) && !empty($mechanic_data = $mech_data->row_array())){
$mech_veh_data = json_decode($mechanic_data['vehicle_data']);
$mechanic_data['engine_no'] = $mech_veh_data->attributes->Engine;
$mechanic_data['vehicle_trim'] = $mech_veh_data->attributes->Trim;
unset($mechanic_data['vehicle_data']);
$mechanic_data['services'] = json_decode($mechanic_data['issues_selected']);
unset($mechanic_data['issues_selected']);
$mechanic_data['scheduled_date'] = strtotime($mechanic_data['scheduled_date']);
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $mechanic_data;
}
}
return $respArr;
}
public function get_booking_summary($postData = ''){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData['booking_id'])){
$respArr['message'] = 'Booking Id is required';
return $respArr;
}
$this->db->select("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,bookings.mileage,bookings.issues_selected,bookings.custom_issue_data,bookings.mechanic_id");
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$mech_data = $this->db->get_where('bookings',array('booking_id'=>$postData['booking_id']));
if(!empty($mech_data) && !empty($mechanic_data = $mech_data->row_array())){
$mech_veh_data = json_decode($mechanic_data['vehicle_data']);
$mechanic_data['engine_no'] = $mech_veh_data->attributes->Engine;
$mechanic_data['vehicle_trim'] = $mech_veh_data->attributes->Trim;
unset($mechanic_data['vehicle_data']);
$mechanic_data['services'] = json_decode($mechanic_data['issues_selected']);
if(!empty($mechanic_data['services'])){
foreach($mechanic_data['services'] as $key => $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='".$mechanic_data['mechanic_id']."' AND MI.status='1')
WHERE IC.status='1' AND IC.issue_cat_id='".$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 != ''){
$mechanic_data['services'][$key]->description = $issue_data->custom_description;
$mechanic_data['services'][$key]->service_fee = $issue_data->custom_service_fee;
}else{
$result = array('status' => 'error');
$mechanic_data['services'][$key]->description = $issue_data->default_description;
$mechanic_data['services'][$key]->service_fee = $issue_data->default_service_fee;
}
}
}
return $result;
}else{
return false;
$mechanic_data['services'] = [];
}
unset($mechanic_data['issues_selected']);
$issue_data = json_decode($mechanic_data['custom_issue_data']);
}
public function app_rating($request){
$query = $this->db->where('unique_id',$request['auth'])->get('auth_table');
if($query->num_rows()>0){
$rs = $query->row();
$cust_id = $rs->member_id;
$data = array('rate'=>$request['rating'],
'comments'=>$request['feedback'],
'users_id'=>$cust_id);
$res = $this->db->insert('app_rate',$data);
if($res){
$result = array('status' => 'success');
}else{
$result = array('status' => 'error');
$mechanic_data['optional_images'][] = (isset($issue_data->optionalImages))?$issue_data->optionalImages:'';
$mechanic_data['optional_video'][] = (isset($issue_data->optionalVideos))?$issue_data->optionalVideos:'';
$mechanic_data['booking_description'] = (isset($issue_data->optionlaDescription))?$issue_data->optionlaDescription:'';
unset($mechanic_data['custom_issue_data']);
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $mechanic_data;
}
return $respArr;
}
return $result;
public function getNearMechanics($postData = '',$start,$per_page){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
return $respArr;
}
$current_lat = $postData['location_lat'];
$current_lng = $postData['location_lng'];
$issue_cat_id = $postData['service_id'];
if($start != 0 || $per_page != 0){
$limt = "limit ".$start.",".$per_page;
}else{
return false;
$limt = "";
}
$sql = "SELECT AU.display_name,AU.profile_image,ME.*,MS.shop_name,MS.address AS shop_address,
MS.phone AS shop_phone,MS.email_id AS shop_email_id,
3956*2*ASIN(SQRT(POWER(SIN(($current_lat-ME.location_lat)*pi()/180/2),2)+
COS($current_lat*pi()/180 )*COS(ME.location_lat*pi()/180)*
POWER(SIN(($current_lng-ME.location_lng)*pi()/180/2),2) )) AS distance
FROM mechanic AS ME
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')
WHERE AU.status='1'
-- HAVING distance<30
".$limt;
$mechData = $this->db->query($sql);
if(empty($mechData) || empty($mechData = $mechData->result_array())){
return 0;
}
}
function get_last_order($user_data = array()){
$result = array('status' => 'error');
if(empty($user_data)){
return $result;
}
$query = $this->db->where('unique_id',$user_data['auth'])->get('auth_table')->row();
if(empty($query)){
return $result;
}
$user_id = $query->member_id;
$query = $this->db->query("SELECT ODR.* ,DR_RATE.id AS rateId, USR.first_name,
USR.surname,USR.profile_image
FROM orders AS ODR
LEFT JOIN driver_rate AS DR_RATE ON (DR_RATE.orders_id = ODR.id)
INNER JOIN users AS USR ON (USR.id = ODR.driver_id)
WHERE ODR.status = '3' AND ODR.users_id = '".$user_id."'
ORDER BY ODR.id DESC LIMIT 1")->row_array();
if(empty($query)){
$result['message'] = 'No Data';
}
$orderData = array();
$orderData['status'] = 'success';
$orderData['data']['is_last_order_rated'] = (!empty($query['rateId']))?true:false;
$orderData['data']['order_id'] = $query['id'];
$orderData['data']['driver_id'] = $query['driver_id'];
$orderData['data']['driver_name'] = $query['first_name'].' '.$query['surname'];
$orderData['data']['amount'] = $query['amount'];
$orderData['data']['date'] = strtotime($query['date'].' '.$query['time']);
$orderData['data']['shop_name'] = $query['shop_name'];
$orderData['data']['driver_photo'] = $query['profile_image'];
$orderData['data']['item_name'] = $query['order_desc'];
$orderData['data']['item_quantity'] = '';
return $orderData;
}
function get_last_order_driver($user_data = array()){
$result = array('status' => 'error');
if(empty($user_data)){
return $result;
}
$query = $this->db->where('unique_id',$user_data['auth'])->get('auth_table')->row();
if(empty($query)){
return $result;
}
$user_id = $query->member_id;
$query = $this->db->query("SELECT ODR.* ,DR_RATE.id AS rateId, USR.first_name,
USR.surname,USR.profile_image
FROM orders AS ODR
LEFT JOIN driver_rate AS DR_RATE ON (DR_RATE.orders_id = ODR.id)
INNER JOIN users AS USR ON (USR.id = ODR.users_id)
WHERE ODR.status = '3' AND ODR.driver_id = '".$user_id."'
ORDER BY ODR.id DESC LIMIT 1")->row_array();
if(empty($query)){
$result['message'] = 'No Data';
}
$orderData = array();
$orderData['status'] = 'success';
$orderData['data']['is_last_order_rated'] = (!empty($query['rateId']))?true:false;
$orderData['data']['order_id'] = $query['id'];
$orderData['data']['driver_id'] = $query['driver_id'];
$orderData['data']['driver_name'] = $query['first_name'].' '.$query['surname'];
$orderData['data']['amount'] = $query['amount'];
$orderData['data']['date'] = strtotime($query['date'].' '.$query['time']);
$orderData['data']['shop_name'] = $query['shop_name'];
$orderData['data']['driver_photo'] = $query['profile_image'];
$orderData['data']['item_name'] = $query['order_desc'];
$orderData['data']['item_quantity'] = '';
return $orderData;
}
public function request_cancel($request = array()){
if(empty($request) || !isset($request['id'],$request['auth']) || empty($request['id']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
$estimate = 0;
$mechDataArr = array();
foreach($mechData AS $index => $data){
if(empty($data['start_time']) || empty($data['end_time'])){
$scheduleTiming = array('09:00 AM','10:00 AM','11:00 AM','12:00 PM','01:00 PM',
'02:00 PM','03:00 PM','04:00 PM','05:00 PM','06:00 PM');
} else {
$endTime = strtotime($data['end_time']);
$schTime = strtotime($data['start_time']);
$scheduleTiming = array();
for( ; $schTime <= ($endTime-3600) ; $schTime += 3600){
$scheduleTiming[] = date('h:i A',$schTime);
}
}
$rating = $this->db->query("SELECT round(avg(rate),2) AS rating
FROM mechanic_rating
WHERE mechanic_id='".$data['mechanic_id']."'");
$rating = (!empty($rating) && !empty($rating = $rating->row_array()))?$rating['rating']:'0';
$mechanic_id = $data['mechanic_id'];
$sql = "SELECT ISS.*, IC.*, MI.mechanic_id, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
INNER JOIN issues AS ISS ON (IC.issue_id=ISS.issue_id)
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='$mechanic_id' AND MI.status='1')
WHERE ISS.status='1' AND IC.status='1' AND IC.issue_cat_id IN ($issue_cat_id)";
$subIssData = $this->db->query($sql);
$sIssueData = array();
if(!empty($subIssData) && !empty($subIssData = $subIssData->result_array())){
$sIssueData = $subIssData;
}
$estimate = 0;
foreach($sIssueData AS $sIndex => $sIssue){
if(!empty($sIssue['custom_service_fee'])){
$estimate += $sIssue['custom_service_fee'];
$sIssueData[$sIndex]['service_fee'] = $sIssue['custom_service_fee'];
} else {
$estimate += $sIssue['default_service_fee'];
$sIssueData[$sIndex]['service_fee'] = $sIssue['default_service_fee'];
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
}
$query1 = $this->db->where('id',$request['id'])->get('orders')->row();
$request_id = $query1->req_id;
$update_request_status = $this->db->update('request',array('status'=>'2'),array('id'=>$request_id));
$query = $this->db->update('orders',array('status'=>'3'), array('id'=>$request['id']));
// $query = $this->db->update('request',array('status'=>'2'), array('id'=>$request['id']));
if ($query) {
return array('status' => 'success','message' => 'Successfully Cancelled..!!');
$mechData[$index]['rating'] = $rating;
$mechData[$index]['estimate'] = $estimate;
$mechData[$index]['sub_issues'] = $sIssueData;
$mechData[$index]['scheduleTiming'] = $scheduleTiming;
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $mechData;
}
return array('status'=>'error');
}
public function request_status($request = array()){
if(empty($request) || !isset($request['id'],$request['auth']) || empty($request['id']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
}
$query = $this->db->query("SELECT ODR.delivery_fee,ODR.id,REQ.status
FROM request AS REQ
LEFT JOIN orders AS ODR ON (ODR.req_id = REQ.id)
WHERE REQ.id = '".$request['id']."'")->row_array();
if (empty($query)) {
return array('status' => 'error','message');
}
$status = $query['status'];
switch($status){
case 0:
return array("status"=>"success","data"=>array("request_status"=>"0"));
case 1:
return array("status"=>"success",
"data"=>array("request_status"=>"1",
"delivery_fee"=>$query['delivery_fee'],
"order_id"=>$query['id']));
case 2:
return array("status"=>"success","data"=>array("request_status"=>"2"));
return $respArr;
}
}
function tracking_details($request = array()){
if(empty($request) || !isset($request['order_id'],$request['auth']) || empty($request['order_id']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
public function add_service_details($postData){
$respArr = array('status'=>'error','message'=>'Something Went Wrong');
if(empty($postData['booking_id'])){
$respArr['message'] = 'Booking Id is Required';
return $respArr;
}
$custom_issue_data = array(
'optionlaDescription'=>(isset($postData['description']) && !empty($postData['description']))?$postData['description']:"",
'optionalImages'=>(isset($postData['image']) && !empty($postData['image']))?$postData['image']:[],
'optionalVideos'=>(isset($postData['video']) && !empty($postData['video']))?$postData['video']:[],
);
if($this->db->update('bookings',array('custom_issue_data'=>json_encode($custom_issue_data)),array('booking_id'=>$postData['booking_id']))){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
return $respArr;
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
}
$data = $this->db->query("SELECT ODR.*,ODR.delivery_lat AS lat,ODR.delivery_lng AS lng,
DRV.profile_pic,USR.phone,DRV.driver_lat,DRV.driver_lng
FROM orders AS ODR
INNER JOIN users AS USR ON (USR.id = ODR.driver_id)
INNER JOIN drivers AS DRV ON (DRV.users_id = ODR.driver_id)
WHERE ODR.id='".$request['order_id']."' AND USR.status = '1' AND DRV.status = '1'")->row_array();
if(!empty($data)){
return array('status'=>'success','orderData'=>$data);
}
return array('status'=>'error');
}
function getUserId($auth = ''){
if(empty($auth)){
return;
public function remove_booking($postData = array()){
$respArr = array('status'=>'error','message'=>'Something Went Wrong..!');
if(empty($postData['booking_id'])){
$respArr['message'] = 'Booking Id is Required';
return $respArr;
}else if(empty($postData['service_id'])){
$respArr['message'] = 'Service Id is Required';
return $respArr;
}
$query = $this->db->where('unique_id',$auth)->get('auth_table')->row();
if(empty($query)){
return;
$booked_data = $this->db->get_where('bookings',array('booking_id'=>$postData['booking_id']));
if(!empty($booked_data) && !empty($booked_data = $booked_data->row_array())){
$issues_selected = json_decode($booked_data['issues_selected']);
foreach($issues_selected as $key => $value){
if($value->sub_issue_id == $postData['service_id']){
unset($issues_selected[$key]);
}
return $query->member_id;
}
function geySysSettings(){
$data = $this->db->get('setting')->row();
if(!empty($data)){
return $data;
}
return 0;
}
function orders_list($request = array()){
$data = $this->geySysSettings();
$google_key = $data->google_api_key;
if(empty($request) || !isset($request['auth']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
$issues_selected = array_values($issues_selected);
if($this->db->update('bookings',array('issues_selected'=>json_encode($issues_selected)),array('booking_id'=>$postData['booking_id']))){
$respArr['status'] = 'success';
$respArr['message'] ='success';
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
return $respArr;
}
$isDriver = $this->db->select('is_driver')->where(array('users_id'=>$user_id))->get('user_profile')->row_array();
$isDriver = (!empty($isDriver) && isset($isDriver['is_driver']))?$isDriver['is_driver']:'0';
$limit_offset = '10';
$page_no = (isset($request['page_no']) && !empty($request['page_no']))?$request['page_no']:1;
if($page_no != 1){
$limit_offset = ($page_no-1).'0,10';
}
$count = '';
$query = '';
if($isDriver == '0'){
$count = $this->db->get_where('orders',array('users_id'=>$user_id));
$count = (!empty($count))?$count->num_rows():0;
$query = $this->db->query("SELECT ODR.*,USR.first_name,USR.surname,USR.profile_image
FROM orders AS ODR
INNER JOIN users AS USR ON (USR.id = ODR.users_id)
WHERE ODR.users_id='".$user_id."' AND USR.status = '1' ORDER BY ODR.id DESC
LIMIT ".$limit_offset)->result_array();
} else {
$count = $this->db->get_where('orders',array('driver_id'=>$user_id));
$count = (!empty($count))?$count->num_rows():0;
$query = $this->db->query("SELECT ODR.*,USR.first_name,USR.surname,DRV.profile_pic AS profile_image
FROM orders AS ODR
INNER JOIN users AS USR ON (USR.id = ODR.driver_id)
INNER JOIN drivers AS DRV ON (DRV.users_id = ODR.driver_id)
WHERE ODR.driver_id='".$user_id."' AND USR.status = '1' AND DRV.status = '1'
ORDER BY ODR.id DESC LIMIT ".$limit_offset)->result_array();
}
$orderData = array();
foreach($query AS $order){
$shopData = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?place_id=".$order['shop_id']."&key=".$google_key);
if(empty($shopData)){
continue;
}
switch ($order['status']) {
case '1':
$order['status'] = '2';
break;
case '2':
$order['status'] = '3';
break;
case '3':
$order['status'] = '4';
break;
}
$shopData = json_decode($shopData,true);
$details['order_id'] = $order['id'];
$details['type'] = $isDriver;
$details['name'] = $order['first_name'].' '.$order['surname'];
$details['amount'] = $order['price'];
$details['delivery_mode'] = $order['delivery_mode'];
$details['date'] = strtotime($order['date'].' '.$order['time']);
$details['shop_name'] = $order['shop_name'];
$details['address'] = $shopData['results'][0]['formatted_address'];
$details['shop_subname'] = $order['shop_name'];
$details['photo'] = $order['profile_image'];
$details['order_status'] = $order['status'];
$details['receipt_amount'] = $order['receipt_amount'];
$details['total_amount'] = $order['amount'];
$details['delivery_charge'] = $order['delivery_fee'];
$details['item_name'] = $order['order_desc'];
$orderData[] = $details;
public function get_service($postData = array()){
$respArr = array('status'=>'error','message'=>'Something went Wrong.. Try Again');
if(empty($postData['booking_id'])){
$respArr['message'] = 'Booking Id is Required';
return $respArr;
}
$tot_page = ceil($count/10);
return array('status'=>'success','data'=>array('orders_list'=>$orderData),'meta'=>array('total_pages'=>$tot_page,'total'=>$count,'current_page'=>$page_no,'per_page'=>'10'));
}
function issuing_receipt($request = array()){
if(empty($request) || !isset($request['auth']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
$booked_data = $this->db->get_where('bookings',array('booking_id'=>$postData['booking_id']));
if(!empty($booked_data) && !empty($booked_data = $booked_data->row_array())){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data']['services'] = json_decode($booked_data['issues_selected']);
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
return $respArr;
}
$status = $this->db->update('orders', array('price'=>$request['receipt_amount'],'amount'=>$request['total_amount'],'delivery_fee'=>$request['delivery_fee'],'receipt_photo'=>$request['receipt_photo'],), array('id'=>$request['order_id']));
if($status){
return array('status'=>'success');
public function rate_mechanic($auth,$postData){
$respArr = array('status'=>'error','message'=>'Something went Wrong.. Try Again');
if(empty($postData['rate'])){
$respArr['message'] = 'Rating is Required';
return $respArr;
}
return array('status'=>'error');
}
function request_order($request = array()){
if(empty($request) || !isset($request['auth']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
if(empty($postData['mechanic_id'])){
$respArr['message'] = 'Mechanic Id is Required';
return $respArr;
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
if(empty($postData['description'])){
$respArr['message'] = 'Description is Required';
return $respArr;
}
$status = $this->db->insert('request',array('users_id'=>$user_id,'delivery_location'=>$request['location_name'],'delivery_lat'=>$request['delivery_latitude'],'delivery_lng'=>$request['delivery_longitude'],'shop_id'=>$request['shop_id'],'shop_name'=>$request['shop_name'],'item_name'=>$request['item_name'],'date'=>date('Y-m-d'),'time'=>date('h:i:s'),'delivery_mode'=>$request['delivery_mode'],'status'=>'0'));
$requested_id = $this->db->insert_id();
$order = $this->db->insert('orders',array('users_id'=>$user_id,'req_id'=>$requested_id,'delivery_location'=>$request['location_name'],'delivery_lat'=>$request['delivery_latitude'],'delivery_lng'=>$request['delivery_longitude'],'shop_id'=>$request['shop_id'],'shop_name'=>$request['shop_name'],'item_name'=>$request['item_name'],'date'=>date('Y-m-d'),'time'=>date('h:i:s'),'delivery_mode'=>$request['delivery_mode'],'status'=>'0'));
if($status){
return array('status'=>'success');
$mechRate = $this->db->get_where('mechanic_rating',array('customer_id'=>$postData['customer_id'],'mechanic_id'=>$postData['mechanic_id']));
if(!empty($mechRate) && !empty($mechRate = $booked_data->row_array())){
$respArr['message'] = 'Sorry, You are already Rated for this mechanic';
return $respArr;
}
return array('status'=>'error');
}
public function chat_file_upload($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$data = array('chat_list_id' => $request['chat_list_id'],
'chat_id' => $request['chat_id'],
'type' => $request['type'],
'file' => $request['doc']);
$this->db->insert('chat_history',$data);
$result = array('status' => 'success','data'=>array('chat_list_id'=>$request['chat_list_id'],'chat_id'=>$request['chat_id'],'file'=>$request['doc']));
} else{
$result = array('status' => 'error');
$postData['status'] = '1';
if($this->db->insert('mechanic_rating',$postData)){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
}
return $respArr;
}
return $result;
}
function set_user_recent_chat($request = array()){
if(empty($request) || !isset($request['auth']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
public function acceptMechanicQuote($postData){
$respArr = array('status'=>'error','message'=>'Something went Wrong.. Try Again');
if(empty($postData['bookingId'])){
$respArr['message'] = 'Booking Id is Required';
return $respArr;
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
if(empty($postData['mechanicId'])){
$respArr['message'] = 'Mechanic Id is Required';
return $respArr;
}
$status = $this->db->insert('chat',array('chat_list_id'=>$request['chat_list_id'],'user_id'=>$request['user_id'],'driver_id'=>$request['driver_id'],'sender_id'=>$request['sender_id'],'type'=>$request['type'],'message'=>$request['message'],'photo_url'=>$request['photo_url'],'video_url'=>$request['video_url'],'order_id'=>$request['order_id'],'time'=>$request['time']));
if($status){
return array('status'=>'success');
if(empty($postData['amount'])){
$respArr['message'] = 'Amount is Required';
return $respArr;
}
return array('status'=>'error');
}
function request_trigger(){
$data = $this->geySysSettings();
$google_key = $data->google_api_key;
$newTime = date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s")." -1 minutes"));
$sql = "SELECT REQ.id FROM request AS REQ
LEFT JOIN rider_state AS RS ON (RS.req_id = REQ.id AND RS.assigned_time <= '".$newTime."')
WHERE REQ.status IN (0,2,3)";
$data = $this->db->query($sql);
if(empty($data)){
return;
if($this->db->update('mechanic_booking',array('status'=>'1'),array('booking_id'=>$postData['bookingId'],'mechanic_id'=>$postData['mechanicId']))){
$this->db->update('mechanic_booking',array('status'=>'2'),array('booking_id'=>$postData['bookingId'],'mechanic_id !='=>$postData['mechanicId']));
$this->db->update('bookings',array('status'=>'5','cost'=>$postData['amount']),array('booking_id'=>$postData['bookingId']));
}
$data = $data->result_array();
foreach($data as $id){
$reqData = $this->db->query("SELECT REQ.shop_id,GROUP_CONCAT(RS.driver_id) AS driver_id,
REQ.users_id
FROM request AS REQ
LEFT JOIN rider_state AS RS ON (RS.req_id = REQ.id)
WHERE REQ.id = '".$id['id']."'")->row_array();
if(empty($reqData) || empty($reqData['shop_id'])){
continue;
}
$shopData = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?place_id=".$reqData['shop_id']."&key=".$google_key);
if(empty($shopData)){
continue;
}
$shopData = json_decode($shopData,true);
$shopLoc = $shopData['results'][0]['geometry']['location'];
$user_id = (!empty($reqData['users_id']))?$reqData['users_id']:'';
$drvCond = (!empty($reqData['driver_id']))?' AND driver.users_id NOT IN ('.$reqData['driver_id'].','.$user_id.')':' AND driver.users_id NOT IN ('.$user_id.')';
$lat = $shopLoc['lat'];
$lng = $shopLoc['lng'];
$rideData = $this->db->query("SELECT driver.users_id, 3956 * 2 * ASIN(SQRT(POWER(SIN(($lat - driver.driver_lat) * pi()/180 / 2), 2)+ COS($lat * pi()/180 ) * COS(driver.driver_lat * pi()/180)* POWER(SIN(($lng - driver.driver_lng) * pi()/180 / 2), 2) )) as distance, UP.fcm_token AS fcm_token
FROM drivers AS driver
LEFT JOIN user_profile AS UP ON (UP.users_id = driver.users_id)
WHERE driver.status = '1' AND UP.driver_enabled = '1' AND
UP.is_driver = '1' $drvCond
GROUP BY driver.users_id HAVING distance < 25
ORDER BY distance ASC LIMIT 0,1")->row_array();
$book_data = $this->db->get_where('bookings',array('booking_id'=>$postData['bookingId']))->row();
$transaction_array = array(
'customer_id'=>$book_data->customer_id,
'booking_id'=>$postData['bookingId'],
'datetime'=>date('Y-m-d h:i:s'),
'amount'=>$postData['amount']
);
$this->db->insert('transaction',$transaction_array);
if(empty($rideData) || !isset($rideData['users_id']) || empty($rideData['users_id'])){
continue;
$respArr['data'] = $this->db->insert_id();
$respArr['status'] = 'success';
$respArr['message'] = 'Updated Successfully';
return $respArr;
}
$this->db->insert('rider_state', array('driver_id'=>$rideData['users_id'],'req_id'=>$id['id'],
'assigned_time'=>date('Y-m-d h:i:s')));
$fcm_data = array('id'=>$id['id'],'title'=>'WAAW','message'=>'Delivery Request');
$this->push_sent_cancel($rideData['fcm_token'], $fcm_data);
public function getMechAmount($transId){
$respArr = array('status'=>'error');
if(empty($transId)){
return $respArr;
}
return;
}
function get_recent_chat_list($request = array()){
if(empty($request) || !isset($request['auth']) || empty($request['auth'])){
return array('status'=>'error','message'=>'No data');
}
$user_id = $this->getUserId($request['auth']);
if(empty($user_id)){
return array('status'=>'error');
}
$limit_offset = '10';
$page_no = (isset($request['page']) && !empty($request['page']))?$request['page']:1;
if($page_no != 1){
$limit_offset = ($page_no-1).'0,10';
}
// $resultData = $this->db->query("
// SELECT CH.*, ORD.status AS order_status FROM chat AS CH
// LEFT JOIN orders AS ORD ON (ORD.id = CH.order_id)
// WHERE CH.user_id = '".$user_id."' LIMIT ".$limit_offset)->result_array();
$resultData = $this->db->query("
SELECT CH.*, ORD.status AS order_status FROM chat AS CH
INNER JOIN orders AS ORD ON (ORD.id = CH.order_id)
WHERE ORD.status IN (1)
LIMIT ".$limit_offset)->result_array();
$chatData = array();
$user_data = array();
$chkUserData = 0;
foreach($resultData AS $data){
if($chkUserData == 0){
$user = $this->db->get_where('users',array('id'=>$data['user_id']))->row_array();
if(empty($user)){
continue;
}
$user_data['user_name'] = $user['first_name'].' '.$user['surname'];
$user_data['user_photo'] = $user['profile_image'];
$user = $this->db->query("SELECT DRV.profile_pic,USR.first_name,USR.surname
FROM users AS USR
INNER JOIN drivers AS DRV ON (DRV.users_id = USR.id)
WHERE USR.id='".$data['driver_id']."'")->row_array();
if(empty($user)){
continue;
}
$user_data['driver_name'] = $user['first_name'].' '.$user['surname'];
$user_data['driver_photo'] = $user['profile_pic'];
$chkUserData = 1;
}
$chatData['type'] = $data['type'];
$chatData['time'] = $data['time'];
$chatData['chat_id'] = $data['chat_id'];
$chatData['user_id'] = $data['user_id'];
$chatData['order_id'] = $data['order_id'];
$chatData['driver_id'] = $data['driver_id'];
$chatData['message'] = $data['message'];
$chatData['photo_url'] = $data['photo_url'];
$chatData['video_url'] = $data['video_url'];
$chatData['sender_id'] = $data['sender_id'];
$chatData['order_status'] = $data['order_status'];
$chatData['user_name'] = $user_data['user_name'];
$chatData['user_photo'] = $user_data['user_photo'];
$chatData['driver_name'] = $user_data['driver_name'];
$chatData['driver_photo'] = $user_data['driver_photo'];
$result = $this->db->get_where('transaction',array('id'=>$transId));
if(!empty($result) && $result->num_rows() > 0){
$result = $result->row_array();
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
$custData = $this->db->get_where('customers',array('customer_id'=>$result['customer_id']))->row();
$respArr['emailId'] = $custData->email;
return $respArr;
}
return array("status"=>"success","data"=>array('recent_chats'=>array($chatData)));
}
public function request_details($request){
$data = $this->geySysSettings();
$google_key = $data->google_api_key;
$rs2 = $this->db->query("SELECT REQ_TB.* ,USERS_TB.id AS userid, USERS_TB.profile_image AS user_photo,USERS_TB.first_name,USERS_TB.surname, USERS_TB.phone AS user_phone_number
FROM request AS REQ_TB
JOIN users AS USERS_TB ON (USERS_TB.id = REQ_TB.users_id)
WHERE REQ_TB.id = '".$request['request_id']."'")->row();
if(!empty($rs2)){
$shopData = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?place_id=".$rs2->shop_id."&key=".$google_key);
if(empty($shopData)){
return array('status'=>'error');
}
$shopData = json_decode($shopData,true);
// print_r($shopData);
// die();
$shopLoc = $shopData['results'][0]['geometry']['location'];
$shopAddress = $shopData['results'][0]['formatted_address'];
$milliseconds = round(microtime(true) * 1000);
$data = array('request_id' => $rs2->id,
'shop_name' =>$rs2->shop_name,
'shop_address'=>$shopAddress,
'user_phone_number' =>$rs2->user_phone_number,
'user_photo' => $rs2->user_photo,
'shop_latitude' =>$shopLoc['lat'],
'shop_longitude' =>$lng = $shopLoc['lng'],
'delivery_latitude'=>$rs2->delivery_lat,
'delivery_longitude'=>$rs2->delivery_lng,
'request_time' => $milliseconds,
'user_id' => $rs2->users_id,
'user_name' => $rs2->first_name.' '.$rs2->surname);
$result = array('status' => 'success','user' => $data);
public function transactionResp($transId,$result,$payfor){
$status = 0;
if($result['data']['status'] == 'success'){
$status = 1;
}
$odr_status = 9;
if($result['data']['status'] == 'success' && $payfor == '2'){
$odr_status = 2;
}
$this->db->update('transaction',array('transaction_response'=>json_encode($result),'transaction_reference'=>$result['data']['id'],'status'=>$status),array('id'=>$transId));
$bookData = $this->db->get_where('transaction',array('id'=>$transId))->row();
$this->db->update('bookings',array('status'=>'1'),array('booking_id'=>$bookData->booking_id));
if($payfor == '2'){
$this->db->query("UPDATE orders JOIN transaction ON transaction.booking_id = orders.order_id SET orders.status = $odr_status WHERE transaction.id = $transId");
}
else{
$result = array('status' => 'error');
return 1;
}
return $result;
public function productSearch($postData){
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
public function order_status($request){
$data = $this->geySysSettings();
$google_key = $data->google_api_key;
$rs = $this->db->query("SELECT * FROM orders
WHERE id = '".$request['order_id']."'")->row();
$per_page = 10;
$page = (isset($data['page']))?$data['page']:'0';
if(!empty($rs)){
$shopData = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?place_id=".$rs->shop_id."&key=".$google_key);
if(empty($shopData)){
return array('status'=>'error');
$where = '';
if(isset($postData['key']) && !empty($postData['key'])){
$where .= " (PRD.product_name LIKE '%".$postData['key']."%' OR
PRD.short_description LIKE '%".$postData['key']."%' OR
PRD.description LIKE '%".$postData['key']."%') AND ";
}
$shopData = json_decode($shopData,true);
$shopAddress = $shopData['results'][0]['formatted_address'];
$data = array('order_status' => $rs->status,
'item_name' => $rs->item_name,
'amount' => $rs->amount,
'address'=>$shopAddress,
);
if(isset($postData['brand_id']) && !empty($postData['brand_id'])){
$where .= " PRD.brand_id IN (".implode(',',$postData['brand_id']).") AND ";
}
$result = array('status' => 'success','user' => $data);
if(isset($postData['minPrice']) && $postData['minPrice'] != ''){
$where .= " PRD.amount > ".$postData['minPrice']." AND ";
}
if(isset($postData['maxPrice']) && $postData['maxPrice'] != ''){
$where .= " PRD.amount < ".$postData['maxPrice']." AND ";
}
$result = $this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS count,PRD.*,PI.image
FROM products AS PRD
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'))
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
WHERE $where PRD.status='1'
GROUP BY PRD.product_id,PI.product_id
LIMIT $page,$per_page");
//pr($this->db->last_query());
if(!empty($result) && $result->num_rows() > 0){
$respArr['status'] = 'success';
$respArr['data'] = $result->result_array();
}
else{
$result = array('status' => 'error');
return $respArr;
}
return $result;
public function getBrands(){
$respArr = array('status'=>'error');
$prdt_brand = $this->db->get_where('product_brand',array('status'=>'1'))->result();
if(count($prdt_brand) > 0){
$query = $this->db->query("SELECT MIN(amount) AS minamount, MAX(amount) AS maxamount
FROM products WHERE status='1'")->row();
$respArr['status'] = 'success';
$respArr['brands'] = $prdt_brand;
$respArr['minamount'] = $query->minamount;
$respArr['maxamount'] = $query->maxamount;
}
public function confirm_delivery($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$rs = $this->db->query("SELECT receipt_photo FROM orders
WHERE id = '".$request['order_id']."'")->row();
if($rs->receipt_photo != ''){
$data = array('status' => '2');
$this->db->where('users_id', $id);
$this->db->where('id', $request['order_id']);
$query = $this->db->update('orders', $data);
$result = array('status' => 'success');
return $result;
return $respArr;
}
else{
$result = array('status' => 'error','message' => 'Please upload the receipt_photo');
return $result;
public function SingleProductSearch($postData){
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
} else {
$result = array('status' => 'error','message' => 'Insufficient data');
return $result;
$sql = "SELECT ROUND(AVG(REV.rating),2) AS rating, COUNT(REV.id) AS count,PRD.*
FROM products AS PRD
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
WHERE PRD.product_id =".$postData['product_id'];
$this->db->query($sql);
$result = $this->db->query($sql);
if(!empty($result) && $result->num_rows() > 0){
$respArr['status'] = 'success';
$respArr['data'] = $result->row();
$prdt_img = $this->db->get_where('product_images',array('product_id'=>$postData['product_id'],'status'=>'1'))->result();
$reviews = $this->db->get_where('product_rating',array('product_id'=>$postData['product_id'],'status'=>'1'))->result();
$respArr['data']->images = '';
$respArr['data']->reviews = '';
if(count($prdt_img) > 0){
$respArr['data']->images = $prdt_img;
}
if(count($reviews) > 0){
$respArr['data']->reviews = $reviews ;
}
public function order_accept_reject($request){
$order_status = $request['type'];
$order_id = $request['request_id'];
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$data1 = "SELECT id FROM orders WHERE req_id = $order_id";
$query1 = $this->db->query($data1);
$rs = $query1->row();
$ord_id = $rs->id;
if($order_status==0)
{
$data = array('status' => '1');
$data1 = array('driver_id' => $id,
'status' => '1'
);
$this->db->where('id', $request['request_id']);
$query = $this->db->update('request', $data);
// echo $this->db->last_query();
// die();
$this->db->where('req_id', $request['request_id']);
$query = $this->db->update('orders', $data1);
$result = array('status' => 'success','data'=> $ord_id);
$fcm_data = array('id'=>$order_id,'title'=>'WAAW','message'=>'Request Accepted');
$this->push_sent_cancel($rideData['fcm_token'], $fcm_data);
return $result;
}
if($order_status==1)
{
$data = array('status' => '2');
$this->db->where('id', $request['request_id']);
$query = $this->db->update('request', $data);
$result = array('status' => 'success','data'=> $ord_id);
$fcm_data = array('id'=>$order_id,'title'=>'WAAW','message'=>'Request Rejected');
$this->push_sent_cancel($rideData['fcm_token'], $fcm_data);
return $result;
return $respArr;
}
} else {
$result = array('status' => 'error');
return $result;
public function saveUserAddress($postData = array()){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.. Try Again Later');
if(empty($postData)){
$respArr['message'] = 'All Field is required';
return $respArr;
}
if($this->db->insert('customer_address',$postData)){
$respArr['status'] = "success";
$respArr['message'] = "Address Added Successfully";
}
function push_sent_cancel($fcm_token, $fcm_data) {
$data1 = "SELECT * FROM setting WHERE id = '1' ";
$query1 = $this->db->query($data1);
$rs = $query1->row();
$key = $rs->api_key;
$data = "{ \"notification\": { \"title\": \"".$fcm_data['title']."\", \"text\": \"".$fcm_data['message']."\", \"sound\": \"default\" }, \"time_to_live\": 60, \"data\" : {\"response\" : {\"status\" : \"success\", \"data\" : {\"request_id\" : \"".$fcm_data['id']."\", \"trip_status\" : 0}}}, \"collapse_key\" : \"trip\", \"priority\":\"high\", \"to\" : \"".$fcm_token."\"}";
$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);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_close($ch);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
return $respArr;
}
public function search($request){
$data = $this->geySysSettings();
$google_key = $data->google_api_key;
if(!isset($request['type']) || empty($request['type']) || !isset($request['latitude']) || empty($request['latitude']) || !isset($request['longitude']) || empty($request['longitude'])){
return array('status'=>'error');
public function getUserAddress($postData){
$respArr = array('status'=>'error');
if(empty($postData['user_id'])){
$respArr['message'] = 'User Id is required';
return $respArr;
}
if(isset($request['page_token']) && !empty($request['page_token'])){
$urlParams = '&pagetoken='.$request['page_token'];
} else {
$urlParams = "&location=".$request['latitude'].",".$request['longitude'];
$urlParams.= "&rankby=distance";
$urlParams.= "&type=".str_replace(',','|',trim($request['type']));
if(isset($request['query']) && !empty($request['query'])){
$urlParams.= "&keyword=".str_replace(',','|',trim($request['query']));
$result = $this->db->get_where('customer_address',array('customer_id'=>$postData['user_id'],'status'=>'1'));
if(!empty($result) && !empty($result = $result->result())){
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
return $respArr;
}
$searchData = file_get_contents("https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=".$google_key.$urlParams);
if(empty($searchData)){
return array('status'=>'error');
public function getUserAddressById($postData){
$respArr = array('status'=>'error');
if(empty($postData['address_id'])){
$respArr['message'] = 'Address Id is required';
return $respArr;
}
$searchData = json_decode($searchData,true);
if(empty($searchData) || $searchData['status']!='OK'){
return array('status'=>'error');
if(empty($postData['customer_id'])){
$respArr['message'] = 'Customer Id is required';
return $respArr;
}
$deStores = array();
$resultData = $this->db->query("SELECT place_id FROM delisted_stores WHERE status = '1'");
if(!empty($resultData)){
$resultData = $resultData->result_array();
foreach ($resultData AS $place_id) {
$deStores[] = $place_id['place_id'];
$result = $this->db->get_where('customer_address',array('id'=>$postData['address_id'],'customer_id'=>$postData['customer_id']));
if(!empty($result) && !empty($result = $result->row())){
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
return $respArr;
}
$i = 0;
$placelist = array();
$page_token = $searchData['next_page_token'];
$searchData = $searchData['results'];
foreach ($searchData AS $shopinfo) {
if(!isset($shopinfo['place_id']) || empty($shopinfo['place_id']) || (!empty($deStores) && in_array($shopinfo['place_id'],$deStores))){
continue;
public function updateUserAddress($postData){
$respArr = array('status'=>'error');
if(empty($postData['data'])){
$respArr['message'] = 'All Field is required';
return $respArr;
}
$shopLoc = $shopinfo['geometry']['location'];
$lat = $shopLoc['lat'];
$lng = $shopLoc['lng'];
$shopLoc = $shopinfo['geometry']['location'];
if( isset($shopinfo['opening_hour']) || isset($shopinfo['opening_hour']['open_now'])||($shopinfo['opening_hours']['open_now'] == 1) && isset($shopinfo['opening_hours']['open_now']))
$open_hotel = "true";
else
$open_hotel = "false";
$placelist[$i]['place_id'] = (isset($shopinfo['place_id']))?$shopinfo['place_id']:"null";
$placelist[$i]['name'] = (isset($shopinfo['name']))?$shopinfo['name']:"null";
$placelist[$i]['image'] = (isset($shopinfo['icon']))?$shopinfo['icon']:"null";
$placelist[$i]['rating'] = (isset($shopinfo['rating']))?$shopinfo['rating']:"null";
$placelist[$i]['latitude'] = (isset($lat))?$lat:"null";
$placelist[$i]['longitude'] = (isset($lng))?$lng:"null";
$placelist[$i]['is_opened'] = (isset($open_hotel))?$open_hotel:"null";
$placelist[$i]['address'] = (isset($shopinfo['vicinity']))?$shopinfo['vicinity']:"null";
$i++;
if(empty($postData['address_id'])){
$respArr['message'] = 'Address Id is required';
return $respArr;
}
$result = array('status' => 'success','data' =>array('places_list' => $placelist),'meta'=>array('page_token'=>$page_token));
return $result;
}
public function order_picked_up($request){
$query = $this->db->where('unique_id', $request['auth'])->get('auth_table');
if ($query->num_rows() > 0) {
$rs = $query->row();
$id = $rs->member_id;
$data = array('status' => '1');
if($this->db->update('customer_address',$postData['data'],array('id'=>$postData['address_id']))){
$respArr['status'] = 'success';
$respArr['message'] = 'Address Updated Successfully';
}
return $respArr;
}
$this->db->where('users_id', $id);
public function initOrderBooking($postData=array()){
$respArr = array('status'=>'error');
if(empty($postData['data'])){
$respArr['message'] = 'All Field is required';
return $respArr;
}
$this->db->where('id', $request['order_id']);
$squence = str_pad(rand(1111,9999),4,0,STR_PAD_LEFT);
$query = $this->db->update('orders', $data);
$insert_array = array(
'format_order_id'=>'ORD'.date('ymd').$squence,
'product_id'=>$postData['data']['product_id'],
'customer_id'=>$postData['data']['customer_id'],
'address_id'=>$postData['data']['address_id'],
'quantity'=>$postData['data']['quantity'],
'amount'=>$postData['data']['total_amount']
);
$this->db->insert('orders',$insert_array);
$insert_id = $this->db->insert_id();
$this->db->insert('transaction',array(
'customer_id'=>$postData['data']['customer_id'],
'booking_id'=>$insert_id,
'payment_for'=>'2',
'datetime'=>date('Y-m-d h:i:s'),
'amount'=>$postData['data']['total_amount']
));
$last_id = $this->db->insert_id();
$respArr['status'] = 'success';
$respArr['data'] = $last_id;
return $respArr;
}
$result = array('status' => 'success');
return $result;
public function getOrderPayDetails($orderId){
$respArr = array('status'=>'error');
if(empty($orderId)){
$respArr['message'] = 'Order Id is required';
return $respArr;
}
$result = $this->db->query("SELECT TRANS.amount,CUST.email
FROM transaction TRANS
LEFT JOIN customers CUST
ON CUST.customer_id = TRANS.customer_id
WHERE TRANS.id = $orderId"
);
if(!empty($result) && !empty($result = $result->row())){
$this->db->query("UPDATE orders JOIN transaction ON transaction.booking_id = orders.order_id SET orders.status = '1' WHERE transaction.id = $orderId");
} else {
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
return $respArr;
}
$result = array('status' => 'error');
return $result;
public function getOrderDetail($postData){
$respArr = array('status'=>'error');
if(empty($postData['ref_id'])){
$respArr['message'] = 'Transaction Id is required';
return $respArr;
}
$result = $this->db->query("SELECT TRANS.datetime,TRANS.amount,TRANS.status,PRD.product_id,
PRD.product_name,PRD.short_description,ORDS.format_order_id,ORDS.quantity,ORDS.expected_delivery,ORDS.delivered,ORDS.status AS odr_status
FROM transaction TRANS
JOIN orders ORDS ON ORDS.order_id = TRANS.booking_id
JOIN products PRD ON PRD.product_id = ORDS.product_id
WHERE TRANS.id =".$postData['ref_id']);
if(!empty($result) && !empty($result = $result->row())){
$prdt_img = $this->db->get_where('product_images',array('product_id'=>$result->product_id))->result();
$result->images = '';
if(count($prdt_img) > 0){
$result->images = $prdt_img;
}
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
return $respArr;
}
public function rateProduct($postData=array()){
$respArr = array('status'=>'error');
if(empty($postData)){
$respArr['message'] = 'All Field is required';
return $respArr;
}
$postData['datetime'] = date('Y-m-d h:i:s');
if($this->db->insert('product_rating',$postData)){
$respArr['status'] = 'success';
$respArr['message'] = 'Rated Successfully';
}
return $respArr;
}
}
?>
......@@ -38,8 +38,11 @@
<label>Choose a Mechanic</label>
<select name="mechanic_id" class="form-control required" data-parsley-trigger="change"
onchange="changeMechanic()" dmClick="0" required>
<?php if($this->session->userdata['user_type'] == 1){?>
<option>View All</option>
<?php }else{ ?>
<option selected disabled>Select Mechanic</option>
<?php
<?php }
if(!empty($mechanic_data)){
foreach ($mechanic_data as $mechanic) {
$chkFlg = ($mechanic_id == $mechanic->mechanic_id)?'selected':'';
......@@ -57,7 +60,7 @@
</div>
</div>
<?php }
if($this->session->userdata['user_type'] != 1 || ($this->session->userdata['user_type'] == 1 && !empty($mechanic_id))){ ?>
if($this->session->userdata['user_type'] != 1 || ($this->session->userdata['user_type'] == 1)){ ?>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-body">
......@@ -66,7 +69,7 @@
<tr>
<th class="hidden">ID</th>
<th width="18%;">Car Name</th>
<th width="12%;">Mechanic</th>
<!-- <th width="12%;">Mechanic</th> -->
<th width="12%;">Customer</th>
<th width="15%;">Scheduled Date</th>
<th width="11%;">Service Fee</th>
......@@ -81,7 +84,6 @@
<tr>
<th class="hidden"><?= $bookData->booking_id ?></th>
<th class="center"><?= $bookData->car_name ?></th>
<th class="center"><?= $bookData->mechFirstName.' '.$bookData->mechLastName ?></th>
<th class="center"><?= $bookData->custFirstName.' '.$bookData->custLastName ?></th>
<th class="center">
<?= $bookData->scheduled_date.' '.$bookData->scheduled_time ?>
......@@ -89,33 +91,65 @@
<th class="center"><?= $bookData->cost ?></th>
<th class="center">
<?php
if($this->session->userdata['user_type'] == 1 ){
switch($bookData->status){
case 0: echo 'Pending'; break;
case 1: echo 'Accepted'; break;
case 3: echo 'Completed'; break;
case 4: echo 'Cancelled'; break;
}
} else {
switch($bookData->mech_status){
case 0: echo 'Pending'; break;
case 1: echo 'Accepted'; break;
case 2: echo 'Rejected'; break;
}
}
?>
</th>
<td class="center float-right">
<td class="center">
<button class="btn btn-sm btn-primary" booking_id="<?= encode_param($bookData->booking_id) ?>" id="showBookinDetails">
<i class="fa fa-fw fa-edit"></i>View Quote
</button>
<?php if($bookData->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/3/".encode_param($mechanic_id)) ?>">
<?php if($this->session->userdata['user_type'] == 1){
if($bookData->status == 0 || $bookData->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/4/".encode_param($mechanic_id)) ?>">
<i class="fa fa-cog"></i> Cancel
</a>
<?php } ?>
<?php if($bookData->status == 0 || $bookData->status == 3){ ?>
<?php } if($bookData->status == 4 ){ ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/1/".encode_param($mechanic_id)) ?>">
<i class="fa fa-cog"></i> Accept
</a>
<?php } ?>
<?php }
} else {
if($bookData->mech_status == 0 || $bookData->mech_status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/4/".encode_param($mechanic_id)) ?>">
<i class="fa fa-cog"></i> Cancel
</a>
<?php } if($bookData->mech_status == 2 || $bookData->mech_status == 0){ ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/1/".encode_param($mechanic_id)) ?>">
<i class="fa fa-cog"></i> Accept
</a>
<?php }
} ?>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Bookings/changeBookingStatus/".encode_param($bookData->booking_id)."/2/".encode_param($mechanic_id))?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php if($bookData->custom_id == ''){
if($this->session->userdata['user_type'] != 1 ){ ?>
<button class="btn btn-sm btn-primary" style="margin-top:3px;" booking_id="<?= encode_param($bookData->booking_id) ?>" id="customQuote" view="0">
<i class="fa fa-fw fa-edit"></i><span>Generate Custom Quote</span>
</button>
<?php } ?>
<?php } else { ?>
<button class="btn btn-sm btn-primary" style="margin-top:3px;" booking_id="<?= encode_param($bookData->custom_id) ?>" id="customQuote" view="1">
<i class="fa fa-fw fa-edit"></i><span>View Custom Quote</span>
</button>
<?php } ?>
</td>
</tr>
<?php } } ?>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
$url = (!isset($brand_id) || empty($brand_id))?'Brand/createBrand':'Brand/updateBrand/'.$brand_id;
if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?= base_url($url) ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label>Brand Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$"
name="brand_name" required="" value="<?= (isset($brand_data->brand_name))?$brand_data->brand_name:'' ?>"placeholder="Enter Brand Name">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Brand Logo</label>
<div class="col-md-12" style="padding-bottom:10px;">
<div class="col-md-3">
<img id="brand_image" src="<?= (isset($brand_data->brand_logo))?base_url($brand_data->brand_logo):'' ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="brand_logo" type="file" accept="image/*"
onchange="setImg(this,'brand_image');" />
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url('Brand/viewbrands') ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Brand List</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Brand/addBrand') ?>">Add New Brand</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="150px;">Brand Name</th>
<th width="150px;">Brand Image</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($brand_data)){
foreach($brand_data as $brand) { ?>
<tr>
<th class="hidden"><?= $brand->brand_id ?></th>
<th class="center"><?= $brand->brand_name ?></th>
<th class="center">
<img class="small-icon" src="<?=base_url($brand->brand_logo)?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" />
</th>
<th class="center"><?= ($brand->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Brand/editBrand/'.encode_param($brand->brand_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<!-- <?php if($brand->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
</a>
<?php } ?> -->
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
......@@ -37,8 +37,7 @@
<div class="col-md-6">
<div class="form-group">
<label>Display Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" name="display_name" required=""
<input type="text" class="form-control required" data-parsley-trigger="change" data-parsley-minlength="2" name="display_name" required=""
placeholder="Enter Display Name" value="<?= (isset($user_data->display_name))?$user_data->display_name:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
......@@ -181,7 +180,7 @@
<div class="form-group">
<label>Licence Exp Date</label>
<div class="input-group date" data-provide="datepicker">
<input id="date" type="text" class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" name="licence_exp_date" placeholder="Pick Licence Expiry Date" autocomplete="off" value="<?= (isset($user_data->licence_exp_date))?$user_data->licence_exp_date:'' ?>">
<input id="date" type="text" class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" name="licence_exp_date" placeholder="Pick Licence Expiry Date" autocomplete="off">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?= base_url('Mailtemplate/changeNotifData') ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="box-header with-border">
<h3 class="box-title padLeft10 padTop5">Email Template</h3>
</div>
<div class="box-body">
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Customer Registration Mail</label>
<p>Email => {:email}</p>
<textarea id="rich_editor_2" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Registration Mail" name="customer_registration_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->customer_registration_mail ?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Cancel Booking</label>
<p>Car Name => {:car_name} , Booking Date => {:book_date}</p>
<textarea id="rich_editor_3" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Forgot Mail" name="cancel_booking" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->cancel_booking ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Mechanic Activation Mail</label>
<p>Username => {:user_name}</p>
<textarea id="rich_editor_4" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Checker Activation Mail" name="mechanic_activation_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->mechanic_activation_mail ?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Success Booking</label>
<p>Car Name => {:car_name} , Amount => {:amount} , Booking Date => {:book_date}</p>
<textarea id="rich_editor_5" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Provider Activation Mail" style="height:108px;"
name="success_booking" data-parsley-trigger="change"><?= $notificationData->success_booking ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-md-6">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url() ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-sm-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="12%;">Order ID</th>
<th width="18%;">Product</th>
<th width="14%;">Customer</th>
<th width="9%;">Quantity</th>
<th width="9%;">Amount</th>
<th width="18%;">Status</th>
<th width="20%;">Action</th>
</tr>
</thead>
<tbody>
<?php if(!empty($orderData)){
foreach($orderData as $odrData) { ?>
<tr>
<th class="hidden"><?= $odrData->order_id ?></th>
<th class="center"><?= $odrData->format_order_id ?></th>
<th class="center"><?= $odrData->product_name ?></th>
<th class="center"><?= $odrData->customer_name ?></th>
<th class="center"><?= $odrData->quantity ?></th>
<th class="center"><?= $odrData->amount ?></th>
<th class="center">
<?php
switch($odrData->status){
case 0: echo 'Inactive'; break;
case 1: echo 'Payment Processing'; break;
case 2: echo 'Order Places'; break;
case 3: echo 'Order Packed'; break;
case 4: echo 'Order Shipped'; break;
case 5: echo 'Ordered Delivered'; break;
case 6: echo 'Returned'; break;
case 7: echo 'Cancelled'; break;
case 8: echo 'Deleted'; break;
case 9: echo 'Payment Failed'; break;
}
?>
</th>
<td class="center">
<a class="btn btn-sm btn-info" id="viewOrderDetails"
order_id="<?= encode_param($odrData->order_id) ?>">
<i class="fa fa-fw fa-eye"></i>View
</a>
<a class="btn btn-sm btn-success" id="changeOrderStatus" style="background-color:#ac2925" order_id="<?= encode_param($odrData->order_id) ?>"><i class="fa fa-cog"></i>Change Status</a>
</td>
</tr>
<?php } }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
$url = (!isset($product_id) || empty($product_id))?'Product/createproduct':'Product/updateproduct/'.$product_id;
if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form name="productAddForm" role="form" action="<?= base_url($url) ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<!-- Basic Details -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Basic Details</h3>
</div><br>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Choose Brand</label>
<select name="brand_id" class="form-control required" placeholder="Select Brand" required="">
<option selected disabled>Choose a Brand</option>
<?php
foreach ($brand_data as $brand) {
$select = (isset($brand->brand_id) && $brand->brand_id==$brand_id)?'selected':'';
echo '<option '.$select.' value="'.$brand->brand_id.'">'.
$brand->brand_name.
'</option>';
}
?>
</select>
</div>
<div class="form-group">
<label>Short Description</label>
<textarea type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" name="short_description" required="" value="<?= (isset($product_data->short_description))?$product_data->short_description:'' ?>"
data-parsley-pattern="^[a-zA-Z0-9\ . _ @ \/]+$" placeholder="Enter Short Description"><?= (isset($product_data->short_description))?$product_data->short_description:'' ?></textarea>
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Product Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change" data-parsley-minlength="2" name="product_name" required=""
placeholder="Enter Product Name" value="<?= (isset($product_data->product_name))?$product_data->product_name:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group">
<label>Amount</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" name="amount" required="" value="<?= (isset($product_data->amount))?$product_data->amount:'' ?>"
data-parsley-pattern="^[0-9\ . \/]+$" placeholder="Enter Amount">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<!-- Mechanic Data -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Product Details</h3>
</div><br>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Product Images</label>
<div id="multipleImageInputCntr">
<?php
$count = 1;
if(isset($product_image) && !empty($product_image)){
foreach($product_image AS $photos){ ?>
<div class="dropZoneContainer" id="multiImageCntr_<?= $count ?>">
<input type="hidden" name="existingImages[]" value="<?= $photos['id'] ?>">
<div id="multiImageClose_<?= $count ?>" class="close_custom cpoint"
onclick="removeImage('<?= $count ?>');">&times;</div>
<input disabled type="file" name="product_image[]" class="multiFileUpload"
accept="image/*" onchange="setMultiImg(this,jQuery(this));"
count="<?= $count ?>" />
<img class="multiDropZoneOverlay" id="multiImageImg_<?= $count ?>"
src="<?= base_url($photos['image']) ?>" onerror="this.src='<?=base_url("assets/images/add-image.png")?>';" />
</div>
<?php
$count += 1;
}
}
?>
<div class="dropZoneContainer" id="multiImageCntr_<?= $count ?>">
<div id="multiImageClose_<?= $count ?>" class="close_custom cpoint hide"
onclick="removeImage('<?= $count ?>');">&times;</div>
<input type="file" name="product_image[]" class="multiFileUpload" accept="image/*"
onchange="setMultiImg(this,jQuery(this));" count="<?= $count ?>" />
<img class="multiDropZoneOverlay" id="multiImageImg_<?= $count ?>"
src="<?=base_url("assets/images/add-image.png")?>" />
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Product Details</h3>
</div><br>
</div>
<div class="form-group">
<div class="col-md-4">
<label>Vehicle Model Year</label>
<select name="vehYear" class="form-control required" input="search_params"
data-parsley-trigger="change" required="">
<option selected disabled value="">Choose Vehicle Model Year</option>
<?php
for($year=date('Y'); $year>=1950; $year--){
$cond = (isset($product_data) && isset($product_data->year) &&
!empty($product_data->year) &&
$product_data->year == $year)?'selected':'';
echo '<option '.$cond.' value="'.$year.'">'.$year.'</option>';
}
?>
</select>
</div>
<div class="col-md-4">
<label>Vehicle Make</label>
<select name="vehMake" class="form-control required" input="search_params"
data-parsley-trigger="change" required="">
<option selected disabled value="">Choose Vehicle Make</option>
<option <?= ($product_data->make == 'Toyota') ? 'selected' : ''?> value="Toyota">Toyota</option>
<option <?= ($product_data->make == 'Alto') ? 'selected' : ''?> value="Alto">Alto</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Hyundai') ? 'selected' : ''?> value="Hyundai">Hyundai</option>
<option <?= ($product_data->make == 'Ford') ? 'selected' : ''?> value="Ford">Ford</option>
<option <?= ($product_data->make == 'Ford') ? 'selected' : ''?> value="Ford">Ford</option>
<option <?= ($product_data->make == 'Honda') ? 'selected' : ''?> value="Honda">Honda</option>
<option <?= ($product_data->make == 'Honda') ? 'selected' : ''?> value="Honda">Honda</option>
<option <?= ($product_data->make == 'Honda') ? 'selected' : ''?> value="Honda">Honda</option>
</select>
</div>
<div class="col-md-4">
<label>Vehicle Model</label>
<select name="vehModel" class="form-control required" input="search_params"
data-parsley-trigger="change" required="">
<option selected="" disabled="" value="">Choose Vehicle Model</option>
<option <?= ($product_data->model == 'Corolla') ? 'selected' : ''?> value="Corolla">Corolla</option>
<option <?= ($product_data->model == '800') ? 'selected' : ''?> value="800">800</option>
<option <?= ($product_data->model == 'Eon') ? 'selected' : ''?>value="Eon">Eon</option>
<option <?= ($product_data->model == 'Eon') ? 'selected' : ''?> value="Eon">Eon</option>
<option <?= ($product_data->model == 'i10') ? 'selected' : ''?> value="i10">i10</option>
<option <?= ($product_data->model == 'i20') ? 'selected' : ''?> value="i20">i20</option>
<option <?= ($product_data->model == 'i10 Grand') ? 'selected' : ''?>value="i10 Grand">i10 Grand</option>
<option <?= ($product_data->model == 'i20 Grand') ? 'selected' : ''?> value="i20 Grand">i20 Grand</option>
<option <?= ($product_data->model == 'i10 Magna') ? 'selected' : ''?> value="i10 Magna">i10 Magna</option>
<option <?= ($product_data->model == 'i20 Magna') ? 'selected' : ''?> value="i20 Magna">i20 Magna</option>
<option <?= ($product_data->model == 'Sonata') ? 'selected' : ''?> value="Sonata">Sonata</option>
<option <?= ($product_data->model == 'Creta') ? 'selected' : ''?> value="Creta">Creta</option>
<option <?= ($product_data->model == 'Aspair') ? 'selected' : ''?> value="Aspair">Aspair</option>
<option <?= ($product_data->model == 'Eco-sport') ? 'selected' : ''?> value="Eco-sport">Eco-sport</option>
<option <?= ($product_data->model == 'City') ? 'selected' : ''?> value="City">City</option>
<option <?= ($product_data->model == 'Amaze') ? 'selected' : ''?> value="Amaze">Amaze</option>
<option <?= ($product_data->model == 'Sonata') ? 'selected' : ''?> value="Sonata">Sonata</option>
</select>
</div>
</div>
<div class="col-md-6 padTop20">
<div class="form-group">
<label>Product Description</label>
<textarea id="rich_editor" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Product Description" name="description"
style="height:108px;" data-parsley-trigger="change" data-parsley-minlength="2"><?= (isset($product_data->description))?$product_data->description:'' ?></textarea>
</div>
</div>
<div class="col-md-6 padTop20">
<div class="form-group">
<label>About</label>
<textarea id="rich_editor1" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="About" name="about"
style="height:108px;" data-parsley-trigger="change" data-parsley-minlength="2"><?= (isset($product_data->about))?$product_data->about:'' ?></textarea>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button id="addProductButton" type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url('Product/viewProducts') ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
<div id="multipleImageInput" class="hide">
<div class="dropZoneContainer" id="multiImageCntr_{:count}" count="{:count}">
<div id="multiImageClose_{:count}" class="close_custom hide" onclick="removeImage('{:count}');">&times;</div>
<input id="event_image_{:count}" type="file" name="product_image[]" class="multiFileUpload" accept="image/*"
onchange="setMultiImg(this,jQuery(this));" count="{:count}" />
<img class="multiDropZoneOverlay" id="multiImageImg_{:count}" src=""
onerror="this.src='<?=base_url("assets/images/add-image.png")?>';" />
</div>
</div>
\ No newline at end of file
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Brand List</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Brand/addBrand') ?>">Add New Products</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="150px;">Brand Name</th>
<th width="150px;">Product Name</th>
<th width="150px;">Short Description</th>
<th width="150px;">Amount</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($product_data)){
foreach($product_data as $product) { ?>
<tr>
<th class="hidden"><?= $product->product_id ?></th>
<th class="center"><?= $product->brand_name ?></th>
<th class="center"><?= $product->product_name ?></th>
<th class="center"><?= $product->short_description ?></th>
<th class="center"><?= $product->amount ?></th>
<th class="center"><?= ($product->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-info" id="viewProductDetails"
product_id="<?= encode_param($product->product_id) ?>">
<i class="fa fa-fw fa-eye"></i>View
</a>
<a class="btn btn-sm btn-primary"
href="<?= base_url('Product/editproduct/'.encode_param($product->product_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Product/changeStatus/".encode_param($product->product_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
......@@ -92,10 +92,14 @@
</div>
</div>
<div class="row">
<div class="form-group col-xs-3">
<div class="form-group col-xs-4">
<label>Vin Audit API</label>
<input type="text" name="vin_audit_api" class="form-control required" placeholder="Enter Vin Audit API" value="<?= $data['vin_audit_api'] ?>">
</div>
<div class="form-group col-xs-3">
<label>Web Url</label>
<input type="text" name="web_url" class="form-control required" placeholder="Enter Web Url" value="<?= $data['web_url'] ?>">
</div>
</div>
</div>
<div class="box-footer" style="padding-left:46%">
......
......@@ -16,13 +16,22 @@
<script src="<?= base_url('assets/js/app.min.js') ?>"></script>
<script src="<?= base_url('assets/js/custom-script.js') ?>"></script>
<script src="<?= base_url('assets/js/parsley.min.js') ?>"></script>
<script src="<?= base_url('assets/js/ckeditor.js') ?>"></script>
<script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script>
<script src="<?= base_url('assets/js/bootstrap-datepicker.js') ?>"></script>
<script src="<?= base_url('assets/js/clockpicker.js') ?>" type="text/javascript"></script>
<script>
jQuery('.clockpicker').clockpicker();
jQuery( document ).ready(function() {
if(jQuery('#rich_editor').length==1){ CKEDITOR.replace('rich_editor'); }
if(jQuery('#rich_editor1').length==1){CKEDITOR.replace('rich_editor1'); }
if(jQuery('#rich_editor_2').length==1){CKEDITOR.replace('rich_editor_2');}
if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3');}
if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4');}
if(jQuery('#rich_editor_5').length==1){CKEDITOR.replace('rich_editor_5');}
});
function doconfirm(){
action = confirm("Are you sure to delete permanently?");
if(action != true) return false;
......@@ -52,7 +61,7 @@
jQuery(function () {
jQuery('.datatable').DataTable({
"ordering" : jQuery(this).data("ordering"),
"order": [[ 0, "asc" ]]
"order": [[ 0, "desc" ]]
});
});
<?php //} ?>
......
......@@ -23,5 +23,5 @@
<div class="pull-right hidden-xs">
<b>Version</b> 1.0
</div>
<strong>Copyright &copy; 2015-2016 <a href="#">Techware Solution</a>.</strong> All rights reserved.
<strong>Copyright &copy; <?= date('Y')?> - <?= date('Y')+1?> <a href="#">CarFixxers</a>.</strong> All rights reserved.
</footer>
\ No newline at end of file
......@@ -43,7 +43,7 @@
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Issue Management</span>
<span>Service Orders</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
......@@ -118,11 +118,62 @@
</li>
</ul>
</li>
<li>
<a href="<?= base_url('Mailtemplate') ?>"><i class="fa fa-book" aria-hidden="true">
</i><span>Mail Template</span></a>
</li>
<?php } ?>
<li>
<a href="<?= base_url('Bookings/listBookings') ?>"><i class="fa fa-book" aria-hidden="true">
</i><span>Request Management</span></a>
</li>
<li>
<a href="<?= base_url('Orders/listOrders') ?>"><i class="fa fa-book" aria-hidden="true">
</i><span>Order Management</span></a>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Product Management</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li>
<a href="<?= base_url('Product/addProduct') ?>">
<i class="fa fa-circle-o text-aqua"></i>
Add New Product
</a>
</li>
<li>
<a href="<?= base_url('Product/viewProducts') ?>">
<i class="fa fa-circle-o text-aqua"></i>
View All Product
</a>
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Brand Management</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li>
<a href="<?= base_url('Brand/addBrand') ?>">
<i class="fa fa-circle-o text-aqua"></i>
Add New Brand
</a>
</li>
<li>
<a href="<?= base_url('Brand/viewBrand') ?>">
<i class="fa fa-circle-o text-aqua"></i>
View All Brand
</a>
</li>
</ul>
</li>
<?php if($this->session->userdata['user_type'] == 1){ ?>
<li><a href="<?= base_url('Settings') ?>">
<i class="fa fa-wrench" aria-hidden="true">
......
......@@ -495,3 +495,83 @@
border-right: 1px solid #e5e5e5;
border-top: 1px solid #e5e5e5;
}
.errInput{
border: 1px solid red !important;
}
.dropZoneContainer{
position: relative;
display: inline-block;
}
.close_custom{
position: absolute;
width: 17px;
height: 17px;
text-align: center;
background: #000;
font-size: 13px;
top: -5px;
right: -1px;
color: #fff;
border-radius: 50%;
z-index: 99;
}
.dropZoneOverlay, .FileUpload {
width: 250px;
height: 250px;
}
.multiDropZoneOverlay, .multiFileUpload {
width: 50px;
height: 50px;
}
.dropZoneOverlay {
border: dotted 1px;
font-family: cursive;
color: #040404;
text-align: center;
position: absolute;
top:0px;
left:0px;
right:0px;
}
.multiDropZoneOverlay {
border: dotted 1px;
font-family: cursive;
color: #040404;
text-align: center;
position: absolute;
top:0px;
left:0px;
right:0px;
}
.FileUpload {
opacity: 0;
position: relative;
z-index: 1;
}
.multiFileUpload {
opacity: 0;
position: relative;
z-index: 1;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
}
.errorBorder {
border: 1px solid #ff0000 !important;
}
......@@ -13,6 +13,28 @@ function setImg(input,id) {
}
}
function setMultiImg(input,thisObj){
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
var count = thisObj.attr('count');
thisObj.attr('count',count+1);
jQuery('[id="multipleImageInputCntr"]').append(jQuery('[id="multipleImageInput"]').html().replace(/{:count}/g,count+1));
thisObj.addClass('prevent-click');
jQuery('[id="multiImageClose_'+count+'"]').removeClass('hide');
jQuery('[id="multiImageImg_'+count+'"]').attr('src', e.target.result);
jQuery('[id^="multiImageImg_"]').removeClass('errorBorder');
};
reader.readAsDataURL(input.files[0]);
}
}
function removeImage(count){
jQuery('[id="multiImageCntr_'+count+'"]').remove();
}
function setModal(header_msg,body_msg){
jQuery('[id="modal_body_msg"]').html(body_msg);
jQuery('[id="modal_header_msg"]').html(header_msg);
......@@ -756,6 +778,276 @@ function viewMapIssueDetails(issue_id) {
return false;
}
jQuery('[id="customQuote"]').on('click',function() {
var thisObj = jQuery(this);
if(thisObj.attr('view') == '0'){
customQuote(thisObj);
} else {
viewCustomQuote(thisObj);
}
});
quoteThisObj = '';
function customQuote(thisObj){
quoteThisObj = thisObj;
var booking_id = thisObj.attr('booking_id');
if(booking_id == '' || booking_id==undefined || booking_id == 'undefined' || booking_id == null || booking_id=='null'){
return true;
}
modalTrigger('Generate Custom Description','');
addModalLoader();
jQuery.ajax({
url : base_url+"Bookings/getBooking",
type : 'POST',
data : {'booking_id':booking_id,'view_all':'1'},
success : function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').htnl('Something went wrong, Please try again later...!');
return false;
}
var booking_data = resp_data['data'];
jQuery.each(booking_data, function(index, value){
if(value == '' || value == null || value == 'null' || value == undefined || value == 'undefined'){
booking_data[index] = ' -- ';
}
});
var html ='',
imgCount = 0,
issueHtml = '',
optionalHtml = '',
issues_selected = jQuery.parseJSON(booking_data['issues_selected']);
if(issues_selected != ''){
var comma = '';
issueHtml += '<form id="customQuote" role="form" method="post">'+
'<div class="col-md-12" style="padding-top:10px">'+
'<div class="col-md-3"><div class="row"><label>Selected Issue</label></div></div>'+
'<div class="col-md-6"><div class="row"><label>Description</label></div></div>'+
'<div class="col-md-3"><div class="row"><label>Amount</label></div></div>'+
'<input type="hidden" name="booking_id" value="'+booking_id+'">'+
'<div class="row">';
jQuery.each(issues_selected, function (index, value) {
issueHtml += '<div class="col-md-12">'
issueHtml += '<div class="col-md-3 marginTop10">';
issueHtml += comma+' '+value['issue_category']+' ';
issueHtml += '</div>'+
'<div class="col-md-6">'+
'<textarea placeholder="Description" id="description_'+index+'" rows="2" cols="60" name="description[]"></textarea>'+
'</div>'+
'<div class="col-md-3">'+
'<input class="marginTop10" placeholder="Amount" id="amount_'+index+'" type="number" name="amount[]">'+
'</div>'+
'<input type="hidden" name="issue_id[]" value="'+value['issue_id']+'">'+
'<input type="hidden" name="sub_issue_id[]" value="'+value['sub_issue_id']+'">'+
'</div>'+
'<input type="hidden" name="issue_category[]" value="'+value['issue_category']+'">';
});
issueHtml += '<input type="hidden" id="array_count" name="count" value="'+issues_selected.length+'">'+
'</div>'+
'</div>'+
'<div class="col-md-12">'+
'<div class="box-footer textCenterAlign">'+
'<button type="button" onclick="submitCustQuote(event);" class="btn btn-primary">Submit</button>'+
'</div>'+
'</div>'+
'</form>';
}
remModalLoader();
jQuery('[id="modal_content"]').html(issueHtml);
jQuery('[id^="optionalImage_"]').error(function() {
jQuery('[id^="optionalImage_"]').attr('src',base_url+'assets/images/no_image_text.png');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
})
}
function submitCustQuote(e){
e.preventDefault();
var count = jQuery('[id="array_count"]').val(), errFlag = '1';
jQuery('[id^="amount_"]').removeClass('errInput');
jQuery('[id^="description_"]').removeClass('errInput');
for (var i=0;i<count;i++){
var descrptn = jQuery('[id="description_'+i+'"]').val();
var amount = jQuery('[id="amount_'+i+'"]').val();
if((descrptn != '' && amount == '') || (descrptn == '' && amount != '')){
if(amount == ''){
jQuery('[id="amount_'+i+'"]').addClass('errInput');
}
if(descrptn == ''){
jQuery('[id="description_'+i+'"]').addClass('errInput');
}
return false;
}
if(descrptn != '' && amount != ''){
errFlag = '0';
}
}
if(errFlag == '1'){
jQuery('[id^="amount_"]').addClass('errInput');
jQuery('[id^="description_"]').addClass('errInput');
return false;
}
var form_data = new FormData();
form_data.append('data',jQuery('[id="customQuote"]').serialize());
if(form_data == '' || form_data==undefined || form_data == 'undefined' || form_data == null || form_data=='null'){
return true;
}
jQuery.ajax({
url : base_url+"Bookings/insertCustomQuote",
type : 'POST',
data : form_data,
async : false,
contentType: false,
processData: false,
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == 'error'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
else{
quoteThisObj.attr('view','1');
quoteThisObj.find('span').html('View Custom Quote');
quoteThisObj.attr('booking_id',resp_data['data']);
remModalLoader();
jQuery('[id="modal_content"]').html('Custom Quote Inserted Successfully.');
return false;
}
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
})
}
function viewCustomQuote(thisObj){
var custom_id = thisObj.attr('booking_id');
if(custom_id == '' || custom_id==undefined || custom_id == 'undefined' || custom_id == null || custom_id=='null'){
return true;
}
modalTrigger('View Custom Description','');
addModalLoader();
jQuery.ajax({
url : base_url+"Bookings/getCustomData",
type : 'POST',
data : {'custom_id':custom_id,'view_all':'1'},
success : function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var booking_data = resp_data['data'];
jQuery.each(booking_data, function(index, value){
if(value == '' || value == null || value == 'null' || value == undefined || value == 'undefined'){
booking_data[index] = ' -- ';
}
});
var html ='',
imgCount = 0,
issueHtml = '',
optionalHtml = '',
issues_selected = jQuery.parseJSON(booking_data['issues_selected']),
custdescription = jQuery.parseJSON(booking_data['custom_service_quote']);
// console.log(custdescription);
if(issues_selected != ''){
var comma = '';
issueHtml += '<div class="col-md-12" style="padding-top:10px">'+
'<div class="col-md-4"><div class="row"><label>Selected Issue</label></div></div>'+
'<div class="col-md-4"><div class="row"><label>Description</label></div></div>'+
'<div class="col-md-4"><div class="row"><label>Amount</label></div></div>'+
'<div class="row">';
jQuery.each(issues_selected, function (index, value) {
issueHtml += '<div class="col-md-12">'+
'<div class="col-md-4 marginTop10">';
issueHtml += comma+' '+value['issue_category']+' ';
issueHtml += '</div>'+
'<div class="col-md-4 marginTop10">'+
custdescription[index]['description']+
'</div>'+
'<div class="col-md-4 marginTop10">'+
custdescription[index]['amount']+
'</div>'+
'</div>';
});
issueHtml += '</div>'+
'</div>'+
'<div class="col-md-12">'+
'<div class="col-md-6"></div>'+
'<div class="col-md-6"><br><br>'+
'<div class="col-md-4"><label>Total Amount</label></div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-5"><b>'+booking_data['custom_amount']+'</b></div>'+
'</div>'+
'</div>';
}
remModalLoader();
jQuery('[id="modal_content"]').html(issueHtml);
jQuery('[id^="optionalImage_"]').error(function() {
jQuery('[id^="optionalImage_"]').attr('src',base_url+'assets/images/no_image_text.png');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
})
}
jQuery('[id="showBookinDetails"]').on('click',function() {
var booking_id = jQuery(this).attr('booking_id');
......@@ -788,7 +1080,7 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
}
});
var html = '',
imgCount = 0;
imgCount = 0,
issueHtml = '',
optionalHtml = '',
optional_data = jQuery.parseJSON(booking_data['custom_issue_data']),
......@@ -796,7 +1088,7 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
if(issues_selected != ''){
var comma = '';
issueHtml = '<div class="col-md-12" style="padding-top: 10px;">'+
issueHtml = '<div class="col-md-12" style="padding-top:10px;">'+
'<div class="row"><label>Selected Issue</label></div>'+
'<div class="row">'+
'<div class="col-md-1"></div>'+
......@@ -809,7 +1101,7 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
}
if(optional_data != ''){
optionalHtml = '<div class="col-md-12" style="padding-top: 20px;">'+
optionalHtml = '<div class="col-md-12" style="padding-top:20px;">'+
'<div class="row"><label>Additional Information</label></div>';
if(optional_data['optionlaDescription'] != ''){
......@@ -844,11 +1136,6 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
'<div class="col-md-6"><label>'+booking_data['custFirstName']+' '+booking_data['custLastName']+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Mechanic</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+booking_data['mechFirstName']+' '+booking_data['mechLastName']+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Current Milage</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+booking_data['mileage']+'</label></div>'+
......@@ -896,7 +1183,26 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+booking_data['car_location']+'</label></div>'+
'</div> '+
'</div> '+issueHtml+optionalHtml+
'</div> '+issueHtml+
'<div class="col-md-12"> '+
'<div class="row"><label>Mechanic Details</label></div>'+
'<div class="col-md-3"><div class="row"><label>Mechanic Name</label></div></div>'+
'<div class="col-md-3"><div class="row"><label>Amount</label></div></div>'+
'<div class="col-md-2"><div class="row"><label>status</label></div></div>'+
'<div class="row">';
jQuery.each(booking_data['mechanic_data'], function (index1, value1) {
if(value1['custom_amount'] == '' || value1['custom_amount'] == null || value1['custom_amount'] == undefined || value1['custom_amount'] == 'null' || value1['custom_amount'] == 'undefined'){
value1['custom_amount'] = booking_data['cost'];
}
html+= '<div class="col-md-12">'+
'<div class="col-md-3">'+value1['first_name']+' '+value1['last_name']+'</div>'+
'<div class="col-md-3">'+value1['custom_amount']+'</div>'+
'<div class="col-md-2">'+value1['status']+'</div>'+
'</div>';
});
html+= '</div>'+
'</div>'+
optionalHtml+
'</div>';
remModalLoader();
......@@ -916,3 +1222,310 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
}
});
});
jQuery('[id="addProductButton"]').on('click',function(event) {
event.preventDefault();
var validation = jQuery('[name="productAddForm"]').parsley().validate();
var error = 0;
var count = jQuery('[id="multipleImageInputCntr"]').children().first().attr('count');
if(jQuery('[id="product_image_'+count+'"]').val() == ''){
error = 1;
jQuery('[id="multiImageImg_'+count+'"]').addClass('errorBorder');
}
if(validation && error == 0){
jQuery('[name="productAddForm"]').submit();
}
});
jQuery('[id="viewProductDetails"]').on('click',function() {
var product_id = jQuery(this).attr('product_id');
if(product_id=='' || product_id==undefined || product_id=='undefined' || product_id==null || product_id=='null'){
return true;
}
modalTrigger('Product Details','');
addModalLoader();
jQuery.ajax({
url : base_url+"Product/getProductData",
type : 'POST',
data : {'product_id':product_id,'view_all':'1'},
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
console.log(resp_data);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var html = '',
imgCount = 0,
optionalHtml = '';
if(resp_data.product_image.length > 0){
optionalHtml = '<div class="col-md-12" style="padding-top:20px;">'+
'<div class="row"><label>Product Images</label></div>';
optionalHtml += '<div class="row">'+
'<div class="col-md-2">Images</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-9">';
jQuery.each(resp_data.product_image, function (index, image) {
console.log(image.image);
imgCount += 1;
optionalHtml += '<img id="optionalImage_'+imgCount+'" src="'+base_url+image.image+'" height="100" width="100" /> ';
});
optionalHtml += '</div>';
optionalHtml += '</div>';
}
html = '<div class="col-xs-12">'+
'<div class="row"><label>Product Details</label></div>'+
'<div class="col-md-6">'+
'<div class="row">'+
'<div class="col-md-4">Brand Name</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.product_data.brand_name+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Product Name</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.product_data.product_name+'</label></div>'+
'</div> '+
'</div>'+
'<div class="col-md-6">'+
'<div class="row"> '+
'<div class="col-md-4">Amount</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.product_data.amount+'</label></div>'+
'</div> '+
'<div class="row"> '+
'<div class="col-md-4">Short Description</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.product_data.short_description+'</label></div> '+
'</div> '+
'</div> '+
'<div class="col-md-12"> '+
'<br>'+
'<div class="row"><label>Product Description</label></div>'+
'<div class="row"> '+
'<div class="col-md-2">Description</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-9"><label>'+resp_data.product_data.description+'</label></div> '+
'</div> '+
'</div> '+
'<div class="col-md-12"> '+
'<br>'+
'<div class="row"><label>About Product</label></div>'+
'<div class="row"> '+
'<div class="col-md-2">Description</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-9"><label>'+resp_data.product_data.about+'</label></div> '+
'</div> '+
'</div> '+
optionalHtml+
'</div>';
remModalLoader();
jQuery('[id="modal_content"]').html(html);
jQuery('[id^="optionalImage_"]').error(function() {
jQuery('[id^="optionalImage_"]').attr('src',base_url+'assets/images/no_image_text.png');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
});
});
jQuery('[id="viewOrderDetails"]').on('click',function() {
var order_id = jQuery(this).attr('order_id');
if(order_id=='' || order_id==undefined || order_id=='undefined' || order_id==null || order_id=='null'){
return true;
}
modalTrigger('Order Details','');
addModalLoader();
jQuery.ajax({
url : base_url+"Orders/getOrderData",
type : 'POST',
data : {'order_id':order_id,'view_all':'1'},
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var html = '',
imgCount = 0,
optionalHtml = '';
if(resp_data.product_image.length > 0){
optionalHtml = '<div class="col-md-12" style="padding-top:20px;">'+
'<div class="row"><label>Product Images</label></div>';
optionalHtml += '<div class="row">'+
'<div class="col-md-12">';
jQuery.each(resp_data.product_image, function (index, image) {
imgCount += 1;
optionalHtml += '<img id="optionalImage_'+imgCount+'" src="'+base_url+image.image+'" height="100" width="100" /> ';
});
optionalHtml += '</div>';
optionalHtml += '</div>';
}
html = '<div class="col-xs-12">'+
'<div class="row"><label>Order Details</label></div>'+
'<div class="col-md-6">'+
'<div class="row">'+
'<div class="col-md-4">Order Id</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.format_order_id+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Customer Name</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.customer_name+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Product Name</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.product_name+'</label></div>'+
'</div> '+
'<div class="row">'+
'<div class="col-md-4">Quantity</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.quantity+'</label></div>'+
'</div> '+
'</div>'+
'<div class="col-md-6">'+
'<div class="row"> '+
'<div class="col-md-4">Brand Name</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.brand_name+'</label></div>'+
'</div> '+
'<div class="row"> '+
'<div class="col-md-4">Short Description</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.short_description+'</label></div> '+
'</div> '+
'<div class="row"> '+
'<div class="col-md-4">Amount</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.amount+'</label></div> '+
'</div> '+
'<div class="row"> '+
'<div class="col-md-4">Status</div>'+
'<div class="col-md-1">:</div>'+
'<div class="col-md-6"><label>'+resp_data.order_data.status+'</label></div> '+
'</div> '+
'</div> '+
optionalHtml+
'</div>';
remModalLoader();
jQuery('[id="modal_content"]').html(html);
jQuery('[id^="optionalImage_"]').error(function() {
jQuery('[id^="optionalImage_"]').attr('src',base_url+'assets/images/no_image_text.png');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
});
});
jQuery('[id="changeOrderStatus"]').on('click',function() {
var order_id = jQuery(this).attr('order_id');
if(order_id=='' || order_id==undefined || order_id=='undefined' || order_id==null || order_id=='null'){
return true;
}
modalTrigger('Change Order Detail Status','');
addModalLoader();
jQuery.ajax({
url : base_url+"Orders/changeOrderStatus",
type : 'POST',
data : {'order_id':order_id,'view_all':'1'},
success: function(resp){
if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
return false;
}
var html = '',
imgCount = 0,
optionalHtml = '';
if(issues_selected != ''){
var comma = '';
issueHtml += '<form id="customQuote" role="form" method="post">'+
'<div class="col-md-12" style="padding-top:10px">'+
'<div class="col-md-3"><div class="row"><label>Selected Issue</label></div></div>'+
'<div class="col-md-6"><div class="row"><label>Description</label></div></div>'+
'<div class="col-md-3"><div class="row"><label>Amount</label></div></div>'+
'<div class="row">'+
'</div>'+
'</div>'+
'<div class="col-md-12">'+
'<div class="box-footer textCenterAlign">'+
'<button type="button" onclick="submitCustQuote(event);" class="btn btn-primary">Submit</button>'+
'</div>'+
'</div>'+
'</form>';
}
remModalLoader();
jQuery('[id="modal_content"]').html(html);
jQuery('[id^="optionalImage_"]').error(function() {
jQuery('[id^="optionalImage_"]').attr('src',base_url+'assets/images/no_image_text.png');
});
},
fail: function(xhr, textStatus, errorThrown){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
},
error: function (ajaxContext) {
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
});
});
\ No newline at end of file
......@@ -75,7 +75,7 @@ switch (ENVIRONMENT)
case 'testing':
case 'production':
error_reporting(-1);
error_reporting(0);
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
......
......@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: db
-- Generation Time: Jan 18, 2019 at 01:31 PM
-- Generation Time: Mar 22, 2019 at 12:18 PM
-- Server version: 5.6.41
-- PHP Version: 7.2.8
......@@ -43,12 +43,35 @@ CREATE TABLE `admin_users` (
--
INSERT INTO `admin_users` (`id`, `username`, `password`, `user_type`, `display_name`, `profile_image`, `status`) VALUES
(1, 'admin', '202cb962ac59075b964b07152d234b70', 1, 'Super Admin User', 'assets/uploads/services/1543990056_1523012120_default.png', 1),
(2, 'mechanic', '202cb962ac59075b964b07152d234b70', 2, 'Mechanic', 'assets/uploads/services/1546929651_audi-r8-1366x786.jpg', 1),
(11, 'cfghbfchdrfg', '97a4aa7bfb0e20d7b9813ffe99f91fd4', 2, 'lnoik', 'assets/uploads/services/1544013534_images.jpg', 1),
(12, 'admin123', '202cb962ac59075b964b07152d234b70', 2, 'Super Admin', 'assets/uploads/services/1544091403_Himalayan.jpg', 2),
(13, 'jansa', '202cb962ac59075b964b07152d234b70', 2, 'Jensa Mechanic', 'assets/uploads/services/1546851554_234858854male.jpg', 1),
(14, 'mechanic_1', '202cb962ac59075b964b07152d234b70', 2, 'Super Mechanic 1', 'assets/uploads/services/1546929755_1523012036_hj.jpg', 1);
(1, 'admin', '202cb962ac59075b964b07152d234b70', 1, 'Super Admin', 'assets/uploads/services/1543990056_1523012120_default.png', 1),
(2, 'mechanics', '202cb962ac59075b964b07152d234b70', 2, 'kmjuiju', 'assets/uploads/services/1550042227_Yoshi_(Universal-X).png', 1),
(11, 'cfghbfchdrfg', '97a4aa7bfb0e20d7b9813ffe99f91fd4', 2, 'jiojio', 'assets/uploads/services/1544013534_images.jpg', 1),
(12, 'admin123', '202cb962ac59075b964b07152d234b70', 2, 'Super Hippo', 'assets/uploads/services/1544091403_Himalayan.jpg', 2),
(13, 'jansa', '202cb962ac59075b964b07152d234b70', 1, 'Jensa Mechanic', 'assets/uploads/services/1546851554_234858854male.jpg', 1),
(14, 'mechanic_1', '202cb962ac59075b964b07152d234b70', 2, 'Driver jiol', 'assets/uploads/services/1546929755_1523012036_hj.jpg', 1);
-- --------------------------------------------------------
--
-- Table structure for table `authtable`
--
CREATE TABLE `authtable` (
`id` int(11) NOT NULL,
`customer_id` int(11) NOT NULL,
`authtoken` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `authtable`
--
INSERT INTO `authtable` (`id`, `customer_id`, `authtoken`) VALUES
(1, 15, 'Dcarfixsce4c6f565626b189c050d7e1872bc220541cfd8d'),
(3, 17, 'Dcarfixs770a63377542b51aed33668e53f2736a16d3ef5a'),
(6, 18, 'Dcarfixsb5a5177e87d91dc0bfaa28ab3f09c62855be3a54'),
(8, 3, 'Dcarfixs26f38971326b399ef38e874128b44286f33031bc'),
(9, 8, 'Dcarfixs6552f72521375bfc5f3295d08137a71722c5155e');
-- --------------------------------------------------------
......@@ -64,10 +87,10 @@ CREATE TABLE `bookings` (
`mileage` varchar(25) DEFAULT NULL,
`cost` decimal(10,0) DEFAULT NULL,
`issues_selected` longtext,
`custom_issue_data` blob,
`custom_issue_data` longtext,
`scheduled_date` varchar(50) DEFAULT NULL,
`scheduled_time` varchar(50) DEFAULT NULL,
`status` tinyint(3) NOT NULL DEFAULT '1'
`status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '0-Pending Approval,1-Accepted,2-Deleted,3-Completed,4-Cancelled,5-Incomplete'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
......@@ -75,18 +98,21 @@ CREATE TABLE `bookings` (
--
INSERT INTO `bookings` (`booking_id`, `customer_id`, `mechanic_id`, `customer_veh_id`, `mileage`, `cost`, `issues_selected`, `custom_issue_data`, `scheduled_date`, `scheduled_time`, `status`) VALUES
(4, 3, 13, 27, '', '1000', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-17', '11:00 AM', 1),
(5, 3, 2, 28, '', '2520', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"10\",\"issue_category\":\"General Service L:1\"}]', NULL, '2019-01-17', '01:00 PM', 1),
(6, 3, 2, 29, '', '3652', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"10\",\"issue_category\":\"General Service L:1\"}]', NULL, '2019-01-17', '02:00 PM', 0),
(7, 3, 13, 30, '', '7582', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-17', '11:00 AM', 0),
(8, 3, 13, 31, '', '522', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-17', '11:00 AM', 0),
(9, 3, 13, 32, '', '2500', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '11:00 AM', 0),
(10, 3, 13, 34, '', '3500', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', NULL, '2019-01-18', '12:00 PM', 0),
(11, 3, 13, 35, '', '1000', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '11:00 AM', 0),
(12, 3, 13, 36, '', '850', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '12:00 PM', 0),
(13, 3, 13, 37, '', '6950', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '11:00 AM', 0),
(14, 3, 13, 38, '', '850', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '10:00 AM', 0),
(15, 3, 13, 39, '', '800', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"}]', NULL, '2019-01-18', '04:00 PM', 0);
(1, 3, 13, 40, '', '1500', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"Add notes for General Diagnosis (Please provide description in notes section) (optional) * Add notes for General Diagnosis (Please provide description in notes section) (optional) * Add notes for General Diagnosis (Please provide description in notes section) (optional) * \",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages323012019104623.jpg\",\"assets\\/uploads\\/services\\/optionalImages3230120191046231.jpg\",\"assets\\/uploads\\/services\\/optionalImages3230120191046232.jpg\",\"assets\\/uploads\\/services\\/optionalImages3230120191046233.jpg\"],\"optionalVideos\":[]}', '2019-01-23', '11:00 AM', 3),
(2, 2, 2, 43, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"Add notes for General Diagnosis (Please provide description in notes section) (optional) *\",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages323012019125439.png\"],\"optionalVideos\":[]}', '2019-01-23', '10:00 AM', 0),
(3, 3, 13, 49, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"\",\"optionalImages\":[],\"optionalVideos\":[]}', '2019-01-23', '11:00 AM', 0),
(4, 3, 13, 51, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"DESCRIPTION\\nAdd notes for General Diagnosis (Please provide description in notes section) (optional) *\",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages323012019143335.jpg\"],\"optionalVideos\":[]}', '2019-01-23', '11:00 AM', 0),
(5, 3, 13, 52, '', '700', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"\",\"optionalImages\":[],\"optionalVideos\":[]}', '2019-01-23', '05:00 PM', 0),
(6, 3, 13, 53, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"\",\"optionalImages\":[],\"optionalVideos\":[]}', '2019-01-23', '10:00 AM', 0),
(7, 3, 13, 54, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"\",\"optionalImages\":[],\"optionalVideos\":[]}', '2019-01-23', '12:00 PM', 0),
(8, 3, 13, 55, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"Add notes for General Diagnosis (Please provide description in notes section) (optional) *\",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages323012019144018.png\"],\"optionalVideos\":[]}', '2019-01-23', '11:00 AM', 0),
(9, 3, 13, 56, '', '500', '[{\"issue_id\":\"id of service\",\"issue\":\"name of service\",\"sub_issue_id\":\"id of sub service\",\"issue_category\":\"name of sub service\"},{\"issue_id\":\"id of service\",\"issue\":\"name of service\",\"sub_issue_id\":\"id of sub service\",\"issue_category\":\"name of sub service\"}]', '{\"optionlaDescription\":\"\",\"optionalImages\":[],\"optionalVideos\":[]}', '2019-02-24', '10:00 AM', 0),
(10, 17, 13, 57, '40', '500', 'null', '{\"optionlaDescription\":\"abcd\",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages13022019182314176298-nature-green-leaves-plants-digital_art-floating_island-trees-glass-broken-sphere-grass-rock13.jpg\",\"assets\\/uploads\\/services\\/optionalImages13022019182314639408-download-free-hd-3d-desktop-backgrounds-1920x1080-for-iphone-51.jpg\",\"assets\\/uploads\\/services\\/optionalImages130220191823157040690-desktop-backgrounds-hd14.jpg\",\"assets\\/uploads\\/services\\/optionalImages1302201918231541607821-Little-girl-with-red-umbrella-playing-in-the-rain-Kids-play-outdoors-by-rainy-weather-in-fall-Autumn-Stock-Photo.jpg\"],\"optionalVideos\":[]}', '2019-02-22', '10:00 AM', 5),
(11, 17, NULL, 58, '40', NULL, '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', NULL, NULL, NULL, 5),
(12, 17, NULL, 59, '40', NULL, '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', NULL, NULL, NULL, 5),
(13, 3, 13, 60, '', '400', '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', '{\"optionlaDescription\":\"Add notes for General Diagnosis (Please provide description in notes section) (optional) * Add notes for General Diagnosis (Please provide description in notes section) (optional) * Add notes for General Diagnosis (Please provide description in notes section) (optional) * \",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages330012019143038.jpg\",\"assets\\/uploads\\/services\\/optionalImages3300120191430381.jpg\",\"assets\\/uploads\\/services\\/optionalImages3300120191430382.jpg\",\"assets\\/uploads\\/services\\/optionalImages3300120191430383.jpg\"],\"optionalVideos\":[]}', '2019-01-31', '09:00 AM', 0),
(14, 17, NULL, 61, '40', NULL, '[{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"issue_category\":\"Oil Change\"},{\"issue\":\"Oil Change and General Service\",\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"issue_category\":\"Oil Top Up \"},{\"issue\":\"General Service\",\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"issue_category\":\"General Service L:0\"}]', NULL, NULL, NULL, 5),
(15, 17, NULL, 62, '30 - 32 miles/gallon', NULL, NULL, '{\"optionlaDescription\":\"abcd\",\"optionalImages\":[\"assets\\/uploads\\/services\\/optionalImages15022019112201Yoshi_(Universal-X).png\"],\"optionalVideos\":[]}', NULL, NULL, 5);
-- --------------------------------------------------------
......@@ -98,12 +124,14 @@ CREATE TABLE `customers` (
`customer_id` int(20) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`country_code` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`address` varchar(500) DEFAULT NULL,
`profile_image` varchar(500) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`date_of_birth` varchar(200) DEFAULT NULL,
`is_otp_verified` int(11) NOT NULL DEFAULT '0' COMMENT '0-not verified,1-verified',
`status` tinyint(3) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
......@@ -111,13 +139,16 @@ CREATE TABLE `customers` (
-- Dumping data for table `customers`
--
INSERT INTO `customers` (`customer_id`, `first_name`, `last_name`, `phone`, `email`, `address`, `profile_image`, `password`, `date_of_birth`, `status`) VALUES
(1, 'Tobin', 'Thomas', '9995559194', '[email protected]', 'Techware', 'assets/uploads/services/1544417044_sniper.jpg', NULL, '05/05/1994', 1),
(2, 'Tobin', 'Thomas', '99955752194', '[email protected]', 'Techware', 'assets/uploads/services/1545036793_car1.jpg', NULL, '12/20/2018', 1),
(3, 'Tobin', 'Thomas', '9993242394', '[email protected]', 'Techware', 'assets/uploads/services/3_1393675771-ferrari.jpg', 'e10adc3949ba59abbe56e057f20f883e', '12/11/2018', 1),
(7, 'tobin', 'thomas', '9995559194', '[email protected]', NULL, 'assets/uploads/services/1545036793_car1.jpg', 'e10adc3949ba59abbe56e057f20f883e', NULL, 1),
(8, 'tobin', 'thomas', '8956235896', '[email protected]', NULL, 'assets/uploads/services/1545036793_car1.jpg', 'e10adc3949ba59abbe56e057f20f883e', NULL, 1),
(9, 'tobin', 'thomas test', NULL, '[email protected]', NULL, NULL, 'e10adc3949ba59abbe56e057f20f883e', NULL, 1);
INSERT INTO `customers` (`customer_id`, `first_name`, `last_name`, `country_code`, `phone`, `email`, `address`, `profile_image`, `password`, `date_of_birth`, `is_otp_verified`, `status`) VALUES
(1, 'Tobin', 'Thomas', '', '9995559194', '[email protected]', 'Techware', 'assets/uploads/services/1544417044_sniper.jpg', NULL, '05/05/1994', 0, 1),
(2, 'Tobin', 'Thomas', '', '99955752194', '[email protected]', 'Techware', 'assets/uploads/services/1545036793_car1.jpg', NULL, '12/20/2018', 0, 1),
(3, 'Tobin', 'Thomas', '', '9993242394', '[email protected]', 'Techware', 'assets/uploads/services/3_1393675771-ferrari.jpg', 'e10adc3949ba59abbe56e057f20f883e', '12/11/2018', 0, 1),
(7, 'tobin', 'thomas', '', '9995559194', '[email protected]', NULL, 'assets/uploads/services/1545036793_car1.jpg', 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1),
(8, 'tobin', 'thomas', '', '8956235896', '[email protected]', NULL, 'assets/uploads/services/1545036793_car1.jpg', 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1),
(9, 'tobin', 'thomas test', '', NULL, '[email protected]', NULL, NULL, 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1),
(16, 'anu', '', '+91', '9856215874', '[email protected]', NULL, NULL, 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1),
(17, 'anu', '', '+91', '98562152374', '[email protected]', NULL, NULL, 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1),
(18, 'anu', '', '+91', '9857581523', '[email protected]', NULL, NULL, 'e10adc3949ba59abbe56e057f20f883e', NULL, 0, 1);
-- --------------------------------------------------------
......@@ -138,7 +169,7 @@ CREATE TABLE `customer_vehicle` (
`car_loc_lat` varchar(150) DEFAULT NULL,
`car_loc_lng` varchar(150) DEFAULT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` tinyint(3) NOT NULL DEFAULT '3'
`status` tinyint(3) NOT NULL DEFAULT '3' COMMENT '0-Inactive,1-Active,2-Deleted,3-Not Saved'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -146,36 +177,52 @@ CREATE TABLE `customer_vehicle` (
--
INSERT INTO `customer_vehicle` (`customer_veh_id`, `customer_id`, `car_name`, `car_model`, `car_maker`, `car_model_year`, `car_vin`, `vehicle_data`, `car_location`, `car_loc_lat`, `car_loc_lng`, `created_date`, `status`) VALUES
(9, NULL, '2015 Hyundai Sonata SE', 'sonata', 'hyundai', '2015', NULL, '{\"vehicle\":\"2015 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2015\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"SE \\/ SE PZEV\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"37 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$20,295\",\"Delivery Charges\":\"$825\",\"MSRP\":\"$21,150\"},\"success\":true,\"error\":\"\"}', 'FL, USA', '27.6648274', '-81.5157535', '2018-12-17 10:11:03', 3),
(10, NULL, '2015 Hyundai Sonata SE', 'sonata', 'hyundai', '2015', NULL, '{\"vehicle\":\"2015 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2015\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"SE \\/ SE PZEV\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"37 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$20,295\",\"Delivery Charges\":\"$825\",\"MSRP\":\"$21,150\"},\"success\":true,\"error\":\"\"}', 'FL, USA', '27.6648274', '-81.5157535', '2018-12-17 10:11:08', 3),
(11, 2, '2016 Hyundai Sonata SE', 'sonata', 'hyundai', '2016', NULL, '{\"vehicle\":\"2016 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2016\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"SE\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"38 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$20,859\",\"Delivery Charges\":\"$835\",\"MSRP\":\"$21,750\"},\"success\":true,\"error\":\"\"}', 'San Francisco, CA, USA', '37.7749295', '-122.4194155', '2018-12-17 10:17:53', 1),
(3, NULL, '2011 Hyundai Sonata GLS', 'sonata', 'hyundai', '2011', NULL, '{\"vehicle\":\"2011 Hyundai Sonata GLS\",\"attributes\":{\"Year\":\"2011\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"GLS\",\"Short Trim\":\"GLS\",\"Trim Variations\":\"GLS PZEV \\/ GLS\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"22 miles\\/gallon\",\"Highway Mileage\":\"35 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"57.90 inches\",\"Overall Length\":\"189.80 inches\",\"Overall Width\":\"72.20 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$19,538\",\"Delivery Charges\":\"$750\",\"MSRP\":\"$20,395\"},\"success\":true,\"error\":\"\"}', '439 Boylston Street, Boston, MA, USA', '42.351495', '-71.072925', '2018-12-17 08:55:52', 3),
(4, 3, '2015 Hyundai Sonata SE', 'sonata', 'hyundai', '2015', NULL, '{\"vehicle\":\"2015 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2015\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"SE \\/ SE PZEV\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"37 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$20,295\",\"Delivery Charges\":\"$825\",\"MSRP\":\"$21,150\"},\"success\":true,\"error\":\"\"}', 'RI, USA', '41.5800945', '-71.4774291', '2018-12-17 08:56:55', 1),
(13, NULL, '2017 Hyundai Sonata SE', 'sonata', 'hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"Base PZEV \\/ Base \\/ SE PZEV \\/ SE \\/ Eco \\/ Sport \\/ Limited \\/ Sport 2.0T \\/ Limited 2.0T\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"36 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$21,047\",\"Delivery Charges\":\"$835\",\"MSRP\":\"$21,950\"},\"success\":true,\"error\":\"\"}', 'H F Shepherd Drive, Decatur, GA, USA', '33.7119197', '-84.2785545', '2018-12-17 10:26:37', 3),
(14, NULL, '2012 Hyundai Sonata SE', 'sonata', 'hyundai', '2012', NULL, '{\"vehicle\":\"2012 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2012\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"SE\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"24 miles\\/gallon\",\"Highway Mileage\":\"35 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"57.90 inches\",\"Overall Length\":\"189.80 inches\",\"Overall Width\":\"72.20 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$24,725\",\"Delivery Charges\":\"$775\",\"MSRP\":\"$26,445\"},\"success\":true,\"error\":\"\"}', 'FDR Drive, Brooklyn, NY, USA', '40.7100593', '-73.9894836', '2018-12-17 10:30:06', 3),
(15, NULL, '2017 Hyundai Sonata SE', 'sonata', 'hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"Base PZEV \\/ Base \\/ SE PZEV \\/ SE \\/ Eco \\/ Sport \\/ Limited \\/ Sport 2.0T \\/ Limited 2.0T\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"36 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$21,047\",\"Delivery Charges\":\"$835\",\"MSRP\":\"$21,950\"},\"success\":true,\"error\":\"\"}', 'DfR Solutions, Virginia Manor Road, Beltsville, MD, USA', '39.063356', '-76.893169', '2018-12-17 10:33:05', 3),
(16, NULL, '2017 Hyundai Sonata SE', 'sonata', 'hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"Base PZEV \\/ Base \\/ SE PZEV \\/ SE \\/ Eco \\/ Sport \\/ Limited \\/ Sport 2.0T \\/ Limited 2.0T\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"36 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$21,047\",\"Delivery Charges\":\"$835\",\"MSRP\":\"$21,950\"},\"success\":true,\"error\":\"\"}', 'DfR Solutions, Virginia Manor Road, Beltsville, MD, USA', '39.063356', '-76.893169', '2018-12-17 10:33:11', 3),
(17, NULL, NULL, NULL, NULL, NULL, '1NXBR32E85Z505904', '{\"vin\":\"1NXBR32E85Z505904\",\"attributes\":{\"VIN\":\"1NXBR32E85Z505904\",\"Year\":\"2005\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"CE\",\"Short Trim\":\"CE\",\"Trim Variations\":\"CE \\/ LE \\/ S\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Compact\",\"Vehicle Category\":\"Compact Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"13.2 gallon\",\"City Mileage\":\"30 - 32 miles\\/gallon\",\"Highway Mileage\":\"38 - 41 miles\\/gallon\",\"Engine\":\"1.8L L4 DOHC 16V\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"4\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"Non-Abs | 4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"2615\",\"Gross Weight\":\"\",\"Overall Height\":\"58.50 inches\",\"Overall Length\":\"178.30 inches\",\"Overall Width\":\"66.90 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$14,287\",\"Delivery Charges\":\"$540\",\"MSRP\":\"$15,790\"},\"success\":true,\"error\":\"\"}', 'DRTY SMMR, Myrtle Avenue, Brooklyn, NY, USA', '40.6973088', '-73.9308637', '2018-12-17 11:42:55', 3),
(20, NULL, '2005 Toyota Corolla CE', NULL, NULL, NULL, '1NXBR32E85Z505904', '{\"vin\":\"1NXBR32E85Z505904\",\"attributes\":{\"VIN\":\"1NXBR32E85Z505904\",\"Year\":\"2005\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"CE\",\"Short Trim\":\"CE\",\"Trim Variations\":\"CE \\/ LE \\/ S\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Compact\",\"Vehicle Category\":\"Compact Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"13.2 gallon\",\"City Mileage\":\"30 - 32 miles\\/gallon\",\"Highway Mileage\":\"38 - 41 miles\\/gallon\",\"Engine\":\"1.8L L4 DOHC 16V\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"4\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"Non-Abs | 4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"2615\",\"Gross Weight\":\"\",\"Overall Height\":\"58.50 inches\",\"Overall Length\":\"178.30 inches\",\"Overall Width\":\"66.90 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$14,287\",\"Delivery Charges\":\"$540\",\"MSRP\":\"$15,790\"},\"success\":true,\"error\":\"\",\"vehicle\":\"2005 Toyota Corolla CE\"}', 'CA, USA', '36.778261', '-119.4179324', '2018-12-17 12:35:05', 3),
(21, NULL, '2014 Hyundai Sonata GLS', 'sonata', 'hyundai', '2014', NULL, '{\"vehicle\":\"2014 Hyundai Sonata GLS\",\"attributes\":{\"Year\":\"2014\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"GLS\",\"Short Trim\":\"GLS\",\"Trim Variations\":\"GLS \\/ GLS PZEV\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"24 miles\\/gallon\",\"Highway Mileage\":\"35 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"57.90 inches\",\"Overall Length\":\"189.80 inches\",\"Overall Width\":\"72.20 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$20,532\",\"Delivery Charges\":\"$810\",\"MSRP\":\"$21,450\"},\"success\":true,\"error\":\"\"}', 'Fresno, CA, USA', '36.7377981', '-119.7871247', '2018-12-17 12:48:33', 3),
(22, 3, '2018 Hyundai Sonata Sport', 'Sonata', 'Hyundai', '2018', NULL, '{\"vehicle\":\"2018 Hyundai Sonata Sport\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"Sport\",\"Short Trim\":\"SEL\",\"Trim Variations\":\"SEL \\/ Limited SULEV \\/ Sport \\/ Limited \\/ SEL SULEV\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Passenger Car\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"\",\"Doors\":\"4\",\"Fuel Type\":\"Gasoline\",\"Fuel Capacity\":\"\",\"City Mileage\":\"\",\"Highway Mileage\":\"\",\"Engine\":\"GDI THETA-II\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"\",\"Anti-Brake System\":\"\",\"Steering Type\":\"\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"\",\"Overall Length\":\"\",\"Overall Width\":\"\",\"Standard Seating\":\"\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'Groove ???? 2 G218 Rama I Rd, Khwaeng Pathum Wan, Khet Pathum Wan, Krung Thep Maha Nakhon 10330, Thailand', '13.7453362', '100.5381618', '2019-01-16 09:05:18', 2),
(23, 3, '2017 Hyundai Sonata SE', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata SE\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"SE\",\"Short Trim\":\"SE\",\"Trim Variations\":\"Base PZEV \\/ Base \\/ SE PZEV \\/ SE \\/ Eco \\/ Sport \\/ Limited \\/ Sport 2.0T \\/ Limited 2.0T\",\"Made In\":\"United States\",\"Vehicle Style\":\"Sedan (4-Door)\",\"Vehicle Type\":\"Car\",\"Vehicle Size\":\"Midsize\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallon\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"36 miles\\/gallon\",\"Engine\":\"2.4L L4 DOHC 16V\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic\",\"Transmission Gears\":\"6\",\"Driven Wheels\":\"Front Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"R&P\",\"Curb Weight\":\"3252\",\"Gross Weight\":\"\",\"Overall Height\":\"58.10 inches\",\"Overall Length\":\"191.10 inches\",\"Overall Width\":\"73.40 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$21,047\",\"Delivery Charges\":\"$835\",\"MSRP\":\"$21,950\"},\"success\":true,\"error\":\"\"}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-16 09:09:10', 1),
(24, 3, '2018 Seat Leon', 'Leon', 'Seat', '2018', NULL, '{\"vehicle\":\"2018 Seat Leon\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Seat\",\"Trim\":\"\",\"Model\":\"Leon\",\"Engine\":\"\"}}', 'F1563 Princes Hwy, Termeil NSW 2539, Australia', '-35.4853846', '150.3415399', '2019-01-16 12:08:53', 3),
(25, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 08:24:15', 3),
(26, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 08:48:12', 3),
(27, 3, '2019 Peugeot 307', '307', 'Peugeot', '2019', NULL, '{\"vehicle\":\"2019 Peugeot 307\",\"attributes\":{\"Year\":\"2019\",\"Make\":\"Peugeot\",\"Trim\":\"\",\"Model\":\"307\",\"Engine\":\"\"}}', 'F1563 Princes Hwy, Termeil NSW 2539, Australia', '-35.4853846', '150.3415399', '2019-01-17 09:37:22', 3),
(28, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 09:39:08', 3),
(29, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 09:43:16', 3),
(30, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 09:44:33', 3),
(31, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-17 09:47:07', 3),
(32, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-18 05:13:09', 3),
(33, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"South Korea\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Sedan\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Large Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallons\",\"City Mileage\":\"22 miles\\/gallon\",\"Highway Mileage\":\"31 miles\\/gallon\",\"Engine\":\"Intercooled Turbo Regular Unleaded I-4 2.0 L\\/122\",\"Engine Size\":\"2-L\",\"Engine Cylinders\":\"4-Cylinder\",\"Transmission Type\":\"Automatic w\\/OD\",\"Transmission Gears\":\"6-Speed\",\"Driven Wheels\":\"Front-Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"Rack & Pinion\",\"Curb Weight\":\"3492 pounds\",\"Gross Weight\":\"\",\"Overall Height\":\"58.1 inches\",\"Overall Length\":\"191.1 inches\",\"Overall Width\":\"73.4 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"$26,600\"},\"success\":true,\"error\":\"\"}', 'Tr??c 71 Hai Bà Tr?ng, C?a Nam, Hoàn Ki?m, Hà N?i, Vietnam', '21.027065', '105.843043', '2019-01-18 05:29:16', 1),
(34, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-18 06:18:49', 3),
(35, 3, '2017 Citroën C5 Break', 'C5 Break', 'Citroën', '2017', NULL, '{\"vehicle\":\"2017 Citro\\u00ebn C5 Break\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Citro\\u00ebn\",\"Trim\":\"\",\"Model\":\"C5 Break\",\"Engine\":\"\"}}', 'FG-1 76-B, Maya Apartments Rd, Block FG1, Vikaspuri, Delhi, 110018, India', '28.642685', '77.0700741', '2019-01-18 06:27:05', 3),
(36, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-18 06:27:22', 3),
(37, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-18 06:28:35', 3),
(38, 3, '2018 Peugeot 307 SW', '307 SW', 'Peugeot', '2018', NULL, '{\"vehicle\":\"2018 Peugeot 307 SW\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Peugeot\",\"Trim\":\"\",\"Model\":\"307 SW\",\"Engine\":\"\"}}', 'BG-510, Bawana Rd, Block BG, Sanjay Gandhi Transport Nagar, Delhi, 110042, India', '28.738923', '77.148339', '2019-01-18 06:28:59', 3),
(39, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-18 06:38:54', 3);
(60, 3, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"\",\"Model\":\"Corolla\",\"Engine\":\"\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-30 09:00:59', 3),
(61, 17, '2018 Honda Corolla', 'Corolla', 'Honda', '2018', NULL, '{\"vehicle\":\"2018 Honda Corolla\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Honda\",\"Trim\":\"dsfds\",\"Model\":\"Corolla\",\"Engine\":\"Tg512\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '76.4521458', '10.247512', '2019-02-06 04:32:47', 3),
(62, 17, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"S\",\"Model\":\"Corolla\",\"Engine\":\"1.8-L L-4 DOHC 16V\"}}', 'kakkand info', '2134', '2433', '2019-02-08 07:17:53', 3),
(56, 3, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"\",\"Model\":\"Corolla\",\"Engine\":\"\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 09:11:12', 3),
(57, 17, '2018 Honda Corolla', 'Corolla', 'Honda', '2018', NULL, '{\"vehicle\":\"2018 Honda Corolla\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Honda\",\"Trim\":\"dsfds\",\"Model\":\"Corolla\",\"Engine\":\"Tg512\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '76.4521458', '10.247512', '2019-01-30 06:52:50', 3),
(58, 17, '2018 Honda Corolla', 'Corolla', 'Honda', '2018', NULL, '{\"vehicle\":\"2018 Honda Corolla\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Honda\",\"Trim\":\"dsfds\",\"Model\":\"Corolla\",\"Engine\":\"Tg512\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '76.4521458', '10.247512', '2019-01-30 06:53:42', 3),
(59, 17, '2018 Honda Corolla', 'Corolla', 'Honda', '2018', NULL, '{\"vehicle\":\"2018 Honda Corolla\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Honda\",\"Trim\":\"dsfds\",\"Model\":\"Corolla\",\"Engine\":\"Tg512\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '76.4521458', '10.247512', '2019-01-30 06:59:03', 3),
(52, 3, '2018 Peugeot 307 SW', '307 SW', 'Peugeot', '2018', NULL, '{\"vehicle\":\"2018 Peugeot 307 SW\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Peugeot\",\"Trim\":\"\",\"Model\":\"307 SW\",\"Engine\":\"\"}}', 'd808 El Camino Real, Burlingame, CA 94010, USA', '37.58087', '-122.3599866', '2019-01-23 09:07:05', 3),
(53, 3, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"\",\"Model\":\"Corolla\",\"Engine\":\"\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 09:07:19', 3),
(54, 3, '2016 Dacia Duster', 'Duster', 'Dacia', '2016', NULL, '{\"vehicle\":\"2016 Dacia Duster\",\"attributes\":{\"Year\":\"2016\",\"Make\":\"Dacia\",\"Trim\":\"\",\"Model\":\"Duster\",\"Engine\":\"\"}}', 'F1563 Princes Hwy, Termeil NSW 2539, Australia', '-35.4853846', '150.3415399', '2019-01-23 09:07:56', 3),
(55, 3, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"\",\"Model\":\"Corolla\",\"Engine\":\"\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 09:10:29', 3),
(51, 3, '2005 Toyota Corolla', 'Corolla', 'Toyota', '2005', NULL, '{\"vehicle\":\"2005 Toyota Corolla\",\"attributes\":{\"Year\":\"2005\",\"Make\":\"Toyota\",\"Trim\":\"\",\"Model\":\"Corolla\",\"Engine\":\"\"}}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 09:03:46', 3),
(49, 3, '2016 Citroën C6', 'C6', 'Citroën', '2016', NULL, '{\"vehicle\":\"2016 Citro\\u00ebn C6\",\"attributes\":{\"Year\":\"2016\",\"Make\":\"Citro\\u00ebn\",\"Trim\":\"\",\"Model\":\"C6\",\"Engine\":\"\"}}', 'Yonge St, Newmarket, ON, Canada', '44.0509919', '-79.4793029', '2019-01-23 08:57:08', 3),
(50, 3, '2005 Toyota Corolla S', 'Corolla', 'Toyota', '2005', '1NXBR32E85Z505904', '{\"vin\":\"1NXBR32E85Z505904\",\"attributes\":{\"VIN\":\"1NXBR32E85Z505904\",\"Year\":\"2005\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"S\",\"Short Trim\":\"S\",\"Trim Variations\":\"S \\/ CE \\/ LE\",\"Made In\":\"America\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Test Car\",\"Vehicle Size\":\"Compact\",\"Vehicle Category\":\"Compact Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"13.20 gallons\",\"City Mileage\":\"30 - 32 miles\\/gallon\",\"Highway Mileage\":\"38 - 41 miles\\/gallon\",\"Engine\":\"1.8-L L-4 DOHC 16V\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Manual\",\"Transmission Gears\":\"5\",\"Driven Wheels\":\"Front-Wheel Drive\",\"Anti-Brake System\":\"Non-ABS 4-Wheel ABS\",\"Steering Type\":\"Rack & Pinion\",\"Curb Weight\":\"2590\",\"Gross Weight\":\"\",\"Overall Height\":\"58.50 inches\",\"Overall Length\":\"178.30 inches\",\"Overall Width\":\"66.90 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$13,563\",\"Delivery Charges\":\"$540\",\"MSRP\":\"$14,990\"},\"success\":true,\"error\":\"\",\"vehicle\":\"2005 Toyota Corolla S\"}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 09:01:15', 1),
(48, 3, '2005 Toyota Corolla S', 'Corolla', 'Toyota', '2005', '1NXBR32E85Z505904', '{\"vin\":\"1NXBR32E85Z505904\",\"attributes\":{\"VIN\":\"1NXBR32E85Z505904\",\"Year\":\"2005\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"S\",\"Short Trim\":\"S\",\"Trim Variations\":\"S \\/ CE \\/ LE\",\"Made In\":\"America\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Test Car\",\"Vehicle Size\":\"Compact\",\"Vehicle Category\":\"Compact Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"13.20 gallons\",\"City Mileage\":\"30 - 32 miles\\/gallon\",\"Highway Mileage\":\"38 - 41 miles\\/gallon\",\"Engine\":\"1.8-L L-4 DOHC 16V\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Manual\",\"Transmission Gears\":\"5\",\"Driven Wheels\":\"Front-Wheel Drive\",\"Anti-Brake System\":\"Non-ABS 4-Wheel ABS\",\"Steering Type\":\"Rack & Pinion\",\"Curb Weight\":\"2590\",\"Gross Weight\":\"\",\"Overall Height\":\"58.50 inches\",\"Overall Length\":\"178.30 inches\",\"Overall Width\":\"66.90 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$13,563\",\"Delivery Charges\":\"$540\",\"MSRP\":\"$14,990\"},\"success\":true,\"error\":\"\",\"vehicle\":\"2005 Toyota Corolla S\"}', 'DFRRI Road, Fimeama, Port Harcourt, Nigeria', '4.7790458', '7.0365156', '2019-01-23 08:54:31', 2),
(47, 3, '2015 Hyundai Sonata', 'Sonata', 'Hyundai', '2015', NULL, '{\"vehicle\":\"2015 Hyundai Sonata\",\"attributes\":{\"Year\":\"2015\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"United States \",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Passenger Car\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Sedan\",\"Doors\":\"4\",\"Fuel Type\":\"Gasoline\",\"Fuel Capacity\":\"\",\"City Mileage\":\"\",\"Highway Mileage\":\"\",\"Engine\":\"DOHC GDI THETA-II\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"\",\"Transmission Type\":\"\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"\",\"Anti-Brake System\":\"\",\"Steering Type\":\"\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"\",\"Overall Length\":\"\",\"Overall Width\":\"\",\"Standard Seating\":\"\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'DF-8, 2nd Avenue, DF Block, Sector 1, Salt Lake City, Kolkata, West Bengal 700064, India', '22.5920989', '88.4167945', '2019-01-23 08:51:56', 2),
(46, 3, '2017 Toyota Corolla', 'Corolla', 'Toyota', '2017', NULL, '{\"vehicle\":\"2017 Toyota Corolla\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"Canada\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Passenger Car\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Sedan\",\"Doors\":\"4\",\"Fuel Type\":\"Gasoline\",\"Fuel Capacity\":\"\",\"City Mileage\":\"\",\"Highway Mileage\":\"\",\"Engine\":\"2ZR-FE\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"4x2\",\"Anti-Brake System\":\"\",\"Steering Type\":\"\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"\",\"Overall Length\":\"\",\"Overall Width\":\"\",\"Standard Seating\":\"\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'V US-6, Walkerton, IN 46574, USA', '41.4669876', '-86.5005615', '2019-01-23 08:32:45', 2),
(45, 3, '2005 Toyota Corolla S', 'Corolla', 'Toyota', '2005', '1NXBR32E85Z505904', '{\"vin\":\"1NXBR32E85Z505904\",\"attributes\":{\"VIN\":\"1NXBR32E85Z505904\",\"Year\":\"2005\",\"Make\":\"Toyota\",\"Model\":\"Corolla\",\"Trim\":\"S\",\"Short Trim\":\"S\",\"Trim Variations\":\"S \\/ CE \\/ LE\",\"Made In\":\"America\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Test Car\",\"Vehicle Size\":\"Compact\",\"Vehicle Category\":\"Compact Cars\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"13.20 gallons\",\"City Mileage\":\"30 - 32 miles\\/gallon\",\"Highway Mileage\":\"38 - 41 miles\\/gallon\",\"Engine\":\"1.8-L L-4 DOHC 16V\",\"Engine Size\":\"1.8\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Manual\",\"Transmission Gears\":\"5\",\"Driven Wheels\":\"Front-Wheel Drive\",\"Anti-Brake System\":\"Non-ABS 4-Wheel ABS\",\"Steering Type\":\"Rack & Pinion\",\"Curb Weight\":\"2590\",\"Gross Weight\":\"\",\"Overall Height\":\"58.50 inches\",\"Overall Length\":\"178.30 inches\",\"Overall Width\":\"66.90 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"$13,563\",\"Delivery Charges\":\"$540\",\"MSRP\":\"$14,990\"},\"success\":true,\"error\":\"\",\"vehicle\":\"2005 Toyota Corolla S\"}', 'F1563 Princes Hwy, Termeil NSW 2539, Australia', '-35.4853846', '150.3415399', '2019-01-23 08:32:19', 2),
(43, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Trim\":\"\",\"Model\":\"Sonata\",\"Engine\":\"\"}}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-23 07:24:51', 3),
(44, 3, '2018 Hyundai Sonata', 'Sonata', 'Hyundai', '2018', NULL, '{\"vehicle\":\"2018 Hyundai Sonata\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"United States \",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Passenger Car\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Sedan\",\"Doors\":\"4\",\"Fuel Type\":\"Gasoline\",\"Fuel Capacity\":\"\",\"City Mileage\":\"\",\"Highway Mileage\":\"\",\"Engine\":\"GDI THETA-II\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"FWD\\/Front Wheel Drive\",\"Anti-Brake System\":\"Standard\",\"Steering Type\":\"\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"\",\"Overall Length\":\"\",\"Overall Width\":\"\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'X US-64, Farmington, NM 87401, USA', '36.7151849', '-108.1481245', '2019-01-23 08:27:20', 2),
(42, 3, '2017 Hyundai Sonata', 'Sonata', 'Hyundai', '2017', NULL, '{\"vehicle\":\"2017 Hyundai Sonata\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"South Korea\",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Sedan\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Sedan\",\"Doors\":\"4\",\"Fuel Type\":\"Regular Unleaded\",\"Fuel Capacity\":\"18.5 gallons\",\"City Mileage\":\"25 miles\\/gallon\",\"Highway Mileage\":\"36 miles\\/gallon\",\"Engine\":\"Regular Unleaded I-4 2.4 L\\/144\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"Automatic w\\/OD\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"Front-Wheel Drive\",\"Anti-Brake System\":\"4-Wheel ABS\",\"Steering Type\":\"\",\"Curb Weight\":\"3250\",\"Gross Weight\":\"\",\"Overall Height\":\"58.1 inches\",\"Overall Length\":\"191.1 inches\",\"Overall Width\":\"73.4 inches\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'Broadway, New York, USA', '40.908288', '-73.896564', '2019-01-23 07:16:43', 2),
(41, 3, '2018 Hyundai Sonata', 'Sonata', 'Hyundai', '2018', NULL, '{\"vehicle\":\"2018 Hyundai Sonata\",\"attributes\":{\"Year\":\"2018\",\"Make\":\"Hyundai\",\"Model\":\"Sonata\",\"Trim\":\"\",\"Short Trim\":\"\",\"Trim Variations\":\"\",\"Made In\":\"United States \",\"Vehicle Style\":\"\",\"Vehicle Type\":\"Passenger Car\",\"Vehicle Size\":\"\",\"Vehicle Category\":\"Sedan\",\"Doors\":\"4\",\"Fuel Type\":\"Gasoline\",\"Fuel Capacity\":\"\",\"City Mileage\":\"\",\"Highway Mileage\":\"\",\"Engine\":\"GDI THETA-II\",\"Engine Size\":\"2.4\",\"Engine Cylinders\":\"4\",\"Transmission Type\":\"\",\"Transmission Gears\":\"\",\"Driven Wheels\":\"FWD\\/Front Wheel Drive\",\"Anti-Brake System\":\"Standard\",\"Steering Type\":\"\",\"Curb Weight\":\"\",\"Gross Weight\":\"\",\"Overall Height\":\"\",\"Overall Length\":\"\",\"Overall Width\":\"\",\"Standard Seating\":\"5\",\"Optional Seating\":\"\",\"Invoice Price\":\"\",\"Delivery Charges\":\"\",\"MSRP\":\"\"},\"success\":true,\"error\":\"\"}', 'Tr??c 71 Hai Bà Tr?ng, C?a Nam, Hoàn Ki?m, Hà N?i, Vietnam', '21.027065', '105.843043', '2019-01-23 05:43:03', 2),
(40, 3, '2017 Dacia Duster', 'Duster', 'Dacia', '2017', NULL, '{\"vehicle\":\"2017 Dacia Duster\",\"attributes\":{\"Year\":\"2017\",\"Make\":\"Dacia\",\"Trim\":\"\",\"Model\":\"Duster\",\"Engine\":\"\"}}', 'F1563 Princes Hwy, Termeil NSW 2539, Australia', '-35.4853846', '150.3415399', '2019-01-23 05:16:35', 3);
-- --------------------------------------------------------
--
-- Table structure for table `custom_quote`
--
CREATE TABLE `custom_quote` (
`custom_id` int(11) NOT NULL,
`booking_id` int(11) DEFAULT NULL,
`custom_service_quote` longtext,
`custom_amount` double DEFAULT NULL,
`status` tinyint(3) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `custom_quote`
--
INSERT INTO `custom_quote` (`custom_id`, `booking_id`, `custom_service_quote`, `custom_amount`, `status`) VALUES
(2, 1, '[{\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"description\":\"fgh\",\"amount\":\"54\"},{\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"description\":\"fghfg\",\"amount\":\"45\"},{\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"description\":\"h\",\"amount\":\"45\"}]', 144, 1),
(3, 2, '[{\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"description\":\"gyhu\",\"amount\":\"452\"},{\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"description\":\"ghju\",\"amount\":\"45345\"},{\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"description\":\"ghj\",\"amount\":\"4532\"}]', 50329, 1),
(4, 3, '[{\"issue_id\":\"11\",\"sub_issue_id\":\"7\",\"description\":\"yui\",\"amount\":\"67\"},{\"issue_id\":\"11\",\"sub_issue_id\":\"8\",\"description\":\"uyiy\",\"amount\":\"676\"},{\"issue_id\":\"12\",\"sub_issue_id\":\"9\",\"description\":\"yiuyiyui\",\"amount\":\"67\"}]', 810, 1);
-- --------------------------------------------------------
......@@ -212,7 +259,7 @@ CREATE TABLE `issues` (
`issue_id` int(11) NOT NULL,
`issue` varchar(500) NOT NULL,
`issue_image` varchar(500) DEFAULT NULL,
`status` tinyint(3) NOT NULL DEFAULT '1'
`status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '0-Inactive,1-Active,2-Delete'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
......@@ -222,9 +269,9 @@ CREATE TABLE `issues` (
INSERT INTO `issues` (`issue_id`, `issue`, `issue_image`, `status`) VALUES
(9, 'Wheel Maintenance', 'assets/uploads/services/images8.jpg', 2),
(10, 'AC Maintenance', 'assets/uploads/services/car_ac.jpg', 2),
(11, 'Oil Change and General Service', 'assets/uploads/services/images9.jpg', 1),
(12, 'General Service', 'assets/uploads/services/Twitch_KingpinSkin_old2_HD1.jpg', 1),
(13, 'Oil Change and General Service (Free Water Service and Polishing).', 'assets/uploads/services/Himalayan.jpg', 1);
(11, 'Oil Change and General Service', 'assets/uploads/services/[email protected]g', 1),
(12, 'General Service', 'assets/uploads/services/[email protected]g', 1),
(13, 'Oil Change and General Service (Free Water Service and Polishing).', 'assets/uploads/services/[email protected]g', 1);
-- --------------------------------------------------------
......@@ -239,7 +286,7 @@ CREATE TABLE `issues_category` (
`issue_cat_image` varchar(500) DEFAULT NULL,
`default_service_fee` double DEFAULT NULL,
`default_description` longtext,
`status` tinyint(3) NOT NULL DEFAULT '1'
`status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '0-Inactive,1-Active,2-Delete'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
......@@ -251,7 +298,8 @@ INSERT INTO `issues_category` (`issue_cat_id`, `issue_id`, `issue_category`, `is
(8, 11, 'Oil Top Up ', 'assets/uploads/services/Himalayan1.jpg', 500, 'Oil Top Up and general service with free water service. ', 1),
(9, 12, 'General Service L:0', 'assets/uploads/services/park-512.png', 700, 'With out Water Service and Polishing. With out Water Service and Polishing. With out Water Service and Polishing. With out Water Service and Polishing. ', 1),
(10, 12, 'General Service L:1', 'assets/uploads/services/car.jpg', 700, 'Free Water Service and Polishing. Free Water Service and Polishing. Free Water Service and Polishing. Free Water Service and Polishing. ', 1),
(11, 13, 'Oil Change and General Service', 'assets/uploads/services/orig.jpg', 1500, 'Oil Change and General Service without free water service. Oil Change and General Service without free water service. Oil Change and General Service without free water service. ', 1);
(11, 13, 'Oil Change and General Service', 'assets/uploads/services/orig.jpg', 1500, 'Oil Change and General Service without free water service. Oil Change and General Service without free water service. Oil Change and General Service without free water service. ', 1),
(12, 13, 'Oil Change and General Service', 'assets/uploads/services/Audi-r8.jpg', 580, 'Oil Change and General Service', 1);
-- --------------------------------------------------------
......@@ -285,11 +333,11 @@ CREATE TABLE `mechanic` (
--
INSERT INTO `mechanic` (`id`, `mechanic_id`, `shop_id`, `first_name`, `last_name`, `email_id`, `phone`, `address`, `city`, `state`, `licence`, `licence_number`, `licence_exp_date`, `location`, `location_lat`, `location_lng`, `start_time`, `end_time`) VALUES
(1, 2, 0, 'Tobin', 'Thomas', '[email protected]', '9995559194', 'Techware Software Solution', 'Ernakulam', 'Kerala', 'assets/uploads/services/1546929651_1523012036_hj.jpg', 'LI000515456', '01/29/2019', 'FL, USA', '27.6648274', '-81.5157535', '10:00', '17:00'),
(5, 11, 0, 'kjo', 'kjo', 'tobin.techw[email protected]', '34653456344456', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1544091718_sniper.jpg', 'dfrgdersgt', '12/13/2018', 'Fort Lauderdale, FL, USA', '26.1224386', '-80.1373174', '06:30', '13:55'),
(6, 12, 0, 'Driver', 'john', 'tobin[email protected]', '9995551234', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1544091568_1523012036_hj.jpg', 'LI00051545', '12/25/2018', NULL, NULL, NULL, NULL, NULL),
(7, 13, 1, 'Jensa', 'Jose', '[email protected]', '9995559856', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1546851554_1523012036_hj.jpg', 'LI0005154', '01/30/2019', 'Grand Rapids, MI, USA', '42.9633599', '-85.6680863', NULL, NULL),
(8, 14, 0, 'Tobin', 'Thomas', 'tobin.techwarr4rt[email protected]', '9934534594', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1546929755_1523012036_hj1.jpg', 'LI000515456', '01/29/2019', 'J K O\'Donnell\'s, West Wayne Street, Fort Wayne, IN, USA', '41.0780191', '-85.1402719', '10:00', '17:00');
(1, 2, 0, 'ol', 'lk', '[email protected]', '9995559194', 'Techware Software Solution', 'Ernakulam', 'Kerala', 'assets/uploads/services/1546929651_1523012036_hj.jpg', 'LI000515456', '01/29/2019', 'FL, USA', '27.6648274', '-81.5157535', '10:00', '17:00'),
(5, 11, 0, 'uiou', 'ouji8o', 'lnkjl[email protected]', '34653456344456', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1544091718_sniper.jpg', 'dfrgdersgt', '12/13/2018', 'Fort Lauderdale, FL, USA', '26.1224386', '-80.1373174', '06:30', '13:55'),
(6, 12, 0, 'Driver', 'john', '5545[email protected]', '9995551234', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1544091568_1523012036_hj.jpg', 'LI00051545', '12/25/2018', NULL, NULL, NULL, NULL, NULL),
(7, 13, 0, 'Jensa', 'Jose', '[email protected]', '9995559856', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1546851554_1523012036_hj.jpg', 'LI0005154', '01/30/2019', 'Grand Rapids, MI, USA', '42.9633599', '-85.6680863', '08:00', '20:00'),
(8, 14, 0, 'Driver', 'jio', 'tobin.techwar[email protected]', '9934534594', 'Techware', 'Aiea', 'Hawaii', 'assets/uploads/services/1546929755_1523012036_hj1.jpg', 'LI000515456', '01/29/2019', 'J K O\'Donnell\'s, West Wayne Street, Fort Wayne, IN, USA', '41.0780191', '-85.1402719', '10:00', '17:00');
-- --------------------------------------------------------
......@@ -370,7 +418,7 @@ CREATE TABLE `setting` (
--
INSERT INTO `setting` (`id`, `title`, `title_short`, `site_logo`, `fav_icon`, `country_flag`, `currency`, `smtp_host`, `smtp_username`, `smtp_password`, `google_api_key`, `vin_audit_url`, `vin_audit_api`) VALUES
(1, 'd-Car Fixers', 'd-CarFixers', 'assets/uploads/services/1539680946_1523012036_hj.jpg', 'assets/uploads/services/1539680946_1523540473_guenstig_reifen.png', 'US', 'USD', '[email protected]', 'AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM1', 'Golden_1234', 'AIzaSyCcc-YDSJyDpehNE6qfntfWpEQ4uS4aq6A', 'https://specifications.vinaudit.com/getspecifications.php', 'VA_DEMO_KEY');
(1, 'Dcarfixxers', 'Dcar', 'assets/uploads/services/1549257477_Twitch_KingpinSkin_old2_HD.jpg', 'assets/uploads/services/1549257477_sniper.jpg', 'US', 'USD', '[email protected]', 'AIzaSyC9JX3BZZfx2S6GQieC_PqjuJdUbZ7_wyM1', 'Golden_1234', 'AIzaSyCcc-YDSJyDpehNE6qfntfWpEQ4uS4aq6A', 'https://specifications.vinaudit.com/getspecifications.php', 'VA_DEMO_KEY');
--
-- Indexes for dumped tables
......@@ -383,6 +431,12 @@ ALTER TABLE `admin_users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `authtable`
--
ALTER TABLE `authtable`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
......@@ -401,6 +455,12 @@ ALTER TABLE `customer_vehicle`
ADD PRIMARY KEY (`customer_veh_id`);
--
-- Indexes for table `custom_quote`
--
ALTER TABLE `custom_quote`
ADD PRIMARY KEY (`custom_id`);
--
-- Indexes for table `forgot_password_link`
--
ALTER TABLE `forgot_password_link`
......@@ -453,6 +513,12 @@ ALTER TABLE `admin_users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `authtable`
--
ALTER TABLE `authtable`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
......@@ -462,13 +528,19 @@ ALTER TABLE `bookings`
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `customer_id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
MODIFY `customer_id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `customer_vehicle`
--
ALTER TABLE `customer_vehicle`
MODIFY `customer_veh_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;
MODIFY `customer_veh_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63;
--
-- AUTO_INCREMENT for table `custom_quote`
--
ALTER TABLE `custom_quote`
MODIFY `custom_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `forgot_password_link`
......@@ -486,7 +558,7 @@ ALTER TABLE `issues`
-- AUTO_INCREMENT for table `issues_category`
--
ALTER TABLE `issues_category`
MODIFY `issue_cat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
MODIFY `issue_cat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `mechanic`
......
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