Commit 9061518e by Jansa Jose

Merge branch 'master' into 'dev_production'

Master See merge request !116
parents f24cb907 8e4c965b
......@@ -7,12 +7,10 @@ class Bookings extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Booking_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function listBookings($mechanic_id = ''){
if(!empty($mechanic_id)){
$mechanic_id = (!is_numeric($mechanic_id))?decode_param($mechanic_id):$mechanic_id;
......@@ -28,31 +26,25 @@ class Bookings extends CI_Controller {
} else {
$mechanic_id = $this->session->userdata('id');
}
$template['page'] = 'Bookings/list-booking';
$template['pTitle'] = "View Bookings";
$template['pDescription'] = "View and Manage Bookings";
$template['menu'] = "Bookings Management";
$template['smenu'] = "View Bookings";
$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/'.$mechanic_id));
}
$booking_id = decode_param($booking_id);
$status = $this->Booking_model->changeStatus($booking_id,$status);
if(!$status){
......@@ -70,7 +62,6 @@ class Bookings extends CI_Controller {
$booking_id = decode_param($_POST['booking_id']);
$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;
......@@ -82,11 +73,9 @@ class Bookings extends CI_Controller {
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;
}
......@@ -112,13 +101,11 @@ class Bookings extends CI_Controller {
if(empty($bookingData)){
return;
}
$header = array('Booking ID','Name','Current Milage','Service Free','Scheduled Date','Scheduled Time','Customer Phone','Customer Mail','Car Name','Car Model','Car Model Year','Car Location','Selected Issue','Status','Mechanic Name');
$file = 'bookData_'.time().'.csv';
$fpoint = fopen('php://memory', 'w');
fputcsv($fpoint, $header, ',');
foreach($bookingData AS $mechanic){
$new = array();
$bookData = $this->Booking_model->getMechBookings($mechanic_id,$mechanic->booking_id,'0,1,3,4');
......@@ -134,7 +121,6 @@ class Bookings extends CI_Controller {
case '4': $status = 'Cancelled';break;
case '5': $status = 'Payment Processing';break;
}
$data = array();
$data[] = $mechanic->booking_id;
$data[] = $bookData->custFirstName.' '.$mechanic->custLastName;
......@@ -153,7 +139,6 @@ class Bookings extends CI_Controller {
if($bookData->status == '1'){
$data[] = $bookData->mechanic_data[0]->first_name.' '.$bookData->mechanic_data[0]->last_name;
}
fputcsv($fpoint, $data, ',');
}
fseek($fpoint, 0);
......
......@@ -19,7 +19,6 @@ class Brand extends CI_Controller {
$template['pDescription'] = "Add Brand";
$template['menu'] = "Brand Management";
$template['smenu'] = "View Brands";
$template['brand_data'] = $this->Brand_model->getbrand();
$this->load->view('template',$template);
}
......@@ -30,7 +29,6 @@ class Brand extends CI_Controller {
$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);
}
......@@ -60,7 +58,6 @@ class Brand extends CI_Controller {
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
......@@ -74,13 +71,11 @@ class Brand extends CI_Controller {
$_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');
......@@ -98,13 +93,11 @@ class Brand extends CI_Controller {
$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);
......@@ -126,7 +119,6 @@ class Brand extends CI_Controller {
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
......@@ -137,13 +129,11 @@ class Brand extends CI_Controller {
$_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');
......
......@@ -8,11 +8,9 @@ class Customer extends CI_Controller {
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Customer_model');
$this->load->model('Vehicle_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
if($this->session->userdata['user_type'] != 1){
redirect(base_url());
}
......@@ -20,10 +18,8 @@ class Customer extends CI_Controller {
public function addCustomerUser(){
$template['page'] = 'Customer/add-customer-user';
$template['pTitle'] = "Add New Customer";
$template['pDescription'] = "Create New Customer";
$template['menu'] = "Customer Management";
$template['smenu'] = "Add Customer";
$template['veh_data']['make'] = $this->Vehicle_model->getVehBrand('',1);
......@@ -33,13 +29,10 @@ class Customer extends CI_Controller {
public function listCustomerUsers(){
$template['page'] = 'Customer/list-customer-users';
$template['pTitle'] = "View Customers";
$template['pDescription'] = "View and Manage Customers";
$template['menu'] = "Customer Management";
$template['smenu'] = "View Customers";
$template['customerData'] = $this->Customer_model->getCustomer();
$this->load->view('template',$template);
}
......@@ -101,7 +94,6 @@ class Customer extends CI_Controller {
}
$saved_vehicles = (!empty($_POST['saved_vehicles']))?implode(',',$_POST['saved_vehicles']):'';
unset($_POST['saved_vehicles']);
$status = $this->Customer_model->createCustomer($_POST,$saved_vehicles);
if($status == 1){
$flashMsg['class'] = 'success';
......@@ -121,7 +113,6 @@ class Customer extends CI_Controller {
public function calculateAge($birthDate = ''){
if(empty($birthDate))
return;
$birthDate = explode("/", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
......@@ -163,21 +154,16 @@ class Customer extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Customer/listCustomerUsers'));
}
$template['page'] = 'Customer/add-customer-user';
$template['menu'] = "Customer Management";
$template['smenu'] = "Edit Customer";
$template['pDescription'] = "Edit Customer Details";
$template['pTitle'] = "Edit Customer";
$template['customer_id'] = $customer_id;
$template['veh_data']['make'] = $this->Vehicle_model->getVehBrand('',1);
$template['veh_data']['model'] = $this->Vehicle_model->getVehModel('',1);
$customer_id = decode_param($customer_id);
$template['customer_data']=$this->Customer_model->getCustomer(array('customer_id'=>$customer_id));
$template['customer_data'] = $this->Customer_model->getCustomer(array('customer_id'=>$customer_id));
$this->load->view('template',$template);
}
......@@ -188,7 +174,6 @@ class Customer extends CI_Controller {
redirect(base_url('Customer/listCustomerUsers'));
}
$customerIdDec = decode_param($customer_id);
$err = 0;
$errMsg = '';
if(!isset($_POST) || empty($_POST)){
......@@ -219,7 +204,6 @@ class Customer extends CI_Controller {
$err = 1;
$errMsg = 'Provide an Address';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
......@@ -235,7 +219,6 @@ class Customer extends CI_Controller {
}
$saved_vehicles = (!empty($_POST['saved_vehicles']))?implode(',',$_POST['saved_vehicles']):'';
unset($_POST['saved_vehicles']);
$status = $this->Customer_model->updateCustomer($customerIdDec,$_POST,$saved_vehicles);
if($status == 1){
$flashMsg['class'] = 'success';
......@@ -254,19 +237,15 @@ class Customer extends CI_Controller {
public function exportCustomerData(){
$custData = $this->Customer_model->getCustomer();
if(empty($custData)){
return;
}
$header = array('ID','Name','Phone','Email','Address','Date Of Birth','Status','Cars');
$file = 'custData_'.time().'.csv';
$fpoint = fopen('php://memory', 'w');
fputcsv($fpoint, $header, ',');
foreach($custData AS $customer){
$carData = $this->Customer_model->getCustomer(array('customer_id'=>$customer->customer_id));
$cars = '';
$data = array();
if(!empty($carData->vehicle_data)){
......@@ -283,7 +262,6 @@ class Customer extends CI_Controller {
$data[] = $customer->date_of_birth;
$data[] = ($customer->status == 1)?'Active':'De-active';
$data[] = $cars;
fputcsv($fpoint, $data, ',');
}
fseek($fpoint, 0);
......
......@@ -17,7 +17,6 @@ class Dashboard extends CI_Controller {
$template['page'] = 'Dashboard/Dashboard';
$template['page_desc'] = "Control Panel";
$template['page_title'] = "Dashboard";
$template['bookingCount'] = $this->Dashboard_model->getBookingCount();
$template['shopCount'] = $this->Dashboard_model->getMechShpCount();
$template['completeBukngCnt'] = $this->Dashboard_model->getCompletedBookingCount();
......@@ -27,7 +26,6 @@ class Dashboard extends CI_Controller {
$template['customerCount'] = $this->Dashboard_model->getCustomerCount();
$template['productCount'] = $this->Dashboard_model->getProductCount();
$template['productSold'] = $this->Dashboard_model->getProductSoldCount();
$this->load->view('template',$template);
}
......
......@@ -7,7 +7,6 @@ class ImportData extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Import_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
......@@ -20,8 +19,7 @@ class ImportData extends CI_Controller {
$template['pTitle'] = "Import Data";
$template['import_id'] = '';
$template['pDescription'] = "Import Data";
$this->load->view('template',$template);
$this->load->view('template',$template);
}
public function importCsvData(){
......@@ -30,13 +28,11 @@ class ImportData extends CI_Controller {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('ImportData/import_data'));
}
if(!isset($_FILES) || empty($_FILES)){
$flashMsg = array('message'=>'Select a File to Upload','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('ImportData/import_data'));
}
if($_POST['import_id'] == '1'){
$this->addMechanics($_FILES);
}else if($_POST['import_id'] == '2'){
......@@ -50,7 +46,6 @@ class ImportData extends CI_Controller {
$this->load->model('Mechanic_model');
if(isset($files) && !empty($files)){
$filename = $files["file"]["tmp_name"];
if(pathinfo($files["file"]['name'], PATHINFO_EXTENSION) == "csv"){
$count = 0;
$respMsg = '';
......@@ -65,7 +60,6 @@ class ImportData extends CI_Controller {
if($count == 1){
continue;
}
if($err == 0 && (!isset($mechData[0]) || empty($mechData[0]))){
$err = 1;
$errMsg = 'Provide a First Name';
......@@ -109,19 +103,16 @@ class ImportData extends CI_Controller {
$err = 1;
$errMsg = 'Provide proper Working Hours';
}
$fnLocation = getLocationLatLng($mechData[9]);
if(empty($fnLocation)){
$err = 1;
$errMsg = 'Provide a Valid Functional Area';
}
if($err == 1){
$respError++;
$respMsg .= '<br>ERROR : Row-'.($count-1).', '.$errMsg;
continue;
}
$mechData[2] = md5($mechData[2]);
$new = array(
'first_name'=>$mechData[0],
......@@ -180,10 +171,8 @@ class ImportData extends CI_Controller {
public function addCustomers($files=array()){
$this->load->model('Customer_model');
if(isset($files) && !empty($files)){
$filename=$files["file"]["tmp_name"];
if(pathinfo($files["file"]['name'], PATHINFO_EXTENSION) =="csv"){
$count = 0;
$respMsg = '';
......@@ -198,7 +187,6 @@ class ImportData extends CI_Controller {
if($count == 1){
continue;
}
if($err == 0 && (!isset($custData[0]) || empty($custData[0]))){
$err = 1;
$errMsg = 'Provide a First Name';
......@@ -227,13 +215,11 @@ class ImportData extends CI_Controller {
$err = 1;
$errMsg = 'Provide an Address';
}
if($err == 1){
$respError++;
$respMsg .= '<br>ERROR : Row-'.($count-1).', '.$errMsg;
continue;
}
$custData[6] = md5($custData[6]);
$new = array(
'first_name'=>$custData[0],
......@@ -246,7 +232,6 @@ class ImportData extends CI_Controller {
'profile_image'=>'',
);
$status = $this->Customer_model->createCustomer($new);
if($status == 1){
$respSuccess++;
}else if($status == 2){
......@@ -257,11 +242,9 @@ class ImportData extends CI_Controller {
$respMsg .= '<br>ERROR : Row-'.($count-1).', Phone Number already in use. ';
}
}
if($count > 0){
$respMsg = "Successfully Uploaded File with, ".
$respSuccess.": Success & ".$respError.": Errors.<br>".$respMsg;
$flashMsg = array('message'=>$respMsg,'class'=>($respError==$count-1)?'error':'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('ImportData/import_data'));
......@@ -275,10 +258,8 @@ class ImportData extends CI_Controller {
}
public function addProduct($files =array()){
if(isset($files) && !empty($files)){
$filename=$files["file"]["tmp_name"];
if(pathinfo($files["file"]['name'], PATHINFO_EXTENSION) =="csv"){
$count = 0;
$respMsg = '';
......@@ -293,7 +274,6 @@ class ImportData extends CI_Controller {
if($count == 1){
continue;
}
if($err == 0 && (!isset($prdData[0]) || empty($prdData[0]))){
$err = 1;
$errMsg = 'Provide a Product Name';
......@@ -334,13 +314,11 @@ class ImportData extends CI_Controller {
$err = 1;
$errMsg = 'About Produt';
}
if($err == 1){
$respError++;
$respMsg .= '<br>ERROR : Row-'.($count-1).', '.$errMsg;
continue;
}
$brand_id = $this->Import_model->checkBrand($prdData[1]);
$cardetail_id = $this->Import_model->checkCardetails($prdData[5],$prdData[6],$prdData[7]);
$new = array(
......@@ -364,7 +342,6 @@ class ImportData extends CI_Controller {
if($count > 0){
$respMsg = "Successfully Uploaded File with, ".
$respSuccess.": Success & ".$respError.": Errors.<br>".$respMsg;
$flashMsg = array('message'=>$respMsg,'class'=>($respError==$count-1)?'error':'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('ImportData/import_data'));
......@@ -376,7 +353,5 @@ class ImportData extends CI_Controller {
}
}
}
}
......@@ -7,7 +7,6 @@ class Issue extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Issue_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
......@@ -19,7 +18,6 @@ class Issue extends CI_Controller {
$template['smenu'] = 'Add Issue';
$template['pTitle'] = "Add Issue";
$template['pDescription'] = "Create New Issue";
$this->load->view('template',$template);
}
......@@ -29,7 +27,6 @@ class Issue extends CI_Controller {
$template['smenu'] = 'View Issues';
$template['pTitle'] = "View Issues";
$template['pDescription'] = "View and Manage Issues";
$template['issue_data'] = $this->Issue_model->getIssues('',1);
$this->load->view('template',$template);
}
......@@ -90,7 +87,6 @@ class Issue extends CI_Controller {
if($err == 0){
$typ = 0;
$insertSubTyp = array();
for ($typ = 0; $typ < count($_POST['issue_category']); $typ++) {
if(!isset($_POST['issue_category'][$typ]) ||
!isset($_POST['default_description'][$typ]) ||
......@@ -104,7 +100,6 @@ class Issue extends CI_Controller {
$_FILES['file']['size'] = $files['issue_cat_image']['size'][$typ];
$_FILES['file']['error'] = $files['issue_cat_image']['error'][$typ];
$_FILES['file']['tmp_name'] = $files['issue_cat_image']['tmp_name'][$typ];
if(!$this->upload->do_upload('file')){
$err = 1;
$errMsg = $this->upload->display_errors();
......@@ -112,7 +107,6 @@ class Issue extends CI_Controller {
}
$imgData = $this->upload->data();
$image_name = "assets/uploads/services/".$imgData['file_name'];
$insertSubTyp[] = array('issue_category' => $_POST['issue_category'][$typ],
'issue_cat_image' => $image_name,'status'=>'1',
'default_service_fee' => $_POST['default_service_fee'][$typ],
......@@ -121,7 +115,6 @@ class Issue extends CI_Controller {
unset($_POST['issue_category']);
unset($_POST['default_service_fee']);
unset($_POST['default_description']);
if($this->upload->do_upload('issue_image')){
$imgData = $this->upload->data();
$_POST['issue_image'] = "assets/uploads/services/".$imgData['file_name'];
......@@ -153,13 +146,11 @@ class Issue extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Issue/viewIssues'));
}
$template['page'] = 'Issue/issueForm';
$template['menu'] = 'Issue Management';
$template['smenu'] = 'Edit Issue';
$template['pTitle'] = "Edit Issue";
$template['pDescription'] = "Update Issue Data";
$template['issue_id'] = encode_param($issue_id);
$template['issue_data'] = $this->Issue_model->getIssueDetails($issue_id,1);
if(empty($template['issue_data'])){
......@@ -174,7 +165,6 @@ class Issue extends CI_Controller {
$errMsg = 'Something went wrong, please try again..!';
$this->load->library('upload',set_upload_service("assets/uploads/services"));
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($issue_id) || !is_numeric($issue_id = decode_param($issue_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Issue/viewIssues'));
......@@ -186,7 +176,6 @@ class Issue extends CI_Controller {
$err = 1;
$errMsg = 'Provide Issue Short Discription';
}
$insertSubTyp = array();
$updateSubTyp = array();
$issue_data = array('issue'=>$_POST['issue']);
......@@ -218,7 +207,6 @@ class Issue extends CI_Controller {
}
}
}
if(isset($_POST['issue_category']) && count($_POST['issue_category']) > 0 &&
isset($_POST['default_description']) && count($_POST['default_description']) > 0 &&
isset($_POST['default_service_fee']) && count($_POST['default_service_fee']) > 0 &&
......@@ -229,9 +217,7 @@ class Issue extends CI_Controller {
count($_POST['issue_category']) == count($_FILES['issue_cat_image']['name'])){
$typ = 0;
$files = $_FILES;
for ($typ = 0; $typ < count($_POST['issue_category']); $typ++) {
if(!isset($_POST['issue_category'][$typ]) ||
!isset($_POST['default_description'][$typ]) ||
!isset($_POST['default_service_fee'][$typ]) ||
......@@ -245,13 +231,11 @@ class Issue extends CI_Controller {
$_FILES['file']['size'] = $files['issue_cat_image']['size'][$typ];
$_FILES['file']['error'] = $files['issue_cat_image']['error'][$typ];
$_FILES['file']['tmp_name'] = $files['issue_cat_image']['tmp_name'][$typ];
if(!$this->upload->do_upload('file')){
continue;
}
$imgData = $this->upload->data();
$image_name = "assets/uploads/services/".$imgData['file_name'];
$insertSubTyp[] = array('issue_category' => $_POST['issue_category'][$typ],
'issue_cat_image' => $image_name,'status'=>'1',
'default_service_fee' => $_POST['default_service_fee'][$typ],
......@@ -259,20 +243,17 @@ class Issue extends CI_Controller {
'issue_id'=>$issue_id);
}
}
if(isset($_FILES['issue_image']) && !empty($_FILES['issue_image']['name']) &&
$this->upload->do_upload('issue_image')){
$imgData = $this->upload->data();
$issue_data['issue_image'] = "assets/uploads/services/".$imgData['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Issue/editIssue/'.encode_param($issue_id)));
}
$status = $this->Issue_model->updateIssue($issue_id,$issue_data,$updateSubTyp,$insertSubTyp);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated Issue Details..!','class'=>'success');
......@@ -288,13 +269,11 @@ class Issue extends CI_Controller {
if($this->session->userdata('user_type') == 1){
redirect(base_url('Issue/viewIssues'));
}
$template['page'] = 'Issue/issueMapping';
$template['menu'] = 'Issue Management';
$template['smenu'] = 'Issue Mapping';
$template['pTitle'] = "Issue Mapping";
$template['pDescription'] = "Creating Custom Issues";
$mechanic_id = $this->session->userdata('id');
$template['issue_data'] = $this->Issue_model->getUnMappedIssues($mechanic_id,1);
$template['mechanic_id'] = encode_param($mechanic_id);
......@@ -324,7 +303,6 @@ class Issue extends CI_Controller {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Issue/issueMapping'));
}
$status = $this->Issue_model->addMechIssue($custom_issue);
if($status == 1){
$flashMsg =array('message'=>'Successfully Created..!','class'=>'success');
......@@ -357,7 +335,6 @@ class Issue extends CI_Controller {
$template['smenu'] = 'Manage Mapped Issues';
$template['pTitle'] = "Manage Mapped Issues";
$template['pDescription'] = "View and Manage Mapped Issues";
$template['mechanic_id'] = $mechanic_id;
$template['mechanic_data'] = $mechanic_data;
$template['mechanicIssueData'] = $this->Issue_model->getMechanicIssues($mechanic_id,'',1);
......@@ -392,12 +369,10 @@ class Issue extends CI_Controller {
$template['smenu'] = 'Edit Mechanic Issue';
$template['pTitle'] = "Edit Mechanic Issue Management";
$template['pDescription'] = "Update Custom Mechanic Issue Data";
$template['issue_id'] = encode_param($issue_id);
$template['mechanic_id'] = encode_param($mechanic_id);
$template['issue_data'] = $this->Issue_model->getIssues('',1);
$template['mechanicIssueData'] = $this->Issue_model->getMechanicIssues($mechanic_id,$issue_id,1);
if(empty($template['mechanicIssueData']) || !isset($template['mechanicIssueData'][$issue_id])){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Issue/viewMappedIssues/'.encode_param($mechanic_id)));
......@@ -425,7 +400,6 @@ class Issue extends CI_Controller {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url($editPage));
}
$status = $this->Issue_model->updateMechIssue($_POST['mechanic_id'],$_POST['issue_id'],$custom_issue);
if($status == 1){
$flashMsg =array('message'=>'Successfully Created..!','class'=>'success');
......@@ -436,7 +410,6 @@ class Issue extends CI_Controller {
redirect($editPage);
}
}
function getIssueDetails(){
$resArr = array('status'=>0);
......@@ -445,11 +418,9 @@ class Issue extends CI_Controller {
echo json_encode($resArr);exit;
}
$issue_data = $this->Issue_model->getIssueDetails($issue_id);
if(empty($issue_data)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $issue_data;
echo json_encode($resArr);exit;
......@@ -459,7 +430,6 @@ class Issue extends CI_Controller {
if(empty($mapping_data) || $mapping_type == ''){
return 0;
}
$custData = array();
foreach($mapping_data['issue_cat_ids'] AS $type_ids) {
$issArr = array('issue_id'=>$mapping_data['issue_id'],
......@@ -468,7 +438,6 @@ class Issue extends CI_Controller {
if($mapping_type == 1 &&
isset($mapping_data['default_service_fee_'.$type_ids]) &&
isset($mapping_data['default_description_'.$type_ids])){
$issArr['custom_description'] = $mapping_data['default_description_'.$type_ids];
$issArr['custom_service_fee'] = $mapping_data['default_service_fee_'.$type_ids];
}
......
......@@ -9,7 +9,6 @@ class Login extends CI_Controller {
$this->load->helper(array('form'));
$this->load->model('login_model');
$this->load->helper('security');
if($this->session->userdata('logged_in')) {
redirect(base_url());
}
......@@ -21,7 +20,6 @@ class Login extends CI_Controller {
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','trim|required');
$this->form_validation->set_rules('password','Password','trim|required|callback_checkUsrLogin');
if($this->form_validation->run() == TRUE) {
redirect(base_url());
}
......@@ -32,7 +30,6 @@ class Login extends CI_Controller {
function checkUsrLogin($password) {
$username = $this->input->post('username');
$result = $this->login_model->login($username, md5($password));
if($result && !empty($result)) {
$this->session->set_userdata('id',$result->id);
$this->session->set_userdata('user',$result);
......
......@@ -7,7 +7,6 @@ class Mailtemplate extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Mailtemplate_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
......@@ -20,14 +19,12 @@ class Mailtemplate extends CI_Controller {
}
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);
}
......@@ -39,7 +36,6 @@ class Mailtemplate extends CI_Controller {
$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']);
}
......@@ -55,7 +51,6 @@ class Mailtemplate extends CI_Controller {
if(!isset($_POST['invoice_template']) || empty($_POST['invoice_template'])){
unset($_POST['invoice_template']);
}
$status = $this->Mailtemplate_model->updateNotif($_POST);
if($status){
$flashMsg['class'] = 'success';
......
......@@ -7,7 +7,6 @@ class Mechanic extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Mechanic_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
......@@ -21,21 +20,18 @@ class Mechanic extends CI_Controller {
$template['smenu'] = 'Add Mechanic';
$template['pTitle'] = "Add Mechanic";
$template['pDescription'] = "Create New Mechanic";
$template['shop_data'] = $this->Shop_model->getShop();
$this->load->view('template',$template);
}
public function viewMechanics(){
$this->load->model('Shop_model');
$template['page'] = 'Mechanic/viewMechanic';
$template['menu'] = 'Mechanic Management';
$template['smenu'] = 'View Mechanics';
$template['pTitle'] = "View Mechanics";
$template['pDescription'] = "View and Manage Mechanics";
$template['page_head'] = "Mechanic Management";
$template['user_data'] = $this->Mechanic_model->getMechanic('',1);
$this->load->view('template',$template);
}
......@@ -48,11 +44,9 @@ class Mechanic extends CI_Controller {
}
$view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:0;
$mechData = $this->Mechanic_model->getMechanic($mechanic_id,$view_all);
if(empty($mechData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $mechData;
echo json_encode($resArr);exit;
......@@ -122,13 +116,11 @@ class Mechanic extends CI_Controller {
$err = 1;
$errMsg = 'Provide proper Working Hours';
}
$fnLocation = getLocationLatLng($_POST['location']);
if(empty($fnLocation)){
$err = 1;
$errMsg = 'Provide a Valid Functional Area';
}
if($err == 0){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
......@@ -141,7 +133,6 @@ class Mechanic extends CI_Controller {
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
$_POST['licence'] = '';
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
......@@ -160,7 +151,6 @@ class Mechanic extends CI_Controller {
$_POST['password'] = md5($_POST['password']);
$_POST['location_lat'] = $fnLocation['lat'];
$_POST['location_lng'] = $fnLocation['lng'];
$status = $this->Mechanic_model->addMechanic($_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
......@@ -191,13 +181,11 @@ class Mechanic extends CI_Controller {
redirect(base_url('Mechanic/viewMechanics'));
}
$this->load->model('Shop_model');
$template['page'] = 'Mechanic/mechanicForm';
$template['menu'] = 'Mechanic Management';
$template['smenu'] = 'Edit Mechanic';
$template['pTitle'] = "Edit Mechanics";
$template['pDescription'] = "Update Mechanic Data";
$template['user_data'] = $this->Mechanic_model->getMechanic($mechanic_id,1);
$template['mechanic_id'] = encode_param($mechanic_id);
$this->load->view('template',$template);
......@@ -248,13 +236,11 @@ class Mechanic extends CI_Controller {
$err = 1;
$errMsg = 'Provide proper Working Hours';
}
$fnLocation = getLocationLatLng($_POST['location']);
if(empty($fnLocation)){
$err = 1;
$errMsg = 'Provide a Valid Functional Area';
}
if($err == 0){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
......@@ -264,7 +250,6 @@ class Mechanic extends CI_Controller {
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['licence']['name'];
......@@ -279,7 +264,6 @@ class Mechanic extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Mechanic/editMechanics/'.$mechanic_id));
}
$_POST['location_lat'] = $fnLocation['lat'];
$_POST['location_lng'] = $fnLocation['lng'];
$status = $this->Mechanic_model->updateMechanic(decode_param($mechanic_id),$_POST);
......@@ -312,13 +296,10 @@ class Mechanic extends CI_Controller {
}
$header = array('ID','Username','Name','Phone','Email','Address','City','State','Licence Number','Licence Exp Date','Start Time','End Time','Status','Shop Id','Shop Name','Shop Address',
'Shop Phone','Shop Email');
$file = 'mechData_'.time().'.csv';
$fpoint = fopen('php://memory', 'w');
fputcsv($fpoint, $header, ',');
foreach($mechData AS $mechanic){
$data = array();
$data[] = $mechanic->mechanic_id;
$data[] = $mechanic->username;
......
......@@ -7,21 +7,17 @@ class Orders extends CI_Controller {
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);
}
......@@ -34,7 +30,6 @@ class Orders extends CI_Controller {
$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;
......@@ -49,7 +44,6 @@ class Orders extends CI_Controller {
echo json_encode($return_arr);exit;
}
$status = $this->Order_model->changeOrderStatus($_POST);
$return_arr['status'] = $status;
echo json_encode($return_arr);exit;
}
......@@ -59,17 +53,13 @@ class Orders extends CI_Controller {
if(empty($orderData)){
return;
}
$header = array('Order ID','Name','Product Name','Brand Name','Short Description','Quantity','Amount','Status','Expected Delivery','Delivered');
$file = 'orderData_'.time().'.csv';
$fpoint = fopen('php://memory', 'w');
fputcsv($fpoint, $header, ',');
foreach($orderData AS $order){
$new = array();
$odrData = $this->Order_model->getOrderDetails($order->order_id);
$data = array();
$data[] = $odrData->format_order_id;
$data[] = $odrData->customer_name;
......
......@@ -9,7 +9,6 @@ class Product extends CI_Controller {
$this->load->model('Brand_model');
$this->load->model('Product_model');
$this->load->model('Vehicle_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
......@@ -22,7 +21,6 @@ class Product extends CI_Controller {
$template['menu'] = "Product Management";
$template['smenu'] = "View Product";
$template['brand_id'] = '';
$template['product_data'] = $this->Product_model->getProduct();
$template['veh_data']['make'] = $this->Vehicle_model->getVehBrand('',1);
$template['veh_data']['model'] = $this->Vehicle_model->getVehModel('',1);
......@@ -36,7 +34,6 @@ class Product extends CI_Controller {
$template['smenu'] = 'View Product';
$template['pTitle'] = "View Product";
$template['pDescription'] = "View and Manage Product";
$mechanic_id = ($this->session->userdata['user_type']==2)?$this->session->userdata['id']:'';
$template['product_data'] = $this->Product_model->getProduct('',1,$mechanic_id);
$this->load->view('template',$template);
......@@ -82,14 +79,12 @@ class Product extends CI_Controller {
$err = 1;
$errMsg = 'Provide a Amount';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addproduct'));
}
$_POST['created_by']=($this->session->userdata['user_type']==2)?$this->session->userdata['id']:0;
$product_id = $this->Product_model->addProduct($_POST);
if($product_id){
$evtMediaData = array();
......@@ -103,7 +98,6 @@ class Product extends CI_Controller {
$_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')){
......@@ -132,20 +126,17 @@ class Product extends CI_Controller {
$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['veh_data']['make'] = $this->Vehicle_model->getVehBrand('',1);
$template['product_image'] = $this->Product_model->getProductImage($product_id);
$template['brand_id'] = $template['product_data']->brand_id;
$this->load->view('template',$template);
}
......@@ -180,7 +171,6 @@ class Product extends CI_Controller {
$err = 1;
$errMsg = 'Provide a Amount';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
......@@ -202,7 +192,6 @@ class Product extends CI_Controller {
$_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')){
......@@ -215,7 +204,6 @@ class Product extends CI_Controller {
$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);
......@@ -226,16 +214,14 @@ class Product extends CI_Controller {
}
}
public function getProductData(){
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']))){
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;
......@@ -243,23 +229,19 @@ class Product extends CI_Controller {
echo json_encode($return_arr);exit;
}
public function exportProductData(){
$mechanic_id = ($this->session->userdata['user_type']==2)?$this->session->userdata['id']:'';
$productData = $this->Product_model->getProduct('',1,$mechanic_id);
if(empty($productData)){
return;
}
$header = array('Product ID','Product Name','Brand Name','Short Description','Part ID','Vehicle Model','Amount','Status');
$file = 'productData_'.time().'.csv';
$fpoint = fopen('php://memory', 'w');
fputcsv($fpoint, $header, ',');
foreach($productData AS $product){
$data = array();
$status = 'Active';
$status = 'Active';
switch ($product->status) {
case '0': $status = 'Inactive';break;
case '1': $status = 'Active ';break;
......
......@@ -8,7 +8,6 @@ class Settings extends CI_Controller {
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Settings_model');
$this->load->model('Dashboard_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
......@@ -23,13 +22,10 @@ class Settings extends CI_Controller {
public function index() {
$template['page'] = 'Settings/viewSettings';
$template['menu'] = "Site Settings";
$template['sub_menu'] = "Change Settings";
$template['page_desc'] = "Edit or View Settings";
$template['page_title'] = "Settings";
$template['data'] = $this->Settings_model->settings_viewing();
$this->load->view('template',$template);
}
......@@ -60,13 +56,10 @@ class Settings extends CI_Controller {
$_POST['fav_icon'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
$status = $this->Settings_model->update_settings($_POST);
if($status){
$flashMsg['class'] = 'success';
$flashMsg['message'] = 'Settings Successfully Updated..!';
$settings = $this->Settings_model->settings_viewing();
if(!empty($settings)){
$this->session->set_userdata('settings', $settings);
......@@ -75,6 +68,5 @@ class Settings extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Settings'));
}
}
?>
\ No newline at end of file
......@@ -7,7 +7,6 @@ class Shop extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Shop_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
......@@ -19,7 +18,6 @@ class Shop extends CI_Controller {
$template['smenu'] = 'Add Shop';
$template['pTitle'] = "Add Shop";
$template['pDescription'] = "Create New Shop";
$template['shop_data'] = $this->Shop_model->getShop();
$this->load->view('template',$template);
}
......@@ -30,7 +28,6 @@ class Shop extends CI_Controller {
$template['smenu'] = 'View Shops';
$template['pTitle'] = "View Shops";
$template['pDescription'] = "View and Manage Shops";
$template['shop_data'] = $this->Shop_model->getShop('',1);
$this->load->view('template',$template);
}
......@@ -69,13 +66,11 @@ class Shop extends CI_Controller {
$err = 1;
$errMsg = 'Provide an Address';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Shop/addShop'));
}
$status = $this->Shop_model->addShop($_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated Shop Details..!','class'=>'success');
......@@ -93,13 +88,11 @@ class Shop extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Shop/viewShops'));
}
$template['page'] = 'Shop/shopForm';
$template['menu'] = 'Shop Management';
$template['smenu'] = 'Edit Shop';
$template['pTitle'] = "Edit Shop";
$template['pDescription'] = "Update Shop Data";
$template['shop_id'] = encode_param($shop_id);
$template['shop_data'] = $this->Shop_model->getShop($shop_id,1);
$this->load->view('template',$template);
......@@ -130,13 +123,11 @@ class Shop extends CI_Controller {
$err = 1;
$errMsg = 'Provide an Address';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Shop/addShop'));
}
$status = $this->Shop_model->updateShop(decode_param($shop_id),$_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated Shop Details..!','class'=>'success');
......
......@@ -8,7 +8,6 @@ class User extends CI_Controller {
date_default_timezone_set("Asia/Kolkata");
$this->load->model('User_model');
$this->load->model('Dashboard_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
......@@ -19,11 +18,10 @@ class User extends CI_Controller {
redirect(base_url());
}
$template['shop_data'] = '';
if($this->session->userdata('user_type') == 2 && isset($this->session->userdata['mechanic_data'])
if($this->session->userdata('user_type') == 2 && isset($this->session->userdata['mechanic_data'])
&& !empty($this->session->userdata['mechanic_data'])){
$this->load->model('Shop_model');
$mechanic_data = $this->session->userdata['mechanic_data'];
if(!empty($mechanic_data->shop_id)){
$template['shop_data'] = $this->Shop_model->getShop($mechanic_data->shop_id);
}
......@@ -40,7 +38,6 @@ class User extends CI_Controller {
$this->load->model('Shop_model');
$user_id = $this->session->userdata('id');
$user_type = $this->session->userdata('user_type');
$template['page'] = 'User/editProfile';
$template['menu'] = "Profile";
$template['smenu'] = "Edit Profile";
......@@ -48,7 +45,6 @@ class User extends CI_Controller {
$template['pDescription'] = "Edit User Profile";
$template['shop_data'] = $this->Shop_model->getShop();
$template['user_data'] = $this->User_model->getUserData();
if(empty($template['user_data'])){
redirect(base_url());
}
......@@ -59,43 +55,33 @@ class User extends CI_Controller {
$user_id = $this->session->userdata('id');
$user_type = $this->session->userdata('user_type');
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($user_id)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('User/editProfile'));
}
if(isset($_FILES['profile_image']) && !empty($_FILES['profile_image'])){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$new_name = time()."_".$_FILES['profile_image']['name'];
$config['file_name'] = $new_name;
$this->upload->initialize($config);
if($this->upload->do_upload('profile_image')){
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if(isset($_FILES['licence']) && !empty($_FILES['licence'])){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$new_name = time()."_".$_FILES['licence']['name'];
$config['file_name'] = $new_name;
$this->upload->initialize($config);
if($this->upload->do_upload('licence')){
$upload_data = $this->upload->data();
$_POST['licence'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if((isset($_POST['password']) || isset($_POST['cPassword'])) &&
(!empty($_POST['password']) || !empty($_POST['cPassword']))){
if($_POST['password'] != $_POST['cPassword']){
......
......@@ -7,7 +7,6 @@ class Vehicle extends CI_Controller {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Vehicle_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
......@@ -15,9 +14,7 @@ class Vehicle extends CI_Controller {
public function vehicleSearch(){
$return_arr = array('status'=>'0');
if(!isset($_POST) || empty($_POST) || !isset($_POST['searchType']) ||
empty($_POST['searchType']) || !isset($_POST['vehLocation']) ||
empty($vehLocation = $_POST['vehLocation'])){
if(!isset($_POST) || empty($_POST) || !isset($_POST['searchType']) || empty($_POST['searchType']) || !isset($_POST['vehLocation']) || empty($vehLocation = $_POST['vehLocation'])){
echo json_encode($return_arr);exit;
}
$vehTrim = $vehEngine = '';
......@@ -27,14 +24,11 @@ class Vehicle extends CI_Controller {
if(isset($_POST['vehEngine']) && !empty($_POST['vehEngine'])){
$vehEngine = $_POST['vehEngine'];
}
$url = "";
$searchType = $_POST['searchType'];
$vehicle_data = array('car_location'=>$vehLocation);
$this->load->model('Settings_model');
$settings = $this->Settings_model->settings_viewing();
if($searchType == 1 &&
isset($_POST['vehYear']) && !empty($_POST['vehYear']) &&
isset($_POST['vehModel']) && !empty($_POST['vehModel']) &&
......@@ -42,18 +36,14 @@ class Vehicle extends CI_Controller {
$vehicle_data['car_maker'] = $_POST['vehMaker'];
$vehicle_data['car_model'] = $_POST['vehModel'];
$vehicle_data['car_model_year'] = $_POST['vehYear'];
$url = "https://specifications.vinaudit.com/v3/selections?format=json&key=".
urlencode($settings['vin_audit_api'])."&id=".urlencode($_POST['vehYear'])."_".
urlencode($_POST['vehMaker'])."_".urlencode($_POST['vehModel']);
}
else
if($searchType == 2 && isset($_POST['vehVin']) && !empty($_POST['vehVin'])){
else if($searchType == 2 && isset($_POST['vehVin']) && !empty($_POST['vehVin'])){
$vehicle_data['car_vin'] = $_POST['vehVin'];
$url = "https://specifications.vinaudit.com/v3/specifications?format=json&key=".urlencode($settings['vin_audit_api'])."&vin=".urlencode($_POST['vehVin']);
}
if(!empty($url)){
$vehData=file_get_contents($url);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
......@@ -70,23 +60,19 @@ class Vehicle extends CI_Controller {
$return_arr['status'] = 3;
echo json_encode($return_arr);exit;
}
if($searchType == 2){
$vehDetails['vehicle'] = $vehData['attributes']['year'].' '.
$vehData['attributes']['make'].' '.
$vehData['attributes']['model'].' '.
$vehData['attributes']['trim'];
$vehDetails['year'] = $vehData['attributes']['year'];
$vehDetails['make'] = $vehData['attributes']['make'];
$vehDetails['trim'] = $vehData['attributes']['trim'];
$vehDetails['model'] = $vehData['attributes']['model'];
$vehDetails['engine'] = $vehData['attributes']['engine'];
$vehicle_data['car_maker'] = $vehDetails['make'];
$vehicle_data['car_model'] = $vehDetails['model'];
$vehicle_data['car_model_year'] = $vehDetails['year'];
} else if($searchType == 1){
$vehSele = $vehData['selections'];
$vehDetails['year'] = $vehSele['years'][0]['name'];
......@@ -94,20 +80,16 @@ class Vehicle extends CI_Controller {
$vehDetails['model'] = $vehSele['years'][0]['makes'][0]['models'][0]['name'];
$vehDetails['vehicle'] = $vehDetails['year'].' '.$vehDetails['make'].' '.
$vehDetails['model'].' '.$vehTrim;
$vehDetails['trim'] = $vehTrim;
$vehDetails['engine'] = $vehEngine;
$vehicle_data['car_maker'] = $vehDetails['make'];
$vehicle_data['car_model'] = $vehDetails['model'];
$vehicle_data['car_model_year'] = $vehDetails['year'];
}
$vehicle_data['car_name'] = $vehDetails['vehicle'];
$vehicle_data['car_loc_lat'] = $lat_lng['lat'];
$vehicle_data['car_loc_lng'] = $lat_lng['lng'];
$vehicle_data['vehicle_data'] = json_encode($vehDetails);
$car_id = $this->Vehicle_model->addVehicle($vehicle_data);
if(!empty($car_id)){
$return_arr['status'] = '1';
......@@ -130,7 +112,6 @@ class Vehicle extends CI_Controller {
echo json_encode($return_arr); exit;
}
public function addVehBrand(){
$template['page'] = 'Vehicles/addBrand';
$template['pTitle'] = "Add Vehicle Brand";
......@@ -138,7 +119,6 @@ class Vehicle extends CI_Controller {
$template['menu'] = "Vehicle Brand Management";
$template['smenu'] = "View Brand";
$template['brand_id'] = '';
$template['vehBrand_data'] = $this->Vehicle_model->getVehBrand('',1);
$this->load->view('template',$template);
}
......@@ -149,7 +129,6 @@ class Vehicle extends CI_Controller {
$template['smenu'] = 'View Vehicles Brand ';
$template['pTitle'] = "View Vehicles Brand ";
$template['pDescription'] = "View and Manage Vehicles Brands";
$template['vehBrand_data'] = $this->Vehicle_model->getVehBrand('',1);
$this->load->view('template',$template);
}
......@@ -179,13 +158,11 @@ class Vehicle extends CI_Controller {
$err = 1;
$errMsg = 'Vehicle Brand is Required';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Vehicle/addVehBrand'));
}
$brand_id = $this->Vehicle_model->addBrand($_POST);
if($brand_id != '0'){
$flashMsg =array('message'=>'Successfully Updated Brand..!','class'=>'success');
......@@ -204,16 +181,13 @@ class Vehicle extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Vehicle/viewVehBrand'));
}
$template['page'] = 'Vehicles/addBrand';
$template['menu'] = 'Brand Management';
$template['smenu'] = 'Edit brand';
$template['pTitle'] = "Edit brand";
$template['pDescription'] = "Update brand Name";
$template['brand_id'] = encode_param($brand_id);
$template['vehBrand_data'] = $this->Vehicle_model->getVehBrand($brand_id,1);
$this->load->view('template',$template);
}
......@@ -233,7 +207,6 @@ class Vehicle extends CI_Controller {
$err = 1;
$errMsg = 'Vehicle Brand is Required';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
......@@ -257,7 +230,6 @@ class Vehicle extends CI_Controller {
$template['menu'] = "Vehicle Model Management";
$template['smenu'] = "View Model";
$template['model_id'] = '';
$template['vehBrand_data'] = $this->Vehicle_model->getVehBrand('',1);
$template['vehModel_data'] = $this->Vehicle_model->getVehModel('',1);
$this->load->view('template',$template);
......@@ -269,7 +241,6 @@ class Vehicle extends CI_Controller {
$template['smenu'] = 'View Vehicles Model ';
$template['pTitle'] = "View Vehicles Model ";
$template['pDescription'] = "View and Manage Vehicles Models";
$template['vehModel_data'] = $this->Vehicle_model->getVehModel('',1);
$this->load->view('template',$template);
}
......@@ -302,13 +273,11 @@ class Vehicle extends CI_Controller {
$err = 1;
$errMsg = 'Vehicle Model is Required';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Vehicle/addVehModel'));
}
$model_id = $this->Vehicle_model->addModel($_POST);
if($model_id != '0'){
$flashMsg =array('message'=>'Successfully Updated Vehicle Model..!','class'=>'success');
......@@ -327,18 +296,14 @@ class Vehicle extends CI_Controller {
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Vehicle/viewVehModel'));
}
$template['page'] = 'Vehicles/addModel';
$template['menu'] = 'Model Management';
$template['smenu'] = 'Edit Model';
$template['pTitle'] = "Edit Model";
$template['pDescription'] = "Update Model Name";
$template['model_id'] = encode_param($model_id);
$template['vehBrand_data'] = $this->Vehicle_model->getVehBrand('',1);
$template['vehModel_data'] = $this->Vehicle_model->getVehModel($model_id,1);
//pr($template['vehModel_data']);
$this->load->view('template',$template);
}
......@@ -361,7 +326,6 @@ class Vehicle extends CI_Controller {
$err = 1;
$errMsg = 'Vehicle Model is Required';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
......@@ -377,7 +341,6 @@ class Vehicle extends CI_Controller {
redirect(base_url('Vehicle/editVehModel/'.$model_id));
}
}
public function getVehModel(){
$return_arr = array('status'=>'0');
......
......@@ -2,14 +2,12 @@
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");
......@@ -28,51 +26,41 @@
$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'];
}
define("PAYSTACK_SECRET_KEY", "sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273");
}
// 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';
......@@ -80,53 +68,44 @@
}
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'])){
......@@ -145,36 +124,30 @@
$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'){
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
......@@ -183,22 +156,17 @@
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
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'])){
......@@ -221,14 +189,11 @@
$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'){
......@@ -241,24 +206,19 @@
}
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');
......@@ -266,30 +226,24 @@
$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']) ){
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']) ||
......@@ -300,11 +254,9 @@
!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'])){
......@@ -321,30 +273,24 @@
}
}
$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'])){
......@@ -367,12 +313,10 @@
$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");
......@@ -384,53 +328,46 @@
$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']){
isset($postData['cpassword']) && !empty($postData['cpassword']) &&
$postData['password'] == $postData['cpassword']){
$postData['password'] = md5($postData['password']);
} else {
} 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'){
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp == '3'){
} 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(){
public 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;
......@@ -439,20 +376,17 @@
}
echo json_encode($respArr);exit;
}
// getCustBookDetails
function getCustBookDetails(){
public 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']:'';
$status =(isset($postData['status']) && !empty($postData['status']))?$postData['status']:'';
$bookingDetails = $this->Booking_model->getCustBookDetails($postData,$status);
if($bookingDetails != '0'){
$respArr['status'] = 1;
......@@ -461,59 +395,49 @@
}
echo json_encode($respArr);exit;
}
// cancelBooking
function cancelBooking(){
public 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'])){
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'],'4');
if($status){
$respArr['status'] = 1;
$respArr['message'] = 'success';
}
echo json_encode($respArr);exit;
}
// deleteCustomerCar
function deleteCustomerCar(){
public 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'])){
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(){
public 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;
......@@ -528,70 +452,56 @@
$url = "";
$searchType = $postData['type'];
$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'];
$last_date ='';
if(isset($postData['vehicleData']['lastMaintanceDate']) && !empty($postData['vehicleData']['lastMaintanceDate'])){
$vehicle_data['last_maintenance_date'] = $postData['vehicleData']['lastMaintanceDate'];
$vehicle_data['last_maintenance_date'] = $postData['vehicleData']['lastMaintanceDate'];
}
$last_maintanence_date ='';
if(isset($postData['vehicleData']['maintanence_interval']) && !empty($postData['vehicleData']['maintanence_interval'])){
$vehicle_data['maintanence_interval'] = $postData['vehicleData']['maintanence_interval'];
}
$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'])){
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'];
$url = "https://specifications.vinaudit.com/v3/selections?format=json&key=".
urlencode($settings['vin_audit_api'])."&id=".urlencode($searchData['modelYear'])."_".urlencode($searchData['car_maker'])."_".urlencode($searchData['modelName']);
}
else if($searchType == 2 && isset($searchData['vin']) && !empty($searchData['vin'])){
$vehicle_data['car_vin'] = $searchData['vin'];
$url = "https://specifications.vinaudit.com/v3/specifications?format=json&key=".urlencode($settings['vin_audit_api'])."&vin=".urlencode($searchData['vin']);
}
if(!empty($url)){
$vehData=file_get_contents($url);
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 || ((!isset($vehData['attributes']) || empty($vehData['attributes'])) &&
(!isset($vehData['selections']) || empty($vehData['selections'])))){
$return_arr['status'] = 2;
$return_arr['message'] = 'No Data Found.';
echo json_encode($return_arr);exit;
}
if($searchType == 2){
$vehDetails['vehicle'] = $vehData['attributes']['year'].' '.
$vehData['attributes']['make'].' '.
$vehData['attributes']['model'].' '.
$vehData['attributes']['trim'];
$vehData['attributes']['make'].' '.
$vehData['attributes']['model'].' '.
$vehData['attributes']['trim'];
$vehDetails['year'] = $vehData['attributes']['year'];
$vehDetails['make'] = $vehData['attributes']['make'];
$vehDetails['trim'] = $vehData['attributes']['trim'];
$vehDetails['model'] = $vehData['attributes']['model'];
$vehDetails['engine'] = $vehData['attributes']['engine'];
$vehicle_data['car_maker'] = $vehDetails['make'];
$vehicle_data['car_model'] = $vehDetails['model'];
$vehicle_data['car_model_year'] = $vehDetails['year'];
......@@ -602,17 +512,14 @@
$vehDetails['model'] = $vehSele['years'][0]['makes'][0]['models'][0]['name'];
$vehDetails['vehicle'] = $vehDetails['year'].' '.$vehDetails['make'].' '.
$vehDetails['model'].' '.$vehTrim;
$vehDetails['trim'] = $vehTrim;
$vehDetails['engine'] = $vehEngine;
$vehicle_data['car_maker'] = $vehDetails['make'];
$vehicle_data['car_model'] = $vehDetails['model'];
$vehicle_data['car_model_year'] = $vehDetails['year'];
}
$vehicle_data['car_name'] = $vehDetails['vehicle'];
$vehicle_data['vehicle_data'] = json_encode($vehDetails);
$car_id = $this->Vehicle_model->addVehicle($vehicle_data);
if(!empty($car_id)){
$return_arr['status'] = '1';
......@@ -622,64 +529,49 @@
}
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';
......@@ -687,20 +579,15 @@
}
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'])){
......@@ -719,22 +606,18 @@
$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';
......@@ -751,53 +634,44 @@
}
echo json_encode($respArr); exit;
}
//Get Booked Services
public function get_allocated_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;
}
$postData = $_GET;
$currentpage = $start = $total = 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;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$bookDataRslt = $this->Webservice_model->getBookedService($authRes['data']['customer_id'],0,0);
$bookDataList = $this->Webservice_model->getBookedService($authRes['data']['customer_id'],$start,$per_page);
if($bookDataRslt['status'] == 'success'){
$total = count($bookDataRslt['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($bookDataList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'services' => $bookDataList['data']
'services_data' => $bookDataList['data']
),
'meta' => array(
'total_pages' => $totalPages,
......@@ -811,7 +685,7 @@
'status' => 'error',
'message'=>'No data',
'data' => array(
'services' => []
'services_data' => []
),
'meta' => array(
'total_pages' => $totalPages,
......@@ -827,41 +701,33 @@
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';
$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->get_booked_services($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');
......@@ -905,61 +771,48 @@
$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);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($serviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -991,28 +844,22 @@
}
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;
}
......@@ -1020,17 +867,13 @@
$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.';
......@@ -1041,53 +884,41 @@
$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);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($subserviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -1122,27 +953,21 @@
}
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;
......@@ -1176,30 +1001,23 @@
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->book_service($postData);
echo json_encode($respData);exit;
}
public function allocated_service_details(){
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;
}
if(empty($postData)){
$respArr = array('status'=>'error','message'=>'All Field is Required');
echo json_encode($respArr);exit;
......@@ -1213,51 +1031,40 @@
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->getBookedService($postData['booking_id'],'','',1);
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['is_emergency']) || $postData['is_emergency'] != 1){
if(!isset($postData['service_id']) || empty($postData['service_id'])){
......@@ -1265,7 +1072,6 @@
$msg = 'Service Id is Required';
}
}
else if(!isset($postData['location']) || empty($postData['location'])){
$err = 1;
$msg = 'Location is Required';
......@@ -1278,17 +1084,14 @@
$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;
......@@ -1296,25 +1099,21 @@
}
if(isset($postData['is_emergency']) && $postData['is_emergency'] == 1){
$mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0,1);
$mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page,1);
$mechanicsList =$this->Webservice_model->getNearMechanics($postData,$start,$per_page,1);
} else {
$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);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($mechanicsList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -1344,20 +1143,16 @@
}
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;
......@@ -1367,7 +1162,6 @@
$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];
......@@ -1392,18 +1186,14 @@
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];
$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];
......@@ -1432,21 +1222,17 @@
$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;
......@@ -1454,38 +1240,30 @@
$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';
......@@ -1495,31 +1273,24 @@
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=''){
//pr($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';
......@@ -1527,16 +1298,13 @@
'amount' => $amount,
'reference' => $transId,
'callback_url' => $callback);
$this->payStackPayment($postdata,1);
}
//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;
......@@ -1563,7 +1331,6 @@
'Authorization: Bearer '.PAYSTACK_SECRET_KEY,
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$request = curl_exec($ch);
curl_close ($ch);
......@@ -1573,17 +1340,17 @@
!empty($result['data']['authorization_url'])){
$redir = $result['data']['authorization_url'];
header("Location: ".$redir);
}else{
$ref = $postdata['reference'];
$status = $this->Webservice_model->transactionResp($ref,$result,$payFor);
$this->fail();
}
//pr($result);
$status = $this->Webservice_model->transactionResp($postdata['reference'],$result,$payFor);
$this->fail();
}
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();
......@@ -1597,7 +1364,6 @@
);
$request = curl_exec($ch);
curl_close($ch);
if ($request) {
$result = json_decode($request, true);
$status = $this->Webservice_model->transactionResp($ref,$result,$payFor);
......@@ -1658,14 +1424,12 @@
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);
}
if($mobile == '1'){
redirect('Webservices/mobPaySuccess');
} else {
......@@ -1679,34 +1443,27 @@
}
}
}
//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);
$total = 0;
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page;
$result = $this->Webservice_model->productSearch($postData,0,0);
$prodList = $this->Webservice_model->productSearch($postData,$page_limit,$per_page);
if($result['status'] == 'success'){
$total = count($result['data']);
}
if($total >= $per_page){
$totalPages = (int)($total%$per_page == 0?$total/$per_page:($total/$per_page)+1);
}
else{
$totalPages = 1;
}
if($prodList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -1734,7 +1491,6 @@
}
echo json_encode($respArr);exit;
}
//Get Brands
public function getBrands(){
header('Content-type:application/json');
......@@ -1746,90 +1502,69 @@
public function brand_details(){
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;
}
$result = $this->Webservice_model->getBrands('1');
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;
}
......@@ -1838,22 +1573,17 @@
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;
}
......@@ -1861,10 +1591,8 @@
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;
}
......@@ -1872,41 +1600,32 @@
public function get_latest_product_list(){
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;
}
$postData['user_id'] = $authRes['data']['customer_id'];
$per_page = 10;
$page = (isset($_GET['page']) && $_GET['page'] >= 1)?(int)$_GET['page']:1;
$start = ($page - 1) * $per_page;
$productResult = $this->Webservice_model->get_latest_product_list(0,0);
$productList = $this->Webservice_model->get_latest_product_list($start,$per_page,$postData);
$product = array();
$total = 0;
if($productResult['status'] == 'success'){
$total = count($productResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($productList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -1942,41 +1661,32 @@
public function get_trending_product_list(){
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;
}
$postData['user_id'] = $authRes['data']['customer_id'];
$per_page = 10;
$page = (isset($_GET['page']) && $_GET['page'] >= 1)?(int)$_GET['page']:1;
$start = ($page - 1) * $per_page;
$productResult = $this->Webservice_model->get_trending_product_list(0,0);
$productList = $this->Webservice_model->get_trending_product_list($start,$per_page,$postData);
$productList=$this->Webservice_model->get_trending_product_list($start,$per_page,$postData);
$product = array();
$total = 0;
if($productResult['status'] == 'success'){
$total = count($productResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($productList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2012,22 +1722,18 @@
public function product_details(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['user_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->SingleProductSearch($postData);
echo json_encode($result);exit;
}
......@@ -2035,21 +1741,17 @@
public function add_address(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->saveUserAddress($postData);
echo json_encode($result);exit;
......@@ -2058,20 +1760,16 @@
public function address_details(){
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;
}
$postData['user_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->getUserAddress($postData);
echo json_encode($result);exit;
}
......@@ -2079,25 +1777,20 @@
public function getLatestPrdts(){
header('Content-type:application/json');
$headers = apache_request_headers();
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page;
$latestResult = $this->Webservice_model->get_latest_product_list(0,0);
$latestList = $this->Webservice_model->get_latest_product_list($page_limit,$per_page);
if($latestResult['status'] == 'success'){
$total = count($latestResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($latestList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2129,29 +1822,23 @@
public function getTrendingPrdts(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$total = 0;
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page;
$trendResult = $this->Webservice_model->get_trending_product_list(0,0);
$trendList = $this->Webservice_model->get_trending_product_list($page_limit,$per_page);
if($trendResult['status'] == 'success'){
$total = count($trendResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total%$per_page == 0?$total/$per_page:($total/$per_page)+1);
}
else{
$totalPages = 1;
}
if($trendList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2183,29 +1870,23 @@
public function getMyOrders(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$total = 0;
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page;
$result = $this->Webservice_model->getMyOrders($postData,0,0);
$resultList = $this->Webservice_model->getMyOrders($postData,$page_limit,$per_page);
if($result['status'] == 'success'){
$total = count($result['data']);
}
if($total >= $per_page){
$totalPages = (int)($total%$per_page == 0?$total/$per_page:($total/$per_page)+1);
}
else{
$totalPages = 1;
}
if($resultList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2237,10 +1918,8 @@
public function cancelOrder(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->cancelOrder($postData);
echo json_encode($result);exit;
}
......@@ -2248,21 +1927,17 @@
public function cancel_order(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->cancelOrder($postData);
echo json_encode($result);exit;
}
......@@ -2270,28 +1945,23 @@
public function getCartData(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$total = 0;
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :'1';
$page_limit = ($page - 1) * $per_page;
$result = $this->Webservice_model->getCartData($postData,0,0);
$cartList = $this->Webservice_model->getCartData($postData,$page_limit,$per_page);
if($result['status'] == 'success'){
$total = count($result['data']);
}
if($total >= $per_page){
$totalPages = (int)($total%$per_page == 0?$total/$per_page:($total/$per_page)+1);
}
else{
$totalPages = 1;
}
if($cartList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2323,10 +1993,8 @@
public function removeCartPrdt(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->removeCartPrdt($postData);
echo json_encode($result);exit;
}
......@@ -2334,10 +2002,8 @@
public function addToCart(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->addToCart($postData);
echo json_encode($result);exit;
}
......@@ -2345,30 +2011,24 @@
public function add_to_cart(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$postData['customer_id'] = $authRes['data']['customer_id'];
$prd_data = $this->Webservice_model->SingleProductSearch($postData);
if($prd_data['status'] == 'error'){
$respArr['status'] = 'error';
$respArr['message'] = 'Amount is Required';
echo json_encode($respArr);exit;
}
$postData['amount'] = $prd_data['data']->amount * $postData['quantity'];
$result = $this->Webservice_model->addToCart($postData);
echo json_encode($result);exit;
......@@ -2377,21 +2037,17 @@
public function remove_product(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->removeCartPrdt($postData);
echo json_encode($result);exit;
}
......@@ -2399,42 +2055,32 @@
public function cart_details(){
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;
}
$per_page = 10;
$page = (isset($_GET['page']) && $_GET['page'] >= 1)?(int)$_GET['page']:1;
$start = ($page - 1) * $per_page;
$postData['customer_id'] = $authRes['data']['customer_id'];
$cartResult = $this->Webservice_model->getCartData($postData,0,0);
$cartList = $this->Webservice_model->getCartData($postData,$start,$per_page);
$product = array();
$total = 0;
if($cartResult['status'] == 'success'){
$total = count($cartResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($cartList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2470,42 +2116,32 @@
public function my_order_details(){
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;
}
$per_page = 10;
$page = (isset($_GET['page']) && $_GET['page'] >= 1)?(int)$_GET['page']:1;
$start = ($page - 1) * $per_page;
$postData['customer_id'] = $authRes['data']['customer_id'];
$orderResult = $this->Webservice_model->getMyOrders($postData,0,0);
$orderList = $this->Webservice_model->getMyOrders($postData,$start,$per_page);
$product = array();
$total = 0;
if($orderResult['status'] == 'success'){
$total = count($orderResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($orderList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2541,44 +2177,34 @@
public function search_product(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['user_id'] = $authRes['data']['customer_id'];
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] >= 1)?(int)$postData['page']:1;
$start = ($page - 1) * $per_page;
$searchResult = $this->Webservice_model->productSearch($postData,0,0);
$searchList = $this->Webservice_model->productSearch($postData,$start,$per_page);
$product = array();
$total = 0;
if($searchResult['status'] == 'success'){
$total = count($searchResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($searchList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2614,44 +2240,34 @@
public function filter_product(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['user_id'] = $authRes['data']['customer_id'];
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] >= 1)?(int)$postData['page']:1;
$start = ($page - 1) * $per_page;
$filterResult = $this->Webservice_model->productSearch($postData,0,0);
$filterList = $this->Webservice_model->productSearch($postData,$start,$per_page);
$product = array();
$total = 0;
if($filterResult['status'] == 'success'){
$total = count($filterResult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($filterList['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -2687,7 +2303,6 @@
public function getMechanicShops(){
header('Content-type:application/json');
$headers = apache_request_headers();
$result = $this->Webservice_model->getMechanicShops();
echo json_encode($result);exit;
}
......@@ -2695,7 +2310,6 @@
public function getVehicleBrand(){
header('Content-type:application/json');
$headers = apache_request_headers();
$result = $this->Webservice_model->getVehicleBrand();
echo json_encode($result);exit;
}
......@@ -2703,18 +2317,15 @@
public function get_vehicle_brand(){
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;
}
$result = $this->Webservice_model->getVehicleBrand();
echo json_encode($result);exit;
}
......@@ -2722,10 +2333,8 @@
public function getVehicleModel(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$result = $this->Webservice_model->getVehicleModel($postData);
echo json_encode($result);exit;
}
......@@ -2733,13 +2342,11 @@
public function get_vehicle_model(){
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;
......@@ -2747,7 +2354,6 @@
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$result = $this->Webservice_model->getVehicleModel($postData);
echo json_encode($result);exit;
}
......@@ -2755,21 +2361,17 @@
public function get_userAddress_by_id(){
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;
}
$postData = $_GET;
$postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->getUserAddressById($postData);
echo json_encode($result);exit;
}
......@@ -2777,21 +2379,17 @@
public function update_address(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$result = $this->Webservice_model->update_user_address($postData);
echo json_encode($result);exit;
}
......@@ -2799,33 +2397,45 @@
public function bulkOrderBooking(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
if(empty($post) || empty($postData = json_decode($post,true)) ||
!isset($postData['Auth']) || empty($postData['Auth']) ||
!isset($postData['data']) || empty($postData['data'])){
$this->fail('','','1');
}
$authRes = $this->Webservice_model->get_customer_authtoken($postData['Auth']);
if($authRes['status'] == 'error'){
$this->fail('','','1');
}
$postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->bulkOrderBooking($postData);
if($result['status'] == 'success'){
$this->orderPayNowApi($result['data']);
}
$this->fail('','','1');
}
public function orderPayNowApi($transId=''){
public function PayNowApi($transId=''){
if(empty($transId)){
$this->fail('','','1');
}
$mechData = $this->Webservice_model->getMechAmount($transId);
if(empty($mechData)){
$this->fail('','','1');
}
$amount = $mechData['data']['amount'] * 100;
$callback = base_url().'Webservices/verify_payment_api/'.$transId.'/1';
$postdata = array('email' => $mechData['emailId'],
'amount' => $amount,
'reference' => $transId,
'callback_url' => $callback);
$this->payStackPaymentApi($postdata);
}
public function orderPayNowApi($transId=''){
if(empty($transId)){
$this->fail('','','1');
}
$orderData = $this->Webservice_model->getOrderPayDetailsApi($transId);
if($orderData['status'] == 'success'){
$amount = $orderData['data']->bulk_amount * 100;
......@@ -2845,32 +2455,31 @@
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);
}
if(empty($result) || !isset($result['data']) ||
!isset($result['data']['authorization_url']) || empty($result['data']['authorization_url'])){
$this->fail('','','1');
}
$redir = $result['data']['authorization_url'];
redirect($redir);
}
public function verify_payment_api($transId='',$payFor='1') {
if(empty($transId)){
$this->fail('','','1');
}
$result = array();
$url = 'https://api.paystack.co/transaction/verify/'.$transId;
$ch = curl_init();
......@@ -2884,7 +2493,6 @@
);
$request = curl_exec($ch);
curl_close($ch);
if ($request) {
$result = json_decode($request, true);
$status = $this->Webservice_model->transactionRespApi($transId,$result,$payFor);
......@@ -2911,10 +2519,8 @@
public function socialLogin(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->socialLogin($postData);
echo json_encode($result);exit;
}
......@@ -2922,10 +2528,8 @@
public function getCustRemainders(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getCustRemainders($postData);
echo json_encode($result);exit;
}
......@@ -2933,11 +2537,9 @@
public function changeReminderStatus(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$this->load->model('Vehicle_model');
$result = $this->Vehicle_model->changeReminderStatus($postData);
echo json_encode($result);exit;
}
......@@ -2946,19 +2548,16 @@
if(empty($order_id)){
return;
}
$this->load->library("Pdf");
header('Content-type:application/json');
$headers = apache_request_headers();
$product_data = $this->Webservice_model->getOrderData($order_id);
$time = explode(' ',$product_data->datetime);
$html = '';
$template = getNotifTemplate();
if(isset($template['invoice_template']) && !empty($template['invoice_template'])){
$html = str_replace(array('{:order_id}','{:order_date}','{:invoice_date}','{:shipping_address}','{:product_name}','{:brand_name}','{:quantity}','{:price}','{:total}','{:name}'),array($product_data->format_order_id,$time[0],date('Y-m-d'),$product_data->shipping_address,$product_data->product_name,$product_data->brand_name,$product_data->quantity,$product_data->prd_amount,$product_data->amount,$product_data->name),$template['invoice_template']);
}
if(isset($template['invoice_template']) && !empty($template['invoice_template'])){
$html = str_replace(array('{:order_id}','{:order_date}','{:invoice_date}','{:shipping_address}','{:product_name}','{:brand_name}','{:quantity}','{:price}','{:total}','{:name}'),array($product_data->format_order_id,$time[0],date('Y-m-d'),$product_data->shipping_address,$product_data->product_name,$product_data->brand_name,$product_data->quantity,$product_data->prd_amount,$product_data->amount,$product_data->name),$template['invoice_template']);
}
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('DcarFixers');
......@@ -2991,22 +2590,18 @@
public function giveReview(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['customer_id'] = $authRes['data']['customer_id'];
$result = $this->Webservice_model->rateProduct($postData);
echo json_encode($result);exit;
}
......@@ -3015,19 +2610,16 @@
header('Content-type:application/json');
$headers = apache_request_headers();
$this->load->model('Vehicle_model');
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']['customer_id'];
$result = $this->Vehicle_model->getCustVechiles($postData);
$respArr['status'] = "success";
$respArr['data'] = $result;
......@@ -3037,12 +2629,81 @@
public function getCustVehDetails(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->getCustVehDetails($postData);
echo json_encode($result);exit;
}
public function remove_vehicle(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->remove_vehicle($postData);
echo json_encode($result);exit;
}
public function get_mechanics_reviews(){
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;
}
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$postData['user_id'] = $authRes['data']['customer_id'];
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] >= 1)?(int)$postData['page']:1;
$start = ($page - 1) * $per_page;
$reviewResult = $this->Webservice_model->get_mechanics_reviews($postData,0,0);
$reviewList = $this->Webservice_model->get_mechanics_reviews($postData,$start,$per_page);
$total = 0;
if($reviewResult['status'] == 'success'){
$total = count($reviewResult['data']);
}
if($total >= $per_page){
$totalPages =(int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($reviewList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'reviews' => $reviewList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page
)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'reviews' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page
)
);
}
echo json_encode($respArr);exit;
}
}
?>
......@@ -2,14 +2,12 @@
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");
......@@ -28,30 +26,24 @@
$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'];
}
define("PAYSTACK_SECRET_KEY", "sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273");
}
// customer_login
public function sign_in_mechanic(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'error','message'=>'Required Fields are empty.');
if(!isset($postData['user_name']) || empty($postData['user_name']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
!isset($postData['password']) || empty($postData['password'] = md5($postData['password'])) || !isset($postData['device_id']) || empty($postData['device_id'])){
echo json_encode($respArr);exit;
}
$respArr = $this->Webservice_mechanic_model->checkMechanicLogin($postData);
......@@ -61,44 +53,34 @@
//Get Booked Services
public function get_todays_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$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_mechanic_model->get_mechanic_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] >= 1)?(int)$postData['page']:1;
$start = ($page - 1) * $per_page;
$postData['mechanic_id'] = $authRes['data']['mechanic_id'];
$bookDataCount = $this->Webservice_mechanic_model->getBookedService($postData,0,0,1);
$bookDataResult = $this->Webservice_mechanic_model->getBookedService($postData,$start,$per_page,1);
$total = 0;
if($bookDataCount['status'] == 'success'){
$total = count($bookDataCount['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($bookDataResult['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -130,71 +112,56 @@
public function services_details(){
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_mechanic_model->get_mechanic_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$postData['mechanic_id'] = $authRes['data']['mechanic_id'];
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$respArr['message'] = "Service Id is Required";
return $respArr;
}
$respArr = $this->Webservice_mechanic_model->getBookedService($postData);
echo json_encode($respArr);exit;
}
public function get_service_history(){
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_mechanic_model->get_mechanic_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] >= 1)?(int)$postData['page']:1;
$start = ($page - 1) * $per_page;
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$postData['mechanic_id'] = $authRes['data']['mechanic_id'];
$bookDataCount = $this->Webservice_mechanic_model->getBookedService($postData,0,0,0,3);
$bookDataResult = $this->Webservice_mechanic_model->getBookedService($postData,$start,$per_page,0,3);
$total = 0;
if($bookDataCount['status'] == 'success'){
$total = count($bookDataCount['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($bookDataResult['status'] == 'success'){
$respArr = array(
'status' => 'success',
......@@ -226,34 +193,28 @@
public function logout(){
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_mechanic_model->get_mechanic_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$respArr = $this->Webservice_mechanic_model->mechanic_logout($authRes['data']['mechanic_id']);
$respArr=$this->Webservice_mechanic_model->mechanic_logout($authRes['data']['mechanic_id']);
echo json_encode($respArr);exit;
}
public function forgot_password(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($postData['user_name']) || empty($postData['user_name'])){
$respArr['message'] = "Username is Required";
echo json_encode($respArr);exit;
}
$respArr = $this->Webservice_mechanic_model->forgot_password($postData['user_name']);
echo json_encode($respArr);exit;
}
......@@ -261,10 +222,8 @@
public function change_password(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array("status"=>"error");
if(!isset($postData['user_name']) || empty($postData['user_name'])){
$respArr['message'] = "Username is Required";
......@@ -273,7 +232,6 @@
$respArr['message'] = "Password is Required";
echo json_encode($respArr);exit;
}
$respArr = $this->Webservice_mechanic_model->change_password($postData);
echo json_encode($respArr);exit;
}
......@@ -281,10 +239,8 @@
public function start_service(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array("status"=>"error");
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$respArr['message'] = "Booking Id is Required";
......@@ -301,10 +257,8 @@
public function stop_service(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$respArr['message'] = "Booking Id is Required";
return $respArr;
......@@ -312,7 +266,6 @@
$respArr['message'] = "Emergency Field is Required";
return $respArr;
}
$respArr = $this->Webservice_mechanic_model->start_service($postData,1);
echo json_encode($respArr);exit;
}
......
......@@ -15,9 +15,7 @@ class Booking_model extends CI_Model {
return 0;
}
$vehData = $postData['vechile_info'];
//$vehName = $this->db->get_where('vehicles_brand',array('veh_brand_id'=>$vehData['maker']))->row();
$car_name = $vehData['modelYear'].' '.$vehData['maker'].' '.$vehData['modelName'];
$vehJson = array('vehicle' => $car_name,
'attributes' => array(
'Year' => $vehData['modelYear'],
......@@ -31,18 +29,15 @@ class Booking_model extends CI_Model {
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,
'car_model' => $vehData['modelName'],
......@@ -55,7 +50,6 @@ class Booking_model extends CI_Model {
'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'],
......@@ -67,11 +61,9 @@ class Booking_model extends CI_Model {
$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'],
'scheduled_date' => $postData['schedule_date']['date'],
'scheduled_time' => $postData['schedule_date']['time'],
'issues_selected' => json_encode($selected_issues),
......@@ -107,7 +99,6 @@ class Booking_model extends CI_Model {
}
$cond = "BK.customer_id='".$postData['customer_id']."' ";
$cond .= (!empty($status))?"AND BK.status IN (".$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
......@@ -119,7 +110,6 @@ class Booking_model extends CI_Model {
if(empty($bookData)){
return 0;
}
$bookDetails = array();
$bookData = $bookData->result();
foreach($bookData AS $book) {
......@@ -142,15 +132,12 @@ class Booking_model extends CI_Model {
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';
}
......@@ -166,18 +153,15 @@ class Booking_model extends CI_Model {
if(empty($customer_id) || empty($booking_id) || $status == ''){
return 0;
}
$status = $this->db->update('bookings',
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>
......@@ -185,13 +169,11 @@ class Booking_model extends CI_Model {
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;
}
......@@ -199,11 +181,9 @@ class Booking_model extends CI_Model {
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 MBK.mechanic_id='".$mechanic_id."' ":"";
$sql = "SELECT GROUP_CONCAT(DISTINCT(MBK.mechanic_id)) AS mechanic_ids,MBK.amount as cost,BK.booking_id,BK.customer_id,BK.customer_veh_id,BK.scheduled_date,BK.scheduled_time,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
......@@ -217,7 +197,6 @@ class Booking_model extends CI_Model {
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)){
if(empty($booking_id)){
......@@ -245,7 +224,6 @@ class Booking_model extends CI_Model {
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);
......@@ -254,7 +232,6 @@ class Booking_model extends CI_Model {
}
$bookData->mechanic_data = $bookedMechanics;
}
// pr($bookData);
return $bookData;
}
return 0;
......@@ -299,7 +276,6 @@ class Booking_model extends CI_Model {
$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];
......@@ -310,7 +286,6 @@ class Booking_model extends CI_Model {
$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');
......@@ -328,7 +303,6 @@ class Booking_model extends CI_Model {
$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;
......
......@@ -9,7 +9,6 @@ class Brand_model extends CI_Model {
if(empty($brand_data)){
return 0;
}
$status = $this->db->insert('product_brand',$brand_data);
return ($status)?1:0;
}
......@@ -17,7 +16,6 @@ class Brand_model extends CI_Model {
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;
......@@ -37,7 +35,6 @@ class Brand_model extends CI_Model {
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;
}
......
......@@ -15,7 +15,6 @@ class Customer_model extends CI_Model {
array('status'=>'1','customer_id'=>$customer_data['customer_id']));
$veh_data = (!empty($veh_data))?$veh_data->result():'';
}
$result = $this->db->query("SELECT * FROM customers WHERE status IN (0,1) $cond");
if(empty($result)){
return;
......@@ -31,14 +30,12 @@ class Customer_model extends CI_Model {
function createCustomer($customer_data = array(), $saved_vehicles = array()){
if(empty($customer_data))
return 0;
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){
return 2;
}
}
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){
......@@ -50,10 +47,8 @@ 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.
......@@ -66,14 +61,12 @@ class Customer_model extends CI_Model {
}
send_mail($subject,$email_id,$message);
$res = array('status'=>1,'data'=>'');
return ($status)?1:0;;
}
function updateCustomer($customer_id = '', $customer_data = array(), $saved_vehicles = array()){
if(empty($customer_id) || empty($customer_data))
return 0;
$emailChk = $this->db->get_where('customers',array('email'=>$customer_data['email'],
'customer_id !='=>$customer_id,
'status !='=>'2'));
......@@ -86,14 +79,11 @@ class Customer_model extends CI_Model {
if(!empty($phoneChk) && $phoneChk->num_rows() > 0){
return 3;
}
$status = $this->db->update('customers',$customer_data,array('customer_id'=>$customer_id));
if($status && !empty($saved_vehicles)){
$this->db->query("UPDATE customer_vehicle SET status='1',customer_id='$customer_id'
WHERE customer_veh_id IN ($saved_vehicles)");
}
return ($status)?1:0;;
}
......@@ -115,7 +105,6 @@ class Customer_model extends CI_Model {
$respArr['status'] = 2;
return $respArr;
}
$result = $this->db->get_where('customers',array('email'=>$userLogData['email'],
'password'=>$userLogData['password'],
'status'=>'1'));
......@@ -137,11 +126,9 @@ class Customer_model extends CI_Model {
$respArr['status'] = 2;
return $respArr;
}
$mail_id = $custData->email;
$cust_id = $custData->customer_id;
$unique_id = generate_unique();
$status = $this->db->insert('forgot_password_link',array('user_type'=>'1','user_id'=>$cust_id,
'token'=>$unique_id));
if($status){
......
......@@ -6,47 +6,91 @@ class Dashboard_model extends CI_Model {
}
public function getBookingCount(){
$result = $this->db->get_where('bookings')->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('bookings')->result();
}else{
$id = $this->session->userdata('id');
$this->db->join('mechanic_booking','mechanic_booking.booking_id = bookings.booking_id','left');
$result = $this->db->get_where('bookings',array('mechanic_booking.mechanic_id'=>$id))->result();
}
return count($result);
}
public function getMechShpCount(){
$result = $this->db->get_where('mechanic_shop',array('status'=>'1'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('mechanic_shop',array('status'=>'1'))->result();
}else{
return 0;
}
return count($result);
}
public function getCompletedBookingCount(){
$result = $this->db->get_where('bookings',array('status'=>'3'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('bookings',array('status'=>'3'))->result();
}else{
$id = $this->session->userdata('id');
$this->db->join('mechanic_booking','mechanic_booking.booking_id = bookings.booking_id','left');
$result = $this->db->get_where('bookings',array('mechanic_booking.mechanic_id'=>$id,'bookings.status'=>'3'))->result();
}
return count($result);
}
public function getPendingBookingCount(){
$result = $this->db->get_where('bookings',array('status'=>'1'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('bookings',array('status'=>'1'))->result();
}else{
$id = $this->session->userdata('id');
$this->db->join('mechanic_booking','mechanic_booking.booking_id = bookings.booking_id','left');
$result = $this->db->get_where('bookings',array('mechanic_booking.mechanic_id'=>$id,'bookings.status'=>'1'))->result();
}
return count($result);
}
public function getMbleVndrsCount(){
$result = $this->db->get_where('mechanic',array('shop_id'=>'1'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('mechanic',array('shop_id'=>'1'))->result();
}else{
return 0;
}
return count($result);
}
public function getMbleMchnsCount(){
$result = $this->db->get_where('mechanic',array('shop_id'=>'0'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('mechanic',array('shop_id'=>'0'))->result();
}else{
return 0;
}
return count($result);
}
public function getCustomerCount(){
$result = $this->db->get_where('customers',array('status'=>'1'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('customers',array('status'=>'1'))->result();
}else{
return 0;
}
return count($result);
}
public function getProductCount(){
$result = $this->db->get_where('products',array('status'=>'1'))->result();
if($this->session->userdata('user_type') == 1){
$result = $this->db->get_where('products',array('status'=>'1'))->result();
}else{
$id = $this->session->userdata('id');
$result = $this->db->get_where('products',array('status'=>'1','created_by'=>$id))->result();
}
return count($result);
}
public function getProductSoldCount(){
$result = $this->db->query("SELECT SUM(`quantity`) as count FROM `orders` WHERE status IN('2,3,4,5')")->row();
if($this->session->userdata('user_type') == 1){
$result = $this->db->query("SELECT SUM(`quantity`) as count FROM `orders` WHERE status IN('2,3,4,5')")->row();
}else{
$id = $this->session->userdata('id');
$result = $this->db->query("SELECT SUM(`quantity`) as count FROM `orders` INNER JOIN products ON products.product_id = orders.product_id WHERE orders.status IN('2,3,4,5') AND products.created_by='$id'")->row();
}
return $result->count;
}
......@@ -57,12 +101,10 @@ class Dashboard_model extends CI_Model {
INNER JOIN `transaction` AS `TRANS` ON (`TRANS`.`booking_id` = `ORDS`.`order_id`)
WHERE `TRANS`.`payment_for`='2' AND `TRANS`.`status` = '1'
GROUP BY SUBSTRING_INDEX(TRANS.datetime,'-',1)");
$result = array();
if(empty($query) || $query->num_rows < 0 || empty($query = $query->result_array())){
return $result;
}
foreach($query as $value){
$result[] = array('y'=>$value['year'],'item1'=>$value['count']);
}
......@@ -76,17 +118,14 @@ class Dashboard_model extends CI_Model {
INNER JOIN `transaction` AS `TRANS` ON (`TRANS`.`booking_id` = `BUK`.`booking_id`)
WHERE `TRANS`.`payment_for`='1' AND `TRANS`.`status` = '1'
GROUP BY SUBSTRING_INDEX(TRANS.datetime,'-',1)");
$result = array();
if(empty($query) || $query->num_rows < 0 || empty($query = $query->result_array())){
return $result;
}
foreach($query as $value){
$result[] = array('y'=>$value['year'],'item1'=>$value['count']);
}
return json_encode($result);
}
}
?>
\ No newline at end of file
......@@ -20,13 +20,11 @@ class Import_model extends CI_Model {
$this->db->insert('vehicles_brand',array('maker'=>$brand));
$brandData['veh_brand_id'] = $this->db->insert_id();
}
$modelData = $this->db->get_where('vehicles_model',array('veh_brand_id'=>$brandData['veh_brand_id'],'model'=>$model));
if(empty($modelData) || $modelData->num_rows < 0 || empty($modelData = $modelData->row_array())){
$this->db->insert('vehicles_model',array('veh_brand_id'=>$brandData['veh_brand_id'],'model'=>$model));
$modelData['veh_modal_id'] = $this->db->insert_id();
}
$carData = $this->db->get_where('cardetails',array('year'=>$year,'veh_modal_id'=>$modelData['veh_modal_id']));
if(empty($carData) || $carData->num_rows < 0 || empty($carData = $carData->row_array())){
$this->db->insert('cardetails',array('year'=>$year,'veh_modal_id'=>$modelData['veh_modal_id']));
......
......@@ -8,13 +8,10 @@ class Issue_model extends CI_Model {
public function addIssue($issue_data = array(), $issueTyp = array()){
if(empty($issue_data) || empty($issueTyp))
return 0;
$status = $this->db->insert('issues',$issue_data);
if(!$status)
return 0;
$issue_id = $this->db->insert_id();
foreach ($issueTyp AS $key => $value) {
$issueTyp[$key]['issue_id'] = $issue_id;
}
......@@ -25,7 +22,6 @@ class Issue_model extends CI_Model {
function getIssues($issue_id = '',$view_all = 0){
$cond = ($view_all != 0)?' ISS.status IN (0,1) ':' ISS.status IN (1) ';
$cond .= (!empty($issue_id))?" AND ISS.issue_id = '$issue_id' ":"";
$result = $this->db->query("SELECT ISS.*,IC.issue_cat_id FROM issues AS ISS
LEFT JOIN issues_category AS IC ON
(ISS.issue_id=IC.issue_id AND IC.status='1')
......@@ -41,9 +37,7 @@ class Issue_model extends CI_Model {
if(empty($mechanic_id)){
return 0;
}
$cond = ($view_all != 0)?' status IN (0,1) ':' status IN (1) ';
$result = $this->db->query("SELECT * FROM issues
WHERE $cond AND issue_id NOT IN
(SELECT issue_id FROM mechanic_issues
......@@ -57,7 +51,6 @@ class Issue_model extends CI_Model {
function getIssueDetails($issue_id = '',$view_all = 0){
$cond = ($view_all != 0)?' status IN (0,1) ':' status IN (1) ';
$cond .= (!empty($issue_id))?" AND issue_id = '$issue_id' ":"";
$result = $this->db->query("SELECT * FROM issues WHERE $cond");
if(empty($result)){
return;
......@@ -94,7 +87,6 @@ class Issue_model extends CI_Model {
return 0;
}
$status = $this->db->update('issues',$issue_data,array('issue_id'=>$issue_id));
$scat_ids = array();
if(!empty($updateSubTyp)){
foreach ($updateSubTyp AS $scat_id => $scat_data) {
......@@ -107,7 +99,6 @@ class Issue_model extends CI_Model {
}
$this->db->where('issue_id',$issue_id);
$this->db->delete('issues_category');
if(!empty($insertSubTyp)){
$this->db->insert_batch('issues_category',$insertSubTyp);
}
......@@ -128,18 +119,15 @@ class Issue_model extends CI_Model {
}
$cond = ($view_all != 0)?' MI.status IN (0,1) ':' MI.status IN (1) ';
$cond .= (!empty($issue_id))?" AND MI.issue_id = '$issue_id' ":"";
$sql = "SELECT MI.issue_id,MI.issue_cat_id,MI.mechanic_id,MI.custom_description,MI.custom_service_fee,
MI.status,ISS.issue,ISS.issue_image
$sql = "SELECT MI.issue_id,MI.issue_cat_id,MI.mechanic_id,MI.custom_description,
MI.custom_service_fee, MI.status,ISS.issue,ISS.issue_image
FROM mechanic_issues AS MI
INNER JOIN issues AS ISS ON (ISS.issue_id=MI.issue_id)
WHERE MI.mechanic_id='$mechanic_id' AND ISS.status='1' AND $cond
GROUP BY MI.issue_id,MI.issue_cat_id";
$mechIssueData = $this->db->query($sql);
if(empty($mechIssueData) || empty($mechIssueData = $mechIssueData->result_array()))
return 0;
$cstFlag = 0;
$customIssues = array();
foreach ($mechIssueData AS $mechIsssue) {
......@@ -152,9 +140,7 @@ class Issue_model extends CI_Model {
'status'=>$mechIsssue['status'],
'custom_enable'=>'0');
}
if(!empty($issCat_id = $mechIsssue['issue_cat_id'])){
$sIssData = $this->db->get_where('issues_category',array('issue_cat_id'=>$issCat_id));
if(empty($sIssData) || empty($sIssData = $sIssData->row_array())){
continue;
......@@ -163,7 +149,6 @@ class Issue_model extends CI_Model {
$subIssueDtls['service_fee'] = $sIssData['default_service_fee'];
$subIssueDtls['issue_category'] = $sIssData['issue_category'];
$subIssueDtls['issue_cat_image'] = $sIssData['issue_cat_image'];
if(!empty($mechIsssue['custom_description'])){
$cstFlag = 1;
$subIssueDtls['description'] = $mechIsssue['custom_description'];
......@@ -172,7 +157,6 @@ class Issue_model extends CI_Model {
$cstFlag = 1;
$subIssueDtls['service_fee'] = $mechIsssue['custom_service_fee'];
}
$customIssues[$issue_id]['sub_issue'][$issCat_id] = $subIssueDtls;
$customIssues[$issue_id]['custom_enable'] = $cstFlag;
}
......@@ -194,48 +178,37 @@ class Issue_model extends CI_Model {
if(empty($mechanic_id) || empty($issue_id) || empty($custom_issue)){
return 0;
}
$status = $this->db->delete('mechanic_issues',array('mechanic_id'=>$mechanic_id,'issue_id'=>$issue_id));
if(!$status){
return ($status)?1:0;
}
return $this->addMechIssue($custom_issue);
}
function getGeneralIssues($issue_id = '', $view_all = '0'){
$cond = ($view_all != 0)?' ISS.status IN (0,1) ':' ISS.status IN (1) ';
$cond .= (!empty($issue_id))?" AND ISS.issue_id='".$issue_id."' ":'';
$sql = "SELECT ISS.*, IC.*
FROM issues AS ISS
LEFT JOIN issues_category AS IC ON (IC.issue_id=ISS.issue_id AND IC.status='1')
WHERE ".$cond;
if(empty($issueData = $this->db->query($sql)) || empty($issueData = $issueData->result_array()))
return 0;
$genIssueData = array();
foreach($issueData AS $issueData){
$issue_id = $issueData['issue_id'];
if(!isset($genIssueData[$issue_id])){
$iData = array('issue'=>$issueData['issue'],'issue_id'=>$issue_id,
'issue_image'=>$issueData['issue_image']);
$genIssueData[$issue_id] = $iData;
$genIssueData[$issue_id] = $iData;
}
if(isset($issueData['issue_cat_id']) && !empty($issueData['issue_cat_id'])){
$sIssueId = $issueData['issue_cat_id'];
$isData = array('issue_cat_id'=>$issueData['issue_cat_id'],
'issue_category'=>$issueData['issue_category'],
'issue_cat_image'=>$issueData['issue_cat_image'],
'default_service_fee'=>$issueData['default_service_fee'],
'default_description'=>$issueData['default_description']);
$genIssueData[$issue_id]['sub_categories'][] = $isData;
}
}
......@@ -245,7 +218,6 @@ class Issue_model extends CI_Model {
$respArr[] = $value;
}
}
return $respArr;
}
}
......
......@@ -11,7 +11,6 @@ class Login_model extends CI_Model {
array('username'=>$username,
'password'=>$password,
'status'=>'1'));
if($query->num_rows() > 0 && !empty($query)){
$result = $query->row();
$result->mechanic_data = '';
......@@ -19,11 +18,9 @@ class Login_model extends CI_Model {
if($result->user_type == 2){
$this->load->model('Mechanic_model');
$result->mechanic_data = $this->Mechanic_model->getMechanic($result->id);
if(!empty($result->mechanic_data->shop_id)){
$this->load->model('Shop_model');
$shop_data = $this->Shop_model->getShop($result->mechanic_data->shop_id);
if(!empty($shop_data)){
$result->mechanic_shop_data = $shop_data;
}
......
......@@ -6,7 +6,6 @@ class Mailtemplate_model extends CI_Model {
public function getCMSdata(){
$cmsData = $this->db->query("SELECT * FROM privacy_policy");
if(!empty($cmsData)){
return $cmsData->row();
}
......@@ -23,7 +22,6 @@ class Mailtemplate_model extends CI_Model {
public function getNotifData(){
$notifData = $this->db->query("SELECT * FROM notification_templates");
if(!empty($notifData)){
return $notifData->row();
}
......
......@@ -13,19 +13,16 @@ class Mechanic_model extends CI_Model {
WHERE AU.status!='2' AND
AU.username='".$mechanic_data['username']."'");
if(!empty($userIdChk) && $userIdChk->num_rows() > 0) return 4;
$emailChk = $this->db->query("SELECT * FROM mechanic AS MECH
INNER JOIN admin_users AS AU ON (AU.id = MECH.mechanic_id)
WHERE AU.status!='2' AND
MECH.email_id='".$mechanic_data['email_id']."'");
if(!empty($emailChk) && $emailChk->num_rows() > 0) return 2;
$phoneChk = $this->db->query("SELECT * FROM mechanic AS MECH
INNER JOIN admin_users AS AU ON (AU.id = MECH.mechanic_id)
WHERE AU.status!='2' AND
MECH.phone='".$mechanic_data['phone']."'");
if(!empty($phoneChk) && $phoneChk->num_rows() > 0) return 3;
$status = $this->db->insert('admin_users',
array('username'=>$mechanic_data['username'],
'password'=>$mechanic_data['password'],
......@@ -61,7 +58,6 @@ class Mechanic_model extends CI_Model {
$cond = (!empty($mechanic_id))?" MECH.mechanic_id = '".$mechanic_id."' ":"";
$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,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.*
......@@ -69,7 +65,6 @@ class Mechanic_model extends CI_Model {
INNER JOIN admin_users AS ADMN ON (ADMN.id = MECH.mechanic_id)
LEFT JOIN mechanic_shop AS MSH ON (MSH.shop_id = MECH.shop_id AND MSH.status = '1')
WHERE ".$cond;
$result = $this->db->query($sql);
if(empty($result)){
return;
......@@ -85,40 +80,36 @@ class Mechanic_model extends CI_Model {
WHERE AU.status!='2' AND AU.id!='".$mechanic_id."' AND
AU.username='".$mechanic_data['username']."'");
if(!empty($userIdChk) && $userIdChk->num_rows() > 0) { return 4; }
$emailChk = $this->db->query("SELECT * FROM mechanic AS MECH
INNER JOIN admin_users AS AU ON (AU.id = MECH.mechanic_id)
WHERE AU.status!='2' AND AU.id!='".$mechanic_id."' AND
MECH.email_id='".$mechanic_data['email_id']."'");
if(!empty($emailChk) && $emailChk->num_rows() > 0) { return 2; }
$phoneChk = $this->db->query("SELECT * FROM mechanic AS MECH
INNER JOIN admin_users AS AU ON (AU.id = MECH.mechanic_id)
WHERE AU.status!='2' AND AU.id!='".$mechanic_id."' AND
MECH.phone='".$mechanic_data['phone']."'");
if(!empty($phoneChk) && $phoneChk->num_rows() > 0) { return 3; }
$admUpdateArr = array('username'=>$mechanic_data['username'],
'display_name'=>$mechanic_data['display_name']);
if(isset($mechanic_data['profile_image']) && !empty($mechanic_data['profile_image']))
$admUpdateArr['profile_image'] = $mechanic_data['profile_image'];
$status = $this->db->update('admin_users',$admUpdateArr,array('id'=>$mechanic_id));
if(!$status) { return 0; }
$upMecArr = array('city'=>$mechanic_data['city'],'first_name'=>$mechanic_data['first_name'],
'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'],
'end_time'=>$mechanic_data['end_time'],
'start_time'=>$mechanic_data['start_time'],
'location_lat'=>$mechanic_data['location_lat'],
'location_lng'=>$mechanic_data['location_lng'],
'licence_number'=>$mechanic_data['licence_number'],
'licence_exp_date'=>$mechanic_data['licence_exp_date']);
$upMecArr = array(
'city'=>$mechanic_data['city'],'first_name'=>$mechanic_data['first_name'],
'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'],
'end_time'=>$mechanic_data['end_time'],
'start_time'=>$mechanic_data['start_time'],
'location_lat'=>$mechanic_data['location_lat'],
'location_lng'=>$mechanic_data['location_lng'],
'licence_number'=>$mechanic_data['licence_number'],
'licence_exp_date'=>$mechanic_data['licence_exp_date']);
if(isset($mechanic_data['licence']) && !empty($mechanic_data['licence']))
$upMecArr['licence'] = $mechanic_data['licence'];
......
......@@ -4,12 +4,10 @@
parent::__construct();
date_default_timezone_set('Asia/Kolkata');
}
/***************************************************************************************/
/****************************************Mobile API's***********************************/
function checkMechanicLogin($userLogData){
$respArr = array('status'=>'error');
$respArr = array('status'=>'error');
if(empty($userLogData)){
return $respArr;
}
......@@ -19,140 +17,139 @@ function checkMechanicLogin($userLogData){
$this->db->join('mechanic_shop as MCHSHP','MCHSHP.shop_id = MCH.shop_id','LEFT');
$this->db->where(array('AU.username'=>$userLogData['user_name'],'AU.password'=>$userLogData['password']));
$result = $this->db->get();
if(empty($result) || $result->num_rows() < 0 || empty($mechData = $result->row())){
$respArr['message'] = "Username or Password is Incorrect";
return $respArr;
$respArr['message'] = "Username or Password is Incorrect";
return $respArr;
}
$authdata = $this->insert_auth($mechData->user_id);
if($authdata){
if($this->db->update('mechanic',array('device_id'=>$userLogData['device_id']),array('mechanic_id'=>$mechData->user_id))){
$authdata = $this->insert_auth($mechData->user_id);
if($authdata){
$mechData->auth_token = $authdata;
$respArr['data'] = $mechData;
$respArr['status'] = 'success';
}
}
return $respArr;
}
public function insert_auth($id){
$static_string = time();
$authToken = 'Dcarfixs'.sha1($static_string);
$mechData = $this->db->get_where('authtable_mechanic',array('mechanic_id'=>$id));
if(!empty($mechData) && $mechData->num_rows() > 0){
$mechData = $mechData->row();
$authToken = $mechData->authtoken;
} else {
$this->db->insert('authtable_mechanic',array('mechanic_id'=>$id,'authtoken'=>$authToken));
$static_string = time();
$authToken = 'Dcarfixs'.sha1($static_string);
$mechData = $this->db->get_where('authtable_mechanic',array('mechanic_id'=>$id));
if(!empty($mechData) && $mechData->num_rows() > 0){
$mechData = $mechData->row();
$authToken = $mechData->authtoken;
}else {
$this->db->insert('authtable_mechanic',array('mechanic_id'=>$id,'authtoken'=>$authToken));
}
return $authToken;
}
public function get_mechanic_authtoken($auth = ''){
$respArr = array('status'=>0,'error'=>'901','message'=>'Something Went Wrong.');
if(empty($auth)){
return $respArr;
$respArr = array('status'=>0,'error'=>'901','message'=>'Something Went Wrong.');
if(empty($auth)){
return $respArr;
}
$auth = $this->db->get_where('authtable_mechanic',array('authtoken'=>$auth));
if(!empty($auth) && $auth->num_rows() >= 1 && !empty($mechAuth = $auth->row_array())){
$respArr['status'] = 'success';
$respArr['data'] = $mechAuth;
$respArr['status'] = 'success';
$respArr['data'] = $mechAuth;
}else{
$respArr['status'] = 'error';
$respArr['error'] = '902';
$respArr['message'] = 'Authtoken is not Valid';
$respArr['status'] = 'error';
$respArr['error'] = '902';
$respArr['message'] = 'Authtoken is not Valid';
}
return $respArr;
}
public function getBookedService($postData = array(),$start = '',$per_page = '',$type=0,$status=1){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.. Try Again Later');
if(empty($postData)){
$respArr['message'] = "All Field is Required";
return $respArr;
$respArr = array('status'=>'error','message'=>'Something Went Wrong.. Try Again Later');
if(empty($postData)){
$respArr['message'] = "All Field is Required";
return $respArr;
}
$where = array('BUK.status'=>$status,'MCHBUK.mechanic_id'=>$postData['mechanic_id']);
if($status == 1){
$stat = array('1','6');
}else{
$stat = array('3');
}
$where = array('MCHBUK.mechanic_id'=>$postData['mechanic_id']);
if(isset($postData['service_id']) && !empty($postData['service_id'])){
$where['BUK.booking_id'] = $postData['service_id'];
$where['BUK.booking_id'] = $postData['service_id'];
}
if($type == 1){
//$where['BUK.scheduled_date'] = date('Y-m-d');
$this->db->where('BUK.scheduled_date >=', date('Y-m-d'));
$this->db->order_by('BUK.scheduled_date','ASC');
$this->db->where('BUK.scheduled_date >=', date('Y-m-d'));
$this->db->order_by('BUK.scheduled_date','ASC');
}
// else if($type == 2){
// $where['BUK.scheduled_date'] = date("Y-m-d", strtotime('tomorrow'));
// }
$this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount as total_amount,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data");
$this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,BUK.status,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount as total_amount,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data,CSTVEH.car_loc_lat as cust_lat,CSTVEH.car_loc_lng as cust_lng,CSTVEH.car_location as cust_address");
$this->db->from('bookings as BUK');
$this->db->join('customers as CUST','CUST.customer_id = BUK.customer_id');
$this->db->join('customer_vehicle as CSTVEH','CSTVEH.customer_veh_id = BUK.customer_veh_id');
$this->db->join('mechanic_booking as MCHBUK','MCHBUK.booking_id = BUK.booking_id');
$this->db->join('mechanic AS MCH','MCHBUK.mechanic_id=MCH.mechanic_id');
$this->db->where_in("BUK.status",$stat);
$this->db->where($where);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
$this->db->limit($per_page,$start);
}
$bookData = $this->db->get();
if(!empty($bookData) && $bookData->num_rows() > 0){
$bookData = $bookData->result_array();
foreach ($bookData as $key => $value) {
$issues_selected = json_decode($value['issues_selected']);
$custom_issue_data = json_decode($value['custom_issue_data']);
$bookData[$key]['service_image'] = $custom_issue_data->optionalImages;
$bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription;
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$new = array();
foreach ($issues_selected as $issue_key => $issue_value) {
$sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='".$postData['mechanic_id']."' AND MI.status='1')
WHERE IC.status='1' AND IC.issue_cat_id='".$issue_value->sub_issue_id."'";
$issue_data = $this->db->query($sql)->row();
if(!empty($issue_data)){
if($issue_data->custom_description != '' && $issue_data->custom_service_fee != ''){
$new[$issue_key]['description'] = $issue_data->custom_description;
$new[$issue_key]['service_fee'] = $issue_data->custom_service_fee;
$bookData = $bookData->result_array();
foreach ($bookData as $key => $value) {
$issues_selected = json_decode($value['issues_selected']);
$custom_issue_data = json_decode($value['custom_issue_data']);
$bookData[$key]['service_image'] = $custom_issue_data->optionalImages;
$bookData[$key]['service_message'] = $custom_issue_data->optionlaDescription;
unset($bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$new = array();
foreach ($issues_selected as $issue_key => $issue_value) {
$sql = "SELECT IC.*, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='".$postData['mechanic_id']."' AND MI.status='1')
WHERE IC.status='1' AND IC.issue_cat_id='".$issue_value->sub_issue_id."'";
$issue_data = $this->db->query($sql)->row();
if(!empty($issue_data)){
if($issue_data->custom_description != '' && $issue_data->custom_service_fee != ''){
$new[$issue_key]['description'] = $issue_data->custom_description;
$new[$issue_key]['service_fee'] = $issue_data->custom_service_fee;
}else{
$new[$issue_key]['description'] = $issue_data->default_description;
$new[$issue_key]['service_fee'] = $issue_data->default_service_fee;
$new[$issue_key]['description'] = $issue_data->default_description;
$new[$issue_key]['service_fee'] = $issue_data->default_service_fee;
}
$new[$issue_key]['issue_name'] = $issue_data->issue_category;
}
$bookData[$key]['service_name'] = $new;
}
$bookData[$key]['service_name'] = $new;
}
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $bookData;
}
}
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data'] = $bookData;
}
return $respArr;
return $respArr;
}
public function mechanic_logout($mechanic_id){
$respArr = array('status'=>'error');
$status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id));
if($status){
$respArr['status'] = "success";
$respArr['message'] = "Logged Out Successfully";
$respArr = array('status'=>'error');
$status = $this->db->delete('authtable_mechanic',array('mechanic_id'=>$mechanic_id));
if($status){
$respArr['status'] = "success";
$respArr['message'] = "Logged Out Successfully";
}
return $status;
return $respArr;
}
public function forgot_password($username){
$respArr = array('status'=>'error');
$result = $this->db->query("SELECT MCH.phone as phone_number,AU.username as user_name FROM admin_users AS AU INNER JOIN mechanic AS MCH ON MCH.mechanic_id = AU.id WHERE AU.username LIKE '$username'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username Doesnot Exist";
return $respArr;
$respArr = array('status'=>'error');
$result = $this->db->query("SELECT MCH.phone as phone_number,AU.username as user_name FROM admin_users AS AU INNER JOIN mechanic AS MCH ON MCH.mechanic_id = AU.id WHERE AU.username LIKE '$username'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username Doesnot Exist";
return $respArr;
}
$respArr['status'] = "success";
$respArr['message'] = "success";
......@@ -160,37 +157,32 @@ public function forgot_password($username){
return $respArr;
}
public function change_password($postData = array())
{
$respArr = array('status'=>'error');
$result = $this->db->query("SELECT * FROM admin_users WHERE username LIKE '".$postData['user_name']."'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username doesnot Exist";
return $respArr;
}
if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){
$respArr['status'] = "success";
$respArr['message'] = "Password Updated Successfully";
}
public function change_password($postData = array()){
$respArr = array('status'=>'error');
$result = $this->db->query("SELECT * FROM admin_users WHERE username LIKE '".$postData['user_name']."'");
if(empty($result) || $result->num_rows() < 0 || empty($result = $result->row())){
$respArr['message'] = "Username doesnot Exist";
return $respArr;
}
if($this->db->update('admin_users',array('password'=>md5($postData['password'])),array('id'=>$result->id))){
$respArr['status'] = "success";
$respArr['message'] = "Password Updated Successfully";
}
return $respArr;
}
public function start_service($postData = array(),$type = 0){
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
$status = ($type == '1')?3:1;
$cost = ($postData['emergency'] == '2')?$postData['amount']:'';
if($this->db->update('bookings',array('service_type'=>$postData['emergency'],'cost'=>$cost,'status'=>$status),array('booking_id'=>$postData['service_id']))){
$respArr['status'] = "success";
$respArr['message'] = ($type == '1')?"Service Completed Successfully":"Service Started Successfully";
}
$respArr = array('status'=>'error');
if(empty($postData)){
return $respArr;
}
$status = ($type == '1')?3:6;
$cost = ($postData['emergency'] == '2')?$postData['amount']:'';
if($this->db->update('bookings',array('service_type'=>$postData['emergency'],'cost'=>$cost,'status'=>$status),array('booking_id'=>$postData['service_id']))){
$respArr['status'] = "success";
$respArr['message'] = ($type == '1')?"Service Completed Successfully":"Service Started Successfully";
}
return $respArr;
}
}
?>
......@@ -4,9 +4,8 @@ class Webservice_model extends CI_Model {
parent::__construct();
date_default_timezone_set('Asia/Kolkata');
}
/***************************************************************************************/
/****************************************Mobile API's***********************************/
/*************************************************************************************************/
/****************************************Mobile API's*********************************************/
public function checkMobAvailability($data = array()){
$res = array('status'=>'success', 'message'=>'Mobile Number Available','data'=>array('phone'=>$data['phone'],'is_available'=>true));
......@@ -47,17 +46,15 @@ class Webservice_model extends CI_Model {
return $respArr;
}
function createServiceProvider($provider_data = array()){
public function createServiceProvider($provider_data = array()){
if(empty($provider_data))
return 0;
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;
}
}
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){
......@@ -65,10 +62,10 @@ class Webservice_model extends CI_Model {
}
}
$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'));
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;
}
......@@ -94,7 +91,6 @@ class Webservice_model extends CI_Model {
return ($status)?1:0;
}
public function insert_auth($id){
$static_string = time();
$authToken = 'Dcarfixs'.sha1($static_string);
......@@ -105,7 +101,6 @@ class Webservice_model extends CI_Model {
} else {
$this->db->insert('authtable',array('customer_id'=>$id,'authtoken'=>$authToken));
}
return $authToken;
}
......@@ -166,21 +161,16 @@ class Webservice_model extends CI_Model {
return $respArr;
}
$where = ($type == 1)?array('bookings.booking_id'=>$id):array('bookings.customer_id'=>$id);
$bookDetails = '';
if($type == 1){
$bookDetails = ",mechanic.location,mechanic.location_lat,mechanic.location_lng";
}
$this->db->select("bookings.booking_id as id,bookings.scheduled_date as booked_date,bookings.scheduled_time as time,customer_vehicle.vehicle_data,customer_vehicle.customer_veh_id as vehicle_id,customer_vehicle.customer_veh_id as year,customer_vehicle.customer_veh_id as vehcle_make,customer_vehicle.customer_veh_id as vehicle_type,bookings.mileage,
bookings.service_type as is_emergency,bookings.status as service_status,bookings.issues_selected,bookings.custom_issue_data".$bookDetails);
$this->db->select("bookings.booking_id as id,bookings.scheduled_date as booked_date,bookings.scheduled_time as time,customer_vehicle.vehicle_data,customer_vehicle.customer_veh_id as vehicle_id,customer_vehicle.car_model_year as year,customer_vehicle.car_maker as vehcle_make,customer_vehicle.car_model as vehicle_type,bookings.mileage,
bookings.service_type as is_emergency,bookings.status as service_status,bookings.issues_selected,bookings.custom_issue_data,mechanic.location,mechanic.location_lat,mechanic.location_lng,mechanic_booking.amount,bookings.cost,TRIM(concat(mechanic.first_name,' ',IFNULL(mechanic.last_name,''))) as mechanic_name,mechanic.address,mechanic.phone,mechanic.mechanic_id");
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
if($type == 1){
$this->db->join("mechanic_booking","mechanic_booking.booking_id = bookings.booking_id AND mechanic_booking.status='1'");
$this->db->join("mechanic","mechanic_booking.mechanic_id = mechanic.mechanic_id");
}
$this->db->join("mechanic_booking","mechanic_booking.booking_id = bookings.booking_id AND mechanic_booking.status='1'");
$this->db->join("mechanic","mechanic_booking.mechanic_id = mechanic.mechanic_id");
$this->db->where('scheduled_date >',date('Y-m-d h:i'));
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$this->db->group_by('id');
$bookData = $this->db->get_where('bookings',$where)->result_array();
$respArr['status'] = 'success';
$respArr['message'] = 'success';
......@@ -190,9 +180,12 @@ class Webservice_model extends CI_Model {
$bookData[$key]['engine_no'] = json_decode($value['vehicle_data'])->engine;
$bookData[$key]['booked_date'] = (string) strtotime($value['booked_date'])*1000;
$bookData[$key]['booked_date'] = $bookData[$key]['booked_date']."";
$bookData[$key]['services'] = !empty($value['issues_selected'])?json_decode($value['issues_selected']):'';
if($value['is_emergency'] == '1'){
$bookData[$key]['services'] = !empty($value['issues_selected'])?json_decode($value['issues_selected']):'';
}
$bookData[$key]['service_description'] = !empty($value['custom_issue_data'])?json_decode($value['custom_issue_data'])->optionlaDescription:'';
unset($bookData[$key]['vehicle_data'],$bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data']);
$bookData[$key]['book_amount'] = ($value['is_emergency'] == '1')?$value['amount']:$value['cost'];
unset($bookData[$key]['vehicle_data'],$bookData[$key]['issues_selected'],$bookData[$key]['custom_issue_data'],$bookData[$key]['amount'],$bookData[$key]['cost']);
}
if($type == 1){
$respArr['data'] = $bookData[0];
......@@ -209,7 +202,6 @@ class Webservice_model extends CI_Model {
if(empty($id)){
return $respArr;
}
$this->db->select("bookings.booking_id as id,bookings.scheduled_date as date,bookings.scheduled_time as time");
$this->db->where('scheduled_date >',date('Y-m-d h:i'));
$bookData = $this->db->get_where('bookings',array('bookings.customer_id'=>$id))->result_array();
......@@ -232,7 +224,6 @@ class Webservice_model extends CI_Model {
if(empty($postData)){
return $respArr;
}
if(isset($postData['vehicle_id']) && !empty($postData['vehicle_id'])){
$result = $this->db->get_where('customer_vehicle',array('customer_veh_id'=>$postData['vehicle_id']))->row();
$postData['mileage'] = '';
......@@ -241,12 +232,12 @@ class Webservice_model extends CI_Model {
$save_car = (isset($postData['save_car']) && !empty($postData['save_car']))?'1':'3';
$car_name=$postData['vehicle_year'].' '.$postData['vehicle_make'].' '.$postData['vehicle_model'];
$vehJson = array(
'vehicle' => $car_name,
'year' => $postData['vehicle_year'],
'make' => $postData['vehicle_make'],
'trim' => $postData['vehicle_trim'],
'model' => $postData['vehicle_model'],
'engine'=> $postData['engine_no']
'vehicle' => $car_name,
'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,
......@@ -263,20 +254,17 @@ class Webservice_model extends CI_Model {
if($this->db->insert('customer_vehicle',$insert_array)){
$last_id = $this->db->insert_id();
}
if($save_car == '1'){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
return $respArr;
}
}
if(isset($postData['save_car']) && !empty($postData['save_car'])){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
return $respArr;
}
$book_data = array(
'mileage' => $postData['mileage'],
'customer_id' => $customer_id,
......@@ -354,11 +342,10 @@ class Webservice_model extends CI_Model {
'issues_selected'=>$issues,
'service_type'=>(isset($postData['is_emergency']) && !empty($postData['is_emergency']))?2:1
);
if($this->db->update('bookings',$insert_array,array('booking_id'=>$postData['booking_id']))){
$this->db->insert("mechanic_booking",array('booking_id'=>$postData['booking_id'],'mechanic_id'=>$postData['mechanic_id'],'amount'=>$cost,'status'=>'0'));
$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->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,bookings.customer_id");
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join("mechanic_booking","mechanic_booking.booking_id = bookings.booking_id AND mechanic_booking.mechanic_id =".$postData['mechanic_id'],'left');
$this->db->join('mechanic','mechanic_booking.mechanic_id = mechanic.mechanic_id');
......@@ -366,6 +353,9 @@ class Webservice_model extends CI_Model {
$this->db->join('mechanic_shop','mechanic_shop.shop_id = mechanic.shop_id','left');
$mech_data = $this->db->get_where('bookings',array('bookings.booking_id'=>$postData['booking_id']));
if(!empty($mech_data) && !empty($mechanic_data = $mech_data->row_array())){
$this->db->insert('transaction',array('customer_id'=>$mechanic_data['customer_id'],'booking_id'=>$postData['booking_id'],'payment_for'=>'1','datetime'=>date('Y-m-d h:i:s'),'amount'=>$cost));
$mechanic_data['trans_id'] = $this->db->insert_id();
$mech_veh_data = json_decode($mechanic_data['vehicle_data']);
$mechanic_data['engine_no'] = !empty($mech_veh_data->engine)?$mech_veh_data->engine:'';
$mechanic_data['vehicle_trim'] = !empty($mech_veh_data->trim)?$mech_veh_data->trim:'';
......@@ -393,7 +383,6 @@ class Webservice_model extends CI_Model {
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join("mechanic_booking","mechanic_booking.booking_id = bookings.booking_id AND mechanic_booking.status = '1'",'left');
$mech_data = $this->db->get_where('bookings',array('bookings.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'] = !empty($mech_veh_data->engine)?$mech_veh_data->engine:'';
......@@ -423,7 +412,6 @@ class Webservice_model extends CI_Model {
}
unset($mechanic_data['issues_selected']);
$issue_data = json_decode($mechanic_data['custom_issue_data']);
$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:'';
......@@ -463,7 +451,6 @@ class Webservice_model extends CI_Model {
if(empty($mechData) || empty($mechData = $mechData->result_array())){
return 0;
}
if($type == 0){
$respArr = $this->getNearMechanicsDetails($mechData,$issue_cat_id);
if($respArr['status'] == 'success'){
......@@ -483,7 +470,7 @@ class Webservice_model extends CI_Model {
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 {
}else {
$endTime = strtotime($data['end_time']);
$schTime = strtotime($data['start_time']);
$scheduleTiming = array();
......@@ -491,12 +478,10 @@ class Webservice_model extends CI_Model {
$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
......@@ -504,7 +489,6 @@ class Webservice_model extends CI_Model {
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())){
......@@ -631,7 +615,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'Amount is Required';
return $respArr;
}
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']));
......@@ -644,7 +627,6 @@ class Webservice_model extends CI_Model {
'amount'=>$postData['amount']
);
$this->db->insert('transaction',$transaction_array);
$respArr['data'] = $this->db->insert_id();
$respArr['status'] = 'success';
$respArr['message'] = 'Updated Successfully';
......@@ -657,12 +639,16 @@ class Webservice_model extends CI_Model {
return $respArr;
}
$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;
if(empty($result) || $result->num_rows() <= 0){
return;
}
$result = $result->row_array();
$respArr['status'] = 'success';
$respArr['data'] = $result;
$custData = $this->db->get_where('customers',array('customer_id'=>$result['customer_id']))->row();
if(empty($custData)){
return;
}
$respArr['emailId'] = $custData->email;
return $respArr;
}
......@@ -672,7 +658,6 @@ class Webservice_model extends CI_Model {
$odrStat = 9;
$trancRef = '';
$respJson = (!empty($result))?json_encode($result):'';
if(!empty($result) && isset($result['data']) && !empty($result['data'])){
$trancReference = $result['data']['id'];
if(isset($result['data']['status']) && $result['data']['status'] == 'success'){
......@@ -680,14 +665,12 @@ class Webservice_model extends CI_Model {
$odrStat = ($payfor == '2')?2:$odrStat;
}
}
$this->db->update('transaction',array('transaction_response'=>$respJson,'transaction_reference'=>$trancRef,'status'=>$status),array('id'=>$transId));
$this->db->update('transaction',array('transaction_response'=>$respJson,'transaction_reference'=>$trancReference,'status'=>$status),array('id'=>$transId));
if($payfor == '1'){
$this->db->query("UPDATE bookings
JOIN transaction ON transaction.booking_id=bookings.booking_id
SET bookings.status = $status WHERE transaction.id = $transId");
} else if($payfor == '2'){
}else if($payfor == '2'){
$this->db->query("UPDATE orders
JOIN transaction ON transaction.booking_id = orders.order_id
SET orders.status = $odrStat WHERE transaction.id = $transId");
......@@ -704,11 +687,13 @@ class Webservice_model extends CI_Model {
$odr_status = ($payfor == '2')?2:$odr_status;
}
$bookData = $this->db->get_where('transaction',array('id'=>$transId))->row();
$this->db->update('transaction',array('transaction_response'=>json_encode($result),'transaction_reference'=>$result['data']['id'],'status'=>$status),array('bulk_bkng_unqId'=>$bookData->bulk_bkng_unqId));
if($payfor == '2'){
$this->db->query("UPDATE orders JOIN transaction ON transaction.booking_id = orders.order_id SET orders.status = $odr_status WHERE transaction.bulk_bkng_unqId = '".$bookData->bulk_bkng_unqId."'");
}else if($payfor == '1'){
$this->db->query("UPDATE bookings
JOIN transaction ON transaction.booking_id=bookings.booking_id
SET bookings.status = $status WHERE transaction.id = $transId");
}
return 1;
}
......@@ -718,12 +703,10 @@ class Webservice_model extends CI_Model {
if(empty($postData)){
return $respArr;
}
$lmt = '';
$lmt = '';
if($start != 0 || $per_page != 0){
$lmt .= "LIMIT $start,$per_page";
}
}
$cartSel = '';
$cartJoin = '';
if(isset($postData['user_id']) && !empty($postData['user_id'])){
......@@ -731,39 +714,30 @@ class Webservice_model extends CI_Model {
$cartJoin = "LEFT JOIN cart AS CRT ON
(CRT.product_id=PRD.product_id AND CRT.customer_id=".$postData['user_id'].")";
}
$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 ";
}
}
if(isset($postData['brand_id']) && !empty($postData['brand_id'])){
$where .= " PRD.brand_id IN (".implode(',',$postData['brand_id']).") AND ";
}
if(isset($postData['minPrice']) && $postData['minPrice'] != ''){
$where .= " PRD.amount > ".$postData['minPrice']." AND ";
}
if(isset($postData['maxPrice']) && $postData['maxPrice'] != ''){
$where .= " PRD.amount < ".$postData['maxPrice']." AND ";
}
if(isset($postData['year']) && $postData['year'] != ''){
$where .= " CRD.year = ".$postData['year']." AND ";
}
if(isset($postData['maker']) && $postData['maker'] != ''){
$where .= " VEHM.veh_brand_id = ".$postData['maker']." AND ";
}
if(isset($postData['model']) && $postData['model'] != ''){
$where .= " VEHM.veh_modal_id = ".$postData['model']." AND ";
}
$result = $this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS count,PRD.*,PI.image".$cartSel."
FROM products AS PRD
......@@ -797,7 +771,6 @@ class Webservice_model extends CI_Model {
$respArr['minamount'] = $query->minamount;
$respArr['maxamount'] = $query->maxamount;
$respArr['brands'] = $prdt_brand;
}else{
$respArr['data'] = $prdt_brand;
}
......@@ -814,7 +787,6 @@ class Webservice_model extends CI_Model {
$per_page = 10;
$page = (isset($postData['page']) && $postData['page'] != 1) ?$postData['page'] :1;
$page_limit = ($page - 1) * $per_page;
$cartSel = '';
$cartJoin = '';
if(isset($postData['user_id']) && !empty($postData['user_id'])){
......@@ -822,7 +794,6 @@ class Webservice_model extends CI_Model {
$cartJoin = "LEFT JOIN cart AS CRT ON
(CRT.product_id=PRD.product_id AND CRT.customer_id=".$postData['user_id'].")";
}
$sql = "SELECT ROUND(AVG(REV.rating),2) AS rating, COUNT(REV.id) AS count,PRD.*,PRDB.brand_name".
$cartSel."
FROM products AS PRD
......@@ -830,46 +801,42 @@ class Webservice_model extends CI_Model {
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id ".$cartJoin."
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();
$respArr['data']->rating = (float)$respArr['data']->rating;
$prdt_img = $this->db->get_where('product_images',array('product_id'=>$postData['product_id'],'status'=>'1'))->result();
$review = $this->getReviewCount($postData['product_id'],0,0);
$reviewList = $this->getReviewCount($postData['product_id'],$page_limit,$per_page);
if(count($review) > 0){
$total = count($review);
}
if($total >= $per_page){
$totalPages = (int)($total%$per_page == 0?$total/$per_page:($total/$per_page)+1);
}
else{
$totalPages = 1;
}
$respArr['data']->images = '';
$respArr['data']->reviews = '';
if(count($prdt_img) > 0){
$respArr['data']->images = $prdt_img;
$respArr['data']->images = $prdt_img;
}
if(count($reviewList) > 0){
$respArr['data']->reviews['data'] = $reviewList;
$respArr['data']->reviews['meta'] = array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page);
} else{
$respArr['data']->reviews['data'] = $reviewList;
$respArr['data']->reviews['meta'] = array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page);
}else{
$respArr['data']->reviews['data'] = [];
$respArr['data']->reviews['meta'] = array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page);
$respArr['data']->reviews['meta'] = array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => ($page == 0)?1:$page,
'per_page' => $per_page);
}
}
return $respArr;
......@@ -877,16 +844,16 @@ class Webservice_model extends CI_Model {
public function getReviewCount($product_id,$start,$per_page){
$this->db->select("PRD.*,TRIM(CONCAT(CUST.first_name,' ',IFNULL(CUST.last_name,''))) as customer_name,CUST.profile_image");
$this->db->join('customers CUST','CUST.customer_id = PRD.customer_id');
$this->db->order_by('PRD.id DESC');
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$reviews = $this->db->get_where('product_rating PRD',array('PRD.product_id'=>$product_id,'PRD.status'=>'1'))->result();
foreach ($reviews as $key => $value) {
$reviews[$key]->rating = (float)$value->rating;
}
return $reviews;
$this->db->join('customers CUST','CUST.customer_id = PRD.customer_id');
$this->db->order_by('PRD.id DESC');
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$reviews = $this->db->get_where('product_rating PRD',array('PRD.product_id'=>$product_id,'PRD.status'=>'1'))->result();
foreach ($reviews as $key => $value) {
$reviews[$key]->rating = (float)$value->rating;
}
return $reviews;
}
public function saveUserAddress($postData = array()){
......@@ -895,7 +862,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'All Field is required';
return $respArr;
}
if($this->db->insert('customer_address',$postData)){
$respArr['status'] = "success";
$respArr['message'] = "Address Added Successfully";
......@@ -909,9 +875,8 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'User Id is required';
return $respArr;
}
$result = $this->db->get_where('customer_address',array('customer_id'=>$postData['user_id'],'status'=>'1'));
if(!empty($result) && !empty($result = $result->result())){
if(!empty($result) && !empty($result = $result->result())){
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
......@@ -928,9 +893,8 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'Customer Id is required';
return $respArr;
}
$result = $this->db->get_where('customer_address',array('id'=>$postData['address_id'],'customer_id'=>$postData['customer_id']));
if(!empty($result) && !empty($result = $result->row())){
if(!empty($result) && !empty($result = $result->row())){
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
......@@ -943,12 +907,10 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'All Field is required';
return $respArr;
}
if(empty($postData['address_id'])){
$respArr['message'] = 'Address Id is required';
return $respArr;
}
if($this->db->update('customer_address',$postData['data'],array('id'=>$postData['address_id']))){
$respArr['status'] = 'success';
$respArr['message'] = 'Address Updated Successfully';
......@@ -958,12 +920,10 @@ class Webservice_model extends CI_Model {
public function update_user_address($postData){
$respArr = array('status'=>'error');
if(empty($postData['id'])){
$respArr['message'] = 'Address Id is required';
return $respArr;
}
if($this->db->update('customer_address',$postData,array('id'=>$postData['id']))){
$respArr['status'] = 'success';
$respArr['message'] = 'Address Updated Successfully';
......@@ -977,9 +937,7 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'All Field is required';
return $respArr;
}
$squence = str_pad(rand(1111,9999),4,0,STR_PAD_LEFT);
$insert_array = array(
'format_order_id'=>'ORD'.date('ymd').$squence,
'product_id'=>$postData['data']['product_id'],
......@@ -990,7 +948,6 @@ class Webservice_model extends CI_Model {
);
$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,
......@@ -1010,7 +967,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'All Field is required';
return $respArr;
}
$this->db->delete('cart',array('customer_id'=>$postData['customer_id']));
$bulk_flag = 0;
$bulkUnqueId = '';
......@@ -1018,7 +974,6 @@ class Webservice_model extends CI_Model {
$bulk_flag = 1;
$bulkUnqueId = 'ORDBK'.time();
}
$transId = '';
foreach ($postData['data'] as $orderKey => $orderValue) {
$orderValue['customer_id'] = $postData['customer_id'];
......@@ -1026,12 +981,10 @@ class Webservice_model extends CI_Model {
$orderValue['bulk_bkng_flag'] = $bulk_flag;
$transId = $this->insertOrders($orderValue);
}
if(empty($transId)){
$respArr['status'] = 'error';
return $respArr;
}
$respArr['status'] = 'success';
$respArr['data'] = $transId;
return $respArr;
......@@ -1053,15 +1006,14 @@ class Webservice_model extends CI_Model {
$status = $this->db->insert('orders',$insertArray);
if(!$status) return;
$insert_id = $this->db->insert_id();
$insertArray = array(
'customer_id'=>$orderValue['customer_id'],'booking_id'=>$insert_id,
'payment_for'=>'2','datetime'=>date('Y-m-d h:i:s'),
'amount'=>$orderValue['total_amount'],
'bulk_bkng_flag'=>$orderValue['bulk_bkng_flag'],
'bulk_bkng_unqId'=>$orderValue['bulkUnqueId'],
'bulk_amount'=>$orderValue['bulk_amount']
);
'customer_id'=>$orderValue['customer_id'],'booking_id'=>$insert_id,
'payment_for'=>'2','datetime'=>date('Y-m-d h:i:s'),
'amount'=>$orderValue['total_amount'],
'bulk_bkng_flag'=>$orderValue['bulk_bkng_flag'],
'bulk_bkng_unqId'=>$orderValue['bulkUnqueId'],
'bulk_amount'=>$orderValue['bulk_amount']
);
$this->db->insert('transaction',$insertArray);
if(!$status) return;
$insert_id = $this->db->insert_id();
......@@ -1074,7 +1026,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'Order Id is required';
return $respArr;
}
$result = $this->db->query("SELECT TRANS.amount,CUST.email
FROM transaction TRANS
LEFT JOIN customers CUST
......@@ -1083,7 +1034,6 @@ class Webservice_model extends CI_Model {
);
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");
$respArr['status'] = 'success';
$respArr['data'] = $result;
}
......@@ -1096,7 +1046,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'Order Id is required';
return $respArr;
}
$result = $this->db->query("SELECT TRANS.bulk_amount,CUST.email,TRANS.bulk_bkng_unqId
FROM transaction TRANS
LEFT JOIN customers CUST
......@@ -1117,9 +1066,8 @@ class Webservice_model extends CI_Model {
$respArr['message'] = 'Transaction Id is required';
return $respArr;
}
$result = $this->db->query("SELECT TRANS.datetime,TRANS.booking_id,TRANS.amount,TRANS.status,PRD.product_id,
PRD.product_name,PRD.short_description,PRD.part_id,ORDS.format_order_id,ORDS.quantity,ORDS.expected_delivery,ORDS.delivered,ORDS.status AS odr_status,PRDR.id AS review_id
$result = $this->db->query("SELECT TRANS.datetime,TRANS.booking_id,TRANS.amount,TRANS.status,
PRD.product_id,PRD.product_name,PRD.short_description,PRD.part_id,ORDS.format_order_id,ORDS.quantity,ORDS.expected_delivery,ORDS.delivered,ORDS.status AS odr_status,PRDR.id AS review_id
FROM transaction TRANS
JOIN orders ORDS ON ORDS.order_id = TRANS.booking_id
JOIN products PRD ON PRD.product_id = ORDS.product_id
......@@ -1129,7 +1077,7 @@ class Webservice_model extends CI_Model {
$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;
$result->images = $prdt_img;
}
$respArr['status'] = 'success';
$respArr['data'] = $result;
......@@ -1145,13 +1093,11 @@ class Webservice_model extends CI_Model {
}
$postData['datetime'] = date('Y-m-d h:i:s');
$result = $this->db->get_where('product_rating',array('product_id'=>$postData['product_id'],'customer_id'=>$postData['customer_id']));
if(!empty($result) && $result->num_rows > 0 && !empty($result = $result->row())){
$respArr['status'] = 'error';
$respArr['message'] = 'Sorry Your are Already Rated for this Product';
return $respArr;
}
if($this->db->insert('product_rating',$postData)){
$respArr['status'] = 'success';
$respArr['message'] = 'Rated Successfully';
......@@ -1165,7 +1111,6 @@ class Webservice_model extends CI_Model {
if($start != 0 || $per_page != 0){
$lmt .= "LIMIT $start,$per_page";
}
$cartSel = '';
$cartJoin = '';
if(isset($postData['user_id']) && !empty($postData['user_id'])){
......@@ -1173,7 +1118,6 @@ class Webservice_model extends CI_Model {
$cartJoin = "LEFT JOIN cart AS CRT ON
(CRT.product_id=PRD.product_id AND CRT.customer_id=".$postData['user_id'].")";
}
$result = $this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
COUNT(REV.id) AS reviews,PRD.*,PI.image as product_image,BRND.brand_name".$cartSel."
FROM products AS PRD
......@@ -1206,7 +1150,6 @@ class Webservice_model extends CI_Model {
if($start != 0 || $per_page != 0){
$lmt .= "LIMIT $start,$per_page";
}
$cartSel = '';
$cartJoin = '';
if(isset($postData['user_id']) && !empty($postData['user_id'])){
......@@ -1214,9 +1157,7 @@ class Webservice_model extends CI_Model {
$cartJoin = "LEFT JOIN cart AS CRT ON
(CRT.product_id=PRD.product_id AND CRT.customer_id=".$postData['user_id'].")";
}
$sql = $this->db->query("SELECT COUNT(ORDS.product_id) as count,PRD.product_id FROM products PRD LEFT JOIN orders AS ORDS ON ORDS.product_id = PRD.product_id WHERE PRD.status='1' GROUP BY PRD.product_id ORDER BY count DESC $lmt ");
if(!empty($sql) && $sql->num_rows() > 0){
foreach ($sql->result_array() as $key => $value) {
$result = $this->db->query("SELECT ROUND(AVG(REV.rating),2) AS rating,
......@@ -1259,25 +1200,21 @@ class Webservice_model extends CI_Model {
FROM orders ORD
JOIN products PRD ON ORD.product_id = PRD.product_id
JOIN transaction TRANS ON (ORD.order_id = TRANS.booking_id AND TRANS.payment_for= '2')
LEFT JOIN product_rating AS REV ON REV.product_id = PRD.product_id
LEFT JOIN product_images AS PI ON (PI.id=
(SELECT MIN(id)
FROM product_images
WHERE product_id= PRD.product_id AND
PRD.status='1'))
JOIN product_brand AS BRND ON BRND.brand_id = PRD.brand_id
WHERE ORD.customer_id=".$postData['customer_id']." GROUP BY ORD.order_id ORDER BY ORD.order_id DESC $lmt");
if(empty($result) || empty($result = $result->result())){
$respArr['status'] = "error";
return $respArr;
}
foreach ($result as $key => $value) {
$result[$key]->rating = (float)$value->rating;
}
$respArr['status'] = "success";
$respArr['data'] = $result;
return $respArr;
......@@ -1289,7 +1226,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = "Order Id is Required";
return $respArr;
}
if($this->db->update('orders',array('status'=>'7'),array('order_id'=>$postData['order_id']))){
$respArr['status'] = 'success';
$respArr['message'] = 'Order Cancelled Successfully';
......@@ -1303,7 +1239,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = "Customer Id is Required";
return $respArr;
}
$lmt = '';
if($start != 0 || $per_page != 0){
$lmt .= "LIMIT $start,$per_page";
......@@ -1325,11 +1260,9 @@ class Webservice_model extends CI_Model {
$respArr['status'] = "error";
return $respArr;
}
foreach ($result as $key => $value) {
$result[$key]->rating = (float)$value->rating;
}
$respArr['status'] = "success";
$respArr['data'] = $result;
return $respArr;
......@@ -1341,7 +1274,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = "Cart Id is Required";
return $respArr;
}
if($this->db->delete('cart',array('cart_id'=>$postData['cart_id']))){
$respArr['status'] = "success";
}
......@@ -1354,7 +1286,6 @@ class Webservice_model extends CI_Model {
$respArr['message'] = "All Field is Required";
return $respArr;
}
$postData['created_date'] = date('Y-m-d h:i:s');
$cartData = $this->db->get_where('cart',array('product_id'=>$postData['product_id'],'customer_id'=>$postData['customer_id']));
if($cartData->num_rows < 0 || empty($cartData = $cartData->row())){
......@@ -1375,16 +1306,13 @@ class Webservice_model extends CI_Model {
$respArr['status'] = "error";
return $respArr;
}
$respArr['status'] = 'success';
$respArr['data'] = $result;
return $respArr;
}
public function getVehicleBrand(){
$respArr = array('status'=>'error');
$this->db->order_by('maker');
$this->db->where('status','1');
$result = $this->db->get('vehicles_brand');
......@@ -1392,10 +1320,8 @@ class Webservice_model extends CI_Model {
$respArr['status'] = "error";
return $respArr;
}
$respArr['status'] = 'success';
$respArr['data'] = $result;
return $respArr;
}
......@@ -1404,7 +1330,6 @@ class Webservice_model extends CI_Model {
if(!isset($postData['vehBrand_id']) && empty($postData['vehBrand_id'])){
$respArr['message'] = 'Vehicle Brand Id is Required' ;
}
$this->db->select("DISTINCT(model) as model,veh_modal_id,engine,trim");
$this->db->order_by('model');
$result = $this->db->get_where('vehicles_model',
......@@ -1417,7 +1342,7 @@ class Webservice_model extends CI_Model {
$type = (isset($postData['type']) && $postData['type'] != '')?$postData['type']:0;
foreach ($result as $key => $model) {
if($type == 0 && in_array($model->model,$modArr)){
unset($result[$key]);
unset($result[$key]);
}
if($type == 1){
$model->model = $model->model;
......@@ -1428,10 +1353,8 @@ class Webservice_model extends CI_Model {
$modArr[] = $model->model;
}
$result = array_merge($result);
$respArr['status'] = 'success';
$respArr['data'] = $result;
return $respArr;
}
......@@ -1440,13 +1363,11 @@ class Webservice_model extends CI_Model {
if(empty($postData['data'])){
$respArr['message'] = 'All Field is Required' ;
}
$result=$this->db->get_where('customers',array('email'=>$postData['data']['email'],'status'=>'1'));
if(!empty($result) && $result->num_rows() == 1 && !empty($custData = $result->row())){
$respArr['data'] = $custData;
$respArr['status'] = 1;
return $respArr;
$respArr['data'] = $custData;
$respArr['status'] = 1;
return $respArr;
}
if(empty($result) || $result->num_rows() < 1 || empty($custData = $result->row())){
$postData['data']['profile_image'] = '';
......@@ -1456,16 +1377,12 @@ class Webservice_model extends CI_Model {
$imageData = file_get_contents($postData['data']['image_url']);
$userlImg = 'assets/uploads/services/userImg_'.time().'.jpg';
file_put_contents($userlImg, $imageData);
$postData['data']['profile_image'] = $userlImg;
}
unset($postData['data']['image_url']);
$this->db->insert('customers',$postData['data']);
$last_id = $this->db->insert_id();
$custData = $this->db->get_where('customers',array('customer_id'=>$last_id))->row();
$respArr['data'] = $custData;
$respArr['status'] = 1;
return $respArr;
......@@ -1477,35 +1394,28 @@ class Webservice_model extends CI_Model {
if(empty($cust_id = $postData['customer_id'])){
$respArr['message'] = 'Customer Id is Required' ;
}
$new = array();
$result = $this->db->get_where('customer_vehicle',
array('customer_id'=>$cust_id,'enable_notification'=>'1','status'=>'1'));
if(!empty($result) && !empty($result = $result->result_array())){
foreach ($result AS $veh_value) {
$veh_id = $veh_value['customer_veh_id'];
$this->db->where('customer_veh_id',$veh_id);
$this->db->where_in('status',array('1','3'));
$this->db->order_by('booking_id','DESC');
$lstBok = $this->db->get("bookings");
$lastMainDate = $veh_value['last_maintenance_date'];
if(!empty($lstBok) && $lstBok->num_rows() > 0 && !empty($lstBok = $lstBok->row_array())){
if(strtotime($lstBok['scheduled_date']) > strtotime($lastMainDate)){
$lastMainDate = $lstBok['scheduled_date'];
}
}
if(empty($lastMainDate)){
continue;
}
$interval = (!empty($veh_value['maintanence_interval']))?$veh_value['maintanence_interval']:6;
$newMainDate = strtotime(date("Y-m-d", strtotime($lastMainDate)) . " +".$interval." month");
$remindDate = strtotime(date("Y-m-d", $newMainDate) . " -10 days");
if(strtotime(date('Y-m-d')) >= $remindDate){
$veh_value['last_maintenance_date'] = $lastMainDate;
$veh_value['next_maintenance_date'] = date('Y-m-d',$newMainDate);
......@@ -1537,14 +1447,12 @@ class Webservice_model extends CI_Model {
if(empty($cust_id = $postData['car_id'])){
$respArr['message'] = 'Car Id is Required' ;
}
$this->db->select('vehicle_data');
$carData = $this->db->get_where('customer_vehicle',array('customer_veh_id'=>$postData['car_id']))->row();
if(empty($carData)){
$respArr['message'] = "Vehicle Doesnot Exist";
return $respArr;
}
$veh_data = json_decode($carData->vehicle_data);
$result = $this->db->query("SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
FROM vehicles_model AS VEHM
......@@ -1564,14 +1472,13 @@ class Webservice_model extends CI_Model {
);
}
if(empty($result) || $result->num_rows() <= 0){
$result = $this->db->query("SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
$result = $this->db->query("SELECT VEHM.veh_modal_id,VEHM.veh_brand_id
FROM vehicles_model AS VEHM
INNER JOIN vehicles_brand AS VEHB ON VEHB.veh_brand_id = VEHM.veh_brand_id
WHERE VEHB.maker LIKE '$veh_data->make'
AND VEHM.model LIKE '$veh_data->model'"
);
}
if(!empty($result) && $result->num_rows() > 0 && !empty($data = $result->row())){
$respArr['data'] = $data;
$respArr['status'] = 'success';
......@@ -1581,5 +1488,34 @@ class Webservice_model extends CI_Model {
return $respArr;
}
public function remove_vehicle($postData = array()){
$respArr = array('status'=>'error');
if(empty($postData['customer_veh_id'])){
$respArr['message'] = 'Vehicle Id is Required' ;
return $respArr;
}
if($this->db->update("customer_vehicle",array('status'=>'2'),array("customer_veh_id"=>$postData['customer_veh_id']))){
$respArr['status'] = "success";
$respArr['message'] = "Vehicle Deleted Successfully";
}
return $respArr;
}
public function get_mechanics_reviews($postData=array(),$start='',$per_page=''){
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
$this->db->select("mechanic_rating.*,TRIM(CONCAT(customers.first_name,' ' ,IFNULL(customers.last_name,''))) as customers_name");
$this->db->join('customers','customers.customer_id = mechanic_rating.customer_id');
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$review = $this->db->get_where('mechanic_rating',array('mechanic_id'=>$postData['mechanic_id']));
if(!empty($service) && !empty($reviewData = $review->result_array())){
$respArr['status'] = 'success';
$respArr['message'] = 'success';
$respArr['data']= $reviewData;
}
return $respArr;
}
}
?>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -21,7 +20,6 @@
</div>
<?php } ?>
</div>
<div class="col-sm-12">
<div class="box box-warning">
<div class="box-header with-border">
......@@ -42,12 +40,11 @@
<div class="col-sm-12">
<div class="form-group">
<label>Choose a Mechanic</label>
<select name="mechanic_id" class="form-control required" data-parsley-trigger="change"
onchange="changeMechanic()" dmClick="0" required>
<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>
<option>View All</option>
<?php }else{ ?>
<option selected disabled>Select Mechanic</option>
<option selected disabled>Select Mechanic</option>
<?php }
if(!empty($mechanic_data)){
foreach ($mechanic_data as $mechanic) {
......@@ -76,7 +73,6 @@
<tr>
<th class="hidden">ID</th>
<th width="18%;">Car Name</th>
<!-- <th width="12%;">Mechanic</th> -->
<th width="12%;">Customer</th>
<th width="15%;">Scheduled Date</th>
<th width="11%;">Service Fee</th>
......@@ -118,8 +114,6 @@
<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($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)) ?>">
......@@ -165,7 +159,7 @@
</div>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -46,8 +45,7 @@
<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');" />
<input name="brand_logo" type="file" accept="image/*" onchange="setImg(this,'brand_image');" />
</div>
</div>
</div>
......
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -11,15 +9,14 @@
<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'] ?>
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
......@@ -41,10 +38,10 @@
<th width="150px;">Brand Image</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</tr>
</thead>
<tbody>
<?php
<?php
if(!empty($brand_data)){
foreach($brand_data as $brand) { ?>
<tr>
......@@ -63,16 +60,7 @@
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 } ?> -->
</a>
</td>
</tr>
<?php } } ?>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -196,7 +195,6 @@
id="loc_search_1" input="search_params" placeholder="Enter Vehicle Location" required>
</div>
</div>
<div class="col-md-12 padTop10">
<div class="col-md-6">
<label>Engine</label>
......
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1> <?= $page_title ?>
<small><?= $page_desc ?></small>
......@@ -24,8 +23,7 @@
<div class="small-box bg-yellow">
<div class="inner">
<h4>Users</h4>
<p><?php
echo 'Total : '. $customerCount ?></p>
<p><?php echo 'Total : '. $customerCount ?></p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
......@@ -33,17 +31,13 @@
<a href="<?= base_url('Customer/listCustomerUsers') ?>" class="small-box-footer ">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($bookingCount) && !empty($bookingCount)){ ?>
<?php } if(isset($bookingCount) && !empty($bookingCount)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h4>Total Bookings</h4>
<p>
<?php
echo 'Total : '.$bookingCount;
?>
<?php echo 'Total : '.$bookingCount; ?>
</p>
</div>
<div class="icon">
......@@ -52,15 +46,12 @@
<a href="<?= base_url('Bookings/listBookings') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($completeBukngCnt) && !empty($completeBukngCnt)){ ?>
<?php } if(isset($completeBukngCnt) && !empty($completeBukngCnt)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-aqua">
<div class="inner">
<h4>Completed Bookings</h4>
<p><?php
echo 'Total : '. $completeBukngCnt ?></p>
<p><?php echo 'Total : '. $completeBukngCnt ?></p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
......@@ -68,15 +59,12 @@
<a href="<?= base_url('Bookings/listBookings') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($pendingBukngCnt) && !empty($pendingBukngCnt)){ ?>
<?php } if(isset($pendingBukngCnt) && !empty($pendingBukngCnt)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue">
<div class="inner">
<h4>Pending Bookings</h4>
<p><?php
echo 'Total : '. $pendingBukngCnt ?></p>
<p><?php echo 'Total : '. $pendingBukngCnt ?></p>
</div>
<div class="icon">
<i class="ion ion-stats-bars"></i>
......@@ -84,15 +72,12 @@
<a href="<?= base_url('Bookings/listBookings') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($shopCount) && !empty($shopCount)){ ?>
<?php } if(isset($shopCount) && !empty($shopCount)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue">
<div class="small-box bg-red">
<div class="inner">
<h4>Mechanic Shops</h4>
<p><?php
echo 'Total : '. $shopCount ?></p>
<p><?php echo 'Total : '. $shopCount ?></p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
......@@ -100,16 +85,12 @@
<a href="<?= base_url('Shop/viewShops') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($mobileVendors) && !empty($mobileVendors)){ ?>
<?php } if(isset($mobileVendors) && !empty($mobileVendors)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-yellow">
<div class="small-box bg-blue">
<div class="inner">
<h4> Mobile Vendors</h4>
<p><?php
echo 'Total : '. $mobileVendors ?></p>
<p><?php echo 'Total : '. $mobileVendors ?></p>
</div>
<div class="icon">
<i class="ion ion-stats-bars"></i>
......@@ -117,15 +98,12 @@
<a href="<?= base_url('Mechanic/viewMechanics') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($mobileMechanics) && !empty($mobileMechanics)){ ?>
<?php } if(isset($mobileMechanics) && !empty($mobileMechanics)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-red">
<div class="small-box bg-orange">
<div class="inner">
<h4>Mobile Mechanics</h4>
<p><?php
echo 'Total : '. $mobileMechanics ?></p>
<p><?php echo 'Total : '. $mobileMechanics ?></p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
......@@ -133,15 +111,12 @@
<a href="<?= base_url('Mechanic/viewMechanics') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($productCount) && !empty($productCount)){ ?>
<?php } if(isset($productCount) && !empty($productCount)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h4>Product Count</h4>
<p><?php
echo 'Total : '. $productCount ?></p>
<p><?php echo 'Total : '. $productCount ?></p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
......@@ -149,15 +124,12 @@
<a href="<?= base_url('Product/viewProducts') ?>" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<?php } ?>
<?php if(isset($productSold) && !empty($productSold)){ ?>
<?php } if(isset($productSold) && !empty($productSold)){ ?>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-red">
<div class="small-box bg-yellow">
<div class="inner">
<h4>Product Sold</h4>
<p><?php
echo 'Total : '. $productSold ?></p>
<p><?php echo 'Total : '. $productSold ?></p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
......@@ -166,14 +138,14 @@
</div>
</div>
<?php } ?>
</div>
<div class="row">
<div class="col-md-6" id="order_report">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Order Sales Report</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
......@@ -182,14 +154,12 @@
</div>
</div>
</div>
<div class="col-md-6" id="booking_report">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Booking Sales Report</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
......@@ -202,51 +172,51 @@
</section>
</div>
<script type="text/javascript">
$(function () {
jQuery.ajax({
type: "POST",
url: base_url + 'Dashboard/getOrderSalesReportCount',
success: function (data) {
if(data == '1' || data == ''){
$('#order_report').addClass('hide');
return false;
}
var data = jQuery.parseJSON(data);
var line = new Morris.Line({
element: 'line-chart',
resize: true,
data: data,
xkey: 'y',
ykeys: ['item1'],
labels: ['Total Orders'],
lineColors: ['#3c8dbc'],
hideHover: 'auto'
});
}
})
})
$(function () {
jQuery.ajax({
type: "POST",
url: base_url + 'Dashboard/getOrderSalesReportCount',
success: function (data) {
// if(data == '1' || data == ''){
// $('#order_report').addClass('hide');
// return false;
// }
var data = jQuery.parseJSON(data);
var line = new Morris.Line({
element: 'line-chart',
resize: true,
data: data,
xkey: 'y',
ykeys: ['item1'],
labels: ['Total Orders'],
lineColors: ['#3c8dbc'],
hideHover: 'auto'
});
}
})
})
$(function () {
jQuery.ajax({
type: "POST",
url: base_url + 'Dashboard/getBookingReportCount',
success: function (data) {
if(data == '1'){
$('#booking_report').addClass('hide');
return false;
}
var data = jQuery.parseJSON(data);
var line = new Morris.Line({
element: 'line-chart-booking',
resize: true,
data: data,
xkey: 'y',
ykeys: ['item1'],
labels: ['Total Bookings'],
lineColors: ['#701d9a'],
hideHover: 'auto'
});
}
})
})
$(function () {
jQuery.ajax({
type: "POST",
url: base_url + 'Dashboard/getBookingReportCount',
success: function (data) {
// if(data == '1'){
// $('#booking_report').addClass('hide');
// return false;
// }
var data = jQuery.parseJSON(data);
var line = new Morris.Line({
element: 'line-chart-booking',
resize: true,
data: data,
xkey: 'y',
ykeys: ['item1'],
labels: ['Total Bookings'],
lineColors: ['#701d9a'],
hideHover: 'auto'
});
}
})
})
</script>
\ No newline at end of file
......@@ -40,7 +40,6 @@
</select>
</div>
</div>
<div class="col-md-6 hide" id="import_file">
<div class="form-group">
<label>Import File</label>
......@@ -52,7 +51,6 @@
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -154,7 +153,6 @@
</section>
</div>
<!-- ADD SUB ITEM HTML -->
<div id="subIssueAdd" class="hide">
......@@ -182,8 +180,7 @@
<img class="small-icon" id="issue_cat_image_{:count}" src="" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" />
</div>
<div class="col-md-8" style="padding-top: 12px;">
<input name="issue_cat_image[]" type="file" accept="image/*"
onchange="setImg(this,'issue_cat_image_{:count}');" required />
<input name="issue_cat_image[]" type="file" accept="image/*" onchange="setImg(this,'issue_cat_image_{:count}');" required />
</div>
</div>
</div>
\ No newline at end of file
......@@ -79,7 +79,6 @@
<div class="col-md-12 padBottom10">
<label>Issue Sub Type Details</label>
</div>
<div id="subTypeDtlsCntrData">
<?php
$disabled = 'disabled';
......@@ -91,33 +90,32 @@
$txtAreaCls = '';
}
if($edit && !empty($mechanicIssueData['sub_issue'])) {
foreach($mechanicIssueData['sub_issue'] AS $issue_cat_id => $sub_issue) { ?>
<div class="col-md-12">
<div class="col-md-1"></div>
<div class="col-md-1 marginTop5">
<i class="fa fa-arrow-circle-right fav-add-icon"></i>
foreach($mechanicIssueData['sub_issue'] AS $issue_cat_id => $sub_issue) { ?>
<div class="col-md-12">
<div class="col-md-1"></div>
<div class="col-md-1 marginTop5">
<i class="fa fa-arrow-circle-right fav-add-icon"></i>
</div>
<div class="col-md-2">
<label><?= $sub_issue['issue_category'] ?></label>
</div>
<div class="col-md-2 marginBottom-10">
<img class="small-icon" src="<?= base_url($sub_issue['issue_cat_image']) ?>"
onerror="this.src='<?= base_url('assets/images/no_image_text.png') ?>';" />
</div>
<div class="col-md-4 marginBottom-10">
<textarea name="default_description_<?= $issue_cat_id ?>" <?= $disabled ?> required class="custom-textarea-style <?= $txtAreaCls ?>"><?= $sub_issue['description'] ?></textarea>
</div>
<div class="col-md-2">
Service Fee :
<input name="default_service_fee_<?= $issue_cat_id ?>" <?= $disabled ?> required data-parsley-pattern="^[0-9\ . \/]+$" class="custom-input-style <?= $inputCls ?>" maxlength="6" value="<?= $sub_issue['service_fee'] ?>">
</div>
</div>
<div class="col-md-2">
<label><?= $sub_issue['issue_category'] ?></label>
</div>
<div class="col-md-2 marginBottom-10">
<img class="small-icon" src="<?= base_url($sub_issue['issue_cat_image']) ?>"
onerror="this.src='<?= base_url('assets/images/no_image_text.png') ?>';" />
</div>
<div class="col-md-4 marginBottom-10">
<textarea name="default_description_<?= $issue_cat_id ?>" <?= $disabled ?> required class="custom-textarea-style <?= $txtAreaCls ?>"><?= $sub_issue['description'] ?></textarea>
</div>
<div class="col-md-2">
Service Fee :
<input name="default_service_fee_<?= $issue_cat_id ?>" <?= $disabled ?> required data-parsley-pattern="^[0-9\ . \/]+$" class="custom-input-style <?= $inputCls ?>" maxlength="6" value="<?= $sub_issue['service_fee'] ?>">
</div>
</div>
<input type="hidden" name="issue_cat_ids[]" value="<?= $issue_cat_id ?>">
<input type="hidden" name="issue_cat_ids[]" value="<?= $issue_cat_id ?>">
<?php } } ?>
</div>
</div>
</div>
<div class="col-md-12 marginTop10">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
......
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<?= $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>
......@@ -11,15 +9,14 @@
<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'] ?>
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
......@@ -56,8 +53,7 @@
<th class="center"><?= ($issue->status == 1)?'Active':'De-activate' ?></th>
<td class="center float-right">
<?php if(!empty($issue->issue_cat_id)){ ?>
<a class="btn btn-sm btn-info cpoint"
onclick="viewIssueDetls('<?= encode_param($issue->issue_id) ?>');">
<a class="btn btn-sm btn-info cpoint" onclick="viewIssueDetls('<?= encode_param($issue->issue_id) ?>');">
<i class="fa fa-fw fa-eye"></i>View Issue Sub Categories
</a>
<?php } ?>
......
......@@ -3,9 +3,7 @@
?>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<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>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......@@ -28,7 +25,6 @@
<div class="box-body">
<form 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>
......@@ -69,7 +65,6 @@
</div>
</div>
</div>
<!-- Mechanic Data -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Personal Details</h3>
......@@ -150,7 +145,6 @@
value="<?= (isset($user_data->phone))?$user_data->phone:'' ?>" name="phone" placeholder="Enter Phone Number" >
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group" style="display:inline-flex;">
<div style="width:250px;" class="clockpicker" data-autoclose="true">
<label>Working Hours</label>
......@@ -160,17 +154,14 @@
id="start_time" autocomplete="off" >
<span class="glyphicon form-control-feedback"></span>
</div>
<div style="width:250px;padding-left:10px;padding-top:25px;"
class="clockpicker" data-autoclose="true">
<div style="width:250px;padding-left:10px;padding-top:25px;" class="clockpicker" data-autoclose="true">
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" placeholder="Work End Time" autocomplete="off"
data-parsley-minlength="2" required="" placeholder="Work End Time" autocomplete="off"
value="<?= (isset($user_data->end_time))?$user_data->end_time:'' ?>" id="end_time"
name="end_time">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="form-group">
<label>Licence Number</label>
<input type="text" class="form-control" data-parsley-trigger="change"
......@@ -196,8 +187,7 @@
<img id="licence_image" src="<?= (isset($user_data->licence))?base_url($user_data->licence):'' ?>" 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="licence" type="file" accept="image/*"
onchange="setImg(this,'licence_image');" />
<input name="licence" type="file" accept="image/*" onchange="setImg(this,'licence_image');" />
</div>
</div>
</div>
......
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<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>
......@@ -11,7 +8,6 @@
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<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>
......@@ -38,7 +36,6 @@
<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>
......@@ -47,7 +44,6 @@
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
......@@ -56,7 +52,6 @@
<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>
......@@ -66,8 +61,6 @@
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
......@@ -76,7 +69,6 @@
<textarea id="rich_editor_6" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Invoice Template" name="invoice_template" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->invoice_template ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-md-6">
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<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>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
<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>
......@@ -28,7 +26,6 @@
<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>
......@@ -56,7 +53,6 @@
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 class="form-group">
<label>Part ID</label>
<input type="text" class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" name="part_id"
......@@ -79,7 +75,6 @@
<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>
......@@ -96,12 +91,11 @@
<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>
onclick="removeImage('<?= $count ?>');">&times;</div>
<input disabled type="file" name="product_image[]" class="multiFileUpload"
accept="image/*" onchange="setMultiImg(this,jQuery(this));"
count="<?= $count ?>" />
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")?>';" />
src="<?= base_url($photos['image']) ?>" onerror="this.src='<?=base_url("assets/images/add-image.png")?>';" />
</div>
<?php
$count += 1;
......@@ -110,139 +104,138 @@
?>
<div class="dropZoneContainer" id="multiImageCntr_<?= $count ?>">
<div id="multiImageClose_<?= $count ?>" class="close_custom cpoint hide"
onclick="removeImage('<?= $count ?>');">&times;</div>
onclick="removeImage('<?= $count ?>');">&times;</div>
<input type="file" name="product_image[]" class="multiFileUpload" accept="image/*"
onchange="setMultiImg(this,jQuery(this));" count="<?= $count ?>" />
onchange="setMultiImg(this,jQuery(this));" count="<?= $count ?>" />
<img class="multiDropZoneOverlay" id="multiImageImg_<?= $count ?>"
src="<?=base_url("assets/images/add-image.png")?>" />
src="<?=base_url("assets/images/add-image.png")?>" />
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<div class="row">
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Product Details</h3>
<div class="form-group">
<div class="row">
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Product Details</h3>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-3">
<label>Vehicle Model Year</label>
<select name="vehYear" class="form-control" input="search_params"
data-parsley-trigger="change">
<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" data-parsley-trigger="change" id="veh_make">
<option selected disabled value="">Choose Vehicle Make</option>
<?php
foreach ($veh_data['make'] as $key => $value) {
$cond = (isset($product_data) && isset($product_data->veh_brand_id) &&
!empty($product_data->veh_brand_id) &&
$product_data->veh_brand_id == $value->veh_brand_id)?'selected':'';
echo '<option '.$cond.' maker="'.$value->veh_brand_id.'" value="'.$value->veh_brand_id.'">'.$value->maker.'</option>';
}
?>
</select>
</div>
<div class="col-md-4">
<label>Vehicle Model</label>
<select name="vehModel" class="form-control" data-parsley-trigger="change" id="veh_model">
<option selected="" disabled="" value="">Choose Vehicle Model</option>
<?php
if((isset($product_id) || !empty($product_id))){
foreach ($veh_data['model'] as $key => $value) {
$cond = (isset($product_data) && isset($product_data->veh_modal_id) &&
!empty($product_data->veh_modal_id) &&
$product_data->veh_modal_id == $value->veh_modal_id)?'selected':'';
echo '<option '.$cond.' value="'.$value->veh_modal_id.'">'.$value->model.' '.$value->trim.' '.$value->engine.'</option>';
<div class="form-group">
<div class="row">
<div class="col-md-3">
<label>Vehicle Model Year</label>
<select name="vehYear" class="form-control" input="search_params"
data-parsley-trigger="change">
<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-1">
<div class="col-md-1">
<div class="row" style="margin-top: 28px !important;">
<div class="col-md-6"></div>
<div class="col-md-6">
?>
</select>
</div>
<div class="col-md-4">
<label>Vehicle Make</label>
<select name="vehMake" class="form-control" data-parsley-trigger="change" id="veh_make">
<option selected disabled value="">Choose Vehicle Make</option>
<?php
foreach ($veh_data['make'] as $key => $value) {
$cond = (isset($product_data) && isset($product_data->veh_brand_id) &&
!empty($product_data->veh_brand_id) &&
$product_data->veh_brand_id == $value->veh_brand_id)?'selected':'';
echo '<option '.$cond.' maker="'.$value->veh_brand_id.'" value="'.$value->veh_brand_id.'">'.$value->maker.'</option>';
}
?>
</select>
</div>
<div class="col-md-4">
<label>Vehicle Model</label>
<select name="vehModel" class="form-control" data-parsley-trigger="change" id="veh_model">
<option selected="" disabled="" value="">Choose Vehicle Model</option>
<?php
$tot = (isset($product_data->carData) && !empty($product_data->carData))?count($product_data->carData):'0';
$count=0;
if((isset($product_id) || !empty($product_id))){
foreach ($veh_data['model'] as $key => $value) {
$cond = (isset($product_data) && isset($product_data->veh_modal_id) &&
!empty($product_data->veh_modal_id) &&
$product_data->veh_modal_id == $value->veh_modal_id)?'selected':'';
echo '<option '.$cond.' value="'.$value->veh_modal_id.'">'.$value->model.' '.$value->trim.' '.$value->engine.'</option>';
}
}
?>
<i class="fa fa-plus-circle cpoint fav-add-icon" id="addPrdtCar" count="<?= $tot?>"></i>
</select>
</div>
<div class="col-md-1">
<div class="col-md-1">
<div class="row" style="margin-top: 28px !important;">
<div class="col-md-6"></div>
<div class="col-md-6">
<?php
$tot = (isset($product_data->carData) && !empty($product_data->carData))?count($product_data->carData):'0';
$count=0;
?>
<i class="fa fa-plus-circle cpoint fav-add-icon" id="addPrdtCar" count="<?= $tot?>"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="">
<div class="<?php (isset($product_data->carData) && !empty($product_data->carData))?'':'hide'?>" id="addCarResult">
<?php
if(isset($product_data->carData) && !empty($product_data->carData)){
$count = 0;
foreach ($product_data->carData as $key => $value) {
?>
<div id="add_result_<?= $key+1; ?>" class="col-md-6 form-group">
<span class="disp-block" style="border:1px solid #e2e2e2;padding: 12px;">
<?php
$carName = $value->year.' '.$value->maker.' '.$value->model;
$carName .= (!empty($value->trim))?' '.$value->trim:'';
$carName .= (!empty($value->engine))?', '.$value->engine:'';
echo $carName;
?>
<div class="float-right">
<div class="float-right margin-all" style="margin-top:0px;">
<i class="fa fa-fw fa-close cpoint" onclick="removeProduct(<?= $key+1 ?>)"></i>
</div>
</div>
<div class="row">
<div class="">
<div class="<?php (isset($product_data->carData) && !empty($product_data->carData))?'':'hide'?>" id="addCarResult">
<?php
if(isset($product_data->carData) && !empty($product_data->carData)){
$count = 0;
foreach ($product_data->carData as $key => $value) {
?>
<div id="add_result_<?= $key+1; ?>" class="col-md-6 form-group">
<span class="disp-block" style="border:1px solid #e2e2e2;padding: 12px;">
<?php
$carName = $value->year.' '.$value->maker.' '.$value->model;
$carName .= (!empty($value->trim))?' '.$value->trim:'';
$carName .= (!empty($value->engine))?', '.$value->engine:'';
echo $carName;
?>
<div class="float-right">
<div class="float-right margin-all" style="margin-top:0px;">
<i class="fa fa-fw fa-close cpoint" onclick="removeProduct(<?= $key+1 ?>)"></i>
</div>
</div>
</div>
<input type="hidden" value="<?= $value->year ?>" name="prdVehYear[]">
<input type="hidden" value="<?= $value->veh_modal_id ?>" name="prdVehModel[]">
</span>
<input type="hidden" value="<?= $value->year ?>" name="prdVehYear[]">
<input type="hidden" value="<?= $value->veh_modal_id ?>" name="prdVehModel[]">
</span>
</div>
<?php
} }
?>
</div>
<?php
} }
?>
</div>
</div>
<div class="row">
<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="row">
<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 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>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button id="addProductButton" type="submit" class="btn btn-primary">Submit</button>
......@@ -256,14 +249,10 @@
</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")?>';" />
<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 ?>
......@@ -11,7 +10,6 @@
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
......@@ -29,9 +27,9 @@
<div class="col-md-6"><h3 class="box-title">Brand List</h3></div>
<div class="col-md-6" align="right">
<?php if(!empty($product_data)){ ?>
<a class="btn btn-sm btn-success" href="<?= base_url('Product/exportProductData')?>">Generate Report</a>
<a class="btn btn-sm btn-success" href="<?= base_url('Product/exportProductData')?>">Generate Report</a>
<?php } ?>
<a class="btn btn-sm btn-primary" href="<?= base_url('Product/addProduct')?>">Add New Product</a>
<a class="btn btn-sm btn-primary" href="<?= base_url('Product/addProduct')?>">Add New Product</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
......@@ -60,17 +58,13 @@
<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 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)) ?>">
<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()">
<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>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $page_title ?>
<small><?= $page_desc ?></small>
</h1>
<h1><?= $page_title ?><small><?= $page_desc ?></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>
......@@ -34,25 +31,24 @@
<form method="post" class="validate" role="form" action="<?= base_url().'Settings/change_settings'?>" enctype="multipart/form-data" data-parsley-validate="">
<div class="box-body">
<div class="row">
<div class="form-group col-xs-4">
<label>Site Title</label>
<input type="text" name="title" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title'] ?>">
</div>
<div class="form-group col-xs-3">
<div class="form-group col-xs-3">
<label>Title Short</label>
<input type="text" name="title_short" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title_short'] ?>">
</div>
<div class="form-group col-xs-5">
<label>Site Logo</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="site_logo" src="<?= base_url($data['site_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="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" />
</div>
<label>Site Logo</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="site_logo" src="<?= base_url($data['site_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="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" />
</div>
</div>
</div>
</div>
<div class="row">
......@@ -64,17 +60,16 @@
<label>Currency</label>
<input type="text" name="currency" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['currency'] ?>">
</div>
<div class="form-group col-xs-5">
<label>Favicon Icon</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="fav_icon_image" src="<?= base_url($data['fav_icon']) ?>" 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="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" />
</div>
<label>Favicon Icon</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="fav_icon_image" src="<?= base_url($data['fav_icon']) ?>" 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="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" />
</div>
</div>
</div>
</div>
<div class="row">
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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">
......@@ -30,7 +25,7 @@
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Shop/addShop') ?>">Add New Shop</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
......@@ -43,7 +38,7 @@
<th width="250px;">Address</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</tr>
</thead>
<tbody>
<?php
......@@ -57,13 +52,10 @@
<th class="center"><?= $shop->address ?></th>
<th class="center"><?= ($shop->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Shop/editShop/'.encode_param($shop->shop_id)) ?>">
<a class="btn btn-sm btn-primary" href="<?= base_url('Shop/editShop/'.encode_param($shop->shop_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Shop/changeStatus/".encode_param($shop->shop_id))."/2" ?>"
onClick="return doconfirm()">
<a class="btn btn-sm btn-danger" href="<?= base_url("Shop/changeStatus/".encode_param($shop->shop_id))."/2" ?>" onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php if($shop->status == 1){ ?>
......
<!-- POP-UP VIEW MODAL END -->
<div class="modal fade" id="popup_modal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="modal_header"></h4>
</div>
<div class="modal-body col-md-12" id="modal_content" style="border-bottom:1px solid #e5e5e5;">
<!-- POP-UP VIEW MODAL CONTENT -->
</div>
<div class="modal-footer">
<div>&nbsp;</div>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- POP-UP VIEW MODAL END -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 1.0
<div class="modal fade" id="popup_modal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="modal_header"></h4>
</div>
<div class="modal-body col-md-12" id="modal_content" style="border-bottom:1px solid #e5e5e5;"></div>
<div class="modal-footer">
<div>&nbsp;</div>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<strong>Copyright &copy; <?= date('Y')?> - <?= date('Y')+1?> <a href="#">CarFixxers</a>.</strong> All rights reserved.
</footer>
\ No newline at end of file
</div>
</div>
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 1.0
</div>
<strong>Copyright &copy; <?= date('Y')?> - <?= date('Y')+1?> <a href="#">CarFixxers</a>.</strong> All rights reserved.
</footer>
\ No newline at end of file
......@@ -44,7 +44,6 @@
</div>
</nav>
</header>
<div id="errModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
......
......@@ -7,9 +7,7 @@
<title><?= $settings['title_short'] ?></title>
<link rel="icon" href="<?= base_url($settings['fav_icon'])?>" type="image/x-icon"/>
<link rel="shortcut icon" href="<?= base_url($settings['fav_icon']) ?>" type="image/x-icon"/>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="<?= base_url('assets/css/bootstrap.min.css') ?>">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
......@@ -23,6 +21,5 @@
<link rel="stylesheet" href="<?= base_url('assets/css/bootstrap-datepicker3.css') ?>">
<link rel="stylesheet" href="<?= base_url('assets/css/clockpicker.css') ?>" type="text/css" >
<link rel="stylesheet" href="<?= base_url('assets/css/morris.css')?>">
<script src="<?= base_url('assets/js/jQuery-2.1.4.min.js') ?>"></script>
</head>
\ No newline at end of file
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<aside class="main-sidebar">
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="<?=base_url($this->session->userdata('profile_pic'))?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>'" class="user-image left-sid" alt="User Image">
</div>
<div class="pull-left info">
<p><?php echo $this->session->userdata('logged_in_admin')['username']; ?></p>
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<ul class="sidebar-menu">
<li><a href="<?= base_url('Dashboard') ?>"><i class="fa fa-wrench" aria-hidden="true">
</i><span>Dashboard</span></a>
......@@ -22,7 +16,7 @@
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Auto Service Centers</span>
<span>Auto Service Centers</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
......@@ -43,7 +37,7 @@
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
<span>Services</span>
<span>Services</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
......@@ -177,7 +171,6 @@
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-bars" aria-hidden="true"></i>
......@@ -206,6 +199,5 @@
</li>
<?php } ?>
</ul>
</section>
<!-- /.sidebar -->
</section>
</aside>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......@@ -26,7 +23,6 @@
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?=base_url('User/updateUser')?>" 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>
......@@ -40,7 +36,6 @@
value="<?= $user_data->display_name ?>" placeholder="Enter Display Name">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group">
<label>User Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
......@@ -63,13 +58,10 @@
</div>
</div>
</div>
<?php
if(isset($user_data->mechanic_data) && !empty($user_data->mechanic_data)){
$mechanic_data = $user_data->mechanic_data;
?>
<!-- Mechanic Data -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Personal Details</h3>
......@@ -165,7 +157,6 @@
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Licence Proof Image</label>
<div class="col-md-12" style="padding-bottom:10px;">
......@@ -173,15 +164,12 @@
<img id="licence_image" src="<?= base_url($mechanic_data->licence) ?>" 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="licence" type="file" accept="image/*"
onchange="setImg(this,'licence_image');" />
<input name="licence" type="file" accept="image/*" onchange="setImg(this,'licence_image');" />
</div>
</div>
</div>
</div>
<?php } ?>
<!-- Change Password -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Change Password</h3>
......
<?php
$user_data = $this->session->userdata['user'];
?>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
<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-header with-border">
<div class="col-md-6"><h3 class="box-title">Admin Details</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('User/editProfile') ?>">Edit</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="col-md-2">
<div class="form-group has-feedback">
<img src="<?= base_url($user_data->profile_image) ?>" class="cpoint"
onclick="viewImageModal('Profile Image','<?= base_url($user_data->profile_image) ?>');"
onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="100" width="100" />
</div>
</div>
<div class="col-md-5">
<div class="row">
<div class="col-md-5"><span>Display Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $user_data->display_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>User Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $user_data->username ?>
</label>
</div>
</div>
<?php
if($this->session->userdata('user_type') == 2 &&
isset($this->session->userdata['mechanic_data']) &&
!empty($this->session->userdata['mechanic_data'])){
$mechanic_data = $this->session->userdata['user']->mechanic_data; ?>
<div class="row padTop20">
<div class="col-md-5"><span>First Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->first_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Last Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->last_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Phone Number </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->phone ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Email ID </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->email_id ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Address </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->address ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>City </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->city ?>
</label>
</div>
<?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>
<div class="row">
<div class="col-md-5"><span>State </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->state ?>
</label>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Admin Details</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('User/editProfile') ?>">Edit</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<?php
if(isset($this->session->userdata['mechanic_shop_data']) &&
!empty($this->session->userdata['mechanic_shop_data'])){
$shop_data = $this->session->userdata['mechanic_shop_data'];
?>
<div class="row padTop20">
<div class="col-md-5"><span>Shop Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->shop_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Address </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->address ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Phone </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->phone ?>
</label>
<div class="box-body">
<div class="col-md-12">
<div class="col-md-2">
<div class="form-group has-feedback">
<img src="<?= base_url($user_data->profile_image) ?>" class="cpoint" onclick="viewImageModal('Profile Image','<?= base_url($user_data->profile_image) ?>');"
onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="100" width="100" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Email </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->email_id ?>
</label>
<div class="col-md-5">
<div class="row">
<div class="col-md-5"><span>Display Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $user_data->display_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>User Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $user_data->username ?>
</label>
</div>
</div>
<?php
if($this->session->userdata('user_type') == 2 &&
isset($this->session->userdata['mechanic_data']) &&
!empty($this->session->userdata['mechanic_data'])){
$mechanic_data = $this->session->userdata['user']->mechanic_data; ?>
<div class="row padTop20">
<div class="col-md-5"><span>First Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->first_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Last Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->last_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Phone Number </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->phone ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Email ID </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->email_id ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Address </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->address ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>City </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->city ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>State </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->state ?>
</label>
</div>
</div>
<?php
if(isset($this->session->userdata['mechanic_shop_data']) &&
!empty($this->session->userdata['mechanic_shop_data'])){
$shop_data = $this->session->userdata['mechanic_shop_data'];
?>
<div class="row padTop20">
<div class="col-md-5"><span>Shop Name </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->shop_name ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Address </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->address ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Phone </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->phone ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Shop Email </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $shop_data->email_id ?>
</label>
</div>
</div>
<?php } ?>
</div>
<div class="col-md-5">
<div class="row">
<div class="col-md-5"><span>Licence Number </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->licence_number ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Licence Exp. Date </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->licence_exp_date ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5">
<span>Licence </span>
</div>
<div class="col-md-12">
<img src="<?= base_url($mechanic_data->licence) ?>"
onclick="viewImageModal('Licence Image','<?= base_url($mechanic_data->licence) ?>');" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" class="cpoint" alt="Licence Image" height="200px" width="auto" style="padding-left: 20%;">
</div>
</div>
</div>
<?php } else { ?>
</div>
</div>
<?php } ?>
</div>
<div class="col-md-5">
<div class="row">
<div class="col-md-5"><span>Licence Number </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->licence_number ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5"><span>Licence Exp. Date </span></div>
<div class="col-md-7">
<span>:</span>
<label class="padLeft20">
<?= $mechanic_data->licence_exp_date ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-5">
<span>Licence </span>
</div>
<div class="col-md-12">
<img src="<?= base_url($mechanic_data->licence) ?>"
onclick="viewImageModal('Licence Image','<?= base_url($mechanic_data->licence) ?>');"
onerror="this.src='<?=base_url("assets/images/no_image.png")?>';"
class="cpoint" alt="Licence Image" height="200px" width="auto"
style="padding-left: 20%;">
</div>
</div>
</div>
<?php } else { ?>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div>
</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>
<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>
......@@ -26,8 +23,7 @@
<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">
<form role="form" action="<?= base_url($url) ?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="col-md-6">
<div class="form-group">
<label>Brand Name</label>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......@@ -51,7 +48,7 @@
<label>Model 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="model" required="" value="<?= (isset($vehModel_data->model))?$vehModel_data->model:'' ?>"placeholder="Enter Vehicle Model">
name="model" required="" value="<?= (isset($vehModel_data->model))?$vehModel_data->model:'' ?>" placeholder="Enter Vehicle Model">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
......
<div class="content-wrapper" >
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......@@ -49,13 +46,10 @@
<th class="center"><?= $brand->maker ?></th>
<th class="center"><?= ($brand->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Vehicle/editVehBrand/'.encode_param($brand->veh_brand_id)) ?>">
<a class="btn btn-sm btn-primary" href="<?= base_url('Vehicle/editVehBrand/'.encode_param($brand->veh_brand_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Vehicle/changeVehicleStatus/".encode_param($brand->veh_brand_id))."/2" ?>"
onClick="return doconfirm()">
<a class="btn btn-sm btn-danger" href="<?= base_url("Vehicle/changeVehicleStatus/".encode_param($brand->veh_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("Vehicle/changeVehicleStatus/".encode_param($brand->veh_brand_id))."/0" ?>">
......
<div class="content-wrapper" >
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<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>
......@@ -16,8 +13,8 @@
<?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'] ?>
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
......@@ -41,7 +38,7 @@
<th width="150px;">Engine</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</tr>
</thead>
<tbody>
<?php
......@@ -55,12 +52,10 @@
<th class="center"><?= $model->engine ?></th>
<th class="center"><?= ($model->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Vehicle/editVehModel/'.encode_param($model->veh_modal_id)) ?>">
<a class="btn btn-sm btn-primary" href="<?= base_url('Vehicle/editVehModel/'.encode_param($model->veh_modal_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Vehicle/changeModelStatus/".encode_param($model->veh_modal_id))."/2" ?>"
<a class="btn btn-sm btn-danger" href="<?= base_url("Vehicle/changeModelStatus/".encode_param($model->veh_modal_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
......
<!DOCTYPE html>
<html>
<?php
$this->load->view('Templates/header-script');
$this->load->view('Templates/header-script');
?>
<body class="hold-transition <?php echo $this->config->item("theme_color"); ?> sidebar-mini">
<div class="wrapper">
<?php
$this->load->view('Templates/header-menu');
//$this->load->view('Templates/left-menu');
$this->load->view('Templates/left-menu');
$this->load->view($page);
$this->load->view('Templates/footer');
?>
$this->load->view('Templates/header-menu');
$this->load->view('Templates/left-menu');
$this->load->view($page);
$this->load->view('Templates/footer');
?>
</div>
<?php
$this->load->view('Templates/footer-script');
$this->load->view('Templates/footer-script');
?>
</body>
</html>
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