Initial commit

This commit is contained in:
2025-12-20 15:43:22 +01:00
commit c693f7c7ed
127 changed files with 17921 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<x-auth-header
:title="__('Confirm password')"
:description="__('This is a secure area of the application. Please confirm your password before continuing.')"
/>
<x-auth-session-status class="text-center" :status="session('status')" />
<form method="POST" action="{{ route('password.confirm.store') }}" class="flex flex-col gap-6">
@csrf
<flux:input
name="password"
:label="__('Password')"
type="password"
required
autocomplete="current-password"
:placeholder="__('Password')"
viewable
/>
<flux:button variant="primary" type="submit" class="w-full" data-test="confirm-password-button">
{{ __('Confirm') }}
</flux:button>
</form>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,31 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<x-auth-header :title="__('Forgot password')" :description="__('Enter your email to receive a password reset link')" />
<!-- Session Status -->
<x-auth-session-status class="text-center" :status="session('status')" />
<form method="POST" action="{{ route('password.email') }}" class="flex flex-col gap-6">
@csrf
<!-- Email Address -->
<flux:input
name="email"
:label="__('Email Address')"
type="email"
required
autofocus
placeholder="email@example.com"
/>
<flux:button variant="primary" type="submit" class="w-full" data-test="email-password-reset-link-button">
{{ __('Email password reset link') }}
</flux:button>
</form>
<div class="space-x-1 rtl:space-x-reverse text-center text-sm text-zinc-400">
<span>{{ __('Or, return to') }}</span>
<flux:link :href="route('login')" wire:navigate>{{ __('log in') }}</flux:link>
</div>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,59 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<x-auth-header :title="__('Log in to your account')" :description="__('Enter your email and password below to log in')" />
<!-- Session Status -->
<x-auth-session-status class="text-center" :status="session('status')" />
<form method="POST" action="{{ route('login.store') }}" class="flex flex-col gap-6">
@csrf
<!-- Email Address -->
<flux:input
name="email"
:label="__('Email address')"
:value="old('email')"
type="email"
required
autofocus
autocomplete="email"
placeholder="email@example.com"
/>
<!-- Password -->
<div class="relative">
<flux:input
name="password"
:label="__('Password')"
type="password"
required
autocomplete="current-password"
:placeholder="__('Password')"
viewable
/>
@if (Route::has('password.request'))
<flux:link class="absolute top-0 text-sm end-0" :href="route('password.request')" wire:navigate>
{{ __('Forgot your password?') }}
</flux:link>
@endif
</div>
<!-- Remember Me -->
<flux:checkbox name="remember" :label="__('Remember me')" :checked="old('remember')" />
<div class="flex items-center justify-end">
<flux:button variant="primary" type="submit" class="w-full" data-test="login-button">
{{ __('Log in') }}
</flux:button>
</div>
</form>
@if (Route::has('register'))
<div class="space-x-1 text-sm text-center rtl:space-x-reverse text-zinc-600 dark:text-zinc-400">
<span>{{ __('Don\'t have an account?') }}</span>
<flux:link :href="route('register')" wire:navigate>{{ __('Sign up') }}</flux:link>
</div>
@endif
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,68 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<x-auth-header :title="__('Create an account')" :description="__('Enter your details below to create your account')" />
<!-- Session Status -->
<x-auth-session-status class="text-center" :status="session('status')" />
<form method="POST" action="{{ route('register.store') }}" class="flex flex-col gap-6">
@csrf
<!-- Name -->
<flux:input
name="name"
:label="__('Name')"
:value="old('name')"
type="text"
required
autofocus
autocomplete="name"
:placeholder="__('Full name')"
/>
<!-- Email Address -->
<flux:input
name="email"
:label="__('Email address')"
:value="old('email')"
type="email"
required
autocomplete="email"
placeholder="email@example.com"
/>
<!-- Password -->
<flux:input
name="password"
:label="__('Password')"
type="password"
required
autocomplete="new-password"
:placeholder="__('Password')"
viewable
/>
<!-- Confirm Password -->
<flux:input
name="password_confirmation"
:label="__('Confirm password')"
type="password"
required
autocomplete="new-password"
:placeholder="__('Confirm password')"
viewable
/>
<div class="flex items-center justify-end">
<flux:button type="submit" variant="primary" class="w-full">
{{ __('Create account') }}
</flux:button>
</div>
</form>
<div class="space-x-1 rtl:space-x-reverse text-center text-sm text-zinc-600 dark:text-zinc-400">
<span>{{ __('Already have an account?') }}</span>
<flux:link :href="route('login')" wire:navigate>{{ __('Log in') }}</flux:link>
</div>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,52 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<x-auth-header :title="__('Reset password')" :description="__('Please enter your new password below')" />
<!-- Session Status -->
<x-auth-session-status class="text-center" :status="session('status')" />
<form method="POST" action="{{ route('password.update') }}" class="flex flex-col gap-6">
@csrf
<!-- Token -->
<input type="hidden" name="token" value="{{ request()->route('token') }}">
<!-- Email Address -->
<flux:input
name="email"
value="{{ request('email') }}"
:label="__('Email')"
type="email"
required
autocomplete="email"
/>
<!-- Password -->
<flux:input
name="password"
:label="__('Password')"
type="password"
required
autocomplete="new-password"
:placeholder="__('Password')"
viewable
/>
<!-- Confirm Password -->
<flux:input
name="password_confirmation"
:label="__('Confirm password')"
type="password"
required
autocomplete="new-password"
:placeholder="__('Confirm password')"
viewable
/>
<div class="flex items-center justify-end">
<flux:button type="submit" variant="primary" class="w-full" data-test="reset-password-button">
{{ __('Reset password') }}
</flux:button>
</div>
</form>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,95 @@
<x-layouts.auth>
<div class="flex flex-col gap-6">
<div
class="relative w-full h-auto"
x-cloak
x-data="{
showRecoveryInput: @js($errors->has('recovery_code')),
code: '',
recovery_code: '',
toggleInput() {
this.showRecoveryInput = !this.showRecoveryInput;
this.code = '';
this.recovery_code = '';
$dispatch('clear-2fa-auth-code');
$nextTick(() => {
this.showRecoveryInput
? this.$refs.recovery_code?.focus()
: $dispatch('focus-2fa-auth-code');
});
},
}"
>
<div x-show="!showRecoveryInput">
<x-auth-header
:title="__('Authentication Code')"
:description="__('Enter the authentication code provided by your authenticator application.')"
/>
</div>
<div x-show="showRecoveryInput">
<x-auth-header
:title="__('Recovery Code')"
:description="__('Please confirm access to your account by entering one of your emergency recovery codes.')"
/>
</div>
<form method="POST" action="{{ route('two-factor.login.store') }}">
@csrf
<div class="space-y-5 text-center">
<div x-show="!showRecoveryInput">
<div class="flex items-center justify-center my-5">
<flux:otp
x-model="code"
length="6"
name="code"
label="OTP Code"
label:sr-only
class="mx-auto"
/>
</div>
</div>
<div x-show="showRecoveryInput">
<div class="my-5">
<flux:input
type="text"
name="recovery_code"
x-ref="recovery_code"
x-bind:required="showRecoveryInput"
autocomplete="one-time-code"
x-model="recovery_code"
/>
</div>
@error('recovery_code')
<flux:text color="red">
{{ $message }}
</flux:text>
@enderror
</div>
<flux:button
variant="primary"
type="submit"
class="w-full"
>
{{ __('Continue') }}
</flux:button>
</div>
<div class="mt-5 space-x-0.5 text-sm leading-5 text-center">
<span class="opacity-50">{{ __('or you can') }}</span>
<div class="inline font-medium underline cursor-pointer opacity-80">
<span x-show="!showRecoveryInput" @click="toggleInput()">{{ __('login using a recovery code') }}</span>
<span x-show="showRecoveryInput" @click="toggleInput()">{{ __('login using an authentication code') }}</span>
</div>
</div>
</form>
</div>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,29 @@
<x-layouts.auth>
<div class="mt-4 flex flex-col gap-6">
<flux:text class="text-center">
{{ __('Please verify your email address by clicking on the link we just emailed to you.') }}
</flux:text>
@if (session('status') == 'verification-link-sent')
<flux:text class="text-center font-medium !dark:text-green-400 !text-green-600">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</flux:text>
@endif
<div class="flex flex-col items-center justify-between space-y-3">
<form method="POST" action="{{ route('verification.send') }}">
@csrf
<flux:button type="submit" variant="primary" class="w-full">
{{ __('Resend verification email') }}
</flux:button>
</form>
<form method="POST" action="{{ route('logout') }}">
@csrf
<flux:button variant="ghost" type="submit" class="text-sm cursor-pointer" data-test="logout-button">
{{ __('Log out') }}
</flux:button>
</form>
</div>
</div>
</x-layouts.auth>

