diff --git a/app/views/reports/templates/template_1/cover.html.erb b/app/views/reports/templates/template_1/cover.html.erb deleted file mode 100644 index 7b5d489fe..000000000 --- a/app/views/reports/templates/template_1/cover.html.erb +++ /dev/null @@ -1,321 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ANALYST WORKSHEET - -
- 1. PRODUCT -
-
- <% report_experiment_descriptions(report).each do |description| %> - <%= description %> -
- <% end %> -
-
-
- 2. SAMPLE NUMBER -
-
- <%= assigned_to_report_repository_items(report, 'Samples').pluck(:name).join(', ') %> -
-
- - - - - - <%= render Reports::MultiCheckboxInputComponent.new( - report: report, - name: :seals, - label: 'Seals', - items: { - intact: 'INTACT', - broken: 'BROKEN', - none: 'NONE' - } - ) %> - - -
-
- 3. SEALS -
-
-
-
- 4. DATE RECEIVED -
-
- <%= render Reports::DateInputComponent.new(report: report, name: :date_recieved, label: 'Date recieved', editing: false) %> -
-
-
- 5.RECEIVED FROM -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :recieved_from, label: 'Received from', editing: false) %> -
-
-
- 6. DISTRICT OR LABORATORY -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :district_laboratory, label: 'District or laboratory', editing: false) %> -
-
-
- 7. DESCRIPTION OF SAMPLE -
-
- <%= render Reports::LargeTextInputComponent.new(report: report, name: :sample_description, label: 'Descripton of sample', editing: false) %> -
-
-
- 8. NET CONTENTS -
-
- - - - - - - - - - - - - -
- <%= render Reports::CheckboxInputComponent.new(report: report, name: :not_applicable, label: 'Not applicable', editing: false) %> - NOT APPLICABLE - - DECLARE/UNIT - <%= render Reports::TextInputComponent.new(report: report, name: :declare_unit, label: 'Declare unit', editing: false) %> - -
- <%= render Reports::CheckboxInputComponent.new(report: report, name: :not_determined, label: 'Not determined', editing: false) %> - NOT DETERMINED - AMOUNT FOUND - - <%= render Reports::TextInputComponent.new(report: report, name: :amount_found, label: 'Amount found', editing: false) %> - -
- - <%= render Reports::TextInputComponent.new(report: report, name: :units_examined, label: 'Units examined', editing: false) %> - UNITS EXAMINED - % of DECLARED - - <%= render Reports::TextInputComponent.new(report: report, name: :percent_of_declared, label: 'Percent of declared', editing: false) %> - -
-
-
- 9. LABELING -
-
- - - - - - - - - - -
- - <%= render Reports::TextInputComponent.new(report: report, name: :originals_submitted, label: 'Original(s) submitted', editing: false) %> - ORIGINAL(S) SUBMITTED -
- - <%= render Reports::TextInputComponent.new(report: report, name: :copies_submitted, label: 'Copies submitted', editing: false) %> - COPIES SUBMITTED -
- <%= render Reports::CheckboxInputComponent.new(report: report, name: :labeling_none, label: 'None', editing: false) %> - NONE -
-
-
- 10. SUMMARY OF ANALYSIS -
-
- <%= render Reports::LargeTextInputComponent.new(report: report, name: :analysis_summary, label: 'Summary of analysis', editing: false) %> -
-
-
- 11. RESERVE SAMPLE -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :reserve_sample, label: 'Reserve sample', editing: false) %> -
-
-
- 12. a. ANALYST SIGNATURE (Broke Seal <%= render Reports::CheckboxInputComponent.new(report: report, name: :analyst_signature_broke, label: 'Broke seal', editing: false) %>) -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_a, label: 'Analyst signature A', editing: false) %> -
-
-
- 13. WORKSHEET CHECK -
-
-
- a. BY -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :worksheet_check_by, label: 'Worksheet check by', editing: false) %> -
-
-
- b. DATE -
-
- <%= render Reports::DateInputComponent.new(report: report, name: :worksheet_check_date, label: 'Worksheet check date', editing: false) %> -
-
-
- b. -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_b, label: 'Analyst signature B', editing: false) %> -
-
-
- 13. DATE REPORTED -
-
- <%= render Reports::DateInputComponent.new(report: report, name: :date_reported, label: 'Date reported', editing: false) %> -
-
-
- c. -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_c, label: 'Analyst signature C', editing: false) %> -
-
- PAGE 1 OF <%= total_pages + 1 %> -
-
diff --git a/app/views/reports/templates/template_1/edit.html.erb b/app/views/reports/templates/template_1/edit.html.erb deleted file mode 100644 index 2d9229c1c..000000000 --- a/app/views/reports/templates/template_1/edit.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -<% content_for :cover do %> - <%= render Reports::MultiCheckboxInputComponent.new( - report: report, - name: :seals, - label: 'Seals', - items: { - intact: 'Intact', - broken: 'Broken', - none: 'None' - } - ) %> - <%= render Reports::DateInputComponent.new(report: report, name: :date_recieved, label: 'Date recieved') %> - <%= render Reports::TextInputComponent.new(report: report, name: :recieved_from, label: 'Received from') %> - <%= render Reports::TextInputComponent.new(report: report, name: :district_laboratory, label: 'District or laboratory') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :sample_description, label: 'Descripton of sample') %> - - <%= render Reports::TextInputComponent.new(report: report, name: :units_examined, label: 'Units examined') %> - <%= render Reports::TextInputComponent.new(report: report, name: :declare_unit, label: 'Declare unit') %> - <%= render Reports::TextInputComponent.new(report: report, name: :amount_found, label: 'Amount found') %> - <%= render Reports::TextInputComponent.new(report: report, name: :percent_of_declared, label: 'Percent of declared') %> - <%= render Reports::CheckboxInputComponent.new(report: report, name: :not_applicable, label: 'Not applicable') %> - <%= render Reports::CheckboxInputComponent.new(report: report, name: :not_determined, label: 'Not determined') %> - - <%= render Reports::TextInputComponent.new(report: report, name: :originals_submitted, label: 'Original(s) submitted') %> - <%= render Reports::TextInputComponent.new(report: report, name: :copies_submitted, label: 'Copies submitted') %> - <%= render Reports::CheckboxInputComponent.new(report: report, name: :labeling_none, label: 'None') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :analysis_summary, label: 'Summary of analysis') %> - - <%= render Reports::TextInputComponent.new(report: report, name: :reserve_sample, label: 'Reserve sample') %> - <%= render Reports::CheckboxInputComponent.new(report: report, name: :analyst_signature_broke, label: 'Broke seal') %> - <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_a, label: 'Analyst signature A') %> - <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_b, label: 'Analyst signature B') %> - <%= render Reports::TextInputComponent.new(report: report, name: :analyst_signature_c, label: 'Analyst signature C') %> - <%= render Reports::TextInputComponent.new(report: report, name: :worksheet_check_by, label: 'Worksheet check by') %> - <%= render Reports::DateInputComponent.new(report: report, name: :worksheet_check_date, label: 'Worksheet check date') %> - <%= render Reports::DateInputComponent.new(report: report, name: :date_reported, label: 'Date reported') %> -<% end %> - -<% content_for :footer do %> - <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :analyst, label: 'Analyst') %> - <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :analyst_number, label: 'Employee number', displayed_field: :external_id) %> - <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :checked_by, label: 'Checked by') %> -<% end %> diff --git a/app/views/reports/templates/template_1/footer.html.erb b/app/views/reports/templates/template_1/footer.html.erb deleted file mode 100644 index 0092acf1d..000000000 --- a/app/views/reports/templates/template_1/footer.html.erb +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - -
-
- ANALYST(S) -
-
- <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :analyst, label: 'Analyst', editing: false) %> -
-
-
- ANALYST EMPLOYEE NO. -
-
- <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :analyst_number, label: 'Employee number', editing: false, displayed_field: :external_id) %> -
-
-
- CHECKED BY: -
-
- <%= render Reports::ProjectMembersInputComponent.new(report: report, name: :checked_by, label: 'Checked by', editing: false) %> -
-
- PAGE OF -
Single-Sided
diff --git a/app/views/reports/templates/template_1/header.html.erb b/app/views/reports/templates/template_1/header.html.erb deleted file mode 100644 index 709b38d76..000000000 --- a/app/views/reports/templates/template_1/header.html.erb +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - -
- GENERAL CONTINUATION SHEET - -
- PRODUCT -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :product, label: 'Product', editing: false) %> -
-
-
- SAMPLE NUMBER -
-
- <%= render Reports::TextInputComponent.new(report: report, name: :sample_number, label: 'Sample number', editing: false) %> -
-
diff --git a/app/views/reports/templates/template_2/cover.html.erb b/app/views/reports/templates/template_2/cover.html.erb deleted file mode 100644 index 6a4479b30..000000000 --- a/app/views/reports/templates/template_2/cover.html.erb +++ /dev/null @@ -1,118 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Technical Report
Date:<%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
From: <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From', editing: false) %>
Through:<%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through', editing: false) %>
To:<%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To', editing: false) %>
Subject:<%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject', editing: false) %>
- EXECUTIVE SUMMARY -
    -
  • Report file name: <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>
  • -
  • Personnel: <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From', editing: false) %>
  • -
  • Associated Protocol: <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol', editing: false) %>
  • -
  • Background: <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Summary background', editing: false) %>
  • -
  • Outcome/Impact: <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Outcome/Impact', editing: false) %>
  • -
  • Conclusion: <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusion', editing: false) %>
  • -
