public function register($leadership_event_id, $booking_id)
 {
     $input = Input::all();
     $validator = Validator::make($input, Booking::$rules);
     if ($validator->passes()) {
         $booking = Booking::findOrFail($booking_id);
         $booking->registration_date = new Datetime();
         $booking->first = Input::get('first');
         $booking->last = Input::get('last');
         $booking->email = Input::get('email');
         $booking->contact_number = Input::get('contact_number');
         $booking->church = Input::get('church');
         $booking->role = Input::get('role');
         $booking->notes = Input::get('notes');
         $booking->save();
         return Redirect::route('registration', array($leadership_event_id))->with('info', 'Registration complete!');
     } else {
         $event = LeadershipEvent::find($leadership_event_id);
         $bookings = Booking::where('id', $booking_id)->get();
         $bookings->each(function ($booking) {
             // Should actually only be one...
             $booking->first = Input::get('first');
             $booking->last = Input::get('last');
             $booking->email = Input::get('email');
             $booking->contact_number = Input::get('contact_number');
             $booking->church = Input::get('church');
             $booking->role = Input::get('role');
             $booking->notes = Input::get('notes');
         });
         $this->layout->with('subtitle', $event->name());
         $this->layout->withErrors($validator);
         $this->layout->content = View::make('registration.index')->with('event', $event)->with('bookings', $bookings)->with('errors', $validator->messages());
     }
 }
