Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajout des prix au m2 pour les mutations concernant un seul bâtiment #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions static/js/component.boite-accordeon.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Vue.component('boite-accordeon', {
<boite
v-for="batiment in mutation.batiments"
:valeur="(batiment['code_type_local'] != 3) ? (formatterNombre(batiment['surface_reelle_bati']) + ' m²') : ''"
:prix_m2="prixMetreCarre"
:icone="['', 'fa fa-home', 'fas fa-building', 'fas fa-warehouse', 'fas fa-store'][batiment['code_type_local']]"
:texte="batiment['type_local'] + ((batiment['code_type_local'] < 3) ? (' / ' + formatterNombre(batiment['nombre_pieces_principales']) + ' p') : '')">
</boite>
Expand All @@ -41,6 +42,14 @@ Vue.component('boite-accordeon', {
selectionnerMutation() {
entrerDansMutation(this.index);
}
},
computed: {
prixMetreCarre() {
if (this.mutation.batiments.length !== 1) return '';
var prixM2 = this.mutation.batiments[0]['valeur_fonciere'] / this.mutation.batiments[0]['surface_reelle_bati'];
if (isNaN(prixM2)) return '';
return formatterNombre(prixM2.toString());
}
}
});

Expand Down
3 changes: 2 additions & 1 deletion static/js/component.boite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Vue.component('boite', {
// Les paramètres sont là
props: ['couleur', 'valeur', 'icone', 'texte'],
props: ['prix_m2', 'valeur', 'icone', 'texte'],
// La on donne le code source HTML du composant qui peut utiliser des données
template:
`<div class="media d-flex">
Expand All @@ -9,6 +9,7 @@ Vue.component('boite', {
</div>
<div class="media-body text-left ml-1">
<b>{{valeur}}</b><br>
<span v-if="prix_m2">{{prix_m2}} € / m²<br></span>
<span>{{texte}}</span>
</div>
</div>`
Expand Down