recurring fixed

This commit is contained in:
HolgerHatGarKeineNode
2023-02-27 16:35:56 +01:00
parent 80fa72c073
commit 9896618944
2 changed files with 25 additions and 25 deletions

View File

@@ -24,22 +24,22 @@ class MeetupEventForm extends Component
public function rules() public function rules()
{ {
return [ return [
'meetupEvent.meetup_id' => 'required', 'meetupEvent.meetup_id' => 'required',
'meetupEvent.start' => 'required', 'meetupEvent.start' => 'required',
'meetupEvent.location' => 'string|nullable', 'meetupEvent.location' => 'string|nullable',
'meetupEvent.description' => 'string|nullable', 'meetupEvent.description' => 'string|nullable',
'meetupEvent.link' => 'url|nullable', 'meetupEvent.link' => 'url|nullable',
'series.*.start' => 'required', 'series.*.start' => 'required',
'recurring' => 'bool', 'recurring' => 'bool',
'repetitions' => 'numeric|min:1', 'repetitions' => 'numeric|min:1',
]; ];
} }
public function mount() public function mount()
{ {
if (! $this->meetupEvent) { if (!$this->meetupEvent) {
$this->meetupEvent = new MeetupEvent( $this->meetupEvent = new MeetupEvent(
[ [
'start' => now() 'start' => now()
@@ -47,7 +47,7 @@ class MeetupEventForm extends Component
->addHours(17), ->addHours(17),
] ]
); );
} elseif (! auth() } elseif (!auth()
->user() ->user()
->can('update', $this->meetupEvent)) { ->can('update', $this->meetupEvent)) {
abort(403); abort(403);
@@ -89,15 +89,15 @@ class MeetupEventForm extends Component
$this->dialog() $this->dialog()
->confirm( ->confirm(
[ [
'title' => __('Delete event'), 'title' => __('Delete event'),
'description' => __('Are you sure you want to delete this event? This action cannot be undone.'), 'description' => __('Are you sure you want to delete this event? This action cannot be undone.'),
'icon' => 'warning', 'icon' => 'warning',
'accept' => [ 'accept' => [
'label' => __('Yes, delete'), 'label' => __('Yes, delete'),
'method' => 'deleteEvent', 'method' => 'deleteEvent',
], ],
'reject' => [ 'reject' => [
'label' => __('No, cancel'), 'label' => __('No, cancel'),
'method' => 'cancel', 'method' => 'cancel',
], ],
] ]
@@ -114,7 +114,7 @@ class MeetupEventForm extends Component
public function submit() public function submit()
{ {
$this->validate(); $this->validate();
if (! $this->meetupEvent->id) { if (!$this->meetupEvent->id) {
$hasAppointmentsOnThisDate = MeetupEvent::query() $hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id) ->where('meetup_id', $this->meetupEvent->meetup_id)
->where('start', '>', Carbon::parse($this->meetupEvent->start) ->where('start', '>', Carbon::parse($this->meetupEvent->start)
@@ -132,7 +132,7 @@ class MeetupEventForm extends Component
$this->meetupEvent->save(); $this->meetupEvent->save();
if (! $this->meetupEvent->id && $this->recurring) { if ($this->recurring) {
foreach ($this->series as $event) { foreach ($this->series as $event) {
$hasAppointmentsOnThisDate = MeetupEvent::query() $hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id) ->where('meetup_id', $this->meetupEvent->meetup_id)

View File

@@ -94,16 +94,16 @@
@if($meetupEvent->start && $recurring) @if($meetupEvent->start && $recurring)
<div class="grid grid-cols-1 lg:grid-cols-3 gap-2"> <div class="grid grid-cols-1 lg:grid-cols-3 gap-2">
@for($i = 0; $i < $repetitions; $i++) @for($i = 0; $i < $repetitions; $i++)
<x-datetime-picker wire:key="event_{{ $i }}" <x-datetime-picker
:label="\App\Support\Carbon::parse($series[$i]['start'])->asDayNameAndMonthName()" :label="\App\Support\Carbon::parse($series[$i]['start'])->asDayNameAndMonthName()"
:clearable="false" :clearable="false"
time-format="24" time-format="24"
timezone="UTC" timezone="UTC"
user-timezone="{{ config('app.user-timezone') }}" user-timezone="{{ config('app.user-timezone') }}"
autocomplete="off" autocomplete="off"
wire:model.debounce="series.{{ $i }}.start" wire:model.debounce="series.{{ $i }}.start"
display-format="DD-MM-YYYY HH:mm" display-format="DD-MM-YYYY HH:mm"
:placeholder="__('Start')"/> :placeholder="__('Start')"/>
@endfor @endfor
</div> </div>
@endif @endif