Skip to content
Snippets Groups Projects
Commit f9599177 authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'redmine-issues/11850' into 'develop'

parents 37c38559 c052f9cb
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
{{ feature.title || feature.feature_id }}
<div class="ui icon right floated compact buttons">
<router-link
v-if="permissions.can_create_feature"
v-if="permissions && permissions.can_create_feature"
:to="{
name: 'ajouter-signalement',
params: {
......@@ -22,7 +22,7 @@
<i class="plus fitted icon"></i>
</router-link>
<router-link
v-if="permissions.can_update_feature"
v-if="permissions && permissions.can_update_feature"
:to="{
name: 'editer-signalement',
params: {
......@@ -35,7 +35,7 @@
<i class="inverted grey pencil alternate icon"></i>
</router-link>
<a
v-if="permissions.can_delete_feature"
v-if="permissions && permissions.can_delete_feature"
@click="isCanceling = true"
id="feature-delete"
class="ui button button-hover-red"
......@@ -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>
......@@ -267,7 +271,10 @@
</div>
</div>
<div v-if="permissions.can_create_feature" class="ui segment">
<div
v-if="permissions && permissions.can_create_feature"
class="ui segment"
>
<form
id="form-comment"
class="ui form"
......@@ -416,13 +423,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,8 +561,13 @@ export default {
mapUtil.getMap().dragging.disable();
mapUtil.getMap().doubleClickZoom.disable();
mapUtil.getMap().scrollWheelZoom.disable();
var currentFeatureId = this.$route.params.slug_signal;
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}features/${currentFeatureId}/?output=geojson`;
this.addFeatureToMap();
},
addFeatureToMap() {
const currentFeatureId = this.$route.params.slug_signal;
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}features/${currentFeatureId}/?feature_type__slug=${this.$route.params.slug_type_signal}&output=geojson`;
axios
.get(url)
.then((response) => {
......@@ -575,9 +605,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 +618,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() {
......
......@@ -271,7 +271,6 @@ export default {
data() {
return {
map: null,
feature_type: null,
baseUrl: this.$store.state.configuration.BASE_URL,
file: null,
showGeoRef: false,
......@@ -336,6 +335,7 @@ export default {
computed: {
...mapGetters(["project"]),
...mapGetters("feature_type", ["feature_type"]),
...mapState(["user", "USER_LEVEL_PROJECTS"]),
...mapState("map", ["basemaps"]),
...mapState("feature", [
......@@ -411,19 +411,10 @@ export default {
}
}
}
return []
return [];
},
},
/* watch: {
feature(newValue) {
if (this.$route.name === "editer-signalement") {
this.initForm();
this.initExtraForms(newValue);
}
},
}, */
methods: {
initForm() {
if (this.currentRouteName === "editer-signalement") {
......@@ -875,7 +866,7 @@ export default {
});
const currentFeatureId = this.$route.params.slug_signal;
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`;
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?feature_type__slug=${this.$route.params.slug_type_signal}&output=geojson`;
axios
.get(url)
.then((response) => {
......@@ -932,14 +923,6 @@ export default {
},
created() {
/* if (!this.project) {
console.log(this.$store.state.projects);
this.project = this.$store.state.projects.find(
(project) => project.slug === this.$store.state.project_slug
);
this.filterStatusChoicesF();
} */
this.$store.commit(
"feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
this.$route.params.slug_type_signal
......@@ -952,17 +935,12 @@ export default {
},
mounted() {
let ftSlug = this.$route.params.slug_type_signal;
this.$store
.dispatch("GET_PROJECT_INFO", this.$route.params.slug)
.then((data) => {
console.log(data);
this.initForm();
this.initMap();
console.log(this.$store.state.feature_type.feature_types);
this.feature_type = this.$store.state.feature_type.feature_types.find(
(el) => el.slug === ftSlug
);
this.onFeatureTypeLoaded();
this.initExtraForms();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment