bugfixes in Cache edit
This commit is contained in:
parent
eabf972012
commit
7faa9ef327
@ -93,9 +93,15 @@
|
|||||||
console.log(params);
|
console.log(params);
|
||||||
if (!params.cacheID || !params.stationID || !params.durchgefuehrterCacheID || !params.token) {
|
if (!params.cacheID || !params.stationID || !params.durchgefuehrterCacheID || !params.token) {
|
||||||
console.log("Mindestens 1 Parameter konnte nicht erkannt werden!");
|
console.log("Mindestens 1 Parameter konnte nicht erkannt werden!");
|
||||||
|
let header = "Fehler!";
|
||||||
|
let message = "Der erkannte QR-Code ist fehlerhaft oder gehört nicht zu BuGa Geocaching.";
|
||||||
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
|
||||||
resolve(false);
|
resolve(false);
|
||||||
} else if (isNaN(params.cacheID) || isNaN(params.stationID) || isNaN(params.durchgefuehrterCacheID)) {
|
} else if (isNaN(params.cacheID) || isNaN(params.stationID) || isNaN(params.durchgefuehrterCacheID)) {
|
||||||
console.log("Mindestens 1 Parameter ist fehlerhaft!");
|
console.log("Mindestens 1 Parameter ist fehlerhaft!");
|
||||||
|
let header = "Fehler!";
|
||||||
|
let message = "Der erkannte QR-Code ist fehlerhaft oder gehört nicht zu BuGa Geocaching.";
|
||||||
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
|
||||||
resolve(false);
|
resolve(false);
|
||||||
} else {
|
} else {
|
||||||
this.$axios.put('/api/checkStation', null, { params })
|
this.$axios.put('/api/checkStation', null, { params })
|
||||||
@ -162,12 +168,12 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateProps() {
|
updateProps() {
|
||||||
console.log("emit result!")
|
console.log("emit result!");
|
||||||
this.$emit('result', this.params)
|
this.$emit('result', this.params)
|
||||||
},
|
},
|
||||||
updateCameraState() {
|
updateCameraState() {
|
||||||
console.log("Camera State:")
|
console.log("Camera State:");
|
||||||
console.log(!this.askForPermission)
|
console.log(!this.askForPermission);
|
||||||
this.$emit('camera', !this.askForPermission)
|
this.$emit('camera', !this.askForPermission)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-layout view="hhh Lpr lFf">
|
<q-layout view="hhh Lpr lFf" @click.native="counter()">
|
||||||
<q-header id="qheader" class="bg-white text-grey-14" elevated>
|
<q-header id="qheader" class="bg-white text-grey-14" elevated>
|
||||||
<q-toolbar class="q-pa-md">
|
<q-toolbar class="q-pa-md">
|
||||||
<q-img src="statics/buga_logo.svg" style="max-width: 40px;" class="q-mr-sm"/>
|
<q-img src="statics/buga_logo.svg" style="max-width: 40px;" class="q-mr-sm"/>
|
||||||
@ -162,6 +162,17 @@
|
|||||||
<q-item-label>Login</q-item-label>
|
<q-item-label>Login</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
|
<!-- <q-item-->
|
||||||
|
<!-- disable-->
|
||||||
|
<!-- class="text-grey-5"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <q-item-section avatar>-->
|
||||||
|
<!-- </q-item-section>-->
|
||||||
|
<!-- <q-item-section>-->
|
||||||
|
<!-- <q-item-label>dev: {{ clickCounter }} clicks</q-item-label>-->
|
||||||
|
<!-- </q-item-section>-->
|
||||||
|
<!-- </q-item>-->
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-drawer>
|
</q-drawer>
|
||||||
|
|
||||||
@ -196,6 +207,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
leftDrawerOpen: this.$q.platform.is.desktop,
|
leftDrawerOpen: this.$q.platform.is.desktop,
|
||||||
|
clickCounter: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -238,7 +250,10 @@
|
|||||||
//this.evalAuthentication();
|
//this.evalAuthentication();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//openURL
|
counter() {
|
||||||
|
this.clickCounter++;
|
||||||
|
//console.log(this.clickCounter);
|
||||||
|
},
|
||||||
dialogClose() {
|
dialogClose() {
|
||||||
console.log("dialogClose(): ")
|
console.log("dialogClose(): ")
|
||||||
this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
|
this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
|
||||||
|
|||||||
@ -124,7 +124,7 @@
|
|||||||
created: function () {
|
created: function () {
|
||||||
console.log("isNewCache: " + this.isNewCache);
|
console.log("isNewCache: " + this.isNewCache);
|
||||||
console.log("Route Params: " + this.$route.params.id);
|
console.log("Route Params: " + this.$route.params.id);
|
||||||
if (!this.isNewCache) {
|
if (!this.isNewCache && !this.$store.getters['cacheCollector/GET_LOCK']) {
|
||||||
this.$axios.get('/api/allCaches')
|
this.$axios.get('/api/allCaches')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("/api/allCaches");
|
console.log("/api/allCaches");
|
||||||
@ -140,8 +140,8 @@
|
|||||||
this.$store.commit('cacheCollector/SET_STATIONS', stations);
|
this.$store.commit('cacheCollector/SET_STATIONS', stations);
|
||||||
this.$store.commit('cacheCollector/SET_ENDSTATION', endstation);
|
this.$store.commit('cacheCollector/SET_ENDSTATION', endstation);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.$store.commit('cacheCollector/SET_LOCK', false);
|
||||||
},
|
},
|
||||||
beforeMount: function () {
|
beforeMount: function () {
|
||||||
},
|
},
|
||||||
@ -174,25 +174,22 @@
|
|||||||
console.log(this.$store.getters['cacheCollector/GET_STATIONS']);
|
console.log(this.$store.getters['cacheCollector/GET_STATIONS']);
|
||||||
const station = this.$store.getters['cacheCollector/GET_STATIONS'][index];
|
const station = this.$store.getters['cacheCollector/GET_STATIONS'][index];
|
||||||
console.log(station);
|
console.log(station);
|
||||||
if (station.hasOwnProperty('id')) {
|
this.$store.commit('cacheCollector/SET_TEMPSTATION', station);
|
||||||
//this.$router.push({ path: '/station/'+station.id});
|
this.$store.commit('cacheCollector/SET_LOCK', true);
|
||||||
} else {
|
this.$router.push({path: `/tempstation/${index}`}); // add parameter
|
||||||
// TODO Stationen bearbeitbar machen bevor sie abgeschickt werden. Am besten Station Objekt als Übergabe Parameter bei Router
|
|
||||||
this.$store.commit('cacheCollector/SET_TEMPSTATION', station);
|
|
||||||
this.$router.push({path: `/tempstation/${index}`}); // add parameter
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
deleteStation(index) {
|
deleteStation(index) {
|
||||||
// TODO wenn Station id hat, mit Backend abgleichen
|
|
||||||
this.$store.commit('cacheCollector/REMOVE_STATION', index);
|
this.$store.commit('cacheCollector/REMOVE_STATION', index);
|
||||||
},
|
},
|
||||||
saveCache() {
|
saveCache() {
|
||||||
// commit to store, send to api, if success -> reset store
|
// commit to store, send to api, if success -> reset store
|
||||||
|
console.log("saveCache!");
|
||||||
let cache = JSON.parse(JSON.stringify(this.computedCache));
|
let cache = JSON.parse(JSON.stringify(this.computedCache));
|
||||||
console.log(cache);
|
console.log(cache);
|
||||||
cache.stationen.push(this.computedEndstation);
|
cache.stationen.push(this.computedEndstation);
|
||||||
|
console.log("isnewcache "+this.isNewCache)
|
||||||
if (this.isNewCache) {
|
if (this.isNewCache) {
|
||||||
|
console.log("CREATECACHE")
|
||||||
this.$axios.post('/api/createCache', cache)
|
this.$axios.post('/api/createCache', cache)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("POST api/createCache: " + response.statusText);
|
console.log("POST api/createCache: " + response.statusText);
|
||||||
@ -217,6 +214,7 @@
|
|||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
console.log("EDITCACHE")
|
||||||
this.$axios.put('/api/editCache', cache)
|
this.$axios.put('/api/editCache', cache)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("POST api/editCache: " + response.statusText);
|
console.log("POST api/editCache: " + response.statusText);
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
<q-tab-panels v-model="tab" animated swipeable class="col">
|
<q-tab-panels v-model="tab" animated swipeable class="col">
|
||||||
|
|
||||||
<q-tab-panel name="startedCaches" class=" fit">
|
<q-tab-panel name="startedCaches" class=" fit">
|
||||||
|
<p class="text-grey-4 text-h5 text-center" v-if="startedCaches.filter(cache => cache.cacheAccesDefinition.id === 0).length === 0">keine Einträge</p>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-card
|
<q-card
|
||||||
class="q-mb-md"
|
class="q-mb-md"
|
||||||
@ -55,6 +56,7 @@
|
|||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
||||||
<q-tab-panel name="finishedCaches" class="fit">
|
<q-tab-panel name="finishedCaches" class="fit">
|
||||||
|
<p class="text-grey-4 text-h5 text-center" v-if="startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1).length === 0">keine Einträge</p>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-card class="q-mb-md"
|
<q-card class="q-mb-md"
|
||||||
v-for="finishedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)"
|
v-for="finishedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)"
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
size="10em"
|
size="10em"
|
||||||
/>
|
/>
|
||||||
|
<p class="text-grey-4 text-h5 text-center" v-if="caches.length === 0">keine Einträge</p>
|
||||||
<q-list v-if="render">
|
<q-list v-if="render">
|
||||||
<q-card class="q-mb-md" v-for="cache in caches" :key="cache.id">
|
<q-card class="q-mb-md" v-for="cache in caches" :key="cache.id">
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
@ -229,6 +230,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
addCache() {
|
addCache() {
|
||||||
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
this.$router.push({path: `/cache`})
|
this.$router.push({path: `/cache`})
|
||||||
},
|
},
|
||||||
editCache(cacheID) {
|
editCache(cacheID) {
|
||||||
|
|||||||
@ -134,13 +134,17 @@
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
let message;
|
let message;
|
||||||
let header = "Unbekannter Fehler...";
|
let header = "Unbekannter Fehler!";
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
console.log(error.response)
|
console.log(error.response);
|
||||||
if (error.response.status === 409) {
|
if (error.response.status === 409) {
|
||||||
message= "Die E-Mail-Adresse wird bereits verwendet!";
|
message= "Die E-Mail-Adresse wird bereits verwendet!";
|
||||||
header= "Anmeldedaten überprüfen!";
|
header= "Anmeldedaten überprüfen!";
|
||||||
}
|
}
|
||||||
|
if (error.response.status === 500) {
|
||||||
|
message= "Der Anmeldeserver konnte die Daten nicht verarbeiten.";
|
||||||
|
header= "Fehler!";
|
||||||
|
}
|
||||||
} else if (error.request) {
|
} else if (error.request) {
|
||||||
console.log(error.request);
|
console.log(error.request);
|
||||||
header = "Anfrage fehlgeschlagen!";
|
header = "Anfrage fehlgeschlagen!";
|
||||||
|
|||||||
@ -97,13 +97,20 @@
|
|||||||
saveStation() {
|
saveStation() {
|
||||||
console.log("saveStation(): ");
|
console.log("saveStation(): ");
|
||||||
console.log(this.station);
|
console.log(this.station);
|
||||||
|
console.log(this.isNewStation);
|
||||||
|
console.log(this.$route.params.pos);
|
||||||
if (this.isNewStation) {
|
if (this.isNewStation) {
|
||||||
this.$store.commit('cacheCollector/ADD_STATION', this.station);
|
this.$store.commit('cacheCollector/ADD_STATION', this.station);
|
||||||
} else {
|
} else {
|
||||||
this.$store.commit('cacheCollector/EDIT_STATION', {index: this.$route.params.pos, station: this.station});
|
this.$store.commit('cacheCollector/EDIT_STATION', {index: this.$route.params.pos, station: this.station});
|
||||||
this.$store.commit('cacheCollector/SET_TEMPSTATION', null);
|
this.$store.commit('cacheCollector/SET_TEMPSTATION', null);
|
||||||
}
|
}
|
||||||
this.$router.push({path: `/cache`});
|
let cache = this.$store.getters['cacheCollector/GET_CACHE'];
|
||||||
|
if (cache.hasOwnProperty('id')) {
|
||||||
|
this.$router.push({path: `/cache/${cache.id}`});
|
||||||
|
} else {
|
||||||
|
this.$router.push({path: `/cache`});
|
||||||
|
}
|
||||||
console.log("station saved..");
|
console.log("station saved..");
|
||||||
},
|
},
|
||||||
dismiss() {
|
dismiss() {
|
||||||
|
|||||||
@ -2,6 +2,10 @@ export const GET_CACHE = (state) => {
|
|||||||
console.log("GET_CACHE: retrieve cache from store. ");
|
console.log("GET_CACHE: retrieve cache from store. ");
|
||||||
return state.newCache;
|
return state.newCache;
|
||||||
};
|
};
|
||||||
|
export const GET_LOCK = (state) => {
|
||||||
|
console.log("GET_LOCK: ");
|
||||||
|
return state.locked;
|
||||||
|
};
|
||||||
export const GET_TEMPSTATION = (state) => {
|
export const GET_TEMPSTATION = (state) => {
|
||||||
console.log("GET_TEMPSTATION: retrieve cache from store. ");
|
console.log("GET_TEMPSTATION: retrieve cache from store. ");
|
||||||
return state.tempStation;
|
return state.tempStation;
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
export const SET_CACHE = (state, cache) => {
|
export const SET_CACHE = (state, cache) => {
|
||||||
console.log("SET_CACHE: save cache to store. ")
|
console.log("SET_CACHE: save cache to store. ");
|
||||||
state.newCache = cache;
|
state.newCache = cache;
|
||||||
};
|
};
|
||||||
|
export const SET_LOCK = (state, bool) => {
|
||||||
|
console.log("SET_LOCK: ");
|
||||||
|
state.locked = bool;
|
||||||
|
};
|
||||||
export const SET_TEMPSTATION = (state, station) => {
|
export const SET_TEMPSTATION = (state, station) => {
|
||||||
console.log("SET_TEMPSTATION: add new station to cache: "+station);
|
console.log("SET_TEMPSTATION: add new station to cache: "+station);
|
||||||
state.tempStation = station;
|
state.tempStation = station;
|
||||||
@ -25,6 +29,7 @@ export const EDIT_STATION = (state, indexStation) => {
|
|||||||
console.log("EDIT_STATION: "+index+" "+station);
|
console.log("EDIT_STATION: "+index+" "+station);
|
||||||
|
|
||||||
state.newCache.stationen[index] = station;
|
state.newCache.stationen[index] = station;
|
||||||
|
console.log("EDIT_STATION: "+JSON.stringify(state.newCache.stationen[index]));
|
||||||
};
|
};
|
||||||
export const REMOVE_STATION = (state, index) => {
|
export const REMOVE_STATION = (state, index) => {
|
||||||
console.log("REMOVE_STATION: "+index);
|
console.log("REMOVE_STATION: "+index);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
|
locked: false,
|
||||||
newCache: {
|
newCache: {
|
||||||
name: "",
|
name: "",
|
||||||
description: "",
|
description: "",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user