Module: MyRoomsHelper

Defined in:
app/helpers/my_rooms_helper.rb

Instance Method Summary collapse

Instance Method Details



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/my_rooms_helper.rb', line 12

def room_link_helper
  redesign_candidate = false
  redesign_candidate = true if @room.complete? and @room.descendants.empty? and !@room.orders.present?
  links = []
  links << link_to("Cancel Installation Plan Design", cancel_design_my_room_path(@room, :authenticity_token => form_authenticity_token), data: { turbo_method: :post }, :class => "block-ui-on-click") if @room.in_design? and !@room.orders.non_carts.present?
  links << link_to('Cancel Room/Heated Space', cancel_my_room_path(@room, :authenticity_token => form_authenticity_token), data: { turbo_method: :put, turbo_confirm: "Are you sure you want to cancel this room?" }) if @room.ok_to_customer_cancel?
  links << link_to("Duplicate Room/Heated Space", duplicate_my_room_path(@room, :authenticity_token => form_authenticity_token), data: { turbo_method: :put }) if @room.reception_type.present? and !redesign_candidate
  links << link_to("Edit Room/Heated Space Info", edit_my_room_path(@room)) if @room.draft?
  links << link_to("Edit Design Tool Plan", edit_room_plan_path(@room.room_plan, room_configuration_id: @room.id)) if @room.draft? and @room.room_plan
  links << link_to("Request Installation Plan", "#request_plan") if @room.floorplan_xml or @room.room_plan or @room.uploads.room_layouts.present? and @room.draft?
  links << link_to("Request an Installation Plan Redesign", redesign_my_room_path(@room)) if redesign_candidate
  # Heat Loss links are now constrained to the Heat Loss Calculation panel only
  links << link_to("Move Room/Heated Space to Another Project", move_my_room_path(@room))
  return links
end

#room_revision_history(rc) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/my_rooms_helper.rb', line 3

def room_revision_history(rc)
  html = ""
  if rc.parent
    html << (:li, link_to(rc.parent.reference_number, my_room_path(rc.parent)))
    html << room_revision_history(rc.parent)
  end
  raw(html)
end

#room_state_definition(room) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/helpers/my_rooms_helper.rb', line 28

def room_state_definition(room)
  status = ""
  if room.orders.non_carts.present?
    status = raw "You purchased this heating system in order #{room.orders.map{|o| link_to o.reference_number, (o.id) }.join(',')}"
  elsif room.state.present?
    case room.state.to_sym
    when :draft
      if room.floorplan_xml or room.uploads.room_layouts.present?
        status = "Your room/heated space layout is now ready to be submitted to our design team for a free installation plan. Use the 'Request free installation plan' button above to submit your room for design. If you do submit the room/heated space for design, you will receive an email once the installation plan of your room/heated space is complete and you can then return to this page to review it."
        status << raw("") if room.line_items.present?
      end
      status << raw(" If you would like to place your order immediately, you can add this heating system to your cart, orders typically ship the same day they are placed. All orders with room/heated space layouts will also ship with a free installation plan.") if room.line_items.present?
    when :in_design
      status = "Your layout has been sent to our design team. You will receive an email once the installation plan of your room/heated space is complete and you can then return to this page to review it."
      status << raw(" If you would like to place your order immediately, please cancel this design request and add the room/heated space to your cart, as we will still include a free installation plan in every order where you have provided a room/heated space layout.") if room.line_items.present?
    when :awaiting_quality_control
      status = "Your installation plan is currently in the final stage of design review and will soon be completed."
    when :complete
      status = "Your room/heated space has been marked completed"
      status << " and an installation plan was created" if room.has_installation_plans?
      status << ". You can add this heating system's line items to your cart and complete the purchase, orders typically ship the same day they are placed." if room.line_items.present?
      status << " If you are not satisfied with the installation plan and materials you can request a redesign under 'Room/Heated Space Options'." if room.has_installation_plans?
    end
  end
  status
end