mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
some new tables
This commit is contained in:
@@ -3,11 +3,13 @@
|
|||||||
namespace App\Http\Livewire\Frontend;
|
namespace App\Http\Livewire\Frontend;
|
||||||
|
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Header extends Component
|
class Header extends Component
|
||||||
{
|
{
|
||||||
public Country $country;
|
public Country $country;
|
||||||
|
public $currentRouteName;
|
||||||
public string $c = 'de';
|
public string $c = 'de';
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
@@ -19,12 +21,13 @@ class Header extends Component
|
|||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
|
$this->currentRouteName = Route::currentRouteName();
|
||||||
$this->c = $this->country->code;
|
$this->c = $this->country->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedC($value)
|
public function updatedC($value)
|
||||||
{
|
{
|
||||||
return to_route('search.cities', ['country' => $value]);
|
return to_route($this->currentRouteName, ['country' => $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|||||||
16
app/Http/Livewire/Frontend/SearchVenue.php
Normal file
16
app/Http/Livewire/Frontend/SearchVenue.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Frontend;
|
||||||
|
|
||||||
|
use App\Models\Country;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class SearchVenue extends Component
|
||||||
|
{
|
||||||
|
public Country $country;
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.frontend.search-venue');
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/Http/Livewire/Tables/CourseTable.php
Normal file
40
app/Http/Livewire/Tables/CourseTable.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Tables;
|
||||||
|
|
||||||
|
use App\Models\Course;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
|
|
||||||
|
class CourseTable extends DataTableComponent
|
||||||
|
{
|
||||||
|
protected $model = Course::class;
|
||||||
|
|
||||||
|
public function configure(): void
|
||||||
|
{
|
||||||
|
$this->setPrimaryKey('id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make("Id", "id")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Lecturer id", "lecturer_id")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Name", "name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Created at", "created_at")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Updated at", "updated_at")
|
||||||
|
->sortable(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function builder(): Builder
|
||||||
|
{
|
||||||
|
return Course::query()
|
||||||
|
->whereHas('country', fn($query) => $query->where('code', $this->country));
|
||||||
|
}
|
||||||
|
}
|
||||||
38
app/Http/Livewire/Tables/VenueTable.php
Normal file
38
app/Http/Livewire/Tables/VenueTable.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Tables;
|
||||||
|
|
||||||
|
use App\Models\Venue;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
|
|
||||||
|
class VenueTable extends DataTableComponent
|
||||||
|
{
|
||||||
|
public string $country;
|
||||||
|
|
||||||
|
protected $model = Venue::class;
|
||||||
|
|
||||||
|
public function configure(): void
|
||||||
|
{
|
||||||
|
$this->setPrimaryKey('id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make("City id", "city_id")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Name", "name")
|
||||||
|
->sortable(),
|
||||||
|
Column::make("Street", "street")
|
||||||
|
->sortable(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function builder(): Builder
|
||||||
|
{
|
||||||
|
return Venue::query()
|
||||||
|
->whereHas('city.country', fn($query) => $query->where('code', $this->country));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ class Venue extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -23,11 +22,10 @@ class Venue extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
'city_id' => 'integer',
|
'city_id' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,9 @@
|
|||||||
</a>
|
</a>
|
||||||
<nav
|
<nav
|
||||||
class="flex flex-wrap items-center mb-5 text-lg md:mb-0 md:pl-8 md:ml-8 md:border-l md:border-gray-800">
|
class="flex flex-wrap items-center mb-5 text-lg md:mb-0 md:pl-8 md:ml-8 md:border-l md:border-gray-800">
|
||||||
<a href="#_" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Städte</a>
|
<a href="{{ route('search.city', ['country' => 'de']) }}" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Städte</a>
|
||||||
<a href="#_" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Dozenten</a>
|
<a href="{{ route('search.lecturer', ['country' => 'de']) }}" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Dozenten</a>
|
||||||
<a href="#_" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Kurse</a>
|
<a href="{{ route('search.venue', ['country' => 'de']) }}" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Veranstaltungs-Orte</a>
|
||||||
<a href="#_" class="mr-5 font-medium leading-6 text-gray-400 hover:text-gray-300">Termine</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@auth
|
@auth
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
<div>
|
<div class="bg-21gray flex flex-col h-screen justify-between">
|
||||||
{{-- Be like water. --}}
|
{{-- HEADER --}}
|
||||||
|
<livewire:frontend.header :country="$country"/>
|
||||||
|
{{-- MAIN --}}
|
||||||
|
<section class="w-full mb-12">
|
||||||
|
<div class="max-w-7xl mx-auto px-10">
|
||||||
|
<livewire:frontend.search-tabs/>
|
||||||
|
<livewire:tables.course-table :country="$country->code"/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{-- FOOTER --}}
|
||||||
|
<livewire:frontend.footer/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
<label for="current-tab" class="sr-only">Select a tab</label>
|
<label for="current-tab" class="sr-only">Select a tab</label>
|
||||||
<select id="current-tab" name="current-tab"
|
<select id="current-tab" name="current-tab"
|
||||||
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 selected>Städte</option>
|
<option {{ route('search.city', ['country' => 'de']) ? 'selected' : '' }}>Städte</option>
|
||||||
<option>Dozenten</option>
|
<option {{ route('search.lecturer', ['country' => 'de']) ? 'selected' : '' }}>Dozenten</option>
|
||||||
<option>Kurse</option>
|
<option {{ route('search.venue', ['country' => 'de']) ? 'selected' : '' }}>Veranstalungs-Orte</option>
|
||||||
<option>Termine</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- Tabs at small breakpoint and up -->
|
<!-- Tabs at small breakpoint and up -->
|
||||||
@@ -26,11 +25,9 @@
|
|||||||
<a href="{{ route('search.lecturer', ['country' => 'de']) }}"
|
<a href="{{ route('search.lecturer', ['country' => 'de']) }}"
|
||||||
class="{{ request()->routeIs('search.lecturer') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Dozenten</a>
|
class="{{ request()->routeIs('search.lecturer') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Dozenten</a>
|
||||||
|
|
||||||
<a href="{{ route('search.course', ['country' => 'de']) }}"
|
<a href="{{ route('search.venue', ['country' => 'de']) }}"
|
||||||
class="{{ request()->routeIs('search.course') ? $currentTab : $notCurrentTab }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">Kurse</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.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>
|
||||||
|
|||||||
13
resources/views/livewire/frontend/search-venue.blade.php
Normal file
13
resources/views/livewire/frontend/search-venue.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<div class="bg-21gray flex flex-col h-screen justify-between">
|
||||||
|
{{-- HEADER --}}
|
||||||
|
<livewire:frontend.header :country="$country"/>
|
||||||
|
{{-- MAIN --}}
|
||||||
|
<section class="w-full mb-12">
|
||||||
|
<div class="max-w-7xl mx-auto px-10">
|
||||||
|
<livewire:frontend.search-tabs/>
|
||||||
|
<livewire:tables.venue-table :country="$country->code"/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{-- FOOTER --}}
|
||||||
|
<livewire:frontend.footer/>
|
||||||
|
</div>
|
||||||
@@ -24,6 +24,9 @@ Route::get('/{country:code}/suche/stadt', \App\Http\Livewire\Frontend\SearchCity
|
|||||||
Route::get('/{country:code}/suche/dozent', \App\Http\Livewire\Frontend\SearchLecturer::class)
|
Route::get('/{country:code}/suche/dozent', \App\Http\Livewire\Frontend\SearchLecturer::class)
|
||||||
->name('search.lecturer');
|
->name('search.lecturer');
|
||||||
|
|
||||||
|
Route::get('/{country:code}/suche/ort', \App\Http\Livewire\Frontend\SearchVenue::class)
|
||||||
|
->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\SearchCity::class)
|
||||||
->name('search.course');
|
->name('search.course');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user