SYNC 14 Setup prizes add picture + normalize + make usage of all fields + add image/resizer

This commit is contained in:
Jérémy Munsch 2023-12-06 11:18:16 +01:00
parent e9ee968289
commit 396d47230e
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
11 changed files with 130 additions and 115 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

View file

@ -3,6 +3,10 @@
return [
'name' => 'base',
'models' => [
'prizes' => [
'picture_max_width' => 560,
'picture_max_height' => 700,
],
'products' => [
'picture_max_width' => 550,
'picture_max_height' => 550,
@ -12,4 +16,51 @@ return [
'picture_max_height' => 355,
],
],
/**
* Format can specifiy to which format save the image
* JPEG PNG GIF TIF BMP ICO PSD WebP
* GD ✔️ ✔️ ✔️ - - - - ✔️ *
* Imagick ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ *
* For WebP support GD driver must be used with PHP 5 >= 5.5.0 or PHP 7
* in order to use imagewebp(). If Imagick is used, it must be compiled
* with libwebp for WebP support.
* resize => will resize the image (boolean)
* fit => Combine cropping and resizing to format image in a smart way (boolean)
* keepRatio => will keep image ratio wile resizing (boolean)
* trim => boolean to trim the image using border color
* inCanvas => to make sure image boundarie is respected
* format => select tha wantd ouput form, yan can just convert images if you want
* example :
* 'small' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'trim' => ['transparent', null, 10]
* ],
* 'smallWebp' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'format' => 'webp'
* ],
* 'justconvertImage' => [
* 'format' => 'webp'
* ]
*/
'resizes' => [
'trimlot1' => [
'height' => 700,
'width' => 560,
'inCanvas' => true,
'trim' => ['transparent', null, 10],
'format' => 'png'
],
'trimlot2' => [
'height' => 476,
'width' => 355,
'inCanvas' => true,
'trim' => ['transparent', null, 10],
'format' => 'png'
]
]
];

View file

@ -2,7 +2,8 @@
<section>
<div>
<p>Bonjour,</p>
<p>Le lot suivant a été gagné : <b>{{ $participation->instantWin()->first()->prize->label_one }}</b> le {{ \Carbon\Carbon::parse($participation->created_at)->format('d/m/Y à H:i') }}</p><br>
<p>Le lot suivant a été gagné : <b>{{ $participation->instantWin()->first()->prize->label }}</b> le
{{ \Carbon\Carbon::parse($participation->created_at)->format('d/m/Y à H:i') }}</p><br>
<p><b>Gagnant :</b></p>
<p>{{ $participation->user->lastname }} {{ $participation->user->firstname }}</p>
<p>{{ $participation->user->address }}</p>
@ -10,10 +11,12 @@
<p>{{ $participation->user->address2 }}</p>
@endif
<p>{{ $participation->user->postal_code }} {{ $participation->user->town }} - {{ $participation->user->country }}</p>
<p>{{ $participation->user->email }}</p><br/>
<p><b>Codes utilisé@if ($settings->use_ean_codes)s @endif :</b></p>
<p>{{ $participation->user->email }}</p><br />
<p><b>Codes utilisé@if ($settings->use_ean_codes)
s
@endif :</b></p>
@if ($settings->use_ean_codes)
<p>- Code On Pack : {{ $participation->codeEan->code }}</p>
<p>- Code On Pack : {{ $participation->codeEan->code }}</p>
@endif
<p>- Code Unique : {{ $participation->code->code_unique }}</p>
</div>

View file

@ -176,7 +176,7 @@
<div
style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">
Vous venez de gagner 1 {{ $prize->label_one ?? 'gain Test' }} en participant &agrave;
Vous venez de gagner 1 {{ $prize->label ?? 'gain Test' }} en participant &agrave;
notre grand jeu Gauloisirs 2022 !<br>
Vous recevrez prochainement votre dotation &agrave; votre domicile. <br>
</div>

View file

@ -1,19 +1,19 @@
<p>Bonjour,</p>
<p>Vous trouverez en PJ les preuves de gain du joueur suivant :</p>
<p>
<b>Lot : {{ $participation->instantWin()->first()->prize->label_one ?? ''}}</b><br/>
{{$user->lastname}} {{$user->firstname}}<br/>
{{$user->address}}<br/>
<b>Lot : {{ $participation->instantWin()->first()->prize->label ?? '' }}</b><br />
{{ $user->lastname }} {{ $user->firstname }}<br />
{{ $user->address }}<br />
@if ($user->address2 !== null)
{{$user->address2}}<br/>
{{ $user->address2 }}<br />
@endif
{{$user->postal_code}} {{$user->town}} - {{$user->country}}<br/>
{{$user->email}}
{{ $user->postal_code }} {{ $user->town }} - {{ $user->country }}<br />
{{ $user->email }}
</p>
<p>Codes utilisés :</p>
<p>
@if ($settings->use_ean_codes)
Code On Pack : {{ $participation->codeEan->code }}<br/>
Code On Pack : {{ $participation->codeEan->code }}<br />
@endif
Code Unique : {{ $participation->code->code_unique ?? ''}}
Code Unique : {{ $participation->code->code_unique ?? '' }}
</p>

View file

@ -22,15 +22,14 @@
<div class="d-flex justify-content-center justify-content-xl-start">
<div class="ms-xl-5 me-2">
<span
class="bg-tertiary fs-3 rounded-pill fw-bold px-3 py-1 text-white">{{ optional(Arr::get($prizesGlobal, 0))->quantity }}</span>
class="bg-tertiary fs-3 rounded-pill fw-bold px-3 py-1 text-white">{{ Arr::get($prizesGlobal, 0)->quantity }}</span>
</div>
<h3 class="text-tertiary fw-bold fs-3 text-uppercase lh-1">
{!! clean(nl2br(__("Wonderbox \nLoisirs"))) !!}
{{ Arr::get($prizesGlobal, 0)->label }}
</h3>
</div>
<img class="img-fluid anti-rotate"
src="{{ Vite::asset('resources/theme/mounted/assets/images/view-lot1.png') }}"
title="{{ __('Wonderbox Loisir en famille') }}" alt="{{ __('Wonderbox Loisir en famille') }}">
<img class="img-fluid anti-rotate" src="{{ asset(Arr::get($prizesGlobal, 0)->picture) }}"
title="{{ Arr::get($prizesGlobal, 0)->picture_title }}" alt="{{ Arr::get($prizesGlobal, 0)->picture_alt }}">
</div>
@endif
@if (Arr::has($prizesGlobal, 1))
@ -41,13 +40,14 @@
class="bg-tertiary fs-3 rounded-pill fw-bold px-3 py-1 text-white">{{ optional(Arr::get($prizesGlobal, 1))->quantity }}</span>
</div>
<h3 class="text-tertiary fw-bold fs-3 text-uppercase lh-1">
{!! clean(nl2br(__("Wonderbox \nHappy Day"))) !!}
{{ Arr::get($prizesGlobal, 1)->label }}
</h3>
</div>
<div class="lot2--img">
<div>
<img class="img-fluid anti-rotate"
src="{{ Vite::asset('resources/theme/mounted/assets/images/view-lot2.png') }}"
title="{{ __('Wonderbox Happy Day') }}" alt="{{ __('Wonderbox Happy Day') }}">
src="{{ asset(resize(Arr::get($prizesGlobal, 1)->picture), 'trimlot2') }}"
title="{{ Arr::get($prizesGlobal, 1)->picture_title }}"
alt="{{ Arr::get($prizesGlobal, 1)->picture_alt }}">
</div>
<div class="d-flex align-items-center justify-content-center flex-column flex-lg-row mt-3">
<span class="text-primary fw-bold text-uppercase">{!! clean(nl2br(__("Ou des milliers\n de bons\n de réduction"))) !!}</span>
@ -134,54 +134,45 @@
<i class="fa-solid fa-play"></i>
<i class="fa-solid fa-pause d-none"></i>
</button>
<button class="bg-quint active" data-bs-target="#carousel-lots" data-bs-slide-to="0" type="button" aria-current="true"
aria-label="{{ __('Slide :n', ['n' => 1]) }}"></button>
<button class="bg-quint" data-bs-target="#carousel-lots" data-bs-slide-to="1" type="button"
aria-label="{{ __('Slide :n', ['n' => 2]) }}"></button>
@foreach ($prizesGlobal as $prizeIndex => $prizeModel)
<button class="bg-quint @if ($loop->first) active @endif" data-bs-target="#carousel-lots"
data-bs-slide-to="{{ $prizeIndex }}" type="button" aria-label="{{ __('Slide :n', ['n' => $prizeIndex + 1]) }}"
@if ($loop->first) aria-current="true" @endif></button>
@endforeach
</div>
<div class="carousel-inner overflow-visible">
<div class="carousel-item active overflow-visible">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-4 col-lg-6 text-md-end text-center">
<img class="img-fluid" src="{{ Vite::asset('resources/theme/mounted/assets/images/view-lot1.png') }}"
title="{{ __('Wonderbox Loisir en famille') }}" alt="{{ __('Wonderbox Loisir en famille') }}">
</div>
<div class="col d-flex justify-content-start align-items-center overflow-visible">
<div
class="d-inline-block text-bg-quint main-rotate carousel-text-pannel mx-md-4 p-md-4 mx-lg-5 p-lg-5 overflow-visible">
<div class="anti-rotate m-3 p-1">
<h3 class="fs-3 text-md-start text-center">{!! clean(nl2br(__("Wonderbox \n loisirs"))) !!}</h3>
<p>{{ __('1 activité pour 2 à 6 personnes') }}</p>
<p>{{ __('1640 activités en famille : cinéma, visite d’un zoo ou d’un château, spectacle au théâtre, cirque, balade en bateau, randonnée équestre, atelier culinaire… Les petits et les grands vont se régaler : sortie à l’aquarium de Paris pour faire connaissance avec ses 10 000 pensionnaires, atelier culinaire pour savourer une bonne dose de bonheur, découverte du bassin de la Villette en bateau électrique, rencontre avec le nouveau monde de Mini World Lyon…') }}
</p>
@foreach ($prizesGlobal as $prizeIndex => $prizeModel)
<div class="carousel-item @if ($loop->first) active @endif overflow-visible">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-4 col-lg-6 text-md-end text-center">
@if ($loop->index === 0)
{{-- RESIZE FOR SPECIFIC PRIZE PICTURE --}}
<img class="img-fluid" src="{{ asset(resize($prizeModel->picture), 'trimlot1') }}"
title="{{ $prizeModel->picture_title }}" alt="{{ $prizeModel->picture_alt }}">
@elseif ($loop->index === 1)
{{-- RESIZE FOR SPECIFIC PRIZE PICTURE --}}
<img class="img-fluid" src="{{ asset(resize($prizeModel->picture), 'trimlot2') }}"
title="{{ $prizeModel->picture_title }}" alt="{{ $prizeModel->picture_alt }}">
@else
<img class="img-fluid" src="{{ asset($prizeModel->picture) }}"
title="{{ $prizeModel->picture_title }}" alt="{{ $prizeModel->picture_alt }}">
@endif
</div>
<div class="col d-flex justify-content-start align-items-center overflow-visible">
<div
class="d-inline-block text-bg-quint main-rotate carousel-text-pannel mx-md-4 p-md-4 mx-lg-5 p-lg-5 overflow-visible">
<div class="anti-rotate m-3 p-1">
<h3 class="fs-3 text-md-start text-center">{{ $prizeModel->arg_title }}</h3>
<h4>{{ $prizeModel->arg_subtitle }}</h4>
<div class="ck-content">{!! clean($prizeModel->arg_content) !!}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="carousel-item overflow-visible">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-4 col-lg-6 text-md-end text-center">
<img class="img-fluid" src="{{ Vite::asset('resources/theme/mounted/assets/images/view-lot2.png') }}"
title="{{ __('Wonderbox Happy Day') }}" alt="{{ __('Wonderbox Happy Day') }}">
</div>
<div class="col d-flex justify-content-center align-items-center overflow-visible">
<div
class="d-inline-block text-bg-quint main-rotate carousel-text-pannel mx-md-4 p-md-4 mx-lg-5 p-lg-5 overflow-visible">
<div class="anti-rotate m-3 p-1">
<h3 class="fs-3 text-md-start text-center">{!! clean(nl2br(__("Wonderbox \n Happy Day"))) !!}</h3>
<p>{{ __('1 activité pour 1 à 2 personnes') }}</p>
<p>{{ __('Plus de 2500 activités : laser game, bowling, balade en canoë, cinéma, repas, dégustation de macarons… Besoin d’une super activité pour déconnecter ? Soyez prêts, vous allez adorer cette journée : parties de bowling endiablées à Châlons-en-Champagne, séance de Taï Chi ou de Wing Chung à Bordeaux ou pizza à déguster face à Notre-Dame de Paris… Voici tout ce dont vous avez besoin pour apprécier un Happy Day !') }}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
<button class="carousel-control-prev" data-bs-target="#carousel-lots" data-bs-slide="prev" type="button">
<span class="carousel-control-prev-icon btn btn-primary rounded-pill p-3" aria-hidden="true"></span>

View file

@ -1,45 +1,24 @@
<section class="container pb-5 pt-5 text-center" id="{{ $sectionId }}">
<div class="mobile--menu">
<div class="title--bloc view-lot1">
<div class="title--txt">
<h1 class="post-title">Félicitations&nbsp;!</h1>
<p class="info2">Vous avez gagné un {{ $prizeModel->label_one }} !<br>
Pour recevoir votre cadeau, vous devez envoyer vos preuves d'achat.
Voir modalités ci dessous.
</p>
</div>
<div class="bg-opacity"></div>
<section class="d-none container pb-5 pt-5 text-center" id="{{ $sectionId }}">
<div class="row">
<div class="col">
<img class="img-fluid" src="{{ asset($prizeModel->picture) }}" title="{{ $prizeModel->picture_title }}"
alt="{{ $prizeModel->picture_alt }}">
</div>
<div class="play--bloc">
<div class="main-btn">
<a href="#winproof">>></a>
</div>
</div>
{{-- <div class="play--bloc">
<p class="strong">Vous possédez un autre code&nbsp;?</p>
<div class="main-btn">
<a href="{{route('saisir-code')}}">Je rejoue</a>
</div>
</div> --}}
</div>
<div class="desktop--menu">
<div class="img--bloc view-lot1"></div>
<div class="txt--bloc">
<div class="bloc--rotate">
<h1 class="post-title">Félicitations&nbsp;!</h1>
<p>Vous avez gagné un {{ $prizeModel->label_one }} !<br>
Pour recevoir votre cadeau, vous devez envoyer vos preuves d'achat.
Voir modalités ci dessous.
</p>
<div class="main-btn">
<a href="#winproof">>></a>
</div>
{{-- <p class="strong">Vous possédez un autre code&nbsp;?</p>
<div class="main-btn">
<a href="{{route('saisir-code')}}">Je rejoue</a>
</div> --}}
</div>
<div class="col">
<span class="fs-1">{{ __("Félicitations\u{00A0}!") }}</span>
<p>{{ __('Vous avez gagné un :model !', [
'model' => $prizeModel->label,
]) }}
<br>
@if ($settingsGlobal->winning_proof)
{{ __('Pour recevoir votre cadeau, vous devez envoyer vos preuves d\'achat. Voir modalités ci dessous.') }}
@else
{{ __('Vous serez prochainement contacté via vos coordonées d\'inscription pour recevoir votre lot.') }}
@endif
</p>
@if ($settingsGlobal->winning_proof)
<a href="#{{ $winProofAnchor }}">&raquo;</a>
@endif
</div>
</div>
</section>

View file

@ -18,6 +18,7 @@
@include('theme::pages.participation.parts.prize', [
'sectionId' => 'prize-section',
'prizeModel' => $prizeModel,
'winProofAnchor' => 'winproof',
])
@elseif (!empty($discount))
{{-- COUPON --}}
@ -30,15 +31,5 @@
throw new \RuntimeException('Unhandled win case');
@endphp
@endif
@endsection
@push('scripts')
<script>
//set default degree (360*5)
var degree = 1800;
//number of clicks = 0
var clicks = 0;
var thisWinAngle = 1400;
</script>
@endpush