From dd65e4af091b37ca2c1378108a36d02c1f429ff0 Mon Sep 17 00:00:00 2001 From: Xavier Carron <33637571+xav-car@users.noreply.github.com> Date: Tue, 24 Dec 2024 14:07:30 +0100 Subject: [PATCH] refactor(orga): use PixPagination when possible --- .../campaign/activity/participants-list.gjs | 21 +++++++++++++++++-- .../campaign/results/assessment-list.gjs | 20 ++++++++++++++++-- .../campaign/results/profile-list.gjs | 16 ++++++++++++-- .../app/components/mission/activity-table.gjs | 21 ++++++++++++++++--- orga/app/components/mission/result-table.gjs | 20 ++++++++++++++++-- orga/app/components/statistics/index.gjs | 16 +++++++++++++- orga/app/components/team/members-list.hbs | 2 +- orga/app/components/team/members-list.js | 14 +++++++++++++ .../styles/components/pagination-control.scss | 1 - orga/app/styles/globals/panels.scss | 1 + 10 files changed, 118 insertions(+), 14 deletions(-) diff --git a/orga/app/components/campaign/activity/participants-list.gjs b/orga/app/components/campaign/activity/participants-list.gjs index 740be59c98c..e69af7554a5 100644 --- a/orga/app/components/campaign/activity/participants-list.gjs +++ b/orga/app/components/campaign/activity/participants-list.gjs @@ -1,4 +1,5 @@ import PixIconButton from '@1024pix/pix-ui/components/pix-icon-button'; +import PixPagination from '@1024pix/pix-ui/components/pix-pagination'; import { array, fn } from '@ember/helper'; import { on } from '@ember/modifier'; import { action } from '@ember/object'; @@ -9,7 +10,6 @@ import { tracked } from '@glimmer/tracking'; import { t } from 'ember-intl'; import TableHeader from '../../table/header'; -import PaginationControl from '../../table/pagination-control'; import ParticipationStatus from '../../ui/participation-status'; import ParticipationFilters from '../filter/participation-filters'; import DeleteParticipationModal from './delete-participation-modal'; @@ -23,10 +23,23 @@ export default class ParticipantsList extends Component { @tracked isModalOpen = false; @tracked participationToDelete; + get currentLocale() { + return this.intl.primaryLocale; + } + get canDeleteParticipation() { return this.currentUser.isAdminInOrganization || this.args.campaign.ownerId == this.currentUser.prescriber?.id; } + get pageOptions() { + return [ + { label: '10', value: 10 }, + { label: '25', value: 25 }, + { label: '50', value: 50 }, + { label: '100', value: 100 }, + ]; + } + @action openModal(participation, event) { event.stopPropagation(); @@ -165,7 +178,11 @@ export default class ParticipantsList extends Component { {{#if @participations}} - + {{/if}}

{{t "pages.campaign-results.table.title"}}

@@ -87,7 +97,13 @@ import EvolutionHeader from './evolution-header'; {{#if @participations}} - + {{#let (getService "service:intl") as |intl|}} + + {{/let}} {{/if}}
diff --git a/orga/app/components/campaign/results/profile-list.gjs b/orga/app/components/campaign/results/profile-list.gjs index e8e61a81390..31ea350efc1 100644 --- a/orga/app/components/campaign/results/profile-list.gjs +++ b/orga/app/components/campaign/results/profile-list.gjs @@ -1,3 +1,4 @@ +import PixPagination from '@1024pix/pix-ui/components/pix-pagination'; import PixTag from '@1024pix/pix-ui/components/pix-tag'; import { array, fn } from '@ember/helper'; import { on } from '@ember/modifier'; @@ -6,12 +7,21 @@ import dayjsFormat from 'ember-dayjs/helpers/dayjs-format'; import { t } from 'ember-intl'; import { gt } from 'ember-truth-helpers'; +import getService from '../../../helpers/get-service.js'; import TableHeader from '../../table/header'; -import TablePaginationControl from '../../table/pagination-control'; import CampaignParticipationFilters from '../filter/participation-filters'; import EvolutionHeader from './evolution-header'; import ParticipationEvolutionIcon from './participation-evolution-icon'; +function pageOptions() { + return [ + { label: '10', value: 10 }, + { label: '25', value: 25 }, + { label: '50', value: 50 }, + { label: '100', value: 100 }, + ]; +} + diff --git a/orga/app/components/mission/activity-table.gjs b/orga/app/components/mission/activity-table.gjs index 027bca4f5a3..4f28e4692f8 100644 --- a/orga/app/components/mission/activity-table.gjs +++ b/orga/app/components/mission/activity-table.gjs @@ -1,9 +1,9 @@ +import PixPagination from '@1024pix/pix-ui/components/pix-pagination'; import PixTag from '@1024pix/pix-ui/components/pix-tag'; import { t } from 'ember-intl'; +import getService from '../../helpers/get-service.js'; import Header from '../table/header'; -import PaginationControl from '../table/pagination-control'; - function statusColor(status) { return { 'not-started': 'tertiary', @@ -12,6 +12,15 @@ function statusColor(status) { }[status]; } +function pageOptions() { + return [ + { label: '10', value: 10 }, + { label: '25', value: 25 }, + { label: '50', value: 50 }, + { label: '100', value: 100 }, + ]; +} +