public function alacarteCheckout() { //echo "<pre>"; print_r(Input::all()); $dataPost['reservationDate'] = Input::get('booking_date'); $dataPost['reservationDay'] = date("D", strtotime($dataPost['reservationDate'])); // $dataPost['reservationTime'] = Input::get('booking_time'); $dataPost['partySize'] = Input::get('qty'); $dataPost['vendorLocationID'] = Input::get('address'); $dataPost['guestName'] = Input::get('fullname'); $dataPost['guestEmail'] = Input::get('email'); $dataPost['phone'] = Input::get('phone'); $dataPost['reservationType'] = 'alacarte'; $dataPost['specialRequest'] = Input::get('special'); $dataPost['addon'] = Input::get('add_ons'); $award = Input::get('avard_point'); $user_email = Input::get('mail'); $vendor_name = Input::get('vendor_name'); $userID = Input::get('user_id'); $userData = Profile::getUserProfileWeb($userID); $outlet = $this->alacarte_model->getOutlet($dataPost['vendorLocationID']); $locationDetails = $this->alacarte_model->getLocationDetails($dataPost['vendorLocationID']); $vendorDetails = $this->alacarterepository->getByRestaurantLocationId($dataPost['vendorLocationID']); $getUsersDetails = $this->experiences_model->fetchDetails($userID); $getReservationID = ''; if ($userID > 0) { //validating the information submitted by users $arrResponse = $this->alacarte_model->validateReservationData($dataPost); if ($arrResponse['status'] == 'success') { $reservationResponse = $this->alacarte_model->addReservationDetails($dataPost, $userID); $rewardsPoints = isset($award) && $award != 0 ? $vendorDetails['attributes']['reward_points_per_reservation'] : 0; $bookingsMade = $userData['data']['a_la_carte_reservation'] + 1; $type = "new"; $reservationType = "alacarte"; $lastOrderId = $reservationResponse['data']['reservationID']; Profile::updateReservationInUsers($rewardsPoints, $type, $bookingsMade, $reservationType, $userID, $lastOrderId); DB::table('users')->where('id', $userID)->update(array('full_name' => $dataPost['guestName'], 'phone_number' => $dataPost['phone'])); $getReservationID = $reservationResponse['data']['reservationID']; //for the new db structure support /*$newDb['attributes']['date'] = date('d-M-Y', strtotime($dataPost['reservationDate'])); $newDb['attributes']['time'] = date("g:i A", strtotime($dataPost['reservationTime']));*/ $combined_date_and_time = $dataPost['reservationDate'] . ' ' . $dataPost['reservationTime']; $newDb['attributes']['reserv_datetime'] = Carbon::createFromFormat('Y-m-d H:i A', $combined_date_and_time)->toDateTimeString(); $newDb['attributes']['no_of_people_booked'] = $dataPost['partySize']; $newDb['attributes']['cust_name'] = $dataPost['guestName']; $newDb['attributes']['email'] = $dataPost['guestEmail']; $newDb['attributes']['contact_no'] = $dataPost['phone']; $newDb['attributes']['reserv_type'] = "Alacarte"; $newDb['attributes']['loyalty_points_awarded'] = $rewardsPoints; $newDb['attributes']['special_request'] = $dataPost['specialRequest']; $newDb['attributes']['experience'] = $outlet->vendor_name . ' - Ala Carte'; $newDb['attributes']['api_added'] = "Admin Reservation"; $newDb['attributes']['giu_membership_id'] = $userData['data']['membership_number']; $newDb['attributes']['outlet'] = $outlet->name; $newDb['attributes']['auto_reservation'] = "Not available"; $newDb['attributes']['ar_confirmation_id'] = "0"; $newDb['attributes']['alternate_id'] = 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']); $newDb['attributes']['reservation_status_id'] = 1; $newDb['userdetails']['user_id'] = $userID; $newDb['userdetails']['status'] = 1; //print_r($newDb);die; $reservDetails = new ReservationDetails(); $newDbStatus = $reservDetails->updateAttributes($reservationResponse['data']['reservationID'], $newDb); $tokens = $reservDetails->pushToRestaurant($reservationResponse['data']['reservationID']); $this->restaurantapp->push($reservationResponse['data']['reservationID'], $tokens, true); //print_r($newDbStatus);die; /*TODO: Add the status of success check and include added_by and transaction_id attributes */ //die; $zoho_data = array('Name' => $dataPost['guestName'], 'Email_ids' => $dataPost['guestEmail'], 'Contact' => $dataPost['phone'], 'Experience_Title' => $outlet->vendor_name . ' - Ala Carte', 'No_of_People' => $dataPost['partySize'], 'Date_of_Visit' => date('d-M-Y', strtotime($dataPost['reservationDate'])), 'Time' => date("g:i A", strtotime($dataPost['reservationTime'])), 'Alternate_ID' => 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']), 'Special_Request' => $dataPost['specialRequest'], 'Type' => "Alacarte", 'API_added' => 'Admin Reservation', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Calling_option' => 'No'); //echo "<pre>"; print_r($zoho_data); $zoho_res = AdminReservations::zoho_add_booking($zoho_data); $zoho_success = $zoho_res->result->form->add->status; //echo "<pre>"; print_r($zoho_success); die; if ($zoho_success[0] != "Success") { //$this->email->from('*****@*****.**', 'WowTables by GourmetItUp'); //$list = array('*****@*****.**', '*****@*****.**', '*****@*****.**'); //$this->email->to($list); //$this->email->subject('Urgent: Zoho reservation posting error'); $mailbody = 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']) . ' reservation has not been posted to zoho. Please fix manually.<br><br>'; $mailbody .= 'Reservation Details<br>'; foreach ($zoho_data as $key => $val) { $name = str_replace('_', ' ', $key); $mailbody .= $name . ' ' . $val . '<br>'; } Mail::send('site.pages.zoho_posting_error', ['zoho_data' => $mailbody], function ($message) use($zoho_data) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('Urgent: Zoho reservation posting error'); $message->cc('*****@*****.**', '*****@*****.**', '*****@*****.**'); }); } $mergeReservationsArray = array('order_id' => sprintf("%06d", $reservationResponse['data']['reservationID']), 'reservation_date' => date('d-F-Y', strtotime($dataPost['reservationDate'])), 'reservation_time' => date('g:i a', strtotime($dataPost['reservationTime'])), 'venue' => $outlet->vendor_name, 'username' => $dataPost['guestName']); //echo "<pre>"; print_r($mergeReservationsArray); die; $city_id = $locationDetails->city_id; $city_name = Location::where(['Type' => 'City', 'id' => $userData['data']['location_id']])->pluck('name'); if (empty($city_name)) { $city_name = 'mumbai'; } $city = ucfirst($city_name); //Start MailChimp if (!empty($getUsersDetails)) { $merge_vars = array('MERGE1' => $dataPost['guestName'], 'MERGE10' => date('m/d/Y'), 'MERGE11' => $userData['data']['a_la_carte_reservation'] + 1, 'MERGE13' => $dataPost['phone'], 'MERGE27' => date("m/d/Y", strtotime($dataPost['reservationDate'])), 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city]))); $this->mailchimp->lists->subscribe($this->listId, ["email" => $dataPost['guestEmail']], $merge_vars, "html", false, true); //$this->mc_api->listSubscribe($list_id, $_POST['email'], $merge_vars,"html",true,true ); } //End MailChimp $footerpromotions = DB::select('SELECT efp.link,mrn.file FROM email_footer_promotions as efp LEFT JOIN media_resized_new as mrn ON mrn.media_id = efp.media_id WHERE efp.show_in_alacarte = 1 AND efp.city_id = ' . $city_id); if (isset($user_email) && $user_email != 0) { Mail::send('site.pages.restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to(Input::get('email'))->subject('Your WowTables Reservation at ' . $mergeReservationsArray['venue']); //$message->cc('*****@*****.**', '*****@*****.**'); }); } Mail::send('site.pages.restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('NR - #A' . $mergeReservationsArray['order_id'] . ' | ' . $mergeReservationsArray['reservation_date'] . ' , ' . $mergeReservationsArray['reservation_time'] . ' | ' . $mergeReservationsArray['venue'] . ' | ' . $mergeReservationsArray['username']); $message->cc(['*****@*****.**', '*****@*****.**', '*****@*****.**']); }); $result_data = array('full_name' => $dataPost['guestName'], 'email' => $dataPost['guestEmail'], 'phone' => $dataPost['phone'], 'booking_date' => $dataPost['reservationDate'], 'booking_time' => $dataPost['reservationTime'], 'exp_title' => $vendor_name, 'order_id' => 'A' . sprintf("%06d", $reservationResponse['data']['reservationID'])); echo json_encode($result_data); } } }
public function alaorder() { $dataPost['reservationDate'] = Input::get('booking_date'); $dataPost['reservationDay'] = date("D", strtotime($dataPost['reservationDate'])); // $dataPost['reservationTime'] = Input::get('booking_time'); $dataPost['partySize'] = Input::get('qty'); $dataPost['vendorLocationID'] = Input::get('address'); $dataPost['guestName'] = Input::get('fullname'); $dataPost['guestEmail'] = Input::get('email'); $dataPost['phone'] = Input::get('phone'); $dataPost['reservationType'] = 'alacarte'; $dataPost['specialRequest'] = Input::get('special'); $dataPost['addon'] = Input::get('add_ons'); //var_dump($this->request->get('special_offer'));die; $special_offer_title = $this->request->get('special_offer_title'); $special_offer_desc = $this->request->get('special_offer_desc'); $dataPost['special_offer_title'] = !empty($special_offer_title) && $special_offer_title != "" ? $special_offer_title : ""; $dataPost['special_offer_desc'] = !empty($special_offer_desc) && $special_offer_desc != "" ? $special_offer_desc : ""; //var_dump($dataPost['special_offer_desc']);die; //$dataPost['access_token'] = Session::get('id'); $userID = Session::get('id'); $userData = Profile::getUserProfileWeb($userID); $outlet = $this->alacarte_model->getOutlet($dataPost['vendorLocationID']); //echo "<pre>"; print_r($outlet); $locationDetails = $this->alacarte_model->getLocationDetails($dataPost['vendorLocationID']); //echo "<pre>"; print_r($locationDetails); $vendorDetails = $this->repository->getByRestaurantLocationId($dataPost['vendorLocationID']); //echo "sfa = ".$vendorDetails['attributes']['reward_points_per_reservation']; //echo $vendorDetails['RestaurantLocation']->slug; //echo "<pre>"; print_r($vendorDetails); die; $arrRules = array('reservationDate' => 'required|date', 'reservationDay' => 'required', 'reservationTime' => 'required', 'partySize' => 'required|integer', 'vendorLocationID' => 'required|not_in:0', 'guestName' => 'required|max:255', 'guestEmail' => 'required|email|max:255', 'phone' => 'required', 'reservationType' => 'required|in:experience,alacarte,event', 'specialRequest' => 'max:512'); $validator = Validator::make($dataPost, $arrRules); $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'; } if ($validator->fails()) { $message = $validator->messages(); $errorMessage = ""; foreach ($data as $key => $value) { if ($message->has($key)) { $errorMessage .= $message->first($key) . '\\n '; } } return redirect()->back()->withErrors($validator); } else { /*$getUsersDetails = $this->experiences_model->fetchDetails($userID); //Start MailChimp if(!empty($getUsersDetails)){ $merge_vars = array( 'MERGE1'=>$dataPost['guestName'], 'MERGE10'=>date('m/d/Y'), 'MERGE11'=>$userData['data']['a_la_carte_reservation'] + 1, 'MERGE13'=>$dataPost['phone'], 'MERGE27'=>date("m/d/Y",strtotime($dataPost['reservationDate'])), 'GROUPINGS' => array(array('id' => 9613, 'groups' => [$city])) ); $this->mailchimp->lists->subscribe($this->listId, ["email"=>$dataPost['guestEmail']],$merge_vars,"html",false,true ); //$this->mc_api->listSubscribe($list_id, $_POST['email'], $merge_vars,"html",true,true ); /*$my_email = $dataPost['guestEmail']; //$city = $users['city']; $city = ucfirst($city_name); $mergeVars = array( 'GROUPINGS' => array( array( 'id' => 9613, 'groups' => [$city], ) ) ); //echo "asd , "; //$this->mailchimp->lists->interestGroupings($this->listId,true); //print_r($test);die; $this->mailchimp->lists->updateMember($this->listId, $my_email, $mergeVars); }*/ //End MailChimp $getReservationID = ''; if ($userID > 0) { //validating the information submitted by users $arrResponse = $this->alacarte_model->validateReservationData($dataPost); if ($arrResponse['status'] == 'success') { $reservationResponse = $this->alacarte_model->addReservationDetails($dataPost, $userID); $rewardsPoints = $vendorDetails['attributes']['reward_points_per_reservation']; $bookingsMade = $userData['data']['a_la_carte_reservation'] + 1; $type = "new"; $reservationType = "alacarte"; $lastOrderId = $reservationResponse['data']['reservationID']; //for the new db structure support /*$newDb['attributes']['date'] = date('d-M-Y', strtotime($dataPost['reservationDate'])); $newDb['attributes']['time'] = date("g:i A", strtotime($dataPost['reservationTime']));*/ $combined_date_and_time = $dataPost['reservationDate'] . ' ' . $dataPost['reservationTime']; $newDb['attributes']['reserv_datetime'] = Carbon::createFromFormat('Y-m-d H:i A', $combined_date_and_time)->toDateTimeString(); $newDb['attributes']['no_of_people_booked'] = $dataPost['partySize']; $newDb['attributes']['cust_name'] = $dataPost['guestName']; $newDb['attributes']['email'] = $dataPost['guestEmail']; $newDb['attributes']['contact_no'] = $dataPost['phone']; $newDb['attributes']['reserv_type'] = "Alacarte"; //$newDb['attributes']['gift_card_id'] = $dataPost['giftCardID']; $newDb['attributes']['loyalty_points_awarded'] = $rewardsPoints; $newDb['attributes']['special_request'] = $dataPost['specialRequest']; $newDb['attributes']['experience'] = $outlet->vendor_name . ' - Ala Carte'; $newDb['attributes']['api_added'] = "Web Reservation"; $newDb['attributes']['giu_membership_id'] = $userData['data']['membership_number']; $newDb['attributes']['outlet'] = $outlet->name; $newDb['attributes']['auto_reservation'] = "Not available"; $newDb['attributes']['ar_confirmation_id'] = "0"; $newDb['attributes']['alternate_id'] = 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']); $newDb['attributes']['special_offer_title'] = $dataPost['special_offer_title']; $newDb['attributes']['special_offer_desc'] = $dataPost['special_offer_desc']; $newDb['attributes']['reservation_status_id'] = 1; $newDb['userdetails']['user_id'] = $userID; $newDb['userdetails']['status'] = 1; $reservDetails = new ReservationDetails(); $newDbStatus = $reservDetails->updateAttributes($reservationResponse['data']['reservationID'], $newDb); $tokens = $reservDetails->pushToRestaurant($reservationResponse['data']['reservationID']); $this->restaurantapp->push($reservationResponse['data']['reservationID'], $tokens, true); //print_r($newDbStatus);die; /*TODO: Add the status of success check and include added_by and transaction_id attributes */ //die; Profile::updateReservationInUsers($rewardsPoints, $type, $bookingsMade, $reservationType, $userID, $lastOrderId); DB::table('users')->where('id', $userID)->update(array('full_name' => $dataPost['guestName'], 'phone_number' => $dataPost['phone'])); $getReservationID = $reservationResponse['data']['reservationID']; $zoho_data = array('Name' => $dataPost['guestName'], 'Email_ids' => $dataPost['guestEmail'], 'Contact' => $dataPost['phone'], 'Experience_Title' => $outlet->vendor_name . ' - Ala Carte', 'No_of_People' => $dataPost['partySize'], 'Date_of_Visit' => date('d-M-Y', strtotime($dataPost['reservationDate'])), 'Time' => date("g:i A", strtotime($dataPost['reservationTime'])), 'Alternate_ID' => 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']), 'Special_Request' => $dataPost['specialRequest'], 'Type' => "Alacarte", 'API_added' => 'Web Reservation', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Special_offer_title' => $dataPost['special_offer_title'], 'Special_offer_desc' => $dataPost['special_offer_desc'], 'Calling_option' => 'No'); //echo "<pre>"; print_r($zoho_data); $zoho_res = $this->zoho_add_booking($zoho_data); //print_r($zoho_res);die; $zoho_success = $zoho_res->result->form->add->status; //echo "<pre>"; print_r($zoho_success); die; if ($zoho_success[0] != "Success") { //$this->email->from('*****@*****.**', 'WowTables by GourmetItUp'); //$list = array('*****@*****.**', '*****@*****.**', '*****@*****.**'); //$this->email->to($list); //$this->email->subject('Urgent: Zoho reservation posting error'); $mailbody = 'A' . sprintf("%06d", $reservationResponse['data']['reservationID']) . ' reservation has not been posted to zoho. Please fix manually.<br><br>'; $mailbody .= 'Reservation Details<br>'; foreach ($zoho_data as $key => $val) { $name = str_replace('_', ' ', $key); $mailbody .= $name . ' ' . $val . '<br>'; } Mail::send('site.pages.zoho_posting_error', ['zoho_data' => $mailbody], function ($message) use($zoho_data) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('Urgent: Zoho reservation posting error'); $message->cc(['*****@*****.**', '*****@*****.**']); }); } $mergeReservationsArray = array('order_id' => sprintf("%06d", $reservationResponse['data']['reservationID']), 'reservation_date' => date('d-F-Y', strtotime($dataPost['reservationDate'])), 'reservation_time' => date('g:i a', strtotime($dataPost['reservationTime'])), 'venue' => $outlet->vendor_name, 'username' => $dataPost['guestName']); //start mailchimp $city_id = Input::get('city_id'); $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name'); if (empty($city_name)) { $city_name = 'mumbai'; } $city = ucfirst($userData['data']['location']); $merge_vars = array('MERGE1' => $dataPost['guestName'], 'MERGE10' => date('m/d/Y'), 'MERGE11' => $userData['data']['a_la_carte_reservation'] + 1, 'MERGE13' => $dataPost['phone'], 'MERGE27' => date("m/d/Y", strtotime($dataPost['reservationDate'])), 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city]))); $this->mailchimp->lists->subscribe($this->listId, ["email" => $dataPost['guestEmail']], $merge_vars, "html", false, true); //end mailchimp $footerpromotions = DB::select('SELECT efp.link,mrn.file FROM email_footer_promotions as efp LEFT JOIN media_resized_new as mrn ON mrn.media_id = efp.media_id WHERE efp.show_in_alacarte = 1 AND efp.city_id = ' . $city_id); Mail::send('site.pages.restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to(Input::get('email'))->subject('Your WowTables Reservation at ' . $mergeReservationsArray['venue']); //$message->cc('*****@*****.**', '*****@*****.**'); }); Mail::send('site.pages.restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('NR - #A' . $mergeReservationsArray['order_id'] . ' | ' . $mergeReservationsArray['reservation_date'] . ' , ' . $mergeReservationsArray['reservation_time'] . ' | ' . $mergeReservationsArray['venue'] . ' | ' . $mergeReservationsArray['username']); $message->cc(['*****@*****.**', '*****@*****.**', '*****@*****.**']); }); } } else { return redirect()->back()->withErrors($validator); } } $arrResponse['allow_guest'] = 'Yes'; $arrResponse['current_city'] = strtolower($city_name); $arrResponse['current_city_id'] = $city_id; $arrResponse['restaurant_name'] = $outlet->vendor_name; $arrResponse['restaurantID'] = $outlet->vendor_id; $arrResponse['vendorLocationID'] = $dataPost['vendorLocationID']; $arrResponse['reservation_date'] = $dataPost['reservationDate']; $arrResponse['reservation_time'] = $dataPost['reservationTime']; $arrResponse['order_id'] = $mergeReservationsArray['order_id']; $arrResponse['guests'] = $dataPost['partySize']; $arrResponse['outlet_name'] = $outlet->name; $arrResponse['terms_and_conditions'] = $vendorDetails['attributes']['terms_and_conditions']; $arrResponse['address'] = $locationDetails->address; $arrResponse['lat'] = $locationDetails->latitude; $arrResponse['long'] = $locationDetails->longitude; $arrResponse['city'] = $arrResponse['current_city']; $arrResponse['guestEmail'] = $dataPost['guestEmail']; $arrResponse['guestName'] = $dataPost['guestName']; $arrResponse['slug'] = $vendorDetails['RestaurantLocation']->slug; //echo "<pre>"; print_r($arrResponse); die; //return response()->view('frontend.pages.thankyou',$arrResponse); return Redirect::to('/alacarte/thankyou/A' . $mergeReservationsArray['order_id'])->with('response', $arrResponse); }
/** * Send mail by zoho for every edited reservation . * * @access public * @return * @since 1.0.0 */ public static function sendZohoMailupdate($arrData, $lastReservationDetail) { $queryResult = DB::table('reservation_details')->where('id', $arrData['reservationID'])->select('user_id')->first(); $userData = Profile::getUserProfileWeb($queryResult->user_id); if ($arrData['reservationType'] == "experience") { $arrProductVendorLocationId = DB::table('reservation_details')->where('id', $arrData['reservationID'])->select('product_vendor_location_id')->get(); $arrProductID = DB::table('product_vendor_locations')->where('id', $arrProductVendorLocationId[0]->product_vendor_location_id)->select('product_id', 'vendor_location_id')->get(); //$productDetails = $this->experiencesRepository->getByExperienceId($arrProductID[0]->product_id); //$outlet = $this->experiences_model->getOutlet($arrProductVendorLocationId[0]->product_vendor_location_id); //$locationDetails = $this->experiences_model->getLocationDetails($arrProductVendorLocationId[0]->product_vendor_location_id); //----------------------------------------------------------------------------------------------------- $locationDetails = self::getExperienceLocationDetails($arrProductVendorLocationId[0]->product_vendor_location_id); $outlet = self::getExperienceOutlet($arrProductVendorLocationId[0]->product_vendor_location_id); $productDetailsTemp = self::readProductDetailByProductVendorLocationID($arrProductVendorLocationId[0]->product_vendor_location_id); $productDetails['attributes'] = array('experience_includes' => $productDetailsTemp['experience_includes'], 'short_description' => $productDetailsTemp['short_description'], 'terms_and_conditions' => $productDetailsTemp['terms_and_conditions']); //-------------------------------------------------------------------------------------------------------- //echo "<prE>"; print_r($productDetails); //echo "<br/>----outlet-----<prE>"; print_r($outlet); //echo "<br/>----locationDetails-----<prE>"; print_r($locationDetails); if (!array_key_exists('giftCardID', $arrData)) { $arrData['giftCardID'] = ''; } //for the new db structure support $combined_date_and_time = $arrData['reservationDate'] . ' ' . $arrData['reservationTime']; $newDb['attributes']['reserv_datetime'] = Carbon::createFromFormat('Y-m-d H:i A', $combined_date_and_time)->toDateTimeString(); $newDb['attributes']['no_of_people_booked'] = $arrData['partySize']; $newDb['attributes']['cust_name'] = $userData['data']['full_name']; $newDb['attributes']['email'] = $userData['data']['email']; $newDb['attributes']['contact_no'] = $userData['data']['phone_number']; $newDb['attributes']['reserv_type'] = "Experience"; $newDb['attributes']['gift_card_id_reserv'] = $arrData['giftCardID']; $newDb['attributes']['experience'] = $outlet->vendor_name . ' - ' . $outlet->descriptive_title; $newDb['attributes']['api_added'] = "Mobile"; $newDb['attributes']['giu_membership_id'] = $userData['data']['membership_number']; $newDb['attributes']['outlet'] = $outlet->name; $newDb['attributes']['auto_reservation'] = "Not available"; $newDb['attributes']['ar_confirmation_id'] = "0"; $newDb['attributes']['alternate_id'] = 'E' . sprintf("%06d", $arrData['reservationID']); $newDb['attributes']['special_request'] = $arrData['addons_special_request']; //$newDb['attributes']['order_completed'] = 'User Changed'; $newDb['attributes']['reservation_status_id'] = 2; $newDb['userdetails']['user_id'] = $queryResult->user_id; $newDb['userdetails']['status'] = 2; $newDb['userdetails']['addons'] = isset($arrData['addon']) ? $arrData['addon'] : ""; $newDb['userdetails']['mobile'] = 1; //print_r($newDb);die; $reservDetails = new ReservationModel(); $newDbStatus = $reservDetails->updateAttributes($arrData['reservationID'], $newDb); //print_r($newDbStatus);die; /*TODO: Add the status of success check and include added_by and transaction_id attributes */ $zoho_data = array('Name' => $userData['data']['full_name'], 'Email_ids' => $userData['data']['email'], 'Contact' => $userData['data']['phone_number'], 'Experience_Title' => $outlet->vendor_name . ' - ' . $outlet->descriptive_title, 'No_of_People' => $arrData['partySize'], 'Date_of_Visit' => date('d-M-Y', strtotime($arrData['reservationDate'])), 'Time' => date("g:ia", strtotime($arrData['reservationTime'])), 'Type' => 'Experience', 'API_added' => 'Mobile', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Order_completed' => 'User Changed', 'Special_Request' => $arrData['addons_special_request'], 'gift_card_id_from_reservation' => $arrData['giftCardID']); //echo "<pre>"; print_r($zoho_data); self::zohoEditBooking('E' . sprintf("%06d", $arrData['reservationID']), $zoho_data); $dataPost = array('reservation_type' => $arrData['reservationType'], 'reservationID' => $arrData['reservationID'], 'partySize' => $arrData['partySize'], 'reservationDate' => $arrData['reservationDate'], 'reservationTime' => $arrData['reservationTime'], 'guestName' => $userData['data']['full_name'], 'guestEmail' => $userData['data']['email'], 'guestPhoneNo' => $userData['data']['phone_number'], 'order_id' => sprintf("%06d", $arrData['reservationID']), 'venue' => $outlet->vendor_name, 'reservation_date' => date('d-F-Y', strtotime($arrData['reservationDate'])), 'reservation_time' => date('g:i a', strtotime($arrData['reservationTime']))); $dataPost['addons_special_request'] = $arrData['addons_special_request']; $dataPost['giftcard_id'] = ""; //echo "<br/>---datapost---<pre>"; print_r($dataPost);die; Mail::send('site.pages.edit_experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $productDetails], function ($message) use($dataPost, $outlet) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to($dataPost['guestEmail'])->subject('Your WowTables Reservation at ' . $outlet->vendor_name . ' has been changed'); //$message->cc('*****@*****.**', '*****@*****.**'); }); //-------------------------------------------------------------------- $dataPost['admin_email'] = 1; $dataPost['final_reservation_oulet'] = $lastReservationDetail['reservation_oulet']; $dataPost['final_reservation_party_size'] = $lastReservationDetail['reservation_party_size']; $dataPost['final_reservation_date'] = $lastReservationDetail['reservation_date']; $dataPost['final_reservation_time'] = $lastReservationDetail['reservation_time']; //-------------------------------------------------------------------- Mail::send('site.pages.edit_experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $productDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('ER - #E' . $dataPost['order_id'] . ' | ' . $dataPost['reservation_date'] . ' , ' . $dataPost['reservation_time'] . ' | ' . $dataPost['venue'] . ' | ' . $dataPost['guestName']); $message->cc('*****@*****.**', '*****@*****.**', '*****@*****.**'); }); } else { if ($arrData['reservationType'] == "alacarte") { $arrVendorLocationID = DB::table('reservation_details')->where('id', $arrData['reservationID'])->select('vendor_location_id')->get(); //$outlet = $this->alacarte_model->getOutlet($arrVendorLocationID[0]->vendor_location_id); //$locationDetails = $this->alacarte_model->getLocationDetails($arrVendorLocationID[0]->vendor_location_id); //$vendorDetails = $this->restaurantLocationsRepository->getByRestaurantLocationId($arrVendorLocationID[0]->vendor_location_id); //--------------------------------------------------------------------------------------------------- $outlet = self::getAlacarteOutlet($arrVendorLocationID[0]->vendor_location_id); $locationDetails = self::getAlacarteLocationDetails($arrVendorLocationID[0]->vendor_location_id); $vendorDetailsTemp = self::readVendorDetailByLocationID($arrVendorLocationID[0]->vendor_location_id); $vendorDetails['attributes'] = array('short_description' => $vendorDetailsTemp['short_description'], 'terms_and_conditions' => $vendorDetailsTemp['terms_conditions']); //------------------------------------------------------------------------------------------------------- //for the new db structure support $combined_date_and_time = $arrData['reservationDate'] . ' ' . $arrData['reservationTime']; $newDb['attributes']['reserv_datetime'] = Carbon::createFromFormat('Y-m-d H:i A', $combined_date_and_time)->toDateTimeString(); $newDb['attributes']['no_of_people_booked'] = $arrData['partySize']; $newDb['attributes']['cust_name'] = $userData['data']['full_name']; $newDb['attributes']['email'] = $userData['data']['email']; $newDb['attributes']['contact_no'] = $userData['data']['phone_number']; $newDb['attributes']['reserv_type'] = "Alacarte"; //$newDb['attributes']['gift_card_id_reserv'] = $arrData['giftCardID']; $newDb['attributes']['experience'] = $outlet->vendor_name . ' - Ala Carte'; $newDb['attributes']['api_added'] = "Mobile"; $newDb['attributes']['giu_membership_id'] = $userData['data']['membership_number']; $newDb['attributes']['outlet'] = $outlet->name; $newDb['attributes']['auto_reservation'] = "Not available"; $newDb['attributes']['ar_confirmation_id'] = "0"; $newDb['attributes']['alternate_id'] = 'A' . sprintf("%06d", $arrData['reservationID']); //$newDb['attributes']['order_completed'] = 'User Changed'; $newDb['attributes']['reservation_status_id'] = 2; $newDb['userdetails']['user_id'] = $queryResult->user_id; $newDb['userdetails']['status'] = 2; //print_r($newDb);die; $reservDetails = new ReservationModel(); $newDbStatus = $reservDetails->updateAttributes($arrData['reservationID'], $newDb); //print_r($newDbStatus);die; /*TODO: Add the status of success check and include added_by and transaction_id attributes */ //echo "experience success";die; $zoho_data = array('Name' => $userData['data']['full_name'], 'Email_ids' => $userData['data']['email'], 'Contact' => $userData['data']['phone_number'], 'Experience_Title' => $outlet->vendor_name . ' - Ala Carte', 'No_of_People' => $arrData['partySize'], 'Date_of_Visit' => date('d-M-Y', strtotime($arrData['reservationDate'])), 'Time' => date("g:i a", strtotime($arrData['reservationTime'])), 'Type' => 'alacarte', 'API_added' => 'Mobile', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Order_completed' => 'User Changed'); self::zohoEditBooking('A' . sprintf("%06d", $arrData['reservationID']), $zoho_data); $dataPost = array('reservation_type' => $arrData['reservationType'], 'reservationID' => $arrData['reservationID'], 'partySize' => $arrData['partySize'], 'reservationDate' => $arrData['reservationDate'], 'reservationTime' => $arrData['reservationTime'], 'guestName' => $userData['data']['full_name'], 'guestEmail' => $userData['data']['email'], 'guestPhoneNo' => $userData['data']['phone_number'], 'order_id' => sprintf("%06d", $arrData['reservationID']), 'venue' => $outlet->vendor_name, 'reservation_date' => date('d-F-Y', strtotime($arrData['reservationDate'])), 'reservation_time' => date('g:i a', strtotime($arrData['reservationTime']))); $dataPost['giftcard_id'] = ""; //echo "<br/>---datapost---<pre>"; print_r($dataPost);die; Mail::send('site.pages.edit_restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails], function ($message) use($dataPost, $outlet) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to($dataPost['guestEmail'])->subject('Your WowTables Reservation at ' . $outlet->vendor_name . ' has been changed'); //$message->cc('*****@*****.**', '*****@*****.**'); }); //-------------------------------------------------------- $dataPost['admin_email'] = 1; $dataPost['final_reservation_party_size'] = $lastReservationDetail['reservation_party_size']; $dataPost['final_reservation_date'] = $lastReservationDetail['reservation_date']; $dataPost['final_reservation_time'] = $lastReservationDetail['reservation_time']; //--------------------------------------------------------- Mail::send('site.pages.edit_restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('ER - #A' . $dataPost['order_id'] . ' | ' . $dataPost['reservation_date'] . ' , ' . $dataPost['reservation_time'] . ' | ' . $dataPost['venue'] . ' | ' . $dataPost['guestName']); //$message->to('*****@*****.**')->subject('ER - #A'.$dataPost['order_id'].' | '.$dataPost['reservation_date'].' , '.$dataPost['reservation_time'].' | '.$dataPost['venue'].' | '.$dataPost['guestName']); $message->cc('*****@*****.**', '*****@*****.**', '*****@*****.**'); }); } } }
/** * Handles requests for cancelling a reservation. * * @access public * @return response * @since 1.0.0 */ public function updateReservetion() { //echo "<pre>"; print_r(Input::all()); //die; $reserv_id = $this->request->input('reserv_id'); $vendor_details = $this->request->input('vendor_details'); $array = explode(',', $vendor_details); $reserveType = $array['0']; //echo "sd = ".$reserveType; die; $party_size = $this->request->input('party_size'); $locality_val = $this->request->input('locality_val'); $edit_date = $this->request->input('edit_date'); $edit_date1 = $this->request->input('last_reserv_date'); $new_date = date('Y-m-d', strtotime($this->request->input('last_reserv_date'))); /*$datearray=explode(" ",$edit_date); $date = trim(str_replace(range('a','z'),'',$datearray["0"])); $remove_comma = trim(str_replace(',','',$datearray["1"])); $month = str_pad($remove_comma, 2, "0", STR_PAD_LEFT); $year = $datearray["2"]; $final_date_format = $year.'-'.$month.'-'.$date;*/ $final_date_format = $edit_date1; $edit_time = $this->request->input('edit_time'); //echo "new_date = ".$new_date; $last_reservation_time = $this->request->input('last_reservation_time'); $last_reservation_date = $this->request->input('last_reservation_date'); $last_reservation_party_size = $this->request->input('last_reservation_party_size'); $new_reservation_outlet = $this->request->input('new_locality_value'); $last_reservation_outlet_val = $this->request->input('old_locality_value'); $last_reservation_outlet_name = $this->request->input('old_area_name'); $last_reservation_giftcard_id = rtrim($this->request->input('last_reservation_giftcard_id')); $user_id = $this->request->input('user_id'); $added_by = $this->request->input('added_by'); //check for outlet change if ($locality_val != $last_reservation_outlet_val) { //echo " , outlet changed, send to email"; $old_reservation_outlet = $last_reservation_outlet_name; $new_reservation_outlet = $new_reservation_outlet; $reservation_oulet = " Old Outlet: " . $old_reservation_outlet . " -> New Outlet: " . $new_reservation_outlet; } else { $reservation_oulet = ""; } //check for party size change if ($party_size != $last_reservation_party_size) { //echo " , party size changed, send to email"; $old_reservation_party_size = $last_reservation_party_size; $new_reservation_party_size = $party_size; $reservation_party_size = " Old Party Size: " . $old_reservation_party_size . " -> New Party Size: " . $new_reservation_party_size; } else { $reservation_party_size = ""; } //check for date change if ($new_date != $last_reservation_date) { $old_reservation_date = $last_reservation_date; $new_reservation_date = $new_date; $reservation_date = " Old Date: " . $old_reservation_date . " -> New Date: " . $new_reservation_date; } else { $reservation_date = ""; } //check for time change if ($edit_time != $last_reservation_time) { $old_reservation_time = $last_reservation_time; $new_reservation_time = $edit_time; $reservation_time = " Old Time: " . $old_reservation_time . " -> New Time: " . $new_reservation_time; } else { $reservation_time = ""; } $addonsArray = $this->request->input('addonsArray'); $giftcard_id = $this->request->input('giftcard_id'); $giftcard_id_text = $this->request->input('giftcard_id') != "" ? $this->request->input('giftcard_id') : "NULL"; $special_request = $this->request->input('special_request'); // `print_r($addonsArray); //echo "sad = ".$giftcard_id; $count = $this->request->input('addonsArray'); $giftcard_change = ''; if ($giftcard_id != $last_reservation_giftcard_id) { if ($giftcard_id == "") { //echo " d null = ".$giftcard_id_text; $giftcard_change = " old Giftcard ID: " . $last_reservation_giftcard_id . " -> New Giftcard ID: " . $giftcard_id_text; } else { $giftcard_change = " old Giftcard ID: " . $last_reservation_giftcard_id . " -> New Giftcard ID: " . $giftcard_id_text; } } else { $giftcard_change = ""; } //die; if ($count == "") { $addonsArray = array(); } $addonsText = ''; foreach ($addonsArray as $prod_id => $qty) { if ($qty > 0) { //echo "prod id = ".$prod_id." , qty = ".$qty; $addonsDetails = DB::select("SELECT attribute_value from product_attributes_text where product_id = {$prod_id} and product_attribute_id = 17"); //echo "<pre>"; print_r($addonsDetails); $addonsText .= $addonsDetails[0]->attribute_value . " (" . $qty . ") , "; } } //$addons_special_request = isset($addonsText) && $addonsText != "" ? "Addons: ".$addonsText : " "; $finalAddontext = isset($addonsText) && $addonsText != "" ? "Addons: " . $addonsText : " "; $special_request_data = isset($special_request) && $special_request != "" ? "Spl Req: " . $special_request : ""; $addons_special_request = $finalAddontext . " " . $special_request_data; //echo " addon special request = ".$addons_special_request; //echo "<pre>"; print_r($addonsArray); die; /*if(count($addonsArray)>=1) { DB::delete("delete from reservation_addons_variants_details where reservation_id = '$reserv_id'"); $this->experiences_model->addReservationAddonDetails($reserv_id, $addonsArray); }*/ //exit; if ($locality_val == "" || $locality_val == '0') { //echo 'null'; DB::update("update reservation_details set reservation_date='{$final_date_format}',reservation_time='{$edit_time}',no_of_persons='{$party_size}',reservation_status='edited' where id = '{$reserv_id}'"); } else { //echo 'value is present'; DB::update("update reservation_details set reservation_date='{$final_date_format}',reservation_time='{$edit_time}',no_of_persons='{$party_size}',vendor_location_id='{$locality_val}',reservation_status='edited' where id = '{$reserv_id}'"); } //exit; DB::update("update reservation_details set giftcard_id='{$giftcard_id}', special_request = '{$special_request}' where id = '{$reserv_id}'"); //code for new db structure changes $combined_date_and_time = $final_date_format . ' ' . $edit_time; $newDb['attributes']['reserv_datetime'] = Carbon::createFromFormat('Y-m-d H:i A', $combined_date_and_time)->toDateTimeString(); $newDb['attributes']['no_of_people_booked'] = $party_size; $newDb['attributes']['gift_card_id_reserv'] = isset($giftcard_id) ? $giftcard_id : ""; $newDb['attributes']['special_request'] = $special_request ? $special_request : ""; $newDb['attributes']['reservation_status_id'] = 2; $newDb['userdetails']['user_id'] = $user_id; $newDb['userdetails']['status'] = 2; $newDb['userdetails']['addons'] = $addonsArray; //print_r($newDb);die; $reservDetails = new ReservDetailsModel(); $newDbStatus = $reservDetails->updateAttributes($reserv_id, $newDb); $tokens = $reservDetails->pushToRestaurant($reserv_id); $this->restaurantapp->push($reserv_id, $tokens, true); //print_r($newDbStatus);die; /*TODO: Add the status of success check and include added_by and transaction_id attributes */ //die; $userID = $user_id; $userData = Profile::getUserProfileWeb($userID); if ($reserveType == "experience") { $arrProductVendorLocationId = DB::table('reservation_details')->where('id', $reserv_id)->select('product_vendor_location_id')->get(); $arrProductID = DB::table('product_vendor_locations')->where('id', $arrProductVendorLocationId[0]->product_vendor_location_id)->select('product_id', 'vendor_location_id')->get(); $productDetails = $this->experiencesRepository->getByExperienceId($arrProductID[0]->product_id); $outlet = $this->experiences_model->getOutlet($arrProductVendorLocationId[0]->product_vendor_location_id); $locationDetails = $this->experiences_model->getLocationDetails($arrProductVendorLocationId[0]->product_vendor_location_id); //echo "<prE>"; print_r($productDetails); //echo "<br/>----outlet-----<prE>"; print_r($outlet); //echo "<br/>----locationDetails-----<prE>"; print_r($locationDetails); $zoho_data = array('Name' => $userData['data']['full_name'], 'Email_ids' => $userData['data']['email'], 'Contact' => $userData['data']['phone_number'], 'Experience_Title' => $outlet->vendor_name . ' - ' . $outlet->descriptive_title, 'No_of_People' => $party_size, 'Date_of_Visit' => date('d-M-Y', strtotime($edit_date1)), 'Time' => date("g:ia", strtotime($this->request->input('edit_time'))), 'Type' => 'Experience', 'API_added' => $added_by == 'user' ? 'Web Updated' : 'Admin Updated', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Order_completed' => $added_by == 'user' ? 'User Changed' : 'Admin Changed', 'Special_Request' => $addons_special_request, 'gift_card_id_from_reservation' => $giftcard_id); //echo "<pre>E".sprintf("%06d",$reserv_id); print_r($zoho_data); die; $this->zoho_edit_booking('E' . sprintf("%06d", $reserv_id), $zoho_data); //echo "<pre> a ="; print_r($a); die; $dataPost = array('reservation_type' => $reserveType, 'reservationID' => $reserv_id, 'partySize' => $party_size, 'reservationDate' => $edit_date1, 'reservationTime' => $this->request->input('edit_time'), 'guestName' => $userData['data']['full_name'], 'guestEmail' => $userData['data']['email'], 'guestPhoneNo' => $userData['data']['phone_number'], 'order_id' => sprintf("%06d", $reserv_id), 'venue' => $outlet->vendor_name, 'reservation_date' => date('d-F-Y', strtotime($edit_date1)), 'reservation_time' => date('g:i a', strtotime($this->request->input('edit_time'))), 'addons_special_request' => $addons_special_request, 'giftcard_id' => $giftcard_id); //echo "<br/>---datapost---<pre>"; print_r($dataPost);die; Mail::send('site.pages.edit_experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $productDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to($dataPost['guestEmail'])->subject('Your WowTables Reservation at ' . $dataPost['venue'] . ' has been changed'); //$message->cc('*****@*****.**', '*****@*****.**'); }); $dataPost['admin_email'] = 1; $dataPost['final_reservation_oulet'] = $reservation_oulet; $dataPost['final_reservation_party_size'] = $reservation_party_size; $dataPost['final_reservation_date'] = $reservation_date; $dataPost['final_reservation_time'] = $reservation_time; $dataPost['final_giftcard_id'] = $giftcard_change; Mail::send('site.pages.edit_experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $productDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('ER - #E' . $dataPost['order_id'] . ' | ' . $dataPost['reservation_date'] . ' , ' . $dataPost['reservation_time'] . ' | ' . $dataPost['venue'] . ' | ' . $dataPost['guestName']); $message->cc('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'); }); } else { if ($reserveType == "alacarte") { $arrVendorLocationID = DB::table('reservation_details')->where('id', $reserv_id)->select('vendor_location_id')->get(); $outlet = $this->alacarte_model->getOutlet($arrVendorLocationID[0]->vendor_location_id); $locationDetails = $this->alacarte_model->getLocationDetails($arrVendorLocationID[0]->vendor_location_id); $vendorDetails = $this->restaurantLocationsRepository->getByRestaurantLocationId($arrVendorLocationID[0]->vendor_location_id); $zoho_data = array('Name' => $userData['data']['full_name'], 'Email_ids' => $userData['data']['email'], 'Contact' => $userData['data']['phone_number'], 'Experience_Title' => $outlet->vendor_name . ' - Ala Carte', 'No_of_People' => $party_size, 'Date_of_Visit' => date('d-M-Y', strtotime($edit_date1)), 'Time' => date("g:i a", strtotime($this->request->input('edit_time'))), 'Type' => 'Experience', 'API_added' => $added_by == 'user' ? 'Web Updated' : 'Admin Updated', 'GIU_Membership_ID' => $userData['data']['membership_number'], 'Outlet' => $outlet->name, 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Order_completed' => $added_by == 'user' ? 'User Changed' : 'Admin Changed', 'Special_Request' => $addons_special_request); $this->zoho_edit_booking('A' . sprintf("%06d", $reserv_id), $zoho_data); $dataPost = array('reservation_type' => $reserveType, 'reservationID' => $reserv_id, 'partySize' => $party_size, 'reservationDate' => $edit_date1, 'reservationTime' => $this->request->input('edit_time'), 'guestName' => $userData['data']['full_name'], 'guestEmail' => $userData['data']['email'], 'guestPhoneNo' => $userData['data']['phone_number'], 'order_id' => sprintf("%06d", $reserv_id), 'venue' => $outlet->vendor_name, 'reservation_date' => date('d-F-Y', strtotime($edit_date1)), 'reservation_time' => date('g:i a', strtotime($this->request->input('edit_time')))); //echo "<br/>---datapost---<pre>"; print_r($dataPost);die; Mail::send('site.pages.edit_restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to($dataPost['guestEmail'])->subject('Your WowTables Reservation at ' . $dataPost['venue'] . ' has been changed'); //$message->cc('*****@*****.**', '*****@*****.**'); }); $dataPost['admin_email'] = 1; $dataPost['final_reservation_party_size'] = $reservation_party_size; $dataPost['final_reservation_date'] = $reservation_date; $dataPost['final_reservation_time'] = $reservation_time; Mail::send('site.pages.edit_restaurant_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $dataPost, 'productDetails' => $vendorDetails], function ($message) use($dataPost) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('ER - #A' . $dataPost['order_id'] . ' | ' . $dataPost['reservation_date'] . ' , ' . $dataPost['reservation_time'] . ' | ' . $dataPost['venue'] . ' | ' . $dataPost['guestName']); $message->cc(['*****@*****.**', '*****@*****.**']); }); } } echo '1'; }
/** * Handles requst for displaying the my account reservation. * record of the logged in user. * * @access public * @param string $access_token * @return response * @since 1.0.0 */ public function updateInfo() { $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; $arrResponse['user'] = Auth::user(); $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. $id = Session::get('id'); $data = Profile::getUserProfileWeb($id); return view('frontend.pages.updateinfo', $arrResponse)->with('data', $data)->with('cities', $cities); }
/** * Show the form for editing the specified resource. * * @Get("/edit/{id}", as="AdminUserEdit") * @param int $id * @return Response */ public function edit($id) { //$user = $this->userRepo->getByUserId($id); $cities = Location::where(['Type' => 'City', 'visible' => 1])->lists('name', 'id'); $data = Profile::getUserProfileWeb($id); $role = DB::table('roles')->select('id', 'name')->get(); /* print_r($role); exit;*/ return view('admin.users.edit', ['data' => $data])->with('cities', $cities)->with('role', $role); }
public function process_response() { //echo "sad <br/>"; $requestarray = Input::all(); $fetch_cookie = Session::get('email_session'); if ($requestarray['status'] == "success") { $details = '<table width="600" cellpadding="2" cellspacing="2" border="0"> <tr> <th colspan="2">Transaction Details</th> </tr>'; foreach ($requestarray as $key => $value) { $details .= '<tr> <td class="fieldName" width="50%">' . $key . '</td> <td class="fieldName" align="left" width="50%">' . $value . '</td> </tr>'; } $details .= '</table>'; $transaction['user_id'] = $fetch_cookie['user_id']; $transaction['response_code'] = $requestarray['unmappedstatus']; $transaction['response_message'] = $requestarray['status']; $transaction['transaction_date'] = date('Y-m-d H:i:s'); $transaction['reservation_id'] = $requestarray['txnid']; $transaction['amount_paid'] = $requestarray['amount']; $transaction['transaction_number'] = $requestarray['mihpayid']; $transaction['transaction_details'] = $details . "~~" . $requestarray['status']; $transaction['source_type'] = "experience"; $userData = Profile::getUserProfileWeb($transaction['user_id']); $lastTransactionID = DB::table('transactions_details')->insertGetId($transaction); $bookingsMade = DB::table('reservation_details')->where('id', $requestarray['txnid'])->update(array('reservation_status' => 'prepaid', 'transaction_id' => $lastTransactionID)); $locationDetails = $this->experiences_model->getLocationDetails($fetch_cookie['vendorLocationID']); $outlet = $this->experiences_model->getOutlet($fetch_cookie['vendorLocationID']); $productDetails = $this->repository->getByExperienceId($outlet->product_id); $userID = $fetch_cookie['user_id']; $rewardsPoints = $fetch_cookie['reward_points']; $bookingsMade = $fetch_cookie['bookingsMade']; $type = "new"; $reservationType = "experience"; $lastOrderId = $fetch_cookie['order_id']; //echo "rewardsPoints = ".$rewardsPoints." , bookingsMade = ".$bookingsMade." , type = ".$type." , reservationType = ".$reservationType; die; Profile::updateReservationInUsers($rewardsPoints, $type, $bookingsMade, $reservationType, $userID, $lastOrderId); DB::table('users')->where('id', $userID)->update(array('full_name' => $fetch_cookie['guestName'], 'phone_number' => $fetch_cookie['phone'])); //echo "<pre>"; print_r($reservationResponse); die; $zoho_data = array('Name' => $fetch_cookie['guestName'], 'Email_ids' => $fetch_cookie['guestEmail'], 'Contact' => $fetch_cookie['phone'], 'Experience_Title' => $fetch_cookie['restaurant_name'] . ' - ' . $fetch_cookie['descriptive_title'], 'No_of_People' => $fetch_cookie['partySize'], 'Date_of_Visit' => date('d-M-Y', strtotime($fetch_cookie['reservationDate'])), 'Time' => date("g:i A", strtotime($fetch_cookie['reservationTime'])), 'Alternate_ID' => 'E' . sprintf("%06d", $fetch_cookie['order_id']), 'Special_Request' => $fetch_cookie['addons_special_request'], 'Type' => "Experience", 'API_added' => 'Web Reservation', 'GIU_Membership_ID' => $fetch_cookie['membership_number'], 'Outlet' => $fetch_cookie['outlet_name'], 'AR_Confirmation_ID' => '0', 'Auto_Reservation' => 'Not available', 'Calling_option' => 'No', 'gift_card_id_from_reservation' => isset($fetch_cookie['giftCardID']) && $fetch_cookie['giftCardID'] != "" ? $fetch_cookie['giftCardID'] : ""); //echo "<pre>"; print_r($zoho_data); $zoho_res = $this->zoho_add_booking($zoho_data); $zoho_success = $zoho_res->result->form->add->status; //echo "<pre>"; print_r($zoho_success); die; if ($zoho_success[0] != "Success") { //$this->email->from('*****@*****.**', 'WowTables by GourmetItUp'); //$list = array('*****@*****.**', '*****@*****.**', '*****@*****.**'); //$this->email->to($list); //$this->email->subject('Urgent: Zoho reservation posting error'); $mailbody = 'E' . sprintf("%06d", $fetch_cookie['order_id']) . ' reservation has not been posted to zoho. Please fix manually.<br><br>'; $mailbody .= 'Reservation Details<br>'; foreach ($zoho_data as $key => $val) { $name = str_replace('_', ' ', $key); $mailbody .= $name . ' ' . $val . '<br>'; } $city_id = Input::get('city'); $footerpromotions = DB::select('SELECT efp.link,mrn.file FROM email_footer_promotions as efp LEFT JOIN media_resized_new as mrn ON mrn.media_id = efp.media_id WHERE efp.show_in_experience = 1 AND efp.city_id = ' . $city_id); Mail::send('site.pages.zoho_posting_error', ['zoho_data' => $mailbody], function ($message) use($zoho_data) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('Urgent: Zoho reservation posting error'); $message->cc(['*****@*****.**', '*****@*****.**']); }); } $mergeReservationsArray = array('order_id' => sprintf("%06d", $fetch_cookie['order_id']), 'reservation_date' => date('d-F-Y', strtotime($fetch_cookie['reservationDate'])), 'reservation_time' => date('g:i a', strtotime($fetch_cookie['reservationTime'])), 'venue' => $fetch_cookie['restaurant_name'], 'username' => $fetch_cookie['guestName']); $reservationResponse = array(); $reservationResponse['data']['reservationDate'] = $fetch_cookie['reservationDate']; $reservationResponse['data']['reservationTime'] = $fetch_cookie['reservationTime']; $reservationResponse['data']['partySize'] = $fetch_cookie['partySize']; $reservationResponse['data']['reservationID'] = $fetch_cookie['order_id']; $reservationResponse['data']['reservation_type'] = "event"; Mail::send('site.pages.experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $fetch_cookie, 'productDetails' => $productDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to(Input::get('email'))->subject('Your WowTables Reservation at ' . $mergeReservationsArray['venue']); //$message->cc('*****@*****.**', '*****@*****.**'); }); $dataPost['admin'] = "yes"; Mail::send('site.pages.experience_reservation', ['location_details' => $locationDetails, 'outlet' => $outlet, 'post_data' => $fetch_cookie, 'productDetails' => $productDetails, 'reservationResponse' => $reservationResponse, 'footerPromotions' => !empty($footerpromotions) ? $footerpromotions : ""], function ($message) use($mergeReservationsArray) { $message->from('*****@*****.**', 'WowTables by GourmetItUp'); $message->to('*****@*****.**')->subject('NR - #E' . $mergeReservationsArray['order_id'] . ' | ' . $mergeReservationsArray['reservation_date'] . ' , ' . $mergeReservationsArray['reservation_time'] . ' | ' . $mergeReservationsArray['venue'] . ' | ' . $mergeReservationsArray['username']); $message->cc(['*****@*****.**', '*****@*****.**', '*****@*****.**']); }); //echo "userid == ".$userID; $getUsersDetails = $this->experiences_model->fetchDetails($userID); $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'; } $city = ucfirst($userData['data']['location']); //Start MailChimp if (!empty($getUsersDetails)) { $merge_vars = array('MERGE1' => $fetch_cookie['guestName'], 'MERGE10' => date('m/d/Y'), 'MERGE11' => $fetch_cookie['bookingsMade'], 'MERGE13' => $fetch_cookie['phone'], 'MERGE27' => date("m/d/Y", strtotime($fetch_cookie['reservationDate'])), 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city]))); $this->mailchimp->lists->subscribe($this->listId, ["email" => $fetch_cookie['guestEmail']], $merge_vars, "html", false, true); //$this->mc_api->listSubscribe($list_id, $_POST['email'], $merge_vars,"html",true,true ); /*$my_email = $dataPost['guestEmail']; //$city = $users['city']; $city = ucfirst($city_name); $mergeVars = array( 'GROUPINGS' => array( array( 'id' => 9613, 'groups' => [$city], ) ) ); //echo "asd , "; //$this->mailchimp->lists->interestGroupings($this->listId,true); //print_r($test);die; $this->mailchimp->lists->updateMember($this->listId, $my_email, $mergeVars);*/ } $arrResponse['allow_guest'] = 'Yes'; $arrResponse['current_city'] = strtolower($city_name); $arrResponse['current_city_id'] = $city_id; $arrResponse['restaurant_name'] = $fetch_cookie['restaurant_name']; $arrResponse['experience_title'] = $fetch_cookie['experience_title']; $arrResponse['experience_description'] = $fetch_cookie['experience_description']; $arrResponse['reservation_date'] = $fetch_cookie['reservationDate']; $arrResponse['reservation_time'] = $fetch_cookie['reservationTime']; $arrResponse['order_id'] = $mergeReservationsArray['order_id']; $arrResponse['guests'] = $fetch_cookie['partySize']; $arrResponse['experience_includes'] = $fetch_cookie['experience_includes']; $arrResponse['terms_and_conditions'] = $fetch_cookie['terms_and_conditions']; $arrResponse['short_description'] = $fetch_cookie['short_description']; $arrResponse['address'] = $fetch_cookie['address']; $arrResponse['lat'] = $fetch_cookie['lat']; $arrResponse['long'] = $fetch_cookie['long']; $arrResponse['city'] = $fetch_cookie['current_city']; $arrResponse['slug'] = $fetch_cookie['slug']; $arrResponse['total_amount'] = $fetch_cookie['total_amount']; $arrResponse['guestEmail'] = $fetch_cookie['guestEmail']; $arrResponse['guestName'] = $fetch_cookie['guestName']; $arrResponse['outlet_name'] = $outlet->name; $arrResponse['product_id'] = $outlet->product_id; $arrResponse['vendor_location_id'] = $outlet->vendor_location_id; $arrResponse['vendor_id'] = $outlet->vendor_id; return Redirect::to('/experiences/thankyou/E' . $mergeReservationsArray['order_id'])->with('response', $arrResponse); //Session::forget('email_session'); } }
public function giftcardCheckout(Request $request) { //echo "<pre>";print_r(Input::all()); //die; $totalAddons = $request->get('addons'); //echo "<pre>"; print_r($totalAddons); die; $receiverName = $request->get('receiver_name'); $receiverEmail = $request->get('receiver_email'); $giftcardType = $request->get('gift_opt'); if ($giftcardType == 2) { $explodePerpersonAmount = explode('|', $request->get('gift_choose_exp')); $perpersonAmount = $explodePerpersonAmount[2]; $productId = $explodePerpersonAmount[1]; $noOfGuests = $request->get('gift_no_people'); $short_description = $explodePerpersonAmount[0]; $totalAmount1 = $request->get('grandTotal'); } else { $totalAmount1 = $request->get('amount'); $short_description = "Cash value GiftCard of Rs. " . $totalAmount1; $perpersonAmount = 0; $productId = 0; $noOfGuests = 0; } $sendingType = $request->get('gift_send'); $specialInstructions = $request->get('special_instructions'); if ($sendingType == "mail") { $totalAmount = $totalAmount1 + 50; } else { $totalAmount = $totalAmount1; } //echo "sad = ".$totalAmount; die; $mailingAddress = $request->get('mailing_address'); $userID = $request->get('userid'); $giftcard = new Giftcards(); $giftcard->receiver_name = $receiverName; $giftcard->receiver_email = $receiverEmail; $giftcard->order_type = $giftcardType; if ($giftcardType == 2) { $giftcard->amount = $perpersonAmount; $giftcard->experience_id = $productId; $giftcard->no_of_guests = $noOfGuests; } $giftcard->total_amount = $totalAmount; $giftcard->sending_type = $sendingType; $giftcard->mailing_address = $mailingAddress; $giftcard->user_id = $userID; $giftcard->save(); $insertedId = $giftcard->id; if (!empty($totalAddons)) { foreach ($totalAddons as $addon => $value) { if ($value > 0) { $giftcardAddon = new GiftcardsAddonsPurchaseDetails(); $giftcardAddon->giftcards_purchase_details_id = $insertedId; $giftcardAddon->no_of_guests = $value; $giftcardAddon->addon_id = $addon; $giftcardAddon->save(); } } } //echo $insertedId; die; $userData = Profile::getUserProfileWeb($userID); //echo "<pre>"; print_r($userData); die; if ($insertedId > 0) { //echo "prepaid is true"; Session::forget('purchase_giftcard_session'); $cookiearray = array('guestName' => $userData['data']['full_name'], 'guestEmail' => $userData['data']['email'], 'phone' => $userData['data']['phone_number'], 'order_id' => 'G' . $insertedId, 'actual_order_id' => $insertedId, 'total_amount' => $totalAmount, 'short_description' => $short_description, 'receiverName' => $receiverName, 'receiverEmail' => $receiverEmail, 'giftcardType' => $giftcardType, 'productId' => $productId, 'noOfGuests' => $noOfGuests, 'sendingType' => $sendingType, 'mailingAddress' => $mailingAddress == "" ? 0 : $mailingAddress, 'specialInstructions' => $specialInstructions == "" ? 0 : $specialInstructions, 'userID' => $userID); //echo "<pre>"; print_r($cookiearray); die; $city_id = Input::get('city'); $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name'); if (empty($city_name)) { $city_name = 'mumbai'; } $cookiearray['allow_guest'] = 'Yes'; $cookiearray['current_city'] = strtolower($city_name); $cookiearray['current_city_id'] = $city_id; Session::put('purchase_giftcard_session', $cookiearray); //die; //echo "<pre>sad = "; print_r($_COOKIE); die; return view('site.pages.giftcard_payment', ['cookie_array' => $cookiearray]); } }