Skip to content
Snippets Groups Projects
Commit 7d00f7a3 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix modify statusand delete features and more

parent c1a41a81
No related branches found
No related tags found
No related merge requests found
...@@ -80,6 +80,9 @@ body { ...@@ -80,6 +80,9 @@ body {
.tiny-margin { .tiny-margin {
margin: 0.1rem 0 0.1rem 0.1rem !important; margin: 0.1rem 0 0.1rem 0.1rem !important;
} }
.tiny-margin-left {
margin-left: 0.1rem !important;
}
.ellipsis { .ellipsis {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</div> </div>
<div <div
v-if="checkedFeatures.length > 0 && massMode === 'modify'" v-if="checkedFeatures.length > 0 && massMode === 'modify'"
class="ui dropdown button compact button-hover-green margin-left-25" class="ui dropdown button compact button-hover-green tiny-margin-left"
data-tooltip="Modifier le statut des Signalements" data-tooltip="Modifier le statut des Signalements"
data-position="bottom right" data-position="bottom right"
@click="toggleModifyStatus" @click="toggleModifyStatus"
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
v-for="status in availableStatus" v-for="status in availableStatus"
:key="status.value" :key="status.value"
class="item" class="item"
@click="modifyStatus(status.value)" @click="$emit('modify-status', status.value)"
> >
{{ status.name }} {{ status.name }}
</span> </span>
...@@ -116,10 +116,10 @@ ...@@ -116,10 +116,10 @@
</div> </div>
<div <div
v-if="checkedFeatures.length > 0 && massMode === 'delete'" v-if="checkedFeatures.length > 0 && massMode === 'delete'"
class="ui button compact button-hover-red margin-left-25" class="ui button compact button-hover-red tiny-margin-left"
data-tooltip="Supprimer tous les signalements sélectionnés" data-tooltip="Supprimer tous les signalements sélectionnés"
data-position="bottom right" data-position="bottom right"
@click="toggleDeleteModal" @click="$emit('toggle-delete-modal')"
> >
<i <i
class="grey trash fitted icon" class="grey trash fitted icon"
...@@ -320,6 +320,14 @@ export default { ...@@ -320,6 +320,14 @@ export default {
}, },
}, },
mounted() {
window.addEventListener('mousedown', this.clickOutsideDropdown);
},
destroyed() {
window.removeEventListener('mousedown', this.clickOutsideDropdown);
},
methods: { methods: {
resetPaginationNfetchFeatures() { resetPaginationNfetchFeatures() {
this.$emit('reset-pagination'); this.$emit('reset-pagination');
...@@ -330,6 +338,20 @@ export default { ...@@ -330,6 +338,20 @@ export default {
this.showAddFeature = !this.showAddFeature; this.showAddFeature = !this.showAddFeature;
this.showModifyStatus = false; this.showModifyStatus = false;
}, },
toggleModifyStatus() {
this.showModifyStatus = !this.showModifyStatus;
this.showAddFeature = false;
},
clickOutsideDropdown(e) {
if (!e.target.closest('#button-dropdown')) {
this.showModifyStatus = false;
setTimeout(() => { //* timout necessary to give time to click on link to add feature
this.showAddFeature = false;
}, 500);
}
},
} }
}; };
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
@reset-pagination="resetPagination" @reset-pagination="resetPagination"
@fetch-features="fetchPagedFeatures" @fetch-features="fetchPagedFeatures"
@show-map="setShowMap" @show-map="setShowMap"
@modify-status="modifyStatus"
@toggle-delete-modal="toggleDeleteModal"
/> />
<div <div
...@@ -143,8 +145,6 @@ export default { ...@@ -143,8 +145,6 @@ export default {
pagination: { ...initialPagination }, pagination: { ...initialPagination },
projectSlug: this.$route.params.slug, projectSlug: this.$route.params.slug,
showMap: true, showMap: true,
showAddFeature: false,
showModifyStatus: false,
sort: { sort: {
column: '', column: '',
ascending: true, ascending: true,
...@@ -223,12 +223,9 @@ export default { ...@@ -223,12 +223,9 @@ export default {
} else { } else {
this.initMap(); this.initMap();
} }
window.addEventListener('mousedown', this.clickOutsideDropdown);
}, },
destroyed() { destroyed() {
window.removeEventListener('mousedown', this.clickOutsideDropdown);
//* allow user to change page if ever stuck on loader //* allow user to change page if ever stuck on loader
this.$store.commit('DISCARD_LOADER'); this.$store.commit('DISCARD_LOADER');
}, },
...@@ -260,24 +257,10 @@ export default { ...@@ -260,24 +257,10 @@ export default {
} }
}, },
toggleModifyStatus() {
this.showModifyStatus = !this.showModifyStatus;
this.showAddFeature = false;
},
toggleDeleteModal() { toggleDeleteModal() {
this.isDeleteModalOpen = !this.isDeleteModalOpen; this.isDeleteModalOpen = !this.isDeleteModalOpen;
}, },
clickOutsideDropdown(e) {
if (!e.target.closest('#button-dropdown')) {
this.showModifyStatus = false;
setTimeout(() => { //* timout necessary to give time to click on link to add feature
this.showAddFeature = false;
}, 500);
}
},
async modifyStatus(newStatus) { async modifyStatus(newStatus) {
if (this.checkedFeatures.length > 0) { if (this.checkedFeatures.length > 0) {
const feature_id = this.checkedFeatures[0]; const feature_id = this.checkedFeatures[0];
......
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