Skip to content

Commit f57cae6

Browse files
committed
Updates and tweaks to functionality
1 parent 4bb079e commit f57cae6

File tree

7 files changed

+44
-14
lines changed

7 files changed

+44
-14
lines changed

app/Http/Controllers/Admin/SeatingPlanController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ protected function updateObject(SeatingPlan $plan, Request $request)
3535
{
3636
$plan->name = $request->input('name');
3737
$plan->image_url = $request->input('image_url');
38-
$plan->image_height = getimagesize($request->input('image_url'))[1];
39-
$plan->image_width = getimagesize($request->input('image_url'))[0];
38+
$imageSizeArr = getimagesize($request->input('image_url'));
39+
if($imageSizeArr) {
40+
$plan->image_height = $imageSizeArr[1];
41+
$plan->image_width = $imageSizeArr[0];
42+
}
4043
$plan->scale = $request->input('scale') ? $request->input('scale') : 100;
4144
$plan->save();
4245
}

app/Http/Controllers/SeatingPlanController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function show(Request $request, Event $event, ?Ticket $ticket = null)
101101

102102
$seatGroups = [];
103103
foreach ($event->seatGroups as $seatGroup) {
104-
if($request->user()->allowedSeatGroup($seatGroup)) {
104+
if ($currentTicket->user->allowedSeatGroup($seatGroup)) {
105105
array_push($seatGroups, $seatGroup->id);
106106
}
107107
}
@@ -148,7 +148,7 @@ public function select(Request $request, Event $event, Ticket $ticket, Seat $sea
148148
return response()->redirectToRoute('seatingplans.show', $event->code)->with('errorMessage', 'You cannot pick a seat for this ticket')->withFragment("tab-plan-{$seat->plan->code}");
149149
}
150150

151-
if (!$seat->canPick($request->user())) {
151+
if (!$seat->canPick($ticket->user)) {
152152
return response()->redirectToRoute('seatingplans.show', [$event->code, $ticket->id])->with('errorMessage', "That seat is not available")->withFragment("tab-plan-{$seat->plan->code}");
153153
}
154154

app/Models/SeatingPlan.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public function import(string $csv, bool $wipe = false): void
172172
$seat->label = $row[5];
173173
$seat->description = $row[6] ?? null;
174174
$seat->class = $row[7] ?? null;
175+
$seat->seat_group_id = (int)$row[8] ?? null;
175176
$seat->disabled = (bool)$row[8];
176177

177178
$seat->saveQuietly();

database/migrations/2024_09_04_154938_add_scale_and_sizing_to_seating_plans.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ public function up(): void
2121
foreach (SeatingPlan::all() as $plan) {
2222
if ($plan->image_url)
2323
{
24-
$plan->image_height = getimagesize($plan->image_url)[1];
25-
$plan->image_width = getimagesize($plan->image_url)[0];
26-
$plan->save();
24+
$imageSizeArr = getimagesize($plan->image_url);
25+
if($imageSizeArr) {
26+
$plan->image_height = $imageSizeArr[1];
27+
$plan->image_width = $imageSizeArr[0];
28+
$plan->save();
29+
}
2730
}
2831
}
2932
}

resources/views/admin/seatgroups/show.blade.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,27 @@ class="btn btn-primary d-inline-block">
9696
@forelse($group->assignments as $assignment)
9797
<tr>
9898
<td class="text-muted">{{ $assignment->id }}</td>
99-
<td>{{ $assignment->assignment_type }}</td>
100-
<td>{{ $assignment->assignment_type_id }}</td>
99+
<td>{{ ucwords(str_replace('_', ' ', $assignment->assignment_type)) }}</td>
100+
<td>
101+
@switch($assignment->assignment_type)
102+
@case('user')
103+
<a href="{{ route('admin.users.show', $assignment->assignment_type_id) }}">
104+
{{ \App\Models\User::find($assignment->assignment_type_id)->nickname }}
105+
</a>
106+
@break
107+
@case('clan')
108+
@php($clan = \App\Models\Clan::find($assignment->assignment_type_id))
109+
<a href="{{ route('admin.clans.show', $clan->code) }}">
110+
{{ $clan->name }}
111+
</a>
112+
@break
113+
@case('ticket_type')
114+
<a href="{{ route('admin.events.tickettypes.show', [$assignment->group->event->code, $assignment->assignment_type_id]) }}">
115+
{{ \App\Models\TicketType::find($assignment->assignment_type_id)->name }}
116+
</a>
117+
@break
118+
@endswitch
119+
</td>
101120

102121
<td class="btn-list">
103122
<a class="btn btn-outline-primary ms-auto"

resources/views/admin/seatingplans/import.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class="card" enctype="multipart/form-data">
2626
optional header row. If it is detected, it will be ignored.
2727
</p>
2828
<p>An example format would be:</p>
29-
<pre><code>ID,X,Y,Row,Number,Label,Description,CSS Class,Disabled
30-
1,2,22,A,1,A1,,,0
31-
2,3,22,A,2,A2,,,0
32-
3,4,22,A,3,A3,,,0
29+
<pre><code>ID,X,Y,Row,Number,Label,Description,CSS Class,Seat Group ID,Disabled
30+
1,2,22,A,1,A1,,1,0
31+
2,3,22,A,2,A2,,2,0
32+
3,4,22,A,3,A3,,,1
3333
4,5,22,A,4,A4,,,0</code></pre>
3434
<p>
3535
If the ID field is included for a seat, then an existing seat with that ID in the plan will be

resources/views/admin/seats/show.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474
</div>
7575
<div class="datagrid-item">
7676
<div class="datagrid-title">Seat Group</div>
77-
<div class="datagrid-content">{{ $seat->group ? $seat->group->id : '' }}</div>
77+
@if ($seat->group)
78+
<div class="datagrid-content"><a href="{{ route('admin.events.seatgroups.show', [$seat->plan->event->code, $seat->group->id]) }}">{{ $seat->group->id }}</a></div>
79+
@else
80+
<span class="text-muted">None</span>
81+
@endif
7882
</div>
7983
</div>
8084
</div>

0 commit comments

Comments
 (0)