Merge branch '8-podrska-za-boje-na-kalendaru' into 'master'
Added colours for teams Closes #8 See merge request kbr4/zsterminator!6
This commit is contained in:
@@ -6,7 +6,10 @@ class ReservationsController < ApplicationController
|
||||
# GET /reservations or /reservations.json
|
||||
def index
|
||||
@reservations = Reservation.includes(:team, :customer).where(company: @company)
|
||||
@reservations = ActiveModelSerializers::SerializableResource.new(@reservations).as_json
|
||||
@reservations = ActiveModelSerializers::SerializableResource.new(
|
||||
@reservations,
|
||||
each_serializer: ReservationSerializer
|
||||
).as_json
|
||||
end
|
||||
|
||||
# GET /reservations/1 or /reservations/1.json
|
||||
@@ -201,4 +204,16 @@ class ReservationsController < ApplicationController
|
||||
@reservation.customer_surname = @customer.surname
|
||||
@reservation.customer_original_phone = @customer.original_phone
|
||||
end
|
||||
|
||||
# Override the application controller method to include teams
|
||||
def set_company
|
||||
company_id = session[:company_id]
|
||||
|
||||
unless company_id && Company.exists?(company_id)
|
||||
company_id = Company.first&.id
|
||||
session[:company_id] = company_id
|
||||
end
|
||||
|
||||
@company = Company.includes(:teams).find(company_id) if company_id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user