12 Added notes and colours to customers

This commit is contained in:
2025-07-23 15:35:19 +02:00
parent 84d43f0dac
commit 541b181c87
17 changed files with 362 additions and 20 deletions

View File

@@ -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