Rename 'town' to 'ownerTown' in UserSettings with 27 character max length
Changes:
- Updated UserSettings interface: town -> ownerTown
- Updated userSettingsActions.ts:
- Changed State type to use ownerTown
- Added max length validation (27 characters) to FormSchema
- Updated validation refinement to check ownerTown
- Updated form data parsing to read ownerTown
- Updated database write operations to use ownerTown
- Updated UserSettingsForm.tsx:
- Changed state tracking to use ownerTown
- Updated validation check to reference ownerTown
- Updated input field: id, name, maxLength={27}
- Updated ViewLocationCard.tsx to use ownerTown instead of town
- Updated English translations:
- town-label -> owner-town-label: "Your Postal Code and Town"
- town-placeholder -> owner-town-placeholder
- town-required -> owner-town-required
- Updated Croatian translations with corresponding ownerTown keys
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
|
||||
const [formValues, setFormValues] = useState({
|
||||
ownerName: userSettings?.ownerName ?? "",
|
||||
ownerStreet: userSettings?.ownerStreet ?? "",
|
||||
town: userSettings?.town ?? "",
|
||||
ownerTown: userSettings?.ownerTown ?? "",
|
||||
iban: formatIban(userSettings?.iban) ?? "",
|
||||
currency: userSettings?.currency ?? "EUR",
|
||||
});
|
||||
@@ -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.ownerName || !formValues.ownerStreet || !formValues.town || !cleanedIban || !formValues.currency;
|
||||
const hasMissingData = !formValues.ownerName || !formValues.ownerStreet || !formValues.ownerTown || !cleanedIban || !formValues.currency;
|
||||
|
||||
// Track whether to generate 2D code for tenant (use persisted value from database)
|
||||
const [show2dCodeInMonthlyStatement, setShow2dCodeInMonthlyStatement] = useState(
|
||||
@@ -121,21 +121,22 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
|
||||
|
||||
<div className="form-control w-full">
|
||||
<label className="label">
|
||||
<span className="label-text">{t("town-label")}</span>
|
||||
<span className="label-text">{t("owner-town-label")}</span>
|
||||
</label>
|
||||
<input
|
||||
id="town"
|
||||
name="town"
|
||||
id="ownerTown"
|
||||
name="ownerTown"
|
||||
type="text"
|
||||
placeholder={t("town-placeholder")}
|
||||
maxLength={27}
|
||||
placeholder={t("owner-town-placeholder")}
|
||||
className="input input-bordered w-full placeholder:text-gray-600"
|
||||
defaultValue={userSettings?.town ?? ""}
|
||||
onChange={(e) => handleInputChange("town", e.target.value)}
|
||||
defaultValue={userSettings?.ownerTown ?? ""}
|
||||
onChange={(e) => handleInputChange("ownerTown", e.target.value)}
|
||||
disabled={pending}
|
||||
/>
|
||||
<div id="town-error" aria-live="polite" aria-atomic="true">
|
||||
{errors?.town &&
|
||||
errors.town.map((error: string) => (
|
||||
<div id="ownerTown-error" aria-live="polite" aria-atomic="true">
|
||||
{errors?.ownerTown &&
|
||||
errors.ownerTown.map((error: string) => (
|
||||
<p className="mt-2 text-sm text-red-500" key={error}>
|
||||
{error}
|
||||
</p>
|
||||
|
||||
@@ -30,7 +30,7 @@ export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettin
|
||||
SjedistePlatitelja: tenantTown ?? "",
|
||||
Primatelj: userSettings?.ownerName ?? "",
|
||||
AdresaPrimatelja: userSettings?.ownerStreet ?? "",
|
||||
SjedistePrimatelja: userSettings?.town ?? "",
|
||||
SjedistePrimatelja: userSettings?.ownerTown ?? "",
|
||||
IBAN: userSettings?.iban ?? "",
|
||||
ModelPlacanja: "HR00",
|
||||
PozivNaBroj: `${yearMonth.year}-${yearMonth.month.toString().padStart(2,"0")}`,
|
||||
|
||||
Reference in New Issue
Block a user