View File

@@ -0,0 +1,60 @@
<div class="container mx-auto py-8">
<h1 class="text-2xl font-bold mb-6">Sök person</h1>
<form wire:submit.prevent="search" class="mb-8 flex flex-col md:flex-row gap-4 items-end">
<div class="flex-1">
<label for="firstName" class="block text-sm font-medium">Förnamn</label>
<input id="firstName" type="text" wire:model.defer="firstName" class="mt-1 block w-full border rounded px-3 py-2" placeholder="Förnamn...">
</div>
<div class="flex-1">
<label for="lastName" class="block text-sm font-medium">Efternamn</label>
<input id="lastName" type="text" wire:model.defer="lastName" class="mt-1 block w-full border rounded px-3 py-2" placeholder="Efternamn...">
</div>
<div>
<label for="party" class="block text-sm font-medium">Parti</label>
<select id="party" wire:model.defer="party" class="mt-1 block w-full border rounded px-3 py-2">
<option value="" class="text-black">Alla partier</option>
@foreach($parties as $partyOption)
<option class="text-black" value="{{ $partyOption->value }}">{{ $partyOption->label() }}</option>
@endforeach
</select>
</div>
<button type="submit" class="bg-blue-600 text-white px-6 py-2 rounded">Sök</button>
</form>
<div class="text-center" wire:loading>
<div role="status">
<svg aria-hidden="true" class="w-8 h-8 text-neutral-tertiary animate-spin fill-brand" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span class="sr-only">Loading...</span>
</div>
</div>
@if($results && isset($results->personlista->person))
<div class="shadow rounded p-4">
<h2 class="text-lg font-semibold mb-4">Resultat</h2>
<ul>
@php
$persons = $results->personlista->person;
if (!is_array($persons) || (isset($persons->intressent_id) && is_string($persons->intressent_id))) {
$persons = [$persons];
}
@endphp
@foreach($persons as $person)
<li class="mb-4 flex items-center border-b pb-4">
<img src="{{ $person->bild_url_192 ?? '' }}" alt="{{ $person->tilltalsnamn }}" class="w-16 h-16 rounded mr-4">
<div class="flex-1">
<a wire:navigate href="{{ route('person.show', $person->intressent_id) }}" class="text-blue-700 font-bold text-lg hover:underline">
{{ $person->tilltalsnamn }} {{ $person->efternamn }}
</a>
<div class="text-sm text-gray-600">{{ $person->parti }} | {{ $person->valkrets }}</div>
</div>
</li>
@endforeach
</ul>
</div>
@elseif($results && (!isset($results->personlista->person) || empty($results->personlista->person)))
<div class="text-red-600">Inga personer hittades.</div>
@endif
</div>

