mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
New view to show the current day's check ins
This commit is contained in:
parent
3c90c13c3b
commit
b67062fb32
@ -44,7 +44,8 @@ class AppTabPanel < Netzke::Basepack::TabPanel
|
|||||||
:logs,
|
:logs,
|
||||||
{ layout: :fit,
|
{ layout: :fit,
|
||||||
wrappedComponent: :user_role_joins,
|
wrappedComponent: :user_role_joins,
|
||||||
title: "User Roles"}
|
title: "User Roles"},
|
||||||
|
:check_ins
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
21
app/components/check_ins.rb
Normal file
21
app/components/check_ins.rb
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
class CheckIns < Netzke::Basepack::Grid
|
||||||
|
|
||||||
|
def configure(c)
|
||||||
|
super
|
||||||
|
c.header = false
|
||||||
|
c.model = "ActsAsLoggable::Log"
|
||||||
|
c.scope = lambda { |rel| rel.where(:log_action_id => ::ActsAsLoggable::UserAction.find_by_action("CHECKIN")).
|
||||||
|
where("start_date >= ?", Time.zone.now.beginning_of_day);
|
||||||
|
}
|
||||||
|
c.columns = [
|
||||||
|
{ :name => :logged_by, :getter => lambda{ |rec|
|
||||||
|
user = User.find_by_id(rec.logger_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,
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user