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

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:
query: page.logo.toFile
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
sections:

View file

@ -1,21 +1,50 @@
title: Projets
sections:
fieldsSection:
type: fields
tabs:
contentTab:
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:
clientBriefImageTags:
label: Tags des images ajoutées aux briefs
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:
width: 1/2
sections:
clients:
label: Clients
yourProjects:
label: Vos projets
type: pages
parent: site.find("clients")
template: client
search: true
query: user.projects
help: Projets pour lesquels vous êtes nommé chef de projet.
image:
back: white
query: page.client.toPage.logo.toFile
projects:
width: 1/2
sections:
projects:
extends: sections/projects
headline: Projets récement modifiés
parent: site.find("projects")
layout: list
sortBy: modified desc
settings:
label: Paramètres
icon: cog

View file

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

View file

@ -1,22 +1,31 @@
<?php
return [
'site' => [
'label' => 'Dashboard',
'icon' => 'dashboard',
// 'site' => [
// 'label' => '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 {
// 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);
$path = Kirby\Cms\App::instance()->path();
return Str::contains($path, 'pages/projects');
}
],
'clients' => [
@ -28,15 +37,6 @@ return [
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' => [
'label' => 'Inspirations',

View file

@ -32,4 +32,17 @@ class ProjectPage extends Page {
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;
}
]
]);