agb registrierung wip

This commit is contained in:
salam committed 2025-09-21 08:28:49 +02:00
1 parent b5d090cf5e
commit 04e2797667
13 files changed
+343 -68

No files matched your search

+37 -21
View File
@@ -5,11 +5,13 @@ namespace App\Filament\Pages\Auth;
use App\Models\Konto;
use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber;
use Filament\Auth\Pages\Register as BaseRegister;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\View;
use Filament\Schemas\Components\Wizard;
use Filament\Schemas\Components\Wizard\Step;
use Filament\Schemas\Schema;
@@ -36,32 +38,53 @@ class Register extends BaseRegister
->icon('lucide-key-square')
->description('Mit einem Konto verbinden.')
->schema([
$this->getKontoFormComponent(),
$this->getKontoModusFormComponent(),
/** OLD */
$this->selectKontoFormComponent(),
$this->getKontoFormComponent(),
/** NEU */
Fieldset::make('Rechnungsdaten')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getCompanyFormComponent(),
$this->getUIDFormComponent(),
$this->getPlaceFormComponent(),
$this->getLocationFormComponent(),
$this->getPLZFormComponent(),
$this->getCountryFormComponent(),
$this->getAdresseFormComponent(),
$this->getGenderFormComponent(),
$this->getFirstNameFormComponent(),
$this->getLastNameFormComponent(),
$this->getPhoneFormComponent(),
$this->getKontoEmailFormComponent(),
$this->getPhoneFormComponent(),
])->columnSpan(4),
]),
Wizard\Step::make('AGB')
->icon('lucide-key-square')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->description(' Allgemein Geschäftsbedignugen')
->schema([
Fieldset::make('Bitte lesen und akzeptieren Sie die allgemeinen Geschäftsbedignungen um die Registrierung abzuschließen.')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getABGFormComponent(),
])->columnSpan(4),
View::make('pages.agb'),
]),
]),
]);
}
protected function getABGFormComponent(): Checkbox
{
return Checkbox::make('agb_akzeptiert')
->label('ABG akzeptieren')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getPhoneFormComponent(): PhoneInput
{
return PhoneInput::make('phone')
@@ -74,16 +97,17 @@ class Register extends BaseRegister
{
return TextInput::make('country')
->label('Land')
->placeholder('Österreich')
->default('Österreich')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
}
protected function getKontoEmailFormComponent(): TextInput
{
return TextInput::make('konto-email')
return TextInput::make('kontoemail')
->label('E-Mail')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->unique(table: Konto::class)
->required();
}
@@ -95,9 +119,9 @@ class Register extends BaseRegister
->required();
}
protected function getPlaceFormComponent(): TextInput
protected function getLocationFormComponent(): TextInput
{
return TextInput::make('place')
return TextInput::make('location')
->label('Ort')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
@@ -144,17 +168,6 @@ class Register extends BaseRegister
->required();
}
protected function getRoleFormComponent(): Select
{
return Select::make('role')
->options([
'gutachter' => 'Gutachter',
'super_admin' => 'Administrator',
])
->default('gutachter')
->required();
}
protected function getGenderFormComponent(): Select
{
return Select::make('gender')
@@ -169,7 +182,7 @@ class Register extends BaseRegister
->required();
}
protected function getKontoFormComponent(): Select
protected function getKontoModusFormComponent(): Select
{
return Select::make('konto')
->columnSpan(4)
@@ -187,11 +200,14 @@ class Register extends BaseRegister
->required();
}
protected function selectKontoFormComponent(): Select
protected function getKontoFormComponent(): Select
{
return Select::make('konto_id')
->columnSpan(4)
->label('Konto auswählen')
->belowLabel([
'Um das erstellte Profil zu aktivieren muß der Kontoinhaber die Anmeldung im Programm freischalten',
])
->visible(fn (Get $get): bool => $get('konto') == 'old')
->options(Konto::query()->pluck('company', 'id'))
->searchable()
@@ -21,7 +21,7 @@ class KontosTable
TextColumn::make('last_name')->label('Nachname'),
TextColumn::make('company')->label('Firma'),
TextColumn::make('address')->label('Adresse'),
TextColumn::make('place')->label('Ort'),
TextColumn::make('location')->label('Ort'),
TextColumn::make('code')->label('PLZ'),
TextColumn::make('phone')->label('Telefon'),
TextColumn::make('uid_number')->label('UID Nummer'),