-
<%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>Page 1 of <%= total_pages + 2 %><%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
-
- - - - - - - - - - - - - -
-
    -
  • Objective <%= render Reports::LargeTextInputComponent.new(report: report, name: :objective, label: 'Objective', editing: false) %>
  • -
  • Background <%= render Reports::LargeTextInputComponent.new(report: report, name: :background, label: 'Background ', editing: false) %>
  • -
  • Materials and Methods <%= render Reports::LargeTextInputComponent.new(report: report, name: :materials_and_methods, label: 'Materials and Methods', editing: false) %>
  • -
  • Results and Discussion <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion', editing: false) %>
  • -
  • References <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References', editing: false) %>
  • -
  • Records Management Project Name: <%= render Reports::LargeTextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name', editing: false) %>
  • -
-
<%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>Page 2 of <%= total_pages + 2 %><%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
-
diff --git a/app/views/reports/templates/template_2/edit.html.erb b/app/views/reports/templates/template_2/edit.html.erb deleted file mode 100644 index 4b19ce0f1..000000000 --- a/app/views/reports/templates/template_2/edit.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% content_for :cover do %> - <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name') %> - <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Summary background') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Outcome/Impact') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusion') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :objective, label: 'Objective') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :background, label: 'Background ') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :materials_and_methods, label: 'Materials and Methods') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References') %> - <%= render Reports::TextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name') %> -<% end %> diff --git a/app/views/reports/templates/template_2/footer.html.erb b/app/views/reports/templates/template_2/footer.html.erb deleted file mode 100644 index eed44040c..000000000 --- a/app/views/reports/templates/template_2/footer.html.erb +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - -
<%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>Page of <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
diff --git a/app/views/reports/templates/template_2/header.html.erb b/app/views/reports/templates/template_2/header.html.erb deleted file mode 100644 index 7b52b05f8..000000000 --- a/app/views/reports/templates/template_2/header.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -
diff --git a/app/views/reports/templates/template_3/cover.html.erb b/app/views/reports/templates/template_3/cover.html.erb deleted file mode 100644 index 4849e82f7..000000000 --- a/app/views/reports/templates/template_3/cover.html.erb +++ /dev/null @@ -1,90 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OTR-Short Form Report
Date:<%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
From: <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From', editing: false) %>
Through:<%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through', editing: false) %>
To:<%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To', editing: false) %>
Subject:<%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject', editing: false) %>
-
    -
  • Report file name: <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>
  • -
  • Associated Protocol: <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol', editing: false) %>
  • -
  • Background: <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Background', editing: false) %>
  • -
  • Conclusions: <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusions', editing: false) %>
  • -
  • Results and Discussion <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion', editing: false) %>
  • -
  • References (if needed) <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References (if needed)', editing: false) %>
  • -
  • Records Management Project Name: <%= render Reports::LargeTextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name', editing: false) %>
  • -
