From 8b8172d9f8e6e8f943fedb6c62be744c7255acf0 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 8 Apr 2023 17:16:00 +0200 Subject: [PATCH] tickets selection + login --- src/webapp/babel.config.js | 8 +- src/webapp/public/index.html | 1 + src/webapp/src/App.vue | 41 +++++- src/webapp/src/components/initial.vue | 33 +++++ .../components/{home.vue => noseatplan.vue} | 0 src/webapp/src/components/seatplan.vue | 130 ++++++++++++++++++ src/webapp/src/router/index.js | 64 ++++++++- src/webapp/src/views/AdminLoginView.vue | 8 +- src/webapp/src/views/CartView.vue | 59 ++++++++ src/webapp/src/views/HomeView.vue | 35 +++-- src/webapp/src/views/LoginView.vue | 10 +- src/webapp/src/views/OrderView.vue | 49 ++++++- src/webapp/src/views/PurchaseView.vue | 55 ++++++++ src/webapp/src/views/SignupView.vue | 20 +-- src/webapp/src/views/TicketsDetailsView.vue | 24 ++++ 15 files changed, 489 insertions(+), 48 deletions(-) create mode 100644 src/webapp/src/components/initial.vue rename src/webapp/src/components/{home.vue => noseatplan.vue} (100%) create mode 100644 src/webapp/src/components/seatplan.vue create mode 100644 src/webapp/src/views/CartView.vue create mode 100644 src/webapp/src/views/PurchaseView.vue create mode 100644 src/webapp/src/views/TicketsDetailsView.vue diff --git a/src/webapp/babel.config.js b/src/webapp/babel.config.js index e955840..c5dc6a5 100644 --- a/src/webapp/babel.config.js +++ b/src/webapp/babel.config.js @@ -1,5 +1,5 @@ module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] -} + presets: [ + '@vue/cli-plugin-babel/preset' + ] +}; diff --git a/src/webapp/public/index.html b/src/webapp/public/index.html index ac644cb..b4d7f11 100644 --- a/src/webapp/public/index.html +++ b/src/webapp/public/index.html @@ -9,6 +9,7 @@ <%= htmlWebpackPlugin.options.title %> + diff --git a/src/webapp/src/App.vue b/src/webapp/src/App.vue index 76c52b6..c2fe276 100644 --- a/src/webapp/src/App.vue +++ b/src/webapp/src/App.vue @@ -1,14 +1,20 @@ diff --git a/src/webapp/src/components/initial.vue b/src/webapp/src/components/initial.vue new file mode 100644 index 0000000..d9af8b2 --- /dev/null +++ b/src/webapp/src/components/initial.vue @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/src/webapp/src/components/home.vue b/src/webapp/src/components/noseatplan.vue similarity index 100% rename from src/webapp/src/components/home.vue rename to src/webapp/src/components/noseatplan.vue diff --git a/src/webapp/src/components/seatplan.vue b/src/webapp/src/components/seatplan.vue new file mode 100644 index 0000000..048a2c8 --- /dev/null +++ b/src/webapp/src/components/seatplan.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/src/webapp/src/router/index.js b/src/webapp/src/router/index.js index 87411da..b803b72 100644 --- a/src/webapp/src/router/index.js +++ b/src/webapp/src/router/index.js @@ -34,9 +34,35 @@ const routes = [ name: 'adminLogin', component: () => import( '../views/AdminLoginView.vue' ), meta: { - title: 'Admin - myevent' + title: 'Login :: Admin - myevent' } }, + { + path: '/admin', + name: 'admin', + component: () => import( '../views/HomeView.vue' ), + meta: { + title: 'Admin - myevent' + }, + children: [ + { + path: 'settings', + name: 'adminSettings', + component: () => import( '../views/AdminLoginView.vue' ), + meta: { + title: 'Admin - myevent' + } + }, + { + path: '', + name: 'adminMain', + component: () => import( '../views/AdminLoginView.vue' ), + meta: { + title: 'Admin - myevent' + } + }, + ] + }, { path: '/signup', name: 'signup', @@ -44,6 +70,33 @@ const routes = [ meta: { title: 'Signup - myevent' } + }, + { + path: '/tickets/details', + name: 'ticketDetails', + component: () => import( '../views/TicketsDetailsView.vue' ), + meta: { + title: 'Details - myevent', + transition: 'scale' + } + }, + { + path: '/cart', + name: 'cart', + component: () => import( '../views/CartView.vue' ), + meta: { + title: 'Cart - myevent', + transition: 'scale' + } + }, + { + path: '/purchase', + name: 'purchase', + component: () => import( '@/views/PurchaseView.vue' ), + meta: { + title: 'Purchase - myevent', + transition: 'scale' + } } ] @@ -58,4 +111,13 @@ router.afterEach( ( to, from ) => { document.title = to.meta.title ? to.meta.title : 'default title'; } ); +let disallowed = [ 'admin', 'adminMain' ]; +let isAuthenticated = true; + +router.beforeEach( ( to, from ) => { + if ( disallowed.includes( to.name ) && !isAuthenticated ) { + return { name: 'adminLogin' }; + } +} ); + export default router; diff --git a/src/webapp/src/views/AdminLoginView.vue b/src/webapp/src/views/AdminLoginView.vue index f66b401..79dad85 100644 --- a/src/webapp/src/views/AdminLoginView.vue +++ b/src/webapp/src/views/AdminLoginView.vue @@ -1,11 +1,11 @@