diff --git a/app/controllers/incomes_controller.rb b/app/controllers/incomes_controller.rb index def3700..b9b27f7 100644 --- a/app/controllers/incomes_controller.rb +++ b/app/controllers/incomes_controller.rb @@ -10,6 +10,11 @@ class IncomesController < ApplicationController # GET /incomes or /incomes.json def index @incomes = Income.all + + respond_to do |format| + format.html { render :index } + format.json { render json: @incomes } + end end # GET /incomes/1 or /incomes/1.json diff --git a/app/views/dashboard/_index.html.erb b/app/views/dashboard/_index.html.erb index 7d544af..6ff43a8 100644 --- a/app/views/dashboard/_index.html.erb +++ b/app/views/dashboard/_index.html.erb @@ -64,23 +64,10 @@
-
- <%= turbo_frame_tag "income_header_frame" do %> - Incomes -
- <%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %> -
- <% end %> + <%= render "incomes/index" %> -
- <%= render "incomes/index" %> -
- -
- <%= render partial: "shared/taxed_incomes", - locals: { salary_taxed: @salary_taxed, hourly_taxed: @hourly_taxed } %> -
-
+ <%= render partial: "shared/taxed_incomes", + locals: { salary_taxed: @salary_taxed, hourly_taxed: @hourly_taxed } %>
diff --git a/app/views/incomes/_index.html.erb b/app/views/incomes/_index.html.erb index 3353331..aa04a92 100644 --- a/app/views/incomes/_index.html.erb +++ b/app/views/incomes/_index.html.erb @@ -1,11 +1,25 @@ <%= turbo_frame_tag :incomes do %> -

Net Income

-
- <% income_headings = ["Income Type", "Rate", "Hours", "Weekly Gross"] %> - <% income_headings.each do |income_heading| %> -
<%= income_heading %>
- <% end %> -
+
+
+
+ Incomes +
+ <%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %> +
+ +

Net Income

- <%= render @incomes %> +
+ <% income_headings = ["Income Type", "Rate", "Hours", "Weekly Gross"] %> + <% income_headings.each do |income_heading| %> +
+ <%= income_heading %> +
+ <% end %> +
+ + <%= render @incomes %> +
+
+
<% end %> diff --git a/app/views/incomes/index.html.erb b/app/views/incomes/index.html.erb index 394e7fa..ed4bcb0 100644 --- a/app/views/incomes/index.html.erb +++ b/app/views/incomes/index.html.erb @@ -1,14 +1,7 @@ -

<%= notice %>

- -

Incomes

- -
- <% @incomes.each do |income| %> - <%= render income %> -

- <%= link_to "Show this income", income %> -

+
+ <% if notice.present? %> +

<%= notice %>

<% end %> -
-<%= link_to "New income", new_income_path %> + <%= render partial: "incomes/index" %> +
diff --git a/app/views/shared/_taxed_incomes.html.erb b/app/views/shared/_taxed_incomes.html.erb index d376c99..206897e 100644 --- a/app/views/shared/_taxed_incomes.html.erb +++ b/app/views/shared/_taxed_incomes.html.erb @@ -1,39 +1,41 @@ <%= turbo_frame_tag "taxed_incomes" do %> -

Gross Income Annual

-
- <% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Annual"] %> - <% fixed_headings.each do |fixed_heading| %> -
<%= fixed_heading %>
- <% end %> -
+
+

Gross Income Annual

+
+ <% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Annual"] %> + <% fixed_headings.each do |fixed_heading| %> +
<%= fixed_heading %>
+ <% end %> +
-
-
Salary
- <%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: true } %> -
+
+
Salary
+ <%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: true } %> +
-
-
Hourly
- <%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: true } %> -
+
+
Hourly
+ <%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: true } %> +
-
+
-

Gross Income Bi-Weekly

-
- <% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Bi-weekly"] %> - <% fixed_headings.each do |fixed_heading| %> -
<%= fixed_heading %>
- <% end %> -
+

Gross Income Bi-Weekly

+
+ <% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Bi-weekly"] %> + <% fixed_headings.each do |fixed_heading| %> +
<%= fixed_heading %>
+ <% end %> +
-
-
Salary
- <%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: false } %> -
+
+
Salary
+ <%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: false } %> +
-
-
Hourly
- <%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: false } %> +
+
Hourly
+ <%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: false } %> +
<% end %>