Skip to content

Commit

Permalink
Merge branch 'main' into FYST-656-implement-form-502-xml-pdf-deductions
Browse files Browse the repository at this point in the history
  • Loading branch information
jenny-heath committed Nov 4, 2024
2 parents a8691be + eca2469 commit 89bedca
Show file tree
Hide file tree
Showing 121 changed files with 2,187 additions and 613 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'rack', '>= 2.0.8'
gem 'rails', '~> 7.1'
gem 'puma', '>= 5.3.2'
gem 'sass-rails', '~> 5.0'
gem 'cfa-styleguide', '0.10.5', git: 'https://github.com/codeforamerica/honeycrisp-gem', branch: 'main', ref: '4c6f873f55704ec34fd518906f131133b290e56a'
gem 'cfa-styleguide', '0.15.2', git: 'https://github.com/codeforamerica/honeycrisp-gem', branch: 'main', ref: '64379cc8e7cf77ed68a98e226146405864ab49b5'
gem 'nokogiri', '>= 1.10.8'
gem 'recaptcha'
gem "activerecord-cte" # Can be removed when we move to Rails 7.1
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
GIT
remote: https://github.com/codeforamerica/honeycrisp-gem
revision: 4c6f873f55704ec34fd518906f131133b290e56a
ref: 4c6f873f55704ec34fd518906f131133b290e56a
revision: 64379cc8e7cf77ed68a98e226146405864ab49b5
ref: 64379cc8e7cf77ed68a98e226146405864ab49b5
branch: main
specs:
cfa-styleguide (0.10.5)
cfa-styleguide (0.15.2)
autoprefixer-rails
bourbon
jquery-rails
Expand Down Expand Up @@ -104,7 +104,7 @@ GEM
ast (2.4.2)
auto_strip_attributes (2.6.0)
activerecord (>= 4.0)
autoprefixer-rails (10.4.15.0)
autoprefixer-rails (10.4.19.0)
execjs (~> 2)
awesome_print (1.9.2)
aws-eventstream (1.2.0)
Expand Down Expand Up @@ -741,7 +741,7 @@ DEPENDENCIES
byebug
cancancan
capybara (>= 2.15)
cfa-styleguide (= 0.10.5)!
cfa-styleguide (= 0.15.2)!
combine_pdf
data_migrate
database_cleaner
Expand Down
13 changes: 10 additions & 3 deletions app/assets/stylesheets/_state-file.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@
}
}

.beige-group {
background: $color-beige;
border: 2px solid $color-grey;
padding: 2rem;
margin-bottom: 2rem;
}

.white-group {
padding: 2rem;
margin-bottom: 2rem;
Expand Down Expand Up @@ -516,7 +523,7 @@
}
}

.reveal__link {
.reveal__button {
color: black;
line-height: 2.4rem;
padding-left: 3rem;
Expand All @@ -525,13 +532,13 @@
background-position-y: 0.3rem;
}

.reveal__link:after {
.reveal__button:after {
content: "\e5ce";
font-size: 2.4rem;
font-weight: normal;
}

.reveal.is-hiding-content .reveal__link:after {
.reveal.is-hiding-content .reveal__button:after {
content: "\e5cf";
font-size: 2.5rem;
font-weight: normal;
Expand Down
3 changes: 2 additions & 1 deletion app/assets/stylesheets/components/_reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
margin-bottom: 0;
}

.reveal__link {
.reveal__button {
border: none;
background: transparent;
font-weight: $font-weight-bold;
display: flex;
justify-content: space-between;
width: 100%;

&:focus {
box-shadow: none;
Expand Down
7 changes: 7 additions & 0 deletions app/assets/stylesheets/templates/_hub.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ body.hub {
width: 100%;
overflow-x: auto;
}

.reassign-roles {
width: 375px;
.reveal__button {
width: 100%;
}
}
}

// TODO: Move these styles into .hub
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module StateFile
module Questions
class IdHealthInsurancePremiumController < QuestionsController
include ReturnToReviewConcern
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module StateFile
module Questions
class NjVeteransExemptionController < QuestionsController
include ReturnToReviewConcern
end
end
end
1 change: 1 addition & 0 deletions app/controllers/state_file/questions/w2_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def form_params

def load_w2
@w2 = current_intake.state_file_w2s.find(params[:id])
@box14_codes = StateFile::StateInformationService.w2_supported_box14_codes(current_state_code)
end
end
end
Expand Down
21 changes: 21 additions & 0 deletions app/forms/state_file/id_health_insurance_premium_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module StateFile
class IdHealthInsurancePremiumForm < QuestionsForm
set_attributes_for :intake, :has_health_insurance_premium, :health_insurance_paid_amount

validates :has_health_insurance_premium, inclusion: { in: %w[yes no], message: :blank }
validates :health_insurance_paid_amount,
presence: true,
numericality: {
allow_blank: true,
greater_than_or_equal_to: 0,
message: I18n.t("validators.not_a_number")
},
if: -> { has_health_insurance_premium == "yes" }

def save
attributes_to_save = attributes_for(:intake)
attributes_to_save[:health_insurance_paid_amount] = nil if has_health_insurance_premium == "no"
@intake.update!(attributes_to_save)
end
end
end
4 changes: 2 additions & 2 deletions app/forms/state_file/nj_homeowner_property_tax_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class NjHomeownerPropertyTaxForm < QuestionsForm
:property_tax_paid

validates :property_tax_paid, presence: true
validates_numericality_of :property_tax_paid, only_integer: true, message: :round_to_whole_number, if: -> { property_tax_paid.present? }
validates :property_tax_paid, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { property_tax_paid.present? }
validates_numericality_of :property_tax_paid, message: I18n.t("validators.not_a_number"), if: -> { property_tax_paid.present? }
validates :property_tax_paid, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { property_tax_paid.present? }

def save
@intake.update(attributes_for(:intake))
Expand Down
2 changes: 1 addition & 1 deletion app/forms/state_file/nj_medical_expenses_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class NjMedicalExpensesForm < QuestionsForm
set_attributes_for :intake,
:medical_expenses

validates_numericality_of :medical_expenses, only_integer: true, message: :round_to_whole_number
validates_numericality_of :medical_expenses, message: I18n.t("validators.not_a_number"), if: -> { medical_expenses.present? }
validates :medical_expenses, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 0 }

def save
Expand Down
3 changes: 1 addition & 2 deletions app/forms/state_file/nj_sales_use_tax_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ class NjSalesUseTaxForm < QuestionsForm
presence: true,
numericality: {
allow_blank: true,
only_integer: true,
greater_than_or_equal_to: 0,
message: :round_to_whole_number
message: I18n.t("validators.not_a_number")
},
if: -> { sales_use_tax_calculation_method == "manual" }

Expand Down
4 changes: 2 additions & 2 deletions app/forms/state_file/nj_tenant_rent_paid_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class NjTenantRentPaidForm < QuestionsForm
:rent_paid

validates :rent_paid, presence: true
validates_numericality_of :rent_paid, only_integer: true, message: :round_to_whole_number, if: -> { rent_paid.present? }
validates :rent_paid, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 1 }, if: -> { rent_paid.present? }
validates_numericality_of :rent_paid, message: I18n.t("validators.not_a_number"), if: -> { rent_paid.present? }
validates :rent_paid, presence: true, numericality: { greater_than_or_equal_to: 1 }, if: -> { rent_paid.present? }

def save
@intake.update(attributes_for(:intake))
Expand Down
13 changes: 13 additions & 0 deletions app/forms/state_file/nj_veterans_exemption_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module StateFile
class NjVeteransExemptionForm < QuestionsForm
set_attributes_for :intake,
:primary_veteran,
:spouse_veteran

validates :primary_veteran, presence: true
validates :spouse_veteran, presence: true, if: -> { intake.filing_status_mfj? }
def save
@intake.update(attributes_for(:intake))
end
end
end
4 changes: 2 additions & 2 deletions app/helpers/vita_min_form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def vita_min_field_in_label(

formatted_label = label(
method,
label_contents(label_text, help_text, optional) + field_html,
label_contents(label_text, help_text, optional: optional) + field_html,
(for_options || options),
)
formatted_label += notice_html(notice).html_safe if notice
Expand Down Expand Up @@ -64,7 +64,7 @@ def vita_min_state_file_select(
label_contents(
label_text,
options[:help_text],
options[:optional],
optional: options[:optional],
),
class: label_class,
)
Expand Down
68 changes: 50 additions & 18 deletions app/javascript/lib/honeycrisp.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ var radioSelector = (function() {
}

$(this).find('input').click(function (e) {
$(this).closest('.radio-button').siblings().removeClass('is-selected')
$(this).closest('.radio-button').addClass('is-selected')
var allRadioButtons;
if ($(this).closest('.cfa-radio-button').length > 0) {
// FormBuilder V2
allRadioButtons = $(this).closest('.cfa-radio-button').siblings().children('.is-selected');
} else {
// FormBuilder V1 & GCF
allRadioButtons = $(this).closest('.radio-button').siblings();
}
allRadioButtons.removeClass('is-selected');
$(this).closest('.radio-button').addClass('is-selected');
})
})
}
Expand All @@ -76,10 +84,10 @@ var checkboxSelector = (function() {

$(this).find('input').click(function(e) {
if($(this).is(':checked')) {
$(this).parent().addClass('is-selected');
$(this).closest('.checkbox').addClass('is-selected');
}
else {
$(this).parent().removeClass('is-selected');
$(this).closest('.checkbox').removeClass('is-selected');
}
})
})
Expand All @@ -104,22 +112,29 @@ var followUpQuestion = (function() {
});

// add click listeners to initial question inputs
$(self).find('> .question-with-follow-up__question input').click(function(e) {
// reset follow ups
$(self).find('> .question-with-follow-up__follow-up input').attr('checked', false);
$(self).find('> .question-with-follow-up__follow-up').find('.radio-button, .checkbox').removeClass('is-selected');
$(self).find('> .question-with-follow-up__follow-up').hide();

// show the current follow up
if($(this).is(':checked') && $(this).attr('data-follow-up') != null) {
$($(this).attr('data-follow-up')).show();
$(self).find('.question-with-follow-up__question input').click(function(e) {fUQ.update($(self))})
});
},
update: function ($container){
// reset follow ups
$container.find('.question-with-follow-up__follow-up input').attr('disabled', true);
$container.find('.question-with-follow-up__follow-up').hide();

$container.find('.question-with-follow-up__question input').each(function(index, input) {
// if any of the inputs with a data-follow-up is checked then show the follow-up
if($(input).is(':checked') && $(input).attr('data-follow-up') != null) {
$container.find('.question-with-follow-up__follow-up input').attr('disabled', false);
var followUpSelector = $(this).attr('data-follow-up');
if (/^[a-zA-Z0-9_\-#\.]+$/.test(followUpSelector)) {
$(followUpSelector).show();
}
})
}
});
}
}
return {
init: fUQ.init
init: fUQ.init,
update: fUQ.update
}
})();

Expand All @@ -129,9 +144,19 @@ var revealer = (function() {
$('.reveal').each(function(index, revealer) {
var self = revealer;
$(self).addClass('is-hiding-content');
$(self).find('.reveal__link').click(function(e) {
var revealButton = $(self).find('.reveal__button')
revealButton.each(function(i, link) {
link.setAttribute('aria-expanded', false)
})
revealButton.click(function(e) {
e.preventDefault();
$(self).toggleClass('is-hiding-content');

if (this.getAttribute('aria-expanded') === 'false') {
this.setAttribute('aria-expanded', 'true');
} else {
this.setAttribute('aria-expanded', 'false')
}
});
});
}
Expand Down Expand Up @@ -216,7 +241,15 @@ var noneOfTheAbove = (function() {
$noneCheckbox.click(function(e) {
$otherCheckboxes.prop('checked', false);
$otherCheckboxes.parent().removeClass('is-selected');

// If we just unchecked an <input> with a follow-up, let's reset the follow-up questions
// so it hides properly.
var $enclosingFollowUp = $noneCheckbox.closest('.question-with-follow-up');
if ($enclosingFollowUp) {
followUpQuestion.update($enclosingFollowUp);
}
});

}
};
return {
Expand Down Expand Up @@ -332,5 +365,4 @@ var Honeycrisp = function(){
}
}();

Honeycrisp.init();

Honeycrisp.init();
5 changes: 5 additions & 0 deletions app/lib/efile/id/id39_r_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize(value_access_tracker:, lines:, intake:)

def calculate
set_line(:ID39R_B_LINE_3, :calculate_sec_b_line_3)
set_line(:ID39R_B_LINE_18, :calculate_sec_b_line_18)
@lines.transform_values(&:value)
end

Expand All @@ -25,6 +26,10 @@ def calculate_sec_b_line_3
end
sum.round
end

def calculate_sec_b_line_18
@intake.has_health_insurance_premium_yes? ? @intake.health_insurance_paid_amount&.round : 0
end
end
end
end
7 changes: 7 additions & 0 deletions app/lib/efile/id/id40_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def calculate
set_line(:ID40_LINE_6C, :calculate_line_6c)
set_line(:ID40_LINE_6D, :calculate_line_6d)
set_line(:ID40_LINE_29, :calculate_line_29)
set_line(:ID40_LINE_46, :calculate_line_46)
@id39r.calculate
@lines.transform_values(&:value)
end
Expand Down Expand Up @@ -55,6 +56,12 @@ def calculate_line_29
0
end
end

def calculate_line_46
@intake.state_file_w2s.sum { |item| item.state_income_tax_amount.round } +
@intake.state_file1099_gs.sum { |item| item.state_income_tax_withheld_amount.round } +
@intake.state_file1099_rs.sum { |item| item.state_tax_withheld_amount.round }
end
end
end
end
Loading

0 comments on commit 89bedca

Please sign in to comment.