cachers can now access their rewards at mycaches page

This commit is contained in:
Timo Volkmann 2019-05-01 21:40:13 +02:00
parent e660a7bba7
commit ea006b3915

View File

@ -59,21 +59,21 @@
<q-tab-panel name="finishedCaches" class="fit">
<q-list>
<q-card class="q-mb-md" v-for="startedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)" :key="startedCache.id">
<q-card class="q-mb-md" v-for="finishedCache in startedCaches.filter(cache => cache.cacheAccesDefinition.id === 1)" :key="finishedCache.id">
<q-expansion-item
class=""
expand-icon-toggle
expand-separator
icon="location_on"
:label="startedCache.cache.name"
:caption=" startedCache.cache.description"
:label="finishedCache.cache.name"
:caption=" finishedCache.cache.description"
>
<q-item>
<q-item-section top avatar class="self-center">
<!--<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>-->
</q-item-section>
<q-item-section>
<q-item-label caption>{{'Erhaltene Punkte für diesen Cache: ' + startedCache.cache.rankingPoints
<q-item-label caption>{{'Erhaltene Punkte für diesen Cache: ' + finishedCache.cache.rankingPoints
}}
</q-item-label>
</q-item-section>
@ -81,6 +81,10 @@
<q-item-section side top class="self-center">
</q-item-section>
</q-item>
<q-item class="q-pr-sm reverse q-gutter-x-sm">
<q-btn @click="goToReward(finishedCache.cache.id)" unelevated color="primary" stack icon="arrow_forward"
label="Belohnung ansehen" size="sm"/>
</q-item>
</q-expansion-item>
</q-card>
</q-list>
@ -93,17 +97,6 @@
</template>
<style>
.my-custom th {
color: #027BE3 !important;
}
.my-custom tr {
color: #027BE3 !important;
}
.my-custom td {
color: #027BE3 !important;
}
</style>
<script>
//import {dom} from 'quasar'
@ -118,98 +111,6 @@
teamStatus: "",
userName: null,
email: null,
userRanking: null,
teamName: null,
teamRanking: null,
dropDownSelectedItem: null,
columns: [
{
name: 'desc',
required: true,
align: 'left',
field: row => row.name,
format: val => `${val}`,
},
{
name: 'userData',
required: true,
align: 'left',
field: 'userData',
}
],
data: [
{
name: 'Mein Nutzername',
userData: this.userName,
},
{
name: 'Meine Email',
userData: this.email,
},
{
name: 'Meine Ranglistenposition',
userData: this.userRanking,
},
{
name: 'Mein Team',
userData: this.teamName,
},
{
name: 'Teamranglistenposition',
userData: this.teamRanking,
},
],
teamColumns: [
{
name: 'desc',
label: 'Benutzername',
required: true,
align: 'left',
field: row => row.name,
format: val => `${val}`,
},
{
name: 'ranking',
label: 'Solo-Ranglistenpunkte',
required: true,
align: 'left',
field: 'ranking',
sortable: true,
}
],
teamData: [
{
name: 'BuGaCacher2019',
ranking: 10,
},
{
name: 'Max',
ranking: 5,
},
{
name: 'Timo',
ranking: 4,
},
{
name: 'Katharina',
ranking: 3,
},
{
name: 'Michael',
ranking: 2,
},
{
name: 'Robin',
ranking: 1,
},
],
pagination: {
sortBy: 'name',
descending: false,
page: 1,
rowsPerPage: 10
// rowsNumber: xx if getting data from a server
},
}
},
mounted: function () {
@ -223,17 +124,6 @@
this.fetchUserCaches();
this.$store.commit('auth/SET_AUTHENTICATED');
this.$store.commit('auth/SET_USER');
this.userName = JSON.parse(localStorage.getItem('userToken')).name;
this.data[0].userData = this.userName;
this.email = JSON.parse(localStorage.getItem('userMail'));
this.data[1].userData = this.email;
this.userRanking = "1234";
this.data[2].userData = this.userRanking;
this.teamName = "BuGa19Community";
this.data[3].userData = this.teamName;
this.dropDownSelectedItem = this.teamName;
this.teamRanking = "2019";
this.data[4].userData = this.teamRanking;
},
methods: {
fetchUserCaches: function () {
@ -285,11 +175,24 @@
})
.catch((error) => {
});
}
//this.$router.push({path: `/station/${cacheID}`})
},
goToReward(cacheID) {
console.log("cacheID");
console.log(cacheID);
let currentStationID;
if (localStorage.getItem('userToken')) {
let params = {cacheID: cacheID};
params.token = JSON.parse(localStorage.getItem('userToken')).token;
this.$axios.get('/api/getCurrentStation', {params})
.then((response) => {
console.log(response.data);
currentStationID = response.data.aktuelleStation.id;
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
})
.catch((error) => {
});
}
},
getPersonalRanking() {
const name = JSON.parse(localStorage.getItem('userToken')).name;