From c822685cc1a6179c41ab98f2aa85a6a7e0922af4 Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 9 Sep 2025 14:18:59 +0200 Subject: [PATCH] wip #7706 @2:30 --- app/SubForms/News.php | 4 +- app/SubForms/OurSolutionsUSP.php | 15 +++--- app/Templates/Base.php | 5 ++ app/Templates/NotesTechniques.php | 37 +++++++++++++ .../views/pages/notes_techniques.blade.php | 54 +++++++++++++++++++ resources/views/pages/our_solutions.blade.php | 14 +++-- 6 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 app/Templates/NotesTechniques.php create mode 100644 resources/views/pages/notes_techniques.blade.php diff --git a/app/SubForms/News.php b/app/SubForms/News.php index bda9d51..e0f4a64 100644 --- a/app/SubForms/News.php +++ b/app/SubForms/News.php @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\DB; class News extends SubForm { - protected $defaultLang = 'fr'; + protected $defaultLang = 'fr'; public function init() { @@ -66,7 +66,7 @@ class News extends SubForm ]); } - public function getDataByTable($table) { + public function getDataByTable($table, $column = 'id') { $column = 'title'; $local = request()->query('locale') ?? $this->defaultLang; diff --git a/app/SubForms/OurSolutionsUSP.php b/app/SubForms/OurSolutionsUSP.php index 5f93ffc..d717909 100644 --- a/app/SubForms/OurSolutionsUSP.php +++ b/app/SubForms/OurSolutionsUSP.php @@ -3,12 +3,16 @@ namespace App\SubForms; -use App\Models\Product; use Cubist\Backpack\app\Magic\SubForm; -use App\Models\Application; +use App\SubForms\News; class OurSolutionsUSP extends SubForm { + public function getNews() { + $instance = new News(); + return $instance->getDataByTable('cubist_cms_pages'); + } + public function init() { parent::init(); @@ -30,10 +34,9 @@ class OurSolutionsUSP extends SubForm $this->addField(['name' => 'page', 'label' => 'Lien vers', - 'type' => 'SelectFromModel', - 'optionsmodel' => 'App\Models\Product', - 'multiple' => false, - 'attribute' => 'name', + 'type' => 'SelectFromArray', + 'options' => self::getNews(), + 'multiple' => false ]); } } diff --git a/app/Templates/Base.php b/app/Templates/Base.php index a93e98a..e7ebbff 100644 --- a/app/Templates/Base.php +++ b/app/Templates/Base.php @@ -29,6 +29,11 @@ class Base extends TemplatePage { $tab = 'Formulaire'; + $this->addField(['name' => 'form_title', + 'type' => 'Text', + 'label' => 'Titre du formulaire', + 'tab' => $tab]); + $this->addField(['name' => 'form_intro', 'type' => 'Markdown', 'label' => 'Texte d\'introduction du formulaire', diff --git a/app/Templates/NotesTechniques.php b/app/Templates/NotesTechniques.php new file mode 100644 index 0000000..e3565be --- /dev/null +++ b/app/Templates/NotesTechniques.php @@ -0,0 +1,37 @@ +addField(['name' => 'content', + 'type' => 'Markdown', + 'label' => 'Contenus', + 'tab'=>'Contenus']); + + $this->addField(['name' => 'faqs', + 'label' => 'FAQs', + 'type' => 'BunchOfFieldsMultiple', + 'edit_label'=>"%question", + 'bunch' => 'App\SubForms\Faq', + 'tab' => 'FAQs']); + + $this->addForm(); + } + +} diff --git a/resources/views/pages/notes_techniques.blade.php b/resources/views/pages/notes_techniques.blade.php new file mode 100644 index 0000000..67ddc63 --- /dev/null +++ b/resources/views/pages/notes_techniques.blade.php @@ -0,0 +1,54 @@ +@extends('layouts/app') + +@section('content') + + + + @markdown($page->get('content')) + + + + + + + @if($page->get('faqs')) + @foreach($page->get('faqs') as $faq) + @if($faq['response']) +
+
+
+ {{ $faq['question'] }} + @svg('arrow-down') +
+ {{ $faq['response'] }} +
+
+ @endif + @endforeach + @endif +
+
+ + {{-- --}} + + + + + {{-- Nested divs to allow grey backgrounds of columns to match the height of their content instead of total height --}} +
+ +
+ +
+
+ @form +
+
+ +
+ +
+
+ + {{-- --}} +@endsection diff --git a/resources/views/pages/our_solutions.blade.php b/resources/views/pages/our_solutions.blade.php index a9a73b0..ae0197e 100644 --- a/resources/views/pages/our_solutions.blade.php +++ b/resources/views/pages/our_solutions.blade.php @@ -66,6 +66,9 @@

{{ $market['title'] }}

+ @if($market['text']) +

{{ $market['text'] }}

+ @endif @endforeach @@ -150,8 +153,11 @@ @php($prefix = 'news') @endif
+
+                                
+                            
- + @@ -161,13 +167,13 @@ {{ $item['date'] }}

- + {{ $item['title'] }}

{{ $item['text'] }}

-

{{ __("En savoir plus") }}

+

{{ __("En savoir plus") }}

@@ -204,7 +210,7 @@ {{-- Nested divs to allow grey backgrounds of columns to match the height of their content instead of total height --}}
- +
-- 2.39.5