diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index 6e8b2789d5a2107271ca6cd361e02c6e49c50e23..827c688bf11bfe5ba83f4fe796119445036efc9c 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -147,10 +147,13 @@ v-for="(link, index) in linked_features" :key="link.feature_to.title + index" > - <td> + <td v-if="link.feature_to.feature_type_slug"> {{ link.relation_type_display }} - <router-link - v-if="link.feature_to.feature_type_slug" + <a @click="pushNgo(link)">{{ link.feature_to.title }} </a> + ({{ link.feature_to.display_creator }} - + {{ link.feature_to.created_on }}) + <!-- <router-link + :key="$route.fullPath" :to="{ name: 'details-signalement', params: { @@ -162,6 +165,7 @@ > ({{ link.feature_to.display_creator }} - {{ link.feature_to.created_on }}) + --> </td> </tr> </tbody> @@ -416,13 +420,31 @@ export default { }, feature: function () { - return this.$store.state.feature.features.find( + const result = this.$store.state.feature.features.find( (el) => el.feature_id === this.$route.params.slug_signal ); + console.log("result", result); + return result; }, }, methods: { + pushNgo(link) { + this.$router.push({ + name: "details-signalement", + params: { + slug_type_signal: link.feature_to.feature_type_slug, + slug_signal: link.feature_to.feature_id, + }, + }); + this.getFeatureEvents(); + this.getFeatureAttachments(); + this.getLinkedFeatures(); + this.addFeatureToMap(); + //this.initMap(); + //this.$router.go(); + }, + postComment() { featureAPI .postComment({ @@ -536,7 +558,12 @@ export default { mapUtil.getMap().dragging.disable(); mapUtil.getMap().doubleClickZoom.disable(); mapUtil.getMap().scrollWheelZoom.disable(); - var currentFeatureId = this.$route.params.slug_signal; + + this.addFeatureToMap(); + }, + + addFeatureToMap() { + const currentFeatureId = this.$route.params.slug_signal; const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}features/${currentFeatureId}/?output=geojson`; axios .get(url) @@ -575,9 +602,9 @@ export default { }, created() { - if (!this.project) { - this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); - } + // if (!this.project) { + // this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); + // } this.$store.commit( "feature_type/SET_CURRENT_FEATURE_TYPE_SLUG", this.$route.params.slug_type_signal @@ -588,12 +615,16 @@ export default { }, mounted() { - this.$store - .dispatch("GET_PROJECT_INFO", this.$route.params.slug) - .then((data) => { - console.log(data); - this.initMap(); - }); + if (!this.project) { + this.$store + .dispatch("GET_PROJECT_INFO", this.$route.params.slug) + .then((data) => { + console.log(data); + this.initMap(); + }); + } else { + this.initMap(); + } }, beforeDestroy() {