From f789ed3cbe93f2991be8f618f76dd5b585a12729 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 12 Jan 2026 17:58:48 +0100 Subject: [PATCH] wait #7932 @1 --- app/Console/Commands/Migration.php | 1 + .../Controllers/Admin/PdfFileController.php | 37 ++-- app/Models/Poll.php | 95 ++++++++++ resources/sass/admin.scss | 5 + resources/views/admin/pdfFiles/show.blade.php | 168 +++++++++--------- 5 files changed, 203 insertions(+), 103 deletions(-) create mode 100644 app/Models/Poll.php diff --git a/app/Console/Commands/Migration.php b/app/Console/Commands/Migration.php index 5a730f8..9618f56 100644 --- a/app/Console/Commands/Migration.php +++ b/app/Console/Commands/Migration.php @@ -72,6 +72,7 @@ class Migration extends Command `rclone sync olds3:prescription-sante /application/storage/s3/`; Artisan::call('psq:fluidbook:archives'); + Artisan::call('migrate', ['--force' => true]); Artisan::call('optimize:clear'); } } diff --git a/app/Http/Controllers/Admin/PdfFileController.php b/app/Http/Controllers/Admin/PdfFileController.php index 94948c9..9dedccc 100644 --- a/app/Http/Controllers/Admin/PdfFileController.php +++ b/app/Http/Controllers/Admin/PdfFileController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Admin; use A17\Twill\Http\Controllers\Admin\ModuleController; -use App\PdfFile; class PdfFileController extends ModuleController { @@ -15,7 +14,7 @@ class PdfFileController extends ModuleController // 'publish' => false, 'delete' => false, 'restore' => false, - + 'edit' => false, ]; protected $indexColumns = [ @@ -23,25 +22,25 @@ class PdfFileController extends ModuleController 'title' => 'Titre', 'field' => 'title' ], - 'viewCount' => [ - 'title' => 'Vues', - 'field' => 'viewCount' - ] +// 'viewCount' => [ +// 'title' => 'Vues', +// 'field' => 'viewCount' +// ] ]; - public function edit($id, $submoduleId = null) - { - /** @var PdfFile $pdf */ - $pdf = PdfFile::with(['trackedLinks']) - ->find($id); - - \View::share('pdf', $pdf); - \View::share('batch', $pdf->emailBatch); - - \View::share('stats', optional($pdf->emailBatch)->statistics()); - - return view('admin.pdfFiles.show'); - } +// public function edit($id, $submoduleId = null) +// { +// /** @var PdfFile $pdf */ +// $pdf = PdfFile::with(['trackedLinks']) +// ->find($id); +// +// \View::share('pdf', $pdf); +// \View::share('batch', $pdf->emailBatch); +// +// \View::share('stats', optional($pdf->emailBatch)->statistics()); +// +// return view('admin.pdfFiles.show'); +// } } diff --git a/app/Models/Poll.php b/app/Models/Poll.php new file mode 100644 index 0000000..0a2b16e --- /dev/null +++ b/app/Models/Poll.php @@ -0,0 +1,95 @@ + 'Question ouverte (texte)', + 'poll_check_check' => 'Question fermée (choix multiples)', + 'poll_check_radio' => 'Question fermée (choix unique)', + ]; + + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function entries() + { + return $this->hasMany(PollEntry::class); + } + + /** + * @return int + */ + public function getEntriesCountAttribute(): int + { + return $this->entries()->count(); + } + + + /** + * @return Collection + */ + public function getQuestions() + { + $questions = $this->blocks()->whereNull('parent_id')->get(); + + return $questions->map(function(Block $q) { + $q->options = $q->children; + $subtype = $q->input('type'); + $subtype = $subtype === null ? + '' : + "_$subtype"; + + return [ + 'type' => $type = $q->type.$subtype, + 'type_str' => self::$pollTypes[$type] ?? 'Type inconnu', + 'question' => $question = $q->input('question'), + 'slug' => Str::slug($question), + 'position' => $q->position, + 'choices' => $q->children->map(function(Block $choice) { + return [ + 'position' => $choice->position, + 'option' => $choice->input('option'), + 'slug' => Str::slug($choice->input('option')), + ]; + }) + ]; + })->filter(fn($q) => $q['question'] !== null); + + } + + /** + * @return string + */ + public function getUrlAttribute(): string + { + return route('poll.show', ['slug' => $this->slug]) ?? '#'; + } +} diff --git a/resources/sass/admin.scss b/resources/sass/admin.scss index 3200ee5..d38f70a 100644 --- a/resources/sass/admin.scss +++ b/resources/sass/admin.scss @@ -71,6 +71,11 @@ } } +a.tablecell__name:not([href]) span{ + color:#000 !important; + text-decoration: none !important; +} + /*Vue material*/ diff --git a/resources/views/admin/pdfFiles/show.blade.php b/resources/views/admin/pdfFiles/show.blade.php index 83e50e5..80b3b91 100644 --- a/resources/views/admin/pdfFiles/show.blade.php +++ b/resources/views/admin/pdfFiles/show.blade.php @@ -2,91 +2,91 @@ @section('content') -
-
-
-
- @if($batch) -

Email envoyé :

- - @endif - @if($pdf) -
-

Lettre :

- Cover - Lire - @foreach($pdf->headlines ?? [] as $headline) - - - @endforeach - @endif -
-
-

{{$batch->subject ?? $pdf->title}}

-

{{$batch->dateString ?? $pdf->created_at}}

-
- @if($pdf) -
-

Statistiques de lecture

-
-
- -
-
- -
- @endif - @unless($stats === null) -
-

Statistiques mailing

-
-
- -
-
- -
-
- -
-
- -
-
- -
- @else -
-

Cette lettre n'a pas été envoyée via la plateforme. Les statistiques d'envoi ne sont pas disponibles

-
- @endif -
+{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{-- @if($batch)--}} +{{--

Email envoyé :

--}} +{{-- --}} +{{-- @endif--}} +{{-- @if($pdf)--}} +{{--
--}} +{{--

Lettre :

--}} +{{-- Cover--}} +{{-- Lire--}} +{{-- @foreach($pdf->headlines ?? [] as $headline)--}} +{{-- --}} +{{-- --}} +{{-- @endforeach--}} +{{-- @endif--}} +{{--
--}} +{{--
--}} +{{--

{{$batch->subject ?? $pdf->title}}

--}} +{{--

{{$batch->dateString ?? $pdf->created_at}}

--}} +{{--
--}} +{{-- @if($pdf)--}} +{{--
--}} +{{--

Statistiques de lecture

--}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{-- @endif--}} +{{-- @unless($stats === null)--}} +{{--
--}} +{{--

Statistiques mailing

--}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{-- @else--}} +{{--
--}} +{{--

Cette lettre n'a pas été envoyée via la plateforme. Les statistiques d'envoi ne sont pas disponibles

--}} +{{--
--}} +{{-- @endif--}} +{{--
--}} - @if($pdf) -
-

Links

- - - - - - - - - @foreach($pdf->trackedLinks as $link) - - - - - @endforeach - -
TitreClics
{!! $link->title !!}{{$link->clicks}}
-
- @endif +{{-- @if($pdf)--}} +{{--
--}} +{{--

Links

--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- @foreach($pdf->trackedLinks as $link)--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- @endforeach--}} +{{-- --}} +{{--
TitreClics
{!! $link->title !!}{{$link->clicks}}
--}} +{{--
--}} +{{-- @endif--}} -
-
-
+{{--
--}} +{{--
--}} +{{--
--}} -
+{{--
--}} @endsection -- 2.39.5