diff --git a/public/site/blueprints/pages/project.yml b/public/site/blueprints/pages/project.yml index 73a1bbc..bcd9bab 100644 --- a/public/site/blueprints/pages/project.yml +++ b/public/site/blueprints/pages/project.yml @@ -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 diff --git a/public/site/blueprints/site.yml b/public/site/blueprints/site.yml index d58899d..b02086c 100644 --- a/public/site/blueprints/site.yml +++ b/public/site/blueprints/site.yml @@ -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 diff --git a/public/site/blueprints/users/0_client.yml b/public/site/blueprints/users/0_client.yml deleted file mode 100644 index cf2109b..0000000 --- a/public/site/blueprints/users/0_client.yml +++ /dev/null @@ -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 diff --git a/public/site/blueprints/users/1_pochet.yml b/public/site/blueprints/users/1_pochet.yml deleted file mode 100644 index bd66784..0000000 --- a/public/site/blueprints/users/1_pochet.yml +++ /dev/null @@ -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 diff --git a/public/site/blueprints/users/client.yml b/public/site/blueprints/users/client.yml index cf2109b..8114170 100644 --- a/public/site/blueprints/users/client.yml +++ b/public/site/blueprints/users/client.yml @@ -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 diff --git a/public/site/config/config.php b/public/site/config/config.php index ea51f43..018f3ba 100644 --- a/public/site/config/config.php +++ b/public/site/config/config.php @@ -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'), diff --git a/public/site/config/routes/request-project-creation.php b/public/site/config/routes/request-project-creation.php new file mode 100644 index 0000000..3b2d70e --- /dev/null +++ b/public/site/config/routes/request-project-creation.php @@ -0,0 +1,37 @@ + '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() + ]; + } + } +]; diff --git a/src/App.vue b/src/App.vue index e86df3b..160956b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,28 +4,12 @@