Merge pull request #8132 from demarches-simplifiees/enhance_manager_team_account

feat(team_user): affiche le nombre de procedure associés aux comptes admins
This commit is contained in:
LeSim 2022-11-24 14:57:03 +01:00 committed by GitHub
commit 7db5c35850
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -2,11 +2,22 @@ module Manager
class TeamAccountsController < Manager::ApplicationController
def index
@records_per_page = params[:records_per_page] || "10"
resources = User
.where(team_account: true)
resources = Administrateur
.where(user: { team_account: true })
.order(created_at: :asc)
.page(params[:_page])
.per(@records_per_page)
resources.each do |resource|
def resource.procedures_count
procedures.with_discarded.count
end
def resource.last_sign_in_at = user.last_sign_in_at
def resource.current_sign_in_at = user.current_sign_in_at
end
page = Administrate::Page::Collection.new(dashboard)
render locals: {

View file

@ -16,8 +16,7 @@ class TeamAccountDashboard < Administrate::BaseDashboard
last_sign_in_at: Field::DateTime,
dossiers: Field::HasMany,
procedures: Field::HasMany,
administrateur: Field::HasOne,
instructeur: Field::HasOne
procedures_count: Field::Number
}.freeze
# COLLECTION_ATTRIBUTES
@ -27,10 +26,9 @@ class TeamAccountDashboard < Administrate::BaseDashboard
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [
:email,
:administrateur,
:instructeur,
:last_sign_in_at,
:current_sign_in_at
:current_sign_in_at,
:procedures_count
].freeze
# SHOW_PAGE_ATTRIBUTES