Merge branch 'issue-53' into 'develop'
Displayed specified claims in pdf and fixed specified claims update See merge request ldc-web/projets/startcoq!29
This commit is contained in:
commit
4274b21eea
3 changed files with 22 additions and 2 deletions
|
|
@ -34,6 +34,7 @@ class ProductResource extends JsonResource
|
|||
'certification' => null,
|
||||
'origins' => null,
|
||||
'claims' => null,
|
||||
'specified_claim' => null,
|
||||
'distribution_network' => null,
|
||||
'ray' => null,
|
||||
'product_range' => null,
|
||||
|
|
@ -83,6 +84,7 @@ class ProductResource extends JsonResource
|
|||
'certification' => \optional($this->product->certification)->label(),
|
||||
'origins' => $this->product->origins_enum->map(fn (OriginEnum $enum) => $enum->label())->implode(', '),
|
||||
'claims' => $this->product->claims_enum->map(fn (ClaimEnum $enum) => $enum->label())->implode(', '),
|
||||
'specified_claim' => $this->product->specified_claim,
|
||||
'distribution_network' => $this->product->distribution_network->label(),
|
||||
'ray' => $this->product->ray->label(),
|
||||
'product_range' => $this->product->product_range->label(),
|
||||
|
|
|
|||
|
|
@ -185,7 +185,9 @@ class Product extends Model
|
|||
{
|
||||
$check = false;
|
||||
foreach ($model->claims as $claimValue) {
|
||||
$check = (intval($claimValue) === \App\Enums\Products\ClaimEnum::others->value) ? true : false;
|
||||
if (!$check) {
|
||||
$check = (intval($claimValue) === \App\Enums\Products\ClaimEnum::others->value) ? true : false;
|
||||
}
|
||||
}
|
||||
$model->specified_claim = ($check) ? $model->specified_claim : null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,23 @@
|
|||
<p><strong>{{ __('Certification : ') }}</strong>{{ $product->certification }}</p>
|
||||
@endif
|
||||
<p><strong>{{ __('Origines : ') }}</strong>{{ $product->origins }}</p>
|
||||
<p><strong>{{ __('Allégations : ') }}</strong>{{ $product->claims }}</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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue