mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
manage cities added, edit venue images
This commit is contained in:
@@ -11,7 +11,6 @@ class CountryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
@@ -27,7 +26,10 @@ class CountryController extends Controller
|
||||
)
|
||||
->when(
|
||||
$request->exists('selected'),
|
||||
fn (Builder $query) => $query->whereIn('code', $request->input('selected', [])),
|
||||
fn(Builder $query) => $query
|
||||
->whereIn('code', $request->input('selected', []))
|
||||
->orWhereIn('id',
|
||||
$request->input('selected', [])),
|
||||
fn(Builder $query) => $query->limit(10)
|
||||
)
|
||||
->get()
|
||||
@@ -40,7 +42,6 @@ class CountryController extends Controller
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
@@ -50,7 +51,6 @@ class CountryController extends Controller
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Country $country)
|
||||
@@ -60,7 +60,6 @@ class CountryController extends Controller
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Country $country)
|
||||
@@ -70,7 +69,6 @@ class CountryController extends Controller
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Country $country)
|
||||
|
||||
@@ -10,6 +10,14 @@ class CityTable extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public bool $manage = false;
|
||||
|
||||
protected $queryString = [
|
||||
'manage' => [
|
||||
'except' => false,
|
||||
],
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.book-case.city-table')->layout('layouts.app', [
|
||||
|
||||
@@ -10,6 +10,10 @@ class VenueTable extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public bool $manage = false;
|
||||
|
||||
protected $queryString = ['manage' => ['except' => false]];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.school.venue-table')->layout('layouts.app', [
|
||||
|
||||
@@ -17,12 +17,14 @@ class CityTable extends DataTableComponent
|
||||
|
||||
public string $type;
|
||||
|
||||
public bool $manage = false;
|
||||
|
||||
public string $tableName = 'cities';
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->setAdditionalSelects(['id'])
|
||||
->setAdditionalSelects(['cities.id', 'cities.created_by'])
|
||||
->setThAttributes(function (Column $column) {
|
||||
return [
|
||||
'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400',
|
||||
@@ -74,6 +76,7 @@ class CityTable extends DataTableComponent
|
||||
fn ($row, Column $column) => view('columns.cities.action')
|
||||
->withRow($row)
|
||||
->withType($this->type)
|
||||
->withManage($this->manage)
|
||||
),
|
||||
])
|
||||
->toArray();
|
||||
|
||||
@@ -12,6 +12,8 @@ class VenueTable extends DataTableComponent
|
||||
{
|
||||
public string $country;
|
||||
|
||||
public bool $manage = false;
|
||||
|
||||
public string $tableName = 'venues';
|
||||
|
||||
public function configure(): void
|
||||
@@ -66,7 +68,7 @@ class VenueTable extends DataTableComponent
|
||||
->collapseOnMobile(),
|
||||
Column::make('')
|
||||
->label(
|
||||
fn ($row, Column $column) => view('columns.venues.action')->withRow($row)
|
||||
fn ($row, Column $column) => view('columns.venues.action')->withRow($row)->withManage($this->manage)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\Venue;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithFileUploads;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
use WireUi\Traits\Actions;
|
||||
|
||||
class VenueForm extends Component
|
||||
@@ -23,6 +24,8 @@ class VenueForm extends Component
|
||||
|
||||
protected $queryString = ['fromUrl' => ['except' => '']];
|
||||
|
||||
protected $listeners = ['refresh' => '$refresh'];
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
@@ -49,6 +52,16 @@ class VenueForm extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteMedia($id)
|
||||
{
|
||||
Media::query()
|
||||
->find($id)
|
||||
->delete();
|
||||
$this->notification()
|
||||
->success(__('Image deleted!'));
|
||||
$this->emit('refresh');
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
@@ -787,5 +787,10 @@
|
||||
"Manage content creators": "Verwalte Content Creators",
|
||||
"Lecturers\/Content Creators": "Dozenten\/Content Creators",
|
||||
"Manage lecturers": "Verwalte Dozenten",
|
||||
"Settings": "Einstellungen"
|
||||
"Settings": "Einstellungen",
|
||||
"Are you sure you want to delete this Bitcoin event?": "Bitte bestätige, dass du dieses Bitcoin Event löschen möchtest.",
|
||||
"Manage cities\/areas": "Verwalte Städte\/Gebiete",
|
||||
"Manage venues": "Verwalte Veranstaltungsorte",
|
||||
"Image deleted!": "Bild gelöscht!",
|
||||
"Current pictures": "Derzeitige Bilder"
|
||||
}
|
||||
|
||||
@@ -784,5 +784,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -784,5 +784,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -785,5 +785,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -747,5 +747,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -759,5 +759,10 @@
|
||||
"Participants": "",
|
||||
"Lecturers\/Content Creators": "",
|
||||
"Manage lecturers": "",
|
||||
"Settings": ""
|
||||
"Settings": "",
|
||||
"Are you sure you want to delete this Bitcoin event?": "",
|
||||
"Manage cities\/areas": "",
|
||||
"Manage venues": "",
|
||||
"Image deleted!": "",
|
||||
"Current pictures": ""
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="flex flex-col space-y-1">
|
||||
@if($type === 'school')
|
||||
@if($type === 'school' && !$manage)
|
||||
<div>
|
||||
<div>
|
||||
@if($row->course_events_count > 0)
|
||||
<x-button amber wire:click="proximitySearch({{ $row->id }})" class="text-21gray">
|
||||
<x-button xs amber wire:click="proximitySearch({{ $row->id }})" class="text-21gray">
|
||||
<i class="fa fa-thin fa-person-chalkboard mr-2"></i>
|
||||
{{ __('Perimeter search course date :name (100km)', ['name' => $row->name]) }}
|
||||
</x-button>
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div>
|
||||
@if($row->course_events_count < 1)
|
||||
<x-button outlined wire:click="proximitySearch({{ $row->id }})" class="text-21gray">
|
||||
<x-button xs outlined wire:click="proximitySearch({{ $row->id }})" class="text-21gray">
|
||||
<i class="fa fa-thin fa-person-chalkboard mr-2"></i>
|
||||
{{ __('Perimeter search course date :name (100km)', ['name' => $row->name]) }}
|
||||
</x-button>
|
||||
@@ -20,13 +20,21 @@
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
@if($type === 'bookCase')
|
||||
@if($type === 'bookCase' && !$manage)
|
||||
<div>
|
||||
<x-button amber wire:click="proximitySearchForBookCases({{ $row->id }})" class="text-21gray">
|
||||
<x-button xs amber wire:click="proximitySearchForBookCases({{ $row->id }})" class="text-21gray">
|
||||
<i class="fa fa-thin fa-book mr-2"></i>
|
||||
{{ __('Perimeter search bookcase :name (25km)', ['name' => $row->name]) }}
|
||||
</x-button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
@can('update', $row)
|
||||
<x-button xs :href="route('city.form', ['city' => $row])">
|
||||
<i class="fa fa-thin fa-edit"></i>
|
||||
{{ __('Edit') }}
|
||||
</x-button>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<div class="w-full mb-4 md:w-auto md:mb-0" x-data="{currentUrl: window.location.href}">
|
||||
<a x-bind:href="'/city/form/?fromUrl='+currentUrl">
|
||||
<x-button>
|
||||
<div class="w-full mb-4 md:w-auto md:mb-0">
|
||||
<x-button :href="route('city.form')">
|
||||
<i class="fa fa-thin fa-plus"></i>
|
||||
{{ __('New City') }}
|
||||
</x-button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<div class="flex flex-col space-y-1">
|
||||
<div>
|
||||
@if($row->course_events_count > 0)
|
||||
@if($row->course_events_count > 0 && !$manage)
|
||||
<x-button xs amber wire:click="venueSearch({{ $row->id }})">
|
||||
{{ __('Show dates') }} ({{ $row->course_events_count }})
|
||||
</x-button>
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
@if($row->course_events_count < 1)
|
||||
@if($row->course_events_count < 1 && !$manage)
|
||||
<x-button xs outlined wire:click="venueSearch({{ $row->id }})">
|
||||
{{ __('Show dates') }} ({{ $row->course_events_count }})
|
||||
</x-button>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<livewire:tables.city-table :country="$country->code" type="bookCase"/>
|
||||
<livewire:tables.city-table :country="$country->code" type="bookCase" :manage="$manage"/>
|
||||
</div>
|
||||
</section>
|
||||
{{-- FOOTER --}}
|
||||
|
||||
@@ -95,6 +95,18 @@
|
||||
{{ __('Manage lecturers') }}
|
||||
</a>
|
||||
|
||||
<a href="{{ route('bookCases.table.city', ['country' => $country, 'manage' => true]) }}"
|
||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||
<i class="fa-thin fa-list flex-none text-gray-400"></i>
|
||||
{{ __('Manage cities/areas') }}
|
||||
</a>
|
||||
|
||||
<a href="{{ route('school.table.venue', ['country' => $country, 'manage' => true]) }}"
|
||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||
<i class="fa-thin fa-list flex-none text-gray-400"></i>
|
||||
{{ __('Manage venues') }}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,6 +53,18 @@
|
||||
{{ __('Register event') }}
|
||||
</a>
|
||||
|
||||
<a href="{{ route('bookCases.table.city', ['country' => $country, 'manage' => true]) }}"
|
||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||
<i class="fa-thin fa-list flex-none text-gray-400"></i>
|
||||
{{ __('Manage cities/areas') }}
|
||||
</a>
|
||||
|
||||
<a href="{{ route('school.table.venue', ['country' => $country, 'manage' => true]) }}"
|
||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||
<i class="fa-thin fa-list flex-none text-gray-400"></i>
|
||||
{{ __('Manage venues') }}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,6 +65,12 @@
|
||||
{{ __('Register Meetup date') }}
|
||||
</a>
|
||||
|
||||
<a href="{{ route('bookCases.table.city', ['country' => $country, 'manage' => true]) }}"
|
||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||
<i class="fa-thin fa-list flex-none text-gray-400"></i>
|
||||
{{ __('Manage cities/areas') }}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{{----}}
|
||||
</div>
|
||||
</div>
|
||||
<livewire:tables.venue-table :country="$country->code"/>
|
||||
<livewire:tables.venue-table :country="$country->code" :manage="$manage"/>
|
||||
</div>
|
||||
</section>
|
||||
{{-- FOOTER --}}
|
||||
|
||||
@@ -39,10 +39,24 @@
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
{{--@if ($venue->getFirstMediaUrl('images'))
|
||||
<div class="text-gray-200">{{ __('Current picture') }}:</div>
|
||||
<img class="h-48 object-contain" src="{{ $venue->getFirstMediaUrl('logo') }}">
|
||||
@endif--}}
|
||||
@if ($venue->getMedia('images'))
|
||||
<div class="text-gray-200">{{ __('Current pictures') }}:</div>
|
||||
<div class="grid grid-cols-4 gap-1">
|
||||
@foreach($venue->getMedia('images') as $image)
|
||||
<div class="space-y-2" wire:key="image_{{ $image->id }}" wire:click="deleteMedia({{ $image->id }})">
|
||||
<div class="flex justify-center">
|
||||
<img class="h-48 object-contain" src="{{ $image->getUrl() }}">
|
||||
</div>
|
||||
<div class="flex justify-center">
|
||||
<x-button xs>
|
||||
<i class="fa-thin fa-trash"></i>
|
||||
{{ __('Delete') }}
|
||||
</x-button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<input class="text-gray-200" type="file" multiple wire:model="images">
|
||||
</x-input.group>
|
||||
|
||||
Reference in New Issue
Block a user