View File

@@ -0,0 +1,208 @@
<div class="container mx-auto py-8">
@if($person)
<div class="flex flex-col md:flex-row gap-8">
<div>
<img src="{{ $person->bild_url_max ?? '' }}" alt="{{ $person->tilltalsnamn }}" class="w-48 h-64 object-cover rounded shadow">
</div>
<div class="flex-1">
<h1 class="text-3xl font-bold mb-2">{{ $person->tilltalsnamn }} {{ $person->efternamn }}</h1>
<div class="mb-2 text-lg text-gray-500">{{ $person->parti }} | {{ $person->valkrets }}</div>
<div class="mb-2">Född: {{ $person->fodd_ar }} | Kön: {{ ucfirst($person->kon) }}</div>
<div class="mb-2">Status: {{ $person->status }}</div>
<div class="mb-2">E-post: {{ str_replace('[på]', '@', collect($person->personuppgift->uppgift ?? [])->firstWhere('kod', 'Officiell e-postadress')->uppgift[0] ?? '-') }}</div>
<div class="mb-4">
<a href="{{ $this->riksdagen_url }}" class="text-blue-600 underline" target="_blank">Visa riksdagen.se</a>
</div>
<h2 class="text-xl font-semibold mt-6 mb-4">Uppdrag</h2>
<!-- Uppdrag tabs -->
<div class="border-b border-gray-200 mb-4">
<nav class="-mb-px flex space-x-8">
<button
wire:click="selectUppdragTab('current')"
class="py-2 cursor-pointer px-1 border-b-2 font-medium text-sm {{ $selectedUppdragTab == 'current' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' }}">
Pågående ({{ count($currentUppdrag) }})
</button>
<button
wire:click="selectUppdragTab('previous')"
class="py-2 cursor-pointer px-1 border-b-2 font-medium text-sm {{ $selectedUppdragTab == 'previous' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' }}">
Tidigare ({{ count($previousUppdrag) }})
</button>
</nav>
</div>
<!-- Current assignments -->
@if($selectedUppdragTab == 'current' && !empty($currentUppdrag))
<div class="space-y-3">
@foreach($currentUppdrag as $uppdrag)
<div class="bg-green-50 border border-green-200 rounded-lg p-4">
<div class="flex justify-between items-start">
<div>
<h4 class="font-semibold text-green-800">{{ $uppdrag->roll_kod }}</h4>
{{-- @if(!empty($uppdrag->uppgift[0]) && is_array($uppdrag->uppgift))
<p class="text-sm text-green-700 mt-1">{{ implode(', ', $uppdrag->uppgift) }}</p>
@endif --}}
<p class="text-sm text-green-600 mt-2">
<span class="font-medium">Typ:</span> {{ ucfirst($uppdrag->typ) }}
@if(isset($uppdrag->status) && $uppdrag->status)
| <span class="font-medium">Status:</span> {{ $uppdrag->status }}
@endif
</p>
</div>
<div class="text-right text-sm text-green-600">
<div>Från: {{ Carbon\Carbon::parse($uppdrag->from)->format('Y-m-d') }}</div>
@if(!empty($uppdrag->tom))
<div>Till: {{ Carbon\Carbon::parse($uppdrag->tom)->format('Y-m-d') }}</div>
@else
<div class="font-semibold text-green-700">Pågående</div>
@endif
</div>
</div>
</div>
@endforeach
</div>
@elseif($selectedUppdragTab == 'current' && empty($currentUppdrag))
<p class="text-gray-500 italic">Inga pågående uppdrag.</p>
@endif
<!-- Previous assignments -->
@if($selectedUppdragTab == 'previous' && !empty($previousUppdrag))
<div class="space-y-3">
@foreach($previousUppdrag as $uppdrag)
<div class="bg-gray-50 border border-gray-200 rounded-lg p-4">
<div class="flex justify-between items-start">
<div>
<h4 class="font-semibold text-gray-800">{{ $uppdrag->roll_kod }}</h4>
{{-- @if(!empty($uppdrag->uppgift[0]) && is_array($uppdrag->uppgift))
<p class="text-sm text-gray-700 mt-1">{{ implode(', ', $uppdrag->uppgift) }}</p>
@endif --}}
<p class="text-sm text-gray-600 mt-2">
<span class="font-medium">Typ:</span> {{ ucfirst($uppdrag->typ) }}
@if(isset($uppdrag->status) && $uppdrag->status)
| <span class="font-medium">Status:</span> {{ $uppdrag->status }}
@endif
</p>
</div>
<div class="text-right text-sm text-gray-600">
<div>{{ Carbon\Carbon::parse($uppdrag->from)->format('Y-m-d') }} - {{ Carbon\Carbon::parse($uppdrag->tom)->format('Y-m-d') }}</div>
<div class="text-xs text-gray-500 mt-1">
{{ Carbon\Carbon::parse($uppdrag->from)->diffForHumans(Carbon\Carbon::parse($uppdrag->tom), true) }}
</div>
</div>
</div>
</div>
@endforeach
</div>
@elseif($selectedUppdragTab == 'previous' && empty($previousUppdrag))
<p class="text-gray-500 italic">Inga tidigare uppdrag registrerade.</p>
@endif
<h2 class="text-xl font-semibold mt-6 mb-2">Biografi</h2>
<ul class="list-disc ml-6">
@foreach(collect($person->personuppgift->uppgift ?? [])->where('typ', 'biografi') as $bio)
<li>
<strong>{{ $bio->kod }}:</strong> {{ is_array($bio->uppgift) ? implode(', ', $bio->uppgift) : $bio->uppgift }}
</li>
@endforeach
</ul>
@if(!empty($votesByYear))
<h2 class="text-xl font-semibold mt-6 mb-4">Voteringar</h2>
<!-- Year tabs -->
<div class="border-b border-gray-200 mb-4">
<nav class="-mb-px flex space-x-8">
@foreach(array_keys($votesByYear) as $year)
<button
wire:click="selectYear('{{ $year }}')"
class="cursor-pointer py-2 px-1 border-b-2 font-medium text-sm {{ $selectedYear == $year ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' }}">
{{ $year }}
</button>
@endforeach
</nav>
</div>
@if($selectedYear && isset($votesByYear[$selectedYear]))
<!-- Voting Statistics Chart -->
<div class="mb-8 bg-white p-6 rounded-lg shadow border">
<h3 class="text-lg font-semibold mb-4">Röststatistik för {{ $selectedYear }}</h3>
@if(!empty($this->votingStatistics))
<div class="flex flex-col lg:flex-row gap-6">
<div class="lg:w-1/2">
<livewire:livewire-pie-chart
:pie-chart-model="$this->pieChartModel"
key="{{ 'pie-chart-'.$selectedYear }}"
/>
</div>
<div class="lg:w-1/2">
<div class="space-y-2">
@foreach($this->votingStatistics as $voteType => $count)
<div class="flex justify-between items-center p-3 bg-gray-50 rounded">
<span class="font-medium">{{ $voteType }}</span>
<span class="text-lg font-bold">{{ $count }}</span>
</div>
@endforeach
<div class="flex justify-between items-center p-3 bg-blue-50 rounded border-t-2 border-blue-500">
<span class="font-bold">Totalt antal voteringar</span>
<span class="text-lg font-bold">{{ array_sum($this->votingStatistics) }}</span>
</div>
</div>
</div>
</div>
@else
<p class="text-gray-500">Ingen röststatistik tillgänglig för detta år.</p>
@endif
</div>
@endif
<!-- Votes table -->
@if($selectedYear && isset($votesByYear[$selectedYear]))
<div class="overflow-x-auto" style="overflow-y: auto; display: block; max-height: 400px;">
<table class="min-w-full bg-white border border-gray-200">
<thead class="bg-gray-50 sticky top-0">
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Datum</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Beteckning</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Punkt</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Röst</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avser</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Votering</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($votesByYear[$selectedYear] as $vote)
<tr class="hover:bg-gray-50 bg-gray-300">
<td class="px-4 py-2 text-sm text-gray-900">
{{ Carbon\Carbon::parse($vote->systemdatum)->format('Y-m-d') }}
</td>
<td class="px-4 py-2 text-sm">
<a href="{{ $vote->votering_url_xml }}" class="text-blue-600 hover:underline" target="_blank">
{{ $vote->beteckning }}
</a>
</td>
<td class="px-4 py-2 text-sm text-gray-900">{{ $vote->punkt }}</td>
<td class="px-4 py-2 text-sm">
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
{{ $vote->rost === 'Ja' ? 'bg-green-100 text-green-800' :
($vote->rost === 'Nej' ? 'bg-red-100 text-red-800' :
'bg-gray-100 text-gray-800') }}">
{{ $vote->rost }}
</span>
</td>
<td class="px-4 py-2 text-sm text-gray-900">{{ $vote->avser }}</td>
<td class="px-4 py-2 text-sm text-gray-900">{{ $vote->votering }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@endif
</div>
</div>
@else
<div class="text-red-600">Personen kunde inte hittas.</div>
@endif
<div class="mt-10 text-sm text-gray-500">
Källa: Sveriges riksdag (<a href="https://riksdagen.se/sv/" class="text-blue-600 underline" target="_blank">riksdagen.se</a>)
</div>
</div>

View File

@@ -0,0 +1,11 @@
<section class="w-full">
@include('partials.settings-heading')
<x-settings.layout :heading="__('Appearance')" :subheading=" __('Update the appearance settings for your account')">
<flux:radio.group x-data variant="segmented" x-model="$flux.appearance">
<flux:radio value="light" icon="sun">{{ __('Light') }}</flux:radio>
<flux:radio value="dark" icon="moon">{{ __('Dark') }}</flux:radio>
<flux:radio value="system" icon="computer-desktop">{{ __('System') }}</flux:radio>
</flux:radio.group>
</x-settings.layout>
</section>

View File

@@ -0,0 +1,34 @@
<section class="mt-10 space-y-6">
<div class="relative mb-5">
<flux:heading>{{ __('Delete account') }}</flux:heading>
<flux:subheading>{{ __('Delete your account and all of its resources') }}</flux:subheading>
</div>
<flux:modal.trigger name="confirm-user-deletion">
<flux:button variant="danger" x-data="" x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')">
{{ __('Delete account') }}
</flux:button>
</flux:modal.trigger>
<flux:modal name="confirm-user-deletion" :show="$errors->isNotEmpty()" focusable class="max-w-lg">
<form method="POST" wire:submit="deleteUser" class="space-y-6">
<div>
<flux:heading size="lg">{{ __('Are you sure you want to delete your account?') }}</flux:heading>
<flux:subheading>
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }}
</flux:subheading>
</div>
<flux:input wire:model="password" :label="__('Password')" type="password" />
<div class="flex justify-end space-x-2 rtl:space-x-reverse">
<flux:modal.close>
<flux:button variant="filled">{{ __('Cancel') }}</flux:button>
</flux:modal.close>
<flux:button variant="danger" type="submit">{{ __('Delete account') }}</flux:button>
</div>
</form>
</flux:modal>
</section>

