mirror of https://github.com/fspc/BikeShed-1.git
Browse Source
-Need to create a customers table to store contact information of customers who are not a user. -Need to scope "User Transactions" for users, staff, and admin. Need to have a "All Shop Transactions" tab. -Need to add conditional UX to form.denney-disable-on-select
Jason Denney
12 years ago
7 changed files with 42 additions and 5 deletions
@ -0,0 +1,17 @@ |
|||||
|
class Transactions < Netzke::Basepack::Grid |
||||
|
def configure(c) |
||||
|
super |
||||
|
c.model = "Transaction" |
||||
|
c.strong_default_attrs = { :vendor_id => controller.current_user.id } |
||||
|
c.columns = [ |
||||
|
:amount, |
||||
|
:item, |
||||
|
{ :name => :bike__serial_number}, |
||||
|
{ :name => :vendor, :getter => lambda { |rec| |
||||
|
user = rec.vendor |
||||
|
user.nil? ? "" : "#{user.first_name} #{user.last_name}" |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
end |
||||
|
end |
@ -0,0 +1,8 @@ |
|||||
|
class Transaction < ActiveRecord::Base |
||||
|
acts_as_loggable |
||||
|
attr_accessible :vendor_id, :customer_id, :customer_type, :bike_id, :amount, :item |
||||
|
|
||||
|
belongs_to :vendor, :class_name => 'User', :foreign_key => 'vendor_id' |
||||
|
belongs_to :bike |
||||
|
|
||||
|
end |
Loading…
Reference in new issue