reorganize panel:

- project blueprints : add managers field
- projects blueprint : re organize, add 'Vos projets' section based on custom user method
- menu : hide dashboard item (useless)
This commit is contained in:
isUnknown 2024-11-11 11:43:34 +01:00
parent d3e73bc8de
commit 4f60dc91d3
15 changed files with 110 additions and 150 deletions

View file

@ -10,4 +10,8 @@ Client: - page://G418qZ4ABsoWFx4i
---- ----
Managers: - user://WWjXgPWk
----
Uuid: jDag30qUf8zyiEwC Uuid: jDag30qUf8zyiEwC

View file

@ -1,25 +0,0 @@
Title: Brief client
----
Stepname: clientBrief
----
Stepindex: 1
----
Uuid: 5NGq8baScF9pCeK9
----
Pdf:
----
Description:
----
Moodboard:

View file

@ -1,13 +0,0 @@
Title: Offre commerciale
----
Stepname: proposal
----
Stepindex: 2
----
Uuid: b1ZjuC8nDSXOOBf9

View file

@ -1,13 +0,0 @@
Title: Brief enrichi
----
Stepname: extended-brief
----
Stepindex: 3
----
Uuid: cOMCwMHw0SRwCDjD

View file

@ -1,13 +0,0 @@
Title: Échantillon virtuel
----
Stepname: virtualSample
----
Stepindex: 5
----
Uuid: FouVvjVPGInE74Yv

View file

@ -1,13 +0,0 @@
Title: Idéation industrielle
----
Stepname: industrialIdeation
----
Stepindex: 4
----
Uuid: 2B5pbQQ6BrcDHGnG

View file

@ -1,13 +0,0 @@
Title: Échantillon physique
----
Stepname: physicalSample
----
Stepindex: 6
----
Uuid: XdHzenC81EA7rS4e

View file

@ -1,9 +0,0 @@
Title: test
----
Client:
----
Uuid: Wz0hErzk7ltN2qT8

View file

@ -28,6 +28,10 @@ tabs:
image: image:
query: page.logo.toFile query: page.logo.toFile
layout: cardlets layout: cardlets
managers:
label: Chefs de projet
type: users
help: Utilisateurs autorisés à intervenir sur ce projet et notifiés lorsque quelqu'un intervient dessus.
- width: 2/3 - width: 2/3
sections: sections:

View file

@ -1,21 +1,50 @@
title: Projets title: Projets
sections: tabs:
fieldsSection: contentTab:
type: fields label: Contenu
columns:
- width: 1/1
sections:
drafts:
extends: sections/projects
headline: Brouillons
status: draft
- width: 1/2
sections:
yourProjects:
label: Vos projets
type: pages
query: user.projects
create: false
help: Projets pour lesquels vous êtes nommé chef de projet.
image:
query: page.client.toPage.logo.toFile
listed:
extends: sections/projects
headline: En cours
layout: list
info: "étape : {{ page.getStepLabel }}"
status: listed
- width: 1/2
sections:
modifiedProjects:
extends: sections/projects
create: false
headline: Projets récement modifiés
sortBy: modified desc
layout: list
image:
query: page.client.toPage.logo.toFil
unlisted:
extends: sections/projects
headline: Archivés
status: unlisted
settings:
label: Réglages
icon: cog
fields: fields:
clientBriefImageTags: clientBriefImageTags:
label: Tags des images ajoutées aux briefs label: Tags des images ajoutées aux briefs
type: tags type: tags
drafts:
extends: sections/projects
headline: Brouillons
status: draft
listed:
extends: sections/projects
headline: En cours
status: listed
unlisted:
extends: sections/projects
headline: Archivés
status: unlisted

View file

@ -8,23 +8,16 @@ tabs:
clients: clients:
width: 1/2 width: 1/2
sections: sections:
clients: yourProjects:
label: Clients label: Vos projets
type: pages type: pages
parent: site.find("clients") query: user.projects
template: client help: Projets pour lesquels vous êtes nommé chef de projet.
search: true
image: image:
back: white query: page.client.toPage.logo.toFile
projects: projects:
width: 1/2 width: 1/2
sections: sections:
projects:
extends: sections/projects
headline: Projets récement modifiés
parent: site.find("projects")
layout: list
sortBy: modified desc
settings: settings:
label: Paramètres label: Paramètres
icon: cog icon: cog

View file

@ -1,4 +1,5 @@
title: Admin title: Admin
home: /panel/pages/projects
fields: fields:
notifications: notifications:

View file

@ -1,22 +1,31 @@
<?php <?php
return [ return [
'site' => [ // 'site' => [
'label' => 'Dashboard', // 'label' => 'Dashboard',
'icon' => 'dashboard', // 'icon' => 'dashboard',
// 'current' => function (string $current): bool {
// // the links of all your custom menu entries
// $links = [
// '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' => [
'label' => 'Projets',
'icon' => 'folder',
'link' => 'pages/projects',
'current' => function (string $current): bool { 'current' => function (string $current): bool {
// the links of all your custom menu entries $path = Kirby\Cms\App::instance()->path();
$links = [ return Str::contains($path, 'pages/projects');
'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);
} }
], ],
'clients' => [ 'clients' => [
@ -28,15 +37,6 @@ return [
return Str::contains($path, 'pages/clients'); return Str::contains($path, 'pages/clients');
} }
], ],
'projects' => [
'label' => 'Projets',
'icon' => 'folder',
'link' => 'pages/projects',
'current' => function (string $current): bool {
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/projects');
}
],
'-', '-',
'inspirations' => [ 'inspirations' => [
'label' => 'Inspirations', 'label' => 'Inspirations',

View file

@ -32,4 +32,17 @@ class ProjectPage extends Page {
return $steps; return $steps;
} }
public function getStepLabel() {
$stepsLabel = [
"clientBrief" => "brief",
"proposal" => "offre commerciale",
"extendedBrief" => "brief enrichi",
"industrialIdeation" => "idéation industrielle",
"virtualSample" => "échantillon virtuel",
"physicalSample" => "échantillon physique",
];
return $stepsLabel[$this->currentStep()->value()];
}
} }

View file

@ -0,0 +1,15 @@
<?php
Kirby::plugin('adrienpayet/pdc-your-projects', [
'userMethods' => [
'projects' => function() {
$allProjects = page('projects')->children();
$managedProjects = $allProjects->filter(
fn ($project) => $project->managers()->toUsers()->has($this)
);
return $managedProjects;
}
]
]);