registrierung wip
This commit is contained in:
1 parent
24871d41a9
commit
09bcc5e13e
9 files changed
+248
-181
No files matched your search
@@ -7,7 +7,6 @@ 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;
|
||||
@@ -28,11 +27,12 @@ class Register extends BaseRegister
|
||||
->icon('lucide-user-plus')
|
||||
->description('Benutzer anlegen.')
|
||||
->schema([
|
||||
$this->getGenderFormComponent(),
|
||||
$this->getNameFormComponent(),
|
||||
$this->getEmailFormComponent(),
|
||||
$this->getPasswordFormComponent(),
|
||||
$this->getPasswordConfirmationFormComponent(),
|
||||
]),
|
||||
])->columnSpan(3),
|
||||
Wizard\Step::make('Konto')
|
||||
// ->columns(4)
|
||||
->icon('lucide-key-square')
|
||||
@@ -47,20 +47,25 @@ class Register extends BaseRegister
|
||||
->schema([
|
||||
$this->getCompanyFormComponent(),
|
||||
$this->getUIDFormComponent(),
|
||||
$this->getLocationFormComponent(),
|
||||
$this->getPLZFormComponent(),
|
||||
$this->getCountryFormComponent(),
|
||||
$this->getLocationFormComponent(),
|
||||
$this->getAdresseFormComponent(),
|
||||
$this->getGenderFormComponent(),
|
||||
$this->getFirstNameFormComponent(),
|
||||
$this->getLastNameFormComponent(),
|
||||
$this->getCountryFormComponent(),
|
||||
])->columnSpan(4),
|
||||
Fieldset::make('Kontaktperson')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->schema([
|
||||
$this->getKontoGenderFormComponent(),
|
||||
$this->getTitleFormComponent(),
|
||||
$this->getKontoFirstNameFormComponent(),
|
||||
$this->getKontoLastNameFormComponent(),
|
||||
$this->getKontoEmailFormComponent(),
|
||||
$this->getPhoneFormComponent(),
|
||||
])->columnSpan(4),
|
||||
|
||||
]),
|
||||
Wizard\Step::make('AGB')
|
||||
->icon('lucide-key-square')
|
||||
->icon('lucide-receipt-text')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->description(' Allgemein Geschäftsbedignugen')
|
||||
->schema([
|
||||
@@ -68,7 +73,7 @@ class Register extends BaseRegister
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->schema([
|
||||
$this->getABGFormComponent(),
|
||||
])->columnSpan(4),
|
||||
]),
|
||||
|
||||
View::make('pages.agb'),
|
||||
]),
|
||||
@@ -77,111 +82,9 @@ class Register extends BaseRegister
|
||||
]);
|
||||
}
|
||||
|
||||
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')
|
||||
->label('Telefon')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->defaultCountry('AT');
|
||||
}
|
||||
|
||||
protected function getCountryFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('country')
|
||||
->label('Land')
|
||||
->default('Österreich')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getKontoEmailFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('kontoemail')
|
||||
->label('E-Mail')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->unique(table: Konto::class)
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getPLZFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('code')
|
||||
->label('Postleitzahl')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getLocationFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('location')
|
||||
->label('Ort')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getAdresseFormComponent(): Textarea
|
||||
{
|
||||
return Textarea::make('address')
|
||||
->label('Adresse')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getFirstNameFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('first_name')
|
||||
->label('Vorname')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getLastNameFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('last_name')
|
||||
->label('Nachname')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getUIDFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('uid_number')
|
||||
->label('UID Nummer')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->rules([new VatNumber])
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getCompanyFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('company')
|
||||
->label('Firma')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getGenderFormComponent(): Select
|
||||
{
|
||||
return Select::make('gender')
|
||||
->columnSpan(2)
|
||||
->label('Geschlecht')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required();
|
||||
}
|
||||
|
||||
/**
|
||||
* MODUS
|
||||
*/
|
||||
protected function getKontoModusFormComponent(): Select
|
||||
{
|
||||
return Select::make('konto')
|
||||
@@ -200,6 +103,24 @@ class Register extends BaseRegister
|
||||
->required();
|
||||
}
|
||||
|
||||
/**
|
||||
* USER
|
||||
*/
|
||||
protected function getGenderFormComponent(): Select
|
||||
{
|
||||
return Select::make('gender')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required();
|
||||
}
|
||||
|
||||
/**
|
||||
* KONTO WÄHLEN
|
||||
*/
|
||||
protected function getKontoFormComponent(): Select
|
||||
{
|
||||
return Select::make('konto_id')
|
||||
@@ -209,8 +130,124 @@ class Register extends BaseRegister
|
||||
'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'))
|
||||
->options(Konto::query()->pluck('konto_company', 'id'))
|
||||
->searchable()
|
||||
->required();
|
||||
}
|
||||
|
||||
/**
|
||||
* KONTO NEU
|
||||
*/
|
||||
protected function getABGFormComponent(): Checkbox
|
||||
{
|
||||
return Checkbox::make('konto_agb_akzeptiert')
|
||||
->label('ABG akzeptieren')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getTitleFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_title')
|
||||
->label('Title')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getKontoGenderFormComponent(): Select
|
||||
{
|
||||
return Select::make('konto_gender')
|
||||
->columnSpan(2)
|
||||
->label('Geschlecht')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getKontoFirstNameFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_first_name')
|
||||
->label('Vorname')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getKontoLastNameFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_last_name')
|
||||
->label('Nachname')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getCompanyFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_company')
|
||||
->label('Firma')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getKontoEmailFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_email')
|
||||
->label('E-Mail')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->unique(table: Konto::class)
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getAdresseFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_address')
|
||||
->label('Adresse')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getLocationFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_location')
|
||||
->label('Ort')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getPLZFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_plz')
|
||||
->label('Postleitzahl')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getPhoneFormComponent(): PhoneInput
|
||||
{
|
||||
return PhoneInput::make('konto_phone')
|
||||
->label('Telefon')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->defaultCountry('AT');
|
||||
}
|
||||
|
||||
protected function getCountryFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_country')
|
||||
->label('Land')
|
||||
->default('Österreich')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->required();
|
||||
}
|
||||
|
||||
protected function getUIDFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('konto_uid_number')
|
||||
->label('UID Nummer')
|
||||
->visible(fn (Get $get): bool => $get('konto') == 'new')
|
||||
->rules([new VatNumber])
|
||||
->required();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user