Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yaf committed Dec 16, 2024
1 parent 4cbf727 commit ac495a9
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 35 deletions.
51 changes: 51 additions & 0 deletions admin/app/components/certifications/header.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import PixButton from '@1024pix/pix-ui/components/pix-button';
import PixTooltip from '@1024pix/pix-ui/components/pix-tooltip';
import { service } from '@ember/service';

export default class CertificationsHeader extends Component {
@service accessControl;

get canPublish() {
return (
!this.args.juryCertificationSummaries.some(
(certification) => certification.status === 'error' && !certification.isCancelled,
) && this.args.session.isFinalized
);
}

<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.displayCertificationStatusUpdateConfirmationModal}}>Dépublier la session</PixButton>
{{else}}

{{#if this.canPublish}}
<PixButton @triggerAction={{this.displayCertificationStatusUpdateConfirmationModal}}>Publier la session</PixButton>
{{else}}

<PixTooltip @position="left" @isWide={{true}}>
<:triggerElement>
<PixButton
@triggerAction={{this.displayCertificationStatusUpdateConfirmationModal}}
@isDisabled={{true}}
>
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}}

{{/if}}
</div>
{{/if}}
</header>
</template>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,11 @@
<section>
<div class="certification-list-page">

<header class="certification-list-page__header">
<h2>Certifications</h2>
{{#if this.accessControl.hasAccessToCertificationActionsScope}}
<div class="btn-group" role="group">

{{#if this.model.session.isPublished}}
<PixButton @triggerAction={{this.displayCertificationStatusUpdateConfirmationModal}}>Dépublier la session</PixButton>
{{else}}

{{#if this.canPublish}}
<PixButton @triggerAction={{this.displayCertificationStatusUpdateConfirmationModal}}>Publier la session</PixButton>
{{else}}

<PixTooltip @position="left" @isWide={{true}}>
<:triggerElement>
<PixButton
@triggerAction={{this.displayCertificationStatusUpdateConfirmationModal}}
@isDisabled={{true}}
>
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}}

{{/if}}
</div>
{{/if}}
</header>

<Certifications::Header
@session={{this.model.session}}
@juryCertificationSummaries={{this.model.juryCertificationSummaries}}
/>

<div>
<Certifications::List
@certifications={{this.sortedCertificationJurySummaries}}
Expand All @@ -52,4 +23,4 @@
@confirm={{action this.toggleSessionPublication}}
@cancel={{action this.onCancelConfirm}}
@show={{this.displayConfirm}}
/>
/>

0 comments on commit ac495a9

Please sign in to comment.