diff --git a/public/site/blueprints/files/pdf.yml b/public/site/blueprints/files/pdf.yml index d817585..7188b35 100644 --- a/public/site/blueprints/files/pdf.yml +++ b/public/site/blueprints/files/pdf.yml @@ -1,17 +1,21 @@ title: PDF focus: false -fields: - comments: - type: hidden - cover: - label: Image de couverture - type: files - multiple: false - width: 1/3 - layout: cards - uploads: pdf-cover - label: - label: Nom - type: text - width: 1/3 + +tabs: + presentation: + label: Présentation + fields: + comments: + type: hidden + cover: + label: Image de couverture + type: files + multiple: false + width: 1/3 + layout: cards + uploads: pdf-cover + label: + label: Nom + type: text + width: 1/3 diff --git a/public/site/blueprints/pages/project.yml b/public/site/blueprints/pages/project.yml index e1f8f4c..73a1bbc 100644 --- a/public/site/blueprints/pages/project.yml +++ b/public/site/blueprints/pages/project.yml @@ -50,6 +50,8 @@ tabs: - virtual-sample - physical-sample + designToLight: tabs/design-to-light + files: tabs/files notificationsTab: diff --git a/public/site/blueprints/pages/proposal.yml b/public/site/blueprints/pages/proposal.yml index 66cf7da..7389056 100644 --- a/public/site/blueprints/pages/proposal.yml +++ b/public/site/blueprints/pages/proposal.yml @@ -28,5 +28,6 @@ tabs: type: files uploads: pdf stepName: - type: hidden + type: hidden + files: tabs/files diff --git a/public/site/blueprints/pages/track.yml b/public/site/blueprints/pages/track.yml index 55b70e6..7a0134f 100644 --- a/public/site/blueprints/pages/track.yml +++ b/public/site/blueprints/pages/track.yml @@ -8,3 +8,5 @@ tabs: label: Rendu type: files required: true + + files: tabs/files diff --git a/public/site/blueprints/tabs/design-to-light.yml b/public/site/blueprints/tabs/design-to-light.yml new file mode 100644 index 0000000..3b8176a --- /dev/null +++ b/public/site/blueprints/tabs/design-to-light.yml @@ -0,0 +1,66 @@ +designToLight: +label: Design to light +icon: leaf + +columns: + - width: 2/10 + fields: + isDTLEnabled: + label: Actif + type: toggle + default: false + - width: 8/10 + fields: + DTLProposalLocation: + label: Localisation de la proposition Design to light + type: radio + options: + proposal: Proposition commerciale + industrialIdeation: Idéation industrielle + virtualSampleDynamicTrack: Échantillon virtuel - piste dynamique + virtualSampleStaticTrack: Échantillon virtuel - piste statique + when: + isDTLEnabled: true + width: 1/2 + + DTLproposal: + label: Fichier + type: files + multiple: false + query: page.find('proposal').pdf.toFiles + width: 1/2 + when: + DTLProposalLocation: proposal + + DTLindustrialIdeation: + label: Fichier + type: files + multiple: false + query: page.find('industrial-ideation').files + width: 1/2 + when: + DTLProposalLocation: industrialIdeation + + DTLVirtualSampleDynamicTrack: + label: Piste dynamique + type: pages + multiple: false + query: page.find('virtual-sample').children + width: 1/2 + when: + DTLProposalLocation: virtualSampleDynamicTrack + + DTLVirtualSampleStaticTrack: + label: Piste statique + type: files + multiple: false + query: page.find('virtual-sample').rawGlass.toFiles.add(page.find('virtual-sample').finishedGlass.toFile) + width: 1/2 + when: + DTLProposalLocation: virtualSampleStaticTrack + + DTLGrade: + label: Note globale + type: text + when: + isDTLEnabled: true diff --git a/public/site/config/menu.php b/public/site/config/menu.php index 000b244..3c2846d 100644 --- a/public/site/config/menu.php +++ b/public/site/config/menu.php @@ -40,7 +40,7 @@ return [ '-', 'design-to-light' => [ 'label' => 'Design to light', - 'icon' => 'circle', + 'icon' => 'leaf', 'link' => 'pages/design-to-light', 'current' => function (string $current): bool { $path = Kirby\Cms\App::instance()->path(); diff --git a/public/site/plugins/icons/index.js b/public/site/plugins/icons/index.js index 9b23b75..adc3ca9 100644 --- a/public/site/plugins/icons/index.js +++ b/public/site/plugins/icons/index.js @@ -2,5 +2,6 @@ panel.plugin("my/icons", { icons: { "light-bulb": '', + leaf: '', }, }); diff --git a/public/site/templates/project.json.php b/public/site/templates/project.json.php index 8c2b7cd..3500654 100644 --- a/public/site/templates/project.json.php +++ b/public/site/templates/project.json.php @@ -1,13 +1,84 @@ $page->title()->value(), - 'url' => $page->url(), - 'modified' => $page->modified('Y-MM-d'), - 'status' => $page->status(), - 'logo' => $page->client()->isNotEmpty() && $page->client()->toPage() ? $page->client()->toPage()->logo()->toFile()->url() : null, - 'steps' => $page->getSteps(), + "title" => $page->title()->value(), + "url" => $page->url(), + "modified" => $page->modified("Y-MM-d"), + "status" => $page->status(), + "logo" => $page->client()->isNotEmpty() && $page->client()->toPage() ? $page->client()->toPage()->logo()->toFile()->url() : null, + "steps" => $page->getSteps(), + "designToLight" => null ]; + if ($page->isDTLEnabled()) { + $DTLProposal = null; + $proposalLocation = $page->DTLProposalLocation()->value(); + + switch ($proposalLocation) { + case 'proposal': + $proposalPage = $page->find('proposal'); + $proposalFile = $page->DTLProposal()->toFile(); + + if ($proposalPage && $proposalFile) { + $index = $proposalPage->pdf()->toFiles()->indexOf($proposalFile); + $DTLProposal = [ + "location" => "proposal", + "path" => "/projects/" . $page->slug() . "?dialog=proposal&fileIndex=" . $index, + "date" => $proposalFile->modified("Y-MM-d"), + "stepLabel" => "Proposition commerciale", + ]; + } + break; + + case 'industrialIdeation': + $proposalPage = $page->find('industrial-ideation'); + $proposalFile = $page->DTLindustrialIdeation()->toFile(); + + if ($proposalPage && $proposalFile) { + $index = $proposalPage->pdf()->toFiles()->indexOf($proposalFile); + $DTLProposal = [ + "location" => "proposal", + "path" => "/projects/" . $page->slug() . "?dialog=industrial-ideation&fileIndex=" . $index, + "date" => $proposalFile->modified("Y-MM-d"), + "stepLabel" => "Idéation industrielle" + ]; + } + break; + + case 'virtualSampleDynamicTrack': + $proposalPage = $page->DTLVirtualSampleDynamicTrack()->toPage(); + + if ($proposalPage) { + $DTLProposal = [ + "location" => "proposal", + "path" => "/projects/" . $page->slug() . "?dialog=virtual-sample", + "date" => $proposalPage->modified("Y-MM-d"), + "stepLabel" => "Échantillon virtuel" + ]; + } + break; + + case 'virtualSampleStaticTrack': + $proposalPage = $page->find('virtual-sample'); + $proposalFile = $page->DTLVirtualSampleStaticTrack()->toFile(); + + if ($proposalPage && $proposalFile) { + $DTLProposal = [ + "location" => "proposal", + "path" => "/projects/" . $page->slug() . "?dialog=virtual-sample", + "date" => $proposalFile->modified("Y-MM-d"), + "stepLabel" => "Échantillon virtuel" + ]; + } + break; + } + + if ($page->DTLGrade()->isNotEmpty()) { + $DTLProposal["grade"] = $page->DTLGrade()->value(); + } + $project["designToLight"] = $DTLProposal; + } + + $pageData = array_merge($genericData, $project); echo json_encode([ diff --git a/src/App.vue b/src/App.vue index f4a960c..a718655 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,13 +4,19 @@ + + diff --git a/src/components/design-to-light/DTLButton.vue b/src/components/design-to-light/DTLButton.vue new file mode 100644 index 0000000..a40cd9c --- /dev/null +++ b/src/components/design-to-light/DTLButton.vue @@ -0,0 +1,11 @@ + + diff --git a/src/components/design-to-light/DTLPanel.vue b/src/components/design-to-light/DTLPanel.vue new file mode 100644 index 0000000..1f50bd1 --- /dev/null +++ b/src/components/design-to-light/DTLPanel.vue @@ -0,0 +1,34 @@ + + + +