(refactor) rename: rentDueNotification > rentDueNotificationEnabled
This commit is contained in:
@@ -19,8 +19,8 @@ The web page served at this path contains an text explanation and "Verify e-mail
|
||||
|
||||
The text includes the following information:
|
||||
* what the web app is about - very short into
|
||||
* why the e-mail was sent = because the landloard of the property `BillingLocation.name` configured the rent (`BillingLocation.rentDueNotification`) and/or utility bills (`BillingLocation.billFwdStrategy`) to be delivered to that e-mail address
|
||||
* what will hapen if he/she clicks on the "Verify e-mail" button = they will be receiving rent due (`BillingLocation.rentDueNotification`) or utility bills due (`BillingLocation.billFwdStrategy`) notification or both - 2x a month - depending on the config set by the landloard
|
||||
* why the e-mail was sent = because the landloard of the property `BillingLocation.name` configured the rent (`BillingLocation.rentDueNotificationEnabled`) and/or utility bills (`BillingLocation.billFwdStrategy`) to be delivered to that e-mail address
|
||||
* what will hapen if he/she clicks on the "Verify e-mail" button = they will be receiving rent due (`BillingLocation.rentDueNotificationEnabled`) or utility bills due (`BillingLocation.billFwdStrategy`) notification or both - 2x a month - depending on the config set by the landloard
|
||||
* opt-out infomation (they can ignore this e-mail, but can also opt-out at any moment)
|
||||
|
||||
If the user clicks the button "Verify e-mail" this triggers update of `BillingLocation.tenantEmailStatus`.
|
||||
|
||||
@@ -24,7 +24,7 @@ export type State = {
|
||||
tenantEmail?: string[];
|
||||
tenantEmailStatus?: string[];
|
||||
billFwdStrategy?: string[];
|
||||
rentDueNotification?: string[];
|
||||
rentDueNotificationEnabled?: string[];
|
||||
rentDueDay?: string[];
|
||||
rentAmount?: string[];
|
||||
};
|
||||
@@ -47,7 +47,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
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(),
|
||||
rentDueNotification: z.boolean().optional().nullable(),
|
||||
rentDueNotificationEnabled: z.boolean().optional().nullable(),
|
||||
rentDueDay: z.coerce.number().min(1).max(31).optional().nullable(),
|
||||
rentAmount: z.coerce.number().int(t("rent-amount-integer")).positive(t("rent-amount-positive")).optional().nullable(),
|
||||
addToSubsequentMonths: z.boolean().optional().nullable(),
|
||||
@@ -84,7 +84,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
path: ["tenantTown"],
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.autoBillFwd || data.rentDueNotification) {
|
||||
if (data.autoBillFwd || data.rentDueNotificationEnabled) {
|
||||
return !!data.tenantEmail && data.tenantEmail.trim().length > 0;
|
||||
}
|
||||
return true;
|
||||
@@ -93,7 +93,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
|
||||
path: ["tenantEmail"],
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.rentDueNotification) {
|
||||
if (data.rentDueNotificationEnabled) {
|
||||
return !!data.rentAmount && data.rentAmount > 0;
|
||||
}
|
||||
return true;
|
||||
@@ -126,7 +126,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
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,
|
||||
rentDueNotification: formData.get('rentDueNotification') === 'on',
|
||||
rentDueNotificationEnabled: formData.get('rentDueNotificationEnabled') === 'on',
|
||||
rentDueDay: formData.get('rentDueDay') || null,
|
||||
rentAmount: formData.get('rentAmount') || null,
|
||||
addToSubsequentMonths: formData.get('addToSubsequentMonths') === 'on',
|
||||
@@ -152,7 +152,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail,
|
||||
tenantEmailStatus,
|
||||
billFwdStrategy,
|
||||
rentDueNotification,
|
||||
rentDueNotificationEnabled,
|
||||
rentDueDay,
|
||||
rentAmount,
|
||||
addToSubsequentMonths,
|
||||
@@ -210,7 +210,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
rentDueNotification: rentDueNotification || false,
|
||||
rentDueNotificationEnabled: rentDueNotificationEnabled || false,
|
||||
rentDueDay: rentDueDay || null,
|
||||
rentAmount: rentAmount || null,
|
||||
}
|
||||
@@ -242,7 +242,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
rentDueNotification: rentDueNotification || false,
|
||||
rentDueNotificationEnabled: rentDueNotificationEnabled || false,
|
||||
rentDueDay: rentDueDay || null,
|
||||
rentAmount: rentAmount || null,
|
||||
}
|
||||
@@ -267,7 +267,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: finalEmailStatus,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
rentDueNotification: rentDueNotification || false,
|
||||
rentDueNotificationEnabled: rentDueNotificationEnabled || false,
|
||||
rentDueDay: rentDueDay || null,
|
||||
rentAmount: rentAmount || null,
|
||||
}
|
||||
@@ -291,7 +291,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: tenantEmailStatus as EmailStatus || EmailStatus.Unverified,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
rentDueNotification: rentDueNotification || false,
|
||||
rentDueNotificationEnabled: rentDueNotificationEnabled || false,
|
||||
rentDueDay: rentDueDay || null,
|
||||
rentAmount: rentAmount || null,
|
||||
yearMonth: yearMonth,
|
||||
@@ -367,7 +367,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
tenantEmail: tenantEmail || null,
|
||||
tenantEmailStatus: tenantEmailStatus as EmailStatus || EmailStatus.Unverified,
|
||||
billFwdStrategy: billFwdStrategy || "when-payed",
|
||||
rentDueNotification: rentDueNotification || false,
|
||||
rentDueNotificationEnabled: rentDueNotificationEnabled || false,
|
||||
rentDueDay: rentDueDay || null,
|
||||
rentAmount: rentAmount || null,
|
||||
yearMonth: { year: monthData.year, month: monthData.month },
|
||||
|
||||
@@ -84,9 +84,11 @@ export interface BillingLocation {
|
||||
/** (optional) bill forwarding strategy */
|
||||
billFwdStrategy?: "when-payed" | "when-attached" | null;
|
||||
/** (optional) whether to automatically send rent notification */
|
||||
rentDueNotification?: boolean | null;
|
||||
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;
|
||||
/** (optional) monthly rent amount in cents */
|
||||
rentAmount?: number | null;
|
||||
/** (optional) whether the location has been seen by tenant */
|
||||
|
||||
@@ -46,7 +46,7 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
proofOfPaymentType: location?.proofOfPaymentType ?? "none",
|
||||
autoBillFwd: location?.autoBillFwd ?? false,
|
||||
billFwdStrategy: location?.billFwdStrategy ?? "when-payed",
|
||||
rentDueNotification: location?.rentDueNotification ?? false,
|
||||
rentDueNotificationEnabled: location?.rentDueNotificationEnabled ?? false,
|
||||
rentAmount: location?.rentAmount ?? "",
|
||||
rentDueDay: location?.rentDueDay ?? 1,
|
||||
});
|
||||
@@ -306,16 +306,16 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
<label className="label cursor-pointer justify-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="rentDueNotification"
|
||||
name="rentDueNotificationEnabled"
|
||||
className="toggle toggle-primary"
|
||||
checked={formValues.rentDueNotification}
|
||||
onChange={(e) => handleInputChange("rentDueNotification", e.target.checked)}
|
||||
checked={formValues.rentDueNotificationEnabled}
|
||||
onChange={(e) => handleInputChange("rentDueNotificationEnabled", e.target.checked)}
|
||||
/>
|
||||
<legend className="fieldset-legend">{t("auto-rent-notification-toggle-label")}</legend>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
{formValues.rentDueNotification && (
|
||||
{formValues.rentDueNotificationEnabled && (
|
||||
<div className="animate-expand-fade-in origin-top">
|
||||
<fieldset className="fieldset mt-2 p-2">
|
||||
<legend className="fieldset-legend">{t("rent-due-day-label")}</legend>
|
||||
@@ -355,7 +355,7 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{(formValues.autoBillFwd || formValues.rentDueNotification) && (
|
||||
{(formValues.autoBillFwd || formValues.rentDueNotificationEnabled) && (
|
||||
<fieldset className="fieldset bg-base-200 border-base-300 rounded-box w-xs border p-4 pb-2 mt-4">
|
||||
<legend className="fieldset-legend font-semibold uppercase">{t("tenant-email-legend")}</legend>
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user