Skip to content

Commit e8a799a

Browse files
authored
✨admin: use PixTable on complementary certification history table
1 parent 2ffe1e0 commit e8a799a

File tree

4 files changed

+59
-37
lines changed

4 files changed

+59
-37
lines changed
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>

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

admin/translations/en.json

+8
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@
312312
"name": "Nom du badge certifié"
313313
},
314314
"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"
315323
}
316324
},
317325
"title": "Toutes les certifications complémentaires"

admin/translations/fr.json

+8
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@
320320
"name": "Nom du badge certifié"
321321
},
322322
"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"
323331
}
324332
},
325333
"title": "Toutes les certifications complémentaires"

0 commit comments

Comments
 (0)