activate prix barres
This commit is contained in:
parent
fc71244b87
commit
b2a13a2043
5 changed files with 22 additions and 16 deletions
|
|
@ -207,7 +207,17 @@ class Product extends Model implements Buyable
|
|||
if (isset($this->priceKgTtc)) {
|
||||
$showPrice = $this->priceKgTtc;
|
||||
} else {
|
||||
$priceKgTtc = $this->attributes['price'] * (1 + ($this->tax->rate / 100));
|
||||
$discountedPriceKgTtc = $this->price;
|
||||
if ($this->promotions->count()) {
|
||||
$applicablePromotion = $this->promotions->first();
|
||||
if ($applicablePromotion->discountType->id == 1) {
|
||||
$discountedPriceKgTtc = $this->price - $applicablePromotion->discount_value;
|
||||
} else {
|
||||
$discountedPriceKgTtc = $this->price - ($this->price * $applicablePromotion->discount_value / 100);
|
||||
}
|
||||
}
|
||||
$priceKgTtc = $discountedPriceKgTtc * (1 + ($this->tax->rate / 100));
|
||||
|
||||
/**
|
||||
* On travaille avec des centimes puis on redivise par 100 pour avoir des unités monetaires
|
||||
* on augmente la précision à 3 digits, l'affichage formate les prix sur 2 décimales
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
{!! $product->description !!}
|
||||
</div>
|
||||
<div class="card-price d-flex justify-content-center align-items-center m-2 mx-0">
|
||||
{{-- @if ($product->promotions->count())
|
||||
<span class="card-price-original position-relative me-2">@fmt_currency_without_ttc($product->priceTtc)</span>
|
||||
@endif --}}
|
||||
<p class="card-price-new {{-- @if ($product->promotions->count()) text-red @endif --}}">
|
||||
<p class="card-price-new">
|
||||
<span>@if ($product->weight_variable) Environ* @endif</span>
|
||||
<span class="font-Barlow-bold h4">@fmt_currency($product->discountedPriceTtc)</span>
|
||||
<span class="font-Barlow-bold h4 @if ($product->promotions->count()) text-red @endif">@fmt_currency($product->discountedPriceTtc)</span>
|
||||
@if ($product->promotions->count())
|
||||
<span class="card-price-original position-relative me-2">@fmt_currency_without_ttc($product->priceTtc)</span>
|
||||
@endif
|
||||
<span class="text-lowercase">/{{ $product->sell_unit }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -137,10 +137,9 @@
|
|||
<div class="card-text text-start text-lg-center w-100" v-html="product.description"></div>
|
||||
<div class="card-price d-flex flex-row justify-content-center align-items-center my-2">
|
||||
<span v-if="product.weight_variable" class="me-1">Environ*</span>
|
||||
<span class="card-price-new font-Barlow-bold h5">{{ currencyFormatter(product.discountedPriceTtc) }}</span>
|
||||
<span class="card-price-new font-Barlow-bold h5" v-bind:class="{'text-red': product.promotion}">{{ currencyFormatter(product.discountedPriceTtc) }}</span>
|
||||
<span v-if="product.promotion != null" class="card-price-original position-relative m-0 ms-2 m-lg-0 me-lg-2">{{ currencyFormatter(product.priceTtc) }}</span>
|
||||
<span v-if="product.weight_variable" class="text-lowercase ms-1">/{{ product.sell_unit }}</span>
|
||||
<!-- <span class="card-price-new h5" v-bind:class="{'text-red': product.promotion}">{{ currencyFormatter(product.discountedPriceTtc) }}</span> -->
|
||||
<!-- <span v-if="product.promotion != null" class="card-price-original position-relative m-0 ms-2 m-lg-0 me-lg-2">{{ currencyFormatter(product.priceTtc) }}</span> -->
|
||||
</div>
|
||||
<p class="fst-italic text-muted mb-2" v-bind:class="[product.weight_variable ? '' : 'opacity-0']">*Produit vendu au kilo : {{ currencyFormatter(product.priceKgTtc) }} /kg</p>
|
||||
<div class="card-action d-flex flex-row-reverse justify-content-between align-items-center w-100">
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@
|
|||
</div>
|
||||
<div class="card-action position-fixed position-lg-relative d-flex justify-content-between align-items-center w-100 px-4 px-lg-0">
|
||||
<div class="card-price d-flex justify-content-center align-items-center">
|
||||
{{-- @if ($product->promotions->count())
|
||||
<span class="card-price-original position-relative">@fmt_currency($product->priceTtc)</span>
|
||||
@endif --}}
|
||||
<p class="m-0">
|
||||
<span>@if ($product->weight_variable) Environ* @endif</span>
|
||||
<span class="{{-- @if ($product->promotions->count()) card-price-new @endif --}} font-Barlow-bold h4 ms-1">@fmt_currency($product->discountedPriceTtc)</span>
|
||||
<span class="@if ($product->promotions->count()) card-price-new @endif font-Barlow-bold h4 ms-1">@fmt_currency($product->discountedPriceTtc)</span>
|
||||
@if ($product->promotions->count())
|
||||
<span class="card-price-original position-relative m-0 ms-2 m-lg-0 me-lg-2">@fmt_currency($product->priceTtc)</span>
|
||||
@endif
|
||||
<span class="text-lowercase">/{{ $product->sell_unit }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -133,9 +133,6 @@ img {
|
|||
color: $red;
|
||||
margin-left: 1rem !important;
|
||||
}
|
||||
.card-price-original {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue