2024-06-12 15:10:53 -04:00
<% content_for :title, 'Points' %>
2024-05-23 14:12:23 -04:00
2024-11-28 09:54:36 -05:00
<div class="w-full my-5">
2024-09-28 11:29:56 -04:00
<%= form_with url: points_path(import_id: params[:import_id]), data: { turbo_method: :get }, method: :get do |f| %>
2024-05-23 14:12:23 -04:00
<div class="flex flex-col md:flex-row md:space-x-4 md:items-end">
2024-09-08 11:25:35 -04:00
<div class="w-full md:w-2/12">
2024-05-23 14:12:23 -04:00
<div class="flex flex-col space-y-2">
<%= f.label :start_at, class: "text-sm font-semibold" %>
2025-07-26 08:52:01 -04:00
<%= f.datetime_local_field :start_at, class: "input input-bordered hover:cursor-pointer hover:input-primary", value: @start_at %>
2024-03-16 17:39:03 -04:00
</div>
2024-05-23 14:12:23 -04:00
</div>
2024-09-08 11:25:35 -04:00
<div class="w-full md:w-2/12">
2024-05-23 14:12:23 -04:00
<div class="flex flex-col space-y-2">
<%= f.label :end_at, class: "text-sm font-semibold" %>
2025-07-26 08:52:01 -04:00
<%= f.datetime_local_field :end_at, class: "input input-bordered hover:cursor-pointer hover:input-primary", value: @end_at %>
2024-03-16 17:39:03 -04:00
</div>
2024-05-23 14:12:23 -04:00
</div>
2024-09-08 11:25:35 -04:00
<div class="w-full md:w-2/12">
<div class="flex flex-col space-y-2">
<%= f.label :import, class: "text-sm font-semibold" %>
2025-07-26 08:52:01 -04:00
<%= f.select :import_id, options_for_select(@imports.map { |i| [i.name, i.id] }, params[:import_id]), { include_blank: true }, class: "input input-bordered hover:cursor-pointer hover:input-primary" %>
2024-09-08 11:25:35 -04:00
</div>
</div>
2024-09-02 12:32:21 -04:00
<div class="w-full md:w-1/12">
2024-05-23 14:12:23 -04:00
<div class="flex flex-col space-y-2">
2025-07-26 08:52:01 -04:00
<%= f.submit "Search", class: "btn btn-primary" %>
2024-03-16 17:39:03 -04:00
</div>
</div>
2024-09-02 12:32:21 -04:00
<div class="w-full md:w-2/12">
2024-05-30 17:36:12 -04:00
<div class="flex flex-col space-y-2 text-center">
2025-10-21 14:01:13 -04:00
<%= link_to 'Export as GeoJSON', exports_path(start_at: @start_at, end_at: @end_at, file_format: :json), data: { 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: "btn border border-base-300 hover:btn-ghost" %>
2024-09-02 15:42:49 -04:00
</div>
</div>
<div class="w-full md:w-2/12">
<div class="flex flex-col space-y-2 text-center">
2025-10-21 14:01:13 -04:00
<%= link_to 'Export as GPX', exports_path(start_at: @start_at, end_at: @end_at, file_format: :gpx), data: { 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: "btn border border-base-300 hover:btn-ghost" %>
2024-05-30 17:36:12 -04:00
</div>
</div>
2024-03-23 16:17:23 -04:00
</div>
2024-05-23 14:12:23 -04:00
<% end %>
<div class='text-center my-5'>
2024-07-24 14:25:16 -04:00
<%= paginate @points %>
2024-03-16 17:39:03 -04:00
</div>
2024-03-23 16:17:23 -04:00
2024-05-23 14:12:23 -04:00
<div id="points" class="min-w-full">
<div data-controller='checkbox-select-all'>
2024-11-12 09:54:18 -05:00
<%= form_with url: bulk_destroy_points_path(params.permit!), method: :delete, id: :bulk_destroy_form do |f| %>
2024-07-31 13:35:35 -04:00
<div class="flex justify-between my-5">
2025-10-21 14:01:13 -04:00
<%= f.submit "Delete Selected", class: "px-4 py-2 bg-red-500 text-white rounded-md", data: { turbo_confirm: "Are you sure?", checkbox_select_all_target: "deleteButton" }, style: "display: none;" %>
2024-09-14 16:52:25 -04:00
<div>
<%= page_entries_info @points, entry_name: 'point' %>
2024-09-05 18:19:53 -04:00
</div>
2024-07-31 13:35:35 -04:00
<div class="flex justify-end">
<span class="mr-2">Order by:</span>
2024-11-12 09:54:18 -05:00
<%= link_to 'Newest', points_path(order_by: :desc, import_id: params[:import_id], start_at: params[:start_at], end_at: params[:end_at]), class: 'btn btn-xs btn-primary mx-1' %>
<%= link_to 'Oldest', points_path(order_by: :asc, import_id: params[:import_id], start_at: params[:start_at], end_at: params[:end_at]), class: 'btn btn-xs btn-primary mx-1' %>
2024-07-31 13:35:35 -04:00
</div>
</div>
2024-05-23 14:12:23 -04:00
<table class='table'>
<thead>
<tr>
<th>
<%= label_tag do %>
<%= check_box_tag 'Select all',
id: :select_all_points,
data: {
checkbox_select_all_target: 'parent',
action: 'change->checkbox-select-all#toggleChildren'
2025-07-26 08:41:03 -04:00
},
class: 'mr-2'
2024-05-23 14:12:23 -04:00
%>
2025-07-26 08:41:03 -04:00
Select all
2024-05-23 14:12:23 -04:00
<% end %>
</div>
</th>
2024-12-11 10:18:40 -05:00
<th>Speed, km/h</th>
2024-05-23 14:12:23 -04:00
<th>Recorded At</th>
<th>Coordinates</th>
</tr>
</thead>
<tbody>
<% @points.each do |point| %>
<%= render point %>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>
2024-11-12 09:55:49 -05:00
<div class='text-center my-5'>
<%= paginate @points %>
</div>
2024-03-23 16:17:23 -04:00
</div>