Commit 12ed207c by Jansa Jose

dc

parent d16111a5
<?php
defined('BASEPATH')OR exit('No direct script access allowed');
header('Content-Type: text/html; charset=utf-8');
// Allow from any origin
if(isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}
class Webservices extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Webservice_model');
$this->load->library('form_validation');
$auth = '';
$class = $this->router->fetch_class();
$method = $this->router->fetch_method();
if($this->input->server('REQUEST_METHOD') == 'GET')
$postdata = json_encode($_GET);
else if ($this->input->server('REQUEST_METHOD') == 'POST')
$postdata = file_get_contents("php://input");
if (isset(apache_request_headers()['Auth'])) {
$auth = apache_request_headers()['Auth'];
}
}
// customer_login
public function customer_login(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
echo json_encode($respArr);exit;
}
$custResp = $this->Customer_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = '1';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '3'){
$respArr['status'] = '3';
$respArr['message'] = 'Invalid Password';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_forgot_password
public function customer_forgot_password(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(empty($postData) || !isset($postData['email']) || empty($postData['email'])){
echo json_encode($respArr);exit;
}
$custResp = $this->Customer_model->genCustForgotPassLink($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
/*
MAIL SENT CONFIGARATION -- TODO
*/
$respArr['status'] = '1';
$respArr['message'] = 'Password Reset Email has been sent';
}
echo json_encode($respArr); exit;
}
// customer_registration
public function customer_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
if(isset($postData['phone']) && empty($postData['phone'])){
unset($postData['phone']);
}
unset($postData['promocode']);
$custResp = $this->Customer_model->createCustomer($postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp == '1'){
$custResp = $this->Customer_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = '1';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp == '3'){
$respArr['status'] = '2';
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_registration
public function service_provider_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createServiceProvider($postData);
if($custResp == '0'){
$respArr['message'] = 'Something went wrong.';
} else if($custResp == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
} else if($custResp == '2'){
$respArr['message'] = 'Email Address already in use';
} else if($custResp == '3'){
$respArr['message'] = 'Phone already in use';
}
echo json_encode($respArr); exit;
}
// getGeneralIssues
public function getGeneralIssues(){
header('Content-type: application/json');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
$this->load->model('Issue_model');
$issue_data = $this->Issue_model->getGeneralIssues();
if(!empty($issue_data)){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
$respArr['issue_data'] = $issue_data;
}
echo json_encode($respArr); exit;
}
// getNearByMechanics
public function getNearByMechanics(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Mechanic_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['pickup_data']) || !isset($postData['sub_issues']) ||
empty($postData['pickup_data']) || empty($postData['sub_issues']) ){
echo json_encode($respArr); exit;
}
$mechanic_data = $this->Mechanic_model->getNearByMechanics($postData['pickup_data'],$postData['sub_issues']);
if(!empty($mechanic_data)){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
$respArr['mechanic_data'] = $mechanic_data;
}
echo json_encode($respArr); exit;
}
// scheduleNow
public function scheduleNow(){
header('Content-type: application/json');
$postData = $_POST;
$optionalData = array('optionlaDescription'=>'','optionalImages'=>array(),'optionalVideos'=>array());
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || empty($postData = json_decode($postData['data'],true)) ||
!isset($postData['cost']) || empty($postData['cost']) ||
!isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['mechanic_id']) || empty($postData['mechanic_id']) ||
!isset($postData['pickup_data']) || empty($postData['pickup_data']) ||
!isset($postData['vechile_info']) || empty($postData['vechile_info']) ||
!isset($postData['schedule_date']) || empty($postData['schedule_date']) ||
!isset($postData['selected_issues']) || empty($postData['selected_issues'])){
echo json_encode($respArr);exit;
}
$optionalData['optionlaDescription'] = (isset($postData['optionalDescription']) &&
!empty($postData['optionalDescription']))?
$postData['optionalDescription']:'';
if(isset($_FILES) && !empty($_FILES)){
foreach ($_FILES as $fileIndex => $optImgs) {
if(empty($optImgs) || !isset($optImgs['name']) || empty($optImgs['name'])){
continue;
}
$this->load->library('upload');
$config = set_upload_service("assets/uploads/services");
$config['file_name'] = 'optionalImages'.$postData['customer_id'].date('dmYHis');
$this->upload->initialize($config);
if($this->upload->do_upload($fileIndex)){
$upload_data = $this->upload->data();
$optionalData['optionalImages'][] = $config['upload_path']."/".$upload_data['file_name'];
}
}
}
$this->load->model('Booking_model');
$postData['optionalData'] = $optionalData;
$status = $this->Booking_model->scheduleBooking($postData);
if($status){
$respArr['status'] = '1';
$respArr['message'] = 'Success';
}
echo json_encode($respArr); exit;
}
// edit_customer_profile
public function edit_customer_profile(){
header('Content-type: application/json');
$postData = $_POST;
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || empty($postData = json_decode($postData['data'],true)) ||
!isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone';
}
else if(!isset($postData['address']) || empty($postData['address'])){
$err = 1;
$msg = 'Provide valid Address';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
if(isset($_FILES) && !empty($_FILES) &&
isset($_FILES['profile_image']) && !empty($_FILES['profile_image'])){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = $postData['customer_id']."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('profile_image')){
$upload_data = $this->upload->data();
$postData['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
$customer_id = $postData['customer_id'];
if(isset($postData['password']) && !empty($postData['password']) &&
isset($postData['cpassword']) && !empty($postData['cpassword']) &&
$postData['password'] == $postData['cpassword']){
$postData['password'] = md5($postData['password']);
} else {
unset($postData['password']);
}
unset($postData['cpassword']);
unset($postData['customer_id']);
$custResp = $this->Customer_model->updateCustomer($customer_id,$postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Profile successfully updated';
$respArr['profile_image'] = (isset($postData['profile_image']) && !empty($postData['profile_image']))?$postData['profile_image']:'';
echo json_encode($respArr);exit;
} else if($custResp == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp == '3'){
$respArr['status'] = '3';
$respArr['message'] = 'Phone Number already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customerVechiles
function customerVechiles(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$vehData = $this->Vehicle_model->getCustVechiles($postData);
if($vehData != '0'){
$respArr['status'] = 1;
$respArr['message'] = 'success';
$respArr['vehData'] = $vehData;
}
echo json_encode($respArr);exit;
}
// getCustBookDetails
function getCustBookDetails(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Booking_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$status = (isset($postData['status']) && !empty($postData['status']))?$postData['status']:'';
$bookingDetails = $this->Booking_model->getCustBookDetails($postData,$status);
if($bookingDetails != '0'){
$respArr['status'] = 1;
$respArr['message'] = 'success';
$respArr['bookData'] = $bookingDetails;
}
echo json_encode($respArr);exit;
}
// cancelBooking
function cancelBooking(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Booking_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['booking_id']) || empty($postData['booking_id'])){
echo json_encode($respArr);exit;
}
$status=$this->Booking_model->changeBookStatus($postData['customer_id'],$postData['booking_id'],'3');
if($status){
$respArr['status'] = 1;
$respArr['message'] = 'success';
}
echo json_encode($respArr);exit;
}
// deleteCustomerCar
function deleteCustomerCar(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id']) ||
!isset($postData['customer_veh_id']) || empty($postData['customer_veh_id'])){
echo json_encode($respArr);exit;
}
$status = $this->Vehicle_model->changeCustomerCarStatus($postData['customer_id'],
$postData['customer_veh_id'],'2');
if($status){
$respArr['status'] = 1;
$respArr['message'] = 'success';
}
echo json_encode($respArr);exit;
}
// addCustomerCar
function addCustomerCar(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Vehicle_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData) || !isset($postData['customer_id']) || empty($postData['customer_id'])){
echo json_encode($respArr);exit;
}
$param = "";
$searchType = $postData['type'];
$searchData = $postData['vehicleData'];
$locationData = $postData['location'];
$vehicle_data['status'] = '1';
$vehicle_data['customer_id'] = $postData['customer_id'];
$vehicle_data['car_loc_lat'] = $locationData['location_lat'];
$vehicle_data['car_loc_lng'] = $locationData['location_lng'];
$vehicle_data['car_location'] = $locationData['location'];
$this->load->model('Settings_model');
$settings = $this->Settings_model->settings_viewing();
$searchData = $postData['vehicleData'];
if($searchType == 1 &&
isset($searchData['car_maker']) && !empty($searchData['car_maker']) &&
isset($searchData['modelName']) && !empty($searchData['modelName']) &&
isset($searchData['modelYear']) && !empty($searchData['modelYear'])){
$vehicle_data['car_maker'] = $searchData['car_maker'];
$vehicle_data['car_model'] = $searchData['modelName'];
$vehicle_data['car_model_year'] = $searchData['modelYear'];
$param = "?format=json&key=".urlencode($settings['vin_audit_api'])."&year=".
urlencode($searchData['modelYear'])."&make=".urlencode($searchData['car_maker']).
"&model=".urlencode($searchData['modelName']);
}
else if($searchType == 2 && isset($searchData['vin']) && !empty($searchData['vin'])){
$vehicle_data['car_vin'] = $searchData['vin'];
$param = "?format=json&key=".urlencode($settings['vin_audit_api']).
"&vin=".urlencode($searchData['vin']);
}
if(!empty($param)){
$vehData=file_get_contents("https://specifications.vinaudit.com/getspecifications.php".$param);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
echo json_encode($return_arr);exit;
}
if(!isset($vehData['success']) || empty($vehData['success']) || $vehData['success'] == false){
$return_arr['status'] = 2;
$return_arr['message'] = 'No Data Found.';
echo json_encode($return_arr);exit;
}
if($searchType == 2){
$vehicle_data['car_model'] = $vehData['attributes']['Model'];
$vehicle_data['car_maker'] = $vehData['attributes']['Make'];
$vehicle_data['car_model_year'] = $vehData['attributes']['Year'];
$vehData['vehicle']= $vehData['attributes']['Year'].' '.$vehData['attributes']['Make'].' '.
$vehData['attributes']['Model'].' '.$vehData['attributes']['Trim'];
}
$vehicle_data['car_name'] = $vehData['vehicle'];
$vehicle_data['vehicle_data'] = json_encode($vehData);
$car_id = $this->Vehicle_model->addVehicle($vehicle_data);
if(!empty($car_id)){
$return_arr['status'] = '1';
$return_arr['car_id'] = $car_id;
$return_arr['veh_data'] = $vehData;
}
}
echo json_encode($return_arr);exit;
}
/*********************************************************************************/
/************************************Mobile API's*********************************/
//Mobile Number Availability
public function mobile_number_availability(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'error','error'=>'901','message'=>'Something went wrong.');
if(!isset($postData['phone']) || empty($postData['phone']) && !isset($postData['country_code']) || empty($postData['country_code'])){
$respArr = array('status'=>'0','error'=>'903','message'=>'Required Fields are empty.');
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkMobAvailability($postData);
if(!empty($custResp)){
$respArr = $custResp;
}
echo json_encode($respArr);exit;
}
//User Login
public function user_login(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Required Fields are empty.');
if(!isset($postData['email']) || empty($postData['email']) ||
!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->checkCustomerLogin($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Email Address';
echo json_encode($respArr);exit;
}
if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Password';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
// customer_registration
public function user_registration(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['password']) || empty($postData['password'] = md5($postData['password']))){
$err = 1;
$msg = 'Provide a Password';
}
else if(!isset($postData['name']) || empty($postData['name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['country_code']) || empty($postData['country_code'])){
$err = 1;
$msg = 'Provide a Country Code';
}
else if(!isset($postData['phone']) && empty($postData['phone'])){
$err = 1;
$msg = 'Provide a Phone Number';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$custResp = $this->Webservice_model->createCustomer($postData);
if(empty($custResp)){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['data'] = $custResp['data'];
$respArr['status'] = 'success';
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '2'){
$respArr['status'] = 'error';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '3'){
$respArr['status'] = 'error';
$respArr['message'] = 'Phone already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
//Get Booked Services
public function get_booked_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$bookData = $this->Webservice_model->getBookedService($authRes['data']['customer_id']);
echo json_encode($bookData);exit;
}
//Add Vehicle Details
public function add_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$err = 0;$msg = '';
if(empty($postData)){
$respArr = array('status'=>0,'error'=>'901','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
if(!isset($postData['vehicle_year']) || empty($postData['vehicle_year'])){
$err = 1;
$msg = 'Provide a Vehicle year';
}
else if(!isset($postData['vehicle_make']) || empty($postData['vehicle_make'])){
$err = 1;
$msg = 'Provide a Vehicle Make';
}
else if(!isset($postData['vehicle_model']) || empty($postData['vehicle_model'])){
$err = 1;
$msg = 'Provide a Vehicle Model';
}
else if(!isset($postData['engine_no']) || empty($postData['engine_no'])){
$err = 1;
$msg = 'Provide an Engine Number';
}
else if(!isset($postData['vehicle_trim']) && empty($postData['vehicle_trim'])){
$err = 1;
$msg = 'Provide a Vehicle Trim';
}
else if(!isset($postData['mileage']) && empty($postData['mileage'])){
$err = 1;
$msg = 'Provide a Mileage';
}
else if(!isset($postData['car_loc_lat']) && empty($postData['car_loc_lat'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_loc_lng']) && empty($postData['car_loc_lng'])){
$err = 1;
$msg = 'Car Location is Required';
}
else if(!isset($postData['car_location']) && empty($postData['car_location'])){
$err = 1;
$msg = 'Car Location is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->addVehicleDetails($postData,$authRes['data']['customer_id']);
echo json_encode($respData);exit;
}
//Get Services
public function get_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$serviceresult = $this->Webservice_model->get_service_list($postData,0,0);
$serviceList = $this->Webservice_model->get_service_list($postData,$start,$per_page);
$service = array();
$total = 0;
if($serviceresult['status'] == 'success'){
$total = count($serviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($serviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'services' => $serviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}
echo json_encode($respArr);exit;
}
//Get Vehicle Details
public function get_vehicle_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$respArr = array('status'=>'error','message'=>'Something Went Wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
else if(!isset($postData['bar_code']) && !empty($postData['bar_code'])){
$respArr['message'] = 'Barcode is Required.';
echo json_encode($respArr);exit;
}
$settings = getSettings();
$param = "?format=json&key=".urlencode($settings['vin_audit_api']).
"&vin=".urlencode($postData['bar_code']);
$vehData=file_get_contents("https://specifications.vinaudit.com/getspecifications.php".$param);
if(empty($vehData) || empty($vehData = json_decode($vehData,true))){
echo json_encode($respArr);exit;
}
if(!isset($vehData['success']) || empty($vehData['success']) || $vehData['success'] == false || !isset($vehData['attributes']) || empty($vehData['attributes'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Invalid Vin Number.';
echo json_encode($respArr);exit;
}
$respArr['status'] = 'success';
$respArr['data'] = $vehData['attributes'];
$respArr['message'] = 'Success';
echo json_encode($respArr);exit;
}
//Search Sub Services
public function search_sub_services(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$subserviceresult = $this->Webservice_model->search_sub_services($postData,0,0);
$subserviceList = $this->Webservice_model->search_sub_services($postData,$start,$per_page);
$service = array();
$total = 0;
if($subserviceresult['status'] == 'success'){
$total = count($subserviceresult['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($subserviceList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'sub_services' => $subserviceList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else if($subserviceList['status'] == 'error'){
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'sub_services' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page
)
);
}else{
$respArr = $subserviceList;
$respArr['status'] = 'error';
}
echo json_encode($respArr);exit;
}
//Book Service
public function book_service(){
header('Content-type: application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
if(empty($postData)){
$respArr = array('status'=>'error','message'=>'All Field is Required');
echo json_encode($respArr);exit;
}
$err = 0;
if(!isset($postData['booking_id']) || empty($postData['booking_id'])){
$err = 1;
$msg = 'Booking Id is Required';
}
else if(!isset($postData['total_cost']) || empty($postData['total_cost'])){
$err = 1;
$msg = 'Total Cost is Required';
}
else if(!isset($postData['mechanic_id']) || empty($postData['mechanic_id'])){
$err = 1;
$msg = 'Mechanic Id is Required';
}
else if(!isset($postData['date']) || empty($postData['date'])){
$err = 1;
$msg = 'Date is Required';
}
else if(!isset($postData['time']) && empty($postData['time'])){
$err = 1;
$msg = 'Time is Required';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$respData = $this->Webservice_model->book_service($postData);
echo json_encode($respData);exit;
}
//Get Booking Summary
public function get_booking_summary(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$res = $this->Webservice_model->get_booking_summary($postData);
echo json_encode($res);exit;
}
//Get Mechanics
public function get_mechanics(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_GET;
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$err = 0;
if(!isset($postData['service_id']) || empty($postData['service_id'])){
$err = 1;
$msg = 'Service Id is Required';
}
else if(!isset($postData['location']) || empty($postData['location'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lat']) || empty($postData['location_lat'])){
$err = 1;
$msg = 'Location is Required';
}
else if(!isset($postData['location_lng']) || empty($postData['location_lng'])){
$err = 1;
$msg = 'Location is Required';
}
if($err == 1){
$respArr['status'] = 'error';
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
$currentpage = 0;
$start = 0;
$per_page = 10;
if(isset($postData['page']) && strlen(trim($postData['page']," ")) > 0 ) {
$currentpage = (int)$postData['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
}
$mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0);
$mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page);
$total = 0;
if($mechanicsList['status'] == 'success'){
$total = count($mechanicsListcount['data']);
}
if($total >= $per_page){
$totalPages = (int)($total % $per_page ==0 ? $total / $per_page :($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($mechanicsList['status'] == 'success'){
$respArr = array(
'status' => 'success',
'message'=>'success',
'data' => array(
'mechanics' => $mechanicsList['data']
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}else{
$respArr = array(
'status' => 'error',
'message'=>'No data',
'data' => array(
'mechanics' => []
),
'meta' => array(
'total_pages' => $totalPages,
'total' => $total,
'current_page' => $currentpage+1,
'per_page' => $per_page)
);
}
echo json_encode($respArr);exit;
}
//Add Service Details
public function add_service_details(){
header('Content-type: application/json');
$headers = apache_request_headers();
$postData = $_POST;
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
if(isset($_FILES['images']) && !empty($_FILES['images'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['images']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$files['images']['name'][$i];
$this->upload->initialize($config);
$_FILES['images']['name'] = $files['images']['name'][$i];
$_FILES['images']['type'] = $files['images']['type'][$i];
$_FILES['images']['tmp_name'] = $files['images']['tmp_name'][$i];
$_FILES['images']['error'] = $files['images']['error'][$i];
$_FILES['images']['size'] = $files['images']['size'][$i];
if($this->upload->do_upload('images'))
{
$imagedata= $this->upload->data();
$new[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
print json_encode($res);
exit();
}
}
$postData['image'] = $new;
}
if(isset($_FILES['videos']) && !empty($_FILES['videos'])){
$files = $_FILES;
$config = set_upload_service('assets/uploads/services');
$this->load->library('upload');
for ($i=0; $i < count($files['videos']['name']) ; $i++){
$config['file_name'] = 'optionalImages'.date('dmYHis').$_FILES['videos']['name'][$i];
$this->upload->initialize($config);
$_FILES['videos']['name'] = $files['videos']['name'][$i];
$_FILES['videos']['type'] = $files['videos']['type'][$i];
$_FILES['videos']['tmp_name'] = $files['videos']['tmp_name'][$i];
$_FILES['videos']['error'] = $files['videos']['error'][$i];
$_FILES['videos']['size'] = $files['videos']['size'][$i];
if($this->upload->do_upload('videos'))
{
$imagedata= $this->upload->data();
$video[$i] = 'assets/uploads/services/'.$imagedata['file_name'];
}
else
{
$display_error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"msg"=> "Sorry! Images not uploaded. ".$display_error['error']
);
echo json_encode($res);
exit();
}
}
$postData['video'] = $video;
}
$addServiceDetails = $this->Webservice_model->add_service_details($postData);
echo json_encode($addServiceDetails);exit();
}
//Remove Booking
public function remove_booking(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$removed = $this->Webservice_model->remove_booking($postData);
echo json_encode($removed);
}
//Get Service
public function get_service(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$getServices = $this->Webservice_model->get_service($postData);
echo json_encode($getServices);exit;
}
public function rate_mechanic(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error';
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
}
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){
echo json_encode($authRes);exit;
}
$postData['customer_id'] = $authRes['data'];
$result = $this->Webservice_model->rate_mechanic($postData);
echo json_encode($result);exit;
}
}
?>
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Brand extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Brand_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function addbrand(){
$template['page'] = 'Brand/addBrand';
$template['pTitle'] = "Add Brand";
$template['pDescription'] = "Add Brand";
$template['menu'] = "Brand Management";
$template['smenu'] = "View Brands";
$template['brand_data'] = $this->Brand_model->getbrand();
$this->load->view('template',$template);
}
public function viewBrand(){
$template['page'] = 'brand/viewBrands';
$template['menu'] = 'brand Management';
$template['smenu'] = 'View brands';
$template['pTitle'] = "View brands";
$template['pDescription'] = "View and Manage brands";
$template['brand_data'] = $this->Brand_model->getbrand('',1);
$this->load->view('template',$template);
}
function changeStatus($brand_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewBrand'));
}
$status = $this->Brand_model->changeStatus($brand_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('brand/viewBrand'));
}
public function createbrand(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/addbrand'));
}
if($err == 0 && (!isset($_POST['brand_name']) || empty($_POST['brand_name']))){
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['brand_logo']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('brand_logo')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['brand_logo'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/addbrand'));
}
$status = $this->Brand_model->addbrand($_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('brand/viewBrand'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('brand/addbrand'));
}
}
public function editbrand($brand_id){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewBrand'));
}
$template['page'] = 'brand/addBrand';
$template['menu'] = 'brand Management';
$template['smenu'] = 'Edit brand';
$template['pTitle'] = "Edit brand";
$template['pDescription'] = "Update brand Data";
$template['brand_id'] = encode_param($brand_id);
$template['brand_data'] = $this->Brand_model->getbrand($brand_id,1);
$this->load->view('template',$template);
}
public function updatebrand($brand_id = ''){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !isset($_POST) || empty($_POST) || !is_numeric(decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewBrand'));
}
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/addbrand'));
}
if($err == 0 && (!isset($_POST['brand_name']) || empty($_POST['brand_name']))){
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['brand_logo']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('brand_logo')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['brand_logo'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/addbrand'));
}
$status = $this->Brand_model->updateBrand(decode_param($brand_id),$_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('brand/viewBrand'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('brand/editbrand/'.$brand_id));
}
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Mailtemplate extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Mailtemplate_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
if($this->session->userdata['user_type'] != 1){
$flashMsg = array('message'=>'Access Denied You don\'t have permission to access this Page',
'class'=>'error');
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url());
}
}
public function index() {
$template['page'] = 'Notification/notification';
$template['menu'] = "Notification Templates";
$template['smenu'] = "Change Notification Templates";
$template['pTitle'] = "Notification Templates";
$template['page_head'] = "Notification Templates";
$template['pDescription'] = "Change Notification Templates";
$template['notificationData'] = $this->Mailtemplate_model->getNotifData();
$this->load->view('template',$template);
}
public function changeNotifData(){
$url = 'Mailtemplate/index';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url($url));
}
if(!isset($_POST['customer_registration_mail']) || empty($_POST['customer_registration_mail'])){
unset($_POST['customer_registration_mail']);
}
if(!isset($_POST['cancel_booking']) || empty($_POST['cancel_booking'])){
unset($_POST['cancel_booking']);
}
if(!isset($_POST['mechanic_activation_mail']) || empty($_POST['mechanic_activation_mail'])){
unset($_POST['mechanic_activation_mail']);
}
if(!isset($_POST['success_booking']) || empty($_POST['success_booking'])){
unset($_POST['success_booking']);
}
$status = $this->Mailtemplate_model->updateNotif($_POST);
if($status){
$flashMsg['class'] = 'success';
$flashMsg['message'] = 'Settings Successfully Updated..!';
}
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url($url));
}
}
?>
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Product extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Brand_model');
$this->load->model('Product_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url('Login'));
}
}
public function addProduct(){
$template['page'] = 'Product/addproduct';
$template['pTitle'] = "Add Product";
$template['pDescription'] = "Add Product";
$template['menu'] = "Product Management";
$template['smenu'] = "View Product";
$template['brand_id'] = '';
$template['product_data'] = $this->Product_model->getProduct();
$template['brand_data'] = $this->Brand_model->getbrand('',1);
$this->load->view('template',$template);
}
public function viewProducts(){
$template['page'] = 'Product/viewProduct';
$template['menu'] = 'Product Management';
$template['smenu'] = 'View Product';
$template['pTitle'] = "View Product";
$template['pDescription'] = "View and Manage Product";
$template['product_data'] = $this->Product_model->getProduct('',1);
$this->load->view('template',$template);
}
function changeStatus($brand_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('brand/viewProducts'));
}
$status = $this->Product_model->changeStatus($brand_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Product/viewProducts'));
}
public function createproduct(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
if($err == 0 && (!isset($_POST['brand_id']) || empty($_POST['brand_id']))){
$err = 1;
$errMsg = 'Please Select a Brand';
}else if($err == 0 && (!isset($_POST['short_description']) || empty($_POST['short_description']))){
$err = 1;
$errMsg = 'Provide a short Description';
}else if($err == 0 && (!isset($_POST['product_name']) || empty($_POST['product_name']))){
$err = 1;
$errMsg = 'Provide a Product Name';
}else if($err == 0 && (!isset($_POST['description']) || empty($_POST['description']))){
$err = 1;
$errMsg = 'Provide a Description';
}else if($err == 0 && (!isset($_POST['about']) || empty($_POST['about']))){
$err = 1;
$errMsg = 'Provide a About';
}else if($err == 0 && (!isset($_POST['amount']) || empty($_POST['amount']))){
$err = 1;
$errMsg = 'Provide a Amount';
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
$product_id = $this->Product_model->addProduct($_POST);
if($product_id){
$evtMediaData = array();
if(!empty($files = $_FILES)){
$images = array();
$this->load->library('upload');
$config = set_upload_service("assets/uploads/products");
for ($typ = 0; $typ < count($files['product_image']['name']); $typ++) {
$_FILES['file']['name'] = $files['product_image']['name'][$typ];
$_FILES['file']['type'] = $files['product_image']['type'][$typ];
$_FILES['file']['size'] = $files['product_image']['size'][$typ];
$_FILES['file']['error'] = $files['product_image']['error'][$typ];
$_FILES['file']['tmp_name'] = $files['product_image']['tmp_name'][$typ];
$config['file_name'] = time()."_".$_FILES['file']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('file')){
$imgData = $this->upload->data();
$evtMediaData[] = array(
'product_id'=>$product_id,
'image'=>"assets/uploads/products/".$imgData['file_name']);
}
}
$status = $this->Product_model->addProductImage($evtMediaData);
}
if($status == 1 || $product_id){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/viewProducts'));
}else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/addProduct'));
}
}
}
public function editproduct($brand_id){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !is_numeric($brand_id = decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/viewProducts'));
}
$template['page'] = 'Product/addProducts';
$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->Product_model->getbrand($brand_id,1);
$this->load->view('template',$template);
}
public function updateproduct($brand_id = ''){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($brand_id) || !isset($_POST) || empty($_POST) || !is_numeric(decode_param($brand_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/viewProducts'));
}
if(!isset($_POST) || empty($_POST)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
if($err == 0 && (!isset($_POST['brand_name']) || empty($_POST['brand_name']))){
$err = 1;
$errMsg = 'Provide a brand Name';
}
if($err == 0){
$config = set_upload_service("assets/uploads/brands");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['brand_logo']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('brand_logo')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['brand_logo'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Product/addProduct'));
}
$status = $this->Product_model->updateProducts(decode_param($brand_id),$_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated brand Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/viewProducts'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Product/editproduct/'.$brand_id));
}
}
}
?>
\ No newline at end of file
<?php
class Brand_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function addBrand($brand_data = array()){
if(empty($brand_data)){
return 0;
}
$status = $this->db->insert('product_brand',$brand_data);
return ($status)?1:0;
}
function getBrand($brand_id = '',$view_all = 0){
$cond = ($view_all != 0)?' status IN (0,1) ':' status IN (1) ';
$cond .= (!empty($brand_id))?" AND brand_id = '$brand_id'":"";
$result = $this->db->query("SELECT * FROM product_brand WHERE $cond");
if(empty($result)){
return;
}
return (empty($brand_id))?$result->result():$result->row();
}
function changeStatus($brand_id = '', $status = '0'){
if(empty($brand_id)){
return 0;
}
$status = $this->db->update('product_brand',array('status'=>$status), array('brand_id'=>$brand_id));
return $status;
}
function updateBrand($brand_id = '', $brand_data = array()){
if(empty($brand_id) || empty($brand_data)){
return 0;
}
$status = $this->db->update('product_brand',$brand_data,array('brand_id'=>$brand_id));
return ($status)?1:0;
}
}
?>
\ No newline at end of file
<?php
class Mailtemplate_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getCMSdata(){
$cmsData = $this->db->query("SELECT * FROM privacy_policy");
if(!empty($cmsData)){
return $cmsData->row();
}
return 0;
}
public function updateCMS($cmsData = array()){
if(empty($cmsData)){
return 0;
}
$status = $this->db->update('privacy_policy',$cmsData);
return $status;
}
public function getNotifData(){
$notifData = $this->db->query("SELECT * FROM notification_templates");
if(!empty($notifData)){
return $notifData->row();
}
return 0;
}
public function updateNotif($notifData = array()){
if(empty($notifData)){
return 0;
}
$status = $this->db->update('notification_templates',$notifData);
return $status;
}
}
?>
\ No newline at end of file
<?php
class Product_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function addProduct($product_data = array()){
if(empty($product_data)){
return 0;
}
$status = $this->db->insert('products',$product_data);
$last_id = $this->db->insert_id();
return $last_id;
}
function getProduct($product_id = '',$view_all = 0){
$cond = ($view_all != 0)?' products.status IN (0,1) ':' products.status IN (1) ';
$cond .= (!empty($product_id))?" AND products.product_id = '$product_id'":"";
$result = $this->db->query("SELECT products.*,product_brand.brand_name FROM products join product_brand on product_brand.brand_id = products.brand_id WHERE $cond");
if(empty($result)){
return;
}
return (empty($product_id))?$result->result():$result->row();
}
function changeStatus($product_id = '', $status = '0'){
if(empty($product_id)){
return 0;
}
$status = $this->db->update('products',array('status'=>$status), array('product_id'=>$product_id));
return $status;
}
function updateProduct($product_id = '', $product_data = array()){
if(empty($product_id) || empty($product_data)){
return 0;
}
$status = $this->db->update('products',$product_data,array('product_id'=>$product_id));
return ($status)?1:0;
}
function addProductImage($imagearray = array()){
if(empty($imagearray)){
return 0;
}
$status = $this->db->insert_batch('product_images',$imagearray);
return ($status)?1:0;
}
}
?>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
$url = (!isset($brand_id) || empty($brand_id))?'Brand/createBrand':'Brand/updateBrand/'.$brand_id;
if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?= base_url($url) ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label>Brand Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$"
name="brand_name" required="" value="<?= (isset($brand_data->brand_name))?$brand_data->brand_name:'' ?>"placeholder="Enter Brand Name">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Brand Logo</label>
<div class="col-md-12" style="padding-bottom:10px;">
<div class="col-md-3">
<img id="brand_image" src="<?= (isset($brand_data->brand_logo))?base_url($brand_data->brand_logo):'' ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="brand_logo" type="file" accept="image/*"
onchange="setImg(this,'brand_image');" />
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url('Brand/viewbrands') ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Brand List</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Brand/addBrand') ?>">Add New Brand</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="150px;">Brand Name</th>
<th width="150px;">Brand Image</th>
<th width="100px;">Status</th>
<th width="300px;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($brand_data)){
foreach($brand_data as $brand) { ?>
<tr>
<th class="hidden"><?= $brand->brand_id ?></th>
<th class="center"><?= $brand->brand_name ?></th>
<th class="center">
<img class="small-icon" src="<?=base_url($brand->brand_logo)?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" />
</th>
<th class="center"><?= ($brand->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Brand/editBrand/'.encode_param($brand->brand_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<!-- <?php if($brand->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Brand/changeStatus/".encode_param($brand->brand_id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
</a>
<?php } ?> -->
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?= base_url('Mailtemplate/changeNotifData') ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<div class="box-header with-border">
<h3 class="box-title padLeft10 padTop5">Email Template</h3>
</div>
<div class="box-body">
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Customer Registration Mail</label>
<p>Email => {:email}</p>
<textarea id="rich_editor_2" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Registration Mail" name="customer_registration_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->customer_registration_mail ?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Cancel Booking</label>
<p>Car Name => {:car_name} , Booking Date => {:book_date}</p>
<textarea id="rich_editor_3" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Forgot Mail" name="cancel_booking" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->cancel_booking ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Mechanic Activation Mail</label>
<p>Username => {:user_name}</p>
<textarea id="rich_editor_4" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Checker Activation Mail" name="mechanic_activation_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->mechanic_activation_mail ?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Success Booking</label>
<p>Car Name => {:car_name} , Amount => {:amount} , Booking Date => {:book_date}</p>
<textarea id="rich_editor_5" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Provider Activation Mail" style="height:108px;"
name="success_booking" data-parsley-trigger="change"><?= $notificationData->success_booking ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-md-6">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url() ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
$url = (!isset($product_id) || empty($product_id))?'Product/createproduct':'Product/updateproduct/'.$mechanic_id;
if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form name="productAddForm" role="form" action="<?= base_url($url) ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<!-- Basic Details -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Basic Details</h3>
</div><br>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Choose Brand</label>
<select name="brand_id" class="form-control required" placeholder="Select Brand" required="">
<option selected disabled>Choose a Brand</option>
<?php
foreach ($brand_data as $brand) {
$select = (isset($brand->brand_id) && $brand->brand_id==$brand_id)?'selected':'';
echo '<option '.$select.' value="'.$brand->brand_id.'">'.
$brand->brand_name.
'</option>';
}
?>
</select>
</div>
<div class="form-group">
<label>Short Description</label>
<textarea type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" name="short_description" required="" value="<?= (isset($user_data->username))?$user_data->username:'' ?>"
data-parsley-pattern="^[a-zA-Z0-9\ . _ @ \/]+$" placeholder="Enter Short Description"></textarea>
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Product Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change" data-parsley-minlength="2" name="product_name" required=""
placeholder="Enter Product Name" value="<?= (isset($user_data->display_name))?$user_data->display_name:'' ?>">
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group">
<label>Amount</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" name="amount" required="" value="<?= (isset($user_data->username))?$user_data->username:'' ?>"
data-parsley-pattern="^[0-9\ . \/]+$" placeholder="Enter Amount">
<span class="glyphicon form-control-feedback"></span>
</div>
</div>
<!-- Mechanic Data -->
<div class="col-md-12">
<div class="box-header with-border padUnset">
<h3 class="box-title">Product Details</h3>
</div><br>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Product Images</label>
<div id="multipleImageInputCntr">
<div class="dropZoneContainer" id="multiImageCntr_1" count="1">
<div id="multiImageClose_1" class="close_custom hide" onclick="removeImage('1');">&times;</div>
<input id="product_image_1" type="file" name="product_image[]" accept="image/*" class="multiFileUpload" onchange="setMultiImg(this,jQuery(this));" count="1" />
<img class="multiDropZoneOverlay" id="multiImageImg_1" src="<?=base_url("assets/images/add-image.png")?>" />
</div>
</div>
</div>
</div>
<div class="col-md-6">
<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"></textarea>
</div>
</div>
<div class="col-md-6">
<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"></textarea>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button id="addProductButton" type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url('Product/viewProducts') ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
<div id="multipleImageInput" class="hide">
<div class="dropZoneContainer" id="multiImageCntr_{:count}" count="{:count}">
<div id="multiImageClose_{:count}" class="close_custom hide" onclick="removeImage('{:count}');">&times;</div>
<input id="event_image_{:count}" type="file" name="product_image[]" class="multiFileUpload" accept="image/*"
onchange="setMultiImg(this,jQuery(this));" count="{:count}" />
<img class="multiDropZoneOverlay" id="multiImageImg_{:count}" src=""
onerror="this.src='<?=base_url("assets/images/add-image.png")?>';" />
</div>
</div>
\ No newline at end of file
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Brand List</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Brand/addBrand') ?>">Add New Products</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="150px;">Brand Name</th>
<th width="150px;">Product Name</th>
<th width="150px;">Short Description</th>
<th width="150px;">Amount</th>
<th width="100px;">Status</th>
<!-- <th width="300px;">Action</th> -->
</tr>
</thead>
<tbody>
<?php
if(!empty($product_data)){
foreach($product_data as $product) { ?>
<tr>
<th class="hidden"><?= $product->product_id ?></th>
<th class="center"><?= $product->brand_name ?></th>
<th class="center"><?= $product->product_name ?></th>
<th class="center"><?= $product->short_description ?></th>
<th class="center"><?= $product->amount ?></th>
<th class="center"><?= ($product->status == 1)?'Active':'De-activate' ?></th>
<!-- <td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Product/editproduct/'.encode_param($product->product_id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Product/changeStatus/".encode_param($product->product_id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
</td> -->
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
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