!!! 5 %html %head %title Admissions Application %meta{ charset: 'utf-8' } = wicked_pdf_stylesheet_link_tag 'pdf' %body :css thead { display: table-row-group; } - def strip_ext(name, strip_2=false) - name.gsub!('_2', '') if strip_2 - name.gsub(/ext+/, '2').titleize %p.mb-3.text-center{ style: 'font-size: 25px' }= "#{applicant.decorate.application_type.capitalize} Application" %p.mb-3.text-center= applicant.application.name %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Student General Information %tbody %tr %td.w-50 Last Name %td.w-50= applicant.last_name %tr %td.w-50 First Name %td.w-50= applicant.first_name %tr %td.w-50 Date of Birth %td.w-50= applicant.date_of_birth %tr %td.w-50 Grade %td.w-50= applicant.decorate.grade_level - profile_fields.each do |profile_field| - next if profile_field.field == 'application_grade' - next if profile_field.field == 'last_name' - next if profile_field.field == 'first_name' - next if profile_field.field == 'date_of_birth' - if profile_field.field == 'race' %tr %td.w-50 Races %td.w-50= applicant.decorate.race_list - else %tr %td.w-50= profile_field.field.titleize %td.w-50 - if profile_field.field == 'ethnicity' = applicant.decorate.ethnic_label - else = applicant.send(profile_field.field) - if applicant.displayable_components[:additional_fields] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Student Additional Information %tbody - additional_values.each do |field| %tr %td.w-50= field.student_additional_field.name - if field.student_additional_field.multi_choice? - choices = field.student_additional_field.choices.pluck(:value, :label).to_h %td.w-50= choices[field.value] - else %td.w-50= field.value - if applicant.displayable_components[:medical] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Student Medical Information %tbody - Admission::ApplicantMedical::HEALTH_ISSUE_ATTRIBUTES.each do |prop| - next if prop == :alerts %tr %td.w-50= (prop == :healthy) ? 'No Health Issues' : prop.to_s.titleize %td.w-50 - if [:allergies, :comments, :medication].include?(prop) = medical.send(prop) - elsif medical.send(prop) = wicked_pdf_image_tag('check.png', height: 20, width: 20) - if applicant.displayable_components[:agreements] - applicant_agreements.each do |applicant_agreement| %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal= "Agreement: #{applicant_agreement.agreement.name}" %tbody %tr %td= applicant_agreement.agreement.body.html_safe %tr %td= applicant_agreement.decorate.response - if applicant.displayable_components[:essays] - applicant_essays.each do |applicant_essays| %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal= "Essay: #{applicant_essays.essay.body}".html_safe %tbody %tr %td= applicant_essays.body.html_safe - if applicant.displayable_components[:documents] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Student Documents %tbody - applicant_documents.each do |applicant_document| %tr %td.w-50= applicant_document.document.name %td.w-50= applicant_document.filename - if student_classes.present? %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal Student Class Selection %tbody - student_classes.each do |student_class| %tr %td= student_class.classroom.name - if applicant.displayable_components[:family_revisions] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light.p-3 %th.font-weight-normal{ colspan: 2 } Family General Information %tbody - family_revision_fields.each do |revision_field| - revision_key = revision_field.field.to_sym %tr %td.font-weight-bold{ colspan: 2}= revision_field.field.titleize - Admission::FamilyRevision::FAMILY_GROUPED_ATTRIBUTES[revision_key].each do |field| %tr %td.w-50= strip_ext(field.to_s, true) %td.w-50 - if revision_key == :family_directory && family_revision.send(field) = wicked_pdf_image_tag('check.png', height: 20, width: 20) - elsif [:country_id, :country_2_id].include?(field) = family_revision.send(field.to_s.sub('_id', ''))&.name - elsif revision_key != :family_directory = family_revision.send(field) - if applicant.displayable_components[:family_additional_fields] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Family Additional Information %tbody - family_additional_values.each do |additional_value| %tr %td.w-50= additional_value.family_additional_field.name - if additional_value.family_additional_field.multi_choice? - choices = additional_value.family_additional_field.family_additional_choices.pluck(:value, :label).to_h %td.w-50= choices[additional_value.value] - else %td.w-50= additional_value.value %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Family Contacts %tbody - contact_revisions.each do |contact| %tr %td.font-weight-bold{ colspan: 2 }= contact&.full_name(:reverse) - Admission::ContactRevisionField::REQUIRED_FIELDS.each do |field| - if field == 'first_name' || field == 'last_name' - next %tr %td.w-50= field.titleize - field = 'relationship_name' if field == 'relationship' %td.w-50 - if ['primary', 'emergency', 'pickup'].include?(field) - if contact&.send("#{field}?") = wicked_pdf_image_tag('check.png', height: 20, width: 20) - else = contact&.decorate&.send(field) - Admission::ContactRevisionField::DISPLAY_FIELDS.each do |field| - case field.to_sym - when :zip_code - field = 'zip' - when :emergency_contact - field = 'emergency' %tr %td.w-50= strip_ext(field) %td.w-50 - if field == 'emergency' - if contact.emergency? = wicked_pdf_image_tag('check.png', height: 20, width: 20) - elsif field == 'country_id' = contact&.country&.name - elsif field == 'title_id' = contact&.title&.name - else = contact&.send(field) - contact_families.each do |contact_family| %tr %td.font-weight-bold{ colspan: 2 }= contact_family.contact&.full_name(:reverse) - Admission::ContactRevisionField::REQUIRED_FIELDS.each do |field| - next if field == 'first_name' || field == 'last_name' %tr %td.w-50= field.titleize - field = 'relationship_name' if field == 'relationship' %td.w-50 - if ['primary', 'emergency', 'pickup'].include?(field) - if contact_family.send("#{field}?") = wicked_pdf_image_tag('check.png', height: 20, width: 20) - else = contact_family.decorate.send(field) - Admission::ContactRevisionField::DISPLAY_FIELDS.each do |field| - case field.to_sym - when :zip_code - field = 'zip' - when :emergency_contact - field = 'emergency' - when :country_id - field = 'country' %tr %td.w-50= strip_ext(field) %td.w-50 - if field == 'emergency' - if contact_family.emergency? = wicked_pdf_image_tag('check.png', height: 20, width: 20) - elsif field == 'country' = contact_family.contact&.country&.name - else = contact_family.contact&.decorate&.send(field) - if applicant.displayable_components[:medical_revisions] %table.table.table-sm.table-borderless.mb-3 %thead %tr.bg-light %th.font-weight-normal{ colspan: 2 } Family Medical Information %tbody - medical_revision_fields.each do |medical_revision| - Admission::MedicalRevision::MEDICAL_GROUPED_ATTRIBUTES[medical_revision.field.to_sym].each do |field| %tr %td= strip_ext(field.to_s) %td= family_medical.send(field)