Esempio n. 2
0
 public function unregister($leadership_event_id, $id)
 {
     $booking = Booking::findOrFail($id);
     $booking->registration_date = null;
     $booking->save();
     return Redirect::route('booking.show', array($leadership_event_id, $id))->with('info', 'Unregistered booking!');
 }
 /**
  * Creates a registration record for a booking.
  */
 public function register_booking()
 {
     $booking_id = Input::get('booking_id');
     $tickets = Input::get('tickets');
     $booking = Booking::findOrFail($booking_id);
     $booking->registrations()->save(new Registration(array('tickets' => $tickets)));
     return Redirect::route('register')->withInput()->with('info', 'Registration complete!');
 }
 /**
  * Update the specified booking in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id)
 {
     $booking = Booking::findOrFail($id);
     if (Input::has('val')) {
         $rules = ['val'];
         //dd('<pre>',Booking::with('Voucher')->where('id',$id)->first(), '</pre>');
         $bookingVouchers = Booking::whereHas('Voucher', function ($q) {
             $q->where('vouchers.val', 1);
         })->where('id', $id);
         //dd($booking->count());
         if ($bookingVouchers->count() > 0) {
             Session::flash("booking_cancellation_error_" . $id, "<b>Sorry</b>, You cannot cancel the above booking! You have " . $booking->first()->voucher->count() . " active vouchers");
         } else {
             $booking->update(array('val' => Input::get('val')));
             Session::flash('success', 'successfully Updated');
         }
         return Redirect::back();
     }
     $validator = Validator::make($data = Input::all(), Booking::$agentRules);
     if ($validator->fails()) {
         //dd($validator->errors());
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['user_id'] = Auth::id();
     $booking->update($data);
     return Redirect::back();
 }
Esempio n. 5
0
 public function clear($leadership_event_id, $activity_id, $booking_id)
 {
     $booking = Booking::findOrFail($booking_id);
     $booking->activities()->detach($activity_id);
     return Redirect::route('signup', array($leadership_event_id, $activity_id))->with('info', 'Sign-up cleared!');
 }
Esempio n. 6
0
 public static function amendBooking($bookingid)
 {
     $booking = Booking::findOrFail($bookingid);
     $booking->count = ++$booking->count;
     return $booking->save() ? true : false;
 }
 public function store()
 {
     $kit = Kits::findOrFail(Input::get('ID'));
     foreach ($kit->contents as $content) {
         if (Input::has('isMissing_' . $content->ID) && Input::get('isMissing_' . $content->ID) == '1' && $content->MissingLogID == null) {
             $message = Input::get('MissingID_' . $content->ID);
             $logID = Logs::MissingReport($kit->KitType, $kit->ID, $content->ID, $message);
             $content->MissingLogID = $logID;
         }
         if (Input::has('isDamaged_' . $content->ID) && Input::get('isDamaged_' . $content->ID) == '1' && $content->DamagedLogID == null) {
             $message = Input::get('DamagedID_' . $content->ID);
             $logID = Logs::DamageReport($kit->KitType, $kit->ID, $content->ID, $message);
             $content->DamagedLogID = $logID;
         }
         $content->save();
     }
     if (Input::has('LogMessage') && strlen(Input::get('LogMessage')) > 0) {
         $message = Input::get('LogMessage');
         $logNote = Logs::Note($kit->KitType, $kit->ID, NULL, $message);
     }
     $booking = Booking::findOrFail(Input::get('BookingID'));
     $kit->KitState = 1;
     $kit->AtBranch = $booking->ForBranch;
     $kit->save();
     return Redirect::action('recieve_kit.index');
 }
Esempio n. 8
0
 public function findKit($bookingID)
 {
     $branch = Branches::find(Session::get('branch'));
     // If the session is not set, default to the IT depot
     if (!isset($branch)) {
         $branch = Branches::find(0);
     }
     // Get Kits to be received
     $data = DB::select('SELECT
                           K.ID AS KitID, K.KitType, K.Name AS KitName, K.AtBranch, K.KitState, K.BarcodeNumber, K.Specialized,  K.SpecializedName,
                           B.ID as BookingID, B.ForBranch, B.StartDate, B.EndDate, B.ShadowStartDate, B.ShadowEndDate, B.Purpose,
                           KS.StateName,
                           KT.Name AS KitTypeName, KT.TypeDescription as KitTypeDesc
                           FROM Booking AS B
                             INNER JOIN Kits as K ON (K.ID = B.KitID)
                               INNER JOIN KitTypes AS KT ON (KT.ID = K.KitType)
                               INNER JOIN KitSTate AS KS ON (KS.ID = K.KitState)
                          WHERE now() BETWEEN DATE_ADD(B.ShadowStartDate, INTERVAL -1 DAY) AND B.ShadowEndDate
                                AND B.ForBranch = ?
                                AND B.ForBranch <> K.AtBranch
                                ORDER BY BookingID
                                ', array($branch->ID));
     // Get Kits to be sent out
     $data2 = DB::select('SELECT
                           K.ID AS KitID, K.KitType, K.Name AS KitName, K.AtBranch, K.KitState, K.BarcodeNumber, K.Specialized,  K.SpecializedName,
                           B.ID as BookingID, B.ForBranch, B.StartDate, B.EndDate, B.ShadowStartDate, B.ShadowEndDate, B.Purpose,
                           KS.StateName,
                           KT.Name AS KitTypeName, KT.TypeDescription as KitTypeDesc
                           FROM Booking AS B
                             INNER JOIN Kits as K ON (K.ID = B.KitID)
                               INNER JOIN KitTypes AS KT ON (KT.ID = K.KitType)
                               INNER JOIN KitSTate AS KS ON (KS.ID = K.KitState)
                          WHERE now() BETWEEN DATE_ADD(B.ShadowStartDate, INTERVAL -1 DAY) AND B.ShadowEndDate
                                AND K.AtBranch = ?
                                AND B.ForBranch <> K.AtBranch
                                ORDER BY BookingID
                                ', array($branch->ID));
     $findBookID = Booking::findOrFail($bookingID);
     $theBookID = $findBookID->ID;
     return CheckIfAuthenticated('members.receiveKitManagement', ['mode' => 'send', 'branch' => $branch, 'selected_menu' => 'main-menu-receive', 'receiveKits' => $data, 'sendKits' => $data2, 'findBookID' => $theBookID, 'kitTypes' => KitTypes::all()], 'home.index', [], false);
 }
 /**
  * Update the specified flightdetail in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($bookingId, $id)
 {
     $user = Auth::user();
     Session::flash('bookings_show_tabs', 'flight-details-tab');
     $flightdetail = FlightDetail::findOrFail($id);
     $data = [];
     $data['date'] = Input::get('date_' . $id);
     $data['time'] = Input::get('time_' . $id);
     $data['flight'] = Input::get('flight_' . $id);
     $data['flight_type'] = Input::get('flight_type_' . $id);
     $validator = Validator::make($data, FlightDetail::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($flightdetail->update($data)) {
         $booking = Booking::getBookingData($bookingId);
         $Currentbooking = Booking::findOrFail($bookingId);
         $Currentbooking->count = $Currentbooking->count++;
         $Currentbooking->save();
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Flight Info Deleted): ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::back();
 }
Esempio n. 10
0
 public function cancel($id)
 {
     $booking = Booking::findOrFail($id);
     $booking->status = 'cancelled';
     $booking->update();
     return Redirect::route('bookings.index');
 }