registrierung wip

This commit is contained in:
salam committed 2025-09-21 18:10:18 +02:00
1 parent 24871d41a9
commit 09bcc5e13e
9 files changed
+248 -181

No files matched your search

+152 -115
View File
@@ -7,7 +7,6 @@ use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber;
use Filament\Auth\Pages\Register as BaseRegister; use Filament\Auth\Pages\Register as BaseRegister;
use Filament\Forms\Components\Checkbox; use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Fieldset; use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
@@ -28,11 +27,12 @@ class Register extends BaseRegister
->icon('lucide-user-plus') ->icon('lucide-user-plus')
->description('Benutzer anlegen.') ->description('Benutzer anlegen.')
->schema([ ->schema([
$this->getGenderFormComponent(),
$this->getNameFormComponent(), $this->getNameFormComponent(),
$this->getEmailFormComponent(), $this->getEmailFormComponent(),
$this->getPasswordFormComponent(), $this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(), $this->getPasswordConfirmationFormComponent(),
]), ])->columnSpan(3),
Wizard\Step::make('Konto') Wizard\Step::make('Konto')
// ->columns(4) // ->columns(4)
->icon('lucide-key-square') ->icon('lucide-key-square')
@@ -47,20 +47,25 @@ class Register extends BaseRegister
->schema([ ->schema([
$this->getCompanyFormComponent(), $this->getCompanyFormComponent(),
$this->getUIDFormComponent(), $this->getUIDFormComponent(),
$this->getLocationFormComponent(),
$this->getPLZFormComponent(), $this->getPLZFormComponent(),
$this->getCountryFormComponent(), $this->getLocationFormComponent(),
$this->getAdresseFormComponent(), $this->getAdresseFormComponent(),
$this->getGenderFormComponent(), $this->getCountryFormComponent(),
$this->getFirstNameFormComponent(), ])->columnSpan(4),
$this->getLastNameFormComponent(), Fieldset::make('Kontaktperson')
->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([
$this->getKontoGenderFormComponent(),
$this->getTitleFormComponent(),
$this->getKontoFirstNameFormComponent(),
$this->getKontoLastNameFormComponent(),
$this->getKontoEmailFormComponent(), $this->getKontoEmailFormComponent(),
$this->getPhoneFormComponent(), $this->getPhoneFormComponent(),
])->columnSpan(4), ])->columnSpan(4),
]), ]),
Wizard\Step::make('AGB') Wizard\Step::make('AGB')
->icon('lucide-key-square') ->icon('lucide-receipt-text')
->visible(fn (Get $get): bool => $get('konto') == 'new') ->visible(fn (Get $get): bool => $get('konto') == 'new')
->description(' Allgemein Geschäftsbedignugen') ->description(' Allgemein Geschäftsbedignugen')
->schema([ ->schema([
@@ -68,7 +73,7 @@ class Register extends BaseRegister
->visible(fn (Get $get): bool => $get('konto') == 'new') ->visible(fn (Get $get): bool => $get('konto') == 'new')
->schema([ ->schema([
$this->getABGFormComponent(), $this->getABGFormComponent(),
])->columnSpan(4), ]),
View::make('pages.agb'), View::make('pages.agb'),
]), ]),
@@ -77,111 +82,9 @@ class Register extends BaseRegister
]); ]);
} }
protected function getABGFormComponent(): Checkbox /**
{ * MODUS
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();
}
protected function getKontoModusFormComponent(): Select protected function getKontoModusFormComponent(): Select
{ {
return Select::make('konto') return Select::make('konto')
@@ -200,6 +103,24 @@ class Register extends BaseRegister
->required(); ->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 protected function getKontoFormComponent(): Select
{ {
return Select::make('konto_id') 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', 'Um das erstellte Profil zu aktivieren muß der Kontoinhaber die Anmeldung im Programm freischalten',
]) ])
->visible(fn (Get $get): bool => $get('konto') == 'old') ->visible(fn (Get $get): bool => $get('konto') == 'old')
->options(Konto::query()->pluck('company', 'id')) ->options(Konto::query()->pluck('konto_company', 'id'))
->searchable() ->searchable()
->required(); ->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();
}
} }
@@ -15,9 +15,9 @@ class AppUserVerifiedMiddleware
*/ */
public function handle(Request $request, Closure $next): Response public function handle(Request $request, Closure $next): Response
{ {
if (is_null($request->user()->app_verified_at)) { // if (is_null($request->user()->app_verified_at)) {
abort(Response::HTTP_FORBIDDEN, 'Ihr Konto muss von einem Administrator verifiziert werden.'); // abort(Response::HTTP_FORBIDDEN, 'Ihr Konto muss von einem Administrator verifiziert werden.');
} // }
return $next($request); return $next($request);
} }
+1 -1
View File
@@ -12,7 +12,7 @@ class KontoSwitch extends Component
public function mount() public function mount()
{ {
$this->kontos = Konto::pluck('company', 'id')->all(); $this->kontos = Konto::pluck('konto_company', 'id')->all();
} }
public function render() public function render()
+12 -12
View File
@@ -13,18 +13,18 @@ class Konto extends Model
* @var list<string> * @var list<string>
*/ */
protected $fillable = [ protected $fillable = [
'title', 'konto_title',
'gender', 'konto_gender',
'first_name', 'konto_first_name',
'last_name', 'konto_last_name',
'company', 'konto_company',
'address', 'konto_email',
'location', 'konto_address',
'code', 'konto_location',
'country', 'konto_plz',
'kontoemail', 'konto_country',
'phone', 'konto_phone',
'uid_number', 'konto_uid_number',
]; ];
// protected static function booted(): void // protected static function booted(): void
// { // {
+52 -21
View File
@@ -26,28 +26,26 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
* @var list<string> * @var list<string>
*/ */
protected $fillable = [ protected $fillable = [
'name',
'first_name',
'last_name',
'email',
'konto_id', 'konto_id',
'password',
'role',
'super_admin',
'app_verified_at',
'first_name',
'last_name',
'gender', 'gender',
'name',
'email',
'password',
'app_verified_at',
'title', 'konto_title',
'company', 'konto_gender',
'address', 'konto_first_name',
'location', 'konto_last_name',
'code', 'konto_company',
'country', 'konto_email',
'kontoemail', 'konto_address',
'phone', 'konto_location',
'uid_number', 'konto_plz',
'konto_country',
'konto_phone',
'konto_uid_number',
'konto_agb_akzeptiert',
]; ];
/** /**
@@ -85,9 +83,42 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
static::creating(function (User $user) { static::creating(function (User $user) {
// dd($user); if (isset($user->konto_title)) {
$user->role = 'gutachter'; $konto = Konto::create([
'konto_title' => $user->konto_title,
'konto_gender' => $user->konto_gender,
'konto_company' => $user->konto_company,
'konto_uid_number' => $user->konto_uid_number,
'konto_location' => $user->konto_location,
'konto_plz' => $user->konto_plz,
'konto_agb_akzeptiert' => $user->konto_agb_akzeptiert,
'konto_country' => $user->konto_country,
'konto_address' => $user->konto_address,
'konto_first_name' => $user->konto_first_name,
'konto_last_name' => $user->konto_last_name,
'konto_email' => $user->konto_email,
'konto_phone' => $user->konto_phone,
]);
$user->konto_id = $konto->id;
unset($user->konto_title);
unset($user->konto_gender);
unset($user->konto_company);
unset($user->konto_uid_number);
unset($user->konto_location);
unset($user->konto_plz);
unset($user->konto_agb_akzeptiert);
unset($user->konto_country);
unset($user->konto_address);
unset($user->konto_first_name);
unset($user->konto_last_name);
unset($user->konto_email);
unset($user->konto_phone);
}
$user->app_verified_at = now();
$user->email_verified_at = now();
$user->assignRole('gutachter');
}); });
} }
@@ -13,18 +13,19 @@ return new class extends Migration
{ {
Schema::create('kontos', function (Blueprint $table) { Schema::create('kontos', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('title')->nullable(); $table->string('konto_title')->nullable();
$table->string('gender')->nullable(); $table->string('konto_gender')->nullable();
$table->string('first_name'); $table->string('konto_first_name');
$table->string('last_name'); $table->string('konto_last_name');
$table->string('company'); $table->string('konto_company');
$table->string('kontoemail')->nullable(); $table->string('konto_email')->nullable();
$table->string('address')->nullable(); $table->string('konto_address')->nullable();
$table->string('location')->nullable(); $table->string('konto_location')->nullable();
$table->string('code')->nullable(); $table->string('konto_plz')->nullable();
$table->string('country')->nullable(); $table->string('konto_country')->nullable();
$table->string('phone')->nullable(); $table->string('konto_phone')->nullable();
$table->string('uid_number')->nullable(); $table->string('konto_uid_number')->nullable();
$table->boolean('konto_agb_akzeptiert')->default(false);
$table->timestamps(); $table->timestamps();
}); });
} }
@@ -19,8 +19,6 @@ return new class extends Migration
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->string('role');
$table->boolean('super_admin')->default(0);
$table->text('app_authentication_secret')->nullable(); $table->text('app_authentication_secret')->nullable();
$table->text('app_authentication_recovery_codes')->nullable(); $table->text('app_authentication_recovery_codes')->nullable();
+1 -1
View File
@@ -12,7 +12,7 @@ class KontoSeeder extends Seeder
*/ */
public function run(): void public function run(): void
{ {
$sql = "INSERT INTO `kontos` (`id`, `title`, `gender`, `first_name`, `last_name`, `company`, `address`, `location`, `code`, `phone`, `uid_number`) $sql = "INSERT INTO `kontos` (`id`, `konto_title`, `konto_gender`, `konto_first_name`, `konto_last_name`, `konto_company`, `konto_address`, `konto_location`, `konto_plz`, `konto_phone`, `konto_uid_number`)
VALUES VALUES
('1', 'Architekt', 'Herr','Bruno','Kunz','Architekt Kunz','Pradlerstraße 11','Innbsruck', '6020', '0512 457328', 'ATU 234578'), ('1', 'Architekt', 'Herr','Bruno','Kunz','Architekt Kunz','Pradlerstraße 11','Innbsruck', '6020', '0512 457328', 'ATU 234578'),
('2', 'Architekt', 'Herr','Sepp','Unterlugauer','Architekt Unterlugauer','Seestraße 1','Innbsruck', '6020', '0512 457328', 'ATU 234578'); ('2', 'Architekt', 'Herr','Sepp','Unterlugauer','Architekt Unterlugauer','Seestraße 1','Innbsruck', '6020', '0512 457328', 'ATU 234578');
+14 -14
View File
@@ -2,7 +2,7 @@
<x-title> <x-title>
Allgemeine Geschäftsbedingungen (AGB) Allgemeine Geschäftsbedingungen (AGB)
</x-title> </x-title>
<x-filament::section> <x-filament::section collapsible>
<x-slot name="heading"> <x-slot name="heading">
1. Geltungsbereich 1. Geltungsbereich
</x-slot> </x-slot>
@@ -11,7 +11,7 @@
oder „uns“). Mit der Nutzung der Software erklärt sich der Nutzer (nachfolgend „Kunde“ oder „Sie“) mit diesen oder „uns“). Mit der Nutzung der Software erklärt sich der Nutzer (nachfolgend „Kunde“ oder „Sie“) mit diesen
AGB einverstanden. AGB einverstanden.
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
2. Vertragsgegenstand 2. Vertragsgegenstand
</x-slot> </x-slot>
@@ -19,7 +19,7 @@
für Bauprojekte durchführen kann. Die Software wird als Software-as-a-Service (SaaS) angeboten, die über das für Bauprojekte durchführen kann. Die Software wird als Software-as-a-Service (SaaS) angeboten, die über das
Internet zugänglich ist. Internet zugänglich ist.
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
3. Nutzungsrechte 3. Nutzungsrechte
</x-slot> </x-slot>
@@ -36,7 +36,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
5. Leistungen des Anbieters 5. Leistungen des Anbieters
</x-slot> </x-slot>
@@ -53,7 +53,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
4. Registrierung und Zugangsdaten 4. Registrierung und Zugangsdaten
</x-slot> </x-slot>
@@ -72,7 +72,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
6. Verfügbarkeit und Wartung 6. Verfügbarkeit und Wartung
</x-slot> </x-slot>
@@ -91,7 +91,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
7. Gebühren und Zahlungsbedingungen 7. Gebühren und Zahlungsbedingungen
</x-slot> </x-slot>
@@ -107,7 +107,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
7. Gebühren und Zahlungsbedingungen 7. Gebühren und Zahlungsbedingungen
</x-slot> </x-slot>
@@ -128,7 +128,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
8. Rechte an den Daten 8. Rechte an den Daten
</x-slot> </x-slot>
@@ -148,7 +148,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
9. Haftung und Gewährleistung 9. Haftung und Gewährleistung
</x-slot> </x-slot>
@@ -172,7 +172,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
10. Datenschutz 10. Datenschutz
</x-slot> </x-slot>
@@ -191,7 +191,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
11. Laufzeit und Kündigung 11. Laufzeit und Kündigung
</x-slot> </x-slot>
@@ -206,7 +206,7 @@
<li>Das Recht zur außerordentlichen Kündigung aus wichtigem Grund bleibt unberührt.</li> <li>Das Recht zur außerordentlichen Kündigung aus wichtigem Grund bleibt unberührt.</li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
12. Änderungen der AGB 12. Änderungen der AGB
</x-slot> </x-slot>
@@ -223,7 +223,7 @@
</li> </li>
</ol> </ol>
</x-filament::section> </x-filament::section>
<x-filament::section> <x-filament::section collapsible collapsed>
<x-slot name="heading"> <x-slot name="heading">
13. Schlussbestimmungen 13. Schlussbestimmungen
</x-slot> </x-slot>