]> _ Git - psq.git/commitdiff
wait #7932 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Jan 2026 16:58:48 +0000 (17:58 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Jan 2026 16:58:48 +0000 (17:58 +0100)
app/Console/Commands/Migration.php
app/Http/Controllers/Admin/PdfFileController.php
app/Models/Poll.php [new file with mode: 0644]
resources/sass/admin.scss
resources/views/admin/pdfFiles/show.blade.php

index 5a730f84d05528f0407abe1404ea7969208f075a..9618f56768ccc4ad3b83855de8c944830f72ed35 100644 (file)
@@ -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');
     }
 }
index 94948c9e2f49915790e4713c5ed49d1a086c09f2..9dedcccf81884f4ffb4577a47f13de8d59c2fa93 100644 (file)
@@ -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 (file)
index 0000000..0a2b16e
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Models;
+
+use A17\Twill\Models\Behaviors\HasBlocks;
+use A17\Twill\Models\Behaviors\HasSlug;
+use A17\Twill\Models\Behaviors\HasMedias;
+use A17\Twill\Models\Block;
+use A17\Twill\Models\Model;
+use App\PollEntry;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Str;
+
+/**
+ * Class Poll
+ * @package App\Models
+ * @property-read int $entriesCount
+ */
+class Poll extends Model implements HasUrl
+{
+    use HasBlocks, HasSlug, HasMedias;
+
+    protected $fillable = [
+        'published',
+        'title',
+        'description',
+    ];
+
+    public $slugAttributes = [
+        'title',
+    ];
+
+    public static $pollTypes = [
+        'poll_text' => '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]) ?? '#';
+    }
+}
index 3200ee520ddd2f70e7a15c1c62c4cfce06c62c30..d38f70a4d902ea687d2aaeae6660da128c718b08 100644 (file)
     }
 }
 
+a.tablecell__name:not([href]) span{
+    color:#000 !important;
+    text-decoration: none !important;
+}
+
 
 /*Vue material*/
 
index 83e50e5ee0b65408f97eb1a200450409c3536060..80b3b911464d14ed08bf466a8db39a84b82bbcc3 100644 (file)
@@ -2,91 +2,91 @@
 
 @section('content')
 
