diff --git a/app/controllers/admin/user.js b/app/controllers/admin/user.js index 30f3e7b..138377f 100644 --- a/app/controllers/admin/user.js +++ b/app/controllers/admin/user.js @@ -62,6 +62,7 @@ class UserController extends SiteController { try { res.locals.pagination = this.getPaginationParameters(req, 10); res.locals.userAccounts = await userService.getUserAccounts(res.locals.pagination, req.query.u); + res.locals.totalUserCount = await userService.getTotalCount(); res.render('admin/user/index'); } catch (error) { return next(error); diff --git a/app/services/user.js b/app/services/user.js index cdbff5e..3cef3b8 100644 --- a/app/services/user.js +++ b/app/services/user.js @@ -437,6 +437,10 @@ class UserService { const { resource: resourceService } = this.dtp.services; await resourceService.recordView(req, 'User', user._id); } + + async getTotalCount ( ) { + return await User.estimatedDocumentCount(); + } } module.exports = { diff --git a/app/views/admin/user/index.pug b/app/views/admin/user/index.pug index e29f60e..65494dc 100644 --- a/app/views/admin/user/index.pug +++ b/app/views/admin/user/index.pug @@ -1,6 +1,8 @@ extends ../layouts/main block content + include ../../components/pagination-bar + .uk-margin form(method="GET", action="/admin/user").uk-form div(uk-grid).uk-grid-collapse @@ -27,4 +29,7 @@ block content else .uk-text-muted N/A td= moment(userAccount.created).format('YYYY-MM-DD hh:mm a') - td= userAccount._id \ No newline at end of file + td= userAccount._id + + .uk-margin + +renderPaginationBar("/admin/user", totalUserCount) \ No newline at end of file