Class: Crm::Scheduler::ProfilesController

Inherits:
CrmController
  • Object
show all
Defined in:
app/controllers/crm/scheduler/profiles_controller.rb

Overview

Availability settings for SchedulerProfile records (buffers, timezone,
whether an employee is bookable at all).

Instance Method Summary collapse

Instance Method Details

#editvoid

This method returns an undefined value.

Redirects to the employee's Scheduler tab, where availability is
edited in place.



19
20
21
# File 'app/controllers/crm/scheduler/profiles_controller.rb', line 19

def edit
  redirect_to employee_path(@profile.employee, tab: 'scheduler')
end

#indexvoid

This method returns an undefined value.

Lists scheduler profiles by employee name.



11
12
13
# File 'app/controllers/crm/scheduler/profiles_controller.rb', line 11

def index
  @profiles = SchedulerProfile.includes(employee: :employee_record).order('parties.full_name')
end

#updatevoid

This method returns an undefined value.

Updates the profile loaded by #find_profile and returns to the
employee's Scheduler tab.



27
28
29
30
31
32
33
# File 'app/controllers/crm/scheduler/profiles_controller.rb', line 27

def update
  if @profile.update(profile_params)
    redirect_to employee_path(@profile.employee, tab: 'scheduler'), notice: 'Availability updated.'
  else
    redirect_to employee_path(@profile.employee, tab: 'scheduler'), alert: @profile.errors.full_messages.to_sentence
  end
end