-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Federal tax bracket radio buttons (#48)
* Add radio buttons to dashboard * add route to submit form when button selected. * Render updated figures. * Refactor radio buttons. * Lint. * Add prys. * Update factories. * Lint.
- Loading branch information
Showing
11 changed files
with
139 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
class DashboardController < ApplicationController | ||
include DashboardBuilder | ||
include Stream | ||
|
||
def index | ||
build_dashboard_variables! | ||
end | ||
|
||
def switch_taxable_income | ||
build_dashboard_variables! | ||
render_respond_to(render_dashboard) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<%= turbo_frame_tag "primary_frame" do %> | ||
<div class="min-h-full"> | ||
<div class="primary-card"> | ||
<div class="mx-auto px-4 py-6 sm:px-6 lg:px-8"> | ||
<h1>Budget Calculator</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<div class="grid grid-cols-3"> | ||
<h3>Final Budget</h3> | ||
<div>Savings Rate %</div> | ||
<div>Investing Rate %</div> | ||
</div> | ||
<div class="grid grid-cols-3"> | ||
<div class="pt-4"> | ||
<%= render partial: "components/income_switch" %> | ||
</div> | ||
|
||
<div class=""> | ||
<%= form_with model: @savings_rate, local: true do |form| %> | ||
<div class="flex"> | ||
<%= form.number_field :rate, in: 0.00..50.00, step: 0.25, value: @savings_rate.display_rate, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-1/4 h-7" %> | ||
<%= form.submit "Save", class:"btn btn-primary ml-4 mt-2 py-0.5 my-auto"%> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<div class=""> | ||
<%= form_with model: @investing_rate, local: true do |form| %> | ||
<div class="flex"> | ||
<%= form.number_field :rate, in: 0.00..50.00, step: 0.25, value: @investing_rate.display_rate, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-1/4 h-7" %> | ||
<%= form.submit "Invest", class:"btn btn-primary ml-4 mt-2 py-0.5 my-auto"%> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<div class="py-4" id="federal_tax_status"> | ||
<strong>Filing status</strong> | ||
<%= form_with url: switch_taxable_income_path, local: true do |form| %> | ||
<div class="flex flex-row"> | ||
<% FederalTaxTableType.all.each do |table| %> | ||
<div class="mx-auto"> | ||
<%= form.radio_button :federal_tax_table_type_id, table.id, checked: table.id == @federal_tax_table_type_id, onchange: "this.form.requestSubmit()" %> | ||
<%= form.label :federal_tax_table_type_id, table.filing_status.humanize.capitalize %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<div id="final_income"> | ||
<%= render partial: "budget/salary_budget", | ||
locals: { | ||
income: @salary_taxed, | ||
total_cost: @total_cost, | ||
investing_amount: @salary_invest, | ||
savings_amount: @salary_saving, | ||
guilt_free: @guilt_free_salary | ||
} | ||
%> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<%= turbo_frame_tag "income_header_frame" do %> | ||
<h1>Income</h1> | ||
<%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %> | ||
<% end %> | ||
|
||
<div class="pt-4"> | ||
<%= render "incomes/index" %> | ||
</div> | ||
|
||
<div class="pt-4"> | ||
<%= render partial: "shared/taxed_incomes", | ||
locals: { salary_taxed: @salary_taxed, hourly_taxed: @hourly_taxed } %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<%= turbo_frame_tag "fixed_expense_header_frame" do %> | ||
<h3>Fixed Expenses</h3> | ||
<%= link_to "New Fixed Expense", new_fixed_expense_path, data: { turbo_frame: :fixed_expenses }, class: "btn btn-primary" %> | ||
<% end %> | ||
|
||
<%= render "fixed_expenses/index" %> | ||
|
||
<%= render partial: "shared/total_costs", locals: { total_cost: @total_cost } %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1 @@ | ||
<div class="min-h-full"> | ||
<div class="primary-card"> | ||
<div class="mx-auto px-4 py-6 sm:px-6 lg:px-8"> | ||
<h1>Budget Calculator</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<div class="grid grid-cols-3"> | ||
<h3>Final Budget</h3> | ||
<div>Savings Rate %</div> | ||
<div>Investing Rate %</div> | ||
</div> | ||
<div class="grid grid-cols-3"> | ||
<div class="pt-4"> | ||
<%= render partial: "components/income_switch" %> | ||
</div> | ||
|
||
<div class=""> | ||
<%= form_with model: @savings_rate, local: true do |form| %> | ||
<div class="flex"> | ||
<%= form.number_field :rate, in: 0.00..50.00, step: 0.25, value: @savings_rate.display_rate, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-1/4 h-7" %> | ||
<%= form.submit "Save", class:"btn btn-primary ml-4 mt-2 py-0.5 my-auto"%> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<div class=""> | ||
<%= form_with model: @investing_rate, local: true do |form| %> | ||
<div class="flex"> | ||
<%= form.number_field :rate, in: 0.00..50.00, step: 0.25, value: @investing_rate.display_rate, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-1/4 h-7" %> | ||
<%= form.submit "Invest", class:"btn btn-primary ml-4 mt-2 py-0.5 my-auto"%> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
</div> | ||
<div id="final_income"> | ||
<%= render partial: "budget/salary_budget", | ||
locals: { | ||
income: @salary_taxed, | ||
total_cost: @total_cost, | ||
investing_amount: @salary_invest, | ||
savings_amount: @salary_saving, | ||
guilt_free: @guilt_free_salary | ||
} | ||
%> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<%= turbo_frame_tag "income_header_frame" do %> | ||
<h1>Income</h1> | ||
<%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %> | ||
<% end %> | ||
|
||
<div class="pt-4"> | ||
<%= render "incomes/index" %> | ||
</div> | ||
|
||
<div class="pt-4"> | ||
<%= render partial: "shared/taxed_incomes", | ||
locals: { salary_taxed: @salary_taxed, hourly_taxed: @hourly_taxed } %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="primary-card"> | ||
<div class="mx-auto py-6 sm:px-6 lg:px-8"> | ||
<%= turbo_frame_tag "fixed_expense_header_frame" do %> | ||
<h3>Fixed Expenses</h3> | ||
<%= link_to "New Fixed Expense", new_fixed_expense_path, data: { turbo_frame: :fixed_expenses }, class: "btn btn-primary" %> | ||
<% end %> | ||
|
||
<%= render "fixed_expenses/index" %> | ||
|
||
<%= render partial: "shared/total_costs", locals: { total_cost: @total_cost } %> | ||
</div> | ||
</div> | ||
</div> | ||
<%= render partial: "dashboard/index" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters