<% content_for :title, 'Points' %>
<%= form_with url: points_path(import_id: params[:import_id]), method: :get do |f| %>
<%= f.label :start_at, class: "text-sm font-semibold" %> <%= f.datetime_local_field :start_at, class: "rounded-md w-full", value: @start_at %>
<%= f.label :end_at, class: "text-sm font-semibold" %> <%= f.datetime_local_field :end_at, class: "rounded-md w-full", value: @end_at %>
<%= f.label :import, class: "text-sm font-semibold" %> <%= f.select :import_id, options_for_select(@imports.map { |i| [i.name, i.id] }, params[:import_id]), { include_blank: true }, class: "rounded-md w-full" %>
<%= f.submit "Search", class: "px-4 py-2 bg-blue-500 text-white rounded-md" %>
<%= link_to 'Export as GeoJSON', exports_path(start_at: @start_at, end_at: @end_at, file_format: :json), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "px-4 py-2 bg-green-500 text-white rounded-md join-item" %>
<%= link_to 'Export as GPX', exports_path(start_at: @start_at, end_at: @end_at, file_format: :gpx), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "px-4 py-2 bg-green-500 text-white rounded-md join-item" %>
<% end %>
<%= paginate @points %>
<%= form_with url: bulk_destroy_points_path, method: :delete, id: :bulk_destroy_form do |f| %>
<%= f.submit "Delete Selected", class: "px-4 py-2 bg-red-500 text-white rounded-md", data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" } %>
<%= page_entries_info @points, entry_name: 'point' %>
Order by: <%= link_to 'Newest', points_path(order_by: :desc, import_id: params[:import_id]), class: 'btn btn-xs btn-primary mx-1' %> <%= link_to 'Oldest', points_path(order_by: :asc, import_id: params[:import_id]), class: 'btn btn-xs btn-primary mx-1' %>
<% @points.each do |point| %> <%= render point %> <% end %>
<%= label_tag do %> Select all <%= check_box_tag 'Select all', id: :select_all_points, data: { checkbox_select_all_target: 'parent', action: 'change->checkbox-select-all#toggleChildren' } %> <% end %> Recorded At Coordinates
<% end %>