Sha256: 264ccf5c72b83dd20debe31a8817af7adf601c61cef2e815924e093ff692858d

Contents?: true

Size: 845 Bytes

Versions: 3

Compression:

Stored size: 845 Bytes

Contents

module E9Crm::DealsHelper
  def records_table_field_map_for_deal
    {
      :fields => { 
        :created_at => nil,
        :offer => nil,
        :campaign => nil
      },

      :links => proc {|r|
        []
      }
    }
  end

  def deal_date_select_options(ending_month = false)
    @_first_deal_date ||= Deal.order(:created_at).first.try(:created_at) || Date.today

    date, cdate = @_first_deal_date, Date.today

    options = []

    if ending_month
      prefix = 'Until'
      label = prefix + ' Now'
    else
      prefix = 'From'
      label = prefix + ' Inception'
    end

    begin
      options << [date.strftime("#{prefix} %B %Y"), date.strftime('%Y/%m')]
      date += 1.month
    end while date.year <= cdate.year && date.month <= cdate.month

    options.unshift([label, nil])

    options_for_select(options)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
e9_crm-0.1.6 app/helpers/e9_crm/deals_helper.rb
e9_crm-0.1.5 app/helpers/e9_crm/deals_helper.rb
e9_crm-0.1.4 app/helpers/e9_crm/deals_helper.rb