Skip to content

Commit 4bb64dd

Browse files
authoredFeb 17, 2025
[FEATURE] Ajouter PixTable dans les certifications complémentaires sur Pix Admin (PIX-16588)
#11429
2 parents a50a7d2 + e8a799a commit 4bb64dd

File tree

8 files changed

+158
-118
lines changed

8 files changed

+158
-118
lines changed
 
+25-28
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1+
import PixTable from '@1024pix/pix-ui/components/pix-table';
2+
import PixTableColumn from '@1024pix/pix-ui/components/pix-table-column';
13
import { LinkTo } from '@ember/routing';
24
import Component from '@glimmer/component';
5+
import { t } from 'ember-intl';
36

47
export default class List extends Component {
58
get sortedComplementaryCertifications() {
69
return this.args.complementaryCertifications.sortBy('label');
710
}
811

912
<template>
10-
<div class="content-text content-text--small">
11-
<div class="table-admin">
12-
<table>
13-
<thead>
14-
<tr>
15-
<th class="table__column--id">ID</th>
16-
<th>Nom</th>
17-
</tr>
18-
</thead>
19-
20-
<tbody>
21-
{{#each this.sortedComplementaryCertifications as |complementaryCertification|}}
22-
<tr>
23-
<td class="table__column--id">{{complementaryCertification.id}}</td>
24-
<td>
25-
<LinkTo
26-
@route="authenticated.complementary-certifications.complementary-certification"
27-
@model={{complementaryCertification.id}}
28-
>
29-
{{complementaryCertification.label}}
30-
</LinkTo>
31-
</td>
32-
</tr>
33-
{{/each}}
34-
</tbody>
35-
</table>
36-
</div>
37-
</div>
13+
<PixTable @data={{this.sortedComplementaryCertifications}}>
14+
<:columns as |row sortedComplementaryCertification|>
15+
<PixTableColumn @context={{sortedComplementaryCertification}} class="table__column--medium">
16+
<:header>
17+
{{t "components.complementary-certifications.list.id"}}
18+
</:header>
19+
<:cell>
20+
{{row.id}}
21+
</:cell>
22+
</PixTableColumn>
23+
<PixTableColumn @context={{sortedComplementaryCertification}}>
24+
<:header>
25+
{{t "components.complementary-certifications.list.name"}}
26+
</:header>
27+
<:cell>
28+
<LinkTo @route="authenticated.complementary-certifications.complementary-certification" @model={{row.id}}>
29+
{{row.label}}
30+
</LinkTo>
31+
</:cell>
32+
</PixTableColumn>
33+
</:columns>
34+
</PixTable>
3835
</template>
3936
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import PixTable from '@1024pix/pix-ui/components/pix-table';
2+
import PixTableColumn from '@1024pix/pix-ui/components/pix-table-column';
13
import { array } from '@ember/helper';
24
import { LinkTo } from '@ember/routing';
35
import Component from '@glimmer/component';
@@ -14,54 +16,63 @@ export default class BadgesList extends Component {
1416

1517
<template>
1618
<section class="page-section">
17-
<div class="content-text content-text--small">
18-
<h2 class="complementary-certification-details__badges-title">
19-
{{t "components.complementary-certifications.target-profiles.badges-list.title"}}
20-
</h2>
21-
<div class="table-admin">
22-
<table>
23-
<thead>
24-
<tr>
25-
<th>{{t "components.complementary-certifications.target-profiles.badges-list.header.image-url"}}</th>
26-
<th class="complementary-certification-details-table__complementary-certification-badge-name">
27-
{{t "components.complementary-certifications.target-profiles.badges-list.header.name"}}
28-
</th>
29-
<th>{{t "components.complementary-certifications.target-profiles.badges-list.header.level"}}</th>
30-
<th>
31-
{{t "components.complementary-certifications.target-profiles.badges-list.header.minimum-earned-pix"}}
32-
</th>
33-
<th>{{t "components.complementary-certifications.target-profiles.badges-list.header.id"}}</th>
34-
</tr>
35-
</thead>
36-
37-
<tbody>
38-
{{#each this.currentTargetProfileBadges as |badge|}}
39-
<tr>
40-
<td>
41-
<img
42-
class="complementary-certification-details-table__complementary-certification-badge-image-url"
43-
src={{badge.imageUrl}}
44-
alt="{{badge.label}}"
45-
/>
46-
</td>
47-
<td>{{badge.label}}</td>
48-
<td>{{badge.level}}</td>
49-
<td>{{this.getMinimumEarnedPixValue badge.minimumEarnedPix}}</td>
50-
<td>
51-
<LinkTo
52-
@route="authenticated.target-profiles.target-profile.badges.badge"
53-
@models={{array @currentTargetProfile.id badge.id}}
54-
target="_blank"
55-
>
56-
{{badge.id}}
57-
</LinkTo>
58-
</td>
59-
</tr>
60-
{{/each}}
61-
</tbody>
62-
</table>
63-
</div>
64-
</div>
19+
<h2 class="complementary-certification-details__badges-title">
20+
{{t "components.complementary-certifications.target-profiles.badges-list.title"}}
21+
</h2>
22+
<PixTable @data={{this.currentTargetProfileBadges}}>
23+
<:columns as |row currentTargetProfileBadge|>
24+
<PixTableColumn @context={{currentTargetProfileBadge}}>
25+
<:header>
26+
{{t "components.complementary-certifications.target-profiles.badges-list.header.image-url"}}
27+
</:header>
28+
<:cell>
29+
<img
30+
class="complementary-certification-details-table__complementary-certification-badge-image-url"
31+
src={{row.imageUrl}}
32+
alt="{{row.label}}"
33+
/>
34+
</:cell>
35+
</PixTableColumn>
36+
<PixTableColumn @context={{currentTargetProfileBadge}} class="table__column--wide">
37+
<:header>
38+
{{t "components.complementary-certifications.target-profiles.badges-list.header.name"}}
39+
</:header>
40+
<:cell>
41+
{{row.label}}
42+
</:cell>
43+
</PixTableColumn>
44+
<PixTableColumn @context={{currentTargetProfileBadge}}>
45+
<:header>
46+
{{t "components.complementary-certifications.target-profiles.badges-list.header.level"}}
47+
</:header>
48+
<:cell>
49+
{{row.level}}
50+
</:cell>
51+
</PixTableColumn>
52+
<PixTableColumn @context={{currentTargetProfileBadge}}>
53+
<:header>
54+
{{t "components.complementary-certifications.target-profiles.badges-list.header.minimum-earned-pix"}}
55+
</:header>
56+
<:cell>
57+
{{this.getMinimumEarnedPixValue row.minimumEarnedPix}}
58+
</:cell>
59+
</PixTableColumn>
60+
<PixTableColumn @context={{currentTargetProfileBadge}}>
61+
<:header>
62+
{{t "components.complementary-certifications.target-profiles.badges-list.header.id"}}
63+
</:header>
64+
<:cell>
65+
<LinkTo
66+
@route="authenticated.target-profiles.target-profile.badges.badge"
67+
@models={{array @currentTargetProfile.id row.id}}
68+
target="_blank"
69+
>
70+
{{row.id}}
71+
</LinkTo>
72+
</:cell>
73+
</PixTableColumn>
74+
</:columns>
75+
</PixTable>
6576
</section>
6677
</template>
6778
}
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
1+
import PixTable from '@1024pix/pix-ui/components/pix-table';
2+
import PixTableColumn from '@1024pix/pix-ui/components/pix-table-column';
13
import { LinkTo } from '@ember/routing';
24
import dayjsFormat from 'ember-dayjs/helpers/dayjs-format';
5+
import { t } from 'ember-intl';
36

47
<template>
58
<section class="page-section">
6-
<div class="content-text content-text--small">
7-
<h2 class="complementary-certification-details__history-title">
8-
Historique des profils cibles rattachés
9-
</h2>
10-
<div class="table-admin">
11-
<table>
12-
<thead>
13-
<tr>
14-
<th>Nom du profil cible</th>
15-
<th>Date de rattachement</th>
16-
<th>Date de détachement</th>
17-
</tr>
18-
</thead>
19-
<tbody>
20-
{{#each @targetProfilesHistory as |targetProfileHistory|}}
21-
<tr>
22-
<td>
23-
<LinkTo
24-
@route="authenticated.target-profiles.target-profile"
25-
@model={{targetProfileHistory.id}}
26-
class="complementary-certification-details-target-profile__link"
27-
>
28-
{{targetProfileHistory.name}}
29-
</LinkTo>
30-
</td>
31-
<td>{{dayjsFormat targetProfileHistory.attachedAt "DD/MM/YYYY"}}</td>
32-
<td>
33-
{{if targetProfileHistory.detachedAt (dayjsFormat targetProfileHistory.detachedAt "DD/MM/YYYY") "-"}}
34-
</td>
35-
</tr>
36-
{{/each}}
37-
</tbody>
38-
</table>
39-
</div>
40-
</div>
9+
<h2 class="complementary-certification-details__history-title">
10+
{{t "components.complementary-certifications.target-profiles.history-list.title"}}
11+
</h2>
12+
<PixTable @data={{@targetProfilesHistory}}>
13+
<:columns as |row targetProfileHistory|>
14+
<PixTableColumn @context={{targetProfileHistory}}>
15+
<:header>
16+
{{t "components.complementary-certifications.target-profiles.history-list.headers.name"}}
17+
</:header>
18+
<:cell>
19+
<LinkTo
20+
@route="authenticated.target-profiles.target-profile"
21+
@model={{row.id}}
22+
class="complementary-certification-details-target-profile__link"
23+
>
24+
{{row.name}}
25+
</LinkTo>
26+
</:cell>
27+
</PixTableColumn>
28+
<PixTableColumn @context={{targetProfileHistory}}>
29+
<:header>
30+
{{t "components.complementary-certifications.target-profiles.history-list.headers.attached-at"}}
31+
</:header>
32+
<:cell>
33+
{{dayjsFormat row.attachedAt "DD/MM/YYYY"}}
34+
</:cell>
35+
</PixTableColumn>
36+
<PixTableColumn @context={{targetProfileHistory}}>
37+
<:header>
38+
{{t "components.complementary-certifications.target-profiles.history-list.headers.detached-at"}}
39+
</:header>
40+
<:cell>
41+
{{if row.detachedAt (dayjsFormat row.detachedAt "DD/MM/YYYY") "-"}}
42+
</:cell>
43+
</PixTableColumn>
44+
</:columns>
45+
</PixTable>
4146
</section>
4247
</template>

Diff for: ‎admin/app/components/complementary-certifications/target-profiles/information.gjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export default class Information extends Component {
2828
{{#if this.isMultipleCurrentTargetProfiles}}
2929
<PixToggleButton @toggled={{@switchToggle}} @onChange={{@switchTargetProfile}} @screenReaderOnly={{true}}>
3030
<:label>Accéder aux détails des profils cibles courants</:label>
31-
<:on>Profil 1</:on>
32-
<:off>Profil 2</:off>
31+
<:viewA>Profil 1</:viewA>
32+
<:viewB>Profil 2</:viewB>
3333
</PixToggleButton>
3434
{{/if}}
3535
{{#if this.hasAccessToAttachNewTargetProfile}}

Diff for: ‎admin/app/templates/authenticated/complementary-certifications/list.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<header class="page-header">
2-
<h1>Toutes les certifications complémentaires</h1>
2+
<h1>{{t "components.complementary-certifications.title"}}</h1>
33
</header>
44

55
<main class="page-body">

Diff for: ‎admin/tests/integration/components/complementary-certifications/target-profiles/history-test.gjs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { render } from '@1024pix/ember-testing-library';
22
import dayjs from 'dayjs';
3-
import { setupRenderingTest } from 'ember-qunit';
43
import History from 'pix-admin/components/complementary-certifications/target-profiles/history';
54
import { module, test } from 'qunit';
65

6+
import setupIntlRenderingTest from '../../../../helpers/setup-intl-rendering';
7+
78
module('Integration | Component | complementary-certifications/target-profiles/history', function (hooks) {
8-
setupRenderingTest(hooks);
9+
setupIntlRenderingTest(hooks);
910

1011
test("it should display history for complementary certification's target profiles", async function (assert) {
1112
// given

Diff for: ‎admin/translations/en.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@
298298
}
299299
},
300300
"complementary-certifications": {
301+
"list": {
302+
"id": "ID",
303+
"name": "Nom"
304+
},
301305
"target-profiles": {
302306
"badges-list": {
303307
"header": {
@@ -308,8 +312,17 @@
308312
"name": "Nom du badge certifié"
309313
},
310314
"title": "Badges certifiés du profil cible actuel"
315+
},
316+
"history-list": {
317+
"headers": {
318+
"attached-at": "Date de rattachement",
319+
"detached-at": "Date de détachement",
320+
"name": "Nom du profil cible"
321+
},
322+
"title": "Historique des profils cibles rattachés"
311323
}
312-
}
324+
},
325+
"title": "Toutes les certifications complémentaires"
313326
},
314327
"layout": {
315328
"menu-bar": {

Diff for: ‎admin/translations/fr.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@
306306
}
307307
},
308308
"complementary-certifications": {
309+
"list": {
310+
"id": "ID",
311+
"name": "Nom"
312+
},
309313
"target-profiles": {
310314
"badges-list": {
311315
"header": {
@@ -316,8 +320,17 @@
316320
"name": "Nom du badge certifié"
317321
},
318322
"title": "Badges certifiés du profil cible actuel"
323+
},
324+
"history-list": {
325+
"headers": {
326+
"attached-at": "Date de rattachement",
327+
"detached-at": "Date de détachement",
328+
"name": "Nom du profil cible"
329+
},
330+
"title": "Historique des profils cibles rattachés"
319331
}
320-
}
332+
},
333+
"title": "Toutes les certifications complémentaires"
321334
},
322335
"layout": {
323336
"menu-bar": {

0 commit comments

Comments
 (0)
Failed to load comments.