mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
tabs added
This commit is contained in:
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Frontend;
|
namespace App\Http\Livewire\Frontend;
|
||||||
|
|
||||||
|
use App\Models\Country;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class SearchCourse extends Component
|
class SearchCourse extends Component
|
||||||
{
|
{
|
||||||
|
public Country $country;
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.frontend.search-course');
|
return view('livewire.frontend.search-course');
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Frontend;
|
namespace App\Http\Livewire\Frontend;
|
||||||
|
|
||||||
|
use App\Models\Country;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class SearchEvent extends Component
|
class SearchEvent extends Component
|
||||||
{
|
{
|
||||||
|
public Country $country;
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.frontend.search-event');
|
return view('livewire.frontend.search-event');
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ use Rappasoft\LaravelLivewireTables\Views\Column;
|
|||||||
|
|
||||||
class CourseTable extends DataTableComponent
|
class CourseTable extends DataTableComponent
|
||||||
{
|
{
|
||||||
|
public string $country;
|
||||||
|
|
||||||
protected $model = Course::class;
|
protected $model = Course::class;
|
||||||
|
|
||||||
public function configure(): void
|
public function configure(): void
|
||||||
@@ -19,22 +21,29 @@ class CourseTable extends DataTableComponent
|
|||||||
public function columns(): array
|
public function columns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make("Id", "id")
|
Column::make("Dozent", "lecturer.name")
|
||||||
->sortable(),
|
|
||||||
Column::make("Lecturer id", "lecturer_id")
|
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Column::make("Name", "name")
|
Column::make("Name", "name")
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Column::make("Created at", "created_at")
|
Column::make("Termine")
|
||||||
|
->label(
|
||||||
|
fn($row, Column $column) => '<strong>'.$row->events->count().'</strong>'
|
||||||
|
)
|
||||||
|
->html()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Column::make("Updated at", "updated_at")
|
Column::make("Erstellt am", "created_at")
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Column::make('')
|
||||||
|
->label(
|
||||||
|
fn($row, Column $column) => view('columns.courses.action')->withRow($row)
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function builder(): Builder
|
public function builder(): Builder
|
||||||
{
|
{
|
||||||
return Course::query()
|
return Course::query()
|
||||||
->whereHas('country', fn($query) => $query->where('code', $this->country));
|
->whereHas('events.venue.city.country',
|
||||||
|
fn($query) => $query->where('countries.code', $this->country));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
63
app/Http/Livewire/Tables/EventTable.php
Normal file
63
app/Http/Livewire/Tables/EventTable.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Tables;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
|
|
||||||
|
class EventTable extends DataTableComponent
|
||||||
|
{
|
||||||
|
public string $country;
|
||||||
|
|
||||||
|
protected $model = Event::class;
|
||||||
|
|
||||||
|
public function configure(): void
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setPrimaryKey('id')
|
||||||
|
->setAdditionalSelects([
|
||||||
|
'course_id',
|
||||||
|
'venue_id',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make("Stadt", "venue.city.name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Veranstaltungs-Ort", "venue.name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Dozent", "course.lecturer.name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Kurs", "course.name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Erstellt am", "created_at")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Zuletzt geändert", "updated_at")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Teilnehmer")
|
||||||
|
->label(
|
||||||
|
fn($row, Column $column) => '<strong>'.$row->registrations->count().'</strong>'
|
||||||
|
)
|
||||||
|
->html()
|
||||||
|
->sortable(),
|
||||||
|
Column::make('')
|
||||||
|
->label(
|
||||||
|
fn($row, Column $column) => view('columns.events.action')->withRow($row)
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function builder(): Builder
|
||||||
|
{
|
||||||
|
return Event::query()
|
||||||
|
->withCount([
|
||||||
|
'registrations',
|
||||||
|
])
|
||||||
|
->whereHas('venue.city.country',
|
||||||
|
fn($query) => $query->where('countries.code', $this->country));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,10 @@ class VenueTable extends DataTableComponent
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Column::make("Street", "street")
|
Column::make("Street", "street")
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Column::make('')
|
||||||
|
->label(
|
||||||
|
fn($row, Column $column) => view('columns.venues.action')->withRow($row)
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ class Course extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Lecturer::class);
|
return $this->belongsTo(Lecturer::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function events(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Event::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,9 @@ class Event extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Venue::class);
|
return $this->belongsTo(Venue::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function registrations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Registration::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
resources/views/columns/courses/action.blade.php
Normal file
1
resources/views/columns/courses/action.blade.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<x-button amber>Termine anzeigen</x-button>
|
||||||
1
resources/views/columns/events/action.blade.php
Normal file
1
resources/views/columns/events/action.blade.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<x-button amber>Anmelden</x-button>
|
||||||
@@ -1 +1 @@
|
|||||||
<x-button amber>Termine ansehen</x-button>
|
<x-button amber>Termine anzeigen</x-button>
|
||||||
|
|||||||
1
resources/views/columns/venues/action.blade.php
Normal file
1
resources/views/columns/venues/action.blade.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<x-button amber>Termine anzeigen</x-button>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<section class="w-full">
|
<section class="w-full">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<div class="flex flex-col flex-wrap items-center justify-between py-7 mx-auto md:flex-row max-w-7xl">
|
<div class="flex flex-col flex-wrap items-center justify-between py-7 mx-auto md:flex-row max-w-screen-2xl">
|
||||||
<div class="relative flex flex-col md:flex-row">
|
<div class="relative flex flex-col md:flex-row">
|
||||||
<a href="#_"
|
<a href="#_"
|
||||||
class="flex items-center mb-5 font-medium text-gray-900 lg:w-auto lg:items-center lg:justify-center md:mb-0">
|
class="flex items-center mb-5 font-medium text-gray-900 lg:w-auto lg:items-center lg:justify-center md:mb-0">
|
||||||
@@ -15,6 +15,10 @@
|
|||||||
class="{{ request()->routeIs('search.lecturer') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Dozenten</a>
|
class="{{ request()->routeIs('search.lecturer') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Dozenten</a>
|
||||||
<a href="{{ route('search.venue', ['country' => $c]) }}"
|
<a href="{{ route('search.venue', ['country' => $c]) }}"
|
||||||
class="{{ request()->routeIs('search.venue') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Veranstaltungs-Orte</a>
|
class="{{ request()->routeIs('search.venue') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Veranstaltungs-Orte</a>
|
||||||
|
<a href="{{ route('search.course', ['country' => $c]) }}"
|
||||||
|
class="{{ request()->routeIs('search.course') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Kurse</a>
|
||||||
|
<a href="{{ route('search.event', ['country' => $c]) }}"
|
||||||
|
class="{{ request()->routeIs('search.event') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Termine</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@auth
|
@auth
|
||||||
@@ -63,6 +67,8 @@
|
|||||||
'search.city' => 'Stadt',
|
'search.city' => 'Stadt',
|
||||||
'search.lecturer' => 'Dozent',
|
'search.lecturer' => 'Dozent',
|
||||||
'search.venue' => 'Veranstaltungs-Ort',
|
'search.venue' => 'Veranstaltungs-Ort',
|
||||||
|
'search.course' => 'Kurs',
|
||||||
|
'search.event' => 'Termin',
|
||||||
};
|
};
|
||||||
@endphp
|
@endphp
|
||||||
<a href="#_"
|
<a href="#_"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<livewire:frontend.header :country="$country"/>
|
<livewire:frontend.header :country="$country"/>
|
||||||
{{-- MAIN --}}
|
{{-- MAIN --}}
|
||||||
<section class="w-full mb-12">
|
<section class="w-full mb-12">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<livewire:frontend.search-tabs/>
|
<livewire:frontend.search-tabs/>
|
||||||
<livewire:tables.city-table :country="$country->code"/>
|
<livewire:tables.city-table :country="$country->code"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<livewire:frontend.header :country="$country"/>
|
<livewire:frontend.header :country="$country"/>
|
||||||
{{-- MAIN --}}
|
{{-- MAIN --}}
|
||||||
<section class="w-full mb-12">
|
<section class="w-full mb-12">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<livewire:frontend.search-tabs/>
|
<livewire:frontend.search-tabs/>
|
||||||
<livewire:tables.course-table :country="$country->code"/>
|
<livewire:tables.course-table :country="$country->code"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
<div>
|
<div class="bg-21gray flex flex-col h-screen justify-between">
|
||||||
{{-- The best athlete wants his opponent at his best. --}}
|
{{-- HEADER --}}
|
||||||
|
<livewire:frontend.header :country="$country"/>
|
||||||
|
{{-- MAIN --}}
|
||||||
|
<section class="w-full mb-12">
|
||||||
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
|
<livewire:frontend.search-tabs/>
|
||||||
|
<livewire:tables.event-table :country="$country->code"/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{-- FOOTER --}}
|
||||||
|
<livewire:frontend.footer/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<livewire:frontend.header :country="$country"/>
|
<livewire:frontend.header :country="$country"/>
|
||||||
{{-- MAIN --}}
|
{{-- MAIN --}}
|
||||||
<section class="w-full mb-12">
|
<section class="w-full mb-12">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<livewire:frontend.search-tabs/>
|
<livewire:frontend.search-tabs/>
|
||||||
<livewire:tables.lecturer-table/>
|
<livewire:tables.lecturer-table/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
class="block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm">
|
class="block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm">
|
||||||
<option {{ route('search.city', ['country' => 'de']) ? 'selected' : '' }}>Städte</option>
|
<option {{ route('search.city', ['country' => 'de']) ? 'selected' : '' }}>Städte</option>
|
||||||
<option {{ route('search.lecturer', ['country' => 'de']) ? 'selected' : '' }}>Dozenten</option>
|
<option {{ route('search.lecturer', ['country' => 'de']) ? 'selected' : '' }}>Dozenten</option>
|
||||||
<option {{ route('search.venue', ['country' => 'de']) ? 'selected' : '' }}>Veranstalungs-Orte</option>
|
<option {{ route('search.venue', ['country' => 'de']) ? 'selected' : '' }}>Veranstalungs-Orte
|
||||||
|
</option>
|
||||||
|
<option {{ route('search.course', ['country' => 'de']) ? 'selected' : '' }}>Kurse</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- Tabs at small breakpoint and up -->
|
<!-- Tabs at small breakpoint and up -->
|
||||||
@@ -28,6 +30,12 @@
|
|||||||
<a href="{{ route('search.venue', ['country' => 'de']) }}"
|
<a href="{{ route('search.venue', ['country' => 'de']) }}"
|
||||||
class="{{ request()->routeIs('search.venue') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Veranstaltungs-Orte</a>
|
class="{{ request()->routeIs('search.venue') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Veranstaltungs-Orte</a>
|
||||||
|
|
||||||
|
<a href="{{ route('search.course', ['country' => 'de']) }}"
|
||||||
|
class="{{ request()->routeIs('search.course') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Kurse</a>
|
||||||
|
|
||||||
|
<a href="{{ route('search.event', ['country' => 'de']) }}"
|
||||||
|
class="{{ request()->routeIs('search.event') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Termine</a>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<livewire:frontend.header :country="$country"/>
|
<livewire:frontend.header :country="$country"/>
|
||||||
{{-- MAIN --}}
|
{{-- MAIN --}}
|
||||||
<section class="w-full mb-12">
|
<section class="w-full mb-12">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<livewire:frontend.search-tabs/>
|
<livewire:frontend.search-tabs/>
|
||||||
<livewire:tables.venue-table :country="$country->code"/>
|
<livewire:tables.venue-table :country="$country->code"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<section class="w-full">
|
<section class="w-full">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<div class="flex flex-col flex-wrap items-center justify-between py-7 mx-auto md:flex-row max-w-7xl">
|
<div class="flex flex-col flex-wrap items-center justify-between py-7 mx-auto md:flex-row max-w-screen-2xl">
|
||||||
<div class="relative flex flex-col md:flex-row">
|
<div class="relative flex flex-col md:flex-row">
|
||||||
<a href="#_"
|
<a href="#_"
|
||||||
class="flex items-center mb-5 font-medium text-gray-900 lg:w-auto lg:items-center lg:justify-center md:mb-0">
|
class="flex items-center mb-5 font-medium text-gray-900 lg:w-auto lg:items-center lg:justify-center md:mb-0">
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="w-full mb-12">
|
<section class="w-full mb-12">
|
||||||
<div class="max-w-7xl mx-auto px-10">
|
<div class="max-w-screen-2xl mx-auto px-10">
|
||||||
<div class="border-b border-gray-200 pb-5 sm:pb-0 my-6">
|
<div class="border-b border-gray-200 pb-5 sm:pb-0 my-6">
|
||||||
<h3 class="text-lg font-medium leading-6 text-gray-200">Suche</h3>
|
<h3 class="text-lg font-medium leading-6 text-gray-200">Suche</h3>
|
||||||
<div class="mt-3 sm:mt-4">
|
<div class="mt-3 sm:mt-4">
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ Route::get('/{country:code}/suche/dozent', \App\Http\Livewire\Frontend\SearchLec
|
|||||||
Route::get('/{country:code}/suche/ort', \App\Http\Livewire\Frontend\SearchVenue::class)
|
Route::get('/{country:code}/suche/ort', \App\Http\Livewire\Frontend\SearchVenue::class)
|
||||||
->name('search.venue');
|
->name('search.venue');
|
||||||
|
|
||||||
Route::get('/{country:code}/suche/kurs', \App\Http\Livewire\Frontend\SearchCity::class)
|
Route::get('/{country:code}/suche/kurs', \App\Http\Livewire\Frontend\SearchCourse::class)
|
||||||
->name('search.course');
|
->name('search.course');
|
||||||
|
|
||||||
Route::get('/{country:code}/suche/termin', \App\Http\Livewire\Frontend\SearchCity::class)
|
Route::get('/{country:code}/suche/termin', \App\Http\Livewire\Frontend\SearchEvent::class)
|
||||||
->name('search.event');
|
->name('search.event');
|
||||||
|
|
||||||
Route::get('/dozenten', \App\Http\Livewire\Guest\Welcome::class)
|
Route::get('/dozenten', \App\Http\Livewire\Guest\Welcome::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user