This commit is contained in:
2024-12-02 12:56:43 +01:00
parent 0acda07eb5
commit 048edfba89
8 changed files with 88 additions and 55 deletions

View File

@@ -24,5 +24,4 @@
<script setup>
import background_base64 from "../assets/background.jpg?inline";
import Footer from "@/components/Footer.vue";
console.log(config);
</script>

View File

@@ -31,7 +31,7 @@ export default {
try {
md = await fetch(`/imprint_en.md`);
} catch (error) {
md = "Error loading Imprint";
md = t('error_loading_imprint');
}
}
this.content = marked(await md.text());

View File

@@ -77,8 +77,8 @@
w-full
md:w-auto
" @click="() => {
state.delete_active = true;
}
state.delete_active = true;
}
">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
@@ -104,8 +104,8 @@
bg-blue-500
hover:bg-blue-600 hover:shadow-lg
" @click="() => {
state.delete_active = false;
}
state.delete_active = false;
}
">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
@@ -146,8 +146,8 @@
<div class="flex lg:flex-wrap flex-row lg:space-x-2">
<div class="flex-none">
<button @click="() => {
state.activetab = 'profile';
}
state.activetab = 'profile';
}
" :class="{
'tab-active border-b-2 font-medium border-blue-500':
state.activetab === 'profile',
@@ -157,8 +157,8 @@
</div>
<div class="flex-none">
<button @click="() => {
state.activetab = 'laptimes';
}
state.activetab = 'laptimes';
}
" :class="{
'tab-active border-b-2 font-medium border-blue-500':
state.activetab === 'laptimes',
@@ -168,8 +168,8 @@
</div>
<div class="flex-none">
<button @click="() => {
state.activetab = 'sponsorings';
}
state.activetab = 'sponsorings';
}
" :class="{
'tab-active border-b-2 font-medium border-blue-500':
state.activetab === 'sponsorings',
@@ -398,14 +398,14 @@
</td>
<td class="px-4 py-3">
<span v-text="(s.amountPerDistance / 100)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
"></span>€
</td>
<td class="px-4 py-3">
<span v-text="(s.amount / 100)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
"></span>€
</td>
</tr>
@@ -415,30 +415,30 @@
<td class="px-4 py-3">{{ $t("total") }}</td>
<td class="px-4 py-3">
<span v-text="(
state.sponsorings.reduce(function (
sum,
current
) {
return sum + current.amountPerDistance;
},
0) / 100
)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
state.sponsorings.reduce(function (
sum,
current
) {
return sum + current.amountPerDistance;
},
0) / 100
)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
"></span>€
</td>
<td class="px-4 py-3">
<span v-text="(
state.sponsorings.reduce(function (
sum,
current
) {
return sum + current.amount;
},
0) / 100
)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
state.sponsorings.reduce(function (
sum,
current
) {
return sum + current.amount;
},
0) / 100
)
.toFixed(2)
.toLocaleString('de-DE', { valute: 'EUR' })
"></span>€
</td>
</tr>
@@ -475,6 +475,8 @@ import { TYPE, useToast } from "vue-toastification";
import axios from "redaxios";
import bwipjs from "bwip-js";
import Footer from "@/components/Footer.vue";
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
function textToBase64Barcode(text) {
const canvas = document.createElement("canvas");
@@ -531,7 +533,7 @@ axios
})
.catch((error) => {
toast.clear();
toast.error("Profil konnte nicht geladen werden...");
toast.error(t('profil_konnte_nicht_geladen_werden'));
});
axios
.get(`${config.baseurl}api/runners/me/${accesstoken}/scans`)
@@ -553,26 +555,26 @@ axios
state.scans = data;
})
.catch((error) => {
toast.error("Profil konnte nicht geladen werden...");
toast.error(t('profil_konnte_nicht_geladen_werden'));
});
function delete_me() {
toast.clear();
toast("Profil wird gelöscht...");
toast(t('profil_wird_geloescht'));
let url = `${config.baseurl}api/runners/me/${accesstoken}?force=true`;
axios
.delete(url)
.then(() => {
toast.clear();
toast("Alle Daten gelöscht!");
toast(t('alle_daten_geloescht'));
location.replace(`${config.baseurl_selfservice}`);
})
.catch((error) => {
toast.clear();
toast.error("Profil konnte nicht gelöscht werden...");
toast.error(t('profil_konnte_nicht_geloescht_werden'));
});
}
function get_certificate() {
toast("Urkunde wird generiert...");
toast(t('urkunde_wird_generiert'));
const browserlocale = (
(navigator.languages && navigator.languages[0]) ||
""
@@ -590,7 +592,7 @@ function get_certificate() {
.then((response) => {
console.log(response);
if (response.status != "200") {
toast.error("Urkunde konnte nicht generiert werden...");
toast.error(t('urkunde_konnte_nicht_generiert_werden'));
} else {
var fileURL = window.URL.createObjectURL(
new Blob([response.data], { type: "application/pdf" })
@@ -610,17 +612,17 @@ function get_certificate() {
.catch((err) => {
console.error(err);
toast.clear();
toast.error("Urkunde konnte nicht generiert werden...");
toast.error(t('urkunde_konnte_nicht_generiert_werden'));
});
}
function get_registration() {
toast.clear();
toast("Registrierungscode wird generiert...");
toast(t('registrierungscode_wird_generiert'));
var a = document.createElement("a");
a.href = state.barcode;
a.download = "LfK25_Registrierungscode.png";
a.click();
toast.clear();
toast("Registrierungscode generiert!", { type: TYPE.SUCCESS });
toast(t('registrierungscode_generiert'), { type: TYPE.SUCCESS });
}
</script>

View File

@@ -27,7 +27,7 @@
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-2 bg-gray-50 text-gray-500 rounded-md p-2" />
<p v-if="!isEmail(user_email) && user_email !== ''" class="text-sm">{{
$t('please_provide_valid_mail')
}}</p>
}}</p>
</div>
<div class="mt-2">
<button :disabled="(!state.submit_enabled)"
@@ -63,6 +63,8 @@ import axios from "redaxios";
import isEmail from 'validator/es/lib/isEmail';
import { TYPE, useToast } from "vue-toastification";
import Footer from "@/components/Footer.vue";
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
let user_email = ref("");
//
@@ -74,16 +76,16 @@ const state = reactive({
const toast = useToast();
function resendMail() {
if (isEmail(user_email.value)) {
toast("Login-Link wird angefordert...");
toast(t('login_link_is_requested'));
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
axios.post(`${config.baseurl}api/runners/login?mail=${user_email.value}&locale=${browserlocale}`)
.then(({ data }) => {
console.log(data);
toast("Login-Link gesendet an " + user_email.value + "!");
toast(t('login_link_gesendet_an_user_email_value') + user_email.value);
})
.catch((error) => {
console.log(error);
toast("Fehler beim Anfordern des Login-Links...", { type: TYPE.ERROR });
toast(t('error_requesting_the_login_link'), { type: TYPE.ERROR });
});
}
}

View File

@@ -3,7 +3,7 @@
<div class="max-w-md w-full py-12 px-6">
<img class="mx-auto h-24 w-auto" src="/favicon-lfk.png" alt />
<h1 class="sm:text-3xl text-2xl font-medium title-font mb-4 text-center">
Lauf für Kaya! - Registriert
Lauf für Kaya! - {{ $t('registriert') }}
</h1>
<p class="mx-auto leading-relaxed text-base text-center">
Bitte klicken Sie zum Fortfahren auf den Link, den wir an
@@ -439,7 +439,13 @@ function login() {
.catch((error) => {
console.log(error);
if (error.data.message === "E-Mail already registered") {
toast("bereits registriert...", { type: TYPE.ERROR });
toast(t('already_registered'), { type: TYPE.ERROR });
} else if (error.data.message === "Invalid body, check 'errors' property for more info.") {
error.data.errors.forEach(e => {
if (e.property === "phone") {
toast(t('invalid_input_phone_number_should_be_international_format'), { type: TYPE.ERROR });
}
});
}
});
}