Skip to content

Commit

Permalink
feat: ajout du partenaire dans la previsualisation d'une aide (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlamande authored Jan 28, 2025
1 parent ecad444 commit 0b5ba8c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 44 deletions.
96 changes: 53 additions & 43 deletions src/components/pages/PagePrevisualisationAide.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
<template>
<div class="fr-container">
<div class="background--white fr-p-4w">
<ThematiqueTag
:tag="{
label: MenuThematiques.getThematiqueData(aide.thematique).labelDansLeMenu,
style: TagThematique.getTagThematiqueUtilitaire(aide.thematique),
}"
aria-hidden="true"
/>
<h1 class="fr-h1 fr-mt-2w text--gris">
{{ aide.titre }}
</h1>
<span class="fr-col-12 fr-pr-2w">
<span v-if="aide.isSimulateur || aide.montantMaximum" class="fr-grid-row">
<span
v-if="aide.isSimulateur"
class="fr-tag background-bleu-light fr-mr-1w fr-icon-money-euro-circle-line fr-tag--icon-left"
>
<span class="fr-sr-only">: </span>
Simulateur
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-8">
<div class="fr-mt-2w background--white border border-radius--md fr-p-2w">
<ThematiqueTag
:tag="{
label: MenuThematiques.getThematiqueData(aide.thematique).labelDansLeMenu,
style: TagThematique.getTagThematiqueUtilitaire(aide.thematique),
}"
aria-hidden="true"
/>
<h1 class="fr-h1 fr-mt-2w text--gris">
{{ aide.titre }}
</h1>
<span class="fr-col-12 fr-pr-2w">
<span v-if="aide.isSimulateur || aide.montantMaximum" class="fr-grid-row">
<span
v-if="aide.isSimulateur"
class="fr-tag background-bleu-light fr-mr-1w fr-icon-money-euro-circle-line fr-tag--icon-left"
>
<span class="fr-sr-only">: </span>
Simulateur
</span>
<span v-if="aide.montantMaximum" class="fr-tag">
<span class="fr-sr-only">, </span>
{{ aide.montantMaximum }}
</span>
</span>
</span>
<span v-if="aide.montantMaximum" class="fr-tag">
<span class="fr-sr-only">, </span>
{{ aide.montantMaximum }}
</span>
</span>
</span>
<div class="cms__content" v-html="aide.contenu" />
<div class="flex align-items--center gap--small">
<a
v-if="aide.urlCommencerVotreDemarche"
:href="aide.urlCommencerVotreDemarche"
class="fr-btn"
rel="noopener external"
target="_blank"
>
Commencer votre démarche
</a>
<router-link
v-if="aide.isSimulateur"
:to="{ path: aide.url }"
class="fr-btn fr-btn--icon-left fr-icon-arrow-right-line"
>
Estimer le montant des aides
</router-link>
<div class="cms__content" v-html="aide.contenu" />
<div class="flex align-items--center gap--small">
<a
v-if="aide.urlCommencerVotreDemarche"
:href="aide.urlCommencerVotreDemarche"
class="fr-btn"
rel="noopener external"
target="_blank"
>
Commencer votre démarche
</a>
<router-link
v-if="aide.isSimulateur"
:to="{ path: aide.url }"
class="fr-btn fr-btn--icon-left fr-icon-arrow-right-line"
>
Estimer le montant des aides
</router-link>
</div>
</div>
</div>
<div class="fr-col-12 fr-col-md-4">
<div v-if="aide.partenaire" class="fr-mt-2w background--white border border-radius--md fr-p-2w">
<p class="fr-mb-0">Proposé par</p>
<img :alt="aide.partenaire.nom" :src="aide.partenaire.logoUrl" class="fr-mt-5v max-full-width" />
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ChargementAidesAxiosRepository implements ChargementAidesRepository
async previsualiser(idAide: string): Promise<Aide> {
const axios = AxiosFactory.getCMSAxios();
const aideCMS = await axios.get(
`/aides/${idAide}?populate[1]=imageUrl&populate[2]=partenaire&populate[3]=thematique_gamification&populate[4]=rubriques&populate[5]=thematiques&populate[6]=tags&populate[7]=besoin`,
`/aides/${idAide}?populate[1]=imageUrl&populate[2]=partenaire,partenaire.logo.media&populate[3]=thematique_gamification&populate[4]=rubriques&populate[5]=thematiques&populate[6]=tags&populate[7]=besoin`,
);
return {
id: aideCMS.data.data.id,
Expand All @@ -71,6 +71,12 @@ export class ChargementAidesAxiosRepository implements ChargementAidesRepository
isSimulateur: aideCMS.data.data.attributes.is_simulateur,
montantMaximum: aideCMS.data.data.attributes.points,
urlCommencerVotreDemarche: aideCMS.data.data.url_commencer_votre_demarche,
partenaire: aideCMS.data.data.attributes.partenaire.data.attributes.logo.data[0]
? {
logoUrl: aideCMS.data.data.attributes.partenaire.data.attributes.logo.data[0].attributes.url,
nom: aideCMS.data.data.attributes.partenaire.data.attributes.nom,
}
: undefined,
};
}
}

0 comments on commit 0b5ba8c

Please sign in to comment.