Module: Account::OrdersHelper

Defined in:
app/helpers/account/orders_helper.rb

Instance Method Summary collapse

Instance Method Details

#destroy_paper_pathObject



5
6
7
# File 'app/helpers/account/orders_helper.rb', line 5

def destroy_paper_path
  '/account/orders/{%= file.order_id %}/attachments/{%=file.remote_asset_id%}'
end

#destroy_ticket_attachment_path(ticket_id) ⇒ Object



9
10
11
12
13
# File 'app/helpers/account/orders_helper.rb', line 9

def destroy_ticket_attachment_path(ticket_id)
  (ticket_id: ticket_id, id: 'remote_asset_id', klass: 'remote_asset_klass')
    .gsub('remote_asset_id', '{%=file.remote_token%}')
    .gsub('remote_asset_klass', '{%=file.assetable_type%}').html_safe
end

#order_state_css(order) ⇒ Object



15
16
17
18
19
# File 'app/helpers/account/orders_helper.rb', line 15

def order_state_css(order)
  return '' unless order&.state

  "status_#{order.state}#{order.not_paid? ? ' not_paid' : ''}"
end

#order_urgency(order) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/account/orders_helper.rb', line 21

def order_urgency(order)
  return nil unless order

  if order.urgency_hours.nil? && !order.parsed_customer_due_date.nil?
    return l(order.parsed_customer_due_date, format: '%m.%d.%Y; %I:%M %p')
  end

  return t('account.order.urgency.days.zero') if order.urgency_hours.nil?

  days = (order.urgency_hours.to_f / 24).ceil
  # l(order.parsed_customer_due_date, format: "#{TranslationCms.default_date_format}<br/> #{TranslationCms.default_time_format}")
  t 'account.order.urgency.days', count: days
end