mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
More customer/project relations
This commit is contained in:
@@ -12,11 +12,12 @@ $(function() {
|
|||||||
data: { selected_customer: $("input#issue_customer_id").val() }
|
data: { selected_customer: $("input#issue_customer_id").val() }
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input#project_customers_id").on("change", function() {
|
$("input#project_customer_id").on("change", function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/filter_vehicles_by_customer",
|
url: "/filter_vehicles_by_customer",
|
||||||
type: "GET",
|
type: "GET",
|
||||||
data: { selected_customer: $("input#project_customers_id").val() }
|
data: { selected_customer: $("input#project_customer_id").val() }
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ en:
|
|||||||
field_qbo_invoice: "Invoice"
|
field_qbo_invoice: "Invoice"
|
||||||
field_qbo_estimate: "Estimate"
|
field_qbo_estimate: "Estimate"
|
||||||
field_vehicles: "Vehicle"
|
field_vehicles: "Vehicle"
|
||||||
|
field_vehicle: "Vehicle"
|
||||||
field_vin: "VIN"
|
field_vin: "VIN"
|
||||||
field_notes: "Notes"
|
field_notes: "Notes"
|
||||||
field_qbo_billed: "Billed"
|
field_qbo_billed: "Billed"
|
||||||
|
|||||||
@@ -15,21 +15,21 @@ class ProjectsFormHookListener < Redmine::Hook::ViewListener
|
|||||||
f = context[:form]
|
f = context[:form]
|
||||||
|
|
||||||
# Check to see if there is a quickbooks user attached to the issue
|
# Check to see if there is a quickbooks user attached to the issue
|
||||||
selected_customer = context[:project].customers_id ? context[:project].customers_id : nil
|
selected_customer = context[:project].customer ? context[:project].customer : nil
|
||||||
selected_vehicle = context[:project].vehicles_id ? context[:project].vehicles_id : nil
|
selected_vehicle = context[:project].vehicle_id ? context[:project].vehicle_id : nil
|
||||||
|
|
||||||
# Load customer information
|
# Load customer information
|
||||||
customer = Customer.find_by_id(selected_customer) if selected_customer
|
customer = Customer.find_by_id(selected_customer) if selected_customer
|
||||||
search_customer = f.autocomplete_field :customers_id, autocomplete_customer_name_customers_path, :selected => selected_customer, :update_elements => {:id => '#project_customer_id', :value => '#project_customer'}
|
search_customer = f.autocomplete_field :customer, autocomplete_customer_name_customers_path, :selected => selected_customer, :update_elements => {:id => '#project_customer_id', :value => '#project_customer'}
|
||||||
customer_id = f.hidden_field :customers_id, :id => "project_customer_id"
|
customer_id = f.hidden_field :customer_id, :id => "project_customer_id"
|
||||||
|
|
||||||
if context[:project].customers_id
|
if context[:project].customer
|
||||||
vehicles = customer.vehicles.pluck(:name, :id).sort!
|
vehicles = customer.vehicles.pluck(:name, :id).sort!
|
||||||
else
|
else
|
||||||
vehicles = [nil].compact
|
vehicles = [nil].compact
|
||||||
end
|
end
|
||||||
|
|
||||||
vehicle = f.select :vehicles_id, vehicles, :selected => selected_vehicle, include_blank: true
|
vehicle = f.select :vehicle_id, vehicles, :selected => selected_vehicle, include_blank: true
|
||||||
|
|
||||||
return "<p><label for=\"project_customer\">Customer</label>#{search_customer} #{customer_id}</p> <p>#{vehicle}</p>"
|
return "<p><label for=\"project_customer\">Customer</label>#{search_customer} #{customer_id}</p> <p>#{vehicle}</p>"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user