add variable isFavorite for product card
This commit is contained in:
parent
33debba630
commit
e9d02d13d8
2 changed files with 29 additions and 6 deletions
|
|
@ -139,6 +139,13 @@
|
|||
</div>
|
||||
</div>
|
||||
{{-- PRODUCT CARDS --}}
|
||||
{{-- FIXME: Remplacer le random par une liaison vers les favoris du customer authentifié --}}
|
||||
@php
|
||||
$customerFavorite1 = (rand(0, 1));
|
||||
$customerFavorite2 = (rand(0, 1));
|
||||
$customerFavorite3 = (rand(0, 1));
|
||||
$customerFavorite4 = (rand(0, 1));
|
||||
@endphp
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2>{{ __('Product cards') }}</h2>
|
||||
|
|
@ -151,6 +158,7 @@
|
|||
'productPicture' => Vite::asset('resources/assets/images/tmp/nuggets.png'),
|
||||
'isNew' => true,
|
||||
'name' => __('Sauté de dinde sans os sans peau'),
|
||||
'isFavorite' => $customerFavorite1
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
|
|
@ -161,6 +169,7 @@
|
|||
'alt' => 'Alt tag',
|
||||
'title' => 'Title tag',
|
||||
],
|
||||
'isFavorite' => $customerFavorite2
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
|
|
@ -172,12 +181,14 @@
|
|||
'alt' => 'Alt tag',
|
||||
'title' => 'Title tag',
|
||||
],
|
||||
'isFavorite' => $customerFavorite3
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
@include('fo.partials.product-card', [
|
||||
'productPicture' => Vite::asset('resources/assets/images/tmp/nuggets.png'),
|
||||
'name' => __('Sauté de dinde sans os sans peau'),
|
||||
'isFavorite' => $customerFavorite4
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -217,6 +228,9 @@
|
|||
'alt' => 'Alt image',
|
||||
'title' => 'Title image',
|
||||
],
|
||||
'title' => 'Title image',
|
||||
'jobs_list' => ['job' => ['value' => 'Dev web']],
|
||||
'job_url' => route('fo.partials-demo')
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
|
|
@ -226,6 +240,9 @@
|
|||
'alt' => 'Alt image',
|
||||
'title' => 'Title image',
|
||||
],
|
||||
'title' => 'Title image',
|
||||
'jobs_list' => ['job' => ['value' => 'Eleveur']],
|
||||
'job_url' => route('fo.partials-demo')
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
|
|
@ -235,6 +252,9 @@
|
|||
'alt' => 'Alt image',
|
||||
'title' => 'Title image',
|
||||
],
|
||||
'title' => 'Title image',
|
||||
'jobs_list' => ['job' => ['value' => 'Manager']],
|
||||
'job_url' => route('fo.partials-demo')
|
||||
])
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-lg-4 mb-4">
|
||||
|
|
@ -244,6 +264,9 @@
|
|||
'alt' => 'Alt image',
|
||||
'title' => 'Title image',
|
||||
],
|
||||
'title' => 'Title image',
|
||||
'jobs_list' => ['job' => ['value' => 'Comptable']],
|
||||
'job_url' => route('fo.partials-demo')
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
@if (!empty($productPicture))
|
||||
<img class="w-75 position-absolute product-card-product" src="{{ $productPicture }}" title="#CHANGEME" alt="#CHANGEME" />
|
||||
@endif
|
||||
{{-- FIXME: Ajouter condition si produit déjà aux favoris => Coeur rouge --}}
|
||||
@if (rand(0, 1))
|
||||
<button class="btn btn-link position-absolute product-card-favorite-empty z-1 bottom-0" title="Ajouter aux favoris"></button>
|
||||
@else
|
||||
<button class="btn btn-link position-absolute product-card-favorite-filled z-1 bottom-0" title="Retirer des favoris"></button>
|
||||
@endif
|
||||
<div>{{ $isFavorite }}</div>
|
||||
<button @class([
|
||||
'btn btn-link position-absolute z-1 bottom-0',
|
||||
'product-card-favorite-empty' => !$isFavorite,
|
||||
'product-card-favorite-filled' => $isFavorite,
|
||||
]) title="<?= ($isFavorite) ? 'Retirer des favoris' : 'Ajouter aux favoris'; ?>"></button>
|
||||
</div>
|
||||
{{-- BOTTOM PART --}}
|
||||
<div class="position-relative">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue