seat selection completed

This commit is contained in:
merdiano 2019-11-05 17:28:51 +05:00
parent 459203bc7f
commit 30d273e604
18 changed files with 378 additions and 153 deletions

View File

@ -73,3 +73,10 @@ if(!function_exists('organisers')){
return \Illuminate\Support\Facades\Auth::user()->account->organisers;
}
}
if(!function_exists('zanitlananlar')){
function zanitlananlar($ticket){
$reserved = $ticket->reserved->pluck('seat_no')->crossJoin(['reserved']);
$booked = $ticket->booked->pluck('booked','seat_no')->dump();
}
}

View File

@ -36,7 +36,7 @@ class PublicController extends Controller
}
}
if(!empty($date)){
$e_query->whereDate('start_date','>=',Carbon::parse($date));
$e_query->where('start_date','>=',Carbon::parse($date));
}
return $e_query->select('id','title','start_date')

View File

@ -66,22 +66,20 @@ class EventCheckoutController extends Controller
// ]);
// }
$event = Event::with('venue')->findOrFail($event_id);
$tickets = Ticket::with('section')
$tickets = Ticket::with(['section','reserved:seat_no,ticket_id','booked:id,seat_no,ticket_id'])
->where('event_id',$event_id)
->where('ticket_date',$request->get('ticket_date'))
->where('is_hidden', false)
// ->where('is_paused', false)
// ->whereDate('start_sale_date','=<',Carbon::now())
->orderBy('sort_order','asc')
->get();
if($tickets->count()>0){
return view('Bilettm.ViewEvent.SeatsPage',compact('event','tickets'));
}
else{
//dd($tickets->first()->booked->pluck('seat_no')->toJson());
if($tickets->count()==0){
//todo flash message
session()->flash('error','There is no tickets available');
return redirect()->back();
}
return view('Bilettm.ViewEvent.SeatsPage',compact('event','tickets'));
}
/**
* Validate a ticket request. If successful reserve the tickets and redirect to checkout
@ -90,12 +88,183 @@ class EventCheckoutController extends Controller
* @param $event_id
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
public function postValidateTickets(Request $request, $event_id)
{
if (!$request->has('tickets')) {
public function postValidateSeats(Request $request, $event_id){
if (!$request->has('seats')) {
return response()->json([
'status' => 'error',
'message' => 'No tickets selected',
'message' => 'No seats selected',
]);
}
/*
* Order expires after X min
*/
$order_expires_time = Carbon::now()->addMinutes(config('attendize.checkout_timeout_after'));
$event = Event::findOrFail($event_id);
$seats = $request->get('seats');
/*
* Remove any tickets the user has reserved
*/
ReservedTickets::where('session_id', '=', session()->getId())->delete();
/*
* Go though the selected tickets and check if they're available
* , tot up the price and reserve them to prevent over selling.
*/
$quantity_available_validation_rules = [];
$order_total = 0;
$booking_fee = 0;
$organiser_booking_fee = 0;
$total_ticket_quantity = 0;
$reserved = [];
$tickets = [];
$validation_rules = [];
$validation_messages = [];
foreach ($seats as $ticket_id=>$ticket_seats){
$seats_count = count($ticket_seats);
if($seats_count<1)
continue;
$seat_nos = array_values($ticket_seats);
$reserved_tickets = ReservedTickets::where('ticket_id',$ticket_id)
->where('expires','>',Carbon::now())
->whereIn('seat_no',$seat_nos)
->pluck('seat_no');
$booked_tickets = Attendee::where('ticket_id',$ticket_id)
->where('event_id',$event_id)
->whereIn('seat_no',$seat_nos)
->pluck('seat_no');
if(count($reserved_tickets)>0 || count($booked_tickets)>0)
return response()->json([
'status' => 'error',
'messages' => 'Some of selected seats are already reserved',//todo show which are reserved
]);
$ticket = Ticket::findOrFail($ticket_id);
$max_per_person = min($ticket->quantity_remaining, $ticket->max_per_person);
/*
* Validation max min ticket count
*/
if($seats_count < $ticket->min_per_person){
$message = 'You must select at least ' . $ticket->min_per_person . ' tickets.';
}elseif ($seats_count > $max_per_person){
$message = 'The maximum number of tickets you can register is ' . $ticket->quantity_remaining;
}
if (isset($message)) {
return response()->json([
'status' => 'error',
'messages' => $message,
]);
}
$total_ticket_quantity += $seats_count;
$order_total += ($seats_count * $ticket->price);
$booking_fee += ($seats_count * $ticket->booking_fee);
$organiser_booking_fee += ($seats_count * $ticket->organiser_booking_fee);
$tickets[] = [
'ticket' => $ticket,
'qty' => $seats_count,
'seats' => $ticket_seats,
'price' => ($seats_count * $ticket->price),
'booking_fee' => ($seats_count * $ticket->booking_fee),
'organiser_booking_fee' => ($seats_count * $ticket->organiser_booking_fee),
'full_price' => $ticket->price + $ticket->total_booking_fee,
];
foreach ($ticket_seats as $seat_no){
$reservedTickets = new ReservedTickets();
$reservedTickets->ticket_id = $ticket_id;
$reservedTickets->event_id = $event_id;
$reservedTickets->quantity_reserved = 1;
$reservedTickets->expires = $order_expires_time;
$reservedTickets->session_id = session()->getId();
$reservedTickets->seat_no = $seat_no;
$reserved[] = $reservedTickets->attributesToArray();
/*
* Create our validation rules here
*/
$validation_rules['ticket_holder_first_name.' . $seat_no . '.' . $ticket_id] = ['required'];
$validation_rules['ticket_holder_last_name.' . $seat_no . '.' . $ticket_id] = ['required'];
$validation_rules['ticket_holder_email.' . $seat_no . '.' . $ticket_id] = ['required', 'email'];
$validation_messages['ticket_holder_first_name.' . $seat_no . '.' . $ticket_id . '.required'] = 'Ticket holder ' . $seat_no . '\'s first name is required';
$validation_messages['ticket_holder_last_name.' . $seat_no . '.' . $ticket_id . '.required'] = 'Ticket holder ' . $seat_no . '\'s last name is required';
$validation_messages['ticket_holder_email.' . $seat_no . '.' . $ticket_id . '.required'] = 'Ticket holder ' . $seat_no . '\'s email is required';
$validation_messages['ticket_holder_email.' . $seat_no . '.' . $ticket_id . '.email'] = 'Ticket holder ' . $seat_no . '\'s email appears to be invalid';
/*
* Validation rules for custom questions
*/
foreach ($ticket->questions as $question) {
if ($question->is_required && $question->is_enabled) {
$validation_rules['ticket_holder_questions.' . $ticket_id . '.' . $seat_no . '.' . $question->id] = ['required'];
$validation_messages['ticket_holder_questions.' . $ticket_id . '.' . $seat_no . '.' . $question->id . '.required'] = "This question is required";
}
}
}
}
ReservedTickets::insert($reserved);
if (empty($tickets)) {
return response()->json([
'status' => 'error',
'message' => 'No tickets selected.',
]);
}
/*
* The 'ticket_order_{event_id}' session stores everything we need to complete the transaction.
*/
session()->put('ticket_order_' . $event->id, [
'validation_rules' => $validation_rules,
'validation_messages' => $validation_messages,
'event_id' => $event->id,
'tickets' => $tickets,
'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' => $activeAccountPaymentGateway,
// 'payment_gateway' => $paymentGateway
]);
/*
* If we're this far assume everything is OK and redirect them
* to the the checkout page.
*/
if ($request->ajax()) {
return response()->json([
'status' => 'success',
'redirectUrl' => route('showEventCheckout', [
'event_id' => $event_id,
'is_embedded' => $this->is_embedded,
]) . '#order_form',
]);
}
/*
* todo Maybe display something prettier than this?
*/
exit('Please enable Javascript in your browser.');
}
public function postValidateTickets(Request $request, $event_id)
{
if (!$request->has('seats')) {
return response()->json([
'status' => 'error',
'message' => 'No seats selected',
]);
}
/*
@ -291,7 +460,7 @@ class EventCheckoutController extends Controller
$secondsToExpire = Carbon::now()->diffInSeconds($order_session['expires']);
$event = Event::findorFail($order_session['event_id']);
$event = Event::with('venue')->findorFail($order_session['event_id']);
$orderService = new OrderService($order_session['order_total'], $order_session['total_booking_fee'], $event);
$orderService->calculateFinalCosts();
@ -520,19 +689,6 @@ class EventCheckoutController extends Controller
$order->event_id = $ticket_order['event_id'];
$order->is_payment_received = isset($request_data['pay_offline']) ? 0 : 1;
// Business details is selected, we need to save the business details
// if (isset($request_data['is_business']) && (bool)$request_data['is_business']) {
// $order->is_business = $request_data['is_business'];
// $order->business_name = sanitise($request_data['business_name']);
// $order->business_tax_number = sanitise($request_data['business_tax_number']);
// $order->business_address_line_one = sanitise($request_data['business_address_line1']);
// $order->business_address_line_two = sanitise($request_data['business_address_line2']);
// $order->business_address_state_province = sanitise($request_data['business_address_state']);
// $order->business_address_city = sanitise($request_data['business_address_city']);
// $order->business_address_code = sanitise($request_data['business_address_code']);
//
// }
// Calculating grand total including tax
$orderService = new OrderService($ticket_order['order_total'], $ticket_order['total_booking_fee'], $event);
$orderService->calculateFinalCosts();
@ -603,7 +759,7 @@ class EventCheckoutController extends Controller
/*
* Create the attendees
*/
for ($i = 0; $i < $attendee_details['qty']; $i++) {
foreach ($attendee_details['seats'] as $i) {
$attendee = new Attendee();
$attendee->first_name = strip_tags($request_data["ticket_holder_first_name"][$i][$attendee_details['ticket']['id']]);
@ -614,6 +770,7 @@ class EventCheckoutController extends Controller
$attendee->ticket_id = $attendee_details['ticket']['id'];
$attendee->account_id = $event->account->id;
$attendee->reference_index = $attendee_increment;
$attendee->seat_no = $i;
$attendee->save();

View File

@ -33,12 +33,14 @@ class EventViewController extends Controller
return view('Public.ViewEvent.EventNotLivePage');
}
$now =Carbon::now(config('app.timezone'));
$tickets = $event->tickets()->select('id','ticket_date')
->where('is_hidden', false)
->whereDate('ticket_date','>=',Carbon::now(config('app.timezone')))
->where('ticket_date','>=',$now)
->orderBy('ticket_date', 'asc')
->groupBy('ticket_date')
->distinct()->get();
->distinct()
->get();
$ticket_dates = array();
@ -46,14 +48,14 @@ class EventViewController extends Controller
$date = $ticket->ticket_date->format('d M');
$ticket_dates[$date][] = $ticket;
}
// dd($ticket_dates);
$data = [
'event' => $event,
'ticket_dates' =>$ticket_dates,
// 'tickets' => $tickets,//$event->tickets()->orderBy('sort_order', 'asc')->get(),
'is_embedded' => 0,
];
// dd($ticket_dates);
/*
* Don't record stats if we're previewing the event page from the backend or if we own the event.
*/

View File

@ -168,7 +168,7 @@ Route::group(
Route::post('{event_id}/checkout/', [
'as' => 'postValidateTickets',
'uses' => 'EventCheckoutController@postValidateTickets',
'uses' => 'EventCheckoutController@postValidateSeats',
]);
Route::post('{event_id}/checkout/validate', [

View File

@ -112,7 +112,7 @@ class Event extends MyBaseModel
public function starting_ticket(){
return $this->tickets()
->select('id','ticket_date','event_id','price')
->whereDate('ticket_date','>=',Carbon::now(\config('app.timezone')))
->where('ticket_date','>=',Carbon::now(\config('app.timezone')))
->orderBy('ticket_date')
->orderBy('price')
->limit(2); // limit 1 returns null ???
@ -483,10 +483,10 @@ ICSTemplate;
public function scopeOnLive($query, $start_date = null, $end_date = null){
//if date is null carbon creates now date instance
if(isset($start_date) && isset($end_date))
$query->whereDate('start_date','<',$end_date)
->whereDate('end_date','>',$start_date);
$query->where('start_date','<',$end_date)
->where('end_date','>',$start_date);
else
$query->whereDate('end_date','>',Carbon::now(config('app.timezone')));
$query->where('end_date','>',Carbon::now(config('app.timezone')));
return $query->where('is_live',1)
->withCount(['images as image_url' => function($q){

View File

@ -78,11 +78,16 @@ class Ticket extends MyBaseModel
return $this->belongsToMany(\App\Models\Question::class);
}
/**
* TODO:implement the reserved method.
*/
public function reserved()
{
return $this->hasMany(ReservedTickets::class)
->where('expires','>',Carbon::now())
->orderBy('seat_no','asc');
}
public function booked(){
return $this->hasMany(Attendee::class)
->orderBy('seat_no','asc');
}
/**

View File

@ -27,7 +27,8 @@ class AddTicketSectionIdToTicketsTable extends Migration
public function down()
{
Schema::table('tickets', function (Blueprint $table) {
//
$table->dropForeign('section_id');
$table->dropColumn('section_id');
});
}
}

View File

@ -14,8 +14,11 @@ class AddSeatToAttendeesTable extends Migration
public function up()
{
Schema::table('attendees', function (Blueprint $table) {
$table->string('row')->nullable();
$table->string('no')->nullable();
$table->string('seat_no')->nullable();
});
Schema::table('reserved_tickets',function (Blueprint $table){
$table->string('seat_no')->nullable();
});
}
@ -27,8 +30,10 @@ class AddSeatToAttendeesTable extends Migration
public function down()
{
Schema::table('attendees', function (Blueprint $table) {
$table->dropColumn('row');
$table->dropColumn('no');
$table->dropColumn('seat_no');
});
Schema::table('reserved_tickets',function (Blueprint $table){
$table->dropColumn('seat_no');
});
}
}

View File

@ -4800,7 +4800,7 @@ function processFormErrors($form, errors)
var $input = $(selector, $form);
if ($input.prop('type') === 'file') {
$('#input-' + $input.prop('name')).append('<div class="help-block error">' + error + '</div>')
$('#input-' + $input.prop('name')).append('<div class="help-block text-danger">' + error + '</div>')
.parent()
.addClass('has-error');
} else {
@ -4808,7 +4808,7 @@ function processFormErrors($form, errors)
$input = $input.parent();
}
$input.after('<div class="help-block error">' + error + '</div>')
$input.after('<div class="help-block text-danger">' + error + '</div>')
.parent()
.addClass('has-error');
}

View File

@ -1101,7 +1101,7 @@ video.kinoteatr-video-tag[poster] {
@media only screen and (max-width: 1440px) {
.time-and-form .form-group.d-block input {
font-size: 15px; } }
.time-and-form input[type=checkbox]:checked ~ label > span {
.time-and-form input[type=radio]:checked ~ label > span {
background-image: url(../images/icons/red-time-ramka.svg) !important;
color: #ffffff !important; }
@ -1215,7 +1215,7 @@ a:hover {
background-size: 100%;
background-repeat: no-repeat;
font-size: 18px; }
.time-box-wrap input[type=checkbox]:checked ~ label span {
.time-box-wrap input[type=radio]:checked ~ label span {
background-image: url(../images/icons/red-time-ramka.svg) !important;
color: #ffffff !important; }
@ -1446,7 +1446,7 @@ a:hover {
color: #000000;
border: 1px solid #000000;
border-radius: 5px;
font-size: 24px;
font-size: 13px;
padding: 15px 50px; }
#choose_seats li a.active.show {
color: #ffffff;
@ -1473,6 +1473,10 @@ tr.ver-space {
#seats-form input:checked ~ label svg {
fill: #d43d34; }
#seats-form input:checked ~ label span {
color: #ffffff;
}
input.booked-seats ~ label svg {
fill: #6a687e; }
@ -1950,4 +1954,25 @@ input.reserved-seats ~ label svg {
.tickets_table_wrap tr.checkout input[type=submit]:focus{
box-shadow: none !important;
}
input[type=checkbox].input-reserved ~ label svg{
fill: #b6b6b6;
}
input[type=checkbox].input-booked ~ label svg{
fill: #69687d;
}
choose_seats_content > div.tab-pane.fade{
display: none !important;
}
#choose_seats_content div.tab-pane.fade.active.show{
display: block !important;
}
#confirm-seats{
background-color: #d43d34;
color: #ffffff;
}

View File

@ -11,41 +11,6 @@
{!!HTML::script(config('attendize.cdn_url_static_assets').'/assets/javascript/frontend.js')!!}
<script>
var OrderExpires = {{strtotime($expires)}};
$('#mirror_buyer_info').on('click', function(e) {
$('.ticket_holder_first_name').val($('#order_first_name').val());
$('.ticket_holder_last_name').val($('#order_last_name').val());
$('.ticket_holder_email').val($('#order_email').val());
});
function setCountdown($element, seconds) {
var endTime, mins, msLeft, time, twoMinWarningShown = false;
function twoDigits(n) {
return (n <= 9 ? "0" + n : n);
}
function updateTimer() {
msLeft = endTime - (+new Date);
if (msLeft < 1000) {
alert(lang("time_run_out"));
location.reload();
} else {
if (msLeft < 120000 && !twoMinWarningShown) {
showMessage(lang("just_2_minutes"));
twoMinWarningShown = true;
}
time = new Date(msLeft);
mins = time.getUTCMinutes();
$element.html('<b>' + mins + ':' + twoDigits(time.getUTCSeconds()) + '</b>');
setTimeout(updateTimer, time.getUTCMilliseconds() + 500);
}
}
endTime = (+new Date) + 1000 * seconds + 500;
updateTimer();
}
</script>
@if(isset($secondsToExpire))
<script>if($('#countdown')) {setCountdown($('#countdown'), {{$secondsToExpire}});}</script>

View File

@ -50,34 +50,35 @@
$total_attendee_increment = 0;
?>
@foreach($tickets as $ticket)
@for($i=0; $i<=$ticket['qty']-1; $i++)
@foreach($ticket['seats'] as $seat)
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">
<b>{{$ticket['ticket']['title']}}</b>: @lang("Public_ViewEvent.ticket_holder_n", ["n"=>$i+1])
<b>{{$ticket['ticket']['title']}}</b>: @lang("Public_ViewEvent.ticket_holder_n", ["n"=>$seat])
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
{!! Form::label("ticket_holder_first_name[{$i}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.first_name")) !!}
{!! Form::text("ticket_holder_first_name[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_first_name.$i.{$ticket['ticket']['id']} ticket_holder_first_name form-control"]) !!}
{!! Form::label("ticket_holder_first_name[{$seat}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.first_name")) !!}
{!! Form::text("ticket_holder_first_name[{$seat}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_first_name.$seat.{$ticket['ticket']['id']} ticket_holder_first_name form-control"]) !!}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{!! Form::label("ticket_holder_last_name[{$i}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.last_name")) !!}
{!! Form::text("ticket_holder_last_name[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_last_name.$i.{$ticket['ticket']['id']} ticket_holder_last_name form-control"]) !!}
{!! Form::label("ticket_holder_last_name[{$seat}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.last_name")) !!}
{!! Form::text("ticket_holder_last_name[{$seat}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_last_name.$seat.{$ticket['ticket']['id']} ticket_holder_last_name form-control"]) !!}
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
{!! Form::label("ticket_holder_email[{$i}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.email_address")) !!}
{!! 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"]) !!}
{!! Form::label("ticket_holder_email[{$seat}][{$ticket['ticket']['id']}]", trans("Public_ViewEvent.email_address")) !!}
{!! Form::text("ticket_holder_email[{$seat}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_email.$seat.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
</div>
</div>
@include('Public.ViewEvent.Partials.AttendeeQuestions', ['ticket' => $ticket['ticket'],'attendee_number' => $total_attendee_increment++])
@ -88,7 +89,7 @@
</div>
@endfor
@endforeach
@endforeach
</div>
</div>

View File

@ -27,7 +27,7 @@
</span>
@lang("Public_ViewEvent.at")
<span property="location" typeof="Place">
<b property="name">{{$event->venue_name}}</b>
<b property="name">{{$event->venue->venue_name}}</b>
<meta property="address" content="{{ urldecode($event->venue_name) }}">
</span>
</div>

View File

@ -21,7 +21,7 @@
</ul>
</div>
<h4 class="time-small-title">Время проведения</h4>
<div class="time-box-wraper col-md-6">
<div class="time-box-wraper col-md-6" style="padding-left: 5px">
<div class="tab-content" id="myTabContent">
{!! Form::open(['url' => route('postValidateDate', ['event_id' => $event->id])]) !!}
@ -49,6 +49,11 @@
@endif
@push('after_scripts')
<script>
$(document).ready(function(){
$(".nav-pills.details-page .tablinks:first-child").click();
});
function openContent(evt, cityName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
@ -59,8 +64,17 @@
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
tablinks[0].className += " active";
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " active";
}
$(document).ready(function () {
$(".time-box-wrap input[type=radio]").css('display', 'none');
$(".time-box-wrap input[type=radio]:checked").css('background-image', '');
$("input.btn-danger").css('background-color', '#d43d34');
$("input.btn-danger").css('margin-top', '20px');
});
</script>
@endpush

View File

@ -1,33 +0,0 @@
@foreach($tickets as $ticket)
<div id="home_{{$ticket->id}}" class="tab-pane fade active show in" role="tabpanel" style="display: unset !important;">
<div class="row justify-content-center">
<img class="img-responsive" src="{{asset('user_content/'.$ticket->section->section_image)}}" alt="{{$ticket->section->section_no}}">
</div>
<div class="standard-box" style="position: relative; padding: 20px 0">
<h5 style="font-weight: bold; font-size: 24px; margin-bottom: 20px; text-align: center">{{$ticket->title }} {{$ticket->description}} {{$ticket->section->section_no}}</h5>
<table style="text-align: center; margin: auto">
<tbody>
@foreach($ticket->section->seats as $row)
<tr>
<td>{{$row['row']}}</td>
<td></td>
<td></td>
@for($i = $row['start_no'];$i<=$row['end_no'];$i++)
<td>
<input type="checkbox" id="seata25" name="seata25" class="seat_check">
<label for="seata{{$i}}">
{{$i}}
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="25" viewBox="0 0 26 25">
<path id="Rectangle_3" data-name="Rectangle 3" d="M8,0H18a8,8,0,0,1,8,8V25a0,0,0,0,1,0,0H0a0,0,0,0,1,0,0V8A8,8,0,0,1,8,0Z"></path>
</svg>
</label>
</td>
@endfor
<td></td>
</tr>
@endforeach
</tbody></table>
<div class="seats-top-overlay" style="width: 70%"></div>
</div>
</div>
@endforeach

View File

@ -20,11 +20,11 @@
</li>
@endforeach
</ul>
<div class="d-flex justify-content-center mt-5 mb-4">
<span class="mx-3" style="font-size: 18px"><i class="fa fa-circle" style="color: #ebeced; font-size: 13px"></i> Available</span>
<span class="mx-3" style="font-size: 18px"><i class="fa fa-circle" style="color: #69687d; font-size: 13px"></i> Booked</span>
<span class="mx-3" style="font-size: 18px"><i class="fa fa-circle" style="color: #b6b6b6; font-size: 13px"></i> Reserved</span>
<span class="mx-3" style="font-size: 18px"><i class="fa fa-circle" style="color: #ff4159; font-size: 13px"></i> Your Selection</span>
<div class="d-flex justify-content-center mt-5 mb-4" style="width: 70%; margin: auto">
<span class="mx-3 text-center" style="font-size: 18px"><i class="fa fa-circle" style="color: #ebeced; font-size: 13px"></i> Available</span>
<span class="mx-3 text-center" style="font-size: 18px"><i class="fa fa-circle" style="color: #69687d; font-size: 13px"></i> Booked</span>
<span class="mx-3 text-center" style="font-size: 18px"><i class="fa fa-circle" style="color: #b6b6b6; font-size: 13px"></i> Reserved</span>
<span class="mx-3 text-center" style="font-size: 18px"><i class="fa fa-circle" style="color: #ff4159; font-size: 13px"></i> Your Selection</span>
</div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width: 100%" height="137.997" viewBox="0 0 1120 137.997">
<defs>
@ -40,23 +40,60 @@
</g>
</g>
</svg>
<form id="seats-form" class="ajax" action="{{route('postValidateTickets',['event_id'=>$event->id])}}" method="post">
@csrf
<div class="tab-content" id="choose_seats_content">
@include('Bilettm.ViewEvent.Partials.Seats')
@foreach($tickets as $ticket)
<div id="home_{{$ticket->id}}" class="tab-pane fade active show in " role="tabpanel">
<div class="row justify-content-center">
<img onload="disable_rb('{{$ticket->id}}',{{$ticket->reserved->pluck('seat_no')->toJson()}},{{$ticket->booked->pluck('seat_no')->toJson()}})"
class="img-responsive" alt="{{$event->venue->venue_name}} - {{$ticket->section->section_no}}"
src="{{asset('user_content/'.$ticket->section->section_image)}}" >
</div>
<div class="standard-box" style="position: relative; padding: 20px 0">
<h5 style="font-weight: bold; font-size: 24px; margin-bottom: 20px; text-align: center">{{$ticket->title }} {{$ticket->description}} {{$ticket->section->section_no}}</h5>
<table style="text-align: center; margin: auto" >
<tbody id="{{$ticket->id}}">
@foreach($ticket->section->seats as $row)
<tr>
<td>{{$row['row']}}</td>
<td></td>
<td></td>
@for($i = $row['start_no'];$i<=$row['end_no'];$i++)
<td>
<input type="checkbox" class="seat_check"
id="seat{{$ticket->id.'-'.$row['row'].'-'.$i}}"
name="seats[{{$ticket->id}}][]"
value="{{$row['row'].'-'.$i}}"
data-num="{{$ticket->price}}">
<label for="seat{{$ticket->id.'-'.$row['row'].$i}}">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="25" viewBox="0 0 26 25">
<path id="Rectangle_3" data-name="Rectangle 3" d="M8,0H18a8,8,0,0,1,8,8V25a0,0,0,0,1,0,0H0a0,0,0,0,1,0,0V8A8,8,0,0,1,8,0Z"></path>
</svg>
<span style="position:relative;right: 55%">{{$i}}</span>
</label>
</td>
@endfor
<td></td>
</tr>
@endforeach
</tbody></table>
<!--<div class="seats-top-overlay" style="width: 70%"></div>-->
</div>
</div>
<script>
{{--var disable_list ={{zanitlananlar($ticket)}}--}}
</script>
@endforeach
</div>
<div class="checked-seats" style="padding: 30px 0; text-align: center">
<h5 style="text-align: center; font-weight: bold;">You Have Selected <span>4</span> Seats</h5>
<h5 style="text-align: center;">Your Seats:</h5>
<form action="{{route('postValidateTickets',['event_id'=>$event->id])}}" method="post">
@csrf
<h5 class="text-center font-weight-bold">You Have Selected <span id="total_seats">0</span> seats. Total cost <span id="total_cost">0</span> man.</h5>
<h5 class="text-center">Your Seats:</h5>
<div class="your-selected-seats" style="text-align: center; margin-bottom: 50px">
<span>G-12</span>
<span>G-13</span>
<span>G-14</span>
<span>G-15</span>
</div>
<a id="confirm-seats">Confirm seats</a>
</form>
{!!Form::submit('Confirm seats', ['id' => 'confirm-seats'])!!}
</div>
</form>
</div>
</div>
</div>
@ -65,6 +102,45 @@
</section>
@endsection
@section('after_scripts')
<script>
$(':checkbox').change(function() {
if(this.checked) {
var ticket = "<span aria-label='"+this.id+"'>"+this.value+"</span>"
$('.your-selected-seats').append(ticket);
}
else{
$('.your-selected-seats').find("[aria-label='"+this.id+"']").remove();
}
var numberOfChecked = $('input:checkbox:checked').length;
var total_cost =0;
$('input:checkbox:checked').each(function(index, elem) {
total_cost += parseFloat($(elem).attr('data-num'));
});
$('#total_seats').html(numberOfChecked);
$('#total_cost').html(total_cost.toFixed(2));
});
$(document).ready(function () {
$("input[type=checkbox].input-booked").attr("disabled", true);
$("input[type=checkbox].input-reserved").attr("disabled", true);
});
function disable_rb(table_id, reserved,booked) {
//alert(reserved[0]);
if(booked.length>0){
//alert('alert')
for(booked)
$('tbody#'+table_id+':input[type=checkbox]').find();
}
if(reserved.left>0){
}
}
</script>
@include("Shared.Partials.LangScript")
{!!HTML::script(config('attendize.cdn_url_static_assets').'/assets/javascript/frontend.js')!!}
@endsection

View File

@ -1,24 +1,24 @@
@foreach($ticket->questions->where('is_enabled', 1)->sortBy('sort_order') as $question)
<div class="col-md-12">
<div class="form-group">
{!! Form::label("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", $question->title, ['class' => $question->is_required ? 'required' : '']) !!}
{!! Form::label("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id]", $question->title, ['class' => $question->is_required ? 'required' : '']) !!}
@if($question->question_type_id == config('attendize.question_textbox_single'))
{!! Form::text("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} form-control"]) !!}
{!! Form::text("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id]", null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} form-control"]) !!}
@elseif($question->question_type_id == config('attendize.question_textbox_multi'))
{!! Form::textarea("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", null, ['rows'=>5, $question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} form-control"]) !!}
{!! Form::textarea("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id]", null, ['rows'=>5, $question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} form-control"]) !!}
@elseif($question->question_type_id == config('attendize.question_dropdown_single'))
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]", array_merge(['' => '-- Please Select --'], $question->options->pluck('name', 'name')->toArray()), null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} form-control"]) !!}
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id]", array_merge(['' => '-- Please Select --'], $question->options->pluck('name', 'name')->toArray()), null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} form-control"]) !!}
@elseif($question->question_type_id == config('attendize.question_dropdown_multi'))
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$i}][$question->id][]",$question->options->pluck('name', 'name'), null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'multiple' => 'multiple','class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} form-control"]) !!}
{!! Form::select("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id][]",$question->options->pluck('name', 'name'), null, [$question->is_required ? 'required' : '' => $question->is_required ? 'required' : '', 'multiple' => 'multiple','class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} form-control"]) !!}
@elseif($question->question_type_id == config('attendize.question_checkbox_multi'))
<br>
@foreach($question->options as $option)
<?php
$checkbox_id = md5($ticket->id.$i.$question->id.$option->name);
$checkbox_id = md5($ticket->id.$seat.$question->id.$option->name);
?>
<div class="custom-checkbox">
{!! Form::checkbox("ticket_holder_questions[{$ticket->id}][{$i}][$question->id][]",$option->name, false,['class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} ", 'id' => $checkbox_id]) !!}
{!! Form::checkbox("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id][]",$option->name, false,['class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} ", 'id' => $checkbox_id]) !!}
<label for="{{ $checkbox_id }}">{{$option->name}}</label>
</div>
@endforeach
@ -26,10 +26,10 @@
<br>
@foreach($question->options as $option)
<?php
$radio_id = md5($ticket->id.$i.$question->id.$option->name);
$radio_id = md5($ticket->id.$seat.$question->id.$option->name);
?>
<div class="custom-radio">
{!! Form::radio("ticket_holder_questions[{$ticket->id}][{$i}][$question->id]",$option->name, false, ['id' => $radio_id, 'class' => "ticket_holder_questions.{$ticket->id}.{$i}.{$question->id} "]) !!}
{!! Form::radio("ticket_holder_questions[{$ticket->id}][{$seat}][$question->id]",$option->name, false, ['id' => $radio_id, 'class' => "ticket_holder_questions.{$ticket->id}.{$seat}.{$question->id} "]) !!}
<label for="{{ $radio_id }}">{{$option->name}}</label>
</div>
@endforeach