app/views/admin/imports/show.html.erb
<% content_for :title, @import.to_s %>
<div class="row mb-5">
<div class="col-md-6">
<p>
<%= t('imports.initiated_by') %>
<% if @import.user %>
<%= link_to_if can?(:read, @import.user), @import.user, [:admin, @import.user] %>
<% else %>
<%= t('imports.deleted_user') %>
<% end %>
</p>
<% if @import.file.attached? %>
<p><%= link_to t('download_with_size', size: number_to_human_size(@import.file.byte_size)), url_for(@import.file), class: button_classes %></p>
<% end %>
</div>
<div class="col-md-6">
<h2><%= t('imports.status') %> <span class="<%= @import.status_class %>"><%= t("enums.import.status.#{@import.status}") %></span></h2>
<% unless @import.pending? %>
<p><%= t('imports.number_of_lines') %> <%= @import.number_of_lines %></p>
<% end %>
<% if @import.pending? && @import.user == current_user %>
<p><%= t('imports.still_pending') %></p>
<% end %>
</div>
</div>
<% if @import.finished_with_errors? %>
<h2><%= t('imports.errors') %></h2>
<table class="table">
<thead>
<tr>
<th>Ligne</th>
<th>Erreur</th>
</tr>
</thead>
<% @import.processing_errors.each do |obj| %>
<tr>
<td><span class="badge text-bg-danger"><%= obj['line'] %></span></td>
<td><%= obj['error'] %></td>
</tr>
<% end %>
</table>
<% end %>