feat: complete jobcard client management foundation

This commit is contained in:
Marco0300
2026-09-01 20:43:24 +02:00
parent 168c15c6ae
commit de2bf277c4
34 changed files with 2072 additions and 74 deletions
+9 -1
View File
@@ -40,7 +40,7 @@ final class ClientRecord
public function normalize(array $record): array
{
return [
'name' => $this->text($record['name'] ?? null) ?? '',
'name' => $this->normalizeName($record['name'] ?? null),
'registration_number' => $this->text($record['registration_number'] ?? null),
'status' => strtolower($this->text($record['status'] ?? null) ?? 'active'),
'support_email' => $this->lowerText($record['support_email'] ?? null),
@@ -114,6 +114,14 @@ final class ClientRecord
return $text === null ? null : strtolower($text);
}
private function normalizeName(mixed $value): ?string
{
$text = $this->text($value);
if ($text === null) return null;
$collapsed = preg_replace('/\s+/u', ' ', $text);
return $collapsed === false ? $text : $collapsed;
}
private function validPhone(string $phone): bool
{
if (mb_strlen($phone) > 60 || preg_match('/^[0-9+().\-\s]+$/', $phone) !== 1) {