mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-08-19 13:30:43 -04:00
Compare commits
8
Commits
2026.3.4
...
7158a8b02c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7158a8b02c | ||
|
|
bdfad0d020 | ||
|
|
16e3d79ea8 | ||
|
|
6da0972476 | ||
|
|
35542ba1b9 | ||
|
|
cc94401a1f | ||
|
|
6012434de2 | ||
|
|
83a5811a37 |
@@ -41,6 +41,11 @@ class Vehicle < ApplicationRecord
|
|||||||
super(val.to_s.strip)
|
super(val.to_s.strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name
|
||||||
|
val = self[:name]
|
||||||
|
val.present? ? val : to_s
|
||||||
|
end
|
||||||
|
|
||||||
# Redmine compatibility shim
|
# Redmine compatibility shim
|
||||||
def project
|
def project
|
||||||
nil
|
nil
|
||||||
@@ -63,7 +68,9 @@ class Vehicle < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
return self[:name] if self[:name].present?
|
||||||
return vin if year.blank? || make.blank? || model.blank?
|
return vin if year.blank? || make.blank? || model.blank?
|
||||||
|
|
||||||
suffix = vin.to_s[9..] || vin
|
suffix = vin.to_s[9..] || vin
|
||||||
"#{year} #{make} #{model} - #{suffix}"
|
"#{year} #{make} #{model} - #{suffix}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -49,6 +49,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% last = vehicle.issues.last %>
|
||||||
|
<% if last %>
|
||||||
|
<% mileage = last.custom_values.find_by(custom_field_id: CustomField.find_by_name("Mileage").id) %>
|
||||||
|
<% if mileage %>
|
||||||
|
<p>
|
||||||
|
<b><%=t(:label_last_service) %></b> <%= last&.closed_on&.to_date || l(:label_unknown) %>
|
||||||
|
at <%= mileage.value %>
|
||||||
|
<%=t(:label_miles) %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get%>
|
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get%>
|
||||||
<%= button_to t(:label_delete), vehicle, method: :delete, data: {confirm: t(:warn_ru_sure)} %>
|
<%= button_to t(:label_delete), vehicle, method: :delete, data: {confirm: t(:warn_ru_sure)} %>
|
||||||
|
|||||||
@@ -24,11 +24,15 @@ en:
|
|||||||
label_customer_vehicles: "Customer Vehicles"
|
label_customer_vehicles: "Customer Vehicles"
|
||||||
label_edit: "Edit"
|
label_edit: "Edit"
|
||||||
label_edit_customer_vehicle: "Edit Customer Vehicle"
|
label_edit_customer_vehicle: "Edit Customer Vehicle"
|
||||||
|
label_last_service: "Last Serviced:"
|
||||||
label_make: "Make"
|
label_make: "Make"
|
||||||
|
label_miles: "miles"
|
||||||
label_model: "Model"
|
label_model: "Model"
|
||||||
label_new_vehicle: "New Customer Vehicle"
|
label_new_vehicle: "New Customer Vehicle"
|
||||||
label_no_vehicles: "There are no vehicles containing the term(s)"
|
label_no_vehicles: "There are no vehicles containing the term(s)"
|
||||||
label_search_vehicles: "Search Vehicles"
|
label_search_vehicles: "Search Vehicles"
|
||||||
|
label_unknown: "Unknown"
|
||||||
|
label_vehicle: "Vehicle"
|
||||||
label_year: "Year"
|
label_year: "Year"
|
||||||
no_customer: "Customer no longer exists"
|
no_customer: "Customer no longer exists"
|
||||||
notice_decoding_vin: "Decoding VIN… this page will update automatically."
|
notice_decoding_vin: "Decoding VIN… this page will update automatically."
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
|
|||||||
name 'Redmine QBO Vehicles plugin'
|
name 'Redmine QBO Vehicles plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
|
description 'This is a plugin for Redmine to intergrate with the redmine_qbo plugin to provide vehicle data tracking'
|
||||||
version '2026.3.4'
|
version '2026.4.1'
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
|
url 'https://github.com/rickbarrette/redmine_qbo_vehicles'
|
||||||
author_url 'https://barrettefabrication.com'
|
author_url 'https://barrettefabrication.com'
|
||||||
requires_redmine version_or_higher: '6.1.0'
|
requires_redmine version_or_higher: '6.1.0'
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ module RedmineQboVehicles
|
|||||||
Customer.prepend Vehicles::Patches::CustomerPatch
|
Customer.prepend Vehicles::Patches::CustomerPatch
|
||||||
|
|
||||||
Vehicles::Hooks::CustomerShowHookListener
|
Vehicles::Hooks::CustomerShowHookListener
|
||||||
Vehicles::Hooks::InvoiceHookListener
|
|
||||||
Vehicles::Hooks::IssuesFormHookListener
|
Vehicles::Hooks::IssuesFormHookListener
|
||||||
Vehicles::Hooks::IssuesShowHookListener
|
Vehicles::Hooks::IssuesShowHookListener
|
||||||
Vehicles::Hooks::PdfHookListener
|
Vehicles::Hooks::PdfHookListener
|
||||||
|
|||||||
@@ -18,14 +18,18 @@ module Vehicles
|
|||||||
def view_issues_form_details_bottom(context={})
|
def view_issues_form_details_bottom(context={})
|
||||||
|
|
||||||
# Load the customer's vehicles for selection in the issue form.
|
# Load the customer's vehicles for selection in the issue form.
|
||||||
|
vehicles = context[:issue].customer&.vehicles || []
|
||||||
|
|
||||||
context[:controller].send(:render_to_string, {
|
context[:controller].send(:render_to_string, {
|
||||||
partial: 'issues/form_hook_vehicles',
|
partial: 'issues/form_hook_vehicles',
|
||||||
locals: {
|
locals: {
|
||||||
vehicle: context[:form].select( :vehicle_id,
|
vehicle: context[:form].select(
|
||||||
context[:issue].customer ? context[:issue].customer.vehicles.pluck(:name, :id) : [],
|
:vehicle_id,
|
||||||
selected: context[:issue].vehicle ? context[:issue].vehicle.id : nil,
|
vehicles.map { |v| [v.name, v.id] },
|
||||||
include_blank: true )
|
selected: context[:issue].vehicle&.id,
|
||||||
}
|
include_blank: true
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user