Add Form Support

This commit is contained in:
2026-05-02 19:11:09 +02:00
parent d388d7048a
commit 75b50fb9ef
15 changed files with 284 additions and 37 deletions

View File

@@ -5,8 +5,9 @@ import { ref } from "vue";
import Modal from "../Modal.vue";
import { Formular } from "../../dto/formular.dto";
async function init() {
forms.value=await RitzenbergenLib.graphqlClient.request<{formulare: Formular[] }>(`
const { $gql } = useNuxtApp();
const forms = await $gql.request<{formulare: Formular[] }>(`
{
formulare {
id
@@ -31,12 +32,8 @@ async function init() {
}
}
`
).then(data=>data.formulare);
).then(data=>data.formulare);
console.log(forms.value);
}
const forms = ref([] as Formular[]);
const props=defineProps({
formid: {
@@ -46,10 +43,8 @@ const props=defineProps({
}
});
init();
function submit($event: Event) {
const url = new URL(
/*const url = new URL(
RitzenbergenLib.RitzenbergenLib.api("/formulare/submit.php")
);
const formData = new FormData(<HTMLFormElement>$event.target);
@@ -59,7 +54,7 @@ function submit($event: Event) {
}).then(() => {
init();
values.value={};
});
});*/
}
const modalOpened=ref<boolean>(false);
@@ -107,8 +102,9 @@ const values=ref({});
data-form-title="Form Name"
:data-formid="form.id"
:data-i="i"
@submit.prevent="submit"
>
<!-- @submit.prevent="submit" -->
<div v-for="(field, j) in form.fields" :key="j">
<label
v-if="field.placeholder == null"