Skip to content

Commit

Permalink
display type of chauffage #2166
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeneuvrier authored and numew committed Feb 2, 2024
1 parent feef133 commit 00b7a11
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
14 changes: 13 additions & 1 deletion src/Service/Signalement/SignalementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public function withDesordres(): self
$this->processDesordresByZone('logement');
$this->processDesordresTypeComposition();
}
// enregistre des données spécifiques dans jsonContent si elles existent (slug du critère pour affichage)
// enregistre des données spécifiques dans jsonContent si elles existent
// (slug du critère ou de la catégorie pour affichage)
if (isset($this->payload['desordres_logement_nuisibles_autres_details_type_nuisibles'])) {
$jsonContent['desordres_logement_nuisibles_autres'] =
$this->payload['desordres_logement_nuisibles_autres_details_type_nuisibles'];
Expand All @@ -147,6 +148,17 @@ public function withDesordres(): self
$jsonContent['desordres_batiment_nuisibles_autres'] =
$this->payload['desordres_batiment_nuisibles_autres_details_type_nuisibles'];
}
if (isset($this->payload['desordres_logement_chauffage_type'])) {
if ('electrique' === $this->payload['desordres_logement_chauffage_type']) {
$jsonContent['desordres_logement_chauffage'] = 'Chauffage électrique';
} elseif ('gaz' === $this->payload['desordres_logement_chauffage_type']) {
$jsonContent['desordres_logement_chauffage'] = 'Chauffage au gaz, bois, éthanol ou fioul';
} elseif ('aucun' === $this->payload['desordres_logement_chauffage_type']) {
$jsonContent['desordres_logement_chauffage'] = 'Aucun radiateur ou moyen de chauffage fixe';
} else {
$jsonContent['desordres_logement_chauffage'] = 'Type de chauffage inconnu';
}
}

if (isset($jsonContent)) {
$this->signalement->setJsonContent($jsonContent);
Expand Down
31 changes: 21 additions & 10 deletions templates/back/signalement/view/user-declaration-desordre.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,37 @@
<h3 class="fr-accordion__title">
<button class="fr-accordion__btn" aria-expanded="false" aria-controls="{{ zone }}-collapse-{{ loop.index }}"><strong>{{ situation|capitalize }}</strong></button>
</h3>
<div class="fr-collapse" id="{{ zone }}-collapse-{{ loop.index }}">
<div class="fr-collapse" id="{{ zone }}-collapse-{{ loop.index }}">
{# Affichage des données spécifiques liées à la catégorie #}
{% set firstCritere = criteres|first %}
{% if firstCritere is defined %}
{% set firstPrecision = firstCritere|first %}
{% if firstPrecision is defined %}
{% if signalement.jsonContent[firstPrecision.desordreCritere.slugCategorie] is defined %}
{{ signalement.jsonContent[firstPrecision.desordreCritere.slugCategorie] }}
{% endif %}
{% endif %}
{% endif %}
<ul>
{% for critere,criticites in criteres %}
{% for critere,precisions in criteres %}
<li>
{{ critere }}
{% for criticite in criticites %}
{% if criticite.label is not same as '' %}
{{ critere }}
{% for precision in precisions %}
{% if precision.label is not same as '' %}
<ul class="fr-list fr-list--none">
<li>
{{ criticite.label|raw }}
{% if signalement.jsonContent[criticite.desordreCritere.slugCritere] is defined %}
<br>Commentaire usager : <i>{{ signalement.jsonContent[criticite.desordreCritere.slugCritere] }}</i>
{{ precision.label|raw }}
{# Affichage des données spécifiques liées au critère #}
{% if signalement.jsonContent[precision.desordreCritere.slugCritere] is defined %}
<br>Commentaire usager : <i>{{ signalement.jsonContent[precision.desordreCritere.slugCritere] }}</i>
{% endif %}
</li>
</ul>
{% endif %}
{# ajout des photos liées spécifiquement à ce critère ou à cette précision #}
{% if photos[criticite.desordreCritere.slugCritere] is defined %}
{% if photos[precision.desordreCritere.slugCritere] is defined %}
<div class="fr-grid-row fr-grid-row--middle fr-grid-row--gutters fr-mb-3v">
{% for photo in photos[criticite.desordreCritere.slugCritere] %}
{% for photo in photos[precision.desordreCritere.slugCritere] %}
{% include 'back/signalement/view/user-declaration-desordre-photo.html.twig' %}
{% endfor %}
</div>
Expand Down

0 comments on commit 00b7a11

Please sign in to comment.