<% my_module ||= report_element.my_module %> <% timestamp = my_module.created_at %> <% export_all = defined?(export_all) && export_all %>

<%= link_to my_module.name, protocols_my_module_url(my_module), target: :_blank %> <% if my_module.archived? %> <%= t('search.index.archived') %> <% end %>

<%= t('projects.reports.elements.module.user_time', code: my_module.code, timestamp: l(timestamp, format: :full)) %>

<% if my_module.started_on.present? %> <%= t('projects.reports.elements.module.started_on', started_on: l(my_module.started_on, format: :full)) %> <% end %>

<% if my_module.due_date.present? %> <%= t('projects.reports.elements.module.due_date', due_date: l(my_module.due_date, format: :full)) %> <% end %>

<% status = my_module.my_module_status %> <%= t('projects.reports.elements.module.status') %> <%= status.name %> <% if my_module.completed? %> <%= t('my_modules.states.completed') %> <%= l(my_module.completed_on, format: :full) %> <% end %>

<%= t('projects.reports.elements.module.tags_header') %>
<% if (tags = my_module.tags.order(:id)).present? %> <% tags.each do |tag| %>
<%= tag.name %>
<% end %> <% end %>
<% if my_module.description.present? %> <%= custom_auto_link(my_module.prepare_for_report(:description, export_all), team: current_team, simple_format: false, base64_encoded_imgs: export_all) %> <% end %>
<%= render partial: 'reports/elements/my_module_protocol_element', locals: { protocol: my_module.protocol, export_all: export_all } %> <% filter_steps_for_report(my_module.protocol.steps, @settings).order(:position).each do |step| %> <%= render partial: 'reports/elements/my_module_step_element', locals: { step: step, export_all: export_all } %> <% end %> <% if %w(file_results table_results text_results).any? { |k| @settings.dig('task', k) } %>
<%= t('projects.reports.elements.module.results') %>

<% end %> <% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %> <%= render partial: 'reports/elements/my_module_result_asset_element', locals: { result: result, report: report, export_all: export_all } %> <% end %>

<% if defined?(children) %>
<%= children %>
<% end %> <% if @settings.dig('task', 'activities') %>
<%= render partial: 'reports/elements/my_module_activity_element', locals: { my_module: my_module, export_all: export_all } %>
<% end %>