View File

@@ -0,0 +1,39 @@
<section class="w-full">
@include('partials.settings-heading')
<x-settings.layout :heading="__('Update password')" :subheading="__('Ensure your account is using a long, random password to stay secure')">
<form method="POST" wire:submit="updatePassword" class="mt-6 space-y-6">
<flux:input
wire:model="current_password"
:label="__('Current password')"
type="password"
required
autocomplete="current-password"
/>
<flux:input
wire:model="password"
:label="__('New password')"
type="password"
required
autocomplete="new-password"
/>
<flux:input
wire:model="password_confirmation"
:label="__('Confirm Password')"
type="password"
required
autocomplete="new-password"
/>
<div class="flex items-center gap-4">
<div class="flex items-center justify-end">
<flux:button variant="primary" type="submit" class="w-full">{{ __('Save') }}</flux:button>
</div>
<x-action-message class="me-3" on="password-updated">
{{ __('Saved.') }}
</x-action-message>
</div>
</form>
</x-settings.layout>
</section>

View File

@@ -0,0 +1,43 @@
<section class="w-full">
@include('partials.settings-heading')
<x-settings.layout :heading="__('Profile')" :subheading="__('Update your name and email address')">
<form wire:submit="updateProfileInformation" class="my-6 w-full space-y-6">
<flux:input wire:model="name" :label="__('Name')" type="text" required autofocus autocomplete="name" />
<div>
<flux:input wire:model="email" :label="__('Email')" type="email" required autocomplete="email" />
@if (auth()->user() instanceof \Illuminate\Contracts\Auth\MustVerifyEmail &&! auth()->user()->hasVerifiedEmail())
<div>
<flux:text class="mt-4">
{{ __('Your email address is unverified.') }}
<flux:link class="text-sm cursor-pointer" wire:click.prevent="resendVerificationNotification">
{{ __('Click here to re-send the verification email.') }}
</flux:link>
</flux:text>
@if (session('status') === 'verification-link-sent')
<flux:text class="mt-2 font-medium !dark:text-green-400 !text-green-600">
{{ __('A new verification link has been sent to your email address.') }}
</flux:text>
@endif
</div>
@endif
</div>
<div class="flex items-center gap-4">
<div class="flex items-center justify-end">
<flux:button variant="primary" type="submit" class="w-full">{{ __('Save') }}</flux:button>
</div>
<x-action-message class="me-3" on="profile-updated">
{{ __('Saved.') }}
</x-action-message>
</div>
</form>
<livewire:settings.delete-user-form />
</x-settings.layout>
</section>

