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);
$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>';
}