feat: wip: sponsoring add

This commit is contained in:
Philipp Dormann 2025-03-17 21:43:47 +01:00
parent 34e63cf690
commit 382757aa66
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -316,14 +316,16 @@
<div>
<label for="sponsorvorname"
class="block mb-2 text-sm text-gray-700 font-medium dark:text-white">Vorname</label>
<input type="text" name="sponsorvorname" id="sponsorvorname" placeholder="Vorname des Sponsors"
<input v-bind="newsponsor_vorname" type="text" name="sponsorvorname" id="sponsorvorname"
placeholder="Vorname des Sponsors"
class="py-2.5 sm:py-3 px-4 block w-full border-gray-200 rounded-lg border sm:text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600">
</div>
<div>
<label for="sponsornachname"
class="block mb-2 text-sm text-gray-700 font-medium dark:text-white">Nachname</label>
<input type="text" name="sponsornachname" id="sponsornachname" placeholder="Nachname des Sponsors"
<input v-bind="newsponsor_nachname" type="text" name="sponsornachname" id="sponsornachname"
placeholder="Nachname des Sponsors"
class="py-2.5 sm:py-3 px-4 block w-full border-gray-200 rounded-lg border sm:text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600">
</div>
</div>
@ -334,7 +336,7 @@
<label for="sponsortel"
class="block mb-2 text-sm text-gray-700 font-medium dark:text-white">Telefonnummer des
Sponsors</label>
<input type="tel" name="sponsortel" id="sponsortel" autocomplete="tel"
<input v-bind="newsponsor_tel" type="tel" name="sponsortel" id="sponsortel" autocomplete="tel"
class="py-2.5 sm:py-3 px-4 block w-full border-gray-200 rounded-lg border sm:text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600">
</div>
@ -342,7 +344,7 @@
<label for="sponsormail"
class="block mb-2 text-sm text-gray-700 font-medium dark:text-white">E-Mail
des Sponsors</label>
<input type="email" name="sponsormail" id="sponsormail"
<input v-bind="newsponsor_mail" type="email" name="sponsormail" id="sponsormail"
class="py-2.5 sm:py-3 px-4 block w-full border-gray-200 rounded-lg border sm:text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600">
</div>
@ -351,7 +353,8 @@
<label for="eurokilometer"
class="block mb-2 text-sm text-gray-700 font-medium dark:text-white">Sponsoring pro Kilometer in
</label>
<input type="number" name="eurokilometer" id="eurokilometer" placeholder="z.B. 1€ ODER 0,50€"
<input v-bind="newsponsor_value" type="number" name="eurokilometer" id="eurokilometer"
placeholder="z.B. 1€ ODER 0,50€"
class="py-2.5 sm:py-3 px-4 block w-full border-gray-200 rounded-lg border sm:text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600">
</div>
</div>
@ -361,11 +364,11 @@
<!-- Checkbox -->
<div class="mt-3 flex">
<div class="flex">
<input id="remember-me" name="remember-me" type="checkbox"
<input v-model="newsponsor_check" id="sponsor_agree" name="sponsor_agree" type="checkbox"
class="shrink-0 mt-1.5 border-gray-200 rounded-sm text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800">
</div>
<div class="ms-3">
<label for="remember-me" class="text-sm text-gray-600 dark:text-neutral-400">Mit dem Absenden
<label for="sponsor_agree" class="text-sm text-gray-600 dark:text-neutral-400">Mit dem Absenden
bestätige ich, dass der Sponsor mit der Übermittlung seiner Daten einverstanden ist und ich dessen
Berechtigung habe</label>
</div>
@ -373,7 +376,7 @@
<!-- End Checkbox -->
<!-- <div class="mt-6 grid"> -->
<button type="button"
<button :disabled="!newsponsor_check" @click="addSponsoring" type="button"
class="py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-teal-100 text-teal-800 hover:bg-teal-200 focus:outline-hidden focus:bg-teal-200 disabled:opacity-50 disabled:pointer-events-none dark:text-teal-500 dark:bg-teal-800/30 dark:hover:bg-teal-800/20 dark:focus:bg-teal-800/20 mt-2 cursor-pointer">
Sponsoring hinzufügen
</button>
@ -526,6 +529,13 @@ import Footer from "@/components/Footer.vue";
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const mode = ref("")
//
const newsponsor_check = ref(false)
const newsponsor_value = ref("")
const newsponsor_mail = ref("")
const newsponsor_tel = ref("")
const newsponsor_vorname = ref("")
const newsponsor_nachname = ref("")
function textToBase64Barcode(text) {
const canvas = document.createElement("canvas");
@ -623,6 +633,26 @@ axios
.catch((error) => {
toast.error(t('profil_konnte_nicht_geladen_werden'));
});
function addSponsoring() {
const postdata = {
"receiptNeeded": false,
"firstname": newsponsor_vorname.value,
"middlename": "",
"lastname": newsponsor_nachname.value,
"phone": newsponsor_tel.value,
"email": newsponsor_mail.value,
"address": {}
}
console.log(postdata);
axios
.post(`${config.baseurl}api/donors`, postdata)
.then(({ data }) => {
console.log(data);
})
.catch((error) => {
//
});
}
function delete_me() {
toast.clear();
toast(t('profil_wird_geloescht'));