Class: Search::ServiceJobPresenter

Inherits:
BasePresenter
  • Object
show all
Includes:
Presenters::Timeable
Defined in:
app/presenters/search/service_job_presenter.rb

Overview

Presents service job search results with HTML links and formatted values.

See Also:

Direct Known Subclasses

PresetJobPresenter

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#business_phoneString

Returns the business phone number formatted for display.

Returns:

  • (String)

    the formatted business phone



44
45
46
# File 'app/presenters/search/service_job_presenter.rb', line 44

def business_phone
  h.number_to_phone(r.business_phone)
end

#cell_phoneString

Returns the cell phone number formatted for display.

Returns:

  • (String)

    the formatted cell phone



37
38
39
# File 'app/presenters/search/service_job_presenter.rb', line 37

def cell_phone
  h.number_to_phone(r.cell_phone)
end

#completed_onString

Returns the completion date formatted for display.

Returns:

  • (String)

    the formatted completion date



58
59
60
# File 'app/presenters/search/service_job_presenter.rb', line 58

def completed_on
  h.render_date(r.completed_on)
end

Returns a link to the associated customer, if available.

Returns:

  • (ActiveSupport::SafeBuffer, nil)

    the customer link, or nil



14
15
16
17
18
# File 'app/presenters/search/service_job_presenter.rb', line 14

def customer_link
  return unless r.has_columns?(:customer_full_name, :customer_id)

  h.link_to r.customer_full_name, h.customer_path(r.customer_id)
end

#distanceString

Returns the distance rounded to two decimal places.

Returns:

  • (String)

    the distance with units



23
24
25
# File 'app/presenters/search/service_job_presenter.rb', line 23

def distance
  "#{r.distance.to_f.round(2)} mi."
end

#home_phoneString

Returns the home phone number formatted for display.

Returns:

  • (String)

    the formatted home phone



30
31
32
# File 'app/presenters/search/service_job_presenter.rb', line 30

def home_phone
  h.number_to_phone(r.home_phone)
end

#job_dateString

Returns the job date formatted for display.

Returns:

  • (String)

    the formatted job date



51
52
53
# File 'app/presenters/search/service_job_presenter.rb', line 51

def job_date
  h.render_date(r.job_date)
end