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

Dependent birth year warning #186829970 #4458

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0b3dc8f
Reordered options, bolded text
tofarr Mar 28, 2024
30f9d2e
Bolded text, reordered options
tofarr Mar 28, 2024
2344e73
Merge branch 'main' into nyc-county-warning-#187296817
tofarr Apr 1, 2024
2174fcb
County warning
tofarr Apr 1, 2024
0f83818
I18n fixes
tofarr Apr 1, 2024
ff4649f
I18n Fixes
tofarr Apr 1, 2024
c2be6b9
I18n Spec fixes
tofarr Apr 1, 2024
36bd35e
Using rails script tag
tofarr Apr 1, 2024
b73f5a4
Updated names for clarity
tofarr Apr 2, 2024
f3eb6b6
Style update
tofarr Apr 4, 2024
30ea2d1
Select warning component
tofarr Apr 4, 2024
1a90540
Integration with form builder
tofarr Apr 4, 2024
5048db2
Clearer name
tofarr Apr 4, 2024
71a73b6
Renamed for clarity
tofarr Apr 4, 2024
69095cb
More progressive enhancement
tofarr Apr 4, 2024
0e2df98
Controller page cleanup
tofarr Apr 4, 2024
f0267d7
More cleanup
tofarr Apr 4, 2024
f50c21f
Added a little flair
tofarr Apr 4, 2024
3965c5a
Fix copypasta
tofarr Apr 4, 2024
22c1bda
Permitted fix
tofarr Apr 4, 2024
7fd7ebb
Fixed headers
tofarr Apr 4, 2024
5da8deb
Updates
tofarr Apr 4, 2024
32220c5
Fixed copy
tofarr Apr 4, 2024
ed4134d
Merge branch 'main' into nyc-county-warning-#187296817
tofarr Apr 5, 2024
9ccefb0
Merge branch 'main' into nyc-county-warning-#187296817
tofarr Apr 5, 2024
026d496
Spec fixes
tofarr Apr 5, 2024
2c883b9
Using content_tag instead of raw html
tofarr Apr 5, 2024
675f51b
Fix spec
tofarr Apr 5, 2024
a1cd39d
Spec fix
tofarr Apr 5, 2024
72591cb
Annotation updates
tofarr Apr 5, 2024
526125e
Merge branch 'main' into nyc-county-warning-#187296817
tofarr Apr 8, 2024
30ba970
WIP
tofarr Apr 8, 2024
50d7a25
WIP
tofarr Apr 8, 2024
8127931
WIP
tofarr Apr 8, 2024
75c1902
Merge branch 'nyc-county-warning-#187296817' into dependent-birth-yea…
tofarr Apr 8, 2024
13a0600
WIP
tofarr Apr 8, 2024
590471f
Dependend birth year warning #186829970
tofarr Apr 8, 2024
bf6068b
WIP
tofarr Apr 9, 2024
a1c3984
Merge branch 'main' into dependent-birth-year-warning-#186829970
tofarr Apr 9, 2024
60c5a94
WIP
tofarr Apr 9, 2024
5ac1e19
WIP
tofarr Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/helpers/vita_min_form_builder.rb
Expand Up @@ -375,6 +375,16 @@ def continue(value = I18n.t("general.continue"))
submit(value, class: "button button--primary button--wide")
end

def warning_for_date(object_name, min_date, year, msg)
@template.content_tag(:div, msg,
class: "warning warning-for-date",
"data-warning-for-date": object_name,
style: "display:none",
"data-min-date": min_date && min_date.strftime("%Y-%m-%d"),
"data-required-year": year
)
end

