Calendar is shown
This commit is contained in:
@@ -6,7 +6,8 @@ class ReservationsController < ApplicationController
|
||||
# GET /reservations or /reservations.json
|
||||
def index
|
||||
|
||||
@reservations = Reservation.all
|
||||
@reservations = Reservation.all.includes(:team, :customer).where(company: @company)
|
||||
@reservations = ActiveModelSerializers::SerializableResource.new(@reservations).as_json
|
||||
end
|
||||
|
||||
# GET /reservations/1 or /reservations/1.json
|
||||
@@ -16,7 +17,7 @@ class ReservationsController < ApplicationController
|
||||
# GET /reservations/new
|
||||
def new
|
||||
@reservation = Reservation.new
|
||||
@reservation.place = @company.places.first
|
||||
@reservation.team = @company.teams.first
|
||||
end
|
||||
|
||||
# GET /reservations/1/edit
|
||||
@@ -70,7 +71,7 @@ class ReservationsController < ApplicationController
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def reservation_params
|
||||
params.require(:reservation).permit(:company_id, :customer_id, :place_id, :title, :description, :start_time, :end_time)
|
||||
params.require(:reservation).permit(:company_id, :customer_id, :team_id, :title, :description, :start_time, :end_time)
|
||||
end
|
||||
|
||||
def determine_layout
|
||||
|
||||
@@ -22,6 +22,7 @@ class TeamsController < ApplicationController
|
||||
# POST /teams or /teams.json
|
||||
def create
|
||||
@team = Team.new(team_params)
|
||||
@team.company = Company.first
|
||||
|
||||
respond_to do |format|
|
||||
if @team.save
|
||||
@@ -36,6 +37,7 @@ class TeamsController < ApplicationController
|
||||
|
||||
# PATCH/PUT /teams/1 or /teams/1.json
|
||||
def update
|
||||
@team.company = Company.first
|
||||
respond_to do |format|
|
||||
if @team.update(team_params)
|
||||
format.html { redirect_to team_url(@team), notice: "Team was successfully updated." }
|
||||
@@ -65,6 +67,6 @@ class TeamsController < ApplicationController
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def team_params
|
||||
params.fetch(:team, {})
|
||||
params.require(:team).permit(:name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user