diff --git a/orga/app/components/banner/certification.gjs b/orga/app/components/banner/certification.gjs new file mode 100644 index 00000000000..65128b2e884 --- /dev/null +++ b/orga/app/components/banner/certification.gjs @@ -0,0 +1,35 @@ +import PixBanner from '@1024pix/pix-ui/components/pix-banner'; +import { service } from '@ember/service'; +import Component from '@glimmer/component'; +import { t } from 'ember-intl'; +import ENV from 'pix-orga/config/environment'; + +export default class InformationBanner extends Component { + @service currentUser; + @service router; + @service dayjs; + + get displayCertificationBanner() { + const timeToDisplay = ENV.APP.CERTIFICATION_BANNER_DISPLAY_DATES.split(' '); + const actualMonth = this.dayjs.self().format('MM'); + return this.currentUser.isSCOManagingStudents && timeToDisplay.includes(actualMonth); + } + + get year() { + return this.dayjs.self().format('YYYY'); + } + + +} diff --git a/orga/app/components/banner/information.gjs b/orga/app/components/banner/information.gjs deleted file mode 100644 index 8cb019d5180..00000000000 --- a/orga/app/components/banner/information.gjs +++ /dev/null @@ -1,64 +0,0 @@ -import PixBanner from '@1024pix/pix-ui/components/pix-banner'; -import { service } from '@ember/service'; -import Component from '@glimmer/component'; -import { t } from 'ember-intl'; -import ENV from 'pix-orga/config/environment'; - -export default class InformationBanner extends Component { - @service currentUser; - @service router; - @service dayjs; - - get _isOnCertificationsPage() { - return this.router.currentRouteName === 'authenticated.certifications'; - } - - get displayNewYearOrganizationLearnersImportBanner() { - return ( - !this.currentUser.prescriber.areNewYearOrganizationLearnersImported && - this.currentUser.isSCOManagingStudents && - !this._isOnCertificationsPage - ); - } - - get displayCertificationBanner() { - const timeToDisplay = ENV.APP.CERTIFICATION_BANNER_DISPLAY_DATES.split(' '); - const actualMonth = this.dayjs.self().format('MM'); - return this.currentUser.isSCOManagingStudents && timeToDisplay.includes(actualMonth); - } - - get year() { - return this.dayjs.self().format('YYYY'); - } - - -} - -const NewYearBanner = ; - -const CertificationBanner = ; diff --git a/orga/app/components/banner/sco-communication.gjs b/orga/app/components/banner/sco-communication.gjs new file mode 100644 index 00000000000..6389b8b3d43 --- /dev/null +++ b/orga/app/components/banner/sco-communication.gjs @@ -0,0 +1,46 @@ +import PixBanner from '@1024pix/pix-ui/components/pix-banner'; +import { LinkTo } from '@ember/routing'; +import { service } from '@ember/service'; +import Component from '@glimmer/component'; +import { t } from 'ember-intl'; + +export default class ScommunicationBanner extends Component { + @service currentUser; + @service router; + + get shouldDisplayBanner() { + return ( + [ + 'authenticated.campaigns.list.my-campaigns', + 'authenticated.campaigns.list.all-campaigns', + 'authenticated.team.list.members', + 'authenticated.sco-organization-participants.list', + ].includes(this.router.currentRouteName) && this.currentUser.isSCOManagingStudents + ); + } + get importParticipantUrl() { + return this.router.urlFor('authenticated.import-organization-participants'); + } + + +} diff --git a/orga/app/components/banner/top-banners.gjs b/orga/app/components/banner/top-banners.gjs index 26fb573e313..28dad869cb0 100644 --- a/orga/app/components/banner/top-banners.gjs +++ b/orga/app/components/banner/top-banners.gjs @@ -1,10 +1,12 @@ -import Information from './information'; +import Certification from './certification'; import LanguageAvailability from './language-availability'; +import Scommunication from './sco-communication'; import Survey from './survey';