Files
nutzwerte_fi4/app/Filament/Resources/Kontos/Schemas/KontoForm.php
T
2025-09-28 13:34:36 +02:00

76 lines
2.8 KiB
PHP

<?php
namespace App\Filament\Resources\Kontos\Schemas;
use Alkoumi\FilamentImageRadioButton\Forms\Components\ImageRadioGroup;
use App\Models\Konto;
use App\Models\Plan;
use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
class KontoForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
ImageRadioGroup::make('plan_id')
->animation(true)
->disk('public')
->label('Plan')
->required()
->columnSpanFull()
->options(fn () => Plan::pluck('file', 'id')->toArray()),
Section::make('Firma')
->inlineLabel()
->schema([
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(),
])->columnSpanFull(),
Section::make('Kontaktperson')
->inlineLabel()
->schema([
TextInput::make('title')
->label('Title')
->required(),
Select::make('gender')
->label('Geschlecht')
->options([
'Herr' => 'Herr',
'Frau' => 'Frau',
'Non-binary' => 'Non-binary',
])
->required(),
TextInput::make('name')
->label('Name')
->required(),
TextInput::make('email')
->label('E-Mail')
->unique(table: Konto::class)
->required(),
PhoneInput::make('phone')
->label('Telefon')
->defaultCountry('AT'),
])->columnSpanFull(),
]);
}
}