Merge branch 'develop' into trunk

This commit is contained in:
Jérémy Munsch 2023-09-08 13:30:40 +02:00
commit 6d764e033d
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
3 changed files with 87 additions and 84 deletions

View file

@ -73,8 +73,9 @@ class ProductResource extends JsonResource
if (count($this->product->origins)) {
$origins = "";
foreach ($this->product->origins as $originValue) {
/** @var \App\Enums\Products\OriginEnum $enumValue */
foreach (OriginEnum::toArray() as $enumValue) {
if (intval($originValue['id']) === $enumValue->value) {
if ($originValue === $enumValue->value) {
$origins = $origins . $enumValue->label . ", ";
}
}
@ -83,8 +84,9 @@ class ProductResource extends JsonResource
if (count($this->product->claims)) {
$claims = "";
foreach ($this->product->claims as $originValue) {
/** @var \App\Enums\Products\ClaimEnum $enumValue */
foreach (ClaimEnum::toArray() as $enumValue) {
if (intval($originValue['id']) === $enumValue->value) {
if ($originValue === $enumValue->value) {
if ($enumValue->value === ClaimEnum::others->value) {
$claims = $claims . $enumValue->label . ": " . $this->product->specified_claim . ", ";
} else {

View file

@ -33,8 +33,8 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
* @property array $docs
* @property string $url
* @property enum $certification
* @property object $origins
* @property object $claims
* @property array<integer> $origins
* @property array<integer> $claims
* @property string $specified_claim
* @property enum $distribution_network
* @property enum $ray

View file

@ -6,113 +6,114 @@
<table width="100%">
<tr>
@if (isset($product->picture) && !empty($product->picture))
<td class="table-cell-text-center" width="30%">
<img src="{{ public_path($product->picture) }}" alt="{{ $product->picture_alt }}" alt="{{ $product->picture_title }}">
</td>
<td width="70%">
@else
<td width="100%">
<td class="table-cell-text-center" width="30%">
<img src="{{ public_path($product->picture) }}" alt="{{ $product->picture_alt }}" alt="{{ $product->picture_title }}">
</td>
<td width="70%">
@else
<td width="100%">
@endif
@if (isset($product->brand_id->name))
@if (isset($product->brand_id->name))
<h2><strong>{{ __('Marque du produit : ') }}</strong><span>{{ $product->brand_id->name }}</span></h2>
@endif
@if (isset($product->name))
@endif
@if (isset($product->name))
<h2><strong>{{ __('Nom du produit : ') }}</strong><span>{{ $product->name }}</span></h2>
@endif
@if (isset($product->certification))
@endif
@if (isset($product->certification))
<p><strong>{{ __('Certification : ') }}</strong>{{ $product->certification }}</p>
@endif
@if (isset($product->origins))
@endif
@if (isset($product->origins))
<p><strong>{{ __('Origines : ') }}</strong>{{ Str::replaceLast(', ', '', $product->origins) }}</p>
@endif
@if (isset($product->claims))
@endif
@if (isset($product->claims))
<p><strong>{{ __('Allégations : ') }}</strong>{{ Str::replaceLast(', ', '', $product->claims) }}</p>
@endif
<table class="table" width="100%">
<tr class="table-header">
@if (isset($product->gencod))
@endif
<table class="table" width="100%">
<tr class="table-header">
@if (isset($product->gencod))
<td class="table-cell-text-center"><strong>{{ __('GENCOD') }}</strong></td>
@endif
@if (isset($product->weight))
@endif
@if (isset($product->weight))
<td class="table-cell-text-center"><strong>{{ __('Poids UVC') }}</strong></td>
@endif
@if (isset($product->pvc))
@endif
@if (isset($product->pvc))
<td class="table-cell-text-center"><strong>{{ __('PVC') }}</strong></td>
@endif
<td class="table-cell-text-center"><strong>{{ __('Prix kg') }}</strong></td>
</tr>
<tr class="table-body">
@if (isset($product->gencod))
@endif
<td class="table-cell-text-center"><strong>{{ __('Prix kg') }}</strong></td>
</tr>
<tr class="table-body">
@if (isset($product->gencod))
<td class="table-cell-text-center">{{ $product->gencod }}</td>
@endif
@if (isset($product->weight))
@endif
@if (isset($product->weight))
<td class="table-cell-text-center">{{ $product->weight }}</td>
@endif
@if (isset($product->pvc))
@endif
@if (isset($product->pvc))
<td class="table-cell-text-center">{{ $product->pvc }}€</td>
@endif
@php
$priceKg = 1000 * $product->pvc / $product->weight;
@endphp
<td class="table-cell-text-center">{{ number_format(round($priceKg, 2), 2, ',', ' ') }}€</td>
</tr>
</table>
@if (isset($product->productKeywords))
@endif
@php
$priceKg = $product->weight ? (1000 * $product->pvc) / $product->weight : 0;
@endphp
<td class="table-cell-text-center">{{ number_format(round($priceKg, 2), 2, ',', ' ') }}€</td>
</tr>
</table>
@if (isset($product->productKeywords))
<p><strong>{{ __('Tendances identifiées : ') }}</strong>{{ Str::replaceLast(', ', '', $product->productKeywords) }}</p>
@endif
@if (isset($product->distribution_network))
@endif
@if (isset($product->distribution_network))
<p><strong>{{ __('Réseau de distribution : ') }}</strong>{{ $product->distribution_network }}</p>
@endif
@if (isset($product->ray))
@endif
@if (isset($product->ray))
<p><strong>{{ __('Rayon : ') }}</strong>{{ $product->ray }}</p>
@endif
@if (isset($product->product_range))
@endif
@if (isset($product->product_range))
<p><strong>{{ __('Famille : ') }}</strong>{{ $product->product_range }}</p>
@endif
@if (isset($product->geo_area))
@endif
@if (isset($product->geo_area))
<p><strong>{{ __('Zone géographique : ') }}</strong>{{ $product->geo_area }}</p>
@endif
@endif
</td>
</tr>
</table>
@if (isset($product->freeComment))
<p><strong>{{ __('Commentaire libre : ') }}</strong>{{ strip_tags($product->freeComment) }}</p>
<p><strong>{{ __('Commentaire libre : ') }}</strong>{{ strip_tags($product->freeComment) }}</p>
@endif
@if(isset($product->productComments))
@foreach ($product->productComments as $productComment)
<p><strong>{{ __('Commentaire dégustation du : ') }}</strong>{{ $productComment->date }}</p>
<table class="table" width="100%">
<tr class="table-header">
<td class="table-cell-text-center" width="20%"><strong>{{ __('Appréciation') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Aspect') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Odeur') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Texture') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Goût') }}</strong></td>
</tr>
<tr class="table-body">
<td class="table-cell-text-center" width="20%">{{ $productComment->evaluation }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->aspect }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->taste }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->odor }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->texture }}</td>
</tr>
</table>
@endforeach
@if (isset($product->productComments))
@foreach ($product->productComments as $productComment)
<p><strong>{{ __('Commentaire dégustation du : ') }}</strong>{{ $productComment->date }}</p>
<table class="table" width="100%">
<tr class="table-header">
<td class="table-cell-text-center" width="20%"><strong>{{ __('Appréciation') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Aspect') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Odeur') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Texture') }}</strong></td>
<td class="table-cell-text-center" width="20%"><strong>{{ __('Goût') }}</strong></td>
</tr>
<tr class="table-body">
<td class="table-cell-text-center" width="20%">{{ $productComment->evaluation }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->aspect }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->taste }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->odor }}</td>
<td class="table-cell-text-center" width="20%">{{ $productComment->texture }}</td>
</tr>
</table>
@endforeach
@endif
<table width="100%" class="product-saw">
<table class="product-saw" width="100%">
<tr>
@if (isset($product->seen_at))
<td class="table-cell-text-center" width="50%">
<strong>{{ __('Téléchargez les documents :') }}</strong>
<a href="{{ route('products.download', $product->id) }}">{{ __('ICI') }}</a>
</td>
<td class="table-cell-text-center" width="50%">
<strong>{{ __('Téléchargez les documents :') }}</strong>
<a href="{{ route('products.download', $product->id) }}">{{ __('ICI') }}</a>
</td>
@endif
@if (isset($product->source))
<td class="table-cell-text-center" width="50%">
<p><strong>{{ __('Vu le : ') }}</strong>{{ $product->seen_at }}</p>
<p><strong>{{ __('Lieu : ') }}</strong>{{ $product->source }},&nbsp;{{ $product->fair }}{{ $product->shop }}{{ $product->catalogue }}</p>
<p><strong>{{ __('Par : ') }}</strong>{{ $product->user_id->firstname }}&nbsp;{{ $product->user_id->lastname }}</p>
</td>
<td class="table-cell-text-center" width="50%">
<p><strong>{{ __('Vu le : ') }}</strong>{{ $product->seen_at }}</p>
<p><strong>{{ __('Lieu : ') }}</strong>{{ $product->source }},&nbsp;{{ $product->fair }}{{ $product->shop }}{{ $product->catalogue }}
</p>
<p><strong>{{ __('Par : ') }}</strong>{{ $product->user_id->firstname }}&nbsp;{{ $product->user_id->lastname }}</p>
</td>
@endif
</tr>
</table>