23-01-2026

This commit is contained in:
Kevin Adametz 2026-01-23 17:33:10 +01:00
parent 07959c0ba2
commit 854ce02bf6
166 changed files with 32909 additions and 1262 deletions

View file

@ -18,6 +18,7 @@ new class extends Component {
public string $email = '';
public bool $showSuccessMessage = false;
public ?PartnerInvitation $lastInvitation = null;
public int $expiryWeeks = 1;
public function getPartnerRoles()
{
@ -44,6 +45,7 @@ new class extends Component {
'contactLastName' => 'nullable|string|max:255',
'roleId' => 'required|exists:roles,id|in:' . implode(',', $availableRoleIds),
'email' => 'required|email|max:255|unique:users,email',
'expiryWeeks' => 'required|integer|in:1,2,3,4',
], [
'companyName.required' => __('Bitte geben Sie einen Firmennamen ein.'),
'companyName.max' => __('Der Firmenname darf maximal 255 Zeichen lang sein.'),
@ -55,6 +57,8 @@ new class extends Component {
'email.email' => __('Bitte geben Sie eine gültige E-Mail-Adresse ein.'),
'email.max' => __('Die E-Mail-Adresse darf maximal 255 Zeichen lang sein.'),
'email.unique' => __('Diese E-Mail-Adresse ist bereits als Benutzer registriert.'),
'expiryWeeks.required' => __('Bitte wählen Sie eine Gültigkeitsdauer aus.'),
'expiryWeeks.in' => __('Die Gültigkeitsdauer muss zwischen 1 und 4 Wochen liegen.'),
]);
// Prüfe ob bereits eine aktive Einladung existiert
@ -76,7 +80,7 @@ new class extends Component {
'email' => $this->email,
'token' => PartnerInvitation::generateToken(),
'status' => 'pending',
'expires_at' => now()->addDays(7), // 7 Tage gültig
'expires_at' => now()->addWeeks($this->expiryWeeks),
'invited_by' => auth()->id(),
]);
@ -91,11 +95,12 @@ new class extends Component {
$this->showSuccessMessage = true;
// Reset Form
$this->reset(['companyName', 'contactFirstName', 'contactLastName', 'roleId', 'email']);
$this->reset(['companyName', 'contactFirstName', 'contactLastName', 'roleId', 'email', 'expiryWeeks']);
// Setze default Rolle wieder
$firstRole = $this->getPartnerRoles()->first();
$this->roleId = $firstRole?->id;
$this->expiryWeeks = 1;
session()->flash('message', __('Einladung erfolgreich versendet!'));
} catch (\Exception $e) {
@ -226,6 +231,19 @@ new class extends Component {
@error('roleId') <flux:error>{{ $message }}</flux:error> @enderror
</flux:field>
<flux:field>
<flux:label>{{ __('Gültigkeit der Einladung') }}</flux:label>
<flux:description>{{ __('Wählen Sie zwischen 1 und 4 Wochen') }}</flux:description>
<flux:select wire:model="expiryWeeks">
@for($i = 1; $i <= 4; $i++)
<flux:select.option :value="$i">
{{ $i }} {{ $i === 1 ? __('Woche') : __('Wochen') }}
</flux:select.option>
@endfor
</flux:select>
@error('expiryWeeks') <flux:error>{{ $message }}</flux:error> @enderror
</flux:field>
<flux:field>
<flux:label>{{ __('E-Mail Adresse') }}</flux:label>
<flux:description>{{ __('E-Mail des Ansprechpartners') }}</flux:description>

File diff suppressed because it is too large Load diff