Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loan start date #1612

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/loans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class LoansController < ApplicationController
include AccountableResource

permitted_accountable_attributes(
:id, :rate_type, :interest_rate, :term_months
:id, :rate_type, :interest_rate, :term_months, :start_date
)
end
5 changes: 5 additions & 0 deletions app/views/loans/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
label: t("loans.form.term_months"),
placeholder: t("loans.form.term_months_placeholder") %>
</div>

<div class="flex items-center gap-2">
<%= loan_form.date_field :start_date,
label: t("loans.form.start_date") %>
</div>
<% end %>
</div>
<% end %>
4 changes: 4 additions & 0 deletions app/views/loans/_overview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<%= summary_card title: t(".type") do %>
<%= account.loan.rate_type&.titleize || t(".unknown") %>
<% end %>

<%= summary_card title: t(".start_date") do %>
<%= account.loan.start_date&.strftime("%B %d, %Y") || t(".unknown") %>
<% end %>
</div>

<div class="flex justify-center py-8">
Expand Down
2 changes: 2 additions & 0 deletions config/locales/views/loans/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ en:
rate_type: Rate type
term_months: Term (months)
term_months_placeholder: '360'
start_date: Loan start date
new:
title: Enter loan details
overview:
interest_rate: Interest Rate
monthly_payment: Monthly Payment
start_date: Start Date
not_applicable: N/A
original_principal: Original Principal
remaining_principal: Remaining Principal
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20250109165633_add_start_date_to_loans.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddStartDateToLoans < ActiveRecord::Migration[7.2]
def change
add_column :loans, :start_date, :date
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading