settings added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-26 14:28:20 +01:00
parent 41c98b4162
commit 4a43b5f1d5
15 changed files with 93 additions and 30 deletions

View File

@@ -23,20 +23,26 @@ class Header extends Component
public string $l = 'de'; public string $l = 'de';
public string $timezone;
public $bgColor = 'bg-21gray'; public $bgColor = 'bg-21gray';
protected $queryString = ['l']; protected $queryString = ['l'];
protected $listeners = ['refresh' => '$refresh'];
public function rules() public function rules()
{ {
return [ return [
'c' => 'required', 'c' => 'required',
'l' => 'required', 'l' => 'required',
'timezone' => 'required',
]; ];
} }
public function mount() public function mount()
{ {
$this->timezone = config('app.user-timezone');
$this->l = Cookie::get('lang') ?: config('app.locale'); $this->l = Cookie::get('lang') ?: config('app.locale');
if (!$this->country) { if (!$this->country) {
$this->country = Country::query() $this->country = Country::query()
@@ -47,6 +53,15 @@ class Header extends Component
$this->c = $this->country->code; $this->c = $this->country->code;
} }
public function updatedTimezone($value)
{
auth()
->user()
->update(['timezone' => $value]);
return redirect(request()->header('Referer'));
}
public function updatedC($value) public function updatedC($value)
{ {
return to_route($this->currentRouteName, ['country' => $value, 'lang' => $this->l]); return to_route($this->currentRouteName, ['country' => $value, 'lang' => $this->l]);

View File

@@ -786,5 +786,6 @@
"Manage": "Verwalten", "Manage": "Verwalten",
"Manage content creators": "Verwalte Content Creators", "Manage content creators": "Verwalte Content Creators",
"Lecturers\/Content Creators": "Dozenten\/Content Creators", "Lecturers\/Content Creators": "Dozenten\/Content Creators",
"Manage lecturers": "Verwalte Dozenten" "Manage lecturers": "Verwalte Dozenten",
"Settings": "Einstellungen"
} }

View File

@@ -783,5 +783,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -783,5 +783,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -784,5 +784,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -746,5 +746,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -758,5 +758,6 @@
"Manage content creators": "", "Manage content creators": "",
"Participants": "", "Participants": "",
"Lecturers\/Content Creators": "", "Lecturers\/Content Creators": "",
"Manage lecturers": "" "Manage lecturers": "",
"Settings": ""
} }

View File

@@ -35,6 +35,8 @@
@include('livewire.frontend.navigation.profile') @include('livewire.frontend.navigation.profile')
@endauth @endauth
@include('livewire.frontend.navigation.settings')
</div> </div>
<div class="hidden lg:flex lg:flex-1 lg:justify-end"> <div class="hidden lg:flex lg:flex-1 lg:justify-end">
@if(!auth()->check()) @if(!auth()->check())

View File

@@ -57,23 +57,6 @@
<div class="grid grid-cols-1 gap-10 sm:gap-8 lg:grid-cols-2"> <div class="grid grid-cols-1 gap-10 sm:gap-8 lg:grid-cols-2">
<h3 class="sr-only">Recent posts</h3> <h3 class="sr-only">Recent posts</h3>
<x-native-select
label="{{ __('Change country') }}"
wire:model="c"
option-label="name"
option-value="code"
:options="$countries"
/>
<x-select
label="{{ __('Change language') }}"
wire:model="l"
:clearable="false"
:searchable="true"
:async-data="route('api.languages.index')"
option-label="name"
option-value="language"
/>
{{--@foreach($orangePills as $item) {{--@foreach($orangePills as $item)
<article <article
class="relative isolate flex max-w-2xl flex-col gap-x-8 gap-y-6 sm:flex-row sm:items-start lg:flex-col lg:items-stretch"> class="relative isolate flex max-w-2xl flex-col gap-x-8 gap-y-6 sm:flex-row sm:items-start lg:flex-col lg:items-stretch">

View File

@@ -0,0 +1,52 @@
<div x-data="Components.popover({ open: false, focus: false })" x-init="init()"
@keydown.escape="onEscape"
@close-popover-group.window="onClosePopoverGroup">
<button type="button"
class="flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900"
@click="toggle" @mousedown="if (open) $event.preventDefault()" aria-expanded="true"
:aria-expanded="open.toString()">
{{ __('Settings') }}
<svg class="h-5 w-5 flex-none text-gray-400" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
clip-rule="evenodd"></path>
</svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 -translate-y-1"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 -translate-y-1"
x-description="'Product' flyout menu, show/hide based on flyout menu state."
class="absolute inset-x-0 top-0 -z-10 bg-white pt-16 shadow-lg ring-1 ring-gray-900/5"
x-ref="panel" @click.away="open = false" x-cloak>
<div
class="mx-auto grid max-w-7xl grid-cols-1 gap-y-10 gap-x-8 py-10 px-6 lg:grid-cols-2 lg:px-8">
<div class="grid grid-cols-1 gap-10 sm:gap-8 lg:grid-cols-3">
<h3 class="sr-only">{{ __('Settings') }}</h3>
<x-select label="{{ __('Timezone') }}" :clearable="false" wire:model.debounce="timezone"
id="timezone"
:options="collect(Timezonelist::toArray(false))->collapse()->keys()"/>
<x-native-select
label="{{ __('Change country') }}"
wire:model="c"
option-label="name"
option-value="code"
:options="$countries"
/>
<x-select
label="{{ __('Change language') }}"
wire:model="l"
:clearable="false"
:searchable="true"
:async-data="route('api.languages.index')"
option-label="name"
option-value="language"
/>
</div>
</div>
</div>
</div>