diff --git a/app/javascript/dashboard/components/table/Pagination.vue b/app/javascript/dashboard/components/table/Pagination.vue index 6de3d851c..cea8e0e90 100644 --- a/app/javascript/dashboard/components/table/Pagination.vue +++ b/app/javascript/dashboard/components/table/Pagination.vue @@ -1,12 +1,47 @@ - - - - {{ $t('REPORT.PAGINATION.RESULTS', { start, end, total }) }} - - - - - - - - - - - + + {{ $t('REPORT.PAGINATION.RESULTS', { start, end, total }) }} + + + + + + + - {{ page }} - - - - - - - - - + + {{ page }} + + + + + + diff --git a/app/javascript/dashboard/i18n/locale/en/report.json b/app/javascript/dashboard/i18n/locale/en/report.json index 3156115c9..294ca2e7b 100644 --- a/app/javascript/dashboard/i18n/locale/en/report.json +++ b/app/javascript/dashboard/i18n/locale/en/report.json @@ -119,7 +119,8 @@ "EMPTY_LIST": "No results found" }, "PAGINATION": { - "RESULTS": "Showing {start} to {end} of {total} results" + "RESULTS": "Showing {start} to {end} of {total} results", + "PER_PAGE_TEMPLATE": "{size} / page" } }, "AGENT_REPORTS": { diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/overview/AgentTable.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/overview/AgentTable.vue index 42ca08582..483ea914d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/overview/AgentTable.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/overview/AgentTable.vue @@ -7,6 +7,7 @@ import { getPaginationRowModel, } from '@tanstack/vue-table'; import { useI18n } from 'vue-i18n'; +import { useUISettings } from 'dashboard/composables/useUISettings'; import Spinner from 'shared/components/Spinner.vue'; import EmptyState from 'dashboard/components/widgets/EmptyState.vue'; @@ -30,6 +31,19 @@ const { agents, agentMetrics } = defineProps({ }); const { t } = useI18n(); +const { uiSettings, updateUISettings } = useUISettings(); + +// UI Settings key for agent table page size +const AGENT_TABLE_PAGE_SIZE_KEY = 'report_overview_agent_table_page_size'; + +// Get the saved page size from UI settings or default to 10 +const getPageSize = () => { + return uiSettings.value[AGENT_TABLE_PAGE_SIZE_KEY] || 10; +}; + +const handlePageSizeChange = pageSize => { + updateUISettings({ [AGENT_TABLE_PAGE_SIZE_KEY]: pageSize }); +}; const getAgentMetrics = id => agentMetrics.find(metrics => metrics.assignee_id === Number(id)) || {}; @@ -98,13 +112,24 @@ const table = useVueTable({ enableSorting: false, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), + initialState: { + pagination: { + pageSize: getPageSize(), + }, + }, }); - + { + return uiSettings.value[TEAM_TABLE_PAGE_SIZE_KEY] || 10; +}; + +const handlePageSizeChange = pageSize => { + updateUISettings({ [TEAM_TABLE_PAGE_SIZE_KEY]: pageSize }); +}; const getTeamMetrics = id => teamMetrics.find(metrics => metrics.team_id === Number(id)) || {}; @@ -92,13 +106,24 @@ const table = useVueTable({ enableSorting: false, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), + initialState: { + pagination: { + pageSize: getPageSize(), + }, + }, }); - +
- {{ $t('REPORT.PAGINATION.RESULTS', { start, end, total }) }} -
+ {{ $t('REPORT.PAGINATION.RESULTS', { start, end, total }) }} +