<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Reservation extends MY_Controller {
    function __construct() {
        parent::__construct();
        $this->load->library('Formatslist');
    }
    public function index() {
        $data['template'] = 'sales/reservation_view';
        $this->load->view('template',$data);
    }
    public function getreservation() {
        $reservationdata =  $this->common->getAll('RESERVATIONS');
        $reservationdetails    =   array();
        if($reservationdata){
            foreach ($reservationdata as $reservation){
                array_push($reservationdetails, array(
                    'CREATED' => $this->formatslist->datetimeFormat($reservation->CREATED),
                    'DATENEW' => $this->formatslist->datetimeFormat($reservation->DATENEW),
                    'TITLE' => $reservation->TITLE,
                    'CHAIRS' => $reservation->CHAIRS,
                    'DESCRIPTION' => $reservation->DESCRIPTION
                ));
            }
            $data['data']    =   $reservationdetails;
        }else{
            $data['data']    =   $reservationdetails;
        }
        echo json_encode($data);
    }
}