(refactor) renames autoBillFwd > billFwdEnabled
This commit is contained in:
@@ -20,7 +20,7 @@ export type State = {
|
||||
tenantName?: string[];
|
||||
tenantStreet?: string[];
|
||||
tenantTown?: string[];
|
||||
autoBillFwd?: string[];
|
||||
billFwdEnabled?: string[];
|
||||
tenantEmail?: string[];
|
||||
tenantEmailStatus?: string[];
|
||||
billFwdStrategy?: string[];
|
||||
@@ -43,7 +43,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
tenantName: z.string().max(30).optional().nullable(),
|
||||
tenantStreet: z.string().max(27).optional().nullable(),
|
||||
tenantTown: z.string().max(27).optional().nullable(),
|
||||
autoBillFwd: z.boolean().optional().nullable(),
|
||||
billFwdEnabled: z.boolean().optional().nullable(),
|
||||
tenantEmail: z.string().email(t("tenant-email-invalid")).optional().or(z.literal("")).nullable(),
|
||||
tenantEmailStatus: z.enum([EmailStatus.Unverified, EmailStatus.VerificationPending, EmailStatus.Verified, EmailStatus.Unsubscribed]).optional().nullable(),
|
||||
billFwdStrategy: z.enum(["when-payed", "when-attached"]).optional().nullable(),
|
||||
@@ -84,7 +84,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
path: ["tenantTown"],
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.autoBillFwd || data.rentDueNotificationEnabled) {
|
||||
if (data.billFwdEnabled || data.rentDueNotificationEnabled) {
|
||||
return !!data.tenantEmail && data.tenantEmail.trim().length > 0;
|
||||
}
|
||||
return true;
|
||||
@@ -122,7 +122,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: formData.get('tenantName') || null,
|
||||
tenantStreet: formData.get('tenantStreet') || null,
|
||||
tenantTown: formData.get('tenantTown') || null,
|
||||
autoBillFwd: formData.get('autoBillFwd') === 'on',
|
||||
billFwdEnabled: formData.get('billFwdEnabled') === 'on',
|
||||
tenantEmail: formData.get('tenantEmail') || null,
|
||||
tenantEmailStatus: formData.get('tenantEmailStatus') as "unverified" | "verification-pending" | "verified" | "unsubscribed" | undefined,
|
||||
billFwdStrategy: formData.get('billFwdStrategy') as "when-payed" | "when-attached" | undefined,
|
||||
@@ -148,7 +148,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName,
|
||||
tenantStreet,
|
||||
tenantTown,
|
||||
autoBillFwd,
|
||||
billFwdEnabled,
|
||||
tenantEmail,
|
||||
tenantEmailStatus,
|
||||
billFwdStrategy,
|
||||
@@ -206,7 +206,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: tenantName || null,
|
||||
tenantStreet: tenantStreet || null,
|
||||
tenantTown: tenantTown || null,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
billFwdEnabled: billFwdEnabled || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
@@ -238,7 +238,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: tenantName || null,
|
||||
tenantStreet: tenantStreet || null,
|
||||
tenantTown: tenantTown || null,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
billFwdEnabled: billFwdEnabled || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
@@ -263,7 +263,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: tenantName || null,
|
||||
tenantStreet: tenantStreet || null,
|
||||
tenantTown: tenantTown || null,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
billFwdEnabled: billFwdEnabled || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
@@ -287,7 +287,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: tenantName || null,
|
||||
tenantStreet: tenantStreet || null,
|
||||
tenantTown: tenantTown || null,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
billFwdEnabled: billFwdEnabled || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: tenantEmailStatus as EmailStatus || EmailStatus.Unverified,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
@@ -363,7 +363,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantName: tenantName || null,
|
||||
tenantStreet: tenantStreet || null,
|
||||
tenantTown: tenantTown || null,
|
||||
autoBillFwd: autoBillFwd || false,
|
||||
billFwdEnabled: billFwdEnabled || false,
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: tenantEmailStatus as EmailStatus || EmailStatus.Unverified,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
|
||||
@@ -75,20 +75,22 @@ export interface BillingLocation {
|
||||
tenantStreet?: string | null;
|
||||
/** (optional) tenant town */
|
||||
tenantTown?: string | null;
|
||||
/** (optional) whether to automatically notify tenant */
|
||||
autoBillFwd?: boolean | null;
|
||||
/** (optional) tenant email */
|
||||
tenantEmail?: string | null;
|
||||
/** (optional) tenant email status */
|
||||
tenantEmailStatus?: EmailStatus | null;
|
||||
/** (optional) whether to automatically notify tenant */
|
||||
billFwdEnabled?: boolean | null;
|
||||
/** (optional) bill forwarding strategy */
|
||||
billFwdStrategy?: "when-payed" | "when-attached" | null;
|
||||
/** (optional) bill forwarding status */
|
||||
billFwdStatus?: "pending" | "sent" | "failed" | null;
|
||||
/** (optional) whether to automatically send rent notification */
|
||||
rentDueNotificationEnabled?: boolean | null;
|
||||
/** (optional) day of month when rent is due (1-31) */
|
||||
rentDueDay?: number | null;
|
||||
/** (optional) when was the rent due notification sent */
|
||||
rentDueNotificationEnabledSentAt?: number | null;
|
||||
rentDueNotificationStatus?: "sent" | "failed" | null;
|
||||
/** (optional) monthly rent amount in cents */
|
||||
rentAmount?: number | null;
|
||||
/** (optional) whether the location has been seen by tenant */
|
||||
|
||||
Reference in New Issue
Block a user