View File

@@ -0,0 +1,205 @@
<section class="w-full">
@include('partials.settings-heading')
<x-settings.layout
:heading="__('Two Factor Authentication')"
:subheading="__('Manage your two-factor authentication settings')"
>
<div class="flex flex-col w-full mx-auto space-y-6 text-sm" wire:cloak>
@if ($twoFactorEnabled)
<div class="space-y-4">
<div class="flex items-center gap-3">
<flux:badge color="green">{{ __('Enabled') }}</flux:badge>
</div>
<flux:text>
{{ __('With two-factor authentication enabled, you will be prompted for a secure, random pin during login, which you can retrieve from the TOTP-supported application on your phone.') }}
</flux:text>
<livewire:settings.two-factor.recovery-codes :$requiresConfirmation/>
<div class="flex justify-start">
<flux:button
variant="danger"
icon="shield-exclamation"
icon:variant="outline"
wire:click="disable"
>
{{ __('Disable 2FA') }}
</flux:button>
</div>
</div>
@else
<div class="space-y-4">
<div class="flex items-center gap-3">
<flux:badge color="red">{{ __('Disabled') }}</flux:badge>
</div>
<flux:text variant="subtle">
{{ __('When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can be retrieved from a TOTP-supported application on your phone.') }}
</flux:text>
<flux:button
variant="primary"
icon="shield-check"
icon:variant="outline"
wire:click="enable"
>
{{ __('Enable 2FA') }}
</flux:button>
</div>
@endif
</div>
</x-settings.layout>
<flux:modal
name="two-factor-setup-modal"
class="max-w-md md:min-w-md"
@close="closeModal"
wire:model="showModal"
>
<div class="space-y-6">
<div class="flex flex-col items-center space-y-4">
<div class="p-0.5 w-auto rounded-full border border-stone-100 dark:border-stone-600 bg-white dark:bg-stone-800 shadow-sm">
<div class="p-2.5 rounded-full border border-stone-200 dark:border-stone-600 overflow-hidden bg-stone-100 dark:bg-stone-200 relative">
<div class="flex items-stretch absolute inset-0 w-full h-full divide-x [&>div]:flex-1 divide-stone-200 dark:divide-stone-300 justify-around opacity-50">
@for ($i = 1; $i <= 5; $i++)
<div></div>
@endfor
</div>
<div class="flex flex-col items-stretch absolute w-full h-full divide-y [&>div]:flex-1 inset-0 divide-stone-200 dark:divide-stone-300 justify-around opacity-50">
@for ($i = 1; $i <= 5; $i++)
<div></div>
@endfor
</div>
<flux:icon.qr-code class="relative z-20 dark:text-accent-foreground"/>
</div>
</div>
<div class="space-y-2 text-center">
<flux:heading size="lg">{{ $this->modalConfig['title'] }}</flux:heading>
<flux:text>{{ $this->modalConfig['description'] }}</flux:text>
</div>
</div>
@if ($showVerificationStep)
<div class="space-y-6">
<div class="flex flex-col items-center space-y-3 justify-center">
<flux:otp
name="code"
wire:model="code"
length="6"
label="OTP Code"
label:sr-only
class="mx-auto"
/>
</div>
<div class="flex items-center space-x-3">
<flux:button
variant="outline"
class="flex-1"
wire:click="resetVerification"
>
{{ __('Back') }}
</flux:button>
<flux:button
variant="primary"
class="flex-1"
wire:click="confirmTwoFactor"
x-bind:disabled="$wire.code.length < 6"
>
{{ __('Confirm') }}
</flux:button>
</div>
</div>
@else
@error('setupData')
<flux:callout variant="danger" icon="x-circle" heading="{{ $message }}"/>
@enderror
<div class="flex justify-center">
<div class="relative w-64 overflow-hidden border rounded-lg border-stone-200 dark:border-stone-700 aspect-square">
@empty($qrCodeSvg)
<div class="absolute inset-0 flex items-center justify-center bg-white dark:bg-stone-700 animate-pulse">
<flux:icon.loading/>
</div>
@else
<div class="flex items-center justify-center h-full p-4">
<div class="bg-white p-3 rounded">
{!! $qrCodeSvg !!}
</div>
</div>
@endempty
</div>
</div>
<div>
<flux:button
:disabled="$errors->has('setupData')"
variant="primary"
class="w-full"
wire:click="showVerificationIfNecessary"
>
{{ $this->modalConfig['buttonText'] }}
</flux:button>
</div>
<div class="space-y-4">
<div class="relative flex items-center justify-center w-full">
<div class="absolute inset-0 w-full h-px top-1/2 bg-stone-200 dark:bg-stone-600"></div>
<span class="relative px-2 text-sm bg-white dark:bg-stone-800 text-stone-600 dark:text-stone-400">
{{ __('or, enter the code manually') }}
</span>
</div>
<div
class="flex items-center space-x-2"
x-data="{
copied: false,
async copy() {
try {
await navigator.clipboard.writeText('{{ $manualSetupKey }}');
this.copied = true;
setTimeout(() => this.copied = false, 1500);
} catch (e) {
console.warn('Could not copy to clipboard');
}
}
}"
>
<div class="flex items-stretch w-full border rounded-xl dark:border-stone-700">
@empty($manualSetupKey)
<div class="flex items-center justify-center w-full p-3 bg-stone-100 dark:bg-stone-700">
<flux:icon.loading variant="mini"/>
</div>
@else
<input
type="text"
readonly
value="{{ $manualSetupKey }}"
class="w-full p-3 bg-transparent outline-none text-stone-900 dark:text-stone-100"
/>
<button
@click="copy()"
class="px-3 transition-colors border-l cursor-pointer border-stone-200 dark:border-stone-600"
>
<flux:icon.document-duplicate x-show="!copied" variant="outline"></flux:icon>
<flux:icon.check
x-show="copied"
variant="solid"
class="text-green-500"
></flux:icon>
</button>
@endempty
</div>
</div>
</div>
@endif
</div>
</flux:modal>
</section>

