project creation request form working
This commit is contained in:
parent
6c84f723f7
commit
c750001a2c
14 changed files with 194 additions and 89 deletions
|
|
@ -14,6 +14,15 @@ tabs:
|
|||
columns:
|
||||
- width: 1/1
|
||||
fields:
|
||||
isClientRequest:
|
||||
type: hidden
|
||||
default: "false"
|
||||
requestDetails:
|
||||
label: Demande client
|
||||
type: textarea
|
||||
disabled: true
|
||||
when:
|
||||
isClientRequest: "true"
|
||||
currentStep:
|
||||
label: Étape en cours
|
||||
type: radio
|
||||
|
|
|
|||
|
|
@ -1,40 +1,34 @@
|
|||
title: Site
|
||||
title: Projets
|
||||
|
||||
tabs:
|
||||
dashboard:
|
||||
label: Dashboard
|
||||
icon: dashboard
|
||||
contentTab:
|
||||
label: Contenu
|
||||
columns:
|
||||
- width: 1/1
|
||||
sections:
|
||||
drafts:
|
||||
extends: sections/projects
|
||||
headline: Brouillons
|
||||
status: draft
|
||||
- width: 1/1
|
||||
sections:
|
||||
listed:
|
||||
extends: sections/projects
|
||||
headline: Projets en cours
|
||||
headline: En cours
|
||||
query: user.currentProjects
|
||||
sortBy: modified desc
|
||||
- width: 1/1
|
||||
sections:
|
||||
unlisted:
|
||||
extends: sections/projects
|
||||
headline: Projets archivés
|
||||
headline: Archivés
|
||||
query: user.archivedProjects
|
||||
sortBy: modified desc
|
||||
|
||||
settings:
|
||||
label: Paramètres
|
||||
label: Réglages
|
||||
icon: cog
|
||||
columns:
|
||||
- width: 1/1
|
||||
sections:
|
||||
settings:
|
||||
label: Paramètres
|
||||
type: fields
|
||||
fields:
|
||||
description:
|
||||
label: Description
|
||||
type: text
|
||||
max: 160
|
||||
help: Description en une phrase du service
|
||||
moodboardTags:
|
||||
label: Tags des images de Brief client
|
||||
help: Ensemble des tags d’images disponibles lors de la création du Brief client
|
||||
type: tags
|
||||
fields:
|
||||
clientBriefImageTags:
|
||||
label: Tags des images ajoutées aux briefs
|
||||
type: tags
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -5,7 +5,18 @@ permissions:
|
|||
panel: false
|
||||
|
||||
fields:
|
||||
client:
|
||||
type: pages
|
||||
multiple: false
|
||||
query: site.find("clients").childrenAndDrafts
|
||||
subpages: false
|
||||
image:
|
||||
query: page.logo.toFile
|
||||
layout: cardlets
|
||||
required: true
|
||||
width: 1/3
|
||||
projects:
|
||||
label: Projets
|
||||
type: pages
|
||||
query: page('projects').children
|
||||
width: 2/3
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ return [
|
|||
require(__DIR__ . '/routes/remove-file.php'),
|
||||
require(__DIR__ . '/routes/upload-pdf.php'),
|
||||
require(__DIR__ . '/routes/validate-brief.php'),
|
||||
require(__DIR__ . '/routes/request-project-creation.php'),
|
||||
],
|
||||
'hooks' => [
|
||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
||||
|
|
|
|||
37
public/site/config/routes/request-project-creation.php
Normal file
37
public/site/config/routes/request-project-creation.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => 'request-project-creation.json',
|
||||
'method' => 'POST',
|
||||
'action' => function () {
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json);
|
||||
|
||||
$client = kirby()->user()->client()->toPage()->uuid();
|
||||
|
||||
$projectData = [
|
||||
"slug" => esc(Str::slug($data->title)),
|
||||
"template" => "project",
|
||||
"content" => [
|
||||
"title" => esc($data->title),
|
||||
"requestDetails" => esc("Demande de " . kirby()->user()->name() . " (" . kirby()->user()->email() . ") : \n\n" . $data->details),
|
||||
"client" => [$client],
|
||||
"isClientRequest" => "true",
|
||||
"isDTLEnabled" => esc($data->isDTLEnabled)
|
||||
]
|
||||
];
|
||||
|
||||
$projects = page("projects");
|
||||
try {
|
||||
$projects->createChild($projectData);
|
||||
return [
|
||||
"status" => "success",
|
||||
];
|
||||
} catch (\Throwable $th) {
|
||||
return [
|
||||
"status" => "error",
|
||||
"message" => $th->getMessage() . " in " . $th->getFile() . " line " . $th->getLine()
|
||||
];
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue