Add tenantStreet and tenantTown fields to LocationEditForm

- Added tenantStreet and tenantTown optional fields to BillingLocation interface
- Updated LocationEditForm to include new input fields with 27 character max length
- Both fields are mandatory when 2D code generation is enabled
- Updated all database operations (insert and update) to persist new fields
- Added Croatian and English translations for labels and validation messages
- Updated form state tracking to include new tenant address fields

🤖 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 15:33:00 +01:00
parent 3cf880a661
commit ec39eda51f
5 changed files with 103 additions and 1 deletions

View File

@@ -47,6 +47,8 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
const [tenantFields, setTenantFields] = useState({
tenantFirstName: location?.tenantFirstName ?? "",
tenantLastName: location?.tenantLastName ?? "",
tenantStreet: location?.tenantStreet ?? "",
tenantTown: location?.tenantTown ?? "",
tenantEmail: location?.tenantEmail ?? "",
});
@@ -121,7 +123,7 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
</div>
</div>
<div className="form-control w-full mb-4">
<div className="form-control w-full">
<label className="label">
<span className="label-text">{t("tenant-last-name-label")}</span>
</label>
@@ -143,6 +145,54 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
))}
</div>
</div>
<div className="form-control w-full">
<label className="label">
<span className="label-text">{t("tenant-street-label")}</span>
</label>
<input
id="tenantStreet"
name="tenantStreet"
type="text"
maxLength={27}
placeholder={t("tenant-street-placeholder")}
className="input input-bordered w-full placeholder:text-gray-600"
defaultValue={location?.tenantStreet ?? ""}
onChange={(e) => handleTenantFieldChange("tenantStreet", e.target.value)}
/>
<div id="tenantStreet-error" aria-live="polite" aria-atomic="true">
{state.errors?.tenantStreet &&
state.errors.tenantStreet.map((error: string) => (
<p className="mt-2 text-sm text-red-500" key={error}>
{error}
</p>
))}
</div>
</div>
<div className="form-control w-full mb-4">
<label className="label">
<span className="label-text">{t("tenant-town-label")}</span>
</label>
<input
id="tenantTown"
name="tenantTown"
type="text"
maxLength={27}
placeholder={t("tenant-town-placeholder")}
className="input input-bordered w-full placeholder:text-gray-600"
defaultValue={location?.tenantTown ?? ""}
onChange={(e) => handleTenantFieldChange("tenantTown", e.target.value)}
/>
<div id="tenantTown-error" aria-live="polite" aria-atomic="true">
{state.errors?.tenantTown &&
state.errors.tenantTown.map((error: string) => (
<p className="mt-2 text-sm text-red-500" key={error}>
{error}
</p>
))}
</div>
</div>
</>
)}
</fieldset>