Skip to content

Commit

Permalink
🐛 fix wrong checkin end in event suggestions backend (#2299)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu authored Jan 29, 2024
1 parent 37bee80 commit ca2ad40
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
1 change: 0 additions & 1 deletion app/Http/Controllers/Frontend/Admin/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function renderSuggestions(): View {
return view('admin.events.suggestions', [
'suggestions' => EventSuggestion::where('processed', false)
->where('end', '>', DB::raw('CURRENT_TIMESTAMP'))
->where('user_id', '!=', auth()->user()->id) //moderator can't accept their own suggestions
->orderBy('begin')
->get()
]);
Expand Down
46 changes: 23 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions resources/views/admin/events/suggestion-create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class="form-control" placeholder="{{ __('stationboard.station-placeholder') }}"
<div class="col-6">
<div class="form-floating">
<input id="begin" type="datetime-local" class="form-control" name="begin"
value="{{ $event->begin->toDateTimeLocalString() }}"
value="{{ $event->begin->startOfDay()->toDateTimeLocalString() }}"
required
/>
<label for="begin">Checkin {{ __('events.begin') }}:</label>
Expand All @@ -84,7 +84,7 @@ class="form-control" placeholder="{{ __('stationboard.station-placeholder') }}"
<div class="col-6">
<div class="form-floating">
<input id="end" type="datetime-local" class="form-control" name="end"
value="{{ $event->begin->toDateTimeLocalString() }}"
value="{{ $event->end->endOfDay()->toDateTimeLocalString() }}"
required
/>
<label for="end">Checkin {{ __('events.end') }}:</label>
Expand Down
21 changes: 17 additions & 4 deletions resources/views/admin/events/suggestions.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@php use App\Enum\EventRejectionReason; @endphp
@php use Illuminate\Support\Facades\Date; @endphp
@extends('admin.layout')

@section('title', 'Veranstaltungsvorschläge')
@section('title', 'Event suggestions')

@section('content')
<div class="card">
<div class="card-body">
@if($suggestions->count() == 0)
<p class="font-weight-bold text-danger">Es sind aktuell keine Vorschläge vorhanden. :(</p>
@if($suggestions->count() === 0)
<p class="font-weight-bold text-danger">
Nothing to do here! 🎉
</p>
@else
<table class="table">
<thead>
Expand All @@ -26,6 +27,10 @@
</thead>
<tbody>
@foreach($suggestions as $event)
@if($event->user->id === auth()->id() && !auth()->user()->hasRole('admin'))
@continue
@endif

<tr class="{{$event->begin->isPast() ? 'table-danger' : ''}}">
<td>{{$event->name}}</td>
<td>{{$event->host}}</td>
Expand Down Expand Up @@ -70,5 +75,13 @@
</table>
@endif
</div>
@if(!auth()->user()->hasRole('admin'))
<div class="card-footer">
<small>
You cannot see your own suggestions.
They are only visible to other event moderators and admins.
</small>
</div>
@endif
</div>
@endsection

0 comments on commit ca2ad40

Please sign in to comment.