Commit d10f8062 by Tobin

dc

parent 467bc43d
......@@ -308,18 +308,6 @@ class Api extends CI_Controller {
}
}
public function cancel_booking() {
$data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Api_model->cancel_booking($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function payNow($auth_token='',$amount=0,$booking_id='',$event_id=''){
if(empty($auth_token) || empty($amount) || empty($booking_id)){
redirect('https://projects.nuvento.com/failure');
......
......@@ -25,10 +25,10 @@ class User extends CI_Controller {
if($user_type != 1){
if($user_type == 2){
$this->load->model('Provider_model');
$template['provider'] = $this->Provider_model->getProviderData();
$template['provider'] = $this->Provider_model->getProviderData($this->session->userdata('id'));
} else if ($user_type == 3){
$this->load->model('Customer_model');
$template['customer'] = $this->Customer_model->getCustomerData();
$template['customer'] = $this->Customer_model->getCustomerData($this->session->userdata('id'));
}
}
}
......@@ -43,14 +43,15 @@ class User extends CI_Controller {
public function editProfile() {
$template['provider'] = '';
$template['customer'] = '';
if(($user_type = $this->session->userdata('user_type')) != 1){
if($user_type != 1){
if($user_type == 2){
$this->load->model('Provider_model');
$template['provider'] = $this->Provider_model->getProviderData();
$template['provider'] = $this->Provider_model->getProviderData($this->session->userdata('id'));
} else if ($user_type == 3){
$this->load->model('Customer_model');
$template['customer'] = $this->Customer_model->getCustomerData();
$template['customer'] = $this->Customer_model->getCustomerData($this->session->userdata('id'));
}
}
}
......@@ -128,7 +129,7 @@ class User extends CI_Controller {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('User/editProfile'));
}
} else if ($user_type == 2) {
} else if ($user_type == 3) {
if (!isset($_POST['name']) || empty($_POST['name'])){
$flashMsg = array('message'=>'Provide a Name..!','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
......@@ -149,11 +150,11 @@ class User extends CI_Controller {
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('User/viewProfile'));
} else if($status == 2){
} else if($status == 5){
$flashMsg = array('message'=>'Email ID alrady exist..!','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('User/editProfile'));
} else if($status == 3){
} else if($status == 6){
$flashMsg = array('message'=>'Phone Number alrady exist..!','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('User/editProfile'));
......
......@@ -370,7 +370,7 @@ class Api_model extends CI_Model {
if($res_count > 0) {
$rs = $this->db->where('bookId',$data['bookingCode'])->update('booking',array('status'=>1));
if($rs) {
$result = $this->db->select('booking.id AS book_id,booking.event_id,booking.bookId AS bookingCode,booking.qrcode,booking.no_of_ticket,booking.amount,booking.status AS book_status,events.event_name,events.event_discription,event_gallery.media_url,venue.location,customer.name AS customer_name,customer.profile_image,venue.venue_name,venue.location_lat AS lat,venue.location_lng AS lng, booking.ticket_details,event_date_time.date,event_date_time.time')->where('booking.bookId',$data['bookingCode'])->from('booking')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('venue', 'venue.id = events.venue_id')->join('event_gallery', 'events.event_id = event_gallery.event_id AND event_gallery.media_type = 0', 'LEFT')->join('customer','customer.customer_id = booking.customer_id')->get()->row();
$result = $this->db->select('booking.id AS book_id,booking.event_id,booking.bookId AS bookingCode,booking.qrcode,booking.no_of_ticket,booking.amount,booking.status AS book_status,events.event_name,events.event_discription,event_gallery.media_url,venue.location,customer.name AS customer_name,customer.profile_image,venue.venue_name,venue.location_lat AS lat,venue.location_lng AS lng, booking.ticket_details,event_date_time.date,event_date_time.time')->where('booking.bookId',$data['bookingCode'])->from('booking')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('venue', 'venue.id = events.venue_id')->join('event_gallery', 'events.event_id = event_gallery.event_id', 'LEFT')->join('customer','customer.customer_id = booking.customer_id')->get()->row();
if(count($result)>0){
$res = array('status'=>1,'data'=>$result);
......@@ -922,27 +922,5 @@ class Api_model extends CI_Model {
}
return $res;
}
public function cancel_booking($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0) {
$booked_data = $this->db->get_where('booking',array('id'=>$data['booking_id']))->row();
if($booked_data){
if($this->db->update('booking',array('status'=>'0'),array('id'=>$data['booking_id']))){
$res = array('status'=>1);
}else{
$res = array('status'=>0,'message'=>'Booking Id doesnot Exist','code'=>'ER13');
}
}
}else {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
}
?>
\ No newline at end of file
?>
......@@ -8,7 +8,7 @@ class User_model extends CI_Model {
if(empty($user_id)){
return 0;
}
$userData = array();
$userData = new stdClass();
$query = $this->db->get_where('users',array('id'=>$user_id));
if($query->num_rows() > 0 && !empty($query)){
......@@ -17,10 +17,10 @@ class User_model extends CI_Model {
if(isset($result->user_type) && !empty($result->user_type)){
if($result->user_type == 2){
$this->load->model('Provider_model');
$userData = $this->Provider_model->getProviderData();
$userData = $this->Provider_model->getProviderData($this->session->userdata('id'));
} else if ($result->user_type == 3){
$this->load->model('Customer_model');
$userData = $this->Customer_model->getCustomerData();
$userData = $this->Customer_model->getCustomerData($this->session->userdata('id'));
}
}
$userData->id = $result->id;
......@@ -46,13 +46,14 @@ class User_model extends CI_Model {
if(!empty($chkUser) && $chkUser->num_rows() > 0) {
return 4;
}
$status = '';
if ($user_type == 2) {
$chkUser = $this->db->query("SELECT * FROM users AS USR
INNER JOIN provider AS PRV ON (USR.id = PRV.provider_id)
WHERE USR.status!='2' AND USR.id!='".$user_id."' AND
PRV.email='".$user_data['email']."'");
if(!empty($chkUser) && $chkUser->num_rows() > 0) return 5;
$chkUser = $this->db->query("SELECT * FROM users AS USR
......@@ -86,7 +87,7 @@ class User_model extends CI_Model {
array('customer_id'=>$user_id));
}
if($status){
if($status || $user_type == 1){
$userData['username'] = $user_data['username'];
$userData['display_name'] = $user_data['display_name'];
if(isset($user_data['password']) && !empty($user_data['password'])){
......@@ -98,6 +99,7 @@ class User_model extends CI_Model {
$this->db->update('users',$userData,array('id'=>$user_id));
$usrData = $this->getUserData($user_id);
if(!empty($usrData)){
$this->session->set_userdata('id',$usrData->id);
$this->session->set_userdata('user',$usrData);
......
......@@ -68,20 +68,6 @@ class Validation_model extends CI_Model {
'paymentFailureUrl' => array() ,
'paymentSuccessUrl' => array() ,
'get_cms_data' => array() ,
'cancel_booking' => array(
'booking_id' => array(
'required' => array(
'code' => 'ER16',
'message' => 'Booking id is null or empty'
)
) ,
'auth_token' => array(
'required' => array(
'code' => 'ER17',
'message' => 'User Id is null or empty'
)
)
) ,
'favourite' => array(
'event_id' => array(
'required' => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment