ldc-startcoq/resources/views/documents/product-body.blade.php
Vincent BRIDIER 4274b21eea Merge branch 'issue-53' into 'develop'
Displayed specified claims in pdf and fixed specified claims update

See merge request ldc-web/projets/startcoq!29
2023-10-20 14:25:17 +00:00

123 lines
6.2 KiB
PHP

{{-- HEADER --}}
<h1 class="header-title">{{ __('Veille produit') }}</h1>
<img class="header-logo" src="{{ public_path(Vite::asset('resources/assets/images/logo.png')) }}" alt="{{ config('app.name') }}"><br>
{{-- CONTENT --}}
<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%">
@endif
<h2><strong>{{ __('Marque du produit : ') }}</strong><span>{{ $product->brand->name }}</span></h2>
<h2><strong>{{ __('Nom du produit : ') }}</strong><span>{{ $product->name }}</span></h2>
@if (isset($product->certification))
<p><strong>{{ __('Certification : ') }}</strong>{{ $product->certification }}</p>
@endif
<p><strong>{{ __('Origines : ') }}</strong>{{ $product->origins }}</p>
<p><strong>{{ __('Allégations : ') }}</strong>
@php
$claims = Str::of($product->claims)->explode(', ');
$claimOthers = \App\Enums\Products\ClaimEnum::others->label();
@endphp
@if ($claims->contains($claimOthers))
@php
$product->claims = $claims->except(array_search('Autres', $claims->toArray()))->implode(', ');
@endphp
{{ $product->claims }}, {{ $claimOthers}}
@if ($product->specified_claim)
: {{ $product->specified_claim }}
@endif
@else
{{ $product->claims }}
@endif
</p>
<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))
<td class="table-cell-text-center"><strong>{{ __('Poids UVC') }}</strong></td>
@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))
<td class="table-cell-text-center">{{ $product->gencod }}</td>
@endif
@if (isset($product->weight))
<td class="table-cell-text-center">{{ $product->weight }} g</td>
@endif
@if (isset($product->pvc))
<td class="table-cell-text-center">{{ $product->pvc }}€</td>
@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))
<p><strong>{{ __('Réseau de distribution : ') }}</strong>{{ $product->distribution_network }}</p>
@endif
@if (isset($product->ray))
<p><strong>{{ __('Rayon : ') }}</strong>{{ $product->ray }}</p>
@endif
@if (isset($product->product_range))
<p><strong>{{ __('Famille : ') }}</strong>{{ $product->product_range }}</p>
@endif
@if (isset($product->geo_area))
<p><strong>{{ __('Zone géographique : ') }}</strong>{{ $product->geo_area }}</p>
@endif
</td>
</tr>
</table>
@if (isset($product->freeComment))
<p><strong>{{ __('Commentaire libre : ') }}</strong>{{ strip_tags($product->freeComment) }}</p>
@endif
@foreach ($product->productComments as $productComment)
<p><strong>{{ __('Commentaire dégustation du : ') }}</strong>{{ $productComment->created_at }}</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
<table class="product-saw" width="100%">
<tr>
<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>
@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->firstname }}&nbsp;{{ $product->user->lastname }}</p>
</td>
@endif
</tr>
</table>