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>
101 lines
2.9 KiB
TypeScript
101 lines
2.9 KiB
TypeScript
import { ObjectId } from "mongodb";
|
|
import { inter } from "../ui/fonts";
|
|
|
|
export interface BillAttachment {
|
|
fileName: string;
|
|
fileSize: number;
|
|
fileType: string;
|
|
fileLastModified: number;
|
|
fileContentsBase64: string;
|
|
};
|
|
|
|
export interface YearMonth {
|
|
year: number;
|
|
month: number;
|
|
};
|
|
|
|
/** User settings data */
|
|
export interface UserSettings {
|
|
/** user's ID */
|
|
userId: string;
|
|
/** owner name */
|
|
ownerName?: string | null;
|
|
/** owner street */
|
|
ownerStreet?: string | null;
|
|
/** owner town */
|
|
ownerTown?: string | null;
|
|
/** IBAN */
|
|
iban?: string | null;
|
|
/** currency (ISO 4217) */
|
|
currency?: string | null;
|
|
/** whether to show 2D code in monthly statement */
|
|
show2dCodeInMonthlyStatement?: boolean | null;
|
|
};
|
|
|
|
/** bill object in the form returned by MongoDB */
|
|
export interface BillingLocation {
|
|
_id: string;
|
|
/** user's ID */
|
|
userId: string;
|
|
/** user's email */
|
|
userEmail?: string | null;
|
|
/** name of the location */
|
|
name: string;
|
|
/** billing period year and month */
|
|
yearMonth: YearMonth;
|
|
/** array of bills */
|
|
bills: Bill[];
|
|
/** (optional) notes */
|
|
notes: string|null;
|
|
/** (optional) whether to generate 2D code for tenant */
|
|
generateTenantCode?: boolean | null;
|
|
/** (optional) tenant name */
|
|
tenantName?: string | null;
|
|
/** (optional) tenant street */
|
|
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) bill forwarding strategy */
|
|
billFwdStrategy?: "when-payed" | "when-attached" | null;
|
|
/** (optional) whether to automatically send rent notification */
|
|
rentDueNotification?: boolean | null;
|
|
/** (optional) day of month when rent is due (1-31) */
|
|
rentDueDay?: number | null;
|
|
/** (optional) monthly rent amount in cents */
|
|
rentAmount?: number | null;
|
|
/** (optional) whether the location has been seen by tenant */
|
|
seenByTenant?: boolean | null;
|
|
};
|
|
|
|
export enum BilledTo {
|
|
Tenant = "tenant",
|
|
Landlord = "landlord"
|
|
}
|
|
|
|
/** Bill basic data */
|
|
export interface Bill {
|
|
_id: string;
|
|
/** bill name */
|
|
name: string;
|
|
/** is the bill paid */
|
|
paid: boolean;
|
|
/** who is billed for the bill */
|
|
billedTo?: BilledTo;
|
|
/** payed amount amount in cents */
|
|
payedAmount?: number | null;
|
|
/** attached document (optional) */
|
|
attachment?: BillAttachment|null;
|
|
/**
|
|
* true if there an attachment
|
|
* @description this field enables us to send this info to the client without sending large attachment - it's an optimization
|
|
*/
|
|
hasAttachment?: boolean;
|
|
/** (optional) notes */
|
|
notes?: string|null;
|
|
/** (optional) image data containing PDF471 bar code */
|
|
barcodeImage?:string;
|
|
}; |