Work on custom attendee questions
Created answers table in DB
This commit is contained in:
parent
0ca9e2e1be
commit
ad8b5d9f62
|
|
@ -11,6 +11,7 @@ use App\Models\EventStats;
|
|||
use App\Models\Order;
|
||||
use App\Models\OrderItem;
|
||||
use App\Models\ReservedTickets;
|
||||
use App\Models\QuestionAnswer;
|
||||
use App\Models\Ticket;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -80,7 +81,7 @@ class EventCheckoutController extends Controller
|
|||
$quantity_available_validation_rules = [];
|
||||
|
||||
foreach ($ticket_ids as $ticket_id) {
|
||||
$current_ticket_quantity = (int) $request->get('ticket_'.$ticket_id);
|
||||
$current_ticket_quantity = (int)$request->get('ticket_' . $ticket_id);
|
||||
|
||||
if ($current_ticket_quantity < 1) {
|
||||
continue;
|
||||
|
|
@ -97,18 +98,18 @@ class EventCheckoutController extends Controller
|
|||
*/
|
||||
$max_per_person = min($ticket_quantity_remaining, $ticket->max_per_person);
|
||||
|
||||
$quantity_available_validation_rules['ticket_'.$ticket_id] = ['numeric', 'min:'.$ticket->min_per_person, 'max:'.$max_per_person];
|
||||
$quantity_available_validation_rules['ticket_' . $ticket_id] = ['numeric', 'min:' . $ticket->min_per_person, 'max:' . $max_per_person];
|
||||
|
||||
$quantity_available_validation_messages = [
|
||||
'ticket_'.$ticket_id.'.max' => 'The maximum number of tickets you can register is '.$ticket_quantity_remaining,
|
||||
'ticket_'.$ticket_id.'.min' => 'You must select at least '.$ticket->min_per_person.' tickets.',
|
||||
'ticket_' . $ticket_id . '.max' => 'The maximum number of tickets you can register is ' . $ticket_quantity_remaining,
|
||||
'ticket_' . $ticket_id . '.min' => 'You must select at least ' . $ticket->min_per_person . ' tickets.',
|
||||
];
|
||||
|
||||
$validator = Validator::make(['ticket_'.$ticket_id => (int) $request->get('ticket_'.$ticket_id)], $quantity_available_validation_rules, $quantity_available_validation_messages);
|
||||
$validator = Validator::make(['ticket_' . $ticket_id => (int)$request->get('ticket_' . $ticket_id)], $quantity_available_validation_rules, $quantity_available_validation_messages);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'messages' => $validator->messages()->toArray(),
|
||||
]);
|
||||
}
|
||||
|
|
@ -118,12 +119,12 @@ class EventCheckoutController extends Controller
|
|||
$organiser_booking_fee = $organiser_booking_fee + ($current_ticket_quantity * $ticket->organiser_booking_fee);
|
||||
|
||||
$tickets[] = [
|
||||
'ticket' => $ticket,
|
||||
'qty' => $current_ticket_quantity,
|
||||
'price' => ($current_ticket_quantity * $ticket->price),
|
||||
'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee),
|
||||
'ticket' => $ticket,
|
||||
'qty' => $current_ticket_quantity,
|
||||
'price' => ($current_ticket_quantity * $ticket->price),
|
||||
'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee),
|
||||
'organiser_booking_fee' => ($current_ticket_quantity * $ticket->organiser_booking_fee),
|
||||
'full_price' => $ticket->price + $ticket->total_booking_fee,
|
||||
'full_price' => $ticket->price + $ticket->total_booking_fee,
|
||||
];
|
||||
|
||||
/*
|
||||
|
|
@ -142,21 +143,21 @@ class EventCheckoutController extends Controller
|
|||
/*
|
||||
* Create our validation rules here
|
||||
*/
|
||||
$validation_rules['ticket_holder_first_name.'.$i.'.'.$ticket_id] = ['required'];
|
||||
$validation_rules['ticket_holder_last_name.'.$i.'.'.$ticket_id] = ['required'];
|
||||
$validation_rules['ticket_holder_email.'.$i.'.'.$ticket_id] = ['required', 'email'];
|
||||
$validation_rules['ticket_holder_first_name.' . $i . '.' . $ticket_id] = ['required'];
|
||||
$validation_rules['ticket_holder_last_name.' . $i . '.' . $ticket_id] = ['required'];
|
||||
$validation_rules['ticket_holder_email.' . $i . '.' . $ticket_id] = ['required', 'email'];
|
||||
|
||||
$validation_messages['ticket_holder_first_name.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s first name is required';
|
||||
$validation_messages['ticket_holder_last_name.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s last name is required';
|
||||
$validation_messages['ticket_holder_email.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s email is required';
|
||||
$validation_messages['ticket_holder_email.'.$i.'.'.$ticket_id.'.email'] = 'Ticket holder '.($i + 1).'\'s email appears to be invalid';
|
||||
$validation_messages['ticket_holder_first_name.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s first name is required';
|
||||
$validation_messages['ticket_holder_last_name.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s last name is required';
|
||||
$validation_messages['ticket_holder_email.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s email is required';
|
||||
$validation_messages['ticket_holder_email.' . $i . '.' . $ticket_id . '.email'] = 'Ticket holder ' . ($i + 1) . '\'s email appears to be invalid';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($tickets)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'message' => 'No tickets selected.',
|
||||
]);
|
||||
}
|
||||
|
|
@ -164,33 +165,33 @@ class EventCheckoutController extends Controller
|
|||
/*
|
||||
* @todo - Store this in something other than a session?
|
||||
*/
|
||||
session()->set('ticket_order_'.$event->id, [
|
||||
'validation_rules' => $validation_rules,
|
||||
'validation_messages' => $validation_messages,
|
||||
'event_id' => $event->id,
|
||||
'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */
|
||||
'total_ticket_quantity' => $total_ticket_quantity,
|
||||
'order_started' => time(),
|
||||
'expires' => $order_expires_time,
|
||||
'reserved_tickets_id' => $reservedTickets->id,
|
||||
'order_total' => $order_total,
|
||||
'booking_fee' => $booking_fee,
|
||||
'organiser_booking_fee' => $organiser_booking_fee,
|
||||
'total_booking_fee' => $booking_fee + $organiser_booking_fee,
|
||||
'order_requires_payment' => (ceil($order_total) == 0) ? false : true,
|
||||
'account_id' => $event->account->id,
|
||||
'affiliate_referral' => Cookie::get('affiliate_'.$event_id),
|
||||
'account_payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway : false,
|
||||
'payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway->payment_gateway : false,
|
||||
session()->set('ticket_order_' . $event->id, [
|
||||
'validation_rules' => $validation_rules,
|
||||
'validation_messages' => $validation_messages,
|
||||
'event_id' => $event->id,
|
||||
'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */
|
||||
'total_ticket_quantity' => $total_ticket_quantity,
|
||||
'order_started' => time(),
|
||||
'expires' => $order_expires_time,
|
||||
'reserved_tickets_id' => $reservedTickets->id,
|
||||
'order_total' => $order_total,
|
||||
'booking_fee' => $booking_fee,
|
||||
'organiser_booking_fee' => $organiser_booking_fee,
|
||||
'total_booking_fee' => $booking_fee + $organiser_booking_fee,
|
||||
'order_requires_payment' => (ceil($order_total) == 0) ? false : true,
|
||||
'account_id' => $event->account->id,
|
||||
'affiliate_referral' => Cookie::get('affiliate_' . $event_id),
|
||||
'account_payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway : false,
|
||||
'payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway->payment_gateway : false,
|
||||
]);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'status' => 'success',
|
||||
'redirectUrl' => route('showEventCheckout', [
|
||||
'event_id' => $event_id,
|
||||
'event_id' => $event_id,
|
||||
'is_embedded' => $this->is_embedded,
|
||||
]).'#order_form',
|
||||
]) . '#order_form',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +207,7 @@ class EventCheckoutController extends Controller
|
|||
*/
|
||||
public function showEventCheckout(Request $request, $event_id)
|
||||
{
|
||||
$order_session = session()->get('ticket_order_'.$event_id);
|
||||
$order_session = session()->get('ticket_order_' . $event_id);
|
||||
|
||||
|
||||
if (!$order_session || $order_session['expires'] < Carbon::now()) {
|
||||
|
|
@ -216,9 +217,9 @@ class EventCheckoutController extends Controller
|
|||
$secondsToExpire = Carbon::now()->diffInSeconds($order_session['expires']);
|
||||
|
||||
$data = $order_session + [
|
||||
'event' => Event::findorFail($order_session['event_id']),
|
||||
'event' => Event::findorFail($order_session['event_id']),
|
||||
'secondsToExpire' => $secondsToExpire,
|
||||
'is_embedded' => $this->is_embedded,
|
||||
'is_embedded' => $this->is_embedded,
|
||||
];
|
||||
|
||||
if ($this->is_embedded) {
|
||||
|
|
@ -240,8 +241,7 @@ class EventCheckoutController extends Controller
|
|||
$mirror_buyer_info = ($request->get('mirror_buyer_info') == 'on');
|
||||
$event = Event::findOrFail($event_id);
|
||||
$order = new Order;
|
||||
$ticket_order = session()->get('ticket_order_'.$event_id);
|
||||
|
||||
$ticket_order = session()->get('ticket_order_' . $event_id);
|
||||
|
||||
$validation_rules = $ticket_order['validation_rules'];
|
||||
$validation_messages = $ticket_order['validation_messages'];
|
||||
|
|
@ -253,7 +253,7 @@ class EventCheckoutController extends Controller
|
|||
|
||||
if (!$order->validate($request->all())) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'messages' => $order->errors(),
|
||||
]);
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ class EventCheckoutController extends Controller
|
|||
/*
|
||||
* Add the request data to a session in case payment is required off-site
|
||||
*/
|
||||
session()->push('ticket_order_' . $event_id .'.request_data', $request->except(['card-number', 'card-cvc']));
|
||||
session()->push('ticket_order_' . $event_id . '.request_data', $request->except(['card-number', 'card-cvc']));
|
||||
|
||||
/*
|
||||
* Begin payment attempt before creating the attendees etc.
|
||||
|
|
@ -275,17 +275,17 @@ class EventCheckoutController extends Controller
|
|||
'testMode' => config('attendize.enable_test_payments'),
|
||||
]);
|
||||
|
||||
switch($ticket_order['payment_gateway']->id) {
|
||||
switch ($ticket_order['payment_gateway']->id) {
|
||||
case config('attendize.payment_gateway_paypal'):
|
||||
case config('attendize.payment_gateway_coinbase'):
|
||||
|
||||
$transaction_data = [
|
||||
'cancelUrl' => route('showEventCheckoutPaymentReturn' , [
|
||||
'event_id' => $event_id,
|
||||
$transaction_data = [
|
||||
'cancelUrl' => route('showEventCheckoutPaymentReturn', [
|
||||
'event_id' => $event_id,
|
||||
'is_payment_cancelled' => 1
|
||||
]),
|
||||
'returnUrl' => route('showEventCheckoutPaymentReturn' , [
|
||||
'event_id' => $event_id,
|
||||
'returnUrl' => route('showEventCheckoutPaymentReturn', [
|
||||
'event_id' => $event_id,
|
||||
'is_payment_successful' => 1
|
||||
]),
|
||||
'brandName' => isset($ticket_order['account_payment_gateway']->config['brandingName'])
|
||||
|
|
@ -303,16 +303,16 @@ class EventCheckoutController extends Controller
|
|||
default:
|
||||
Log::error('No payment gateway configured.');
|
||||
return repsonse()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'message' => 'No payment gateway configured.'
|
||||
]);
|
||||
break;
|
||||
}
|
||||
|
||||
$transaction_data = [
|
||||
'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']),
|
||||
'currency' => $event->currency->code,
|
||||
'description' => 'Order for customer: '.$request->get('order_email'),
|
||||
'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']),
|
||||
'currency' => $event->currency->code,
|
||||
'description' => 'Order for customer: ' . $request->get('order_email'),
|
||||
] + $transaction_data;
|
||||
|
||||
$transaction = $gateway->purchase($transaction_data);
|
||||
|
|
@ -321,7 +321,7 @@ class EventCheckoutController extends Controller
|
|||
|
||||
if ($response->isSuccessful()) {
|
||||
|
||||
session()->push('ticket_order_' . $event_id .'.transaction_id', $response->getTransactionReference());
|
||||
session()->push('ticket_order_' . $event_id . '.transaction_id', $response->getTransactionReference());
|
||||
return $this->completeOrder($event_id);
|
||||
|
||||
} elseif ($response->isRedirect()) {
|
||||
|
|
@ -329,19 +329,19 @@ class EventCheckoutController extends Controller
|
|||
/*
|
||||
* As we're going off-site for payment we need to store some into in a session
|
||||
*/
|
||||
session()->push('ticket_order_' . $event_id .'.transaction_data', $transaction_data);
|
||||
session()->push('ticket_order_' . $event_id . '.transaction_data', $transaction_data);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'redirectUrl' => $response->getRedirectUrl(),
|
||||
'status' => 'success',
|
||||
'redirectUrl' => $response->getRedirectUrl(),
|
||||
'redirectData' => $response->getRedirectData(),
|
||||
'message' => 'Redirecting to ' . $ticket_order['payment_gateway']->provider_name
|
||||
'message' => 'Redirecting to ' . $ticket_order['payment_gateway']->provider_name
|
||||
]);
|
||||
|
||||
} else {
|
||||
// display error to customer
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'message' => $response->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
|
@ -352,7 +352,7 @@ class EventCheckoutController extends Controller
|
|||
|
||||
if ($error) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'error',
|
||||
'message' => $error,
|
||||
]);
|
||||
}
|
||||
|
|
@ -370,10 +370,10 @@ class EventCheckoutController extends Controller
|
|||
public function showEventCheckoutPaymentReturn(Request $request, $event_id)
|
||||
{
|
||||
|
||||
if($request->get('is_payment_cancelled') == '1') {
|
||||
if ($request->get('is_payment_cancelled') == '1') {
|
||||
session()->flash('message', 'You cancelled your payment. You may try again.');
|
||||
return response()->redirectToRoute('showEventCheckout', [
|
||||
'event_id' => $event_id,
|
||||
'event_id' => $event_id,
|
||||
'is_payment_cancelled' => 1,
|
||||
]);
|
||||
}
|
||||
|
|
@ -390,12 +390,12 @@ class EventCheckoutController extends Controller
|
|||
$response = $transaction->send();
|
||||
|
||||
if ($response->isSuccessful()) {
|
||||
session()->push('ticket_order_' . $event_id .'.transaction_id', $response->getTransactionReference());
|
||||
session()->push('ticket_order_' . $event_id . '.transaction_id', $response->getTransactionReference());
|
||||
return $this->completeOrder($event_id, false);
|
||||
} else {
|
||||
session()->flash('message', $response->getMessage());
|
||||
return response()->redirectToRoute('showEventCheckout', [
|
||||
'event_id' => $event_id,
|
||||
'event_id' => $event_id,
|
||||
'is_payment_failed' => 1,
|
||||
]);
|
||||
}
|
||||
|
|
@ -410,24 +410,25 @@ class EventCheckoutController extends Controller
|
|||
* @param bool|true $return_json
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function completeOrder($event_id, $return_json=true)
|
||||
public function completeOrder($event_id, $return_json = true)
|
||||
{
|
||||
|
||||
$order = new Order();
|
||||
$ticket_order = session()->get('ticket_order_' . $event_id);
|
||||
$request_data = $ticket_order['request_data'][0];
|
||||
$ticket_order = session()->get('ticket_order_' . $event_id);
|
||||
$request_data = $ticket_order['request_data'][0];
|
||||
$event = Event::findOrFail($ticket_order['event_id']);
|
||||
$attendee_increment = 1;
|
||||
$mirror_buyer_info = isset($request_data['mirror_buyer_info']) ? ($request_data['mirror_buyer_info'] == 'on') : false;
|
||||
$ticket_questions = $request_data['ticket_holder_questions'];
|
||||
|
||||
|
||||
/*
|
||||
* Create the order
|
||||
*/
|
||||
if(isset($ticket_order['transaction_id']))
|
||||
{
|
||||
if (isset($ticket_order['transaction_id'])) {
|
||||
$order->transaction_id = $ticket_order['transaction_id'][0];
|
||||
}
|
||||
if($ticket_order['order_requires_payment']) {
|
||||
if ($ticket_order['order_requires_payment']) {
|
||||
$order->payment_gateway_id = $ticket_order['payment_gateway']->id;
|
||||
}
|
||||
$order->first_name = $request_data['order_first_name'];
|
||||
|
|
@ -463,7 +464,7 @@ class EventCheckoutController extends Controller
|
|||
*/
|
||||
$event_stats = EventStats::firstOrNew([
|
||||
'event_id' => $event_id,
|
||||
'date' => DB::raw('CURDATE()'),
|
||||
'date' => DB::raw('CURDATE()'),
|
||||
]);
|
||||
$event_stats->increment('tickets_sold', $ticket_order['total_ticket_quantity']);
|
||||
|
||||
|
|
@ -504,53 +505,66 @@ class EventCheckoutController extends Controller
|
|||
* Create the attendees
|
||||
*/
|
||||
for ($i = 0; $i < $attendee_details['qty']; $i++) {
|
||||
|
||||
$attendee = new Attendee();
|
||||
$attendee->first_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->first_name : $request_data["ticket_holder_first_name.$i.{$attendee_details['ticket']['id']}"]) : $order->first_name;
|
||||
$attendee->last_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->last_name : $request_data["ticket_holder_last_name.$i.{$attendee_details['ticket']['id']}"]) : $order->last_name;
|
||||
$attendee->email = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->email : $request_data["ticket_holder_email.$i.{$attendee_details['ticket']['id']}"]) : $order->email;
|
||||
$attendee->first_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->first_name : $request_data["ticket_holder_first_name"][$i][$attendee_details['ticket']['id']]) : $order->first_name;
|
||||
$attendee->last_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->last_name : $request_data["ticket_holder_last_name"][$i][$attendee_details['ticket']['id']]) : $order->last_name;
|
||||
$attendee->email = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->email : $request_data["ticket_holder_email"][$i][$attendee_details['ticket']['id']]) : $order->email;
|
||||
$attendee->event_id = $event_id;
|
||||
$attendee->order_id = $order->id;
|
||||
$attendee->ticket_id = $attendee_details['ticket']['id'];
|
||||
$attendee->account_id = $event->account->id;
|
||||
$attendee->reference = $order->order_reference.'-'.($attendee_increment);
|
||||
$attendee->reference = $order->order_reference . '-' . ($attendee_increment);
|
||||
$attendee->save();
|
||||
|
||||
/*
|
||||
* Queue an email to send to each attendee
|
||||
* Save the answers to any additional questions
|
||||
*/
|
||||
foreach ($attendee_details['ticket']->questions as $question) {
|
||||
|
||||
$ticket_answer = $ticket_questions[$attendee_details['ticket']->id][$i][$question->id];
|
||||
|
||||
if(!empty($ticket_answer)) {
|
||||
QuestionAnswer::create([
|
||||
'answer_text' => $ticket_answer,
|
||||
'attendee_id' => $attendee->id,
|
||||
'event_id' => $event->id,
|
||||
'account_id' => $event->account->id,
|
||||
'question_id' => $question->id
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep track of total number of attendees */
|
||||
$attendee_increment++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Kill the session
|
||||
*/
|
||||
session()->forget('ticket_order_'.$event->id);
|
||||
session()->forget('ticket_order_' . $event->id);
|
||||
|
||||
/*
|
||||
* Queue up some tasks - Emails to be sent, PDFs etc.
|
||||
*/
|
||||
$this->dispatch(new OrderTicketsCommand($order));
|
||||
|
||||
|
||||
|
||||
if($return_json) {
|
||||
if ($return_json) {
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'status' => 'success',
|
||||
'redirectUrl' => route('showOrderDetails', [
|
||||
'is_embedded' => $this->is_embedded,
|
||||
'is_embedded' => $this->is_embedded,
|
||||
'order_reference' => $order->order_reference,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->redirectToRoute('showOrderDetails', [
|
||||
'is_embedded' => $this->is_embedded,
|
||||
'order_reference' => $order->order_reference,
|
||||
]);
|
||||
'is_embedded' => $this->is_embedded,
|
||||
'order_reference' => $order->order_reference,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -571,9 +585,9 @@ class EventCheckoutController extends Controller
|
|||
}
|
||||
|
||||
$data = [
|
||||
'order' => $order,
|
||||
'event' => $order->event,
|
||||
'tickets' => $order->event->tickets,
|
||||
'order' => $order,
|
||||
'event' => $order->event,
|
||||
'tickets' => $order->event->tickets,
|
||||
'is_embedded' => $this->is_embedded,
|
||||
];
|
||||
|
||||
|
|
@ -600,9 +614,9 @@ class EventCheckoutController extends Controller
|
|||
}
|
||||
|
||||
$data = [
|
||||
'order' => $order,
|
||||
'event' => $order->event,
|
||||
'tickets' => $order->event->tickets,
|
||||
'order' => $order,
|
||||
'event' => $order->event,
|
||||
'tickets' => $order->event->tickets,
|
||||
'attendees' => $order->attendees,
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Http\Requests\StoreEventQuestionRequest;
|
||||
use App\Models\Event;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\Question;
|
||||
use App\Models\QuestionType;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -16,30 +15,14 @@ class EventQuestionsController extends MyBaseController
|
|||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function showCreateEventQuestion(Request $request, $event_id)
|
||||
{
|
||||
// Get the event ID.
|
||||
$event_id = $request->get('event_id');
|
||||
|
||||
// Get the event or display a 'not found' warning.
|
||||
$event = Event::findOrFail($event_id);
|
||||
|
||||
// Initialize an empty array for the question options.
|
||||
$question_options = [
|
||||
(object)[
|
||||
'name' => '',
|
||||
],
|
||||
];
|
||||
$event = Event::scope()->findOrFail($event_id);
|
||||
|
||||
return view('ManageEvent.Modals.CreateQuestion', [
|
||||
'form_url' => route('event.question.store', [
|
||||
'event_id' => $event_id,
|
||||
]),
|
||||
'event' => $event,
|
||||
'question' => [],
|
||||
'modal_id' => $request->get('modal_id'),
|
||||
'question_types' => QuestionType::all(),
|
||||
'question_options' => $question_options,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -50,10 +33,8 @@ class EventQuestionsController extends MyBaseController
|
|||
* @param StoreEventQuestionRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreEventQuestionRequest $request)
|
||||
public function postCreateEventQuestion(StoreEventQuestionRequest $request, $event_id)
|
||||
{
|
||||
// Get the event ID.
|
||||
$event_id = $request->get('event_id');
|
||||
|
||||
// Get the event or display a 'not found' warning.
|
||||
$event = Event::findOrFail($event_id);
|
||||
|
|
@ -62,7 +43,7 @@ class EventQuestionsController extends MyBaseController
|
|||
$question = Question::createNew(false, false, true);
|
||||
$question->title = $request->get('title');
|
||||
$question->instructions = $request->get('instructions');
|
||||
$question->is_required = $request->get('title');
|
||||
$question->is_required = ($request->get('is_required') == 'yes') ;
|
||||
$question->question_type_id = $request->get('question_type_id');
|
||||
$question->save();
|
||||
|
||||
|
|
@ -83,27 +64,24 @@ class EventQuestionsController extends MyBaseController
|
|||
// Get tickets.
|
||||
$ticket_ids = $request->get('tickets');
|
||||
|
||||
// Add ticket <-> question entry.
|
||||
if ($ticket_ids && is_array($ticket_ids)) {
|
||||
foreach ($ticket_ids as $ticket_id) {
|
||||
Ticket::find($ticket_id)->questions()->attach($question->id);
|
||||
}
|
||||
}
|
||||
$question->tickets()->attach($ticket_ids);
|
||||
|
||||
$event->questions()->attach($question->id);
|
||||
|
||||
session()->flash('message', 'Successfully Created Question');
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Successfully Created Question. Refreshing page...',
|
||||
'runThis' => 'reloadPageDelayed();',
|
||||
'status' => 'success',
|
||||
'message' => 'Refreshing..',
|
||||
'redirectUrl' => route('showEventCustomize', ['event_id' => $event_id]) . '#questions',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function showEditEventQuestion(Request $request, $event_id, $question_id)
|
||||
{
|
||||
$question = Question::findOrFail($question_id);
|
||||
$event = Event::findOrFail($event_id);
|
||||
$question = Question::scope()->findOrFail($question_id);
|
||||
$event = Event::scope()->findOrFail($event_id);
|
||||
|
||||
$data = [
|
||||
'question' => $question,
|
||||
|
|
@ -118,51 +96,70 @@ class EventQuestionsController extends MyBaseController
|
|||
|
||||
public function postEditEventQuestion(Request $request, $event_id, $question_id)
|
||||
{
|
||||
// Get the event or display a 'not found' warning.
|
||||
$event = Event::scope()->findOrFail($event_id);
|
||||
|
||||
// Create question.
|
||||
$question = Question::scope()->findOrFail($question_id);
|
||||
$question->title = $request->get('title');
|
||||
$question->instructions = $request->get('instructions');
|
||||
$question->is_required = $request->get('is_required');
|
||||
$question->question_type_id = $request->get('question_type_id');
|
||||
$question->save();
|
||||
|
||||
// Get options.
|
||||
$options = $request->get('option');
|
||||
|
||||
$question->options()->delete();
|
||||
|
||||
// Add options.
|
||||
if ($options && is_array($options)) {
|
||||
foreach ($options as $option_name) {
|
||||
if (trim($option_name) !== '') {
|
||||
$question->options()->create([
|
||||
'name' => $option_name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get tickets.
|
||||
$ticket_ids = $request->get('tickets');
|
||||
|
||||
$question->tickets()->sync($ticket_ids);
|
||||
|
||||
session()->flash('message', 'Successfully Edited Question');
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Refreshing..',
|
||||
'redirectUrl' => route('showEventCustomize', ['event_id' => $event_id]) . '#questions',
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
|
||||
public function postDeleteEventQuestion(Request $request, $event_id)
|
||||
{
|
||||
//
|
||||
}
|
||||
$question_id = $request->get('question_id');
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
$question = Question::scope()->find($question_id);
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
if ($question->delete()) {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
session()->flash('message', 'Question Successfully Deleted');
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Refreshing..',
|
||||
'redirectUrl' => route('showEventCustomize', ['event_id' => $event_id]) . '#questions',
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'id' => $question->id,
|
||||
'message' => 'This question can\'t be deleted.',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -375,21 +375,36 @@ Route::group(['middleware' => ['auth', 'first.run']], function () {
|
|||
'uses' => 'EventTicketQuestionsController@postCreateQuestion',
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* Event questions.
|
||||
* Event Questions
|
||||
*/
|
||||
Route::resource('question', 'EventQuestionsController');
|
||||
Route::get('{event_id}/question/create', [
|
||||
'as' => 'showCreateEventQuestion',
|
||||
'uses' => 'EventQuestionsController@showCreateEventQuestion'
|
||||
]);
|
||||
|
||||
Route::post('{event_id}/question/create', [
|
||||
'as' => 'postCreateEventQuestion',
|
||||
'uses' => 'EventQuestionsController@postCreateEventQuestion'
|
||||
]);
|
||||
|
||||
|
||||
Route::get('{event_id}/question/{question_id}', [
|
||||
'as' => 'showEditEventQuestion',
|
||||
'uses' => 'EventQuestionsController@showEditEventQuestion'
|
||||
]);
|
||||
|
||||
|
||||
Route::post('{event_id}/question/{question_id}', [
|
||||
'as' => 'postEditEventQuestion',
|
||||
'uses' => 'EventQuestionsController@postEditEventQuestion'
|
||||
]);
|
||||
|
||||
Route::post('{event_id}/question/delete/{question_id}', [
|
||||
'as' => 'postDeleteEventQuestion',
|
||||
'uses' => 'EventQuestionsController@postDeleteEventQuestion'
|
||||
]);
|
||||
|
||||
/*
|
||||
* -------
|
||||
* Attendees
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class QuestionAnswer extends MyBaseModel
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'question_id',
|
||||
'event_id',
|
||||
'attendee_id',
|
||||
'account_id',
|
||||
'answer_text',
|
||||
];
|
||||
|
||||
public function event()
|
||||
{
|
||||
return $this->belongsToMany('\App\Models\Event');
|
||||
}
|
||||
|
||||
public function attendee()
|
||||
{
|
||||
return $this->belongsToMany('\App\Models\Attendee');
|
||||
}
|
||||
|
||||
public function question()
|
||||
{
|
||||
return $this->belongsToMany('\App\Models\Question');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class OrderPageUpdate extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->string('questions_collection_type', 10)->default('buyer'); // buyer or attendee
|
||||
$table->integer('checkout_timeout_after')->default(8); // timeout in mins for checkout
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn(['checkout_timeout_after', 'questions_collection_type']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddQuestionAnswersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('question_answers', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('attendee_id')->unsigned()->index();
|
||||
$table->integer('event_id')->unsigned()->index();
|
||||
$table->integer('question_id')->unsigned()->index();
|
||||
$table->integer('account_id')->unsigned()->index();
|
||||
$table->text('answer_text');
|
||||
$table->nullableTimestamps();
|
||||
|
||||
$table->foreign('attendee_id')->references('id')->on('attendees');
|
||||
$table->foreign('question_id')->references('id')->on('questions');
|
||||
|
||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$table->foreign('event_id')->references('id')->on('events')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
||||
Schema::drop('question_answers');
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
}
|
||||
}
|
||||
|
|
@ -390,10 +390,7 @@ function changeQuestionType(select)
|
|||
}
|
||||
}
|
||||
|
||||
function submitQuestionForm()
|
||||
{
|
||||
$('#edit-question-form').submit();
|
||||
}
|
||||
|
||||
|
||||
function addQuestionOption()
|
||||
{
|
||||
|
|
@ -437,12 +434,7 @@ function processFormErrors($form, errors)
|
|||
toggleSubmitDisabled($submitButton);
|
||||
}
|
||||
|
||||
function reloadPageDelayed()
|
||||
{
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -536,10 +536,22 @@
|
|||
|
||||
|
||||
<div class="tab-pane {{$tab == 'questions' ? 'active' : ''}}" id="questions">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::label('questions_collection_type', 'Question Collection Type', array('class'=>'control-label required')) !!}
|
||||
{!! Form::select('questions_collection_type', [
|
||||
'attendee' => 'Collect information for each attendee.',
|
||||
'buyer' => 'Only collect information for the buyer.'], $event->questions_collection_type,
|
||||
array(
|
||||
'class'=>'form-control'
|
||||
)) !!}
|
||||
</div>
|
||||
|
||||
<h4>Attendees questions</h4>
|
||||
<div class="panel">
|
||||
<div class="table-responsive">
|
||||
@if ($questions)
|
||||
@if($questions->count())
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>
|
||||
|
|
@ -548,6 +560,9 @@
|
|||
<th>
|
||||
Question Type
|
||||
</th>
|
||||
<th>
|
||||
Required
|
||||
</th>
|
||||
<th>
|
||||
Applies to tickets
|
||||
</th>
|
||||
|
|
@ -564,6 +579,9 @@
|
|||
<td>
|
||||
{{ $question->question_type->name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $question->is_required ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>
|
||||
{{implode(', ', array_column($question->tickets->toArray(), 'title'))}}
|
||||
</td>
|
||||
|
|
@ -572,7 +590,7 @@
|
|||
data-href="{{route('showEditEventQuestion', ['event_id' => $event->id, 'question_id' => $question->id])}}">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#" class="btn btn-xs btn-danger loadModal">
|
||||
<a data-id="{{ $question->id }}" data-route="{{ route('postDeleteEventQuestion', ['event_id' => $event->id, 'question_id' => $question->id]) }}" data-type="question" href="javascript:void(0);" class="btn btn-xs btn-danger deleteThis">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
|
|
@ -580,11 +598,16 @@
|
|||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<div class="panel-body">
|
||||
You haven't added any questions yet. You can add question by clicking the '<b>Add Question</b>' button below.
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="panel-footer mt15 text-right">
|
||||
<button class="loadModal btn btn-success" type="button" data-modal-id="EditQuestion" href="javascript:void(0);"
|
||||
data-href="{{route('event.question.create', ['event_id' => $event->id])}}">
|
||||
data-href="{{route('showCreateEventQuestion', ['event_id' => $event->id])}}">
|
||||
<i class="ico-question"></i> Add question
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
<div role="dialog" id="{{ $modal_id }}" class="modal fade" style="display: none;">
|
||||
{!! Form::open(['url' => route('postCreateEventQuestion', ['event_id'=>$event->id]), 'id' => 'edit-question-form', 'class' => 'ajax']) !!}
|
||||
<script id="question-option-template" type="text/template">
|
||||
<tr>
|
||||
<td><input class="form-control" name="option[]" type="text"></td>
|
||||
|
|
@ -17,9 +18,6 @@
|
|||
Create Question</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="panel panel-default">
|
||||
{!! Form::model($question, ['url' => $form_url, 'id' => 'edit-question-form', 'class' => 'ajax']) !!}
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="question-title" class="required">
|
||||
Question
|
||||
|
|
@ -61,14 +59,12 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($question_options as $question_option)
|
||||
<tr>
|
||||
<td><input class="form-control" name="option[]" type="text" value="{{ $question_option->name }}"></td>
|
||||
<td><input class="form-control" name="option[]" type="text" value=""></td>
|
||||
<td width="50">
|
||||
<i class="btn btn-danger ico-remove" onclick="removeQuestionOption(this);"></i>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
|
@ -84,7 +80,7 @@
|
|||
</fieldset>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::checkbox('is_required', 1, null, ['id' => 'is_required']) !!}
|
||||
{!! Form::checkbox('is_required', 'yes', false, ['id' => 'is_required']) !!}
|
||||
{!! Form::label('is_required', 'Make this a required question') !!}
|
||||
</div>
|
||||
|
||||
|
|
@ -100,18 +96,12 @@
|
|||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div> <!-- /end modal body-->
|
||||
<div class="modal-footer">
|
||||
<a href="" class="btn btn-danger" data-dismiss="modal">
|
||||
Close
|
||||
</a>
|
||||
<a class="btn btn-success" href="javascript:void(0);" onclick="submitQuestionForm();">
|
||||
Create Question
|
||||
</a>
|
||||
{!! Form::button('Cancel', ['class'=>"btn modal-close btn-danger",'data-dismiss'=>'modal']) !!}
|
||||
{!! Form::submit('Save Question', ['class'=>"btn btn-success"]) !!}
|
||||
</div>
|
||||
</div><!-- /end modal content-->
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<div role="dialog" id="{{ $modal_id }}" class="modal fade" style="display: none;">
|
||||
{!! Form::model($question, ['url' => route('postEditEventQuestion', ['event_id' => $event->id, 'question_id' => $question->id]), 'id' => 'edit-question-form', 'class' => 'ajax']) !!}
|
||||
<script id="question-option-template" type="text/template">
|
||||
<tr>
|
||||
<td><input class="form-control" name="option[]" type="text"></td>
|
||||
|
|
@ -16,9 +17,6 @@
|
|||
Edit Question</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="panel panel-default">
|
||||
{!! Form::model($question, ['url' => route('postEditEventQuestion', ['event_id' => $event->id, 'question_id' => $question->id]), 'id' => 'edit-question-form', 'class' => 'ajax']) !!}
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="question-title" class="required">
|
||||
Question
|
||||
|
|
@ -51,14 +49,9 @@
|
|||
'class' => 'form-control',
|
||||
]) !!}
|
||||
</div>
|
||||
<fieldset id="question-options" {!! empty($question->has_options) ? ' class="hide"' : '' !!}>
|
||||
<fieldset id="question-options" class="{{ $question->has_options ? 'hide' : '' }}" >
|
||||
<legend>Question Options</legend>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Option name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($question->options as $question_option)
|
||||
<tr>
|
||||
|
|
@ -83,7 +76,7 @@
|
|||
</fieldset>
|
||||
|
||||
<div class="form-group">
|
||||
{!! Form::checkbox('is_required', 1, null, ['id' => 'is_required']) !!}
|
||||
{!! Form::checkbox('is_required', 1, $question->is_required, ['id' => 'is_required']) !!}
|
||||
{!! Form::label('is_required', 'Make this a required question') !!}
|
||||
</div>
|
||||
|
||||
|
|
@ -91,26 +84,21 @@
|
|||
<label>
|
||||
Require this question for ticket(s):
|
||||
</label>
|
||||
|
||||
@foreach ($event->tickets as $ticket)
|
||||
<br>
|
||||
<input id="ticket_{{ $ticket->id }}" name="tickets[]" type="checkbox" value="{{ $ticket->id }}">
|
||||
<input {{in_array($ticket->id, $question->tickets->lists('id')->toArray()) ? 'checked' : ''}} id="ticket_{{ $ticket->id }}" name="tickets[]" type="checkbox" value="{{ $ticket->id }}">
|
||||
<label for="ticket_{{ $ticket->id }}"> {{ $ticket->title }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- /end modal body-->
|
||||
<div class="modal-footer">
|
||||
<a href="" class="btn btn-danger" data-dismiss="modal">
|
||||
Close
|
||||
</a>
|
||||
<a class="btn btn-success" href="javascript:void(0);" onclick="submitQuestionForm();">
|
||||
Save Question
|
||||
</a>
|
||||
{!! Form::button('Cancel', ['class'=>"btn modal-close btn-danger",'data-dismiss'=>'modal']) !!}
|
||||
{!! Form::submit('Save Question', ['class'=>"btn btn-success"]) !!}
|
||||
</div>
|
||||
</div><!-- /end modal content-->
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
@foreach($ticket->questions as $question)
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
{!! Form::label("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]", $question->title, ['class' => $question->is_required ? 'required' : '']) !!}
|
||||
{!! Form::label("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", $question->title, ['class' => $question->is_required ? 'required' : '']) !!}
|
||||
|
||||
@if($question->question_type_id == config('attendize.question_textbox_single'))
|
||||
{!! Form::text("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]", null, ['required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
|
||||
{!! Form::text("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", null, ['required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} form-control"]) !!}
|
||||
@elseif($question->question_type_id == config('attendize.question_textbox_multi'))
|
||||
{!! Form::textarea("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]", null, ['required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
|
||||
{!! Form::textarea("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", null, ['rows'=>5, 'required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_question.{$ticket['ticket']['id']}.$i.$question->id form-control"]) !!}
|
||||
@elseif($question->question_type_id == config('attendize.question_dropdown_single'))
|
||||
{!! Form::select("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]",$question->options->lists('name', 'id'), null, ['required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
|
||||
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]",$question->options->lists('name', 'id'), null, ['required' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_question.{$ticket['ticket']['id']}.$i.$question->id form-control"]) !!}
|
||||
@elseif($question->question_type_id == config('attendize.question_dropdown_multi'))
|
||||
{!! Form::select("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]",$question->options->lists('name', 'id'), null, ['required' => $question->is_required ? 'required' : '', 'multiple' => 'multiple','class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
|
||||
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]",$question->options->lists('name', 'id'), null, ['required' => $question->is_required ? 'required' : '', 'multiple' => 'multiple','class' => "ticket_holder_question.{$ticket['ticket']['id']}.$i.$question->id form-control"]) !!}
|
||||
@elseif($question->question_type_id == config('attendize.question_checkbox_multi'))
|
||||
<br>
|
||||
@foreach($question->options as $option)
|
||||
{{$option->name}}
|
||||
{!! Form::checkbox("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]",$option->name) !!}<br>
|
||||
{!! Form::checkbox("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]",$option->name) !!}<br>
|
||||
@endforeach
|
||||
@elseif($question->question_type_id == config('attendize.question_radio_single'))
|
||||
<br>
|
||||
@foreach($question->options as $option)
|
||||
{{$option->name}}
|
||||
{!! Form::radio("ticket_holder_questions[{$i}][{$ticket['ticket']['id']}][$question->id]",$option->name) !!}<br>
|
||||
{!! Form::radio("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]",$option->name) !!}<br>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@
|
|||
<div class="col-md-12">
|
||||
<div class="ticket_holders_details" >
|
||||
<h3>Ticket Holder Information</h3>
|
||||
<?php
|
||||
$total_attendee_increment = 0;
|
||||
?>
|
||||
@foreach($tickets as $ticket)
|
||||
@for($i=0; $i<=$ticket['qty']-1; $i++)
|
||||
<div class="panel panel-primary">
|
||||
|
|
@ -117,11 +120,12 @@
|
|||
{!! Form::text("ticket_holder_email[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
|
||||
</div>
|
||||
</div>
|
||||
@include('Public.ViewEvent.Partials.AttendeeQuestions', ['ticket' => $ticket['ticket'],'attendee_number' => $i])
|
||||
@include('Public.ViewEvent.Partials.AttendeeQuestions', ['ticket' => $ticket['ticket'],'attendee_number' => $total_attendee_increment++])
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endfor
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue