mirror of https://github.com/fspc/BikeShed-1.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
class CheckIns < Netzke::Basepack::Grid
|
|
|
|
def configure(c)
|
|
super
|
|
c.header = false
|
|
c.model = "ActsAsLoggable::Log"
|
|
c.force_fit = true
|
|
c.scope = lambda { |rel| rel.where(:log_action_type => ::ActsAsLoggable::UserAction).
|
|
where(:loggable_type => "User").
|
|
where(:log_action_id => ::ActsAsLoggable::UserAction.find_by_action("CHECKIN")).
|
|
where("start_date >= ?", Time.zone.now.beginning_of_day);
|
|
}
|
|
c.columns = [
|
|
{ :name => :name, :getter => lambda{ |rec|
|
|
user = User.find_by_id(rec.loggable_id)
|
|
user.nil? ? "" : "#{user.first_name} #{user.last_name}"
|
|
}
|
|
},
|
|
{ :name => "Status", :getter => lambda{ |rec| rec.start_date == rec.end_date ? "Checked In" : "Checked Out" } },
|
|
:start_date,
|
|
:end_date,
|
|
]
|
|
c.prohibit_update = true
|
|
c.prohibit_create = true
|
|
c.prohibit_delete = true
|
|
end
|
|
|
|
def default_bbar
|
|
[ :search ]
|
|
end
|
|
|
|
end
|
|
|