refactoring: replaced global var opened by opened_concernement

This commit is contained in:
2023-06-26 12:26:16 +02:00
parent 36275fb9f3
commit 45cd0341fe
5 changed files with 33 additions and 28 deletions

View File

@@ -22,7 +22,7 @@ export default {
computed: {
...mapState(UserStore,['isloggedin']),
...mapState(ConcernementsStore,['map_mode']),
...mapState(ConcernementsStore,['opened']),
...mapState(ConcernementsStore,['opened_concernement']),
// ...mapState(ConcernementsStore,['opened_entity_id']),
...mapState(ConcernementsStore,['concernements_loaded']),
...mapState(ConcernementsStore,['ct_concernement']),
@@ -35,7 +35,7 @@ export default {
...mapState(CommonStore,['hover_elmt'])
},
created () {
console.log(`Concernement view created, id: ${this.id}, eid: ${this.eid}, opened:${this.opened}`);
console.log(`Concernement view created, id: ${this.id}, eid: ${this.eid}, opened_concernement:${this.opened_concernement}`);
// when we arrived directly to the url, load the entite
// this.eid provided by route params
@@ -46,9 +46,9 @@ export default {
watch: {
concernements_loaded: {
handler (n, o){
console.log(`watch concernements_loaded n: ${n}, opened:${this.opened}, id:${this.id}`);
console.log(`watch concernements_loaded n: ${n}, opened_concernement:${this.opened_concernement}, id:${this.id}`);
// when we arrived directly to the url then all concernement are loaded: do open the concernement
if (!this.opened) {
if (!this.opened_concernement) {
this.openCloseConcernements(this.id)
}
@@ -107,7 +107,7 @@ export default {
</script>
<template>
<section v-if="opened" class="concernement">
<section v-if="opened_concernement" class="concernement">
<header v-if="concernements_loaded">
<label
v-if="ct_concernement && !entite && map_mode !== 'puissancedagir'&& map_mode !== 'doleancer'"
@@ -115,9 +115,9 @@ export default {
{{ ct_concernement.title.description }}
</label>
<h3 v-if="entite">{{ entite.title }}</h3>
<span v-if="entite && opened.entites_byid[eid].menacemaintien < 0">menace</span>
<span v-if="entite && opened.entites_byid[eid].menacemaintien > 0">maintient</span>
<h2>{{ opened.title }}</h2>
<span v-if="entite && opened_concernement.entites_byid[eid].menacemaintien < 0">menace</span>
<span v-if="entite && opened_concernement.entites_byid[eid].menacemaintien > 0">maintient</span>
<h2>{{ opened_concernement.title }}</h2>
</header>
<!-- concernement -->
<section
@@ -125,11 +125,11 @@ export default {
class="content-concernement">
<section class="description">
<label v-if="ct_concernement">{{ ct_concernement.field_description.description }}</label>
<div v-html="opened.description"/>
<div v-html="opened_concernement.description"/>
</section>
<section class="caillou">
<label v-if="ct_concernement">{{ ct_concernement.field_caillou.description }}</label>
<div v-html="opened.caillou "/>
<div v-html="opened_concernement.caillou "/>
</section>
</section>
<!-- entite -->
@@ -151,7 +151,7 @@ export default {
class="content-besoins">
<ul class="besoins">
<li
v-for="besoin in opened.besoins"
v-for="besoin in opened_concernement.besoins"
:key="besoin.id"
class="besoin"
:id="besoin.id"
@@ -213,7 +213,7 @@ export default {
v-if="map_mode === 'doleancer'"
class="content-doleances">
<section
v-for="doleance in opened.doleances"
v-for="doleance in opened_concernement.doleances"
class="doleance">
<header>
<label for="leprobleme">{{ ct_cercle_politique.field_le_probleme.label }}</label>