From 8da0fb0e36f5f004acb54e54bfbd5b31d7c786c6 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Thu, 26 Sep 2024 17:21:24 +0200 Subject: [PATCH] project blueprint - optional steps working --- .../1_miss-dior-blooming-bouquet/project.txt | 2 +- .../test/1_client-brief/client-brief.txt | 25 +++++ .../_drafts/test/2_proposal/proposal.txt | 13 +++ .../test/3_extended-brief/extended-brief.txt | 13 +++ .../test/4_virtual-sample/virtual-sample.txt | 13 +++ .../industrial-ideation.txt | 13 +++ .../physical-sample/physical-sample.txt | 13 +++ .../content/projects/_drafts/test/project.txt | 9 ++ .../content/projects/projet-test/project.txt | 29 ------ public/site/blueprints/pages/client-brief.yml | 3 + .../site/blueprints/pages/extended-brief.yml | 6 ++ .../blueprints/pages/industrial-ideation.yml | 11 +++ .../site/blueprints/pages/physical-sample.yml | 11 +++ public/site/blueprints/pages/project.yml | 14 +-- public/site/blueprints/pages/proposal.yml | 6 ++ .../pages/{sample.yml => virtual-sample.yml} | 6 ++ public/site/config/hooks/create-steps.php | 96 ++++++++++++------- public/site/models/client-brief.php | 0 public/site/models/project.php | 37 +------ public/site/plugins/icons/index.js | 6 ++ public/site/plugins/icons/index.php | 4 + public/site/templates/project.json.php | 4 +- public/site/templates/projects.json.php | 2 +- src/components/Projects.vue | 2 +- src/components/{ => project}/Project.vue | 0 src/components/project/ProjectStep.vue | 37 +++++++ .../{ => project}/brief/AddImages.vue | 0 src/components/{ => project}/brief/Intro.vue | 0 .../{ => project}/brief/ModeSelection.vue | 0 src/views/Project.vue | 48 ++++++---- 30 files changed, 296 insertions(+), 127 deletions(-) create mode 100644 public/content/projects/_drafts/test/1_client-brief/client-brief.txt create mode 100644 public/content/projects/_drafts/test/2_proposal/proposal.txt create mode 100644 public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt create mode 100644 public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt create mode 100644 public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt create mode 100644 public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt create mode 100644 public/content/projects/_drafts/test/project.txt delete mode 100644 public/content/projects/projet-test/project.txt create mode 100644 public/site/blueprints/pages/industrial-ideation.yml create mode 100644 public/site/blueprints/pages/physical-sample.yml rename public/site/blueprints/pages/{sample.yml => virtual-sample.yml} (77%) create mode 100644 public/site/models/client-brief.php create mode 100644 public/site/plugins/icons/index.js create mode 100644 public/site/plugins/icons/index.php rename src/components/{ => project}/Project.vue (100%) create mode 100644 src/components/project/ProjectStep.vue rename src/components/{ => project}/brief/AddImages.vue (100%) rename src/components/{ => project}/brief/Intro.vue (100%) rename src/components/{ => project}/brief/ModeSelection.vue (100%) diff --git a/public/content/projects/1_miss-dior-blooming-bouquet/project.txt b/public/content/projects/1_miss-dior-blooming-bouquet/project.txt index 1085a72..71ef6a8 100644 --- a/public/content/projects/1_miss-dior-blooming-bouquet/project.txt +++ b/public/content/projects/1_miss-dior-blooming-bouquet/project.txt @@ -6,7 +6,7 @@ Optionalsteps: industrialIdeation, physicalSample ---- -Currentstep: brief +Currentstep: extendedBrief ---- diff --git a/public/content/projects/_drafts/test/1_client-brief/client-brief.txt b/public/content/projects/_drafts/test/1_client-brief/client-brief.txt new file mode 100644 index 0000000..eab353a --- /dev/null +++ b/public/content/projects/_drafts/test/1_client-brief/client-brief.txt @@ -0,0 +1,25 @@ +Title: Brief client + +---- + +Stepname: clientBrief + +---- + +Stepindex: 1 + +---- + +Uuid: 8B7d4RgY8eFqvqOB + +---- + +Briefclientpdf: + +---- + +Description: + +---- + +Briefclientimages: \ No newline at end of file diff --git a/public/content/projects/_drafts/test/2_proposal/proposal.txt b/public/content/projects/_drafts/test/2_proposal/proposal.txt new file mode 100644 index 0000000..2f96a53 --- /dev/null +++ b/public/content/projects/_drafts/test/2_proposal/proposal.txt @@ -0,0 +1,13 @@ +Title: Offre commerciale + +---- + +Stepname: proposal + +---- + +Stepindex: 2 + +---- + +Uuid: AORTte4et35lhTXL \ No newline at end of file diff --git a/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt b/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt new file mode 100644 index 0000000..51dcb6e --- /dev/null +++ b/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt @@ -0,0 +1,13 @@ +Title: Brief enrichi + +---- + +Stepname: extended-brief + +---- + +Stepindex: 3 + +---- + +Uuid: oBp6AlnPTY1xpfNU \ No newline at end of file diff --git a/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt b/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt new file mode 100644 index 0000000..64a6692 --- /dev/null +++ b/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt @@ -0,0 +1,13 @@ +Title: Échantillon virtuel + +---- + +Stepname: virtualSample + +---- + +Stepindex: 5 + +---- + +Uuid: KvcDJf8bfJXQnxML \ No newline at end of file diff --git a/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt b/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt new file mode 100644 index 0000000..cb16e5d --- /dev/null +++ b/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt @@ -0,0 +1,13 @@ +Title: Idéation industrielle + +---- + +Stepname: industrialIdeation + +---- + +Stepindex: 4 + +---- + +Uuid: jGfYrEyipW8esCwk \ No newline at end of file diff --git a/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt b/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt new file mode 100644 index 0000000..b54c228 --- /dev/null +++ b/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt @@ -0,0 +1,13 @@ +Title: Échantillon physique + +---- + +Stepname: physicalSample + +---- + +Stepindex: 6 + +---- + +Uuid: IbgnF5QBMM0WsmRK \ No newline at end of file diff --git a/public/content/projects/_drafts/test/project.txt b/public/content/projects/_drafts/test/project.txt new file mode 100644 index 0000000..fb97f4a --- /dev/null +++ b/public/content/projects/_drafts/test/project.txt @@ -0,0 +1,9 @@ +Title: test + +---- + +Client: + +---- + +Uuid: 96WmogVvmpMRmgzj \ No newline at end of file diff --git a/public/content/projects/projet-test/project.txt b/public/content/projects/projet-test/project.txt deleted file mode 100644 index d1bee12..0000000 --- a/public/content/projects/projet-test/project.txt +++ /dev/null @@ -1,29 +0,0 @@ -Title: Projet Test - ----- - -Client: - page://G418qZ4ABsoWFx4i - ----- - -Briefclientpdf: - ----- - -Description: Maecenas sed diam eget risus varius blandit sit amet non magna. Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas faucibus mollis interdum. - ----- - -Briefclientimages: - ----- - -Pdf: - ----- - -Text: - ----- - -Uuid: Bdho8W2PQkSk1x21 \ No newline at end of file diff --git a/public/site/blueprints/pages/client-brief.yml b/public/site/blueprints/pages/client-brief.yml index 367e009..b9f4e40 100644 --- a/public/site/blueprints/pages/client-brief.yml +++ b/public/site/blueprints/pages/client-brief.yml @@ -21,6 +21,9 @@ tabs: columns: - width: 1/1 fields: + stepName: + type: hidden + value: test briefClientPdf: label: PDF type: files diff --git a/public/site/blueprints/pages/extended-brief.yml b/public/site/blueprints/pages/extended-brief.yml index 8093b4a..d7922c4 100644 --- a/public/site/blueprints/pages/extended-brief.yml +++ b/public/site/blueprints/pages/extended-brief.yml @@ -13,3 +13,9 @@ options: move: false duplicate: false sort: false + +tabs: + contentTab: + fields: + stepName: + type: hidden diff --git a/public/site/blueprints/pages/industrial-ideation.yml b/public/site/blueprints/pages/industrial-ideation.yml new file mode 100644 index 0000000..47227d0 --- /dev/null +++ b/public/site/blueprints/pages/industrial-ideation.yml @@ -0,0 +1,11 @@ +title: Idéation industrielle +icon: light-bulb +image: + back: black + color: white + +tabs: + contentTab: + fields: + stepName: + type: hidden diff --git a/public/site/blueprints/pages/physical-sample.yml b/public/site/blueprints/pages/physical-sample.yml new file mode 100644 index 0000000..7b69bf0 --- /dev/null +++ b/public/site/blueprints/pages/physical-sample.yml @@ -0,0 +1,11 @@ +title: Échantillon physique +icon: image +image: + back: black + color: white + +tabs: + contentTab: + fields: + stepName: + type: hidden diff --git a/public/site/blueprints/pages/project.yml b/public/site/blueprints/pages/project.yml index 84bce12..cd043fc 100644 --- a/public/site/blueprints/pages/project.yml +++ b/public/site/blueprints/pages/project.yml @@ -8,15 +8,6 @@ tabs: columns: - width: 1/1 fields: - optionalSteps: - label: Étapes optionnelles - type: checkboxes - width: 1/2 - columns: 2 - options: - industrialIdeation: Idéation industrielle - physicalSample: Échantillon physique - help: Après modification, sauvegardez et rechargez la page pour mettre à jour la liste ci-dessous. currentStep: label: Étape en cours type: radio @@ -43,11 +34,14 @@ tabs: stepsSection: label: Étapes type: pages + sortBy: stepIndex asc templates: - client-brief - proposal - extended-brief - - sample + - industrial-ideation + - virtual-sample + - physical-sample # client: # label: Client diff --git a/public/site/blueprints/pages/proposal.yml b/public/site/blueprints/pages/proposal.yml index b899325..b2d5632 100644 --- a/public/site/blueprints/pages/proposal.yml +++ b/public/site/blueprints/pages/proposal.yml @@ -13,3 +13,9 @@ options: move: false duplicate: false sort: false + +tabs: + contentTab: + fields: + stepName: + type: hidden diff --git a/public/site/blueprints/pages/sample.yml b/public/site/blueprints/pages/virtual-sample.yml similarity index 77% rename from public/site/blueprints/pages/sample.yml rename to public/site/blueprints/pages/virtual-sample.yml index 69c9873..4df9ce5 100644 --- a/public/site/blueprints/pages/sample.yml +++ b/public/site/blueprints/pages/virtual-sample.yml @@ -13,3 +13,9 @@ options: move: false duplicate: false sort: false + +tabs: + contentTab: + fields: + stepName: + type: hidden diff --git a/public/site/config/hooks/create-steps.php b/public/site/config/hooks/create-steps.php index d00a06b..afd5e9a 100644 --- a/public/site/config/hooks/create-steps.php +++ b/public/site/config/hooks/create-steps.php @@ -1,37 +1,67 @@ template() != "project") return; - - $page->createChild([ - 'slug' => 'client-brief', - 'template' => 'client-brief', - 'content' => [ - 'title' => 'Brief client' - ] - ]); - - $page->createChild([ - 'slug' => 'proposal', - 'template' => 'proposal', - 'content' => [ - 'title' => 'Offre commerciale' - ] - ]); - - $page->createChild([ - 'slug' => 'extended-brief', - 'template' => 'extended-brief', - 'content' => [ - 'title' => 'Brief enrichi' - ] - ]); - - $page->createChild([ - 'slug' => 'sample', - 'template' => 'sample', - 'content' => [ - 'title' => 'Échantillon virtuel' - ] - ]); + if ($page->template() == "project") { + kirby()->impersonate('kirby'); + + $brief = $page->createChild([ + 'slug' => 'client-brief', + 'template' => 'client-brief', + 'content' => [ + 'title' => 'Brief client', + 'stepName' => 'clientBrief', + 'stepIndex' => 1 + ], + ])->changeStatus('listed'); + + $page->createChild([ + 'slug' => 'proposal', + 'template' => 'proposal', + 'content' => [ + 'title' => 'Offre commerciale', + 'stepName' => 'proposal', + 'stepIndex' => 2 + ] + ])->changeStatus('listed'); + + $page->createChild([ + 'slug' => 'extended-brief', + 'template' => 'extended-brief', + 'content' => [ + 'title' => 'Brief enrichi', + 'stepName' => 'extended-brief', + 'stepIndex' => 3 + ] + ])->changeStatus('listed'); + + $page->createChild([ + 'slug' => 'industrial-ideation', + 'template' => 'industrial-ideation', + 'content' => [ + 'title' => 'Idéation industrielle', + 'stepName' => 'industrialIdeation', + 'stepIndex' => 4 + ] + ]); + + $page->createChild([ + 'slug' => 'virtual-sample', + 'template' => 'virtual-sample', + 'content' => [ + 'title' => 'Échantillon virtuel', + 'stepName' => 'virtualSample', + 'stepIndex' => 5 + ] + ])->changeStatus('listed'); + + $page->createChild([ + 'slug' => 'physical-sample', + 'template' => 'physical-sample', + 'content' => [ + 'title' => 'Échantillon physique', + 'stepName' => 'physicalSample', + 'stepIndex' => 6 + ] + ]); + } }; \ No newline at end of file diff --git a/public/site/models/client-brief.php b/public/site/models/client-brief.php new file mode 100644 index 0000000..e69de29 diff --git a/public/site/models/project.php b/public/site/models/project.php index f9e5b02..9e147dc 100644 --- a/public/site/models/project.php +++ b/public/site/models/project.php @@ -3,39 +3,12 @@ class ProjectPage extends Page { public function getSteps() { - $steps = [ - [ - 'text' => '1. Brief', - 'value' => 'brief' - ], - [ - 'text' => '2. Offre commerciale', - 'value' => 'proposal' - ], - [ - 'text' => '3. Brief enrichi', - 'value' => 'extendedBrief' - ], - ]; - - if (str_contains($this->optionalSteps(), 'industrialIdeation')) { - $steps[] = [ - 'text' => '4. Idéation industrielle', - 'value' => 'industrialIdeation' + $steps = array_map(function($child) { + return [ + 'text' => $child['content']['title'], + 'value' => $child['content']['stepname'] ]; - } - - $steps[] = [ - 'text' => count($steps) + 1 . '. Échantillon virtuel', - 'value' => 'virtualSample' - ]; - - if (str_contains($this->optionalSteps(), 'physicalSample')) { - $steps[] = [ - 'text' => count($steps) + 1 . '.Échantillon physique', - 'value' => 'physicalSample' - ]; - } + }, $this->children()->toArray()); return $steps; } diff --git a/public/site/plugins/icons/index.js b/public/site/plugins/icons/index.js new file mode 100644 index 0000000..9b23b75 --- /dev/null +++ b/public/site/plugins/icons/index.js @@ -0,0 +1,6 @@ +panel.plugin("my/icons", { + icons: { + "light-bulb": + '', + }, +}); diff --git a/public/site/plugins/icons/index.php b/public/site/plugins/icons/index.php new file mode 100644 index 0000000..81c56de --- /dev/null +++ b/public/site/plugins/icons/index.php @@ -0,0 +1,4 @@ + [] +]); \ No newline at end of file diff --git a/public/site/templates/project.json.php b/public/site/templates/project.json.php index 5629d2f..0fb12e7 100644 --- a/public/site/templates/project.json.php +++ b/public/site/templates/project.json.php @@ -5,7 +5,9 @@ $project = [ 'url' => $page->url(), 'modified' => $page->modified('Y-MM-d'), 'status' => $page->status(), - 'logo' => $page->client()->toPage()->logo()->toFile()->url() + 'logo' => $page->client()->toPage()->logo()->toFile()->url(), + 'currentStep' => $page->currentStep()->value(), + 'steps' => $page->getSteps() ]; $data = array_merge($genericData, $project); diff --git a/public/site/templates/projects.json.php b/public/site/templates/projects.json.php index 1015bf7..3cd43bd 100644 --- a/public/site/templates/projects.json.php +++ b/public/site/templates/projects.json.php @@ -7,7 +7,7 @@ $children = $page->children()->map(function ($child) { 'uri' => '/' . $child->uri(), 'modified' => $child->modified('Y-MM-d'), 'status' => $child->status(), - 'logo' => $child->client()->toPage()->logo()->toFile()->url() + 'logo' => $child->client()->toPage()->logo()->toFile()->url(), ]; })->values(); diff --git a/src/components/Projects.vue b/src/components/Projects.vue index 98d2f1e..d977060 100644 --- a/src/components/Projects.vue +++ b/src/components/Projects.vue @@ -33,7 +33,7 @@