]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7774 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 3 Oct 2025 16:02:56 +0000 (18:02 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 3 Oct 2025 16:02:56 +0000 (18:02 +0200)
app/Http/Controllers/Admin/Operations/FluidbookPublication/Services/PumaOperation.php

index 5d7b09006d0405903f87063970ae807edef76c6a..c918f694fffd5dec62344c260ba9348d1e9458ab 100644 (file)
@@ -16,18 +16,18 @@ trait PumaOperation
     protected function setupPumaRoutes($segment, $routeName, $controller)
     {
         foreach (['services', 's'] as $s) {
-            Route::get($s . '/puma/planogramme/{id}_{cid}/{references}/{format?}/{filename?}', $controller . '@pumaPlanogramme')->middleware([CORSMiddleware::class])->withoutMiddleware([CheckIfAdmin::class, Authenticate::class, VerifyCsrfToken::class]);
+            Route::get($s . '/puma/planogramme/{id}_{cid}/{references}/{format?}/{filename?}/{pa?}/{pvp?}', $controller . '@pumaPlanogramme')->middleware([CORSMiddleware::class])->withoutMiddleware([CheckIfAdmin::class, Authenticate::class, VerifyCsrfToken::class]);
         }
     }
 
-    protected function pumaPlanogramme($id, $cid, $references, $format = 'html', $filename = '')
+    protected function pumaPlanogramme($id, $cid, $references, $format = 'html', $filename = '', $pa = 1, $pvp = 1)
     {
         if ($format === 'pdf') {
             $tmp = Files::tempnam() . '.pdf';
 
             $cl = new CommandLine('node');
             $cl->setArg(null, resource_path('puma/planogramme/print.js'));
-            $cl->setArg('url', 'https://' . $_SERVER['HTTP_HOST'] . '/s/puma/planogramme/' . $id . '_' . $cid . '/' . rawurlencode($references)) . '/html/' . $filename;
+            $cl->setArg('url', 'https://' . $_SERVER['HTTP_HOST'] . '/s/puma/planogramme/' . $id . '_' . $cid . '/' . rawurlencode($references) . '/html/' . $filename . '/' . $pa . '/' . $pvp);
             $cl->setArg('output', $tmp);
             $cl->execute();
             return response()->download($tmp, $filename . '.pdf')->deleteFileAfterSend(true);
@@ -120,7 +120,19 @@ trait PumaOperation
                         $html .= '<h3>' . $reference . '</h3>';
                         $html .= '<div>' . $product['Désignation'] ?? '' . '</div>';
                         $html .= '<div>' . $product['Color Name'] ?? '' . '</div>';
-                        $html .= '<div>PA : ' . number_format(floatval($product['Tarif'] ?? 0), 2, ',', ' ') . ' € / PVP : ' . number_format(floatval($product['PVC'] ?? 0), 2, ',', ' ') . ' €</div>';
+                        if ($pa || $pvp) {
+                            $html .= '<div>';
+                            if ($pa) {
+                                $html .= 'PA : ' . number_format(floatval($product['Tarif'] ?? 0), 2, ',', ' ') . ' € ';
+                            }
+                            if ($pa && $pvp) {
+                                $html .= ' / ';
+                            }
+                            if ($pvp) {
+                                $html .= 'PVP : ' . number_format(floatval($product['PVC'] ?? 0), 2, ',', ' ') . ' €';
+                            }
+                            $html .= '</div>';
+                        }
                         $html .= '</div>';
                         $html .= '</article>';
                     }