Class: ProviderChooserForm

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/forms/provider_chooser_form.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) current_user

Returns the value of attribute current_user



5
6
7
# File 'app/forms/provider_chooser_form.rb', line 5

def current_user
  @current_user
end

- (Object) provider_id

Returns the value of attribute provider_id



4
5
6
# File 'app/forms/provider_chooser_form.rb', line 4

def provider_id
  @provider_id
end

Instance Method Details

- (Object) providers



7
8
9
# File 'app/forms/provider_chooser_form.rb', line 7

def providers
  current_user.providers
end

- (Object) week_slots(current_week)



11
12
13
14
15
16
17
18
19
# File 'app/forms/provider_chooser_form.rb', line 11

def week_slots(current_week)
  affiliation = Affiliation.find_by(provider_id: provider_id, customer: current_user)

  if affiliation.present?
    affiliation.provider.week_slots(current_week).decorate(context) + affiliation.week_bookings(current_week).decorate(context)
  else
    []
  end
end