32 lines
812 B
TypeScript
32 lines
812 B
TypeScript
import { MembershipFeeDto } from '../dtos';
|
|
|
|
export class MembershipFeeViewModel implements MembershipFeeDto {
|
|
leagueId: string;
|
|
amount: number;
|
|
currency: string;
|
|
period: string;
|
|
|
|
constructor(dto: MembershipFeeDto) {
|
|
Object.assign(this, dto);
|
|
}
|
|
|
|
/** UI-specific: Formatted amount */
|
|
get formattedAmount(): string {
|
|
return `${this.currency} ${this.amount.toFixed(2)}`;
|
|
}
|
|
|
|
/** UI-specific: Period display */
|
|
get periodDisplay(): string {
|
|
switch (this.period) {
|
|
case 'monthly': return 'Monthly';
|
|
case 'yearly': return 'Yearly';
|
|
case 'season': return 'Per Season';
|
|
default: return this.period;
|
|
}
|
|
}
|
|
|
|
/** UI-specific: Amount per period */
|
|
get amountPerPeriod(): string {
|
|
return `${this.formattedAmount} ${this.periodDisplay.toLowerCase()}`;
|
|
}
|
|
} |