mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-11-17 18:40:36 -05:00
- The Vehicles page shows all vehicles without a search: a Redmine list with vehicle, VIN (click to copy), customer, last serviced date and mileage, and last update, sortable by column and paged by Redmine with its per-page choices - Search narrows it to the vehicles matching every word (a single match opens it); sorting still applies and Clear goes back to everyone - A customer's vehicles (/customers/:id/vehicles) are the same list for that customer, under a Customers » customer » Vehicles trail, with New Vehicle; its search stays within the customer - Last serviced for a page of vehicles in one query (Vehicle.last_service_infos); ties on the issue's date go to the newest issue, here and on the vehicle page - The customer page's vehicle list says "No data to display" when empty, not the search wording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.6 KiB
ERB
53 lines
1.6 KiB
ERB
<% if vehicles.present? %>
|
|
|
|
<% vehicles.each do |vehicle| %>
|
|
<div class="row">
|
|
|
|
<div class="container">
|
|
|
|
<% if show_checkbox %>
|
|
<%= check_box_tag "vehicle_ids[]", vehicle.id, false, onchange: "updateLink()", data: { url: vehicle_path(vehicle).html_safe, text: vehicle.to_s, new_issue_param: 'issue[vehicle_id]' }, class: "vehicle-checkbox appointment checkbox" %>
|
|
<% else %>
|
|
<div class='checkbox'>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class='label-main'>
|
|
<%= link_to vehicle.to_s, vehicle_path(vehicle) %>
|
|
</div>
|
|
|
|
<div class="label-sub">
|
|
<%= render partial: 'vehicles/vin', locals: { vin: vehicle.vin } %>
|
|
<% if show_customer %>
|
|
<%= vehicle.customer %>
|
|
<% end %>
|
|
|
|
<%
|
|
mileage = vehicle.last_service_mileage
|
|
%>
|
|
|
|
<% if mileage %>
|
|
<br/>
|
|
<b><%= t(:label_last_service) %></b> <%= vehicle.last_service_date %>
|
|
at <%= mileage %> <%= t(:label_miles) %>
|
|
<% end %>
|
|
|
|
</div>
|
|
<br/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<% end %>
|
|
|
|
<%# pages: a Redmine::Pagination::Paginator for the list (count: how many in all); per_page_links: false to leave out "Per page" %>
|
|
<% if local_assigns[:pages] %>
|
|
<span class="pagination"><%= pagination_links_full pages, count, per_page_links: local_assigns[:per_page_links] %></span>
|
|
<% end %>
|
|
|
|
<%=t(:label_matching)%> <%= local_assigns[:count] || vehicles.size %> <%=t(:field_vehicles) %>
|
|
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|