creating clones of map_item for duplicates superposition concernement couples

This commit is contained in:
2023-09-11 11:57:38 +02:00
parent 8e9941c1d1
commit c4dd253b98
4 changed files with 100 additions and 12 deletions

View File

@@ -23,9 +23,35 @@ export default {
},
computed: {
...mapState(UserStore,['isloggedin']),
...mapState(ConcernementsStore,['concernements',
...mapState(ConcernementsStore,['map_mode',
'concernements',
'concernementsByID',
'opened_recit'])
'allSuperpositions_byid',
'opened_recit']),
superposed_clones_concernements () {
let clones = [];
// loop through all superposition grouped by concernements couples
for(let [couple_id, superpositions] of Object.entries(this.allSuperpositions_byid)){
// if one concernement couple has more than one superposition
if (superpositions.length > 1) {
// loop through these superpositions for one concernement couple starting with the second
for (let i = 1; i < superpositions.length; i++) {
let superposition_id = `${superpositions[i][0].cid}-${superpositions[i][0].eid}--${superpositions[i][1].cid}-${superpositions[i][1].eid}`
// first concernement of the couple
clones.push({
concernement: this.concernementsByID[superpositions[i][0].cid],
superposition_id: superposition_id
})
// second concernement of the couple
clones.push({
concernement: this.concernementsByID[superpositions[i][1].cid],
superposition_id: superposition_id
})
}
}
}
return clones;
}
},
methods: {
...mapActions(ConcernementsStore,['loadConcernements']),
@@ -69,6 +95,18 @@ export default {
:active_revision="concernement.active_revision"
/>
</template>
<template v-if="map_mode === 'superposition'">
<template v-for="(superposition,index) in superposed_clones_concernements">
<ConcernementMapItem
v-if="superposition.concernement.visible"
:key="index"
:concernement="superposition.concernement"
:is_opened="superposition.concernement.opened"
:active_revision="superposition.concernement.active_revision"
:superposition_id="superposition.superposition_id"
/>
</template>
</template>
</MapConcernements>
<div id="content" :class="{'recit-opened':opened_recit}">
<RouterView />