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>
|
||||
|
||||
Reference in New Issue
Block a user