re7 pages display BR page and mail only if activated in settings

This commit is contained in:
Jérémy Munsch 2023-12-07 17:05:55 +01:00
parent cae2ad7754
commit 58623e9207
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
2 changed files with 22 additions and 8 deletions

View file

@ -79,6 +79,10 @@ class Re7Controller extends Controller
$this->getRandomWeightedElementIndex($settings->web_coupons)
);
if (!$settings->reductions_activated) {
return abort(404);
}
$crmCoupon = new Reduction();
return view('theme::pages.participation.won', compact('discount', 'crmCoupon'));
}
@ -118,6 +122,12 @@ class Re7Controller extends Controller
*/
public function mailDiscount(): View
{
/** @var \App\Models\Settings */
$settings = app(Settings::class);
if (!$settings->reductions_activated) {
return abort(404);
}
return view('back::pages.re7-preview-mail', [
'render_url' => route('re7.mail-print', [
'type' => 'discount'

View file

@ -21,10 +21,12 @@
<div class="list-group">
<span class="list-group-item list-group-item-dark">{{ __('Participation') }}</span>
{{-- WON BR --}}
<a class="list-group-item list-group-item-action" href="{{ route('re7.discount') }}"
title="{{ __('Afficher un bon de réduction dans un nouvel onglet') }}"
target="_blank">{{ __('Bon de réduction') }}</a>
@if ($settingsGlobal->reductions_activated)
{{-- WON BR --}}
<a class="list-group-item list-group-item-action" href="{{ route('re7.discount') }}"
title="{{ __('Afficher un bon de réduction dans un nouvel onglet') }}"
target="_blank">{{ __('Bon de réduction') }}</a>
@endif
{{-- WON PRIZE --}}
@foreach (\App\Models\Prize::getCached() as $prize)
@ -50,10 +52,12 @@
<div class="list-group">
<span class="list-group-item list-group-item-dark">{{ __('Mails') }}</span>
{{-- WON BR MAIL --}}
<a class="list-group-item list-group-item-action" href="{{ route('re7.mail-discount') }}"
title="{{ __('Afficher le mail de bon de réduction dans un nouvel onglet') }}"
target="_blank">{{ __('Bon de réduction') }}</a>
@if ($settingsGlobal->reductions_activated)
{{-- WON BR MAIL --}}
<a class="list-group-item list-group-item-action" href="{{ route('re7.mail-discount') }}"
title="{{ __('Afficher le mail de bon de réduction dans un nouvel onglet') }}"
target="_blank">{{ __('Bon de réduction') }}</a>
@endif
{{-- WON PRIZE MAIL --}}
@foreach (\App\Models\Prize::getCached() as $prize)