Class: Workarea::Search::Admin::PaymentGiftCard

Inherits:
Workarea::Search::Admin show all
Defined in:
app/models/workarea/search/admin/payment_gift_card.rb

Instance Method Summary collapse

Instance Method Details

#created_byObject



32
33
34
35
36
37
38
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 32

def created_by
  if model.order_id.present?
    'order'
  else
    'admin'
  end
end

#facetsObject



40
41
42
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 40

def facets
  super.merge(created_by: created_by)
end

#jump_to_textObject



18
19
20
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 18

def jump_to_text
  "#{model.token} - balance: #{model.balance}"
end

#search_textObject



9
10
11
12
13
14
15
16
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 9

def search_text
  [
    model.token,
    model.to,
    model.from,
    model.message
  ].join ' '
end

#statusObject



22
23
24
25
26
27
28
29
30
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 22

def status
  if model.balance.zero?
    'redeemed'
  elsif model.used > 0
    'partially_redeemed'
  else
    'unredeemed'
  end
end

#typeObject



5
6
7
# File 'app/models/workarea/search/admin/payment_gift_card.rb', line 5

def type
  'gift_card'
end