Rename firstName to ownerName with updated validation

- Renamed firstName to ownerName in UserSettings interface
- Updated UserSettingsForm field to accept full name (first and last)
- Set maximum length to 25 characters for owner name field
- Updated all database operations to use ownerName
- Changed English label from "First Name" to "Your First and Last Name"
- Updated Croatian translations to match (Vaše ime i prezime)
- Updated form validation schema and error messages
- Removed old lastName-related translations
- Updated ViewLocationCard to use ownerName for recipient

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-22 22:31:07 +01:00
parent c1762f7157
commit db1df76ed6
6 changed files with 29 additions and 34 deletions

View File

@@ -27,7 +27,7 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
// Track current form values for real-time validation
const [formValues, setFormValues] = useState({
firstName: userSettings?.firstName ?? "",
ownerName: userSettings?.ownerName ?? "",
street: userSettings?.street ?? "",
town: userSettings?.town ?? "",
iban: formatIban(userSettings?.iban) ?? "",
@@ -40,7 +40,7 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
// Check if any required field is missing (clean IBAN of spaces for validation)
const cleanedIban = formValues.iban.replace(/\s/g, '');
const hasMissingData = !formValues.firstName || !formValues.street || !formValues.town || !cleanedIban || !formValues.currency;
const hasMissingData = !formValues.ownerName || !formValues.street || !formValues.town || !cleanedIban || !formValues.currency;
// Track whether to generate 2D code for tenant (use persisted value from database)
const [show2dCodeInMonthlyStatement, setShow2dCodeInMonthlyStatement] = useState(
@@ -71,21 +71,22 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
<>
<div className="form-control w-full">
<label className="label">
<span className="label-text">{t("first-name-label")}</span>
<span className="label-text">{t("owner-name-label")}</span>
</label>
<input
id="firstName"
name="firstName"
id="ownerName"
name="ownerName"
type="text"
placeholder={t("first-name-placeholder")}
maxLength={25}
placeholder={t("owner-name-placeholder")}
className="input input-bordered w-full placeholder:text-gray-600"
defaultValue={userSettings?.firstName ?? ""}
onChange={(e) => handleInputChange("firstName", e.target.value)}
defaultValue={userSettings?.ownerName ?? ""}
onChange={(e) => handleInputChange("ownerName", e.target.value)}
disabled={pending}
/>
<div id="firstName-error" aria-live="polite" aria-atomic="true">
{errors?.firstName &&
errors.firstName.map((error: string) => (
<div id="ownerName-error" aria-live="polite" aria-atomic="true">
{errors?.ownerName &&
errors.ownerName.map((error: string) => (
<p className="mt-2 text-sm text-red-500" key={error}>
{error}
</p>