public function save() { $waitlist = new Waitlist($this->department); if (!$this->verifyValues()) { throw new Exception("Error processing request. Please try again."); } if ($waitlist->inList($this->studentId, $this->department, $this->course, $this->section)) { throw new Exception("Student already added to waitlist"); } else { $waitlist->add($this->toCsv()); } }
public function delete($id) { $user = Auth::user(); $waitlist = Waitlist::find($id); $club = $waitlist->member; if ($club) { $club = $waitlist->member->team->club; } else { $club = $waitlist->participant->event->club; } $title = 'League Together - Remove from Waitlist'; return View::make('app.club.waitlist.delete')->with('page_title', $title)->with('waitlist', $waitlist)->with('club', $club)->withUser($user); }
public function PaymentStoreTeam($club, $id) { $user = Auth::user(); $team = Team::find($id); $club = Club::find($club); $cart = Cart::contents(true); $uuid = Uuid::generate(); $uuidMember = Uuid::generate(); //Addition for stub feature $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail(); $title = 'League Together - ' . $team->club->name . ' Teams'; //check if follower equal club if ($follow->club_id != $club->id) { $param = array('ccnumber' => str_replace('_', '', Input::get('card')), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'), 'discount' => Input::get('discount'), 'club' => $club->id, 'firstname' => $user->profile->firstname, 'lastname' => $user->profile->lastname, 'phone' => $user->profile->mobile); } else { $param = array('customer_vault_id' => $user->profile->customer_vault, 'discount' => Input::get('discount'), 'club' => $club->id); } $payment = new Payment(); $transaction = $payment->sale($param); if ($transaction->response == 3 || $transaction->response == 2) { return Redirect::action('ClubPublicController@PaymentCreateTeam', array($club->id, $team->id))->with('error', $transaction->responsetext); } else { foreach (Cart::contents() as $item) { $player = Player::find($item->player_id); //default from team $due = $team->getOriginal('due'); $early_due = $team->getOriginal('early_due'); $early_due_deadline = $team->getOriginal('early_due_deadline'); $member = new Member(); $member->id = $uuidMember; $member->firstname = $player->firstname; $member->lastname = $player->lastname; $member->due = $due; $member->early_due = $early_due; $member->early_due_deadline = $early_due_deadline; $member->plan_id = $team->plan_id; $member->player_id = $player->id; $member->team_id = $item->team_id; $member->accepted_on = Carbon::Now(); $member->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname; $member->accepted_user = $user->id; $member->method = $item->type; $member->status = 1; $member->save(); $payment->id = $uuid; $payment->customer = $user->profile->customer_vault; $payment->transaction = $transaction->transactionid; $payment->subtotal = $transaction->subtotal; $payment->service_fee = $transaction->fee; $payment->total = $transaction->total; $payment->promo = $transaction->promo; $payment->tax = $transaction->tax; $payment->discount = $transaction->discount; $payment->club_id = $club->id; $payment->user_id = $user->id; $payment->player_id = $item->player_id; $payment->event_type = null; $payment->type = $transaction->type; $payment->save(); $salesfee = $item->price / getenv("SV_FEE") - $item->price; $sale = new Item(); $sale->description = $item->name; $sale->quantity = $item->quantity; $sale->price = $item->price; $sale->fee = $salesfee; $sale->member_id = $uuidMember; $sale->team_id = $item->team_id; $sale->payment_id = $uuid; $sale->save(); $member = Member::find($uuidMember); //create payments plan schedule if ($item->type == "plan") { $subtotal = $member->plan->getOriginal('recurring'); $fee = $subtotal / getenv("SV_FEE") - $subtotal; $total = $fee + $subtotal; for ($x = 1; $x < $member->plan->recurrences + 1; $x++) { $today = Carbon::now(); $today->addMonths($x); $payon = $member->plan->getOriginal('on'); //make sure the payday is a valid day if ($payon == 31) { if ($today->month == 2) { $payon = 28; } if ($today->month == 4 || $today->month == 6 || $today->month == 9 || $today->month == 11) { $payon = 30; } } $payday = Carbon::create($today->year, $today->month, $payon, 0); $schedule = new SchedulePayment(); $schedule->date = $payday; $schedule->description = "Membership Team " . $member->team->name; $schedule->subtotal = number_format($subtotal, 2); $schedule->fee = number_format($fee, 2); $schedule->total = number_format($total, 2); $schedule->plan_id = $member->plan->id; $schedule->club_id = $club->id; $schedule->member_id = $member->id; $status = $schedule->save(); if (!$status) { return "We process your payment but and error occurred in the process, please contact us: support@leaguetogether.com Error# 597"; } } //end for loop } //end if plan //waitlist process if ($team->max < $team->members->count()) { //add to waitlist $waitlist = new Waitlist(); $waitlist->id = Uuid::generate(); $waitlist->member_id = $uuidMember; $waitlist->team_id = $team->id; $waitlist->save(); } if ($club->processor_name == 'Bluepay') { //return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result','Success'); return Redirect::action('ClubPublicController@PaymentCreateTeam', array($club->id, $team->id))->with('error', 'Player added successfully. Please check your email for receipt.'); } else { $payment->receipt($transaction, $club->id, $item->player_id); return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result', $transaction); } //return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result',$transaction); } } }
<?php require_once dirname(__FILE__) . '/../classes/Waitlist.php'; // call this script with ajax $course = trim($_POST['course']); $section = trim($_POST['section']); $department = explode(" ", $course)[0]; if ($course == "Select Option") { die("Please select a course from the dropdown list"); } if ($section == "Select Option") { die("Please select a section from the dropdown list"); } $waitlist = new Waitlist($department, $section, $course); ob_start(); $waitlist->display(); $html = ob_get_clean(); die($html);