-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jnf/fyst-1727/special-program-az
- Loading branch information
Showing
64 changed files
with
1,397 additions
and
163 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
app/controllers/concerns/state_file/repeated_question_concern.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module StateFile | ||
# This concern can be used by any StateFile::Questions::QuestionsController that needs to show a page repeatedly for each of a list of items | ||
# It requires you to add a hidden `index` input to your edit template | ||
module RepeatedQuestionConcern | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
before_action :set_index_and_load_item | ||
end | ||
|
||
attr_reader :current_index | ||
|
||
def prev_path | ||
prev_index = current_index - 1 | ||
if prev_index.negative? | ||
super | ||
else | ||
options = { index: prev_index } | ||
self.class.to_path_helper(options) | ||
end | ||
end | ||
|
||
def next_path | ||
next_index = current_index + 1 | ||
if next_index >= num_items | ||
super | ||
else | ||
options = {index: next_index} | ||
self.class.to_path_helper(options) | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_index_and_load_item | ||
@current_index = params[:index].present? ? params[:index].to_i : 0 | ||
load_item(@current_index) | ||
end | ||
|
||
def num_items | ||
# define in controller | ||
raise NotImplementedError | ||
end | ||
|
||
def load_item(index) | ||
# define in controller | ||
raise NotImplementedError | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/controllers/state_file/questions/md_permanently_disabled_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module StateFile | ||
module Questions | ||
class MdPermanentlyDisabledController < QuestionsController | ||
def self.show?(intake) | ||
Flipper.enabled?(:show_retirement_ui) && intake.state_file1099_rs.length.positive? | ||
end | ||
|
||
private | ||
|
||
def form_params | ||
params.require(:state_file_md_permanently_disabled_form).permit(:mfj_disability, :primary_disabled, :spouse_disabled, :proof_of_disability_submitted) | ||
end | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
app/controllers/state_file/questions/md_retirement_income_subtraction_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module StateFile | ||
module Questions | ||
class MdRetirementIncomeSubtractionController < RetirementIncomeSubtractionController | ||
|
||
def followup_class = StateFileMd1099RFollowup | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/controllers/state_file/questions/retirement_income_subtraction_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module StateFile | ||
module Questions | ||
class RetirementIncomeSubtractionController < QuestionsController | ||
include RepeatedQuestionConcern | ||
|
||
attr_reader :state_file_1099r | ||
|
||
def initialized_edit_form | ||
attribute_keys = Attributes.new(form_class.attribute_names).to_sym | ||
state_specific_followup = find_or_create_state_specific_followup | ||
form_class.new(state_specific_followup, form_class.existing_attributes(state_specific_followup).slice(*attribute_keys)) | ||
end | ||
|
||
def initialized_update_form | ||
form_class.new(find_or_create_state_specific_followup, form_params) | ||
end | ||
|
||
def self.show?(intake) | ||
Flipper.enabled?(:show_retirement_ui) && intake.state_file1099_rs.length.positive? | ||
end | ||
|
||
private | ||
|
||
def num_items | ||
current_intake.state_file1099_rs.count | ||
end | ||
|
||
def load_item(index) | ||
@state_file_1099r = current_intake.state_file1099_rs[index] | ||
if @state_file_1099r.nil? | ||
render "public_pages/page_not_found", status: 404 | ||
end | ||
end | ||
|
||
def find_or_create_state_specific_followup | ||
unless @state_file_1099r.state_specific_followup.present? | ||
@state_file_1099r.update(state_specific_followup: followup_class.create) | ||
end | ||
@state_file_1099r.state_specific_followup | ||
end | ||
|
||
def followup_class | ||
raise NotImplementedError, "Implement Subclass#followup_class to return the state-specific 1099R followup model class" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module StateFile | ||
class MdPermanentlyDisabledForm < QuestionsForm | ||
set_attributes_for :intake, :primary_disabled, :spouse_disabled, :proof_of_disability_submitted | ||
|
||
attr_accessor :mfj_disability | ||
validates_presence_of :mfj_disability, if: -> { intake.filing_status_mfj?} | ||
validates :primary_disabled, inclusion: { in: %w[yes no], message: :blank }, unless: -> { intake.filing_status_mfj? } | ||
validates :proof_of_disability_submitted, inclusion: { in: %w[yes no], message: :blank }, if: :disability_selected? | ||
|
||
|
||
def save | ||
if intake.filing_status_mfj? | ||
case mfj_disability | ||
when "me" | ||
@intake.update(primary_disabled: "yes", spouse_disabled: "no", proof_of_disability_submitted: proof_of_disability_submitted) | ||
when "spouse" | ||
@intake.update(primary_disabled: "no", spouse_disabled: "yes", proof_of_disability_submitted: proof_of_disability_submitted) | ||
when "both" | ||
@intake.update(primary_disabled: "yes", spouse_disabled: "yes", proof_of_disability_submitted: proof_of_disability_submitted) | ||
when "none" | ||
@intake.update(primary_disabled: "no", spouse_disabled: "no", proof_of_disability_submitted: nil) | ||
end | ||
elsif primary_disabled == "no" | ||
@intake.update( | ||
primary_disabled: "no", | ||
proof_of_disability_submitted: nil | ||
) | ||
else | ||
@intake.update(attributes_for(:intake)) | ||
end | ||
end | ||
|
||
private | ||
|
||
def disability_selected? | ||
mfj_disability.in?(%w[me spouse both]) || primary_disabled == "yes" | ||
end | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
app/forms/state_file/md_retirement_income_subtraction_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module StateFile | ||
class MdRetirementIncomeSubtractionForm < Form | ||
include FormAttributes | ||
|
||
set_attributes_for :state_file_md1099_r_followup, :income_source, :service_type | ||
|
||
attr_accessor :state_file_md1099_r_followup | ||
|
||
validates :income_source, presence: true | ||
validates :service_type, presence: true | ||
|
||
def initialize(state_file_md1099_r_followup = nil, params = {}) | ||
@state_file_md1099_r_followup = state_file_md1099_r_followup | ||
super(params) | ||
end | ||
|
||
def save | ||
state_file_md1099_r_followup.update(attributes_for(:state_file_md1099_r_followup)) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class SendDfTransferIssueMessageJob < ApplicationJob | ||
def perform(email: false, sms: false, contact_info: nil, state_code: nil) | ||
message_instance = StateFile::AutomatedMessage::DfTransferIssueMessage.new | ||
|
||
if email | ||
StateFileNotificationEmail.create!( | ||
data_source: nil, # we have no data source because the intakes have been deleted | ||
to: contact_info, | ||
body: message_instance.email_body(state_code: state_code), | ||
subject: message_instance.email_subject(state_code: state_code) | ||
) | ||
end | ||
if sms | ||
StateFileNotificationTextMessage.create!( | ||
data_source: nil, # we have no data source because the intakes have been deleted | ||
to_phone_number: contact_info, | ||
body: message_instance.sms_body(state_code: state_code), | ||
) | ||
end | ||
end | ||
|
||
def priority | ||
PRIORITY_MEDIUM | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.