website refactor
This commit is contained in:
@@ -9,9 +9,9 @@ export class BillingViewModel {
|
||||
stats: BillingStatsViewModel;
|
||||
|
||||
constructor(data: {
|
||||
paymentMethods: any[];
|
||||
invoices: any[];
|
||||
stats: any;
|
||||
paymentMethods: unknown[];
|
||||
invoices: unknown[];
|
||||
stats: unknown;
|
||||
}) {
|
||||
this.paymentMethods = data.paymentMethods.map(pm => new PaymentMethodViewModel(pm));
|
||||
this.invoices = data.invoices.map(inv => new InvoiceViewModel(inv));
|
||||
@@ -29,15 +29,17 @@ export class PaymentMethodViewModel {
|
||||
expiryYear?: number;
|
||||
bankName?: string;
|
||||
|
||||
constructor(data: any) {
|
||||
this.id = data.id;
|
||||
this.type = data.type;
|
||||
this.last4 = data.last4;
|
||||
this.brand = data.brand;
|
||||
this.isDefault = data.isDefault;
|
||||
this.expiryMonth = data.expiryMonth;
|
||||
this.expiryYear = data.expiryYear;
|
||||
this.bankName = data.bankName;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.id = d.id;
|
||||
this.type = d.type;
|
||||
this.last4 = d.last4;
|
||||
this.brand = d.brand;
|
||||
this.isDefault = d.isDefault;
|
||||
this.expiryMonth = d.expiryMonth;
|
||||
this.expiryYear = d.expiryYear;
|
||||
this.bankName = d.bankName;
|
||||
}
|
||||
|
||||
get displayLabel(): string {
|
||||
@@ -68,18 +70,20 @@ export class InvoiceViewModel {
|
||||
sponsorshipType: 'league' | 'team' | 'driver' | 'race' | 'platform';
|
||||
pdfUrl: string;
|
||||
|
||||
constructor(data: any) {
|
||||
this.id = data.id;
|
||||
this.invoiceNumber = data.invoiceNumber;
|
||||
this.date = new Date(data.date);
|
||||
this.dueDate = new Date(data.dueDate);
|
||||
this.amount = data.amount;
|
||||
this.vatAmount = data.vatAmount;
|
||||
this.totalAmount = data.totalAmount;
|
||||
this.status = data.status;
|
||||
this.description = data.description;
|
||||
this.sponsorshipType = data.sponsorshipType;
|
||||
this.pdfUrl = data.pdfUrl;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.id = d.id;
|
||||
this.invoiceNumber = d.invoiceNumber;
|
||||
this.date = new Date(d.date);
|
||||
this.dueDate = new Date(d.dueDate);
|
||||
this.amount = d.amount;
|
||||
this.vatAmount = d.vatAmount;
|
||||
this.totalAmount = d.totalAmount;
|
||||
this.status = d.status;
|
||||
this.description = d.description;
|
||||
this.sponsorshipType = d.sponsorshipType;
|
||||
this.pdfUrl = d.pdfUrl;
|
||||
}
|
||||
|
||||
get formattedTotalAmount(): string {
|
||||
@@ -107,13 +111,15 @@ export class BillingStatsViewModel {
|
||||
activeSponsorships: number;
|
||||
averageMonthlySpend: number;
|
||||
|
||||
constructor(data: any) {
|
||||
this.totalSpent = data.totalSpent;
|
||||
this.pendingAmount = data.pendingAmount;
|
||||
this.nextPaymentDate = new Date(data.nextPaymentDate);
|
||||
this.nextPaymentAmount = data.nextPaymentAmount;
|
||||
this.activeSponsorships = data.activeSponsorships;
|
||||
this.averageMonthlySpend = data.averageMonthlySpend;
|
||||
constructor(data: unknown) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const d = data as any;
|
||||
this.totalSpent = d.totalSpent;
|
||||
this.pendingAmount = d.pendingAmount;
|
||||
this.nextPaymentDate = new Date(d.nextPaymentDate);
|
||||
this.nextPaymentAmount = d.nextPaymentAmount;
|
||||
this.activeSponsorships = d.activeSponsorships;
|
||||
this.averageMonthlySpend = d.averageMonthlySpend;
|
||||
}
|
||||
|
||||
get formattedTotalSpent(): string {
|
||||
|
||||
Reference in New Issue
Block a user