Files
fewo-stommer/app/Filament/Forms/Components/EuroInput.php
T
Lars StommerandClaude Opus 5.5 2e9a391b37 Phase 1: Wohnungen, Saisons & Preisberechnung
- Datenmodell Property/Season/Extra (Beträge in Cent), Seeder mit Preisliste 2026
- PriceCalculator: Saison-Splitting, Mindestaufenthalt, Zusatzperson, Endreinigung, Extras, Anzahlung/Restzahlung
- Filament-Verwaltung: Wohnungen, Saisons (Überschneidungsprüfung, Lückenwarnung, Kopie ins Folgejahr, Preisrechner), Zusatzleistungen
- Tests für Preisberechnung und Saisonverwaltung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:19:49 +02:00

25 lines
685 B
PHP

<?php
namespace App\Filament\Forms\Components;
use Filament\Forms\Components\TextInput;
/**
* Edits an amount stored in euro cents as a euro value with two decimals.
*/
class EuroInput extends TextInput
{
protected function setUp(): void
{
parent::setUp();
$this
->numeric()
->minValue(0)
->step(0.01)
->suffix('€')
->formatStateUsing(fn (?int $state): ?string => $state === null ? null : number_format($state / 100, 2, '.', ''))
->dehydrateStateUsing(fn (string|int|float|null $state): ?int => $state === null || $state === '' ? null : (int) round((float) $state * 100));
}
}