2024-09-05 22:54:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-07-21 02:57:13 +02:00
|
|
|
module PdfDocuments
|
|
|
|
|
class CustomerReport < Base
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def generate
|
2024-07-22 01:29:09 +02:00
|
|
|
logo
|
2024-09-05 22:54:38 +02:00
|
|
|
@prawn_document.formatted_text_box [ {
|
2024-07-22 01:29:09 +02:00
|
|
|
text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", size: 8, align: :right
|
2024-09-05 22:54:38 +02:00
|
|
|
} ], align: :right
|
2024-07-21 02:57:13 +02:00
|
|
|
|
2024-07-22 01:29:09 +02:00
|
|
|
heading1 params.report.name
|
2024-10-31 23:13:18 +01:00
|
|
|
rich_text params.report.comment
|
2024-07-22 01:29:09 +02:00
|
|
|
|
2024-11-23 21:11:01 +01:00
|
|
|
params.report.export[:elements].each.with_index(1) do |(element, success_criteria), element_index|
|
2024-07-22 01:29:09 +02:00
|
|
|
heading2 "#{element_index} #{element.title}"
|
|
|
|
|
move_down(5)
|
2024-11-23 21:11:01 +01:00
|
|
|
bold("Pfad: #{element.page.path}")
|
|
|
|
|
move_down(5)
|
|
|
|
|
rich_text element.description
|
2024-11-23 22:05:01 +01:00
|
|
|
safe_display(element.screenshot) { image(_1, height: 160) }
|
2024-07-21 02:57:13 +02:00
|
|
|
|
2024-11-23 21:11:01 +01:00
|
|
|
success_criteria.each.with_index(1) do |success_criterion, sc_index|
|
|
|
|
|
success_criterion_row(success_criterion, [element_index, sc_index])
|
2024-07-21 02:57:13 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-11-23 21:11:01 +01:00
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def success_criterion_row(success_criterion, index)
|
|
|
|
|
heading3 "#{index.join(".")} #{success_criterion.title}"
|
|
|
|
|
safe_display(success_criterion.test_comment) do
|
|
|
|
|
heading4 "Kommentar"
|
|
|
|
|
rich_text success_criterion.test_comment
|
|
|
|
|
end
|
|
|
|
|
safe_display(success_criterion.quick_criterion) do
|
|
|
|
|
heading4 "Kriterium"
|
|
|
|
|
rich_text success_criterion.quick_criterion
|
|
|
|
|
end
|
|
|
|
|
safe_display(success_criterion.quick_fail) do
|
|
|
|
|
heading4 "Fail"
|
|
|
|
|
rich_text success_criterion.quick_fail
|
|
|
|
|
end
|
|
|
|
|
safe_display(success_criterion.quick_fix) do
|
|
|
|
|
heading4 "Fix"
|
|
|
|
|
rich_text success_criterion.quick_fix
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-07-21 02:57:13 +02:00
|
|
|
end
|
|
|
|
|
end
|