This commit refactors the application to support managing multiple condominiums. Key changes include: - Introduction of `Condo` and `Notice` data types. - Implementation of multi-condo selection and management, including active condo context. - Addition of a notice system to inform users about important updates or events within a condo. - Styling adjustments to ensure better visibility of form elements. - Mock database updates to accommodate new entities and features.
103 lines
2.1 KiB
TypeScript
103 lines
2.1 KiB
TypeScript
|
|
export interface Condo {
|
|
id: string;
|
|
name: string;
|
|
address?: string;
|
|
iban?: string;
|
|
defaultMonthlyQuota: number;
|
|
image?: string; // Optional placeholder for logo
|
|
}
|
|
|
|
export interface Family {
|
|
id: string;
|
|
condoId: string; // Link to specific condo
|
|
name: string;
|
|
unitNumber: string; // Internal apartment number
|
|
contactEmail?: string;
|
|
balance: number; // Calculated balance (positive = credit, negative = debt)
|
|
customMonthlyQuota?: number; // Optional override for default quota
|
|
}
|
|
|
|
export interface Payment {
|
|
id: string;
|
|
familyId: string;
|
|
amount: number;
|
|
datePaid: string; // ISO Date string
|
|
forMonth: number; // 1-12
|
|
forYear: number;
|
|
notes?: string;
|
|
}
|
|
|
|
export interface SmtpConfig {
|
|
host: string;
|
|
port: number;
|
|
user: string;
|
|
pass: string;
|
|
secure: boolean;
|
|
fromEmail: string;
|
|
}
|
|
|
|
export interface AlertDefinition {
|
|
id: string;
|
|
subject: string;
|
|
body: string;
|
|
daysOffset: number; // Number of days
|
|
offsetType: 'before_next_month' | 'after_current_month';
|
|
sendHour: number; // 0-23
|
|
active: boolean;
|
|
lastSent?: string; // ISO Date of last execution
|
|
}
|
|
|
|
export type NoticeIconType = 'info' | 'warning' | 'maintenance' | 'event';
|
|
|
|
export interface Notice {
|
|
id: string;
|
|
condoId: string;
|
|
title: string;
|
|
content: string;
|
|
type: NoticeIconType;
|
|
link?: string;
|
|
date: string; // ISO Date
|
|
active: boolean;
|
|
}
|
|
|
|
export interface NoticeRead {
|
|
userId: string;
|
|
noticeId: string;
|
|
readAt: string;
|
|
}
|
|
|
|
export interface AppSettings {
|
|
// Global settings only
|
|
currentYear: number; // The active fiscal year (could be per-condo, but global for simplicity now)
|
|
smtpConfig?: SmtpConfig;
|
|
}
|
|
|
|
export enum PaymentStatus {
|
|
PAID = 'PAID',
|
|
UNPAID = 'UNPAID', // Past due
|
|
UPCOMING = 'UPCOMING', // Future
|
|
PENDING = 'PENDING'
|
|
}
|
|
|
|
export interface MonthStatus {
|
|
monthIndex: number; // 0-11
|
|
status: PaymentStatus;
|
|
payment?: Payment;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
name?: string;
|
|
role?: 'admin' | 'poweruser' | 'user';
|
|
phone?: string;
|
|
familyId?: string | null;
|
|
receiveAlerts?: boolean;
|
|
}
|
|
|
|
export interface AuthResponse {
|
|
token: string;
|
|
user: User;
|
|
}
|