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 @@ - - diff --git a/src/components/Btn.vue b/src/components/Btn.vue deleted file mode 100644 index f674efe..0000000 --- a/src/components/Btn.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/src/components/ProjectRequestButton.vue b/src/components/ProjectRequestButton.vue new file mode 100644 index 0000000..ef703be --- /dev/null +++ b/src/components/ProjectRequestButton.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/components/ProjectRequestDialog.vue b/src/components/ProjectRequestDialog.vue new file mode 100644 index 0000000..422920f --- /dev/null +++ b/src/components/ProjectRequestDialog.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/stores/api.js b/src/stores/api.js index f9475e1..1e1720d 100644 --- a/src/stores/api.js +++ b/src/stores/api.js @@ -75,6 +75,28 @@ export const useApiStore = defineStore("api", () => { } } + async function requestProjectCreation(data) { + const headers = { + method: "POST", + body: JSON.stringify(data), + }; + + try { + const response = await fetch("/request-project-creation.json", headers); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const data = await response.json(); + console.log(data); + } catch (error) { + console.error( + "Une erreur s'est produite lors de l'ajout du commentaire :", + error + ); + throw error; + } + } + async function updateComment(comment) { const headers = { method: "POST", @@ -144,12 +166,6 @@ export const useApiStore = defineStore("api", () => { } } - /** - * - * @param {string} comment - * @param {string} projectId UUID or URI - * @returns status with message if error - */ async function readNotification(notificationId, projectId) { const headers = { method: "POST", @@ -233,5 +249,6 @@ export const useApiStore = defineStore("api", () => { readNotification, readAllNotifications, validateBrief, + requestProjectCreation, }; }); diff --git a/src/views/Home.vue b/src/views/Home.vue index e818944..814706c 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,9 +1,16 @@ diff --git a/src/views/Kanban.vue b/src/views/Kanban.vue index f94b243..7e18cd9 100644 --- a/src/views/Kanban.vue +++ b/src/views/Kanban.vue @@ -7,6 +7,12 @@
+ + + @@ -16,9 +22,11 @@ import Header from "../components/project/Header.vue"; import DialogWrapper from "../components/project/DialogWrapper.vue"; import { usePageStore } from "../stores/page"; import { storeToRefs } from "pinia"; -import { watch } from "vue"; +import { watch, ref } from "vue"; import { useDialogStore } from "../stores/dialog"; import { useRoute } from "vue-router"; +import DTLButton from "../components/design-to-light/DTLButton.vue"; +import DTLPanel from "../components/design-to-light/DTLPanel.vue"; const { page } = storeToRefs(usePageStore()); const dialog = useDialogStore(); @@ -29,6 +37,8 @@ if (route.query.dialog) { openDialog(route.query.dialog); } +const isDTLPanelOpen = ref(false); + watch( () => route.query.dialog, (targetStepSlug) => { @@ -43,10 +53,16 @@ watch( } ); +// Functions function openDialog(targetStepSlug) { const targetStep = page.value.steps.find( (step) => step.slug === targetStepSlug ); dialog.content = targetStep; } + +function openDTLPanel(event) { + isDTLPanelOpen.value = true; + event.stopImmediatePropagation(); +}