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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user