validation createCache and bugFix
This commit is contained in:
parent
3e1607f5b0
commit
cd55602d1f
@ -4,7 +4,8 @@
|
||||
<div class="q-pa-md q-gutter-y-md">
|
||||
<p class="text-h5">{{ isNewCache ? "Neuen Cache erstellen" : "Cache bearbeiten"}}</p>
|
||||
<q-input class="col" dense stack-label filled v-model="computedCache.name" label="Name" color="black"/>
|
||||
<q-input class="col" dense stack-label filled v-model="computedCache.rankingPoints" label="Punktewert" color="black"/>
|
||||
<q-input class="col" dense stack-label filled v-model="computedCache.rankingPoints" label="Punktewert"
|
||||
color="black"/>
|
||||
<p class="text-h6">Beschreibung</p>
|
||||
<q-editor
|
||||
:toolbar="[
|
||||
@ -94,9 +95,30 @@
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-card>
|
||||
<div class="row q-mt-xl">
|
||||
<q-btn @click="saveCache" class="full-width q-mb-md" color="primary" unelevated stack label="Cache speichern"
|
||||
icon="save_alt"/>
|
||||
<div v-show="validateInputBool" class="q-ma-none">
|
||||
<q-separator v-show="validateInputBool" color="negative" class="q-mt-lg"/>
|
||||
<div v-if="(computedCache.name.length <= 2)">
|
||||
• Name muss mindestens 3 Zeichen lang sein.
|
||||
</div>
|
||||
<div v-if="(computedCache.rankingPoints <= 0 || computedCache.rankingPoints > 9999 || computedCache.rankingPoints === NaN)">
|
||||
• Punktewert des Caches muss 1-9999 betragen.
|
||||
</div>
|
||||
<div v-if="(computedCache.description.length <= 0)">
|
||||
• Cachebeschreibung muss ausgefüllt sein und sollte sinnvollen Text enthalten.
|
||||
</div>
|
||||
<div v-if="(computedCache.reward.rewardDescription.length <= 0)">
|
||||
• Cachebelohnung muss ausgefüllt sein und sollte einen netten Text enthalten.
|
||||
</div>
|
||||
<div v-if="(this.computedCache.stationen.length <= 0)">
|
||||
• Es muss mindestens eine Station zum Cache hinzugefügt werden.
|
||||
</div>
|
||||
<q-separator v-show="validateInputBool" color="negative"/>
|
||||
</div>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn @click="validateInput" class="full-width q-mb-md" color="primary" unelevated stack
|
||||
label="Cache speichern"
|
||||
icon="save_alt">
|
||||
</q-btn>
|
||||
<q-btn to="/overview" class="full-width" color="negative" unelevated stack label="Abbrechen"/>
|
||||
</div>
|
||||
</div>
|
||||
@ -112,6 +134,9 @@
|
||||
return {
|
||||
scrolldown: false,
|
||||
isNewCache: this.$route.params.id === undefined,
|
||||
showTooltip: false,
|
||||
tooltipInfoText: "",
|
||||
validateInputBool: false,
|
||||
//tempCache: {},
|
||||
}
|
||||
},
|
||||
@ -258,7 +283,19 @@
|
||||
},
|
||||
validateEverything() {
|
||||
return this.validateRankingPoints();
|
||||
}
|
||||
},
|
||||
validateInput() {
|
||||
if (this.computedCache.name.length > 2
|
||||
&& (this.computedCache.rankingPoints > 0 && this.computedCache.rankingPoints <= 9999)
|
||||
&& this.computedCache.description.length > 0
|
||||
&& this.computedCache.reward.rewardDescription.length > 0
|
||||
&& this.computedCache.stationen.length > 0) {
|
||||
this.validateInputBool = false;
|
||||
this.saveCache();
|
||||
return;
|
||||
}
|
||||
this.validateInputBool = true;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
computedCache: {
|
||||
|
||||
@ -566,7 +566,7 @@
|
||||
const token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||
newAdmin.roles.role = "ADMIN";
|
||||
JSON.stringify(newAdmin);
|
||||
this.$axios.patch(process.env.USER_API, '/account', newAdmin, {
|
||||
this.$axios.patch(process.env.USER_API + '/account', newAdmin, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user