fix vue ranges, nutriscore's images

This commit is contained in:
Alexis Gousseau 2022-10-10 11:59:20 +02:00
parent ba1405ba8a
commit 7033d4650e
8 changed files with 35 additions and 28 deletions

View file

@ -44,11 +44,16 @@ class ProductResource extends JsonResource
{
// @phpcs:enable
$data = array_merge(
['discountedPriceHt' => $this->product->discountedPriceHt],
\array_intersect_key(
$this->product->toArray(),
self::$skeleton
)
),
['discountedPriceHt' => $this->product->discountedPriceHt],
[
'nutriscore' => (isset($this->product->foodProduct->nutriscore)) ?
$this->product->foodProduct->nutriscore :
null
]
);
$data['description'] = clean($data['description']);

View file

@ -219,7 +219,7 @@
</div>
<div class="form-group">
<label for="nutriscore">Nutriscore</label>
<input type="text" id="nutriscore" name="nutriscore" class="form-control" placeholder="Nutriscore" value="{{ old('nutriscore', $product->foodProduct->nutriscore) }}">
<input type="text" id="nutriscore" name="nutriscore" class="form-control" placeholder="Score nutriscore (A, B, C, D, E)" value="{{ old('nutriscore', $product->foodProduct->nutriscore) }}">
</div>
<div class="form-group">
<label>Arguments Nutriscore</label>

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -120,7 +120,7 @@
<section class="w-100 w-lg-75">
<p class="title-small font-Barlow-bold m-3 text-center text-lg-start">Tous les rayons</p>
<div v-if="loading" class="placeholder row m-0 g-4">
<article class="col-sm-4 rounded-4 p-3 m-0 position-relative card">
<article class="col-lg-4 card position-relative rounded-4 p-3 m-0 my-2">
<div class="d-flex flex-row flex-lg-column justify-content-between align-items-center col-md-4 p-0 w-100 m-0">
<div class="image">
<content-placeholders>
@ -139,37 +139,39 @@
<!-- card article -->
<article v-for="(product, productIndex) in showedProducts"
:key="productIndex"
class="col-sm-4 rounded-4 p-3 m-0 position-relative card"
class="col-lg-4 card rounded-4 p-3 m-0"
v-bind:class="[!product.availability ? 'card-available-soon' : '']">
<div class="d-flex flex-row flex-lg-column justify-content-between align-items-center col-md-4 p-0 w-100 m-0">
<div class="position-relative text-center w-50 w-lg-100">
<p class="position-absolute top-50 start-50 translate-middle font-Barlow-bold title-small text-uppercase d-none text-center m-0">
bientôt disponible
</p>
<img class="img-fluid" :src="'/images/produits/' + product.picture" :alt="'Image du produit '+product.name">
</div>
<div
class="card-body d-flex flex-column justify-content-center align-items-start align-items-lg-center w-75 w-lg-100 px-2 px-lg-0">
<h5 class="font-Barlow-bold m-0 m-lg-2">
<a class="text-decoration-none text-dark stretched-link" :href="'/produit/'+product.slug">{{ product.name }}</a>
</h5>
<p class="m-0" v-html="product.description"></p>
<div class="card-price d-flex justify-content-center align-items-center font-Barlow-bold mb-3 mt-0 m-lg-4 mt-lg-0">
<span class="card-price-original text-red position-relative me-2">{{ product.price }}€</span>
<span class="card-price-new h3">{{ product.discountedPriceHt }}€</span>
<div class="position-relative w-100 h-100 px-4 py-2">
<div class="d-flex flex-row flex-lg-column justify-content-between align-items-center col-md-4 p-0 w-100 m-0">
<div class="position-relative text-center w-50 w-lg-100">
<p class="position-absolute top-50 start-50 translate-middle font-Barlow-bold title-small text-uppercase d-none text-center m-0">
bientôt disponible
</p>
<img class="img-fluid" :src="'/images/produits/' + product.picture" :alt="'Image du produit '+product.name">
</div>
<div class="card-action d-flex justify-content-between align-items-center w-100">
<img class="card-action-nutriscore" src="/img/nutriscore/nutriscore-1.png">
<basket-buttons :product-id="product.id"></basket-buttons>
<div
class="card-body d-flex flex-column justify-content-center align-items-start align-items-lg-center w-75 w-lg-100 px-2 px-lg-0">
<h5 class="font-Barlow-bold m-0 m-lg-2">
<a class="text-decoration-none text-dark stretched-link" :href="'/produit/'+product.slug">{{ product.name }}</a>
</h5>
<p class="m-0" v-html="product.description"></p>
<div class="card-price d-flex justify-content-center align-items-center font-Barlow-bold mb-3 mt-0 m-lg-4 mt-lg-0">
<span class="card-price-original text-red position-relative me-2">{{ product.price }}€</span>
<span class="card-price-new h3">{{ product.discountedPriceHt }}€</span>
</div>
<div class="card-action d-flex flex-row-reverse justify-content-between align-items-center w-100">
<basket-buttons :product-id="product.id"></basket-buttons>
<img v-if="product.nutriscore != null" class="card-action-nutriscore" :src="'/sable/img/nutriscore/nutriscore-'+product.nutriscore+'.png'">
</div>
</div>
</div>
<div v-if="!product.loading" class="filtre position-absolute bottom-0 start-0 w-100 h-100 h-lg-75 rounded-4"></div>
</div>
<div v-if="!product.loading" class="filtre position-absolute bottom-0 start-0 w-100 h-100 h-lg-75 rounded-4"></div>
</article>
</div>
<div class="paginator" v-if="lastPage > 1 && !loading">
<div class="paginator my-4" v-if="lastPage > 1 && !loading">
<nav>
<ul class="pagination justify-content-end font-Barlow-bold">
<ul class="pagination justify-content-end font-Barlow-bold m-0">
<li class="page-item" v-if="currentPage > firstPage" v-on:click="showPrevPage(true, $event);">
<a href="#" rel="prev" aria-label="« Précédent" class="page-link">‹</a>
</li>
@ -209,7 +211,7 @@
products: [],
showedProducts: {},
maxPagesToShow: 2,
paginate: 3,
paginate: 9,
firstPage: 1,
lastPage: 2,
currentPage: 1,