demarches-normaliennes/app/views/instructeurs/procedures/download_export.js.erb

24 lines
1.1 KiB
Text

<% if @can_download_dossiers %>
<% if @statut.present? %>
<%= render_to_element('.dossiers-export', partial: "dossiers_export", locals: { procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count }) %>
<% else %>
<%= render_to_element('.procedure-actions', partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }) %>
<% end %>
<% end %>
<% @exports.values.each do |exports| %>
<% if @statut.present? %>
<% export = exports[:statut][@statut] %>
<% if export && !export.ready? %>
<%= fire_event('export:update', { url: download_export_instructeur_procedure_path(@procedure, export_format: export.format, statut: export.statut, no_progress_notification: true) }.to_json) %>
<% end %>
<% else %>
<% exports[:time_span_type].values.each do |export| %>
<% if !export.ready? %>
<%= fire_event('export:update', { url: download_export_instructeur_procedure_path(@procedure, export_format: export.format, time_span_type: export.time_span_type, no_progress_notification: true) }.to_json) %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= render_flash %>