|
1 | 1 | import PixButton from '@1024pix/pix-ui/components/pix-button';
|
| 2 | +import PixTable from '@1024pix/pix-ui/components/pix-table'; |
| 3 | +import PixTableColumn from '@1024pix/pix-ui/components/pix-table-column'; |
2 | 4 | import { fn } from '@ember/helper';
|
3 | 5 | import { action } from '@ember/object';
|
4 | 6 | import { LinkTo } from '@ember/routing';
|
5 | 7 | import { service } from '@ember/service';
|
6 | 8 | import Component from '@glimmer/component';
|
7 | 9 | import { tracked } from '@glimmer/tracking';
|
8 | 10 | import dayjsFormat from 'ember-dayjs/helpers/dayjs-format';
|
| 11 | +import { t } from 'ember-intl'; |
9 | 12 |
|
10 | 13 | import ConfirmPopup from '../confirm-popup';
|
11 | 14 |
|
@@ -38,69 +41,102 @@ export default class CampaignParticipation extends Component {
|
38 | 41 | Attention toute modification sur une participation nécessite un accord écrit du prescripteur et du prescrit.
|
39 | 42 | </p>
|
40 | 43 |
|
41 |
| - <div class="content-text content-text--small"> |
42 |
| - <table class="table-admin"> |
43 |
| - <thead> |
44 |
| - <tr> |
45 |
| - <th>Prescrit</th> |
46 |
| - <th>Campagne</th> |
47 |
| - <th>Identifiant externe</th> |
48 |
| - <th>Date de début</th> |
49 |
| - <th>Statut</th> |
50 |
| - <th>Date d'envoi</th> |
51 |
| - <th>Supprimé le</th> |
52 |
| - {{#if this.accessControl.hasAccessToUsersActionsScope}} |
53 |
| - <th>Actions</th> |
54 |
| - {{/if}} |
55 |
| - </tr> |
56 |
| - </thead> |
57 |
| - <tbody> |
58 |
| - {{#each @participations as |participation|}} |
59 |
| - <tr aria-label="Participation"> |
60 |
| - <td>{{participation.organizationLearnerFullName}}</td> |
61 |
| - <td> |
62 |
| - <LinkTo @route="authenticated.campaigns.campaign" @model={{participation.campaignId}}> |
63 |
| - {{participation.campaignCode}} |
64 |
| - </LinkTo> |
65 |
| - </td> |
| 44 | + {{#if @participations}} |
| 45 | + <PixTable |
| 46 | + @variant="primary" |
| 47 | + @data={{@participations}} |
| 48 | + @caption={{t "components.users.campaign-participations.table.caption"}} |
| 49 | + > |
| 50 | + <:columns as |participation context|> |
| 51 | + <PixTableColumn @context={{context}} class="break-word"> |
| 52 | + <:header> |
| 53 | + Prescrit |
| 54 | + </:header> |
| 55 | + <:cell> |
| 56 | + {{participation.organizationLearnerFullName}} |
| 57 | + </:cell> |
| 58 | + </PixTableColumn> |
| 59 | + <PixTableColumn @context={{context}} class="break-word"> |
| 60 | + <:header> |
| 61 | + Campagne |
| 62 | + </:header> |
| 63 | + <:cell> |
| 64 | + <LinkTo @route="authenticated.campaigns.campaign" @model={{participation.campaignId}}> |
| 65 | + {{participation.campaignCode}} |
| 66 | + </LinkTo> |
| 67 | + </:cell> |
| 68 | + </PixTableColumn> |
| 69 | + <PixTableColumn @context={{context}} class="break-word"> |
| 70 | + <:header> |
| 71 | + Identifiant externe |
| 72 | + </:header> |
| 73 | + <:cell> |
66 | 74 | {{#if participation.participantExternalId}}
|
67 |
| - <td>{{participation.participantExternalId}}</td> |
| 75 | + {{participation.participantExternalId}} |
68 | 76 | {{else}}
|
69 |
| - <td>-</td> |
| 77 | + - |
70 | 78 | {{/if}}
|
71 |
| - <td>{{dayjsFormat participation.createdAt "DD/MM/YYYY"}}</td> |
72 |
| - <td>{{participation.displayedStatus}}</td> |
73 |
| - <td> |
74 |
| - {{if participation.sharedAt (dayjsFormat participation.sharedAt "DD/MM/YYYY") "-"}} |
75 |
| - </td> |
| 79 | + </:cell> |
| 80 | + </PixTableColumn> |
| 81 | + <PixTableColumn @context={{context}}> |
| 82 | + <:header> |
| 83 | + Date de début |
| 84 | + </:header> |
| 85 | + <:cell> |
| 86 | + {{dayjsFormat participation.createdAt "DD/MM/YYYY"}} |
| 87 | + </:cell> |
| 88 | + </PixTableColumn> |
| 89 | + <PixTableColumn @context={{context}}> |
| 90 | + <:header> |
| 91 | + Statut |
| 92 | + </:header> |
| 93 | + <:cell> |
| 94 | + {{participation.displayedStatus}} |
| 95 | + </:cell> |
| 96 | + </PixTableColumn> |
| 97 | + <PixTableColumn @context={{context}}> |
| 98 | + <:header> |
| 99 | + Date d'envoi |
| 100 | + </:header> |
| 101 | + <:cell> |
| 102 | + {{if participation.sharedAt (dayjsFormat participation.sharedAt "DD/MM/YYYY") "-"}} |
| 103 | + </:cell> |
| 104 | + </PixTableColumn> |
| 105 | + <PixTableColumn @context={{context}}> |
| 106 | + <:header> |
| 107 | + Supprimé le |
| 108 | + </:header> |
| 109 | + <:cell> |
76 | 110 | {{#if participation.deletedAt}}
|
77 |
| - <td> |
78 |
| - {{dayjsFormat participation.deletedAt "DD/MM/YYYY"}} |
79 |
| - </td> |
| 111 | + {{dayjsFormat participation.deletedAt "DD/MM/YYYY"}} |
80 | 112 | {{else}}
|
81 |
| - <td>-</td> |
| 113 | + - |
82 | 114 | {{/if}}
|
83 |
| - {{#if this.accessControl.hasAccessToUsersActionsScope}} |
84 |
| - <td> |
85 |
| - {{#unless participation.deletedAt}} |
86 |
| - <PixButton |
87 |
| - @triggerAction={{fn this.toggleDisplayRemoveParticipationModal participation}} |
88 |
| - @size="small" |
89 |
| - @variant="error" |
90 |
| - > |
91 |
| - Supprimer |
92 |
| - </PixButton> |
93 |
| - {{/unless}} |
94 |
| - </td> |
95 |
| - {{/if}} |
96 |
| - </tr> |
97 |
| - {{/each}} |
98 |
| - </tbody> |
99 |
| - </table> |
100 |
| - {{#unless @participations}} |
101 |
| - <div class="table__empty">Aucune participation</div> |
102 |
| - {{/unless}} |
103 |
| - </div> |
| 115 | + </:cell> |
| 116 | + </PixTableColumn> |
| 117 | + {{#if this.accessControl.hasAccessToUsersActionsScope}} |
| 118 | + <PixTableColumn @context={{context}}> |
| 119 | + <:header> |
| 120 | + Actions |
| 121 | + </:header> |
| 122 | + <:cell> |
| 123 | + {{#unless participation.deletedAt}} |
| 124 | + <PixButton |
| 125 | + @triggerAction={{fn this.toggleDisplayRemoveParticipationModal participation}} |
| 126 | + @size="small" |
| 127 | + @variant="error" |
| 128 | + > |
| 129 | + Supprimer |
| 130 | + </PixButton> |
| 131 | + {{/unless}} |
| 132 | + </:cell> |
| 133 | + </PixTableColumn> |
| 134 | + {{/if}} |
| 135 | + </:columns> |
| 136 | + </PixTable> |
| 137 | + {{else}} |
| 138 | + <div class="table__empty">Aucune participation</div> |
| 139 | + {{/if}} |
104 | 140 |
|
105 | 141 | <ConfirmPopup
|
106 | 142 | @message="Vous êtes sur le point de supprimer la ou les participation(s) de {{this.participationToDelete.organizationLearnerFullName}} (y compris celles améliorées), celle-ci ne sera plus visible ni comprise dans les statistiques de la campagne de Pix Orga. Le participant pourra terminer son parcours mais ne pourra plus envoyer ses résultats. Il ne pourra pas non plus participer de nouveau à cette campagne."
|
|
0 commit comments