Class: PdfFill::Forms::Va21674
- Includes:
- FormHelper
- Defined in:
- lib/pdf_fill/forms/va21674.rb
Constant Summary collapse
- ITERATOR =
PdfFill::HashConverter::ITERATOR
- KEY =
{ 'veteran_information' => { 'full_name' => { 'first' => { key: 'form1[0].#subform[0].FirstNameofVeteran[0]', limit: 12, question_num: 1, question_suffix: 'A', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > VETERAN\'S NAME' }, 'middleInitial' => { key: 'form1[0].#subform[0].MiddleInitialofVeteran[0]', limit: 1, question_num: 1, question_suffix: 'B', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > VETERAN\'S NAME' }, 'last' => { key: 'form1[0].#subform[0].LastNameofVeteran[0]', limit: 18, question_num: 1, question_suffix: 'C', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > VETERAN\'S NAME' } }, 'va_file_number' => { key: 'form1[0].#subform[0].VAFileNumber[0]', limit: 9, question_num: 2, question_text: 'VA FILE NUMBER' } }, # end veteran_information 'dependents_application' => { 'veteran_contact_information' => { 'phone_number' => { 'phone_area_code' => { key: 'form1[0].#subform[0].TelephoneNumber_AreaCode[0]', limit: 3, question_num: 16, question_suffix: 'D', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > TELEPHONE NUMBER' }, 'phone_first_three_numbers' => { key: 'form1[0].#subform[0].TelephoneNumber_FirstThreeNumbers[0]', limit: 3, question_num: 16, question_suffix: 'D', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > TELEPHONE NUMBER' }, 'phone_last_four_numbers' => { key: 'form1[0].#subform[0].TelephoneNumber_LastFourNumbers[0]', limit: 4, question_num: 16, question_suffix: 'D', question_text: 'VETERAN/CLAIMANT\'S IDENTIFICATION INFORMATION > TELEPHONE NUMBER' } }, 'international_phone_number' => { key: 'form1[0].#subform[0].TelephoneNumber_International[0]', limit: 12, question_num: 16, question_suffix: 'D', question_text: 'Enter international phone number (if applicable)' }, 'email_address' => { key: 'form1[0].#subform[0].email[0]', limit: 25, question_num: 3, question_text: 'E-MAIL ADDRESS OF VETERAN' }, 'email_address_two' => { key: 'form1[0].#subform[0].email[1]', limit: 25, question_num: 3, question_text: 'E-MAIL ADDRESS OF VETERAN' } }, # end veteran_contact_information 'student_name_and_ssn' => { 'full_name' => { 'first' => { key: 'form1[0].#subform[0].FirstNameofStudent[0]', limit: 12, question_num: 4, question_suffix: 'A', question_text: 'STUDENT\'S NAME' }, 'middleInitial' => { key: 'form1[0].#subform[0].MiddleInitialofStudent[0]', limit: 1, question_num: 4, question_suffix: 'B', question_text: 'STUDENT\'S NAME' }, 'last' => { key: 'form1[0].#subform[0].LastNameofStudent[0]', limit: 18, question_num: 4, question_suffix: 'C', question_text: 'STUDENT\'S NAME' } }, 'ssn' => { 'first' => { key: 'form1[0].#subform[0].StudentSsn_FirstThree[0]', limit: 3, question_num: 5, question_suffix: 'A', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > SOCIAL SECURITY NUMBER' }, 'second' => { key: 'form1[0].#subform[0].StudentSsn_MiddleTwo[0]', limit: 2, question_num: 5, question_suffix: 'B', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > SOCIAL SECURITY NUMBER' }, 'third' => { key: 'form1[0].#subform[0].StudentSsn_LastFour[0]', limit: 4, question_num: 5, question_suffix: 'C', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > SOCIAL SECURITY NUMBER' } }, 'birth_date' => { 'month' => { key: 'form1[0].#subform[0].Student_DOB.month[0]', limit: 2, question_num: 6, question_suffix: 'A', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > DATE OF BIRTH (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].Student_DOB.day[0]', limit: 2, question_num: 6, question_suffix: 'B', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > DATE OF BIRTH (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].Student_DOB.year[0]', limit: 4, question_num: 6, question_suffix: 'C', question_text: 'STUDENT\'S IDENTIFICATION INFORMATION > DATE OF BIRTH (MM-DD-YYYY)' } } }, # end student_name_and_ssn 'student_address_marriage_tuition' => { 'was_married' => { 'was_married_yes' => { key: 'form1[0].#subform[0].YES[0]' }, 'was_married_no' => { key: 'form1[0].#subform[0].NO[0]' } }, 'marriage_date' => { 'month' => { key: 'form1[0].#subform[0].Student_Date_of_Marriage.month[0]', limit: 2, question_num: 7, question_suffix: 'B', question_text: 'DATE OF MARRIAGE' }, 'day' => { key: 'form1[0].#subform[0].Student_Date_of_Marriage.day[0]', limit: 2, question_num: 7, question_suffix: 'B', question_text: 'DATE OF MARRIAGE' }, 'year' => { key: 'form1[0].#subform[0].Student_Date_of_Marriage.year[0]', limit: 4, question_num: 7, question_suffix: 'B', question_text: 'DATE OF MARRIAGE' } }, 'address' => { 'address_line1' => { key: 'form1[0].#subform[0].AddressofStudentStreet[0]', limit: 30, question_num: 8, question_suffix: 'A', question_text: 'Address of Student > No & Street' }, 'address_line2' => { key: 'form1[0].#subform[0].AddressofStudentAptNumber[0]', limit: 5, question_num: 8, question_suffix: 'B', question_text: 'Address of Student > Apt/Unit Number' }, 'city' => { key: 'form1[0].#subform[0].AddressofStudentCity[0]', limit: 18, question_num: 8, question_suffix: 'C', question_text: 'Address of Student > City' }, 'state_code' => { key: 'form1[0].#subform[0].AddressofStudentState[0]', limit: 2, question_num: 8, question_suffix: 'D', question_text: 'Address of Student > State' }, 'country_name' => { key: 'form1[0].#subform[0].AddressofStudentCountry[0]', limit: 2, question_num: 8, question_suffix: 'E', question_text: 'Address of Student > Country' }, 'zip_code' => { 'firstFive' => { key: 'form1[0].#subform[0].AddressofStudentPostCode_FirstFive0]', limit: 5, question_num: 8, question_suffix: 'F', question_text: 'Address of Student > Zip Code (First Five Digits)' }, 'lastFour' => { key: 'form1[0].#subform[0].AddressofStudentPostCode_LastFour0]', limit: 4, question_num: 8, question_suffix: 'G', question_text: 'Address of Student > Zip Code (Last Four Digits)' } } }, 'tuition_is_paid_by_gov_agency' => { 'is_paid_yes' => { key: 'form1[0].#subform[0].YES1[0]' }, 'is_paid_no' => { key: 'form1[0].#subform[0].NO1[0]' } }, 'agency_name' => { # temporary addition while new fields have not been added that changes the schema key: 'form1[0].#subform[0].FederalAssistanceProgram[0]', limit: 200, question_num: 9, question_suffix: 'A', question_text: 'Federally funded school or program' }, 'date_payments_began' => { # temporary addition while new fields have not been added that changes the schema 'month' => { key: 'form1[0].#subform[0].DatePaymentsBegan.month[0]', limit: 2, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].DatePaymentsBegan.day[0]', limit: 2, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].DatePaymentsBegan.year[0]', limit: 4, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' } } }, # end student_address_marriage_tuition 'agency_or_program' => { 'agency_name' => { key: 'form1[0].#subform[0].FederalAssistanceProgram[0]', limit: 200, question_num: 9, question_suffix: 'A', question_text: 'Federally funded school or program' }, 'type_of_program_or_benefit' => { key: 'form1[0].#subform[0].TypeOfProgramOrBenefit[0]', limit: 50, question_num: 9, question_suffix: 'B', question_text: 'Type of Program or Benefit' }, 'date_payments_began' => { 'month' => { key: 'form1[0].#subform[0].DatePaymentsBegan.month[0]', limit: 2, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].DatePaymentsBegan.day[0]', limit: 2, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].DatePaymentsBegan.year[0]', limit: 4, question_num: 9, question_suffix: 'C', question_text: 'School Attendance Information > DATE PAYMENTS BEGAN (MM-DD-YYYY)' } } }, # end agency_or_program 'school_information' => { 'training_program' => { key: 'form1[0].#subform[0].FederalAssistanceType[0]', limit: 200, question_num: 9, question_suffix: 'B', question_text: 'Type of program or benefit' } }, # end school_information 'current_term_dates' => { 'is_school_accredited' => { 'is_school_accredited_yes' => { key: 'form1[0].#subform[0].YES4[0]' }, 'is_school_accredited_no' => { key: 'form1[0].#subform[0].NO4[0]' } }, 'official_school_start_date' => { 'month' => { key: 'form1[0].#subform[0].OfficialStartDate.month[0]', limit: 2, question_num: 11, question_suffix: 'A', question_text: 'OFFICIAL BEGINNING DATE OF REGULAR TERM OR COURSE (MM/DD/YYYY)' }, 'day' => { key: 'form1[0].#subform[0].OfficialStartDate.day[0]', limit: 2, question_num: 11, question_suffix: 'A', question_text: 'OFFICIAL BEGINNING DATE OF REGULAR TERM OR COURSE (MM/DD/YYYY)' }, 'year' => { key: 'form1[0].#subform[0].OfficialStartDate.year[0]', limit: 4, question_num: 11, question_suffix: 'A', question_text: 'OFFICIAL BEGINNING DATE OF REGULAR TERM OR COURSE (MM/DD/YYYY)' } }, 'expected_student_start_date' => { 'month' => { key: 'form1[0].#subform[0].StudentStartDate.month[0]', limit: 2, question_num: 11, question_suffix: 'B', question_text: 'DATE STUDENT STARTED OR EXPECTS TO START COURSE (MM/DD/YYYY)' }, 'day' => { key: 'form1[0].#subform[0].StudentStartDate.day[0]', limit: 2, question_num: 11, question_suffix: 'B', question_text: 'DATE STUDENT STARTED OR EXPECTS TO START COURSE (MM/DD/YYYY)' }, 'year' => { key: 'form1[0].#subform[0].StudentStartDate.year[0]', limit: 4, question_num: 11, question_suffix: 'B', question_text: 'DATE STUDENT STARTED OR EXPECTS TO START COURSE (MM/DD/YYYY)' } }, 'expected_graduation_date' => { 'month' => { key: 'form1[0].#subform[0].ExpectedGraduation.month[0]', limit: 2, question_num: 11, question_suffix: 'C', question_text: 'EXPECTED DATE OF GRADUATION (MM/DD/YYYY)' }, 'day' => { key: 'form1[0].#subform[0].ExpectedGraduation.day[0]', limit: 2, question_num: 11, question_suffix: 'C', question_text: 'EXPECTED DATE OF GRADUATION (MM/DD/YYYY)' }, 'year' => { key: 'form1[0].#subform[0].ExpectedGraduation.year[0]', limit: 4, question_num: 11, question_suffix: 'C', question_text: 'EXPECTED DATE OF GRADUATION (MM/DD/YYYY)' } } }, # end current_term_dates 'program_information' => { 'student_is_enrolled_full_time' => { 'full_time_yes' => { key: 'form1[0].#subform[0].YES2[0]' }, 'full_time_no' => { key: 'form1[0].#subform[0].NO2[0]' } }, 'course_of_study' => { key: 'form1[0].#subform[0].Subject[0]', limit: 40, question_num: 10, question_suffix: 'B', question_text: 'SUBJECT FOR WHICH STUDENT IS ENROLLED' }, 'classes_per_week' => { key: 'form1[0].#subform[0].NumberofSession[0]', limit: 25, question_num: 10, question_suffix: 'C', question_text: 'NUMBER OF SESSIONS PER WEEK' }, 'hours_per_week' => { key: 'form1[0].#subform[0].HoursPerWeek[0]', limit: 25, question_num: 10, question_suffix: 'D', question_text: 'HOURS PER WEEK' } }, # end program_information 'child_stopped_attending_school' => { 'date_child_left_school' => { 'month' => { key: 'form1[0].#subform[0].DateStoppedAttending.month[0]', limit: 2, question_num: 10, question_suffix: 'A', question_text: 'School Attendance Information > Date student stopped attending continuously (MM-DD-YYYY)' # rubocop:disable Layout/LineLength }, 'day' => { key: 'form1[0].#subform[0].DateStoppedAttending.day[0]', limit: 2, question_num: 10, question_suffix: 'A', question_text: 'School Attendance Information >Date student stopped attending continuously (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].DateStoppedAttending.year[0]', limit: 4, question_num: 10, question_suffix: 'A', question_text: 'School Attendance Information > Date student stopped attending continuously (MM-DD-YYYY)' # rubocop:disable Layout/LineLength } } }, 'student_did_attend_school_last_term' => { 'did_attend_yes' => { key: 'form1[0].#subform[0].YES3[0]' }, 'did_attend_no' => { key: 'form1[0].#subform[0].NO3[0]' } }, 'last_term_school_information' => { 'address' => { key: 'form1[0].#subform[0].NameSchoolAttend[0]', limit: 100, question_num: 11, question_suffix: 'B', question_text: 'NAME AND ADDRESS OF SCHOOL ATTENDED LAST TERM' }, 'classes_per_week' => { key: 'form1[0].#subform[0].NumberofSessionPerWeek[0]', limit: 10, question_num: 11, question_suffix: 'C', question_text: 'NO. OF SESSIONS PER WEEK' }, 'hours_per_week' => { key: 'form1[0].#subform[0].HoursPerWeek2[0]', limit: 10, question_num: 11, question_suffix: 'D', question_text: 'HOURS PER WEEK' }, 'term_begin' => { 'month' => { key: 'form1[0].#subform[0].BeginDateofLastTerm.month[0]', limit: 2, question_num: 12, question_suffix: 'B', question_text: 'BEGINNING DATE OF LAST TERM (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].BeginDateofLastTerm.day[0]', limit: 2, question_num: 12, question_suffix: 'B', question_text: 'BEGINNING DATE OF LAST TERM (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].BeginDateofLastTerm.year[0]', limit: 4, question_num: 12, question_suffix: 'B', question_text: 'BEGINNING DATE OF LAST TERM (MM-DD-YYYY)' } }, 'date_term_ended' => { 'month' => { key: 'form1[0].#subform[0].EndDateofLastTerm.month[0]', limit: 2, question_num: 12, question_suffix: 'C', question_text: 'ENDING DATE OF LAST TERM (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].EndDateofLastTerm.day[0]', limit: 2, question_num: 12, question_suffix: 'C', question_text: 'ENDING DATE OF LAST TERM (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].EndDateofLastTerm.year[0]', limit: 4, question_num: 12, question_suffix: 'C', question_text: 'ENDING DATE OF LAST TERM (MM-DD-YYYY)' } } } }, # end dependents_application 'signature' => { key: 'form1[0].#subform[0].Signature_PrintName[0]', limit: 35, question_num: 16, question_suffix: 'A', question_text: 'SIGNATURE' }, 'signature_date' => { 'month' => { key: 'form1[0].#subform[0].SignatureDate.month[0]', limit: 2, question_num: 16, question_suffix: 'B', question_text: 'DATE SIGNED (MM-DD-YYYY)' }, 'day' => { key: 'form1[0].#subform[0].SignatureDate.day[0]', limit: 2, question_num: 16, question_suffix: 'B', question_text: 'DATE SIGNED (MM-DD-YYYY)' }, 'year' => { key: 'form1[0].#subform[0].SignatureDate.year[0]', limit: 4, question_num: 16, question_suffix: 'B', question_text: 'DATE SIGNED (MM-DD-YYYY)' } } }.freeze
Instance Attribute Summary
Attributes inherited from FormBase
Instance Method Summary collapse
-
#expand_phone_number(phone_number) ⇒ Object
rubocop:enable Metrics/MethodLength.
-
#format_checkboxes(dependents_application) ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#merge_dates ⇒ Object
rubocop:disable Metrics/MethodLength.
- #merge_fields(options = {}) ⇒ Object
- #merge_student_helpers ⇒ Object
-
#select_checkbox(value) ⇒ Object
override from form_helper.
Methods included from FormHelper
#address_block, #combine_date_ranges, #expand_checkbox_as_hash, #extract_country, #extract_middle_i, #format_boolean, #select_radio_button, #split_date, #split_postal_code, #split_ssn, #validate_date
Methods inherited from FormBase
#combine_both_addr, #combine_full_address, #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
#expand_phone_number(phone_number) ⇒ Object
rubocop:enable Metrics/MethodLength
619 620 621 622 623 624 625 626 |
# File 'lib/pdf_fill/forms/va21674.rb', line 619 def (phone_number) phone_number = phone_number.delete('^0-9') { 'phone_area_code' => phone_number[0..2], 'phone_first_three_numbers' => phone_number[3..5], 'phone_last_four_numbers' => phone_number[6..9] } end |
#format_checkboxes(dependents_application) ⇒ Object
rubocop:disable Metrics/MethodLength
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
# File 'lib/pdf_fill/forms/va21674.rb', line 647 def format_checkboxes(dependents_application) was_married = dependents_application['student_address_marriage_tuition']['was_married'] dependents_application['student_address_marriage_tuition']['was_married'] = { 'was_married_yes' => select_checkbox(was_married), 'was_married_no' => select_checkbox(!was_married) } is_paid = dependents_application['student_address_marriage_tuition']['tuition_is_paid_by_gov_agency'] dependents_application['student_address_marriage_tuition']['tuition_is_paid_by_gov_agency'] = { 'is_paid_yes' => select_checkbox(is_paid), 'is_paid_no' => select_checkbox(!is_paid) } is_full_time = dependents_application['program_information']['student_is_enrolled_full_time'] dependents_application['program_information']['student_is_enrolled_full_time'] = { 'full_time_yes' => select_checkbox(is_full_time), 'full_time_no' => select_checkbox(!is_full_time) } did_attend = dependents_application['student_did_attend_school_last_term'] dependents_application['student_did_attend_school_last_term'] = { 'did_attend_yes' => select_checkbox(did_attend), 'did_attend_no' => select_checkbox(!did_attend) } is_school_accredited = dependents_application['current_term_dates']['is_school_accredited'] dependents_application['current_term_dates']['is_school_accredited'] = { 'is_school_accredited_yes' => (is_school_accredited), 'is_school_accredited_no' => (!is_school_accredited) } end |
#merge_dates ⇒ Object
rubocop:disable Metrics/MethodLength
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
# File 'lib/pdf_fill/forms/va21674.rb', line 571 def merge_dates dependents_application = @form_data['dependents_application'] current_term_dates = dependents_application['current_term_dates'] child_stopped_attending_school = dependents_application['child_stopped_attending_school'] last_term_school_information = dependents_application['last_term_school_information'] student_address_marriage_tuition = dependents_application['student_address_marriage_tuition'] agency_or_program = dependents_application['agency_or_program'] dependents_application['student_name_and_ssn']['birth_date'] = split_date(dependents_application['student_name_and_ssn']['birth_date']) if current_term_dates.present? current_term_dates['official_school_start_date'] = split_date(current_term_dates['official_school_start_date']) current_term_dates['expected_student_start_date'] = split_date(current_term_dates['expected_student_start_date']) current_term_dates['expected_graduation_date'] = split_date(current_term_dates['expected_graduation_date']) end if child_stopped_attending_school.present? child_stopped_attending_school['birth_date'] = split_date(child_stopped_attending_school['birth_date']) child_stopped_attending_school['date_child_left_school'] = split_date(child_stopped_attending_school['date_child_left_school']) end if last_term_school_information.present? last_term_school_information['term_begin'] = split_date(last_term_school_information['term_begin']) last_term_school_information['date_term_ended'] = split_date(last_term_school_information['date_term_ended']) end if student_address_marriage_tuition.present? student_address_marriage_tuition['marriage_date'] = split_date(student_address_marriage_tuition['marriage_date']) # handle old format of fields before merging in front end, remove once merged if student_address_marriage_tuition['date_payments_began'].present? date_payments_began = student_address_marriage_tuition['date_payments_began'] student_address_marriage_tuition['date_payments_began'] = split_date(date_payments_began) end end if agency_or_program.present? agency_or_program['date_payments_began'] = split_date(agency_or_program['date_payments_began']) end end |
#merge_fields(options = {}) ⇒ Object
556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/pdf_fill/forms/va21674.rb', line 556 def merge_fields( = {}) created_at = [:created_at] if [:created_at].present? (@form_data['veteran_information']['full_name'], created_at&.to_date || Time.zone.today) @form_data['signature_date'] = split_date(@form_data['signatureDate']) veteran_contact_information = @form_data['dependents_application']['veteran_contact_information'] veteran_contact_information['phone_number'] = (veteran_contact_information['phone_number']) merge_dates merge_student_helpers @form_data end |
#merge_student_helpers ⇒ Object
628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/pdf_fill/forms/va21674.rb', line 628 def merge_student_helpers dependents_application = @form_data['dependents_application'] dependents_application['student_name_and_ssn']['ssn'] = split_ssn(dependents_application['student_name_and_ssn']['ssn']) dependents_application['student_address_marriage_tuition']['address']['zip_code'] = split_postal_code(dependents_application['student_address_marriage_tuition']['address']) dependents_application['student_address_marriage_tuition']['address']['country_name'] = extract_country(dependents_application['student_address_marriage_tuition']['address']) format_checkboxes(dependents_application) end |
#select_checkbox(value) ⇒ Object
override from form_helper
642 643 644 |
# File 'lib/pdf_fill/forms/va21674.rb', line 642 def select_checkbox(value) value ? 'On' : 'Off' end |