<%
  rows_to_assign = selected_rows.select{ |k, v| v[:assigned] == "true" }
  rows_to_unassign = selected_rows.select{ |k, v| v[:assigned] == "false" }
%>
<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
    <span aria-hidden="true">×</span>
  </button>
  <h4 class="modal-title">
    <%= t('my_modules.modals.update_repository_record.title',
         repository_name: repository.name,
         my_module_name: my_module.name) %>
  </h4>
</div>
<div class="modal-body">
  <p><%= t('my_modules.modals.update_repository_record.message', size: selected_rows.values.count) %></p>
  <div class="rows-list-container">
    <% if rows_to_assign.values.any? %>
      <div class="rows-to-assign">
        <p class="header">
          <i class="fas fa-plus"></i>
          <%= t('my_modules.modals.update_repository_record.newly_assigned_items') %>
        </p>
        <ul class="rows-list">
          <% rows_to_assign.each do |row_id, row| %>
            <li><%= row[:row_name] %></li>
          <% end %>
        </ul>
      </div>
    <% end %>
    <% if rows_to_unassign.values.any? %>
      <div class="rows-to-unassign">
        <p class="header">
          <i class="fas fa-minus"></i>
          <%= t('my_modules.modals.update_repository_record.items_will_be_removed') %>
        </p>
        <ul class="rows-list">
          <% rows_to_unassign.each do |row_id, row| %>
            <li><%= row[:row_name] %></li>
          <% end %>
        </ul>
      </div>
    <% end %>
  </div>
</div>
<div class="modal-footer">
  <a class="btn btn-light" data-dismiss="modal">
    <i class="fas fa-times"></i>
    <%= t('general.cancel') %>
  </a>
  <a class="btn btn-secondary downstream-action" >
    <%= t('my_modules.modals.update_repository_record.task_and_downstream') %>
  </a>
  <a class="btn btn-primary task-action">
    <%= t('my_modules.modals.update_repository_record.task') %>
  </a>
</div>
