Skip to content

Commit

Permalink
Style incomes. (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
neb417 authored Nov 7, 2024
1 parent 107995d commit bcb75eb
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 66 deletions.
5 changes: 5 additions & 0 deletions app/controllers/incomes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 3 additions & 16 deletions app/views/dashboard/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,10 @@
</div>

<div class="primary-card">
<div class="mx-auto py-6 sm:px-6 lg:px-8">
<%= turbo_frame_tag "income_header_frame" do %>
<strong>Incomes</strong>
<div class="mt-4">
<%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %>
</div>
<% end %>
<%= render "incomes/index" %>

<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>
<%= render partial: "shared/taxed_incomes",
locals: { salary_taxed: @salary_taxed, hourly_taxed: @hourly_taxed } %>
</div>

<div class="primary-card">
Expand Down
30 changes: 22 additions & 8 deletions app/views/incomes/_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<%= turbo_frame_tag :incomes do %>
<h3>Net Income</h3>
<div class="grid grid-cols-5">
<% income_headings = ["Income Type", "Rate", "Hours", "Weekly Gross"] %>
<% income_headings.each do |income_heading| %>
<div class="px-5"><strong><%= income_heading %></strong></div>
<% end %>
</div>
<div class="min-h-full">
<div class="primary-card">
<div class="mx-auto py-6 sm:px-6 lg:px-8">
<strong>Incomes</strong>
<div class="mt-2">
<%= link_to "New Income", new_income_path, data: { turbo_frame: :incomes }, class: "btn btn-primary" %>
</div>

<h3>Net Income</h3>

<%= render @incomes %>
<div class="grid grid-cols-5">
<% income_headings = ["Income Type", "Rate", "Hours", "Weekly Gross"] %>
<% income_headings.each do |income_heading| %>
<div class="px-5">
<strong><%= income_heading %></strong>
</div>
<% end %>
</div>

<%= render @incomes %>
</div>
</div>
</div>
<% end %>
17 changes: 5 additions & 12 deletions app/views/incomes/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<p style="color: green"><%= notice %></p>

<h1>Incomes</h1>

<div id="incomes">
<% @incomes.each do |income| %>
<%= render income %>
<p>
<%= link_to "Show this income", income %>
</p>
<div class="w-full">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
</div>

<%= link_to "New income", new_income_path %>
<%= render partial: "incomes/index" %>
</div>
62 changes: 32 additions & 30 deletions app/views/shared/_taxed_incomes.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<%= turbo_frame_tag "taxed_incomes" do %>
<h3>Gross Income Annual</h3>
<div class="grid grid-cols-5">
<% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Annual"] %>
<% fixed_headings.each do |fixed_heading| %>
<div class="px-5"><strong><%= fixed_heading %></strong></div>
<% end %>
</div>
<div class="mx-auto pb-6 sm:px-6 lg:px-8">
<h3>Gross Income Annual</h3>
<div class="grid grid-cols-5">
<% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Annual"] %>
<% fixed_headings.each do |fixed_heading| %>
<div class="px-5"><strong><%= fixed_heading %></strong></div>
<% end %>
</div>

<div class="grid grid-cols-5">
<div class="px-5">Salary</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: true } %>
</div>
<div class="grid grid-cols-5">
<div class="px-5">Salary</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: true } %>
</div>

<div class="grid grid-cols-5">
<div class="px-5">Hourly</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: true } %>
</div>
<div class="grid grid-cols-5">
<div class="px-5">Hourly</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: true } %>
</div>

<br>
<br>

<h3>Gross Income Bi-Weekly</h3>
<div class="grid grid-cols-5">
<% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Bi-weekly"] %>
<% fixed_headings.each do |fixed_heading| %>
<div class="px-5"><strong><%= fixed_heading %></strong></div>
<% end %>
</div>
<h3>Gross Income Bi-Weekly</h3>
<div class="grid grid-cols-5">
<% fixed_headings = ["Income Type", "Federal Tax", "Fica Tax", "State Tax", "Bi-weekly"] %>
<% fixed_headings.each do |fixed_heading| %>
<div class="px-5"><strong><%= fixed_heading %></strong></div>
<% end %>
</div>

<div class="grid grid-cols-5">
<div class="px-5">Salary</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: false } %>
</div>
<div class="grid grid-cols-5">
<div class="px-5">Salary</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: salary_taxed, annual: false } %>
</div>

<div class="grid grid-cols-5">
<div class="px-5">Hourly</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: false } %>
<div class="grid grid-cols-5">
<div class="px-5">Hourly</div>
<%= render partial: "shared/taxed_income", locals: { taxed_income: hourly_taxed, annual: false } %>
</div>
</div>
<% end %>

0 comments on commit bcb75eb

Please sign in to comment.