This commit is contained in:
salam committed 2025-09-25 14:37:34 +02:00
1 parent 5f95289079
commit 60249dffd9
37 files changed
+412 -458

No files matched your search

+32 -86
View File
@@ -7,6 +7,7 @@ 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;
@@ -18,6 +19,8 @@ use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
class Register extends BaseRegister
{
public User $user;
public function form(Schema $schema): Schema
{
return $schema
@@ -39,28 +42,35 @@ class Register extends BaseRegister
->description('Mit einem Konto verbinden.')
->schema([
$this->getKontoModusFormComponent(),
/** OLD */
/** BESTEHENDES KONTO */
$this->getKontoFormComponent(),
/** NEU */
Fieldset::make('Rechnungsdaten')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getCompanyFormComponent(),
$this->getUIDFormComponent(),
$this->getPLZFormComponent(),
$this->getLocationFormComponent(),
$this->getAdresseFormComponent(),
$this->getCountryFormComponent(),
TextInput::make('company')
->label('Firma')
->required(),
TextInput::make('uid_number')
->label('UID Nummer')
->rules([new VatNumber])
->required(),
Textarea::make('address')
->label('Adresse')
->required(),
TextInput::make('country')
->label('Land')
->default('Österreich')
->required(),
])->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(),
// $this->getKontoGenderFormComponent(),
// $this->getTitleFormComponent(),
// $this->getNameFormComponent(),
// $this->getKontoEmailFormComponent(),
// $this->getPhoneFormComponent(),
])->columnSpan(4),
]),
@@ -72,7 +82,9 @@ class Register extends BaseRegister
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(),
Checkbox::make('agb_akzeptiert')
->label('ABG akzeptieren')
->required(),
]),
View::make('pages.agb'),
@@ -130,7 +142,7 @@ 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('konto_company', 'id'))
->options(Konto::query()->pluck('company', 'id'))
->searchable()
->required();
}
@@ -138,17 +150,9 @@ class Register extends BaseRegister
/**
* 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')
return TextInput::make('title')
->label('Title')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
@@ -156,7 +160,7 @@ class Register extends BaseRegister
protected function getKontoGenderFormComponent(): Select
{
return Select::make('konto_gender')
return Select::make('gender')
->columnSpan(2)
->label('Geschlecht')
->visible(fn (Get $get): bool => $get('konto') == 'new')
@@ -168,25 +172,9 @@ class Register extends BaseRegister
->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')
return TextInput::make('konto.company')
->label('Firma')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->required();
@@ -194,60 +182,18 @@ class Register extends BaseRegister
protected function getKontoEmailFormComponent(): TextInput
{
return TextInput::make('konto_email')
return TextInput::make('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')
return PhoneInput::make('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();
}
}