🏡 index : ~doyle/zpan.git

author Jordan Doyle <jordan@doyle.wf> 2016-06-19 16:03:45.0 +01:00:00
committer Jordan Doyle <jordan@doyle.wf> 2016-06-19 16:03:45.0 +01:00:00
commit
b0a1df09d56c70bf394127f92bca8af2034e7707 [patch]
tree
0191010d220c64cbe61bfd8bad5dadeb4d3d6455
parent
fafd800bafa92d7e2938babd69b2b914e1262bd3
download
b0a1df09d56c70bf394127f92bca8af2034e7707.tar.gz

Fix the events timetable



Diff

 resources/views/dj/timetable.blade.php             | 8 +++++---
 resources/views/events/timetable.blade.php         | 6 +++---
 app/Http/Controllers/DJ/TimetableController.php    | 6 +++++-
 app/Http/Controllers/Event/TimetableController.php | 1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/resources/views/dj/timetable.blade.php b/resources/views/dj/timetable.blade.php
index c8034b0..b5f759d 100644
--- a/resources/views/dj/timetable.blade.php
+++ a/resources/views/dj/timetable.blade.php
@@ -21,19 +21,19 @@
                            @for ($i = 0; $i < 24; $i++)
                                <li>
                                    {{ sprintf('%02d', $i) }}:00 -
                                    @if(!isset($day[$i]) || ($day[$i] === auth()->user()->username || auth()->user()->isAdmin()))
                                    @if(empty($day[$i]) || ($day[$i]['id'] === auth()->user()->userid || auth()->user()->isAdmin()))
                                        <form action="{{ route('dashboard::dj::timetable.book') }}" method="post"
                                              class="a-submit" style="display: inline">
                                            {{ method_field(isset($day[$i]) ? 'delete' : 'put') }}
                                            {{ method_field(!empty($day[$i]) ? 'delete' : 'put') }}
                                            {{ csrf_field() }}
                                            <input type="hidden" name="day" value="{{ $id }}">
                                            <input type="hidden" name="hour" value="{{ $i }}">
                                            <a href="javascript:void(0)" class="mdl-color-text--primary no-decoration">
                                                {!! isset($day[$i]) ? $day[$i] : _('Unbooked') !!}
                                                {!! !empty($day[$i]) ? $day[$i]['name'] : _('Unbooked') !!}
                                            </a>
                                        </form>
                                    @else
                                        {!! $day[$i] !!}
                                        {!! $day[$i]['name'] !!}
                                    @endif
                                </li>
                            @endfor
diff --git a/resources/views/events/timetable.blade.php b/resources/views/events/timetable.blade.php
index e64b9c3..c01520c 100644
--- a/resources/views/events/timetable.blade.php
+++ a/resources/views/events/timetable.blade.php
@@ -25,7 +25,7 @@
                                        <a href="{{ route('dashboard::event::timetable.book', ['day' => $id, 'hour' => $i]) }}" class="mdl-color-text--primary no-decoration">
                                            {{ _('Unbooked') }}
                                        </a>
                                    @elseif($day[$i] === auth()->user()->username || auth()->user()->isAdmin())
                                    @elseif($day[$i]['id'] === auth()->user()->userid || auth()->user()->isAdmin())
                                        <form action="{{ route('dashboard::event::timetable.unbook') }}" method="post"
                                              class="a-submit" style="display: inline">
                                            {{ method_field('delete') }}
@@ -33,11 +33,11 @@
                                            <input type="hidden" name="day" value="{{ $id }}">
                                            <input type="hidden" name="hour" value="{{ $i }}">
                                            <a href="javascript:void(0)" class="mdl-color-text--primary no-decoration">
                                                {!! $day[$i] !!}
                                                {{ $day[$i]['name'] }} ({{ $day[$i]['type'] }})
                                            </a>
                                        </form>
                                    @else
                                        {!! $day[$i] !!}
                                        {{ $day[$i]['name'] }} ({{ $day[$i]['type'] }})
                                    @endif
                                </li>
                            @endfor
diff --git a/app/Http/Controllers/DJ/TimetableController.php b/app/Http/Controllers/DJ/TimetableController.php
index 6ce851a..397c079 100644
--- a/app/Http/Controllers/DJ/TimetableController.php
+++ a/app/Http/Controllers/DJ/TimetableController.php
@@ -155,8 +155,10 @@
        }

        foreach ($week as $slot) {
            $timetable[$slot->day][$slot->hour] = $raw ? $slot->user->getDisplayName()->toHtml() :
                $slot->user->getDisplayName();
            $timetable[$slot->day][$slot->hour] = [
                'id' => $slot->user->userid,
                'name' => $raw ? $slot->user->getDisplayName()->toHtml() : $slot->user->getDisplayName()
            ];
        }

        return $timetable;
diff --git a/app/Http/Controllers/Event/TimetableController.php b/app/Http/Controllers/Event/TimetableController.php
index ced4a4d..3ee608e 100644
--- a/app/Http/Controllers/Event/TimetableController.php
+++ a/app/Http/Controllers/Event/TimetableController.php
@@ -211,6 +211,7 @@
            $type = $slot->type->name;

            $timetable[$slot->day][$slot->hour] = [
                'id' => $slot->user()->first()->userid,
                'name' => $raw ? $slot->user()->first()->getDisplayName()->toHtml() :
                    $slot->user()->first()->getDisplayName(),
                'type' => $type