Sha256: 512f3005771b0c75569f240a1718a6eabc2e8dedf97e7742785883d705ff7952

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

class Plugins::Ecommerce::OrderDecorator < Draper::Decorator
  delegate_all

  def the_status(include_date_action = false)
    res = if object.bank_pending? || object.on_delivery_pending?
            "<span class='label label-warning'>#{h.t("plugins.ecommerce.messages.order_status.#{object.status}", default: object.status.titleize)}</span>"
          elsif object.canceled?
            "<span class='label label-danger'>#{h.t("plugins.ecommerce.messages.order_status.#{object.status}", default: object.status.titleize)}</span>"
          else
            "<span class='label label-success'>#{h.t("plugins.ecommerce.messages.order_status.#{object.status}", default: object.status.titleize)}</span>"
          end
    res = "#{res} #{object.action_date}" if include_date_action
    res
  end

  def the_url_tracking
    if object.shipped?
      consignment_number = object.get_meta("consignment_number")
      _url = object.shipping_method.options[:url_tracking].gsub("{{consignment_number}}", consignment_number) rescue ''
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_ecommerce-1.2.1 app/decorators/plugins/ecommerce/order_decorator.rb