Aller aux produits
Collection Exclusive AĂŻd
LâArt de la PĂątisserie Fine
Baklawa au pistache, Kaak Warka, Bjawia... Recettes ancestrales transmises de mÚre en fille depuis des générations
Sélection
Notre Patrimoine Gourmand
Retrouvez rapidement les familles de produits disponibles selon le catalogue du tenant.
Nos créations artisanales
Notre Carte ComplĂšte
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-S0MOT313";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/agneau-msseli-69f0d3ce4e3e7",
name: "Agneau Msseli",
summary: "Viande d'agneau s\u00e9ch\u00e9e au soleil puis cuite a l'huile\r\nd'olive",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Mselli",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Agneau+Msseli",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Agneau Msseli
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-YQ0JB2PJ";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/veau-msselli-69f0d268a98f4",
name: "Veau Msselli",
summary: "Viande de veau s\u00e9ch\u00e9e au soleil puis cuite a l'huile\r\nd'olive",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Mselli",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Veau+Msselli",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Veau Msselli
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-ECPLOPO5";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-caramel-au-beurre-sale-69f0be7776b2d",
name: "Cookies caramel au beurre sal\u00e9",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+caramel+au+beurre+sal%C3%A9",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies caramel au beurre salé
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-RDMLHLJF";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-cacahouete-69ef4910c1a40",
name: "Cookies Cacahou\u00e8te",
summary: "farine, Cacahou\u00e8te , Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Cacahou%C3%A8te",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies CacahouĂšte
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-ASBXZTMP";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-chocolat-69ef478258aa0",
name: "Cookies Chocolat",
summary: "farine, Chocolat, Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Chocolat",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies Chocolat
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-WHYMSMZK";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-speculoos-69ef438528dc8",
name: "Cookies Speculoos",
summary: "farine, Sp\u00e9culoos, Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Speculoos",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies Speculoos
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-XI2GLHXY";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-pistache-69ef423bf41a7",
name: "Cookies Pistache",
summary: "farine, Pistache , Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/P2ZQncv5vh6SYt3DoHs2wLxx8nNi7xo600p4xvgp.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/P2ZQncv5vh6SYt3DoHs2wLxx8nNi7xo600p4xvgp.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Pistache",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/P2ZQncv5vh6SYt3DoHs2wLxx8nNi7xo600p4xvgp.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies Pistache
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-7UE7ABBW";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/mafrouda-amande-noix-t6pl1",
name: "Mafrouda Amande Noix",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || null,
active_image: this.activeImage || null,
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Hlou Amandes",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Mafrouda+Amande+Noix",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = null;
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Mafrouda Amande Noix
Sur Devis
0,000
TND
/ piĂšce
Rayon
Mselli
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-S0MOT313";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/agneau-msseli-69f0d3ce4e3e7",
name: "Agneau Msseli",
summary: "Viande d'agneau s\u00e9ch\u00e9e au soleil puis cuite a l'huile\r\nd'olive",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Mselli",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Agneau+Msseli",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/1YSUJZXRpPhoZdMGOhA3Tl9TRc9isnGxpBJWNzyp.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Agneau Msseli
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-YQ0JB2PJ";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/veau-msselli-69f0d268a98f4",
name: "Veau Msselli",
summary: "Viande de veau s\u00e9ch\u00e9e au soleil puis cuite a l'huile\r\nd'olive",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Mselli",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Veau+Msselli",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/nQhgL30G3e7vUGtpVCzp44AFPvV0BifhhBs0Nxkx.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Veau Msselli
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-76FTAIZW";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/kaddid-mselli-iyr76",
name: "kaddid mselli",
summary: "Viande de veau et d'agneau s\u00e9ch\u00e9e au soleil puis cuite a l'huile\r\nd'olive",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1rQ0wSXH-1776692684.webp",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/1rQ0wSXH-1776692684.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Mselli",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+kaddid+mselli",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/1rQ0wSXH-1776692684.webp";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
kaddid mselli
Sur Devis
0,000
TND
/ piĂšce
Rayon
Cookies
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-ECPLOPO5";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-caramel-au-beurre-sale-69f0be7776b2d",
name: "Cookies caramel au beurre sal\u00e9",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+caramel+au+beurre+sal%C3%A9",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/oRXBEcQIbBqspc6Me56ciMpuAFtRIz5JL14WjaMV.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies caramel au beurre salé
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-RDMLHLJF";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-cacahouete-69ef4910c1a40",
name: "Cookies Cacahou\u00e8te",
summary: "farine, Cacahou\u00e8te , Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Cacahou%C3%A8te",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/svlPa8fP4d8KEqDgdoZxpZ6LWT0JxMbBWCJuc12t.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies CacahouĂšte
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-ASBXZTMP";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-chocolat-69ef478258aa0",
name: "Cookies Chocolat",
summary: "farine, Chocolat, Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Chocolat",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/M1nM9z8mSKah1oL3si0ojXUb5NmWhmVrdrE7mq3K.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies Chocolat
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-WHYMSMZK";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/cookies-speculoos-69ef438528dc8",
name: "Cookies Speculoos",
summary: "farine, Sp\u00e9culoos, Beurre, \u0153uf, sucre, , levure chimique, vanille",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Cookies",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Cookies+Speculoos",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/lfeIWorSM7BM8D2OLzcYhvsHDz6Rj0hfJmNu8pwP.jpg";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Cookies Speculoos
Sur Devis
0,000
TND
/ piĂšce
Rayon
Hlou Amandes
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-7UE7ABBW";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/mafrouda-amande-noix-t6pl1",
name: "Mafrouda Amande Noix",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "pi\u00e8ce",
currency: "TND",
image: this.activeImage || null,
active_image: this.activeImage || null,
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Hlou Amandes",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Mafrouda+Amande+Noix",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = null;
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Mafrouda Amande Noix
Sur Devis
0,000
TND
/ piĂšce
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-KBJKRX03";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/baklewa-kchour-lim-v4ob4",
name: "Baklewa Kchour Lim",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "kg",
currency: "TND",
image: this.activeImage || null,
active_image: this.activeImage || null,
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Hlou Amandes",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Baklewa+Kchour+Lim",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = null;
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Baklewa Kchour Lim
Sur Devis
0,000
TND
/ kg
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-OU29C2F2";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/mlabes-eek9w",
name: "Mlabes",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "kg",
currency: "TND",
image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/c2A1p8YD8MIcF45aLRsMQRBVHQ69Q4ieoadk7zr7.webp",
active_image: this.activeImage || "https:\/\/lebecdor.com\/storage\/products\/c2A1p8YD8MIcF45aLRsMQRBVHQ69Q4ieoadk7zr7.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Hlou Amandes",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Mlabes",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = "https:\/\/lebecdor.com\/storage\/products\/c2A1p8YD8MIcF45aLRsMQRBVHQ69Q4ieoadk7zr7.webp";
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Mlabes
Sur Devis
0,000
TND
/ kg
0 && this.currentStock <= 5; },
get shouldForceQuote() { return this.isQuoteMode || (this.isService && this.currentPrice <= 0); },
get displaySku() {
return (this.selectedVariant && this.selectedVariant.sku) ? this.selectedVariant.sku : "PRD-IJPUC9YT";
},
get activeVariantLabel() {
if (!this.selectedVariant) return '';
return this.selectedVariant.label || this.selectedVariant.name || '';
},
init() {
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
this.inWishlist = wl.includes(this.id);
}
window.addEventListener('wishlist-updated', (e) => {
if (e.detail.product_id === this.id) {
this.inWishlist = e.detail.added;
}
});
},
get currentPrice() {
let p = this.selectedVariant ? parseFloat(this.selectedVariant.price) : this.basePrice;
return p > 0 ? p : this.basePrice;
},
formatPrice(p) { return Number(p).toLocaleString('fr-TN', { minimumFractionDigits: 3, maximumFractionDigits: 3, useGrouping: false }); },
handleCardNavigation(event) {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
this.openQuickView();
},
openQuickView() {
const activeGallery = this.galleryImages && this.galleryImages.length ? this.galleryImages : [this.activeImage].filter(Boolean);
const mappedVariants = (this.variants || []).map(v => ({
...v,
price_formatted: this.formatPrice(v.price || 0)
}));
window.dispatchEvent(new CustomEvent('open-product-quickview', {
detail: {
id: this.id,
url: "https:\/\/lebecdor.com\/catalogue\/produit\/twejen-warka-qfaqn",
name: "Twejen Warka",
summary: "",
type: this.isService ? 'service' : 'product',
is_service: this.isService,
is_quote_mode: this.isQuoteMode,
should_force_quote: this.shouldForceQuote,
manage_stock: this.productManageStock,
allow_backorder: this.allowBackorder,
stock: this.currentStock,
sku: this.displaySku,
unit: "kg",
currency: "TND",
image: this.activeImage || null,
active_image: this.activeImage || null,
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Hlou Amandes",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Twejen+Warka",
booking_enabled: false,
variants: mappedVariants,
selected_variant: this.selectedVariant ? {
...this.selectedVariant,
price_formatted: this.formatPrice(this.selectedVariant.price || 0)
} : null
}
}));
},
selectVariant(v) {
if (this.selectedVariant && this.selectedVariant.id === v.id) {
this.selectedVariant = null;
this.activeImage = null;
} else {
this.selectedVariant = v;
if(v.image) this.activeImage = v.image;
}
},
selectGalleryImage(img, idx) {
this.selectedVariant = null;
this.activeImage = img;
this.galleryIndex = idx;
},
stepGallery(direction) {
if (!this.galleryImages.length) return;
this.selectedVariant = null;
this.galleryIndex = (this.galleryIndex + direction + this.galleryImages.length) % this.galleryImages.length;
this.activeImage = this.galleryImages[this.galleryIndex];
},
openQuantityPopup() {
if (this.variants.length > 0 && !this.selectedVariant) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.choose_option,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#f59e0b', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.choose_option); }
return;
}
if (this.purchaseBlocked && !this.isQuoteMode) {
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.trans.out_of_stock,
duration: 2500, gravity: 'bottom', position: 'center',
style: { background: '#ef4444', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
} else { alert(this.trans.out_of_stock); }
return;
}
this.qty = 1;
this.openQty = true;
},
toggleWishlist() {
this.inWishlist = !this.inWishlist;
if (!this.isAuth) {
let storageKey = 'smartbs_wishlist_' + this.tenantId;
let wl = JSON.parse(localStorage.getItem(storageKey) || '[]');
if (this.inWishlist) {
if (!wl.includes(this.id)) wl.push(this.id);
} else {
wl = wl.filter(id => id !== this.id);
}
localStorage.setItem(storageKey, JSON.stringify(wl));
window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { count: wl.length, product_id: this.id, added: this.inWishlist } }));
} else {
const url = 'https://lebecdor.com/wishlist/toggle';
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name=\'csrf-token\']').content, 'Accept': 'application/json' },
body: JSON.stringify({ product_id: this.id })
}).then(res => res.json())
.then(data => { window.dispatchEvent(new CustomEvent('wishlist-updated', { detail: { added: this.inWishlist, product_id: this.id } })); })
.catch(err => { this.inWishlist = !this.inWishlist; });
}
if (typeof Toastify !== 'undefined') {
Toastify({
text: this.inWishlist ? this.trans.added_fav : this.trans.removed_fav,
duration: 2000, gravity: 'bottom', position: 'center',
style: { background: this.inWishlist ? '#f43f5e' : '#64748b', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' }
}).showToast();
}
},
addToCart() {
this.openQty = false;
let variantId = this.selectedVariant ? this.selectedVariant.id : null;
let variantSku = this.selectedVariant ? this.selectedVariant.sku : null;
let variantName = this.selectedVariant ? this.selectedVariant.name : null;
let payload = { quantity: this.qty, variant_id: variantId, variant_sku: variantSku, variant_name: variantName };
const addUrl = 'https://lebecdor.com/panier/ajouter/' + this.id;
const csrfToken = document.querySelector('meta[name=\'csrf-token\']')?.content;
fetch(addUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken, 'Accept': 'application/json' },
body: JSON.stringify(payload)
}).then(res => res.json()).then(data => {
const count = data.cart_count ?? data.count ?? '+1';
const total = data.cart_total_formatted ?? data.total_formatted ?? null;
document.querySelectorAll('.cart-count-badge').forEach(el => el.innerText = count);
if (total) document.querySelectorAll('.cart-total-price').forEach(el => el.innerText = total);
window.dispatchEvent(new Event('cart-updated'));
let successMsg = '';
if(this.isQuoteMode) {
successMsg = variantName ? this.trans.opt_add_quote.replace(':name', variantName) : this.trans.prod_add_quote;
} else {
successMsg = variantName ? this.trans.opt_add.replace(':name', variantName) : this.trans.prod_add;
}
if (typeof Toastify !== 'undefined') {
Toastify({ text: 'â
' + successMsg, duration: 2500, gravity: 'bottom', position: 'center', style: { background: '#10b981', color: '#fff', borderRadius: '10px', fontWeight: 'bold', marginBottom: '80px' } }).showToast();
} else { alert(successMsg + ' !'); }
}).catch(error => { console.error('Erreur:', error); });
}
}"
@mouseenter="isHovered = true" @mouseleave="isHovered = false"
class="group relative bg-white rounded-[2rem] p-3 md:p-4 border border-slate-100 hover:border-slate-200 transition-all duration-500 hover:shadow-2xl hover:shadow-slate-200/50 flex flex-col h-full"
style="--primary-color: #1a1a1a; --secondary-color: #f8f6f2;">
Vite, plus que
Aucun avis
En Rupture
Twejen Warka
Sur Devis
0,000
TND
/ kg
Commande rapide
Une occasion, un plateau, une envie ?
Contactez la boutique pour une commande, une réservation ou un devis événement. Les prix, devis et stocks suivent automatiquement les modules actifs du tenant.
123 Rue de l'Exemple, 75000 Paris, Sfax
contact@votreboutique.com
Demande de Devis
Contact direct avec l'artisan
FR
AR