View File

@@ -0,0 +1,89 @@
<div
class="py-6 space-y-6 border shadow-sm rounded-xl border-zinc-200 dark:border-white/10"
wire:cloak
x-data="{ showRecoveryCodes: false }"
>
<div class="px-6 space-y-2">
<div class="flex items-center gap-2">
<flux:icon.lock-closed variant="outline" class="size-4"/>
<flux:heading size="lg" level="3">{{ __('2FA Recovery Codes') }}</flux:heading>
</div>
<flux:text variant="subtle">
{{ __('Recovery codes let you regain access if you lose your 2FA device. Store them in a secure password manager.') }}
</flux:text>
</div>
<div class="px-6">
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<flux:button
x-show="!showRecoveryCodes"
icon="eye"
icon:variant="outline"
variant="primary"
@click="showRecoveryCodes = true;"
aria-expanded="false"
aria-controls="recovery-codes-section"
>
{{ __('View Recovery Codes') }}
</flux:button>
<flux:button
x-show="showRecoveryCodes"
icon="eye-slash"
icon:variant="outline"
variant="primary"
@click="showRecoveryCodes = false"
aria-expanded="true"
aria-controls="recovery-codes-section"
>
{{ __('Hide Recovery Codes') }}
</flux:button>
@if (filled($recoveryCodes))
<flux:button
x-show="showRecoveryCodes"
icon="arrow-path"
variant="filled"
wire:click="regenerateRecoveryCodes"
>
{{ __('Regenerate Codes') }}
</flux:button>
@endif
</div>
<div
x-show="showRecoveryCodes"
x-transition
id="recovery-codes-section"
class="relative overflow-hidden"
x-bind:aria-hidden="!showRecoveryCodes"
>
<div class="mt-3 space-y-3">
@error('recoveryCodes')
<flux:callout variant="danger" icon="x-circle" heading="{{$message}}"/>
@enderror
@if (filled($recoveryCodes))
<div
class="grid gap-1 p-4 font-mono text-sm rounded-lg bg-zinc-100 dark:bg-white/5"
role="list"
aria-label="Recovery codes"
>
@foreach($recoveryCodes as $code)
<div
role="listitem"
class="select-text"
wire:loading.class="opacity-50 animate-pulse"
>
{{ $code }}
</div>
@endforeach
</div>
<flux:text variant="subtle" class="text-xs">
{{ __('Each recovery code can be used once to access your account and will be removed after use. If you need more, click Regenerate Codes above.') }}
</flux:text>
@endif
</div>
</div>
</div>
</div>