Ejemplo n.º 1
0
 /**
  * Handles requst for displaying the historical my reservation
  * record of the logged in user.
  * 
  * @access	public
  * @param	string	$access_token
  * @return	response
  * @since	1.0.0
  */
 public function reservationRecord()
 {
     $user_array = Session::all();
     //$userID =Session::get('id');
     //this code is start in header and footer page.
     $cities = Location::where(['Type' => 'City', 'visible' => 1])->lists('name', 'id');
     $arrResponse['cities'] = $cities;
     $city_id = Input::get('city');
     $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name');
     if (empty($city_name)) {
         $city_name = 'mumbai';
     }
     $arrResponse['allow_guest'] = 'Yes';
     $arrResponse['current_city'] = strtolower($city_name);
     $arrResponse['current_city_id'] = $city_id;
     //this code is start in header and footer page.
     $userID = Session::get('id');
     if ($userID) {
         $arrReservation = ReservationModel::getReservationRecord($userID);
     } else {
         $arrReservation['status'] = Config::get('constants.API_ERROR');
         $arrReservation['msg'] = 'Not a valid request';
     }
     /*print_r($arrReservation);
     		foreach ($arrReservation['data']['pastReservation'] as $data) {
     			echo $data['guest_email'];
     		}
     		exit;*/
     //return response()->json($arrResponse,200);
     //$aLaCarteID = DB::table('vendor_locations')->where('slug',$alaslug)->first()->id; //@kailash
     /*$aLaCarteID 		 = '97';
             $arrALaCarte 		 = $this->alacarte_model->getALaCarteDetails($aLaCarteID);
     		$data['reserveData'] = $this->alacarte_model->getAlacarteLimit($aLaCarteID);
             $data['block_dates'] = $this->alacarte_model->getAlacarteBlockDates($aLaCarteID);
             $data['schedule']    = $this->alacarte_model->getAlacarteLocationSchedule($aLaCarteID);*/
     /*print_r($arrReservation);
      	exit;*/
     return view('frontend.pages.myreservation', $arrResponse)->with('arrReservation', $arrReservation);
     /*->with('data',$data);*/
 }
    public function myReservationDetails()
    {
        $userID = Input::get('user_id');
        if (isset($userID) && $userID != "" && $userID > 0) {
            $arrReservation = ReservationModel::getReservationRecord($userID);
            $arrUpcomingReservations = '';
            foreach ($arrReservation['data']['upcomingReservation'] as $data) {
                $arrUpcomingReservations .= '<div class="panel panel-default">
                                                    <div class="panel-heading">
                                                        <div class="row">
                                                            <span class="lead col-md-8">';
                if ($data['type'] == 'experience' || $data['type'] == 'event') {
                    $arrUpcomingReservations .= $data['vendor_name'] . ': ' . $data['name'];
                } else {
                    $arrUpcomingReservations .= $data['vendor_name'] . ': ' . 'Classic Reservation';
                }
                $arrUpcomingReservations .= '</span>
                                                                <ul class="col-md-4 list-inline text-right">';
                if ($data['type'] == 'experience' || $data['type'] == 'event') {
                    $arrUpcomingReservations .= '<li>
                                                                                                        <a href="' . $data['type'] . ',' . $data['vl_id'] . ',' . $data['product_id'] . ',' . $data['city_id'] . '" class="btn btn-defaulbt tn-sm" data-toggle="modal" data-keyboard="false" data-backdrop="static" data-target="#editModal" id="change_reservation">Change</a>
                                                                                                     </li>';
                } else {
                    if ($data['type'] == "alacarte") {
                        $arrUpcomingReservations .= '<li>
                                                                                                            <a href="' . $data['type'] . ',' . $data['vendor_location_id'] . ',' . $data['vendor_location_id'] . '" class="btn btn-defaulbt tn-sm" data-toggle="modal" data-keyboard="false" data-backdrop="static" data-target="#editModal" id="change_reservation">Change</a>
                                                                                                        </li>';
                    }
                }
                $arrUpcomingReservations .= '<li>';
                if ($data['type'] == "experience") {
                    $change_id = "cancel_reservation";
                } else {
                    if ($data['type'] == "alacarte") {
                        $change_id = "ac_cancel_reservation";
                    } else {
                        if ($data['type'] == "event") {
                            $change_id = "event_reservation";
                        }
                    }
                }
                $arrUpcomingReservations .= '<a href="javascript:" class="btn btn-default btn-sm" data-toggle="modal" data-keyboard="false" data-backdrop="static" data-target="#cancelModal" id="' . $change_id . '" data-reserve-type="' . $data['type'] . '">Cancel</a>';
                $arrUpcomingReservations .= '</li>
                                                                                <input type="hidden" value="' . $data['id'] . '">
                                                                                <input type="hidden" value="' . $data['type'] . '" class="reserv_typee">
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="panel-body">';
                if ($data['type'] == 'experience') {
                    $arrUpcomingReservations .= '<p class="res-desc"><strong>Description: ' . $data['short_description'] . '</strong></p>';
                }
                $arrUpcomingReservations .= '<div class="row">
                                                                <div class="col-md-4 col-sm-4 res-details">
                                                                    <ul>
                                                                        <li>
                                                                            <p class="text-warning"><em>Date</em></p>
                                                                            <p><strong>' . $data['dayname'] . ', ' . date('F j Y', strtotime($data['date'])) . '</strong></p>
                                                                        </li>
                                                                        <li>
                                                                            <p class="text-warning"><em>Time</em></p>
                                                                            <p><strong>' . date('h:i A', strtotime($data['time'])) . '</strong></p>
                                                                        </li>
                                                                        <li>
                                                                            <p class="text-warning"><em>Number of guests</em></p>
                                                                            <p><strong>' . $data['no_of_persons'] . '</strong></p>
                                                                        </li>
                                                                        <li>
                                                                            <p class="text-warning"><em>Reservation ID</em></p>
                                                                            <p><strong>EU-' . $data['id'] . '</strong></p>
                                                                        </li>';
                if ($data['type'] == 'experience') {
                    $arrUpcomingReservations .= '<li>
                                                                                <p class="text-warning"><em>Experience</em></p>
                                                                                <p><strong><a href="' . URL::to('/') . '/' . $data['city'] . '/experiences/' . $data['product_slug'] . '" target="_blank">View Details</a></strong></p>
                                                                            </li>';
                }
                $arrUpcomingReservations .= '</ul>
                                                                </div>
                                                                <div class="col-md-8 col-sm-8 res-location">
                                                                    <ul>
                                                                        <li>
                                                                            <p class="text-warning"><em>Outlet</em></p>
                                                                            <p><strong>' . $data['locality'] . '</strong></p>
                                                                        </li>
                                                                        <li>
                                                                            <p class="text-warning"><em>Address</em></p>
                                                                            <address>
                                                                                <strong>' . $data['name'] . '</strong><br>
                                                                                ' . $data['address'] . '<br>

                                                                            </address>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>';
            }
            $arrPastReservations = '';
            foreach ($arrReservation['data']['pastReservation'] as $data) {
                $arrPastReservations .= '<div class="panel panel-default">
                                            <div class="panel-heading">
                                                <div class="row">
                                                    <span class="lead col-md-8">';
                if ($data['type'] == 'experience') {
                    $arrPastReservations .= $data['vendor_name'] . ' : ' . $data['name'];
                } else {
                    $arrPastReservations .= $data['name'] . ' : ' . 'Classic Reservation';
                }
                $arrPastReservations .= '</span>
                                                </div>
                                            </div>
                                            <div class="panel-body">';
                if ($data['type'] == 'experience') {
                    $arrPastReservations .= '<p class="res-desc"><strong>Description: ' . $data['short_description'] . '</strong></p>';
                }
                $arrPastReservations .= '<div class="row">
                                                    <div class="col-md-4 col-sm-4 res-details">
                                                        <ul>
                                                            <li>
                                                                <p class="text-warning"><em>Date</em></p>
                                                                <p><strong>' . $data['dayname'] . ', ' . date('F j Y', strtotime($data['date'])) . '</strong></p>
                                                            </li>
                                                            <li>
                                                                <p class="text-warning"><em>Time</em></p>
                                                                <p><strong>' . date('h:i A', strtotime($data['time'])) . '</strong></p>
                                                            </li>
                                                            <li>
                                                                <p class="text-warning"><em>Number of guests</em></p>
                                                                <p><strong>' . $data['no_of_persons'] . '</strong></p>
                                                            </li>
                                                            <li>
                                                                <p class="text-warning"><em>Reservation ID</em></p>
                                                                <p><strong>EU-' . $data['id'] . '</strong></p>
                                                            </li>';
                if ($data['type'] == 'experience') {
                    $arrPastReservations .= '<li>
                                                                    <p class="text-warning"><em>Experience</em></p>
                                                                    <p><strong><a href="' . URL::to('/') . '/' . $data['city'] . '/experiences/' . $data['product_slug'] . '" target="_blank">View Details</a></strong></p>
                                                                  </li>';
                }
                $arrPastReservations .= '</ul>
                                                    </div>
                                                    <div class="col-md-8 col-sm-8 res-location">
                                                        <ul>
                                                            <li>
                                                                <p class="text-warning"><em>Outlet</em></p>
                                                                <p><strong>' . $data['locality'] . '</strong></p>
                                                            </li>
                                                            <li>
                                                                <p class="text-warning"><em>Address</em></p>
                                                                <address>
                                                                    <strong>' . $data['name'] . '</strong><br>
                                                                    ' . $data['address'] . '<br>

                                                                </address>
                                                            </li>

                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>';
            }
            $newData['upcomings'] = $arrUpcomingReservations;
            $newData['previous'] = $arrPastReservations;
            echo json_encode($newData);
        }
    }