create login page
This commit is contained in:
parent
6b31d89e1d
commit
5b3549068b
6 changed files with 88 additions and 42 deletions
|
|
@ -1,27 +1,31 @@
|
|||
<?php
|
||||
|
||||
return function ($page, $kirby, $site) {
|
||||
if (!$kirby->user()) {
|
||||
go($site->panel()->url());
|
||||
}
|
||||
$data = $page->toArray();
|
||||
$data['template'] = (string) $page->template();
|
||||
$data['newInspirations'] = (bool) page('inspirations')->children()->findBy('new', 'true');
|
||||
if (!$kirby->user() && $page->uri() != 'login') {
|
||||
go('/login');
|
||||
} else {
|
||||
$data = $page->toArray();
|
||||
$data['template'] = (string) $page->template();
|
||||
$data['newInspirations'] = (bool) page('inspirations')->children()->findBy('new', 'true');
|
||||
|
||||
$userData = [
|
||||
"role" => (string) $kirby->user()->role(),
|
||||
"uuid" => (string) $kirby->user()->uuid()
|
||||
];
|
||||
|
||||
if ($kirby->user()->client()->exists() && $kirby->user()->client()->isNotEmpty()) {
|
||||
$userData['client'] = [
|
||||
"name" => (string) $kirby->user()->client()->toPage()->title(),
|
||||
"uuid" => (string) $kirby->user()->client()->toPage()->uuid()
|
||||
if ($kirby->user()) {
|
||||
$userData = [
|
||||
"role" => (string) $kirby->user()->role(),
|
||||
"uuid" => (string) $kirby->user()->uuid()
|
||||
];
|
||||
|
||||
if ($kirby->user()->client()->exists() && $kirby->user()->client()->isNotEmpty()) {
|
||||
$userData['client'] = [
|
||||
"name" => (string) $kirby->user()->client()->toPage()->title(),
|
||||
"uuid" => (string) $kirby->user()->client()->toPage()->uuid()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
'genericData' => $data,
|
||||
'userData' => $userData ?? null
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'genericData' => $data,
|
||||
'userData' => $userData
|
||||
];
|
||||
};
|
||||
13
public/site/templates/login.json.php
Normal file
13
public/site/templates/login.json.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
$specificData = [
|
||||
"exampleField" => $page->exampleField(),
|
||||
"exampleHardData" => 'Example hard value'
|
||||
];
|
||||
|
||||
$pageData = array_merge($genericData, $specificData);
|
||||
|
||||
echo json_encode([
|
||||
"page" => $pageData,
|
||||
"user" => $userData
|
||||
]);
|
||||
1
public/site/templates/login.php
Normal file
1
public/site/templates/login.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php snippet('generic-template') ?>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<h1 v-if="page" class="sr-only">{{ page.content.title }}</h1>
|
||||
<div class="with-sidebar">
|
||||
<Menu />
|
||||
<div :class="{ 'with-sidebar': page?.template !== 'login' }">
|
||||
<Menu v-if="page?.template !== 'login'" />
|
||||
<RouterView />
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,60 +1,65 @@
|
|||
import Home from "../views/Home.vue";
|
||||
import Notifications from "../views/Notifications.vue";
|
||||
import Reunions from "../views/Reunions.vue";
|
||||
import Inspirations from "../views/Inspirations.vue";
|
||||
import Kanban from "../views/Kanban.vue";
|
||||
import Brief from "../views/Brief.vue";
|
||||
import DesignToLight from "../views/DesignToLight.vue";
|
||||
import Home from '../views/Home.vue';
|
||||
import Notifications from '../views/Notifications.vue';
|
||||
import Reunions from '../views/Reunions.vue';
|
||||
import Inspirations from '../views/Inspirations.vue';
|
||||
import Kanban from '../views/Kanban.vue';
|
||||
import Brief from '../views/Brief.vue';
|
||||
import DesignToLight from '../views/DesignToLight.vue';
|
||||
import Login from '../views/Login.vue';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
path: '/',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: "/notifications",
|
||||
path: '/login',
|
||||
component: Login,
|
||||
},
|
||||
{
|
||||
path: '/notifications',
|
||||
component: Notifications,
|
||||
},
|
||||
{
|
||||
path: "/reunions",
|
||||
path: '/reunions',
|
||||
component: Reunions,
|
||||
},
|
||||
{
|
||||
path: "/inspirations",
|
||||
path: '/inspirations',
|
||||
component: Inspirations,
|
||||
},
|
||||
{
|
||||
path: "/design-to-light",
|
||||
path: '/design-to-light',
|
||||
component: DesignToLight,
|
||||
},
|
||||
{
|
||||
path: "/projects/:id",
|
||||
path: '/projects/:id',
|
||||
component: Kanban,
|
||||
},
|
||||
{
|
||||
path: "/projects/:id/client-brief",
|
||||
path: '/projects/:id/client-brief',
|
||||
component: Brief,
|
||||
},
|
||||
{
|
||||
path: "/projects/:id/extended-brief",
|
||||
path: '/projects/:id/extended-brief',
|
||||
component: Brief,
|
||||
},
|
||||
|
||||
// Redirections
|
||||
{
|
||||
path: "/projects/:id/industrial-ideation",
|
||||
path: '/projects/:id/industrial-ideation',
|
||||
redirect: (to) => {
|
||||
return (
|
||||
"/projects/" +
|
||||
'/projects/' +
|
||||
to.params.id +
|
||||
"?dialog=industrial-ideation&comments=true"
|
||||
'?dialog=industrial-ideation&comments=true'
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/projects/:id/proposal",
|
||||
path: '/projects/:id/proposal',
|
||||
redirect: (to) => {
|
||||
return "/projects/" + to.params.id + "?dialog=proposal&comments=true";
|
||||
return '/projects/' + to.params.id + '?dialog=proposal&comments=true';
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
23
src/views/Login.vue
Normal file
23
src/views/Login.vue
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<form
|
||||
@submit.prevent="handleSubmit"
|
||||
class="w-full h-full p-16 flex flex-col"
|
||||
style="--row-gap: 1rem"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
v-model="subject"
|
||||
id="appointment-subject"
|
||||
placeholder="Objet du rendez-vous"
|
||||
class="w-full rounded-md border border-grey-200 px-16 py-12"
|
||||
required
|
||||
/>
|
||||
<label for="appointment-details" class="sr-only">Détails du projet</label>
|
||||
<button @click="login" class="btn" type="submit">Soumettre</button>
|
||||
</form>
|
||||
</template>
|
||||
<script setup>
|
||||
function login() {
|
||||
console.log('test');
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue