Updating the admin account view to show use the new account_invoice model to display data

This commit is contained in:
Rob Harrington
2015-09-17 20:31:25 +10:00
parent 27384439f8
commit 2dcbe2b4f2
4 changed files with 23 additions and 19 deletions

View File

@@ -25,14 +25,19 @@ class BillablePeriod < ActiveRecord::Base
end
end
def adjustment_label
def label
enterprise_version = enterprise.version_at(begins_at)
category = enterprise_version.category.to_s.titleize
category += (trial ? " Trial" : "")
"#{enterprise_version.name} (#{category})"
end
def adjustment_label
begins = begins_at.localtime.strftime("%d/%m/%y")
ends = ends_at.localtime.strftime("%d/%m/%y")
"#{enterprise_version.name} (#{category}) [#{begins} - #{ends}]"
"#{label} [#{begins} - #{ends}]"
end
def delete

View File

@@ -7,6 +7,7 @@ Spree.user_class.class_eval do
has_many :enterprises, through: :enterprise_roles
has_many :owned_enterprises, class_name: 'Enterprise', foreign_key: :owner_id, inverse_of: :owner
has_many :owned_groups, class_name: 'EnterpriseGroup', foreign_key: :owner_id, inverse_of: :owner
has_many :account_invoices
has_many :billable_periods, foreign_key: :owner_id, inverse_of: :owner
has_one :cart
has_many :customers