Module: MyQuotesHelper

Defined in:
app/helpers/my_quotes_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_discounted_shipping_price(quote) ⇒ Object



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

def display_discounted_shipping_price(quote)
  shipping_cost = quote.line_items.shipping_only.to_a.sum { |li| li.price_total }
  discounted_shipping_cost = quote.discounted_shipping_total
  currency_symbol = begin
    quote.currency_symbol
  rescue StandardError
    Money::Currency.new('USD').symbol
  end

  if shipping_cost == discounted_shipping_cost
    number_to_currency(shipping_cost, unit: currency_symbol)
  else
    tag.del(number_to_currency(shipping_cost, unit: currency_symbol)) + ' ' +
      (:span, number_to_currency(discounted_shipping_cost, unit: currency_symbol), class: 'text-danger fw-bold')
  end
end

#quote_revision_history(quote) ⇒ Object



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

def quote_revision_history(quote)
  html = ''
  if quote.parent
    html << (:li, link_to("Quote # #{quote.parent.reference_number}", (quote.parent)))
    html << quote_revision_history(quote.parent)
  end
  raw(html)
end