feat(team_account): add procedures count

This commit is contained in:
simon lehericey 2022-11-24 14:21:32 +01:00 committed by LeSim
parent 6c5ceac1e5
commit 18bb26a7f2
2 changed files with 11 additions and 2 deletions

View file

@ -7,6 +7,13 @@ module Manager
.order(created_at: :asc) .order(created_at: :asc)
.page(params[:_page]) .page(params[:_page])
.per(@records_per_page) .per(@records_per_page)
resources.each do |resource|
def resource.procedures_count
administrateur.procedures.with_discarded.count
end
end
page = Administrate::Page::Collection.new(dashboard) page = Administrate::Page::Collection.new(dashboard)
render locals: { render locals: {

View file

@ -15,7 +15,8 @@ class TeamAccountDashboard < Administrate::BaseDashboard
current_sign_in_at: Field::DateTime, current_sign_in_at: Field::DateTime,
last_sign_in_at: Field::DateTime, last_sign_in_at: Field::DateTime,
dossiers: Field::HasMany, dossiers: Field::HasMany,
procedures: Field::HasMany procedures: Field::HasMany,
procedures_count: Field::Number
}.freeze }.freeze
# COLLECTION_ATTRIBUTES # COLLECTION_ATTRIBUTES
@ -26,7 +27,8 @@ class TeamAccountDashboard < Administrate::BaseDashboard
COLLECTION_ATTRIBUTES = [ COLLECTION_ATTRIBUTES = [
:email, :email,
:last_sign_in_at, :last_sign_in_at,
:current_sign_in_at :current_sign_in_at,
:procedures_count
].freeze ].freeze
# SHOW_PAGE_ATTRIBUTES # SHOW_PAGE_ATTRIBUTES