Skip to content
Snippets Groups Projects
Commit 729ce80d authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Replaced all custom modals with regular JavaScript alert/confirm

parent 5d9eab1c
Branches
No related tags found
No related merge requests found
......@@ -49,69 +49,12 @@
<div id="poiMarker" style="display:none">
<img src="@/assets/map_icon.png">
</div>
<!-- For Saving -->
<Modal
v-show="isModalVisible"
v-on:close="closeModal"
v-on:action="actionModal"
>
<template v-slot:header>
{{ $t("alert.header.label")}}
</template>
<template v-slot:body>
{{ $t("mapPOI.modal.label.saveprompt")}}: {{poi.name}} ?
</template>
<template v-slot:footer>
{{ $t("mapPOI.modal.label.pleasechoose")}}:
</template>
</Modal>
<!-- For Delete -->
<Modal
v-show="isModalDelVisible"
v-on:close="closeDelModal"
v-on:action="actionDelModal"
>
<template v-slot:header>
{{ $t("alert.header.label")}}
</template>
<template v-slot:body>
<font color='red'>{{ $t("mapPOI.modal.label.deleteprompt")}}: {{poi.name}} ?</font>
</template>
<template v-slot:footer>
{{ $t("mapPOI.modal.label.pleasechoose")}} :
</template>
</Modal>
<modal-simple
v-show="isModalSimpleVisible"
v-on:close="closeModal"
>
<template v-slot:header>
{{ $t("alert.header.error.label")}}
</template>
<template v-slot:body>
{{msgErr}}
</template>
<template v-slot:footer>
&nbsp;
</template>
</modal-simple>
</div>
</template>
<script>
import CommonUtil from '@/components/CommonUtil';
import Modal from '@/components/Modal';
import ModalSimple from '@/components/ModalSimple.vue';
import 'ol/ol.css';
import Map from 'ol/Map';
......@@ -144,14 +87,11 @@ import i18n from '@/App'
export default{
name : 'MapPOI',
components : {Modal,ModalSimple},
components : {},
props : ['pointOfInterestId'],
data() {
return {
isModalDelVisible : false,
isModalVisible : false,
isModalSimpleVisible : false,
poi : {},
mapZoom : 0,
poiTypes : [],
......@@ -176,12 +116,12 @@ export default{
},
callForRemovePOI()
{
this.isModalDelVisible = true;
},
closeDelModal(){
this.isModalDelVisible = false;
if(confirm(this.$i18n.t("mapPOI.modal.label.deleteprompt") + " " + this.poi.name + "?"))
{
this.deletePOI();
}
},
actionDelModal()
deletePOI()
{
if(this.poi.pointOfInterestId)
{
......@@ -199,8 +139,6 @@ export default{
}
}
this.isModalDelVisible = false;
},
removeLocalPOI(id)
{
......@@ -227,46 +165,33 @@ export default{
{
if((!this.poi.name) || (this.trimString(this.poi.name) === ''))
{
this.msgErr = this.$i18n.t("mapPOI.modal.alert.missingPOIName");//'Name should not be empty';
this.isModalSimpleVisible = true;
alert(this.$i18n.t("mapPOI.modal.alert.missingPOIName"));
return;
}
else if(!this.poi.geoJSON)
if(!this.poi.geoJSON)
{
this.msgErr = this.$i18n.t("mapPOI.modal.alert.missingGeoInfo");
this.isModalSimpleVisible = true;
alert(this.$i18n.t("mapPOI.modal.alert.missingGeoInfo"));
return;
}
else
// TODO Simplify this logic
if (!this.poi.pointOfInterestTypeId)
{
if (!this.poi.pointOfInterestTypeId)
if(this.poi.pointOfInterestTypeId === 0)
{
if(this.poi.pointOfInterestTypeId === 0)
{
this.isModalVisible = false;
this.showModal();
}
else
{
this.msgErr = this.$i18n.t("mapPOI.modal.alert.missingPOIType");
this.isModalSimpleVisible = true;
}
// Pass
}
else
{
this.isModalVisible = false;
this.showModal();
alert(this.$i18n.t("mapPOI.modal.alert.missingPOIType"));
return false;
}
}
},
showModal() {
this.isModalVisible = true;
},
closeModal() {
this.isModalVisible = false;
this.isModalSimpleVisible = false;
},
actionModal() {
this.isModalVisible = false;
this.saveToStore();
if(confirm(this.$i18n.t("mapPOI.modal.label.saveprompt") + " " + this.poi.name + "?"))
{
this.saveToStore();
}
},
getPointOfInterest(id){
let lstPOI = JSON.parse(localStorage.getItem(CommonUtil.CONST_STORAGE_POI_LIST));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment