Rename autoTenantNotification to autoBillFwd and update related references in forms and translations
This commit is contained in:
@@ -18,7 +18,7 @@ export type State = {
|
||||
generateTenantCode?: string[];
|
||||
tenantFirstName?: string[];
|
||||
tenantLastName?: string[];
|
||||
autoTenantNotification?: string[];
|
||||
autoBillFwd?: string[];
|
||||
tenantEmail?: string[];
|
||||
};
|
||||
message?:string | null;
|
||||
@@ -35,7 +35,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
generateTenantCode: z.boolean().optional().nullable(),
|
||||
tenantFirstName: z.string().optional().nullable(),
|
||||
tenantLastName: z.string().optional().nullable(),
|
||||
autoTenantNotification: z.boolean().optional().nullable(),
|
||||
autoBillFwd: z.boolean().optional().nullable(),
|
||||
tenantEmail: z.string().email(t("tenant-email-invalid")).optional().or(z.literal("")).nullable(),
|
||||
addToSubsequentMonths: z.boolean().optional().nullable(),
|
||||
updateScope: z.enum(["current", "subsequent", "all"]).optional().nullable(),
|
||||
@@ -62,7 +62,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
path: ["tenantLastName"],
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.autoTenantNotification) {
|
||||
if (data.autoBillFwd) {
|
||||
return !!data.tenantEmail && data.tenantEmail.trim().length > 0;
|
||||
}
|
||||
return true;
|
||||
@@ -90,7 +90,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: formData.get('generateTenantCode') === 'on',
|
||||
tenantFirstName: formData.get('tenantFirstName') || null,
|
||||
tenantLastName: formData.get('tenantLastName') || null,
|
||||
autoTenantNotification: formData.get('autoTenantNotification') === 'on',
|
||||
autoBillFwd: formData.get('autoBillFwd') === 'on',
|
||||
tenantEmail: formData.get('tenantEmail') || null,
|
||||
addToSubsequentMonths: formData.get('addToSubsequentMonths') === 'on',
|
||||
updateScope: formData.get('updateScope') as "current" | "subsequent" | "all" | undefined,
|
||||
@@ -110,7 +110,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode,
|
||||
tenantFirstName,
|
||||
tenantLastName,
|
||||
autoTenantNotification,
|
||||
autoBillFwd,
|
||||
tenantEmail,
|
||||
addToSubsequentMonths,
|
||||
updateScope,
|
||||
@@ -148,7 +148,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: generateTenantCode || false,
|
||||
tenantFirstName: tenantFirstName || null,
|
||||
tenantLastName: tenantLastName || null,
|
||||
autoTenantNotification: autoTenantNotification || false,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: generateTenantCode || false,
|
||||
tenantFirstName: tenantFirstName || null,
|
||||
tenantLastName: tenantLastName || null,
|
||||
autoTenantNotification: autoTenantNotification || false,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: generateTenantCode || false,
|
||||
tenantFirstName: tenantFirstName || null,
|
||||
tenantLastName: tenantLastName || null,
|
||||
autoTenantNotification: autoTenantNotification || false,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: generateTenantCode || false,
|
||||
tenantFirstName: tenantFirstName || null,
|
||||
tenantLastName: tenantLastName || null,
|
||||
autoTenantNotification: autoTenantNotification || false,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
yearMonth: yearMonth,
|
||||
bills: [],
|
||||
@@ -279,7 +279,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
generateTenantCode: generateTenantCode || false,
|
||||
tenantFirstName: tenantFirstName || null,
|
||||
tenantLastName: tenantLastName || null,
|
||||
autoTenantNotification: autoTenantNotification || false,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
yearMonth: { year: monthData.year, month: monthData.month },
|
||||
bills: [],
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface BillingLocation {
|
||||
/** (optional) tenant last name */
|
||||
tenantLastName?: string | null;
|
||||
/** (optional) whether to automatically notify tenant */
|
||||
autoTenantNotification?: boolean | null;
|
||||
autoBillFwd?: boolean | null;
|
||||
/** (optional) tenant email */
|
||||
tenantEmail?: string | null;
|
||||
};
|
||||
|
||||
@@ -33,8 +33,8 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
);
|
||||
|
||||
// Track whether to automatically notify tenant (use persisted value from database)
|
||||
const [autoTenantNotification, setAutoTenantNotification] = useState(
|
||||
location?.autoTenantNotification ?? false
|
||||
const [autoBillFwd, setautoBillFwd] = useState(
|
||||
location?.autoBillFwd ?? false
|
||||
);
|
||||
|
||||
// Track tenant field values for real-time validation
|
||||
@@ -147,16 +147,16 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
<label className="label cursor-pointer justify-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="autoTenantNotification"
|
||||
name="autoBillFwd"
|
||||
className="toggle toggle-primary"
|
||||
checked={autoTenantNotification}
|
||||
onChange={(e) => setAutoTenantNotification(e.target.checked)}
|
||||
checked={autoBillFwd}
|
||||
onChange={(e) => setautoBillFwd(e.target.checked)}
|
||||
/>
|
||||
<span className="label-text">{t("auto-tenant-notification")}</span>
|
||||
<span className="label-text">{t("auto-utility-bill-forwarding")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{autoTenantNotification && (
|
||||
{autoBillFwd && (
|
||||
<div className="form-control w-full">
|
||||
<label className="label">
|
||||
<span className="label-text">{t("tenant-email-label")}</span>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
"tenant-first-name-placeholder": "Enter tenant's first name",
|
||||
"tenant-last-name-label": "Tenant Last Name",
|
||||
"tenant-last-name-placeholder": "Enter tenant's last name",
|
||||
"auto-tenant-notification": "automatic bill forwarding",
|
||||
"auto-utility-bill-forwarding": "automatic utility bill forwarding",
|
||||
"tenant-email-label": "Tenant Email",
|
||||
"tenant-email-placeholder": "Enter tenant's email",
|
||||
"warning-missing-tenant-names": "Warning: Tenant first and last name are missing. The 2D barcode will not be displayed to the tenant when they open the shared link until both fields are filled in.",
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
"tenant-first-name-placeholder": "Unesite ime podstanara",
|
||||
"tenant-last-name-label": "Prezime podstanara",
|
||||
"tenant-last-name-placeholder": "Unesite prezime podstanara",
|
||||
"auto-tenant-notification": "automatsko prosljeđivanje režija",
|
||||
"auto-utility-bill-forwarding": "automatsko prosljeđivanje režija",
|
||||
"tenant-email-label": "Email podstanara",
|
||||
"tenant-email-placeholder": "Unesite email podstanara",
|
||||
"warning-missing-tenant-names": "Upozorenje: Ime i prezime podstanara nedostaju. 2D barkod neće biti prikazan podstanaru kada otvori podijeljenu poveznicu dok oba polja ne budu popunjena.",
|
||||
|
||||
Reference in New Issue
Block a user