<?php 
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Booking_list extends Admin_Controller {
	
	   function __construct()
	   {
			parent::__construct();
			$this->load->model("mod_booking","booking");
	   }		

       public function index($page=1)
       {	
	   		$tab['activeTab'] = "booking";
		    $this->load->model("mod_booking");
			$data["booking"] = $this->mod_booking->getbooking();
			$data["booking"] = $data["booking"]->result_array(); 
			$this->load->view('admin/header',$tab);
			$this->load->view('admin/booking/view',$data);
			$this->load->view('admin/footer');
       }
	
	   public function detail()
       {	
	   		$tab['activeTab'] = "booking";	
			$id = $this->uri->segment(4);
			$booking = $this->booking->detail($id);
			if(!$booking)
			{
				redirect("admin/booking_list/detail/");
			}
			
			if(@$_POST['confrim'])
			{	
			    $user_id = $this->session->userdata('userId');
				$postdata['confirm'] = $_POST['status'];
				$postdata['confrimby'] = $user_id;
				$msg=$this->booking->update($postdata,$id);
				$this->session->set_flashdata('message',"Confrim is Successfully Update");
				redirect("admin/booking_list");
			}
			
			$data['booking'] = $booking;	
			$this->load->view('admin/header',$tab);
			$this->load->view('admin/booking/detail',$data);
			$this->load->view('admin/footer');
       }
	
		
	   public function confrim()
	   {
			$id=26;
			if(@$_POST['confrim'])
			{	
			    $user_id = $this->session->userdata('userId');
				$postdata['confirm'] = $_POST['status'];
				$postdata['confrimby'] = $user_id;
				$msg=$this->booking->update($postdata,$id);
				$this->session->set_flashdata('message',"Confrim is Successfully Update");
				redirect("admin/booking_list");
			}
	   }
	   
	   
	   function delete()
	   {
			$id = $this->uri->segment(4);
			$this->brand->delete($id);
			$this->session->set_flashdata('message',"Car Brand deleted successfully");
			redirect("admin/brand");
	   }
	   
		
}