public function cart(Request $request)
{
-
$request->validate([
'action' => 'required|string', // add/update/delete
'id' => 'required|numeric',
$this->addField(['name' => 'discount',
'label' => 'Remise',
'type' => 'select_from_array',
- 'options' => ['A','B','C','D','E'],
+ 'options' => ['A' => 'A','B' => 'B','C' => 'C','D' => 'D','E' => 'E'],
'allows_null' => false,
'default' => 'A',
'column' => true,
public static function discountArray($categoryProduct) {
$categoryClient = self::getClientConnected()->discount ?? 'A';
+ //dd(self::getClientConnected());
$category_array = [
'A' => 0,
'B' => 5,
$discount_array = array_combine($discount_array_save_keys,$discount_array);
if($categoryProduct && $categoryClient) {
- return $discount_array[$categoryClient][$categoryProduct];
+ return $discount_array[$categoryProduct][$categoryClient];
}
return null;
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="15.121" height="8.112" viewBox="0 0 15.121 8.112">
+ <path id="Tracé_226" data-name="Tracé 226" d="M.5,3.85,6.65,10a.48.48,0,0,0,.7,0L13.5,3.85" transform="translate(0.561 -2.789)" fill="none" stroke="#182f4c" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+</svg>
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+ <g id="Ellipse_35" data-name="Ellipse 35" fill="#fff" stroke="#6b7285" stroke-width="1.5">
+ <circle cx="8" cy="8" r="8" stroke="none"/>
+ <circle cx="8" cy="8" r="7.25" fill="none"/>
+ </g>
+ <g transform="translate(4,4)">
+ <circle id="Ellipse_37" data-name="Ellipse 37" cx="4" cy="4" r="4" fill="#0eaada" />
+ </g>
+</svg>
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+ <g id="Ellipse_35" data-name="Ellipse 35" fill="#fff" stroke="#6b7285" stroke-width="1.5">
+ <circle cx="8" cy="8" r="8" stroke="none"/>
+ <circle cx="8" cy="8" r="7.25" fill="none"/>
+ </g>
+</svg>
mounted() {
eventBus.$on('add-item', data => {
data.action = 'add';
- data.ref = this.ref ?? data.ref;
- data.price = this.price;
+ data.ref = data.ref !== "" ? data.ref : this.ref;
+ data.price = data.price !== undefined ? data.price : this.price;
this.saveCart(data);
});
priceDiscount() {
let discount = this.discount ?? 0
let newValue = (this.price * discount) / 100
- return this.price - newValue.toFixed(2)
+ return (this.price - newValue).toFixed(2)
}
},
$(this).find('.add').addClass('hidden');
$(this).find('.added').removeClass('hidden').addClass('inline-flex');
var id = parseInt($(this).attr('data-product-id')),
- ref = $(this).attr('data-ref')
+ ref = $(this).attr('data-ref'),
+ price = $(this).attr('data-price')
eventBus.$emit('add-item', {
id: id,
quantity: 1,
- ref: ref
+ ref: ref,
+ price: price
});
clearTimeout(time);
</a>
<div class="cart-item-text pl-6 xs:pl-0 leading-relaxed flex-grow">
<a :href="item.URL" class="block text-navy font-display">
-
<span class="text-grey-dark" v-if="item.ref">{{ item.ref }}</span>
<span class="text-grey-dark" v-else>{{ item.reference }}</span>
<br>
<span class="mr-2">Quantité</span>
<number-input v-model="item.quantity" :min="1" inline center controls></number-input>
</div>
- <div v-if="!isNaN(item.price)" :class="{ 'line-through' : item.discount > 0 }">
+ <div v-if="!isNaN(parseFloat(item.price))" :class="{ 'line-through' : item.discount > 0 }">
<span class="text-navy">{{ Number.parseFloat(price).toFixed(2) }}<span>€ HT</span></span>
</div>
<div v-if="item.discount > 0">
-import tippy from 'tippy.js'
-
-tippy('[data-tooltip]', {
- arrow: true,
- arrowType: 'sharp',
- animation: 'shift-away',
- content: function (el) {
- return el.getAttribute('data-tooltip');
- },
- flipBehavior: ["top", "bottom"],
- theme: 'custom',
- placement: 'top',
-
- popperOptions: {
- modifiers: {
- data: {styles: {marginBottom: '50px'}},
- hide: {enabled: true}
- }
- },
-});
-
import blueimp from 'blueimp-gallery';
document.getElementById('product-gallery').onclick = function (event) {
--- /dev/null
+import tippy from 'tippy.js'
+
+tippy('[data-tooltip]', {
+ arrow: true,
+ arrowType: 'sharp',
+ animation: 'shift-away',
+ content: function (el) {
+ return el.getAttribute('data-tooltip');
+ },
+ flipBehavior: ["top", "bottom"],
+ theme: 'custom',
+ placement: 'top',
+
+ popperOptions: {
+ modifiers: {
+ data: {styles: {marginBottom: '50px'}},
+ hide: {enabled: true}
+ }
+ },
+});
@elseif(isset($template) && $template === "miniature" && $options)
<a href="{{ $link }}" class="btn text-center">
@else
- <button data-ref="{{ $reference }}" data-product-id="{{ $id }}" class="btn cart-add">
+ <button data-ref="{{ $reference }}" data-price="{{ $price }}" data-product-id="{{ $id }}" class="btn cart-add">
@endif
<span class="btn-text relative">
<span class="add">
</div>
<div class="product-price">
@if(floatval($product['price']))
- <p class="no-m">{{ $product['price'] * $product['quantity'] }}€ HT</p>
+ <p class="no-m">{{ number_format($product['price'] * $product['quantity'], 2) }}€ HT</p>
@else
<p class="text-navy">
N/A
@extends('layouts/app')
+@push('scripts')
+ <script src="{{ mix('/js/tippy-config.js') }}"></script>
+@endpush
+
@section('content')
<full-width padding="pb-3v">
<content>
@push('scripts')
<script src="{{ mix('/js/product-details.js') }}"></script>
+ <script src="{{ mix('/js/tippy-config.js') }}"></script>
@endpush
@section('content')
@endauth
@if(config('features.quote'))
- <cart-add :id="$product->id" :reference="$product->reference" :price="$product->basic_selling_price" template="product-detail"></cart-add>
+ <cart-add :id="$product->id" reference="" price="" template="product-detail"></cart-add>
<span
data-tooltip="{{__('Ajoutez un ou plusieurs produits à votre sélection, ajustez les quantités et obtenez un devis.')}}"
class="font-display text-lg inline-block align-middle rounded-full border-grey-dark border-2 h-8 w-8 text-center ml-6">?</span>
$categoryProduct = $product->category;
$discount = \App\Models\Client::discountArray($categoryProduct);
- $price = number_format($product->basic_selling_price - (($product->basic_selling_price * $discount) / 100), 2);
+ $price = floatval(number_format($product->basic_selling_price - (($product->basic_selling_price * $discount) / 100), 2));
+ if($price < 1)
+ $price = ""
@endphp
<div data-product-id="{{ $id }}" class="product-grid-item bg-grey-200">
@endif
</div>
@if(config('features.quote'))
- <cart-add :id="$product->id" :reference="$product->reference" :link="$product->getEntity()->URL" :price="$product->basic_selling_price" :options="$options" template="miniature"></cart-add>
+ <cart-add :id="$product->id" :reference="$product->reference" :link="$product->getEntity()->URL" :price="$price" :options="$options" template="miniature"></cart-add>
@endif
<div class="links mt-4">
<div class="link">
.js('resources/js/carrousel.js', 'public/js')
.js('resources/js/logowall.js', 'public/js')
.js('resources/js/product-details.js', 'public/js')
+ .js('resources/js/tippy-config.js', 'public/js')
.js('resources/js/mailform.js', 'public/js');
// mix.polyfill({