BladeX::component('components.map-link'); // <map-link address="..."> ... </map-link>
BladeX::component('components.phone-link'); // <phone-link number="012345"> ... </phone-link>
BladeX::component('components.text-block'); // <text-block> ... </text-block>
+ BladeX::component('components.cart-add')->tag('cart-add'); // <cart-add id="1234"> ... </cart-add>
} catch (\Exception $e) {
}
"modernizr-webpack-plugin": "^1.0.7",
"polyfill-array-includes": "^2.0.0",
"popper.js": "^1.12",
- "portal-vue": "^2.1.5",
+ "portal-vue": "^2.1.7",
"resolve-url-loader": "^2.3.1",
"rupture": "^0.7.1",
"stylus": "github:acidjazz/stylus#dev",
require('./menu');
require('../../vendor/cubist/cms-back/src/public/emailobfuscator/emailobfuscator');
require('element-closest');
+window.$ = require('cash-dom');
// Polyfill CSS Vars for older browsers
// This is only partly useful because we need to update CSS variables
}
checkScroll();
+
+$(document).on('click', 'button.cart-add', function () {
+ $(this).addClass('btn-no-hover').addClass('bg-navy');
+ $(this).find('.add').addClass('opacity-0');
+ $(this).find('.added').show();
+ var id = parseInt($(this).attr('data-product-id'));
+ eventBus.$emit('add-item', {
+ id: id,
+ quantity: 1,
+ });
+});
+
+++ /dev/null
-<template>
- <button class="btn" @click="addToCart" :class="{'btn-no-hover bg-navy' : isAdded }" :disabled="isAdded">
- <span class="btn-text relative">
- <span :class="{'opacity-0': isAdded}">
- <slot></slot>
- </span>
- <span class="absolute top-0 left-0 w-full h-full flex items-center justify-center" v-if="isAdded">
- <slot name="success-message"></slot>
- </span>
- </span>
- </button>
-</template>
-
-<script>
-
- export default {
- name: "CartAdd",
-
- props: {
- productId: {
- type: Number,
- required: true,
- }
- },
-
- data() {
- return {
- isAdded: false,
- };
- },
-
- methods: {
- addToCart() {
- console.warn(':)');
- eventBus.$emit('add-item', {
- id: this.productId,
- quantity: 1,
- });
- this.isAdded = true;
- }
- }
- }
-</script>
-
-<style scoped>
-
-</style>
<!-- Product Grid -->
<div class="grid grid-cols-auto grid-gap-lg products-grid mt-6 sm:mt-2">
<template v-for="product in products" v-if="productVisible(product.id)">
- <div v-html="product.html"></div>
+ <div v-html="product.html" @click="productLoaded(product.id)"></div>
</template>
</div>
import 'ie-array-find-polyfill'
import 'es7-object-polyfill'
import VueSlider from 'vue-slider-component' // See vue-slider.styl for CSS
- import CartAdd from "./CartAdd";
export default {
components: {
- VueSlider,
- CartAdd
+ VueSlider
},
props: {
if (child.tag) { // Ensure it's a tag and not an empty text element
let product = child.elm;
let ID = parseInt(product.dataset.productId);
-
this.products.push({id: ID, html: product.outerHTML});
}
});
return Object.values(this.matches.hits).includes(id)
},
+ productLoaded(id) {
+ console.log(id + ' loaded');
+ },
+
removeFilter(filterID, optionID) {
let index = this.filters[filterID].indexOf(optionID);
--- /dev/null
+<button data-product-id="{{ $id }}" class="btn cart-add">
+ <span class="btn-text relative">
+ <span class="add">
+ {{ __('Ajouter à ma sélection') }}
+ </span>
+ <span class="added absolute top-0 left-0 w-full h-full flex items-center justify-ce hidden">
+ @svg('tick', 'w-4 mr-3 inline absolute left-0') <span class="relative" style="top:-15%">{{ __('Produit ajouté') }}</span>
+ </span>
+ </span>
+</button>
@if(config('features.quote'))
- <cart-add :product-id="{{ $product->id }}" class="align-middle">
- {{ __('Ajouter à ma sélection') }}
-
- <template v-slot:success-message>
- @svg('tick', 'w-4 mr-3') {{ __('Produit ajouté') }}
- </template>
- </cart-add>
-
- <span data-tooltip="{{__('Ajoutez un ou plusieurs produits à votre sélection, ajustez les quantités et obtenez un devis.')}}"
+ <cart-add :id="$product->id"></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>
@endif
</h3>
<div class="product-highlights text-sm">
@if(config('features.quote'))
- <cart-add :product-id="{{ $product->id }}" class="align-middle">
- {{ __('Ajouter à ma sélection') }}
- <template v-slot:success-message>
- @svg('tick', 'w-4 mr-3') {{ __('Produit ajouté') }}
- </template>
- </cart-add>
+ <cart-add :id="$product->id"></cart-add>
@endif
</div>
<div class="links mt-4">