Skip to content

Commit

Permalink
[TECH] PixAdmin - Composants Certifications sous gjs (PIX-13892)
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge committed Aug 21, 2024
2 parents 2b744a9 + bb7a3f5 commit 6077b1d
Show file tree
Hide file tree
Showing 53 changed files with 1,673 additions and 1,611 deletions.
91 changes: 91 additions & 0 deletions admin/app/components/certifications/certification/comments.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import PixButton from '@1024pix/pix-ui/components/pix-button';
import PixTextarea from '@1024pix/pix-ui/components/pix-textarea';
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import pick from 'ember-composable-helpers/helpers/pick';
import set from 'ember-set-helper/helpers/set';

import CertificationInfoField from '../info-field';

export default class Comments extends Component {
@tracked isEditingJuryComment = false;
@tracked commentByJury;

@action
editJuryComment() {
this.isEditingJuryComment = true;
}

@action
async saveJuryComment() {
const hasBeenSaved = await this.args.onJuryCommentSave(this.commentByJury);
if (hasBeenSaved) {
this.cancelJuryCommentEdition();
}
}

@action
cancelJuryCommentEdition() {
this.isEditingJuryComment = false;
}

<template>
<div class="certification-informations__row">
<div class="certification-informations__card">
<h2 class="certification-informations__card__title">Commentaires jury</h2>
<CertificationInfoField
@value={{@certification.commentForCandidate}}
@edition={{false}}
@label="Pour le candidat :"
@fieldId="certification-commentForCandidate"
/>
<CertificationInfoField
@value={{@certification.commentForOrganization}}
@edition={{false}}
@label="Pour l'organisation :"
@fieldId="certification-commentForOrganization"
/>
<div class="certification-info-field">
{{#if this.isEditingJuryComment}}
<label for="certification-commentByJury" class="certification-info-field__label">
Notes internes Jury Pix :
</label>
<PixTextarea
id="certification-commentByJury"
@value={{@certification.commentByJury}}
class="form-control"
{{on "input" (pick "target.value" (set this "commentByJury"))}}
/>
{{else}}
<p>Notes internes Jury Pix :</p>
<p>
{{if @certification.commentByJury @certification.commentByJury " - "}}
</p>
{{/if}}
</div>
<CertificationInfoField @value={{@certification.juryId}} @edition={{false}} @label="Identifiant jury :" />

{{#if this.isEditingJuryComment}}
<ul class="certification-information-comments">
<li>
<PixButton @size="small" @variant="secondary" @triggerAction={{this.cancelJuryCommentEdition}}>
Annuler
</PixButton>
</li>
<li>
<PixButton @size="small" @triggerAction={{this.saveJuryComment}}>
Enregistrer
</PixButton>
</li>
</ul>
{{else}}
<PixButton @size="small" @triggerAction={{this.editJuryComment}}>
Modifier le commentaire jury
</PixButton>
{{/if}}
</div>
</div>
</template>
}
55 changes: 0 additions & 55 deletions admin/app/components/certifications/certification/comments.hbs

This file was deleted.

26 changes: 0 additions & 26 deletions admin/app/components/certifications/certification/comments.js

This file was deleted.

31 changes: 31 additions & 0 deletions admin/app/components/certifications/certification/details-v2.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Card from '../../card';
import CertificationDetailsCompetence from '../details-competence';

<template>
<div class="certification-details-v2">
<div>
<div>
<Card>
<div class="certification-details-v2__info">
<div>Statut :</div>
<div>{{@details.status}}</div>

<div>Créé le :</div>
<div>{{@details.creationDate}}</div>

<div>Terminée le :</div>
<div>{{@details.completionDate}}</div>

<div>Score :</div>
<div class="certificate">{{@details.totalScore}}</div>
<div>Taux de reproductibilité :</div>
<div class="certificate">{{@details.percentageCorrectAnswers}}</div>
</div>
</Card>
</div>
{{#each @details.competences as |competence|}}
<CertificationDetailsCompetence @competence={{competence}} @rate={{@details.percentageCorrectAnswers}} />
{{/each}}
</div>
</div>
</template>
26 changes: 0 additions & 26 deletions admin/app/components/certifications/certification/details-v2.hbs

This file was deleted.

Loading

0 comments on commit 6077b1d

Please sign in to comment.