Rename tenantFirstName to tenantName with updated validation

- Renamed tenantFirstName to tenantName in BillingLocation interface
- Updated LocationEditForm field to accept full name (first and last)
- Set maximum length to 30 characters for tenant name field
- Updated all database operations to use tenantName
- Changed English label from "Tenant First Name" to "Tenant First and Last Name"
- Updated Croatian translations to match (Ime i prezime podstanara)
- Updated form validation schema and error messages
- Removed old tenantLastName-related translations

🤖 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:17:10 +01:00
parent a1c683528c
commit b4e459b2d5
6 changed files with 33 additions and 38 deletions

View File

@@ -45,7 +45,7 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
// Track tenant field values for real-time validation
const [tenantFields, setTenantFields] = useState({
tenantFirstName: location?.tenantFirstName ?? "",
tenantName: location?.tenantName ?? "",
tenantStreet: location?.tenantStreet ?? "",
tenantTown: location?.tenantTown ?? "",
tenantEmail: location?.tenantEmail ?? "",
@@ -101,20 +101,21 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
<>
<div className="form-control w-full">
<label className="label">
<span className="label-text">{t("tenant-first-name-label")}</span>
<span className="label-text">{t("tenant-name-label")}</span>
</label>
<input
id="tenantFirstName"
name="tenantFirstName"
id="tenantName"
name="tenantName"
type="text"
placeholder={t("tenant-first-name-placeholder")}
maxLength={30}
placeholder={t("tenant-name-placeholder")}
className="input input-bordered w-full placeholder:text-gray-600"
defaultValue={location?.tenantFirstName ?? ""}
onChange={(e) => handleTenantFieldChange("tenantFirstName", e.target.value)}
defaultValue={location?.tenantName ?? ""}
onChange={(e) => handleTenantFieldChange("tenantName", e.target.value)}
/>
<div id="tenantFirstName-error" aria-live="polite" aria-atomic="true">
{state.errors?.tenantFirstName &&
state.errors.tenantFirstName.map((error: string) => (
<div id="tenantName-error" aria-live="polite" aria-atomic="true">
{state.errors?.tenantName &&
state.errors.tenantName.map((error: string) => (
<p className="mt-2 text-sm text-red-500" key={error}>
{error}
</p>