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

Nj 75 medical #4869

Merged
merged 5 commits into from
Oct 23, 2024
Merged
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
4 changes: 4 additions & 0 deletions app/assets/stylesheets/components/_form-elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@
.textarea {
margin-bottom: 0;
}

.form-group .form-question + .text--help{
margin-top: 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module StateFile
module Questions
class NjMedicalExpensesController < QuestionsController
include ReturnToReviewConcern

before_action -> { @filing_year = Rails.configuration.statefile_current_tax_year }
mmazanec22 marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
15 changes: 15 additions & 0 deletions app/forms/state_file/nj_medical_expenses_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module StateFile
class NjMedicalExpensesForm < QuestionsForm
set_attributes_for :intake,
:medical_expenses

validates_numericality_of :medical_expenses, only_integer: true, message: :round_to_whole_number
validates :medical_expenses, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 0 }

def save
unless medical_expenses.nil?
@intake.update(attributes_for(:intake))
end
end
end
end
26 changes: 14 additions & 12 deletions app/helpers/vita_min_form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ def vita_min_state_file_select(
html_options_with_errors = html_options.merge(error_attributes(method: method))

html_output = <<~HTML
<div class="form-group#{error_state(object, method)}">
#{formatted_label}
<div class="select">
#{select(method, collection, options, html_options_with_errors, &block)}
</div>
#{errors_for(object, method)}
</div>
HTML
<div class="form-group#{error_state(object, method)}">
#{formatted_label}
<div class="select">
#{select(method, collection, options, html_options_with_errors, &block)}
</div>
#{errors_for(object, method)}
</div>
HTML

html_output.html_safe
end
Expand Down Expand Up @@ -282,11 +282,12 @@ def vita_min_money_field(
method,
label_text,
options: {},
classes: []
classes: [],
help_text: nil
)
text_field_options = standard_options.merge(
class: (classes + ["text-input money-input"]).join(" "),
).merge(options).merge(error_attributes(method: method)).merge(placeholder: '0.00')
).merge(error_attributes(method: method)).merge(placeholder: '0.00').merge(options)

text_field_options[:id] ||= sanitized_id(method)
options[:input_id] ||= sanitized_id(method)
Expand All @@ -301,6 +302,7 @@ def vita_min_money_field(
prefix: '$',
options: options,
wrapper_classes: wrapper_classes,
help_text: help_text
)

html_output = <<~HTML
Expand Down Expand Up @@ -412,9 +414,9 @@ def continue(value = I18n.t("general.continue"))
def warning_for_select(element_id, permitted_values, msg)
@template.content_tag(:div, msg,
class: "warning warning-for-select",
"data-warning-for-select": element_id,
'data-warning-for-select': element_id,
style: "display:none",
"data-permitted": permitted_values.to_json
'data-permitted': permitted_values.to_json
)
end
end
2 changes: 2 additions & 0 deletions app/lib/efile/line_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ NJ1040_LINE_27:
label: '27 Total Income (Add lines 15, 16a, and 20a)'
NJ1040_LINE_29:
label: "29 New Jersey Gross Income (Subtract line 28c from line 27) (See instructions)"
NJ1040_LINE_31:
label: "Medical Expenses (See Worksheet F and instructions)"
NJ1040_LINE_38:
label: "38 Total Exemptions and Deductions (Add lines 30 through 37c)"
NJ1040_LINE_39:
Expand Down
11 changes: 10 additions & 1 deletion app/lib/efile/nj/nj1040_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def calculate
set_line(:NJ1040_LINE_15, :calculate_line_15)
set_line(:NJ1040_LINE_27, :calculate_line_27)
set_line(:NJ1040_LINE_29, :calculate_line_29)
set_line(:NJ1040_LINE_31, :calculate_line_31)
set_line(:NJ1040_LINE_38, :calculate_line_38)
set_line(:NJ1040_LINE_39, :calculate_line_39)
set_line(:NJ1040_LINE_40A, :calculate_line_40a)
Expand Down Expand Up @@ -186,8 +187,16 @@ def calculate_line_29
calculate_line_27
end

def calculate_line_31
two_percent_gross = calculate_line_29 * 0.02
difference_with_med_expenses = @intake.medical_expenses - two_percent_gross
rounded_difference = difference_with_med_expenses.round
return rounded_difference if rounded_difference.positive?
nil
end

def calculate_line_38
calculate_line_13
calculate_line_13 + line_or_zero(:NJ1040_LINE_31)
mmazanec22 marked this conversation as resolved.
Show resolved Hide resolved
end

