diff --git a/app/assets/stylesheets/tax_references.scss b/app/assets/stylesheets/tax_references.scss new file mode 100644 index 0000000..7830c92 --- /dev/null +++ b/app/assets/stylesheets/tax_references.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the TaxReferences controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/tax_references_controller.rb b/app/controllers/tax_references_controller.rb new file mode 100644 index 0000000..9b089f1 --- /dev/null +++ b/app/controllers/tax_references_controller.rb @@ -0,0 +1,10 @@ +class TaxReferencesController < ApplicationController + def index + @tax_references = TaxReference.all + end + + def show + @tax_references = TaxReference.all + @tax_reference = TaxReference.find_by(year: params[:year]) + end +end diff --git a/app/helpers/tax_references_helper.rb b/app/helpers/tax_references_helper.rb new file mode 100644 index 0000000..49539e9 --- /dev/null +++ b/app/helpers/tax_references_helper.rb @@ -0,0 +1,2 @@ +module TaxReferencesHelper +end diff --git a/app/models/tax_reference.rb b/app/models/tax_reference.rb new file mode 100644 index 0000000..984aeff --- /dev/null +++ b/app/models/tax_reference.rb @@ -0,0 +1,17 @@ +class TaxReference < ApplicationRecord + validates :year, uniqueness: true + MAX_MONTHLY_HOURS = 172 + + def worker_contribution(number_of_hours) + return self.hourly_wage * number_of_hours * self.worker_percentage / 100 + end + + def employer_contribution(number_of_hours) + return self.hourly_wage * number_of_hours * self.employer_percentage / 100 + end + + def total_contribution(number_of_hours) + return self.employer_contribution(number_of_hours) + + self.worker_contribution(number_of_hours) + end +end diff --git a/app/views/layouts/_top_navigation.html.erb b/app/views/layouts/_top_navigation.html.erb index 466c4af..6b0ef44 100644 --- a/app/views/layouts/_top_navigation.html.erb +++ b/app/views/layouts/_top_navigation.html.erb @@ -7,11 +7,11 @@