user role client : give access to panel account

This commit is contained in:
isUnknown 2025-01-27 18:22:03 +01:00
parent 8ff30c7f34
commit bcaf287235
7 changed files with 84 additions and 84 deletions

View file

@ -1,11 +0,0 @@
title: Client
description: Ne peut pas accéder au Panel, peut accéder aux Projets auxquels il est assigné côté front.
permissions:
access:
panel: false
fields:
projects:
label: Projets
type: pages
query: page('projects').children

View file

@ -1,21 +0,0 @@
title: Interne Pochet
description: Peux accéder au Panel mais pas aux Utilisateurs, peut accéder aux Projets auxquels il est assigné par un Admin.
home: /panel/pages/projects
permissions:
access:
users: false
fields:
job:
label: Métier
type: select
options:
- Project Manager
- Sales Manager
default: Project Panager
width: 1/4
projects:
label: Projets
type: pages
query: page('projects').children
width: 3/4

View file

@ -2,7 +2,22 @@ title: Client
description: Ne peut pas accéder au Panel, peut accéder aux Projets auxquels il est assigné côté front. description: Ne peut pas accéder au Panel, peut accéder aux Projets auxquels il est assigné côté front.
permissions: permissions:
access: access:
panel: false *: false
panel: true
account: true
projects: false
clients: false
design-to-light: false
inspirations: false
materials: false
creations: false
pages: false
options:
update:
client: false
changeRole: false
delete: false
fields: fields:
client: client:

View file

@ -1,24 +1,15 @@
<?php <?php
return [ $menu = [
// 'site' => [ 'website' => [
// 'label' => 'Dashboard', "label" => "Ouvrir le site",
// 'icon' => 'dashboard', "icon" => "open",
// 'current' => function (string $current): bool { "link" => "https://designtopack.morphozbygroupepochet.com",
// // the links of all your custom menu entries 'current' => function (string $current): bool {
// $links = [ return false;
// 'pages/clients', }
// 'pages/projects', ],
// 'pages/inspirations', "-",
// 'pages/notifications',
// 'pages/reunions'
// ];
// $path = Kirby\Cms\App::instance()->path();
// return
// $current === 'site' &&
// A::every($links, fn ($link) => Str::contains($path, $link) === false);
// }
// ],
'projects' => [ 'projects' => [
'label' => 'Projets', 'label' => 'Projets',
'icon' => 'folder', 'icon' => 'folder',
@ -76,16 +67,9 @@ return [
} }
], ],
'-', '-',
// 'reunions' => [
// 'label' => 'Réunions',
// 'icon' => 'calendar',
// 'link' => 'pages/reunions',
// 'current' => function (string $current): bool {
// $path = Kirby\Cms\App::instance()->path();
// return Str::contains($path, 'pages/reunions');
// }
// ],
'-', '-',
'users', 'users',
'system' 'system'
]; ];
return $menu;

View file

@ -94,7 +94,7 @@
</nav> </nav>
<footer class="w-full"> <footer class="w-full">
<ul class="flex"> <ul class="flex">
<li data-icon="user" v-if="user?.role !== 'client'"> <li data-icon="user">
<a href="/panel/account" @click="collapse()">Profil</a> <a href="/panel/account" @click="collapse()">Profil</a>
</li> </li>
<li data-icon="logout"> <li data-icon="logout">

View file

@ -13,17 +13,20 @@
<h2 class="font-serif text-lg">Demander la création dun projet</h2> <h2 class="font-serif text-lg">Demander la création dun projet</h2>
</template> </template>
<form @submit.prevent="handleSubmit" class="w-full h-full p-16 flex flex-col" style="--row-gap: 1rem"> <form
@submit.prevent="handleSubmit"
class="w-full h-full p-16 flex flex-col"
style="--row-gap: 1rem"
>
<label for="project-title" class="sr-only">Nom du projet</label> <label for="project-title" class="sr-only">Nom du projet</label>
<input <input
type="text" type="text"
v-model="title" v-model="title"
id="project-title" id="project-title"
placeholder="Nom du projet" placeholder="Nom du projet"
class="w-full rounded-md border border-grey-200 px-16 py-12" class="w-full rounded-md border border-grey-200 px-16 py-12"
required required
> />
<label for="project-details" class="sr-only">Détails du projet</label> <label for="project-details" class="sr-only">Détails du projet</label>
<textarea <textarea
@ -37,29 +40,45 @@
required required
></textarea> ></textarea>
<div id="project-dtl" class="w-full text-left rounded-md border border-grey-200 text-grey-800 p-12" style="align-self: flex-start"> <div
<input id="dtl" type="checkbox" v-model="isDTLEnabled"> id="project-dtl"
<label for="dtl" class="flex font-medium mt-4" style="--column-gap: var(--space-4)"> class="w-full text-left rounded-md border border-grey-200 text-grey-800 p-12"
Créer avec <span class="flex justify-center text-sm" data-icon="leaf">Design to Light</span> style="align-self: flex-start"
>
<input id="dtl" type="checkbox" v-model="isDTLEnabled" />
<label
for="dtl"
class="flex font-medium mt-4"
style="--column-gap: var(--space-4)"
>
Créer avec
<span class="flex justify-center text-sm" data-icon="leaf"
>Design to Light</span
>
</label> </label>
<p class="text-sm mt-8 mb-4"> <p class="text-sm mt-8 mb-4">
Découvrez la note environnementale de votre projet et allégez limpact de votre projet grâce à nos expertises doptimisation du poids de flacon. Découvrez la note environnementale de votre projet et allégez limpact
de votre projet grâce à nos expertises doptimisation du poids de
flacon.
</p> </p>
<router-link to="/design-to-light" class="text-sm font-medium">En savoir plus</router-link> <router-link to="/design-to-light" class="text-sm font-medium"
>En savoir plus</router-link
>
</div> </div>
<footer class="flex-columns w-full mt-auto" style="column-gap: .5rem"> <footer class="flex-columns w-full mt-auto" style="column-gap: 0.5rem">
<button class="btn btn--black-10" @click="emits('close')">Annuler</button> <button class="btn btn--black-10" @click="emits('close')">
Annuler
</button>
<button class="btn" type="submit">Soumettre</button> <button class="btn" type="submit">Soumettre</button>
</footer> </footer>
</form> </form>
</Dialog> </Dialog>
</template> </template>
<script setup> <script setup>
import Dialog from "primevue/dialog"; import Dialog from "primevue/dialog";
import { ref } from "vue"; import { ref, watch } from "vue";
import { useApiStore } from "../stores/api"; import { useApiStore } from "../stores/api";
const title = ref(""); const title = ref("");
@ -69,6 +88,12 @@ const api = useApiStore();
const isOpen = ref(true); const isOpen = ref(true);
const emits = defineEmits("close"); const emits = defineEmits("close");
watch(isOpen, (newValue) => {
if (!newValue) {
emits("close");
}
});
async function handleSubmit() { async function handleSubmit() {
const formData = { const formData = {
title: title.value, title: title.value,

View file

@ -1,8 +1,14 @@
<template> <template>
<main class="flex flex-col" style="--row-gap: var(--space-32)"> <main class="flex flex-col" style="--row-gap: var(--space-32)">
<Projects /> <Projects />
<ProjectRequestDialog v-if="isProjectRequestDialogOpen" @close="isProjectRequestDialogOpen = false" /> <ProjectRequestDialog
<ProjectRequestButton @click="isProjectRequestDialogOpen = true" /> v-if="isProjectRequestDialogOpen"
@close="isProjectRequestDialogOpen = false"
/>
<ProjectRequestButton
v-if="user.role === 'client'"
@click="isProjectRequestDialogOpen = true"
/>
</main> </main>
</template> </template>
@ -11,6 +17,8 @@ import Projects from "../components/Projects.vue";
import ProjectRequestButton from "../components/ProjectRequestButton.vue"; import ProjectRequestButton from "../components/ProjectRequestButton.vue";
import ProjectRequestDialog from "../components/ProjectRequestDialog.vue"; import ProjectRequestDialog from "../components/ProjectRequestDialog.vue";
import { ref } from "vue"; import { ref } from "vue";
import { useUserStore } from "../stores/user";
const isProjectRequestDialogOpen = ref(false); const isProjectRequestDialogOpen = ref(false);
const { user } = useUserStore();
</script> </script>