From f5946b042909e1eb0fa4bc4c80ae461f100cc792 Mon Sep 17 00:00:00 2001 From: R40fendt Date: Sun, 4 Jan 2026 17:58:58 +0100 Subject: [PATCH] =?UTF-8?q?AdminPanel=20erste=20Funktionen=20hinzugef?= =?UTF-8?q?=C3=BCgt=20(Formulare)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +- src/adminpanellib.ts | 15 +- src/components/admin/AdminNavbar.vue | 36 ++++ src/components/admin/InputP.vue | 64 +++++++ src/ritzenbergenlib.ts | 10 +- src/router/index.ts | 2 + src/views/adminpanel/AdminPanelLogin.vue | 3 +- src/views/adminpanel/Events.vue | 12 ++ src/views/adminpanel/Formulare.vue | 208 +++++++++++++++++++++++ src/views/adminpanel/Main.vue | 4 + 10 files changed, 349 insertions(+), 8 deletions(-) create mode 100644 src/components/admin/AdminNavbar.vue create mode 100644 src/components/admin/InputP.vue create mode 100644 src/views/adminpanel/Events.vue create mode 100644 src/views/adminpanel/Formulare.vue diff --git a/README.md b/README.md index f3c3d88..871e15c 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,5 @@ Bei der Migration beachten: - addhit URL in der index.html anpassen - Event-Datenbank anpassen - Neue Formulartabelle -- ritzenbergenlib.ts anpassen +- .env.production anpassen +- Salt ändern (secret.php in der API) diff --git a/src/adminpanellib.ts b/src/adminpanellib.ts index e05859c..d844451 100644 --- a/src/adminpanellib.ts +++ b/src/adminpanellib.ts @@ -1,5 +1,10 @@ import RitzenbergenLib from "./ritzenbergenlib"; +import { useRouter } from "vue-router"; + + class AdminPanelLib { + router=useRouter(); + static async getUserInfo(token:string){ const url=new URL(RitzenbergenLib.RitzenbergenLib.api("/admin/userinfo.php")); return fetch(url.toString(), { @@ -7,7 +12,15 @@ class AdminPanelLib { "Authorization": "Bearer "+token }, }) - .then((response)=>response.json()); + .then((response)=>response.json()) + .then((response)=>{ + if(response.error){ + window.alert(response.error); + return false; + }else{ + return response; + } + }); } } diff --git a/src/components/admin/AdminNavbar.vue b/src/components/admin/AdminNavbar.vue new file mode 100644 index 0000000..9107aec --- /dev/null +++ b/src/components/admin/AdminNavbar.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/components/admin/InputP.vue b/src/components/admin/InputP.vue new file mode 100644 index 0000000..9bdf43e --- /dev/null +++ b/src/components/admin/InputP.vue @@ -0,0 +1,64 @@ + + + diff --git a/src/ritzenbergenlib.ts b/src/ritzenbergenlib.ts index 2b47554..b24d1e6 100644 --- a/src/ritzenbergenlib.ts +++ b/src/ritzenbergenlib.ts @@ -185,8 +185,8 @@ class Formular { el.id, el.name, el.minitext, - el.public, - el.multiple + el.public==null?null:(el.public==1?true:false), + el.multiple==null?null:(el.multiple==1?true:false) ) ) ); @@ -212,12 +212,12 @@ class Formular { displayvalue: el.displayvalue, placeholder: el.placeholder, title: el.title, - required: el.required == 1, + required: el.required==null?null:(el.required==1?true:false), maxlength: el.maxlength, min: el.min, max: el.max, - multiple: el.multiple == 1, - checked: el.checked == 1, + multiple: el.multiple==null?null:(el.multiple==1?true:false), + checked: el.checked==null?null:(el.checked==1?true:false), }) ) ); diff --git a/src/router/index.ts b/src/router/index.ts index 4f40f08..c83ba63 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -16,6 +16,8 @@ const routes = [ { path: "/bulitipp/tippen", component: () => import("../views/Bulitipp.vue") }, { path: "/adminpanel/login", component: () => import("../views/adminpanel/AdminPanelLogin.vue") }, { path: "/adminpanel/:token", component: () => import("../views/adminpanel/Main.vue"), name: "adminpanel-main" }, + { path: "/adminpanel/:token/events", component: () => import("../views/adminpanel/Events.vue"), name: "adminpanel-events" }, + { path: "/adminpanel/:token/formulare", component: () => import("../views/adminpanel/Formulare.vue"), name: "adminpanel-formulare" }, { path: "/adminpanel", component: () => import("../views/adminpanel/Main.vue") }, ] diff --git a/src/views/adminpanel/AdminPanelLogin.vue b/src/views/adminpanel/AdminPanelLogin.vue index 3eba07f..9d807b2 100644 --- a/src/views/adminpanel/AdminPanelLogin.vue +++ b/src/views/adminpanel/AdminPanelLogin.vue @@ -25,6 +25,7 @@ const username=ref(""); const password=ref(""); +