-    <div class="bootstrap">
-        <div class="container mt-4">
-            <div class="row">
-                <div class="col-6">
-                    @if($batch)
-                    <h3>Email envoyé : </h3>
-                    <iframe class="mb-4" width="100%" height="600px" srcdoc="{{ $batch->render() }}" frameborder="0"></iframe>
-                    @endif
-                    @if($pdf)
-                    <hr>
-                    <h3>Lettre :</h3>
-                    <img src="{{$pdf->coverUrl}}" alt="Cover" style="max-width: 400px;" class="d-block m-auto">
-                        <a href="{{route('admin.preview', ['slug' => $pdf->slug])}}" target="_blank" class="btn btn-primary mt-3">Lire</a>
-                        @foreach($pdf->headlines ?? [] as $headline)
-                            <x-headline :headline="$headline" class="mt-3">
-                            </x-headline>
-                        @endforeach
-                    @endif
-                </div>
-                <div class="col-6">
-                    <h1>{{$batch->subject ?? $pdf->title}}</h1>
-                    <p>{{$batch->dateString ?? $pdf->created_at}}</p>
-                    <div class="row">
-                        @if($pdf)
-                            <div class="col-12">
-                                <h3>Statistiques de lecture</h3>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="opened" custom-metric="{{$pdf->viewCount}}" custom-label="Lectures authentifiées"></mg-stats>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="opened" custom-metric="{{$pdf->accessLogs()->count()}}" custom-label="Lectures totales"></mg-stats>
-                            </div>
-                        @endif
-                        @unless($stats === null)
-                            <div class="col-12">
-                                <h3 class="mt-3">Statistiques mailing</h3>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="delivered" current="{{$stats['delivered'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="reçus"></mg-stats>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="opened" current="{{$stats['opened'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="ouverts"></mg-stats>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="clicked" current="{{$stats['clicked'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="cliqués"></mg-stats>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="suppressed" current="{{$stats['suppressed'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="annulés"></mg-stats>
-                            </div>
-                            <div class="col-md-6 mt-2">
-                                <mg-stats icon="failed" current="{{$stats['failed'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="erreur"></mg-stats>
-                            </div>
-                        @else
-                            <div class="col-12 mt-3">
-                                <p>Cette lettre n'a pas été envoyée via la plateforme. Les statistiques d'envoi ne sont pas disponibles</p>
-                            </div>
-                        @endif
-                    </div>
+{{--    <div class="bootstrap">--}}
+{{--        <div class="container mt-4">--}}
+{{--            <div class="row">--}}
+{{--                <div class="col-6">--}}
+{{--                    @if($batch)--}}
+{{--                    <h3>Email envoyé : </h3>--}}
+{{--                    <iframe class="mb-4" width="100%" height="600px" srcdoc="{{ $batch->render() }}" frameborder="0"></iframe>--}}
+{{--                    @endif--}}
+{{--                    @if($pdf)--}}
+{{--                    <hr>--}}
+{{--                    <h3>Lettre :</h3>--}}
+{{--                    <img src="{{$pdf->coverUrl}}" alt="Cover" style="max-width: 400px;" class="d-block m-auto">--}}
+{{--                        <a href="{{route('admin.preview', ['slug' => $pdf->slug])}}" target="_blank" class="btn btn-primary mt-3">Lire</a>--}}
+{{--                        @foreach($pdf->headlines ?? [] as $headline)--}}
+{{--                            <x-headline :headline="$headline" class="mt-3">--}}
+{{--                            </x-headline>--}}
+{{--                        @endforeach--}}
+{{--                    @endif--}}
+{{--                </div>--}}
+{{--                <div class="col-6">--}}
+{{--                    <h1>{{$batch->subject ?? $pdf->title}}</h1>--}}
+{{--                    <p>{{$batch->dateString ?? $pdf->created_at}}</p>--}}
+{{--                    <div class="row">--}}
+{{--                        @if($pdf)--}}
+{{--                            <div class="col-12">--}}
+{{--                                <h3>Statistiques de lecture</h3>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="opened" custom-metric="{{$pdf->viewCount}}" custom-label="Lectures authentifiées"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="opened" custom-metric="{{$pdf->accessLogs()->count()}}" custom-label="Lectures totales"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                        @endif--}}
+{{--                        @unless($stats === null)--}}
+{{--                            <div class="col-12">--}}
+{{--                                <h3 class="mt-3">Statistiques mailing</h3>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="delivered" current="{{$stats['delivered'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="reçus"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="opened" current="{{$stats['opened'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="ouverts"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="clicked" current="{{$stats['clicked'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="cliqués"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="suppressed" current="{{$stats['suppressed'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="annulés"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                            <div class="col-md-6 mt-2">--}}
+{{--                                <mg-stats icon="failed" current="{{$stats['failed'] ?? 0}}" total="{{$stats['total'] ?? 0}}" text="erreur"></mg-stats>--}}
+{{--                            </div>--}}
+{{--                        @else--}}
+{{--                            <div class="col-12 mt-3">--}}
+{{--                                <p>Cette lettre n'a pas été envoyée via la plateforme. Les statistiques d'envoi ne sont pas disponibles</p>--}}
+{{--                            </div>--}}
+{{--                        @endif--}}
+{{--                    </div>--}}
 
-                    @if($pdf)
-                        <div class="mt-5 box p-2">
-                            <h2>Links</h2>
-                            <table class="table table-hover">
-                                <thead>
-                                <tr>
-                                    <th>Titre</th>
-                                    <th>Clics</th>
-                                </tr>
-                                </thead>
-                                <tbody>
-                                @foreach($pdf->trackedLinks as $link)
-                                    <tr>
-                                        <td><a href="{!! $link->target !!}" target="_blank">{!! $link->title !!}</a></td>
-                                        <td>{{$link->clicks}}</td>
-                                    </tr>
-                                @endforeach
-                                </tbody>
-                            </table>
-                        </div>
-                    @endif
+{{--                    @if($pdf)--}}
+{{--                        <div class="mt-5 box p-2">--}}
+{{--                            <h2>Links</h2>--}}
+{{--                            <table class="table table-hover">--}}
+{{--                                <thead>--}}
+{{--                                <tr>--}}
+{{--                                    <th>Titre</th>--}}
+{{--                                    <th>Clics</th>--}}
+{{--                                </tr>--}}
+{{--                                </thead>--}}
+{{--                                <tbody>--}}
+{{--                                @foreach($pdf->trackedLinks as $link)--}}
+{{--                                    <tr>--}}
+{{--                                        <td><a href="{!! $link->target !!}" target="_blank">{!! $link->title !!}</a></td>--}}
+{{--                                        <td>{{$link->clicks}}</td>--}}
+{{--                                    </tr>--}}
+{{--                                @endforeach--}}
+{{--                                </tbody>--}}
+{{--                            </table>--}}
+{{--                        </div>--}}
+{{--                    @endif--}}
 
-                </div>
-            </div>
-        </div>
+{{--                </div>--}}
+{{--            </div>--}}
+{{--        </div>--}}
 
-    </div>
+{{--    </div>--}}
 @endsection