def calculate_line_39
Expand Down
1 change: 1 addition & 0 deletions app/lib/navigation/state_file_nj_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class StateFileNjQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::NameDobController),
Navigation::NavigationStep.new(StateFile::Questions::NjCountyController),
Navigation::NavigationStep.new(StateFile::Questions::NjMunicipalityController),
Navigation::NavigationStep.new(StateFile::Questions::NjMedicalExpensesController),
Navigation::NavigationStep.new(StateFile::Questions::NjHouseholdRentOwnController),
Navigation::NavigationStep.new(StateFile::Questions::NjHomeownerEligibilityController),
Navigation::NavigationStep.new(StateFile::Questions::NjTenantEligibilityController),
Expand Down
14 changes: 14 additions & 0 deletions app/lib/pdf_filler/nj1040_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ def hash_for_pdf
]))
end

if @xml_document.at("Body MedicalExpenses")
medical_expenses = @xml_document.at("Body MedicalExpenses").text.to_i
answers.merge!(insert_digits_into_fields(medical_expenses, [
"219",
"undefined_93",
"218",
"217",
"undefined_92",
"216",
"215",
"31"
]))
end

if @xml_document.at("TotalExemptDeductions")
total_exemptions = @xml_document.at("TotalExemptDeductions").text.to_i
answers.merge!(insert_digits_into_fields(total_exemptions, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def document
end

xml.TotalExemptionAmountB calculated_fields.fetch(:NJ1040_LINE_13)

if calculated_fields.fetch(:NJ1040_LINE_31)
xml.MedicalExpenses calculated_fields.fetch(:NJ1040_LINE_31)
end

xml.TotalExemptDeductions calculated_fields.fetch(:NJ1040_LINE_38)

if calculated_fields.fetch(:NJ1040_LINE_39) > 0
Expand Down
1 change: 1 addition & 0 deletions app/models/state_file_nj_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# last_sign_in_ip :inet
# locale :string default("en")
# locked_at :datetime
# medical_expenses :integer default(0), not null
# message_tracker :jsonb
# municipality_code :string
# municipality_name :string
Expand Down
41 changes: 41 additions & 0 deletions app/views/state_file/questions/nj_medical_expenses/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<%
title = t(".title", filing_year: @filing_year)
content_for :page_title, title
%>

<% content_for :card do %>
<h1 class="h2"><%= t(".title") %></h1>
<%= t(".description_html") %>

<%= form_with model: @form, url: { action: :update }, local: true, method: "put", builder: VitaMinFormBuilder do |f| %>
<div class="white-group">
<%= f.vita_min_money_field(
:medical_expenses,
t('.label', filing_year: @filing_year),
help_text: t('.help_text'),
classes: ["form-width--long"],
options: { placeholder: "" }
) %>
</div>

<p><%= t(".do_not_claim") %></p>

<div class="reveal">
<h2 style="margin-bottom: 0">
<a class="reveal__link" aria-controls="nj-medical-details" aria-expanded="false">
<%= t('.learn_more_title') %>
</a>
</h2>
<div class="reveal__content" id="nj-medical-details">
<p><%= t('.learn_more_meaning') %>:</p>
<ul class="list--bulleted"><%= t('.learn_more_content_html') %></ul>
<p><%= t('.learn_more_note_html') %></p>
</div>
</div>

<% if params[:return_to_review].present? %>
<%= hidden_field_tag "return_to_review", params[:return_to_review] %>
<% end %>
<%= f.continue %>
<% end %>
<% end %>
11 changes: 11 additions & 0 deletions app/views/state_file/questions/nj_review/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@
</div>
</div>
<% end %>

<div id="medical_expenses" class="white-group">
<div class="spacing-below-5">
<p class="text--bold spacing-below-5"><%=t(".medical_expenses") %></p>
<p><%= number_to_currency(current_intake.medical_expenses) %></p>
<%= link_to StateFile::Questions::NjMedicalExpensesController.to_path_helper(return_to_review: "y"), class: "button--small" do %>
<%= t("general.edit") %>
<span class="sr-only"><%= t(".medical_expenses") %></span>
<% end %>
</div>
</div>

<%= render "state_file/questions/shared/review_footer" %>
<% end %>
24 changes: 24 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,29 @@ en:
edit:
helper_description: Please continue to see what else we can guide you to qualify for.
title: Looks like you’re not eligible for this credit.
nj_medical_expenses:
edit:
description_html: |-
<p>This includes expenses for yourself, your spouse, and your dependents.</p>
<p>Only expenses that exceed 2% of your gross income may be deducted.</p>
<p>You can’t deduct expenses for which you were reimbursed through your health insurance plan.</p>
do_not_claim: If you do not want to claim this deduction, click “Continue”.
help_text: Estimates are ok. For example, $3000.
label: Non-reimbursed medical expenses paid in %{filing_year}
learn_more_content_html: |-
<li>Physicians, dental, and other medical fees</li><li>Prescription eyeglasses and contact lenses</li>
<li>Hospital care</li>
<li>Nursing care</li>
<li>Medicines and drugs</li><li>Prosthetic devices</li>
<li>X‑rays and other diagnostic services conducted by or directed by a physician or dentist</li>
<li>Amounts paid for transportation primarily for and essential to medical care</li>
<li>Insurance (including amounts paid as premiums under Part B of Title XVIII of the Social Security Act, relating to supplementary medical insurance for the aged) covering medical care</li>
learn_more_meaning: Medical expenses means non-reimbursed payments for costs such as
learn_more_note_html: |-
Note: In NJ, if you are paying for your adult child’s health insurance (ages 18 to 27), this can only be deducted as a medical expense <a href="https://www.nj.gov/treasury/taxation/pdf/pubs/tams/tam14.pdf" target="blank" rel=
oopener noreferrer">if the child was your dependent.</a>
learn_more_title: What are medical expenses?
title: You can deduct medical expenses.
nj_municipality:
edit:
helper_description_html: If the place where you live is not listed, use the <a href="https://www.nj.gov/nj/gov/county/localities.html" target="_blank" rel="noopener nofollow">NJ state locality tool</a> to get the name of your municipality.
Expand All @@ -2649,6 +2672,7 @@ en:
edit:
county: County
household_rent_own: Rent or own home
medical_expenses: Medical expenses
municipality: Municipality
primary_disabled: I have a disability
property_tax_paid: Property taxes paid
Expand Down
24 changes: 24 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,29 @@ es:
edit:
helper_description: Continúe viendo para qué más podemos ayudarlo a calificar.
title: Parece que no eres elegible para este crédito.
nj_medical_expenses:
edit:
description_html: |-
<p>This includes expenses for yourself, your spouse, and your dependents.</p>
<p>Only expenses that exceed 2% of your gross income may be deducted.</p>
<p>You can’t deduct expenses for which you were reimbursed through your health insurance plan.</p>
do_not_claim: If you do not want to claim this deduction, click “Continue”.
help_text: Estimates are ok. For example, $3000.
label: Non-reimbursed medical expenses paid in %{filing_year}
learn_more_content_html: |-
<li>Physicians, dental, and other medical fees</li><li>Prescription eyeglasses and contact lenses</li>
<li>Hospital care</li>
<li>Nursing care</li>
<li>Medicines and drugs</li><li>Prosthetic devices</li>
<li>X‑rays and other diagnostic services conducted by or directed by a physician or dentist</li>
<li>Amounts paid for transportation primarily for and essential to medical care</li>
<li>Insurance (including amounts paid as premiums under Part B of Title XVIII of the Social Security Act, relating to supplementary medical insurance for the aged) covering medical care</li>
learn_more_meaning: Medical expenses means non-reimbursed payments for costs such as
learn_more_note_html: |-
Note: In NJ, if you are paying for your adult child’s health insurance (ages 18 to 27), this can only be deducted as a medical expense <a href="https://www.nj.gov/treasury/taxation/pdf/pubs/tams/tam14.pdf" target="blank" rel=
oopener noreferrer">if the child was your dependent.</a>
learn_more_title: What are medical expenses?
title: You can deduct medical expenses.
nj_municipality:
edit:
helper_description_html: Si el lugar donde usted vive no aparece en la lista, utilice la <a href="https://www.nj.gov/nj/gov/county/localities.html" target="_blank" rel="noopener nofollow">herramienta de localidad del estado de New Jersey</a> para obtener el nombre de su municipio.
Expand All @@ -2623,6 +2646,7 @@ es:
edit:
county: Condado
household_rent_own: Vivienda en alquiler o en propiedad propia
medical_expenses: Gastos médicos
municipality: Municipio
primary_disabled: Primary disabled
property_tax_paid: Impuestos sobre la propiedad pagados
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddMedicalExpensesToNjIntake < ActiveRecord::Migration[7.1]
def change
add_column :state_file_nj_intakes, :medical_expenses, :integer, default: 0, null: false
mmazanec22 marked this conversation as resolved.
Show resolved Hide resolved
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,7 @@
t.inet "last_sign_in_ip"
t.string "locale", default: "en"
t.datetime "locked_at"
t.integer "medical_expenses", default: 0, null: false
t.jsonb "message_tracker", default: {}
t.string "municipality_code"
t.string "municipality_name"
Expand Down
35 changes: 35 additions & 0 deletions spec/controllers/state_file/questions/nj_medical_expenses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require "rails_helper"

RSpec.describe StateFile::Questions::NjCountyController do
let(:intake) { create :state_file_nj_intake }
before do
sign_in intake
end

describe "#edit" do
render_views
it 'succeeds' do
get :edit
expect(response).to be_successful
end

describe "#update" do
context "when a user has medical expenses" do
let(:form_params) {
{
state_file_nj_medical_expenses_form: {
medical_expenses: 1000,
}
}
}

it "saves the correct value for renter" do
post :update, params: form_params

intake.reload
expect(intake.medical_expenses).to eq 1000
end
end
end
end
end
1 change: 1 addition & 0 deletions spec/factories/state_file_nj_intakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# last_sign_in_ip :inet
# locale :string default("en")
# locked_at :datetime
# medical_expenses :integer default(0), not null
# message_tracker :jsonb
# municipality_code :string
# municipality_name :string
Expand Down
Loading
Loading