Class: PdfFill::Forms::Va210781a
- Includes:
- CommonPtsd
- Defined in:
- lib/pdf_fill/forms/va210781a.rb
Constant Summary collapse
- ITERATOR =
PdfFill::HashConverter::ITERATOR
- KEY =
{ 'veteranFullName' => { 'first' => { key: 'F[0].Page_1[0].ClaimantsFirstName[0]', limit: 12, question_num: 1, question_suffix: 'A', question_text: "VETERAN/BENEFICIARY'S FIRST NAME" }, 'middleInitial' => { key: 'F[0].Page_1[0].ClaimantsMiddleInitial1[0]' }, 'last' => { key: 'F[0].Page_1[0].ClaimantsLastName[0]', limit: 18, question_num: 1, question_suffix: 'B', question_text: "VETERAN/BENEFICIARY'S LAST NAME" } }, 'veteranSocialSecurityNumber' => { 'first' => { key: 'F[0].Page_1[0].ClaimantsSocialSecurityNumber_FirstThreeNumbers[0]' }, 'second' => { key: 'F[0].Page_1[0].ClaimantsSocialSecurityNumber_SecondTwoNumbers[0]' }, 'third' => { key: 'F[0].Page_1[0].ClaimantsSocialSecurityNumber_LastFourNumbers[0]' } }, 'veteranSocialSecurityNumber1' => { 'first' => { key: 'F[0].Page_2[0].VeteransSocialSecurityNumber_FirstThreeNumbers[0]' }, 'second' => { key: 'F[0].Page_2[0].VeteransSocialSecurityNumber_SecondTwoNumbers[0]' }, 'third' => { key: 'F[0].Page_2[0].VeteransSocialSecurityNumber_LastFourNumbers[0]' } }, 'veteranSocialSecurityNumber2' => { 'first' => { key: 'F[0].Page_3[0].VeteransSocialSecurityNumber_FirstThreeNumbers[0]' }, 'second' => { key: 'F[0].Page_3[0].VeteransSocialSecurityNumber_SecondTwoNumbers[0]' }, 'third' => { key: 'F[0].Page_3[0].VeteransSocialSecurityNumber_LastFourNumbers[0]' } }, 'vaFileNumber' => { key: 'F[0].Page_1[0].VAFileNumber[0]' }, 'veteranDateOfBirth' => { 'month' => { key: 'F[0].Page_1[0].DOBmonth[0]' }, 'day' => { key: 'F[0].Page_1[0].DOBday[0]' }, 'year' => { key: 'F[0].Page_1[0].DOByear[0]' } }, 'veteranServiceNumber' => { key: 'F[0].Page_1[0].VeteransServiceNumber[0]' }, 'email' => { key: 'F[0].Page_1[0].PreferredEmail[0]' }, 'veteranPhone' => { key: 'F[0].Page_1[0].PreferredEmail[1]' }, 'veteranSecondaryPhone' => { key: 'F[0].Page_1[0].PreferredEmail[2]' }, 'incidents' => { limit: 2, first_key: 'incidentDescription', question_text: 'INCIDENTS', question_num: 8, 'incidentDate' => { 'month' => { key: "incidentDateMonth[#{ITERATOR}]" }, 'day' => { key: "incidentDateDay[#{ITERATOR}]" }, 'year' => { key: "incidentDateYear[#{ITERATOR}]" } }, 'unitAssignedDates' => { 'fromMonth' => { key: "unitAssignmentDateFromMonth[#{ITERATOR}]" }, 'fromDay' => { key: "unitAssignmentDateFromDay[#{ITERATOR}]" }, 'fromYear' => { key: "unitAssignmentDateFromYear[#{ITERATOR}]" }, 'toMonth' => { key: "unitAssignmentDateToMonth[#{ITERATOR}]" }, 'toDay' => { key: "unitAssignmentDateToDay[#{ITERATOR}]" }, 'toYear' => { key: "unitAssignmentDateToYear[#{ITERATOR}]" } }, 'incidentLocation' => { question_num: 8, limit: 3, first_key: 'row0', 'row0' => { key: "incidentLocationFirstRow[#{ITERATOR}]" }, 'row1' => { key: "incidentLocationSecondRow[#{ITERATOR}]" }, 'row2' => { key: "incidentLocationThirdRow[#{ITERATOR}]" } }, 'unitAssigned' => { question_num: 8, limit: 3, 'row0' => { key: "unitAssignmentFirstRow[#{ITERATOR}]", limit: 30 }, 'row1' => { key: "unitAssignmentSecondRow[#{ITERATOR}]", limit: 30 }, 'row2' => { key: "unitAssignmentThirdRow[#{ITERATOR}]", limit: 30 } }, 'incidentDescription' => { key: "incidentDescription[#{ITERATOR}]", limit: 536 }, 'combinedName0' => { limit: 80, key: "incident_source_name[#{ITERATOR}][0]" }, 'combinedAddress0' => { limit: 80, key: "incident_source_address[#{ITERATOR}][0]" }, 'combinedName1' => { limit: 80, key: "incident_source_name[#{ITERATOR}][1]" }, 'combinedAddress1' => { limit: 80, key: "incident_source_address[#{ITERATOR}][1]" }, 'combinedName2' => { limit: 80, key: "incident_source_name[#{ITERATOR}][2]" }, 'combinedAddress2' => { limit: 80, key: "incident_source_address[#{ITERATOR}][2]" }, 'incidentOverflow' => { key: '', question_text: 'INCIDENTS', question_num: 8, question_suffix: 'A' } }, 'otherInformation' => { question_text: 'OTHER INFORMATION', question_num: 12, limit: 11, first_key: 'value', 'value' => { question_text: 'OTHER INFORMATION', question_num: 12, limit: 80, key: "F[0].Page_3[0].OtherInformation[#{ITERATOR}]" } }, 'signature' => { key: 'F[0].Page_3[0].signature8[0]' }, 'signatureDate' => { key: 'F[0].Page_3[0].date9[0]', format: 'date' }, 'additionalSecondaryIncidentText' => { question_num: 15, question_text: 'ADDITIONAL INCIDENTS', limit: 0, key: 'none' } }.freeze
Instance Attribute Summary
Attributes inherited from FormBase
Instance Method Summary collapse
- #combine_full_address(address) ⇒ Object private
- #combine_other_sources_overflow(incident) ⇒ Object private
- #combine_source_name_address(incident) ⇒ Object private
- #expand_incidents(incidents) ⇒ Object private
- #expand_other_information ⇒ Object private
- #format_incident_overflow(incident, index) ⇒ Object private
- #format_sources_overflow(incident) ⇒ Object private
- #merge_fields(_options = {}) ⇒ Object
Methods included from CommonPtsd
#combine_date_range, #expand_incident_date, #expand_incident_location, #expand_incident_unit_assignment, #expand_ssn, #expand_unit_assigned_dates, #expand_veteran_dob, #format_incident, #get_unit_date_overflow, #split_approximate_date
Methods included from FormHelper
#address_block, #combine_date_ranges, #expand_checkbox_as_hash, #extract_country, #extract_middle_i, #format_boolean, #select_checkbox, #select_radio_button, #split_date, #split_postal_code, #split_ssn, #validate_date
Methods inherited from FormBase
#combine_both_addr, #combine_full_address_extras, #combine_full_name, #combine_hash, #combine_name_addr, #combine_name_addr_extras, #combine_postal_code, #combine_previous_names, date_strftime, #expand_checkbox, #expand_date_range, #expand_signature, #initialize
Constructor Details
This class inherits a constructor from PdfFill::Forms::FormBase
Instance Method Details
#combine_full_address(address) ⇒ Object (private)
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 285 def combine_full_address(address) return '' if address.blank? combine_hash( address, %w[ addressLine1 addressLine2 city state zipCode country ], ', ' ) end |
#combine_other_sources_overflow(incident) ⇒ Object (private)
257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 257 def combine_other_sources_overflow(incident) return if incident.blank? || incident['sources'].blank? sources = incident['sources'] overflow_sources = [] sources.each do |source| overflow = "#{source['name']} \n #{combine_full_address(source['address'])}" overflow_sources.push(overflow) end overflow_sources.join(" \n\n ") end |
#combine_source_name_address(incident) ⇒ Object (private)
244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 244 def combine_source_name_address(incident) return if incident.blank? || incident['sources'].blank? incident['sources'].each_with_index do |source, index| combined_source_address = combine_full_address(source['address']) incident["combinedName#{index}"] = source['name'] incident["combinedAddress#{index}"] = combined_source_address end incident.except!('sources') end |
#expand_incidents(incidents) ⇒ Object (private)
302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 302 def (incidents) return if incidents.blank? incidents.each_with_index do |incident, index| format_incident_overflow(incident, index + 1) incident['incidentDate'] = (incident) (incident) incident['incidentLocation'] = (incident) incident['unitAssigned'] = (incident) combine_source_name_address(incident) end end |
#expand_other_information ⇒ Object (private)
236 237 238 239 240 241 242 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 236 def return if @form_data['otherInformation'].blank? @form_data['otherInformation'].map! do |other_info| { 'value' => other_info } end end |
#format_incident_overflow(incident, index) ⇒ Object (private)
276 277 278 279 280 281 282 283 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 276 def format_incident_overflow(incident, index) incident_overflow = format_incident(incident, index) return if incident_overflow.nil? incident_overflow.push("Other Sources of Information: \n\n#{format_sources_overflow(incident)}") incident['incidentOverflow'] = PdfFill::FormValue.new('', incident_overflow.compact.join("\n\n")) end |
#format_sources_overflow(incident) ⇒ Object (private)
271 272 273 274 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 271 def format_sources_overflow(incident) other_sources_overflow = combine_other_sources_overflow(incident) other_sources_overflow.nil? ? '' : other_sources_overflow end |
#merge_fields(_options = {}) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/pdf_fill/forms/va210781a.rb', line 221 def merge_fields( = {}) @form_data['veteranFullName'] = extract_middle_i(@form_data, 'veteranFullName') @form_data = (@form_data) @form_data['veteranDateOfBirth'] = (@form_data) (@form_data['incidents']) (@form_data['veteranFullName'], @form_data['signatureDate']) @form_data['signature'] = "/es/ #{@form_data['signature']}" @form_data end |