mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-14 12:06:46 +00:00
✨ Enhance timezone support across application
- Introduced a `SetTimezone` middleware to dynamically apply user-specific timezones. - Added a `timezone chooser` component for users to select their timezone. - Enhanced date and time display in views with `asDate`, `asTime`, and `asDateTime` methods. - Updated `AppServiceProvider` to leverage `preventLazyLoading` in local environments and set custom `Carbon` instance for dates. - Expanded configuration with `user-timezone`. - Integrated timezone support into meetups and events for consistent scheduling.
This commit is contained in:
52
resources/views/livewire/timezone/chooser.blade.php
Normal file
52
resources/views/livewire/timezone/chooser.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Livewire\Volt\Component;
|
||||
use Flux\Flux;
|
||||
|
||||
new class extends Component {
|
||||
public bool $withRedirect = true;
|
||||
public $currentRouteName;
|
||||
public $currentRouteParams;
|
||||
public string $selectedTimezone = 'UTC';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentRouteName = request()->route()->getName();
|
||||
$this->currentRouteParams = request()->route()->parameters();
|
||||
$this->selectedTimezone = config('app.timezone', 'UTC');
|
||||
}
|
||||
|
||||
public function updatedSelectedTimezone()
|
||||
{
|
||||
// Handle timezone change here
|
||||
// You can emit an event or update user settings
|
||||
auth()->user()->update([
|
||||
'timezone' => $this->selectedTimezone,
|
||||
]);
|
||||
Flux::toast(text: __('Zeitzone erfolgreich aktualisiert'), heading: __('Zeitzone'), variant: 'success');
|
||||
if ($this->withRedirect) {
|
||||
$this->redirectRoute($this->currentRouteName, $this->currentRouteParams, navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'timezones' => \DateTimeZone::listIdentifiers(),
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div>
|
||||
<flux:select variant="listbox" searchable placeholder="{{ __('Wähle deine Zeitzone...') }}"
|
||||
wire:model.live.debounce="selectedTimezone">
|
||||
<x-slot name="search">
|
||||
<flux:select.search class="px-4" placeholder="{{ __('Suche Zeitzone...') }}"/>
|
||||
</x-slot>
|
||||
@foreach($timezones as $timezone)
|
||||
<flux:select.option value="{{ $timezone }}">
|
||||
{{ $timezone }}
|
||||
</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</div>
|
||||
Reference in New Issue
Block a user