|
| 1 | +<div class="w-full mx-auto"> |
| 2 | + <% if notice.present? %> |
| 3 | + <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p> |
| 4 | + <% end %> |
| 5 | + |
| 6 | + <h1 class="text-center font-bold text-4xl mb-4">Question Answers Summary</h1> |
| 7 | + |
| 8 | + <% if @options_with_questions.empty? %> |
| 9 | + <p class="text-center mt-8">No questions have been defined yet.</p> |
| 10 | + <p class="text-center mt-4"> |
| 11 | + To add questions, edit an <%= link_to 'option', billables_path, class: "text-blue-600 underline" %> |
| 12 | + and add questions in the "Questions for this option" section. |
| 13 | + </p> |
| 14 | + <% else %> |
| 15 | + <% @answer_data.each do |option, questions_hash| %> |
| 16 | + <div class="mt-8 mb-12"> |
| 17 | + <h2 class="font-bold text-2xl mb-4"><%= option.name %></h2> |
| 18 | + |
| 19 | + <% questions_hash.each do |question, answers| %> |
| 20 | + <div class="mb-6"> |
| 21 | + <h3 class="font-semibold text-xl mb-3"><%= question.question_text %></h3> |
| 22 | + |
| 23 | + <% if answers.any? %> |
| 24 | + <table class="table-auto mx-auto w-full max-w-4xl border-collapse"> |
| 25 | + <thead> |
| 26 | + <tr class="bg-gray-100"> |
| 27 | + <th class="border border-gray-300 px-4 py-2 text-left">Person</th> |
| 28 | + <th class="border border-gray-300 px-4 py-2 text-left">Studio</th> |
| 29 | + <th class="border border-gray-300 px-4 py-2 text-left">Answer</th> |
| 30 | + </tr> |
| 31 | + </thead> |
| 32 | + <tbody> |
| 33 | + <% answers.each do |answer| %> |
| 34 | + <tr> |
| 35 | + <td class="border border-gray-300 px-4 py-2"> |
| 36 | + <%= link_to answer.person.name, answer.person, class: "text-blue-600 hover:underline" %> |
| 37 | + </td> |
| 38 | + <td class="border border-gray-300 px-4 py-2"> |
| 39 | + <%= answer.person.studio&.name || 'N/A' %> |
| 40 | + </td> |
| 41 | + <td class="border border-gray-300 px-4 py-2"> |
| 42 | + <% if answer.answer_value.present? %> |
| 43 | + <%= answer.answer_value %> |
| 44 | + <% else %> |
| 45 | + <span class="text-gray-400 italic">No answer provided</span> |
| 46 | + <% end %> |
| 47 | + </td> |
| 48 | + </tr> |
| 49 | + <% end %> |
| 50 | + </tbody> |
| 51 | + </table> |
| 52 | + <% else %> |
| 53 | + <p class="text-gray-500 italic ml-4">No answers yet for this question.</p> |
| 54 | + <% end %> |
| 55 | + </div> |
| 56 | + <% end %> |
| 57 | + </div> |
| 58 | + <% end %> |
| 59 | + |
| 60 | + <div class="mt-8 text-center"> |
| 61 | + <%= link_to "Download PDF Report", report_answers_path(format: :pdf), |
| 62 | + class: "inline-block px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 font-medium" %> |
| 63 | + </div> |
| 64 | + <% end %> |
| 65 | +</div> |
0 commit comments