-
<%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>Page 1 of <%= total_pages + 1 %><%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
-
diff --git a/app/views/reports/templates/template_3/edit.html.erb b/app/views/reports/templates/template_3/edit.html.erb deleted file mode 100644 index be0882810..000000000 --- a/app/views/reports/templates/template_3/edit.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% content_for :cover do %> - <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject') %> - <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name') %> - <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Background') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusions') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion') %> - <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References (if needed)') %> - <%= render Reports::TextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name') %> -<% end %> diff --git a/app/views/reports/templates/template_3/footer.html.erb b/app/views/reports/templates/template_3/footer.html.erb deleted file mode 100644 index 0da5ef6f4..000000000 --- a/app/views/reports/templates/template_3/footer.html.erb +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - -
<%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>Page of <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %>
diff --git a/app/views/reports/templates/template_3/header.html.erb b/app/views/reports/templates/template_3/header.html.erb deleted file mode 100644 index 7b52b05f8..000000000 --- a/app/views/reports/templates/template_3/header.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -
diff --git a/config/initializers/extends.rb b/config/initializers/extends.rb index 3520f1f5f..c785b5d0c 100644 --- a/config/initializers/extends.rb +++ b/config/initializers/extends.rb @@ -420,10 +420,5 @@ class Extends { name: 'Completed', color: '#00b900', consequences: ['MyModuleStatusConsequences::Completion'] } ] - REPORT_TEMPLATES = { - scinote_template: 'scinote_template', - template_1: 'template_1', - template_2: 'template_2', - template_3: 'template_3' - } + REPORT_TEMPLATES = {} end diff --git a/config/initializers/report_templates.rb b/config/initializers/report_templates.rb new file mode 100644 index 000000000..e482295cd --- /dev/null +++ b/config/initializers/report_templates.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +Dir.chdir(Rails.root.join('app/views/reports/templates')) do + templates = Dir.glob('*').select { |entry| File.directory?(entry) } + templates.each do |template| + next if Extends::REPORT_TEMPLATES[template.to_sym].present? + + Extends::REPORT_TEMPLATES[template.to_sym] = + if File.file?("#{template}/name.txt") + File.open("#{template}/name.txt").read.strip + else + template + end + end +end