diff --git a/app/models/concerns/csv_exportable.rb b/app/models/concerns/csv_exportable.rb index 734e230..6ba3183 100644 --- a/app/models/concerns/csv_exportable.rb +++ b/app/models/concerns/csv_exportable.rb @@ -15,16 +15,26 @@ module CsvExportable LOCATION_HEADERS = %i[name address].freeze + COMMON_HEADERS LOCATION_VALUES = %w[name address].freeze + COMMON_VALUES + MATERIAL_HEADERS = %i[name].freeze + COMMON_HEADERS + MATERIAL_VALUES = %w[name].freeze + COMMON_VALUES + + MEDICAL_HEADERS = %i[approved name contact_info].freeze + COMMON_HEADERS + MEDICAL_VALUES = %w[approved? name contact_info].freeze + COMMON_VALUES + HEADERS = { acquired_media_release: ACQUIRED_MEDIA_HEADERS, appearance_release: APPEARANCE_HEADERS, - location_release: LOCATION_HEADERS + location_release: LOCATION_HEADERS, + material_release: MATERIAL_HEADERS, + medical_release: MEDICAL_HEADERS }.freeze VALUES = { acquired_media_release: ACQUIRED_MEDIA_VALUES, appearance_release: APPEARANCE_VALUES, - location_release: LOCATION_VALUES + location_release: LOCATION_VALUES, + material_release: MATERIAL_VALUES, + medical_release: MEDICAL_VALUES }.freeze included do @@ -40,11 +50,9 @@ module CsvExportable end def to_csv_row - v = VALUES[self.class.name.underscore.to_sym].map do |function| + VALUES[self.class.name.underscore.to_sym].map do |function| send(function) end - puts v - v end private diff --git a/app/models/material_release.rb b/app/models/material_release.rb index 56d45ee..9c9044d 100644 --- a/app/models/material_release.rb +++ b/app/models/material_release.rb @@ -10,6 +10,7 @@ class MaterialRelease < ApplicationRecord include Syncable include Taggable include PersonName + include CsvExportable composed_of :person_address, class_name: "Address", diff --git a/app/models/medical_release.rb b/app/models/medical_release.rb index 996bfc5..f160903 100644 --- a/app/models/medical_release.rb +++ b/app/models/medical_release.rb @@ -11,6 +11,7 @@ class MedicalRelease < ApplicationRecord include SecondGuardianPhotoable include GuardianName include SecondGuardianName + include CsvExportable NUMBER_OF_CUSTOM_FIELDS = 15 diff --git a/config/locales/en.yml b/config/locales/en.yml index 9a75c3b..75c8e68 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -780,6 +780,7 @@ en: search: Search empty: Material Releases will appear here table_headers: + name: Name notes: Notes signed_at: Date Signed tags: Tags @@ -802,6 +803,8 @@ en: empty: Medical releases will appear here table_headers: approved: Approved + name: Person name + contact_info: Contact info notes: Notes signed_at: Date Signed tags: Tags diff --git a/config/locales/es.yml b/config/locales/es.yml index 2c03263..7d0444d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -312,12 +312,23 @@ es: form: photos: dropzone_label: Tap to take a photo of Licensed Material (optional) (ES) + index: + table_headers: + name: Name (ES) + notes: Notes (ES) + tags: Tags (ES) + signed_at: Date Signed (ES) medical_releases: custom_validation_errors: question_answer_is_required: answer is required (ES) index: table_headers: approved: Approved (ES) + name: Person name (ES) + contact_info: Contact info (ES) + notes: Notes (ES) + tags: Tags (ES) + signed_at: Date Signed (ES) medical_release: actions: review: Review (ES)