def warning_for_select(element_id, permitted_values, msg)
@template.content_tag(:div, msg,
class: "warning warning-for-select",
Expand Down
30 changes: 30 additions & 0 deletions app/javascript/components/WarningForDateComponent.js
@@ -0,0 +1,30 @@

export default function WarningForDateComponent() {
const warningElements = document.querySelectorAll("[data-warning-for-date]");
warningElements.forEach((warningElement) => {
let { minDate, warningForDate, requiredYear } = warningElement.dataset;
minDate = new Date(minDate);
const fields = ["year", "month", "day"].map((f) => {
return document.querySelector(`[name="${warningForDate}[dob_${f}]"]`);
});

function show(){
if (requiredYear) {
const selectedYear = fields[0].value;
return selectedYear && selectedYear !== requiredYear;
}
const date = new Date(...fields.map((s) => {
return parseInt(s.value);
}))
return date.getTime() < minDate.getTime();
}
function render(){
$(warningElement)[show() ? "show" : "hide"]("slow");
}

fields.forEach((f) => {
f.addEventListener("change", render);
})
render();
});
}
2 changes: 2 additions & 0 deletions app/javascript/listeners/index.js
Expand Up @@ -17,6 +17,7 @@ import { initServiceComparisonComponent } from "../lib/service_comparison_compon
import { fetchEfileStateCounts } from "../lib/fetch_efile_state_counts";
import { fetchStateFileEfileStateCounts } from "../lib/fetch_statefile_efile_state_counts";
import ClientMenuComponent from "../components/ClientMenuComponent";
import WarningForDateComponent from "../components/WarningForDateComponent";
import WarningForSelectComponent from "../components/WarningForSelectComponent";
import MixpanelEventTracking from "../lib/mixpanel_event_tracking";
import IntercomBehavior from "../lib/intercom_behavior";
Expand All @@ -28,6 +29,7 @@ const Listeners = (function(){
MixpanelEventTracking.listenForTrackedClicks();
const { controllerAction } = document.querySelector("#mixpanelData")?.dataset || {};
ClientMenuComponent();
WarningForDateComponent();
WarningForSelectComponent();

documentSubmittingIndicator.init(); // extend styling on honeyCrisp's default ajax upload functionality.
Expand Down
15 changes: 15 additions & 0 deletions app/views/state_file/questions/name_dob/edit.html.erb
Expand Up @@ -77,6 +77,21 @@
<%= ff.cfa_input_field(:first_name, t("general.first_name"), classes: ["form-width--long"], options: {disabled: true}) %>
<%= ff.cfa_input_field(:last_name, t("general.last_name"), classes: ["form-width--long"], options: {disabled: true}) %>

<% child_birth_yr = current_intake.direct_file_data.eitc_eligible_dependents[ff.object.ssn]&.at("ChildBirthYr")&.content %>
<% if child_birth_yr.present? && current_intake.state_code == "ny" %>
<div class="form-group">
<%= ff.warning_for_date(ff.object_name, nil, child_birth_yr, t(".dependent_dob_year_warning")) %>
</div>
<% elsif ff.object.ctc_qualifying %>
<div class="form-group">
<%= ff.warning_for_date(ff.object_name, MultiTenantService.statefile.end_of_current_tax_year.years_ago(17), nil, t(".dependent_dob_under_17_warning")) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment in #4463

</div>
<% end %>

<div class="form-group">

</div>

<div class="date-select">
<%= ff.cfa_date_select(:dob,
t('general.date_of_birth'),
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Expand Up @@ -2383,6 +2383,8 @@ en:
welcome_back: Welcome back %{user_name}!
name_dob:
edit:
dependent_dob_under_17_warning: According to your federal return, this person was less than 17 years old at the end of 2023. Please double check their date of birth.
dependent_dob_year_warning: You entered a different birth year for this person on your federal return. Please double check their date of birth.
dependent_months_lived_label: Number of months they lived with you in %{year}
dependent_name_dob: Please tell us your dependent’s date of birth
last_name: Last name
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es.yml
Expand Up @@ -2350,6 +2350,8 @@ es:
welcome_back: "¡Bienvenido de nuevo %{user_name}!"
name_dob:
edit:
dependent_dob_under_17_warning: Según su declaración federal, esta persona tenía menos de 17 años a finales de 2023. Verifique nuevamente su fecha de nacimiento.
dependent_dob_year_warning: Ingresó un año de nacimiento diferente para esta persona en su declaración federal. Por favor verifique su fecha de nacimiento.
dependent_months_lived_label: Número de meses que vivió contigo en %{year}
dependent_name_dob: Indícanos la fecha de nacimiento de tu dependiente
last_name: Apellido
Expand Down