<div class="row m-3">
  <div class="col">
    <%= form_tag("/internal/podcasts", method: "get") do %>
      <div class="form-row justify-content-end">
        <div class="form-group">
          <%= text_field_tag(:search, params[:search]) %>
          <%= submit_tag("Search") %>
        </div>
      </div>
    <% end %>
  </div>
</div>

<%= paginate @podcasts %>

<table class="table">
  <thead>
    <tr>
      <th scope="col">ID</th>
      <th scope="col">Title</th>
      <th scope="col">Feed URL</th>
      <th scope="col">Eps</th>
      <th scope="col">Reach</th>
      <th scope="col">Pub</th>
      <th scope="col">Status Notice</th>
      <th scope="col">Admin</th>
    </tr>
  </thead>
  <tbody>
    <% @podcasts.each do |podcast| %>
    <tr>
      <td><%= podcast.id %></td>
      <td><%= link_to podcast.title, edit_internal_podcast_path(podcast) %></td>
      <td><%= link_to podcast.feed_url, podcast.feed_url %></td>
      <td><%= podcast.episodes_count %></td>
      <td><%= podcast.reachable %></td>
      <td><%= podcast.published %></td>
      <td><%= podcast.status_notice %></td>
      <td>
        <% podcast.admins.pluck(:username).each do |username| %>
          <%= link_to "@#{username}", "/#{username}" %>
        <% end %>
      </td>
    </tr>
    <% end %>
  </tbody>
</table>

<%= paginate @podcasts %>
