feat(products): add price info section to product details
This update introduces a new price information section in the product details view, enhancing user experience by providing clear pricing details.
This commit is contained in:
parent
769949b3c3
commit
7a6c154e5f
4 changed files with 147 additions and 142 deletions
|
|
@ -1,100 +1,98 @@
|
|||
@if (!empty($productWithPricing->product->inco->nv_kj))
|
||||
<div class="accordion rounded-4 overflow-hidden shadow-sm" id="accordion-product-details">
|
||||
<div class="accordion rounded-4 overflow-hidden shadow-sm" id="accordion-product-details">
|
||||
|
||||
@if (!empty($productWithPricing->product->inco->ingredients))
|
||||
<div class="accordion-item border-0">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed fw-semibold text-dark bg-primary py-3" data-bs-toggle="collapse"
|
||||
data-bs-target="#ingredientsList" type="button" aria-expanded="false" aria-controls="ingredientsList"
|
||||
aria-label="{{ __('See the list of ingredients') }}">
|
||||
<img class="text-success wh-20px me-2" src="{{ Vite::asset('resources/assets/images/icons/icon_check.png') }}" alt=""
|
||||
aria-hidden="true">
|
||||
{{ __('Ingredients') }}
|
||||
</button>
|
||||
</h2>
|
||||
<div class="accordion-collapse collapse" id="ingredientsList" data-bs-parent="#accordion-product-details">
|
||||
<div class="accordion-body bg-light text-secondary lh-lg mh-250px-scroll">
|
||||
{!! clean($productWithPricing->product->inco->ingredients ?? '') !!}
|
||||
@if (!empty($productWithPricing->product->inco->allergens))
|
||||
<div class="border-top border-secondary-subtle mt-3 pt-3">
|
||||
<strong class="text-dark small text-uppercase d-block mb-1">{{ __('Allergens') }} :</strong>
|
||||
<span class="text-danger small fw-medium">{{ $productWithPricing->product->inco->allergens }}</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="accordion-item border-top border-0">
|
||||
@if (!empty($productWithPricing->product->inco->ingredients))
|
||||
<div class="accordion-item border-0">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed fw-semibold text-dark bg-primary py-3" data-bs-toggle="collapse"
|
||||
data-bs-target="#nutritionalValues" type="button" aria-expanded="false" aria-controls="nutritionalValues"
|
||||
aria-label="{{ __('See nutritional values') }}">
|
||||
<img class="wh-20px me-2" src="{{ Vite::asset('resources/assets/images/icons/icon_search.png') }}" alt=""
|
||||
data-bs-target="#ingredientsList" type="button" aria-expanded="false" aria-controls="ingredientsList"
|
||||
aria-label="{{ __('See the list of ingredients') }}">
|
||||
<img class="text-success wh-20px me-2" src="{{ Vite::asset('resources/assets/images/icons/icon_check.png') }}" alt=""
|
||||
aria-hidden="true">
|
||||
{{ __('Nutritional values') }}
|
||||
{{ __('Ingredients') }}
|
||||
</button>
|
||||
</h2>
|
||||
<div class="accordion-collapse collapse" id="nutritionalValues" data-bs-parent="#accordion-product-details">
|
||||
<div class="accordion-body bg-light mh-350px-scroll p-0">
|
||||
<table class="table-sm table-striped table-hover small m-0 table align-middle">
|
||||
<caption class="visually-hidden">{{ __('Average nutritional values') }}</caption>
|
||||
<thead class="table-dark sticky-top z-1">
|
||||
<tr>
|
||||
<th class="py-2 ps-3" scope="col">{{ __('Nutrient') }}</th>
|
||||
<th class="py-2 text-center" scope="col">{{ __('Per') }} {{ $productWithPricing->product->inco->nv_ref_weight_g }}g
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="fw-semibold text-dark ps-3" scope="row">{{ __('Energy') }}</th>
|
||||
<td class="fw-bold text-primary text-center">
|
||||
{{ $productWithPricing->product->inco->nv_kj }} {{ __('Kj') }}<br>
|
||||
<span class="small text-muted">{{ $productWithPricing->product->inco->nv_kcal }} {{ __('Kcal') }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">
|
||||
{{ __('Fat') }}<br>
|
||||
<span class="fw-normal text-muted small ps-2">• {{ __('Of which saturated fatty acids') }}</span>
|
||||
</th>
|
||||
<td class="text-center">
|
||||
{{ $productWithPricing->product->inco->nv_fat_g }} g<br>
|
||||
<span class="text-muted small">{{ $productWithPricing->product->inco->nv_sat_fat_g }} g</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">
|
||||
{{ __('Carbohydrates') }}<br>
|
||||
<span class="fw-normal text-muted small ps-2">• {{ __('of which sugars') }}</span>
|
||||
</th>
|
||||
<td class="text-center">
|
||||
{{ $productWithPricing->product->inco->nv_carb_g }} g<br>
|
||||
<span class="text-muted small">{{ $productWithPricing->product->inco->nv_sugar_g }} g</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Dietary fiber') }}</th>
|
||||
<td class="text-center">{{ $productWithPricing->product->inco->nv_fiber_g }} g</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Proteins') }}</th>
|
||||
<td class="fw-semibold text-center">{{ $productWithPricing->product->inco->nv_protein_g }} g</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Salt') }}</th>
|
||||
<td class="fw-bold text-danger text-center">{{ $productWithPricing->product->inco->nv_salt_g }} g</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="border-top p-3">
|
||||
<p class="fst-italic text-muted small m-0">
|
||||
*{{ __('Reference Daily Intakes for an adult (8400kj/2000kcal).') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="accordion-collapse collapse" id="ingredientsList" data-bs-parent="#accordion-product-details">
|
||||
<div class="accordion-body bg-light text-secondary lh-lg mh-250px-scroll">
|
||||
{!! clean($productWithPricing->product->inco->ingredients ?? '') !!}
|
||||
@if (!empty($productWithPricing->product->inco->allergens))
|
||||
<div class="border-top border-secondary-subtle mt-3 pt-3">
|
||||
<strong class="text-dark small text-uppercase d-block mb-1">{{ __('Allergens') }} :</strong>
|
||||
<span class="text-danger small fw-medium">{{ $productWithPricing->product->inco->allergens }}</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="accordion-item border-top border-0">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed fw-semibold text-dark bg-primary py-3" data-bs-toggle="collapse"
|
||||
data-bs-target="#nutritionalValues" type="button" aria-expanded="false" aria-controls="nutritionalValues"
|
||||
aria-label="{{ __('See nutritional values') }}">
|
||||
<img class="wh-20px me-2" src="{{ Vite::asset('resources/assets/images/icons/icon_search.png') }}" alt=""
|
||||
aria-hidden="true">
|
||||
{{ __('Nutritional values') }}
|
||||
</button>
|
||||
</h2>
|
||||
<div class="accordion-collapse collapse" id="nutritionalValues" data-bs-parent="#accordion-product-details">
|
||||
<div class="accordion-body bg-light mh-350px-scroll p-0">
|
||||
<table class="table-sm table-striped table-hover small m-0 table align-middle">
|
||||
<caption class="visually-hidden">{{ __('Average nutritional values') }}</caption>
|
||||
<thead class="table-dark sticky-top z-1">
|
||||
<tr>
|
||||
<th class="py-2 ps-3" scope="col">{{ __('Nutrient') }}</th>
|
||||
<th class="py-2 text-center" scope="col">{{ __('Per') }} {{ $productWithPricing->product->inco->nv_ref_weight_g }}g
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="fw-semibold text-dark ps-3" scope="row">{{ __('Energy') }}</th>
|
||||
<td class="fw-bold text-primary text-center">
|
||||
{{ $productWithPricing->product->inco->nv_kj }} {{ __('Kj') }}<br>
|
||||
<span class="small text-muted">{{ $productWithPricing->product->inco->nv_kcal }} {{ __('Kcal') }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">
|
||||
{{ __('Fat') }}<br>
|
||||
<span class="fw-normal text-muted small ps-2">• {{ __('Of which saturated fatty acids') }}</span>
|
||||
</th>
|
||||
<td class="text-center">
|
||||
{{ $productWithPricing->product->inco->nv_fat_g }} g<br>
|
||||
<span class="text-muted small">{{ $productWithPricing->product->inco->nv_sat_fat_g }} g</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">
|
||||
{{ __('Carbohydrates') }}<br>
|
||||
<span class="fw-normal text-muted small ps-2">• {{ __('of which sugars') }}</span>
|
||||
</th>
|
||||
<td class="text-center">
|
||||
{{ $productWithPricing->product->inco->nv_carb_g }} g<br>
|
||||
<span class="text-muted small">{{ $productWithPricing->product->inco->nv_sugar_g }} g</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Dietary fiber') }}</th>
|
||||
<td class="text-center">{{ $productWithPricing->product->inco->nv_fiber_g }} g</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Proteins') }}</th>
|
||||
<td class="fw-semibold text-center">{{ $productWithPricing->product->inco->nv_protein_g }} g</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-dark ps-3" scope="row">{{ __('Salt') }}</th>
|
||||
<td class="fw-bold text-danger text-center">{{ $productWithPricing->product->inco->nv_salt_g }} g</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="border-top p-3">
|
||||
<p class="fst-italic text-muted small m-0">
|
||||
*{{ __('Reference Daily Intakes for an adult (8400kj/2000kcal).') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -33,51 +33,4 @@
|
|||
alt="{{ __('Nutriscore') }} {{ Str::upper($productWithPricing->product->inco->nutriscore->label()) }}">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="bg-light rounded-4 d-flex justify-content-between align-items-center mb-md-3 ps-md-3 fixed-bottom position-md-relative z-4 z-md-0 border-1 border-top-primary border p-3 ps-5 shadow-sm">
|
||||
<div class="ms-md-0 ms-3">
|
||||
<p class="text-muted small m-0">
|
||||
@if ($productWithPricing->product->weight_variable)
|
||||
{{ __('About') }}*
|
||||
@endif
|
||||
</p>
|
||||
<p class="m-0">
|
||||
<span class="@if ($productWithPricing->product->validDiscount?->is_old_price_displayed) text-danger @else text-dark @endif fw-bold h3 align-middle">
|
||||
<span class="visually-hidden">{{ __('Current price') }} : </span>
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->hasDiscount ?
|
||||
$productWithPricing->pricing->discountedPriceTtc() : $productWithPricing->pricing->basePriceTtc(),
|
||||
'product' => $productWithPricing->product,
|
||||
])
|
||||
</span>
|
||||
|
||||
@if ($productWithPricing->product->validDiscount?->is_old_price_displayed)
|
||||
<span class="text-muted text-decoration-line-through small ms-2 align-middle">
|
||||
<span class="visually-hidden">{{ __('Original price') }} : </span>
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->basePriceTtc(),
|
||||
'product' => $productWithPricing->product,
|
||||
])
|
||||
</span>
|
||||
@endif
|
||||
<span class="text-lowercase text-muted small align-middle">/{{ $productWithPricing->product->sell_unit->label() }}</span>
|
||||
</p>
|
||||
|
||||
<p class="small fst-italic text-muted">
|
||||
<span>{{ $productWithPricing->product->weight_variable ? __('Product sold by the kilo') : __('Price per kilo') }}</span> :
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->priceKgTtc(),
|
||||
'product' => $productWithPricing->product
|
||||
])
|
||||
<span>/kg</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@can('addToBasket', $productWithPricing->product)
|
||||
<div class="basket-buttons" data-json='@json(['id' => $productWithPricing->product->id])'></div>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
47
resources/views/fo/pages/products/show-price-info.blade.php
Normal file
47
resources/views/fo/pages/products/show-price-info.blade.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<div
|
||||
class="bg-light rounded-4 d-flex justify-content-between align-items-center mb-md-3 ps-md-3 fixed-bottom position-md-relative z-4 z-md-0 border-1 border-top-primary border p-3 ps-5 shadow-sm">
|
||||
<div class="ms-md-0 ms-3">
|
||||
<p class="text-muted small m-0">
|
||||
@if ($productWithPricing->product->weight_variable)
|
||||
{{ __('About') }}*
|
||||
@endif
|
||||
</p>
|
||||
<p class="m-0">
|
||||
<span class="@if ($productWithPricing->product->validDiscount?->is_old_price_displayed) text-danger @else text-dark @endif fw-bold h3 align-middle">
|
||||
<span class="visually-hidden">{{ __('Current price') }} : </span>
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->hasDiscount
|
||||
? $productWithPricing->pricing->discountedPriceTtc()
|
||||
: $productWithPricing->pricing->basePriceTtc(),
|
||||
'product' => $productWithPricing->product,
|
||||
])
|
||||
</span>
|
||||
|
||||
@if ($productWithPricing->product->validDiscount?->is_old_price_displayed)
|
||||
<span class="text-muted text-decoration-line-through small ms-2 align-middle">
|
||||
<span class="visually-hidden">{{ __('Original price') }} : </span>
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->basePriceTtc(),
|
||||
'product' => $productWithPricing->product,
|
||||
])
|
||||
</span>
|
||||
@endif
|
||||
<span class="text-lowercase text-muted small align-middle">/{{ $productWithPricing->product->sell_unit->label() }}</span>
|
||||
</p>
|
||||
|
||||
<p class="small fst-italic text-muted">
|
||||
<span>{{ $productWithPricing->product->weight_variable ? __('Product sold by the kilo') : __('Price per kilo') }}</span> :
|
||||
@include('fo.modules.guarded-currency', [
|
||||
'money' => $productWithPricing->pricing->priceKgTtc(),
|
||||
'product' => $productWithPricing->product,
|
||||
])
|
||||
<span>/kg</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@can('addToBasket', $productWithPricing->product)
|
||||
<div>
|
||||
<div class="basket-buttons" data-json='@json(['id' => $productWithPricing->product->id])'></div>
|
||||
</div>
|
||||
@endcan
|
||||
</div>
|
||||
|
|
@ -17,14 +17,21 @@
|
|||
@include('fo.pages.products.show-info', compact('productWithPricing'))
|
||||
</section>
|
||||
|
||||
<aside class="col-12 col-lg-3 align-self-start sticky-lg-top-navbar @unlessorderable($productWithPricing->product) opacity-75 @endorderable" aria-label="{{ __('Product details') }}">
|
||||
@include('fo.pages.products.show-details', compact('productWithPricing'))
|
||||
</aside>
|
||||
<div class="col-12 col-lg-3 align-self-start sticky-lg-top-navbar">
|
||||
@include('fo.pages.products.show-price-info', compact('productWithPricing'))
|
||||
|
||||
@if (!empty($productWithPricing->product->inco->nv_kj))
|
||||
<aside class="@unlessorderable($productWithPricing->product) opacity-75 @endorderable" aria-label="{{ __('Product details') }}">
|
||||
@include('fo.pages.products.show-details', compact('productWithPricing'))
|
||||
</aside>
|
||||
@endif
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@if (!empty($associatedProducts))
|
||||
<div class="col-12 position-relative mt-5">
|
||||
<div class="associated-products" data-json='@json($associatedProducts)'></div>
|
||||
</div> @endif
|
||||
</main>
|
||||
</div>
|
||||
@endif
|
||||
</main>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue