diff --git a/frontend/src/views/loans/LoansView.vue b/frontend/src/views/loans/LoansView.vue index 418b3c9..a7e70e4 100644 --- a/frontend/src/views/loans/LoansView.vue +++ b/frontend/src/views/loans/LoansView.vue @@ -109,10 +109,16 @@ - Amortization Schedule + + Amortization Schedule + + + {{ showPastPayments ? 'Hide' : 'Show' }} past payments + + @@ -267,12 +273,20 @@ const prePopulated = ref(false) const snackbar = ref(false) const snackbarText = ref('') const snackbarColor = ref('success') +const showPastPayments = ref(false) const loanAccountTypes = ['AutoLoan', 'PersonalLoan', 'Mortgage', 'LineOfCredit'] const loanAccounts = computed(() => accountsStore.accounts.filter(a => a.hasLoanDetail || loanAccountTypes.includes(a.type)) ) +const filteredSchedule = computed(() => { + if (!loanDetail.value) return [] + if (showPastPayments.value) return loanDetail.value.amortizationSchedule + const today = new Date().toISOString().split('T')[0] + return loanDetail.value.amortizationSchedule.filter(e => e.paymentDate.split('T')[0] >= today) +}) + const amortHeaders = [ { title: '#', key: 'paymentNumber', width: '60px' }, { title: 'Date', key: 'paymentDate', width: '110px' },