Skip to content

Commit

Permalink
✨ certif: reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiaPena authored Mar 3, 2025
1 parent 9be7b8a commit c130073
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class EnrolledCandidates extends Component {
}

get caption() {
if (this.args.shouldDisplayPrescriptionScoStudentRegistrationFeature) {
if (this.args.shouldDisplayScoStudentRegistration) {
return this.intl.t('pages.sessions.detail.candidates.list.without-details-description');
}
return this.intl.t('pages.sessions.detail.candidates.list.with-details-description');
Expand Down Expand Up @@ -333,7 +333,7 @@ export default class EnrolledCandidates extends Component {
{{t 'pages.sessions.detail.candidates.list.title'}}
({{@certificationCandidates.length}})
</h3>
{{#if @shouldDisplayPrescriptionScoStudentRegistrationFeature}}
{{#if @shouldDisplayScoStudentRegistration}}
<PixButtonLink @route='authenticated.sessions.add-student' @model={{@sessionId}}>
{{t 'pages.sessions.detail.candidates.list.actions.inscription-multiple.label'}}
</PixButtonLink>
Expand Down Expand Up @@ -370,7 +370,7 @@ export default class EnrolledCandidates extends Component {
{{dayjsFormat candidate.birthdate 'DD/MM/YYYY'}}
</:cell>
</PixTableColumn>
{{#if @shouldDisplayPrescriptionScoStudentRegistrationFeature}}
{{#if @shouldDisplayScoStudentRegistration}}
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.labels.candidate.birth-city'}}
Expand All @@ -388,7 +388,7 @@ export default class EnrolledCandidates extends Component {
</:cell>
</PixTableColumn>
{{/if}}
{{#unless @shouldDisplayPrescriptionScoStudentRegistrationFeature}}
{{#unless @shouldDisplayScoStudentRegistration}}
<PixTableColumn @context={{context}} class='table__column'>
<:header>
{{t 'common.forms.certification-labels.email-results'}}
Expand Down Expand Up @@ -447,7 +447,7 @@ export default class EnrolledCandidates extends Component {
</:header>
<:cell>
<div class='certification-candidates-actions'>
{{#unless @shouldDisplayPrescriptionScoStudentRegistrationFeature}}
{{#unless @shouldDisplayScoStudentRegistration}}
<PixButton
@variant='tertiary'
@triggerAction={{fn this.openCertificationCandidateDetailsModal candidate}}
Expand Down
2 changes: 1 addition & 1 deletion certif/app/components/sessions/session-details/index.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class SessionDetails extends Component {
return this.hasOneOrMoreCandidates;
}

get shouldDisplayPrescriptionScoStudentRegistrationFeature() {
get shouldDisplayScoStudentRegistration() {
return this.currentUser.currentAllowedCertificationCenterAccess.isScoManagingStudents;
}

Expand Down
260 changes: 129 additions & 131 deletions certif/app/components/sessions/session-list.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import dayjsFormat from 'ember-dayjs/helpers/dayjs-format';
import { t } from 'ember-intl';
import { eq } from 'ember-truth-helpers';
import get from 'lodash/get';

import { CREATED, FINALIZED, PROCESSED } from '../../models/session-management';
Expand Down Expand Up @@ -91,139 +90,138 @@ export default class SessionList extends Component {
}

<template>
{{#if (eq @sessionSummaries.length 0)}}
{{#unless @sessionSummaries.length}}
<div class='table__empty content-text'>
{{t 'pages.sessions.list.table.empty'}}
</div>
{{else}}
<PixTable
@onRowClick={{@goToSessionDetails}}
@data={{@sessionSummaries}}
@variant='certif'
@caption={{t 'pages.sessions.list.table.session-caption'}}
>
<:columns as |sessionSummary context|>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.session-number'}}
</:header>
<:cell>
<LinkTo
@route='authenticated.sessions.details'
@model={{sessionSummary.id}}
aria-label='{{t "pages.sessions.list.table.row.session-and-id" sessionId=sessionSummary.id}}'
>
{{sessionSummary.id}}
</LinkTo>
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.center-name'}}
</:header>
<:cell>
{{sessionSummary.address}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.room'}}
</:header>
<:cell>
{{sessionSummary.room}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.date'}}
</:header>
<:cell>
{{dayjsFormat sessionSummary.date 'DD/MM/YYYY' allow-empty=true}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.time'}}
</:header>
<:cell>
{{dayjsFormat sessionSummary.time 'HH:mm' inputFormat='HH:mm:ss' allow-empty=true}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.invigilator'}}
</:header>
<:cell>
{{sessionSummary.examiner}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'pages.sessions.list.table.header.enrolled-candidates'}}
</:header>
<:cell>
{{sessionSummary.enrolledCandidatesCount}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'pages.sessions.list.table.header.effective-candidates'}}
</:header>
<:cell>
{{sessionSummary.effectiveCandidatesCount}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.status'}}
</:header>
<:cell>
{{this.statusLabel sessionSummary.status}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
<span class='screen-reader-only'>
{{t 'pages.sessions.list.table.header.actions'}}
</span>
</:header>
<:cell>
{{#if sessionSummary.hasEffectiveCandidates}}
<PixTooltip @position='left' @isInline={{true}} @id='tooltip-delete-session-button'>
<:triggerElement>
<PixIconButton
@iconName='delete'
@plainIcon={{true}}
@ariaLabel={{t
'pages.sessions.list.actions.delete-session.label'
sessionSummaryId=sessionSummary.id
}}
disabled={{true}}
aria-describedby='tooltip-delete-session-button'
@withBackground={{true}}
/>
</:triggerElement>
<:tooltip>{{t 'pages.sessions.list.actions.delete-session.disabled'}}</:tooltip>
</PixTooltip>
{{else}}
<PixIconButton
@iconName='delete'
@plainIcon={{true}}
@ariaLabel={{t 'pages.sessions.list.actions.delete-session.label' sessionSummaryId=sessionSummary.id}}
disabled={{false}}
@withBackground={{true}}
@triggerAction={{fn
this.openSessionDeletionConfirmModal
sessionSummary.id
sessionSummary.enrolledCandidatesCount
}}
/>
{{/if}}
</:cell>
</PixTableColumn>
</:columns>
</PixTable>
{{/if}}
{{/unless}}
<PixTable
@onRowClick={{@goToSessionDetails}}
@data={{@sessionSummaries}}
@variant='certif'
@caption={{t 'pages.sessions.list.table.session-caption'}}
>
<:columns as |sessionSummary context|>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.session-number'}}
</:header>
<:cell>
<LinkTo
@route='authenticated.sessions.details'
@model={{sessionSummary.id}}
aria-label='{{t "pages.sessions.list.table.row.session-and-id" sessionId=sessionSummary.id}}'
>
{{sessionSummary.id}}
</LinkTo>
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.center-name'}}
</:header>
<:cell>
{{sessionSummary.address}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.room'}}
</:header>
<:cell>
{{sessionSummary.room}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.date'}}
</:header>
<:cell>
{{dayjsFormat sessionSummary.date 'DD/MM/YYYY' allow-empty=true}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'common.forms.session-labels.time'}}
</:header>
<:cell>
{{dayjsFormat sessionSummary.time 'HH:mm' inputFormat='HH:mm:ss' allow-empty=true}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.invigilator'}}
</:header>
<:cell>
{{sessionSummary.examiner}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}} class='table__column--small'>
<:header>
{{t 'pages.sessions.list.table.header.enrolled-candidates'}}
</:header>
<:cell>
{{sessionSummary.enrolledCandidatesCount}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'pages.sessions.list.table.header.effective-candidates'}}
</:header>
<:cell>
{{sessionSummary.effectiveCandidatesCount}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
{{t 'common.forms.session-labels.status'}}
</:header>
<:cell>
{{this.statusLabel sessionSummary.status}}
</:cell>
</PixTableColumn>
<PixTableColumn @context={{context}}>
<:header>
<span class='screen-reader-only'>
{{t 'pages.sessions.list.table.header.actions'}}
</span>
</:header>
<:cell>
{{#if sessionSummary.hasEffectiveCandidates}}
<PixTooltip @position='left' @isInline={{true}} @id='tooltip-delete-session-button'>
<:triggerElement>
<PixIconButton
@iconName='delete'
@plainIcon={{true}}
@ariaLabel={{t
'pages.sessions.list.actions.delete-session.label'
sessionSummaryId=sessionSummary.id
}}
disabled={{true}}
aria-describedby='tooltip-delete-session-button'
@withBackground={{true}}
/>
</:triggerElement>
<:tooltip>{{t 'pages.sessions.list.actions.delete-session.disabled'}}</:tooltip>
</PixTooltip>
{{else}}
<PixIconButton
@iconName='delete'
@plainIcon={{true}}
@ariaLabel={{t 'pages.sessions.list.actions.delete-session.label' sessionSummaryId=sessionSummary.id}}
disabled={{false}}
@withBackground={{true}}
@triggerAction={{fn
this.openSessionDeletionConfirmModal
sessionSummary.id
sessionSummary.enrolledCandidatesCount
}}
/>
{{/if}}
</:cell>
</PixTableColumn>
</:columns>
</PixTable>

<PixPagination @pagination={{@sessionSummaries.meta}} @locale={{this.currentLocale}} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class CertificationCandidatesController extends Controller {
return certificationCandidatesCount > 0;
}

get shouldDisplayPrescriptionScoStudentRegistrationFeature() {
get shouldDisplayScoStudentRegistration() {
return this.currentUser.currentAllowedCertificationCenterAccess.isScoManagingStudents;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{page-title this.pageTitle replace=true}}
{{#if this.shouldDisplayPrescriptionScoStudentRegistrationFeature}}
{{#if this.shouldDisplayScoStudentRegistration}}
{{#unless this.hasOneOrMoreCandidates}}
<CertificationCandidatesSco @sessionId={{this.currentSession.id}} />
{{/unless}}
{{#if this.hasOneOrMoreCandidates}}
<Sessions::SessionDetails::EnrolledCandidates
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{this.shouldDisplayPrescriptionScoStudentRegistrationFeature}}
@shouldDisplayScoStudentRegistration={{this.shouldDisplayScoStudentRegistration}}
@sessionId={{this.currentSession.id}}
@certificationCandidates={{this.certificationCandidates}}
@reloadCertificationCandidate={{this.reloadCertificationCandidateInController}}
Expand All @@ -22,7 +22,7 @@
@fetchCandidatesImportTemplateAction={{this.fetchCandidatesImportTemplate}}
/>
<Sessions::SessionDetails::EnrolledCandidates
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{this.shouldDisplayPrescriptionScoStudentRegistrationFeature}}
@shouldDisplayScoStudentRegistration={{this.shouldDisplayScoStudentRegistration}}
@sessionId={{this.currentSession.id}}
@certificationCandidates={{this.certificationCandidates}}
@reloadCertificationCandidate={{this.reloadCertificationCandidateInController}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates
<EnrolledCandidates
@sessionId='1'
@certificationCandidates={{certificationCandidates}}
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{true}}
@shouldDisplayScoStudentRegistration={{true}}
@countries={{countries}}
/>
</template>,
Expand All @@ -486,7 +486,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates
<EnrolledCandidates
@sessionId='1'
@certificationCandidates={{certificationCandidates}}
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{true}}
@shouldDisplayScoStudentRegistration={{true}}
@countries={{countries}}
/>
</template>,
Expand All @@ -510,7 +510,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates
<EnrolledCandidates
@sessionId='1'
@certificationCandidates={{certificationCandidates}}
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{false}}
@shouldDisplayScoStudentRegistration={{false}}
@countries={{countries}}
/>
</template>,
Expand All @@ -535,7 +535,7 @@ module('Integration | Component | Sessions | SessionDetails | EnrolledCandidates
<EnrolledCandidates
@sessionId='1'
@certificationCandidates={{certificationCandidates}}
@shouldDisplayPrescriptionScoStudentRegistrationFeature={{false}}
@shouldDisplayScoStudentRegistration={{false}}
@countries={{countries}}
/>
</template>,
Expand Down
Loading

0 comments on commit c130073

Please sign in to comment.