-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Corrige la réactivité des boutons de publication dans Pix Ad…
- Loading branch information
Showing
18 changed files
with
572 additions
and
409 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import PixButton from '@1024pix/pix-ui/components/pix-button'; | ||
import PixTooltip from '@1024pix/pix-ui/components/pix-tooltip'; | ||
import { action } from '@ember/object'; | ||
import { service } from '@ember/service'; | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { not } from 'ember-truth-helpers'; | ||
|
||
import ConfirmPopup from '../../confirm-popup'; | ||
|
||
export default class CertificationsHeader extends Component { | ||
@service accessControl; | ||
|
||
@tracked isModalDisplayed = false; | ||
@tracked confirmMessage = null; | ||
|
||
get canPublish() { | ||
return ( | ||
!this.args.juryCertificationSummaries.some( | ||
(certification) => certification.status === 'error' && !certification.isCancelled, | ||
) && this.args.session.isFinalized | ||
); | ||
} | ||
|
||
@action | ||
displayConfirmationModal() { | ||
this.confirmMessage = this.args.session.isPublished | ||
? 'Souhaitez-vous dépublier la session ?' | ||
: 'Souhaitez-vous publier la session ?'; | ||
this.isModalDisplayed = true; | ||
} | ||
|
||
@action | ||
onModalCancel() { | ||
this.isModalDisplayed = false; | ||
} | ||
|
||
@action | ||
async toggleSessionPublication() { | ||
if (this.args.session.isPublished) { | ||
await this.args.unpublishSession(); | ||
} else { | ||
await this.args.publishSession(); | ||
} | ||
this.isModalDisplayed = false; | ||
} | ||
|
||
<template> | ||
<header class="certification-list-page__header"> | ||
<h2>Certifications</h2> | ||
{{#if this.accessControl.hasAccessToCertificationActionsScope}} | ||
<div class="btn-group" role="group"> | ||
|
||
{{#if @session.isPublished}} | ||
<PixButton @triggerAction={{this.displayConfirmationModal}}>Dépublier la session</PixButton> | ||
{{else}} | ||
<PixTooltip @position="left" @isWide={{true}} @hide={{this.canPublish}}> | ||
<:triggerElement> | ||
<PixButton @triggerAction={{this.displayConfirmationModal}} @isDisabled={{not this.canPublish}}> | ||
Publier la session | ||
</PixButton> | ||
</:triggerElement> | ||
<:tooltip> | ||
Vous ne pouvez pas publier la session tant qu'elle n'est pas finalisée ou qu'il reste des certifications | ||
en erreur. | ||
</:tooltip> | ||
</PixTooltip> | ||
{{/if}} | ||
</div> | ||
{{/if}} | ||
</header> | ||
|
||
<ConfirmPopup | ||
@message={{this.confirmMessage}} | ||
@confirm={{this.toggleSessionPublication}} | ||
@cancel={{this.onModalCancel}} | ||
@show={{this.isModalDisplayed}} | ||
/> | ||
</template> | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import PixPagination from '@1024pix/pix-ui/components/pix-pagination'; | ||
import { LinkTo } from '@ember/routing'; | ||
import Component from '@glimmer/component'; | ||
|
||
import CertificationInfoPublished from './info-published'; | ||
import CertificationStatus from './status'; | ||
|
||
export default class CertificationsHeader extends Component { | ||
get sortedCertificationJurySummaries() { | ||
return this.args.juryCertificationSummaries.sortBy('numberOfCertificationIssueReportsWithRequiredAction').reverse(); | ||
} | ||
|
||
<template> | ||
<div class="table-admin"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th class="table__column table__column--id">ID</th> | ||
<th>Prénom</th> | ||
<th>Nom</th> | ||
<th>Statut</th> | ||
<th>Signalements impactants non résolus</th> | ||
{{#if @displayHasSeenEndTestScreenColumn}} | ||
<th>Ecran de fin de test vu</th> | ||
{{/if}} | ||
<th>Autre certification</th> | ||
<th>Score</th> | ||
<th>Début</th> | ||
<th>Fin</th> | ||
<th>Publiée</th> | ||
</tr> | ||
</thead> | ||
|
||
{{#if @juryCertificationSummaries}} | ||
<tbody> | ||
{{#each this.sortedCertificationJurySummaries as |certification|}} | ||
<tr aria-label="Certifications de {{certification.firstName certification.LastName}}"> | ||
<td class="table__column table__column--id"> | ||
<LinkTo @route="authenticated.certifications.certification.informations" @model={{certification.id}}> | ||
{{certification.id}} | ||
</LinkTo> | ||
</td> | ||
<td>{{certification.firstName}}</td> | ||
<td>{{certification.lastName}}</td> | ||
<td> | ||
<CertificationStatus @record={{certification}} /> | ||
</td> | ||
<td | ||
class="certification-list-page__cell--important" | ||
>{{certification.numberOfCertificationIssueReportsWithRequiredActionLabel}}</td> | ||
{{#if @displayHasSeenEndTestScreenColumn}} | ||
<td class="certification-list-page__cell--important">{{certification.hasSeenEndTestScreenLabel}}</td> | ||
{{/if}} | ||
<td>{{certification.complementaryCertificationTakenLabel}}</td> | ||
<td>{{certification.pixScore}}</td> | ||
<td>{{certification.creationDate}}</td> | ||
<td>{{certification.completionDate}}</td> | ||
<td> | ||
<CertificationInfoPublished @record={{certification}} /> | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
{{/if}} | ||
</table> | ||
</div> | ||
|
||
{{#if @juryCertificationSummaries}} | ||
<PixPagination @pagination={{@pagination}} /> | ||
{{/if}} | ||
</template> | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.