Class: StaffDecorator
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- StaffDecorator
show all
- Includes:
- OwnerDashboardPaths
- Defined in:
- app/decorators/staff_decorator.rb
Overview
Instance Method Summary
collapse
#dashboard_v2_block_inventories_path, #dashboard_v2_confirm_reservation_path, #dashboard_v2_create_or_update_inventories_path, #dashboard_v2_create_reservation_path, #dashboard_v2_edit_reservation_path, #dashboard_v2_filter_form_url, #dashboard_v2_group_voucher_marketplace_search_history, #dashboard_v2_group_voucher_marketplace_search_list, #dashboard_v2_inventories_path, #dashboard_v2_inventory_undo_path, #dashboard_v2_log_out_path, #dashboard_v2_new_reservation_path, #dashboard_v2_package_menus_path, #dashboard_v2_reports_path, #dashboard_v2_reservation_cancel_path, #dashboard_v2_reservation_send_reminder_path, #dashboard_v2_reservation_send_review_link_path, #dashboard_v2_reservations_path, #dashboard_v2_reset_inventories_path, #dashboard_v2_reviews_path, #dashboard_v2_root_path, #dashboard_v2_self_checkin_path, #dashboard_v2_self_redeem_path, #dashboard_v2_send_custom_sms_path, #dashboard_v2_staff_path, #dashboard_v2_staffs_path, #dashboard_v2_update_reservation_path, #dashboard_v2_voucher_marketplace_edit_history, #dashboard_v2_voucher_marketplace_history, #dashboard_v2_voucher_marketplace_list, #dashboard_v2_voucher_marketplace_redeem, #edit_dashboard_v2_staff_path, #many_restaurants?, #new_dashboard_v2_staff_path, #override_report_dashboard_v2_inventories_path, #partner_path, #restaurant_group_id_hash, #restaurant_id_hash
Instance Method Details
#dashboard_v2_restaurant_name ⇒ Object
34
35
36
|
# File 'app/decorators/staff_decorator.rb', line 34
def dashboard_v2_restaurant_name
object.name
end
|
#delivery_restaurant? ⇒ Boolean
Define presentation-specific methods here. Helpers are accessed through `helpers` (aka `h`). You can override attributes, for example:
def created_at
helpers.content_tag :span, class: 'time' do
object.created_at.strftime("%a %m/%d/%y")
end
end
18
19
20
|
# File 'app/decorators/staff_decorator.rb', line 18
def delivery_restaurant?
restaurants.select(&:is_take_away?).present?
end
|
#dine_in_restaurant? ⇒ Boolean
22
23
24
|
# File 'app/decorators/staff_decorator.rb', line 22
def dine_in_restaurant?
object.restaurants.select(&:is_dine_in?).present?
end
|
#fetch_restaurant ⇒ Object
30
31
32
|
# File 'app/decorators/staff_decorator.rb', line 30
def fetch_restaurant
restaurants.first
end
|
#fetch_restaurant_ids ⇒ Object
26
27
28
|
# File 'app/decorators/staff_decorator.rb', line 26
def fetch_restaurant_ids
restaurants.pluck(:id)
end
|
#reservations ⇒ Object
42
43
44
45
46
|
# File 'app/decorators/staff_decorator.rb', line 42
def reservations
query = 'JOIN restaurants ON restaurants.id = reservations.restaurant_id'
Reservation.exclude_temporary.joins(query)
.where(restaurants: { id: object.restaurants.pluck(:id)} )
end
|
#restaurant ⇒ Object
48
49
50
|
# File 'app/decorators/staff_decorator.rb', line 48
def restaurant
object.restaurants.first.presence || Restaurant.new
end
|
#time_zone ⇒ Object
38
39
40
|
# File 'app/decorators/staff_decorator.rb', line 38
def time_zone
restaurants.first.time_zone
end
|