12 Added notes and colours to customers
This commit is contained in:
@@ -64,10 +64,15 @@ class CustomersController < ApplicationController
|
||||
).limit(10)
|
||||
|
||||
render json: @customers.map { |c|
|
||||
label = "#{c.full_name} (#{c.original_phone})"
|
||||
label += " - #{c.notes}" if c.notes.present?
|
||||
{
|
||||
id: "#{c.first_name}_#{c.surname}_#{c.original_phone}",
|
||||
label: "#{c.full_name} (#{c.original_phone})",
|
||||
birthyear: c.birthyear
|
||||
label: label,
|
||||
birthyear: c.birthyear,
|
||||
color: c.color || 'green',
|
||||
color_hex: c.color_hex,
|
||||
notes: c.notes
|
||||
}
|
||||
}
|
||||
end
|
||||
@@ -86,6 +91,6 @@ class CustomersController < ApplicationController
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def customer_params
|
||||
params.require(:customer).permit(:first_name, :surname, :phone, :notes, :email, :birthyear)
|
||||
params.require(:customer).permit(:first_name, :surname, :phone, :notes, :email, :birthyear, :color)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user