Achetez en ligne sur ESPACE ZIED
Shop By Category
Explore our wide range of active products
BUREAUTIQUE
Explore
JEUX & JOUETS
Explore
MEUBLES
Explore
MODE BEAUTÉ ET SANTÉ
Explore
Matelas
Explore
Non classé
Explore
Segoe UI
Explore
ÉLECTROMENAGER
Explore
BUREAUTIQUE
Explore
JEUX & JOUETS
Explore
MEUBLES
Explore
MODE BEAUTÉ ET SANTÉ
Explore
Matelas
Explore
Non classé
Explore
Segoe UI
Explore
ÉLECTROMENAGER
Explore
Top Pick
Cocotte 4L 711661 SITRAPRO
499,000 TND
Acheter
Top Pick
Poêle Wok - Proline Nero - 30x5.6Cm - A2835 - Revêtement Volcanique Antiadhésive
159,000 TND
Acheter
Top Pick
chaise perla -caramel
89,000 TND
AcheterBUREAUTIQUE
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 : "SKU-W1KLOFCVOZ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lot-de-2-tabouret-marche-pied-noir-gris-5YzeZ",
name: "Lot de 2 - Tabouret Marche pied - Noir & Gris",
summary: "\r\\n \t\r\\n<\r\\n\r\\n\r\\nli\r\\n\r\\n \t\r\\nstyl\r\\n\r\\n\r\\ne\r\\n\r\\n \t\r\\n=\"list\r\\n\r\\n\r\\n-style-type: none;\">\r\\n\r\\n \t\r\\n<\r\\n\r\\n\r\\nli<\/p>\r\\n\r\\n \tyle=\"list-style-type: none;\">\r\\nstyl\r\\n\r\\n\r\\ne\r\\n\r\\n \t\r\\n=\"list\r\\n\r\\n\r\\n-sty...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/TFyOBUq7-1773234270.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/TFyOBUq7-1773234270.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lot+de+2+-+Tabouret+Marche+pied+-+Noir+%26+Gris",
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:\/\/espacezied.tn\/storage\/products\/TFyOBUq7-1773234270.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lot de 2 - Tabouret Marche pied - Noir & Gris
Sur Devis
0,000
TND
/ simple
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 : "BR718FD0Q1AWGNAFAMZ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/tabouret-marche-pied-noir-rouge-32tZM",
name: "Tabouret Marche pied - Noir & Rouge",
summary: "\r\\n \tTABOURET - SOFPINCE - MARCHE PIED - ROUGE&NOIR\r\\n \tTabouret marchepied\r\\n \tun coffre de rangement multifonctions\r\\n \tDimensions : 45x45x48 cm\r\\n \tPoids : 1,935kg\r\\n \tCouleur : rouge & Noir\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Z3KMc9Bi-1773234270.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Z3KMc9Bi-1773234270.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Tabouret+Marche+pied+-+Noir+%26+Rouge",
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:\/\/espacezied.tn\/storage\/products\/Z3KMc9Bi-1773234270.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Tabouret Marche pied - Noir & Rouge
Sur Devis
0,000
TND
/ simple
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 : "SKU-XD4YJBNRAI";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lot-de-2-chaise-pliable-rotin-gris-BRju2",
name: "Lot de 2 Chaise pliable rotin -Gris",
summary: "\r\\n \tChaise\u00a0pliable Rotin\r\\n \tMarque: Sofpince\r\\n \tCouleur : Gris\r\\n \tMati\u00e8re\u00a0: plastique\r\\n \tL\u00e9g\u00e8re et facile \u00e0 ranger\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/YQ3q5TJu-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/YQ3q5TJu-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lot+de+2+Chaise+pliable+rotin+-Gris",
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:\/\/espacezied.tn\/storage\/products\/YQ3q5TJu-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lot de 2 Chaise pliable rotin -Gris
Sur Devis
0,000
TND
/ simple
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 : "SKU-ODVKRPBUJA";
},
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:\/\/espacezied.tn\/catalogue\/produit\/chaise-pliable-rotin-grege-Ng27S",
name: "Chaise pliable rotin -Grege",
summary: "\r\\n \tChaise\u00a0pliable Rotin\r\\n \tMarque: Sofpince\r\\n \tCouleur : Grege\r\\n \tMati\u00e8re\u00a0: plastique\r\\n \tL\u00e9g\u00e8re et facile \u00e0 ranger\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/zCGSrqbM-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/zCGSrqbM-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Chaise+pliable+rotin+-Grege",
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:\/\/espacezied.tn\/storage\/products\/zCGSrqbM-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Chaise pliable rotin -Grege
Sur Devis
0,000
TND
/ simple
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 : "SKU-WL2CSCPAJX";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lot-de-2-chaise-tabouret-perla-grege-l7Vl8",
name: "Lot de 2 Chaise Tabouret Perla -Grege",
summary: "\r\\n \tLongueur : 41 cm.\r\\n \tLargeur : 41 cm.\r\\n \tHauteur : 109 cm.\r\\n \tCouleur : Gr\u00e8ge\r\\n \tMati\u00e8re\u00a0: plastique.\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/jIqv3xqt-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/jIqv3xqt-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lot+de+2+Chaise+Tabouret+Perla+-Grege",
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:\/\/espacezied.tn\/storage\/products\/jIqv3xqt-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lot de 2 Chaise Tabouret Perla -Grege
Sur Devis
0,000
TND
/ simple
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 : "SKU-BJ9VUMUTFQ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/armoire-crochet-5-casiers-gris-WXRI3",
name: "Armoire Crochet - 5 casiers - Gris",
summary: "\r\\n \tArmoire en plastique Crochet : plastique solide et durable\r\\n \tHauteur 98cm\r\\n \tLargeur 36cm\r\\n \tProfondeur 46cm\r\\n \t5 casiers\r\\n \tcouleur :\u00a0Gris\r\\n \tFabriqu\u00e9 en Tunisie\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/fXmmeoll-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/fXmmeoll-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "BUREAUTIQUE",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Armoire+Crochet++-+5+casiers+-+Gris",
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:\/\/espacezied.tn\/storage\/products\/fXmmeoll-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Armoire Crochet - 5 casiers - Gris
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
JEUX & JOUETS
JEUX & JOUETS
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 : "SKU-HKXEVNPNYX";
},
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:\/\/espacezied.tn\/catalogue\/produit\/tabouret-marche-pied-noir-gris-t8I6M",
name: "Tabouret Marche pied - Noir & Gris",
summary: "\r\\n \tTabouret marchepied\r\\n \tun coffre de rangement multifonctions\r\\n \tDimensions : 45x45x48 cm\r\\n \tPoids : 1,935kg\r\\n \tCouleur : gris & Noir\r\\n",
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: "simple",
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: "JEUX & JOUETS",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Tabouret+Marche+pied+-+Noir+%26+Gris",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Tabouret Marche pied - Noir & Gris
Sur Devis
0,000
TND
/ simple
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 : "SKU-C1ZX4LZT4E";
},
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:\/\/espacezied.tn\/catalogue\/produit\/bassine-rigide-35l-rouge-8DHvH",
name: "Bassine rigide 35L - Rouge",
summary: "\r\\n \tBassine universelle \/ cuvette \u00e0 vaisselle 35 litres\r\\n \tPlastique alimentaire\r\\n \tFacile \u00e0 nettoyer\r\\n \tR\u00e9cipient \u00c2\u00a0id\u00e9al pour recueillir l'eau de refroidissement pendant la distillation\r\\n \tfacile \u00e0 entretenir\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/JUB889wh-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/JUB889wh-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "JEUX & JOUETS",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Bassine+rigide+35L+-+Rouge",
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:\/\/espacezied.tn\/storage\/products\/JUB889wh-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Bassine rigide 35L - Rouge
Sur Devis
0,000
TND
/ simple
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 : "SKU-MFHMXRGUYN";
},
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:\/\/espacezied.tn\/catalogue\/produit\/bassine-rigide-70l-gris-2zFqH",
name: "Bassine rigide 70L - Gris",
summary: "\r\\n \tBassine universelle \/ cuvette \u00e0 vaisselle 70 litres\r\\n \tPlastique alimentaire\r\\n \tFacile \u00e0 nettoyer\r\\n \tR\u00e9cipient \u00c2\u00a0id\u00e9al pour recueillir l'eau de refroidissement pendant la distillation\r\\n \tfacile \u00e0 entretenir\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/lMxVInF4-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/lMxVInF4-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "JEUX & JOUETS",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Bassine+rigide+70L+-+Gris",
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:\/\/espacezied.tn\/storage\/products\/lMxVInF4-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Bassine rigide 70L - Gris
Sur Devis
0,000
TND
/ simple
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 : "SKU-HJC5RWZPXT";
},
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:\/\/espacezied.tn\/catalogue\/produit\/bassine-rigide-110l-rouge-5qb4m",
name: "Bassine rigide 110L - Rouge",
summary: "\r\\n \tBassine universelle \/ cuvette \u00e0 vaisselle 110 litres\r\\n \tPlastique alimentaire\r\\n \tFacile \u00e0 nettoyer\r\\n \tR\u00e9cipient \u00c2\u00a0id\u00e9al pour recueillir l'eau de refroidissement pendant la distillation\r\\n \tfacile \u00e0 entretenir\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/y0hEdxFt-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/y0hEdxFt-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "JEUX & JOUETS",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Bassine+rigide+110L+-+Rouge",
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:\/\/espacezied.tn\/storage\/products\/y0hEdxFt-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Bassine rigide 110L - Rouge
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
MEUBLES
MEUBLES
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 : "SKU-ZVJJIOWKNO";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthomedicale-190120-fPLJz",
name: "MATELAS ORTHOMEDICALE 190\/120",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/qhaUMwQR-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/qhaUMwQR-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+MATELAS+ORTHOMEDICALE+190%2F120",
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:\/\/espacezied.tn\/storage\/products\/qhaUMwQR-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
MATELAS ORTHOMEDICALE 190/120
Sur Devis
0,000
TND
/ simple
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 : "SKU-JHE9Q3IGDN";
},
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:\/\/espacezied.tn\/catalogue\/produit\/table-rectangulaire-11075-cm-4-chaise-2oeH5",
name: "Table rectangulaire 110\/75 cm + 4 chaise",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/udIbRhK7-1773234279.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/udIbRhK7-1773234279.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Table+rectangulaire+110%2F75+cm+%2B+4+chaise",
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:\/\/espacezied.tn\/storage\/products\/udIbRhK7-1773234279.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Table rectangulaire 110/75 cm + 4 chaise
Sur Devis
0,000
TND
/ simple
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 : "SKU-BNCC2DIFY8";
},
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:\/\/espacezied.tn\/catalogue\/produit\/table-rectangulaire-110x70x75-cm-4-chaise-4rprm",
name: "Table Rectangulaire 110x70x75 cm + 4 chaise",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/xWbp464Z-1773234280.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/xWbp464Z-1773234280.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Table+Rectangulaire+110x70x75+cm+%2B+4+chaise",
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:\/\/espacezied.tn\/storage\/products\/xWbp464Z-1773234280.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Table Rectangulaire 110x70x75 cm + 4 chaise
Sur Devis
0,000
TND
/ simple
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 : "SKU-6RY3HH7ABW";
},
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:\/\/espacezied.tn\/catalogue\/produit\/table-oblique-noir-167x97x75-6-chaise-KoLWz",
name: "table oblique noir 167x97x75 + 6 chaise",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/bYvJPCpz-1773234279.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/bYvJPCpz-1773234279.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+table+oblique+noir+167x97x75+%2B+6+chaise",
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:\/\/espacezied.tn\/storage\/products\/bYvJPCpz-1773234279.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
table oblique noir 167x97x75 + 6 chaise
Sur Devis
0,000
TND
/ simple
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 : "SKU-FQSDBGLI81";
},
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:\/\/espacezied.tn\/catalogue\/produit\/armoire-crochet-4-casiers-grege-J28ds",
name: "Armoire Crochet - 4 casiers - Gr\u00e8ge",
summary: "\r\\n \tArmoire en plastique Crochet : plastique solide et durable\r\\n \tHauteur 78 cm\r\\n \tLargeur 36cm\r\\n \tProfondeur 46cm\r\\n \t4 casiers\r\\n \tcouleur :\u00a0Gr\u00e8ge\r\\n \tFabriqu\u00e9 en Tunisie\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/9jd9HW2X-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/9jd9HW2X-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Armoire+Crochet++-+4+casiers+-+Gr%C3%A8ge",
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:\/\/espacezied.tn\/storage\/products\/9jd9HW2X-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
En Rupture
Sur Devis
0,000
TND
/ simple
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 : "SKU-ZRY0FRZLYE";
},
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:\/\/espacezied.tn\/catalogue\/produit\/diwan-lot-de-4chaises-grege-wbFDv",
name: "Diwan - Lot de 4Chaises Gr\u00e8ge",
summary: "\r\\n \tLot de 4 Chaises - diwan - gr\u00e9ge\r\\n \tChaise en plastique\r\\n \tCouleur gr\u00e8ge\r\\n \tId\u00e9al pour une utilisation int\u00e9rieure et ext\u00e9rieure\r\\n \tPrix \u00e9conomique\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Vmyh2Z1Q-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Vmyh2Z1Q-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MEUBLES",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Diwan+-+Lot+de+4Chaises+Gr%C3%A8ge",
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:\/\/espacezied.tn\/storage\/products\/Vmyh2Z1Q-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
En Rupture
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
MODE BEAUTÉ ET SANTÉ
MODE BEAUTÉ ET SANTÉ
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 : "SKU-XD8G1FO6WJ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/brosse-a-dents-a-batterie-avec-tete-supplementaire-atb-8716-gris-Itseo",
name: "Brosse \u00e0 dents \u00e0 batterie avec t\u00e8te suppl\u00e9mentaire - ATB-8716 - Gris",
summary: "\r\\n\r\\n \tIPX4 \u00e9tanche\r\\n \tDupont Tynex, soies douces et rondes\r\\n \tDesign ergonomique\r\\n \tVitesse de rotation: 6000 fois \/ minute\r\\n \tAngle de rotation gauche et droite: 30 degr\u00e9s\r\\n \tT\u00eate interchangeable\r\\n \tAliment\u00e9 par...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/1tU7xk4k-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/1tU7xk4k-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Brosse+%C3%A0+dents+%C3%A0+batterie+avec+t%C3%A8te+suppl%C3%A9mentaire+-+ATB-8716+-+Gris",
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:\/\/espacezied.tn\/storage\/products\/1tU7xk4k-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Brosse à dents à batterie avec tète supplémentaire - ATB-8716 - Gris
Sur Devis
0,000
TND
/ simple
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 : "SKU-Z9WLCKPK7U";
},
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:\/\/espacezied.tn\/catalogue\/produit\/brosse-a-dents-a-batterie-avec-tete-supplementaire-atb-8716-rouge-IiIRu",
name: "Brosse \u00e0 dents \u00e0 batterie avec t\u00e8te suppl\u00e9mentaire - ATB-8716 - Rouge",
summary: "\r\\n\r\\n \tIPX4 \u00e9tanche\r\\n \tDupont Tynex, soies douces et rondes\r\\n \tDesign ergonomique\r\\n \tVitesse de rotation: 6000 fois \/ minute\r\\n \tAngle de rotation gauche et droite: 30 degr\u00e9s\r\\n \tT\u00eate interchangeable\r\\n \tAliment\u00e9 par...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/q9Y2k2T2-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/q9Y2k2T2-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Brosse+%C3%A0+dents+%C3%A0+batterie+avec+t%C3%A8te+suppl%C3%A9mentaire+-+ATB-8716+-+Rouge",
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:\/\/espacezied.tn\/storage\/products\/q9Y2k2T2-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Brosse à dents à batterie avec tète supplémentaire - ATB-8716 - Rouge
Sur Devis
0,000
TND
/ simple
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 : "SKU-ARRFG2EI9R";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lisseur-cheveux-ceramique-fakir-lyric-voice-avec-keratine-230c-blanc-2wAW5",
name: "Lisseur Cheveux C\u00e9ramique FAKIR Lyric Voice avec K\u00e9ratine 230\u00b0C - Blanc",
summary: "\r\\n \tLisseur Cheveux C\u00e9ramique FAKIR Lyric Voice avec Keratine\r\\n \tAfficheur LED avec indicateur de chaleur\r\\n \tPuissance: 30 Watts\r\\n \tC\u00e2ble rotatif \u00e0 360 \u00b0\r\\n \tPlaques de rev\u00eatement en tourmaline et c\u00e9ramique ajout\u00e9es...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/0lAp67tF-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/0lAp67tF-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lisseur+Cheveux+C%C3%A9ramique+FAKIR+Lyric+Voice+avec+K%C3%A9ratine+230%C2%B0C+-+Blanc",
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:\/\/espacezied.tn\/storage\/products\/0lAp67tF-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lisseur Cheveux Céramique FAKIR Lyric Voice avec Kératine 230°C - Blanc
Sur Devis
0,000
TND
/ simple
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 : "SKU-NHZ3HR1C6T";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lisseur-ceramique-color-protect-150-a-230-c-s6300-garantie-2-an-kK7UD",
name: "lisseur C\u00e9ramique - COLOR PROTECT - 150 \u00e0 230 \u00b0C - S6300 - Garantie 2 an",
summary: "\r\\n \tRev\u00eatement Advanced Ceramic Colour Protect: pr\u00e9serve la coloration et prolonge l\u2019\u00e9clat des cheveux color\u00e9s-\r\\n \t30 niveaux detemp\u00e9rature: 150 \u00e0 230\u00b0C-\r\\n \tMolette de r\u00e9glage-\r\\n \tMise \u00e0 temp\u00e9rature ultra rapide en 1...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/eS1oGaE2-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/eS1oGaE2-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+lisseur+C%C3%A9ramique+-+COLOR+PROTECT+-+150+%C3%A0+230+%C2%B0C+-+S6300+-+Garantie+2+an",
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:\/\/espacezied.tn\/storage\/products\/eS1oGaE2-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
lisseur Céramique - COLOR PROTECT - 150 à 230 °C - S6300 - Garantie 2 an
Sur Devis
0,000
TND
/ simple
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 : "SKU-MCYNNLIYFJ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lisseur-boucleur-curl-straight-150-230oc-s6606-garantie-2-ans-woDxz",
name: "Lisseur Boucleur Curl & Straight - 150-230\u00baC - S6606 - Garantie 2 ans",
summary: "\r\\n \tDesign twist\u00e9 unique et intuitif pour cr\u00e9er facilement des boucles volumineuses, de l\u00e9g\u00e8res ondulations ou des coiffures ultra lisses\r\\n \tPlaques rev\u00eatement Advanced Ceramic Tourmaline Antistatique pour des cheveux...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/U5hM9YNH-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/U5hM9YNH-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lisseur+Boucleur+Curl+%26+Straight+-+150-230%C2%BAC+-+S6606+-+Garantie+2+ans",
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:\/\/espacezied.tn\/storage\/products\/U5hM9YNH-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lisseur Boucleur Curl & Straight - 150-230ºC - S6606 - Garantie 2 ans
Sur Devis
0,000
TND
/ simple
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 : "SKU-KDIST1AJDG";
},
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:\/\/espacezied.tn\/catalogue\/produit\/seche-cheveux-2400w-sc8460-style-Ww1Da",
name: "S\u00e8che Cheveux - 2400W - SC8460 style",
summary: "\r\\n \tS\u00e8che-cheveux ionique professionnel moteur AC\u00a0\r\\n \tPuissance : 2400 W\r\\n \tG\u00e9n\u00e9rateur d'ions. 2 vitesses et 3 temp\u00e9ratures\r\\n \tDiffuseur et concentrateur avec un bec \u00e9troit de 6mm.\r\\n \tCoup d'air froid\r\\n \tFiltre amo...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/HeiKF4pW-1773234255.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/HeiKF4pW-1773234255.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "MODE BEAUT\u00c9 ET SANT\u00c9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+S%C3%A8che+Cheveux+-+2400W+-+SC8460+style",
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:\/\/espacezied.tn\/storage\/products\/HeiKF4pW-1773234255.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Sèche Cheveux - 2400W - SC8460 style
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
Matelas
Matelas
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 : "SKU-4R0CEP6FX4";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-19090-super-siesta-WceG6",
name: "Matelas orthop\u00e9dique RELAX 190\/90 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/kVt7QsU1-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/kVt7QsU1-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+190%2F90+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/kVt7QsU1-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 190/90 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
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 : "SKU-ZBHTQP4PHE";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-190120-super-siesta-LWqDI",
name: "Matelas orthop\u00e9dique RELAX 190\/120 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/FH5AXO28-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/FH5AXO28-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+190%2F120+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/FH5AXO28-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 190/120 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
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 : "SKU-ESDUXUHEFX";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-190140-super-siesta-THvGX",
name: "Matelas orthop\u00e9dique RELAX 190\/140 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/62ISCFVa-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/62ISCFVa-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+190%2F140+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/62ISCFVa-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 190/140 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
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 : "SKU-QVTX12WTY8";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-190160-super-siesta-DRVic",
name: "Matelas orthop\u00e9dique RELAX 190\/160 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/RBvevYcy-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/RBvevYcy-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+190%2F160+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/RBvevYcy-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 190/160 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
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 : "SKU-CSFXAWDXAF";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-200160-super-siesta-lg3qs",
name: "Matelas orthop\u00e9dique RELAX 200\/160 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/qxa07nRQ-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/qxa07nRQ-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+200%2F160+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/qxa07nRQ-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 200/160 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
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 : "SKU-K1UOYVXHMP";
},
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:\/\/espacezied.tn\/catalogue\/produit\/matelas-orthopedique-relax-200180-super-siesta-B9oo7",
name: "Matelas orthop\u00e9dique RELAX 200\/180 SUPER SIESTA",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/eXzr6Ht4-1773234288.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/eXzr6Ht4-1773234288.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Matelas",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Matelas+orthop%C3%A9dique+RELAX+200%2F180+SUPER+SIESTA",
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:\/\/espacezied.tn\/storage\/products\/eXzr6Ht4-1773234288.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Matelas orthopédique RELAX 200/180 SUPER SIESTA
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
Non classé
Non classé
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 : "SKU-EMBB8QKP31";
},
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:\/\/espacezied.tn\/catalogue\/produit\/table-ovale-top-145x94x75-avec-6-chaise-RitcM",
name: "table ovale top 145x94x75 avec 6 chaise",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/FfnG46U8-1773234282.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/FfnG46U8-1773234282.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+table+ovale+top+145x94x75+avec+6+chaise",
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:\/\/espacezied.tn\/storage\/products\/FfnG46U8-1773234282.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
table ovale top 145x94x75 avec 6 chaise
Sur Devis
0,000
TND
/ simple
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 : "SKU-XY3RYKT6F1";
},
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:\/\/espacezied.tn\/catalogue\/produit\/tv-50-led-tlf-g3a-4k-smart-android-garantie-3-ans-ULtVb",
name: "TV 50\" LED - TLF G3A - 4K - Smart - Android - Garantie 3 ans",
summary: "\r\\n \tTV 50\" - TLF - 4K - SMART\r\\n \t\u00a0R\u00e9solution:\u00a03840 x 2160 pixels\r\\n \t\u00a0Syst\u00e8me:\u00a0Android 10.0 Q\r\\n \t\u00a0Processeur:\u00a0Quad Core\u00a01.5GHz\r\\n \t\u00a0Audio: Dolby Digital + DTS\r\\n \t\u00a0Taux de rafraichissement: 50\/60 Hz\r\\n \tR\u00e9glage de lum...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/OE7pVr5i-1773234270.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/OE7pVr5i-1773234270.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+TV+50%22+LED+-+TLF+G3A+-+4K+-+Smart+-+Android+-+Garantie+3+ans",
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:\/\/espacezied.tn\/storage\/products\/OE7pVr5i-1773234270.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
TV 50" LED - TLF G3A - 4K - Smart - Android - Garantie 3 ans
Sur Devis
0,000
TND
/ simple
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 : "SKU-PH4QXBGNT6";
},
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:\/\/espacezied.tn\/catalogue\/produit\/chaise-tabouret-perla-gris-Wg1Zb",
name: "Chaise Tabouret Perla -Gris",
summary: "\r\\n \tLongueur : 41 cm.\r\\n \tLargeur : 41 cm.\r\\n \tHauteur : 109 cm.\r\\n \tCouleur : Gris\r\\n \tMati\u00e8re\u00a0: plastique.\r\\n",
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: "simple",
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: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Chaise+Tabouret+Perla+-Gris",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Chaise Tabouret Perla -Gris
Sur Devis
0,000
TND
/ simple
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 : "SKU-LSP0DOC5KY";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lot-de-2-chaise-tabouret-perla-gris-626jE",
name: "Lot de 2 chaise Tabouret Perla -Gris",
summary: "\r\\n \tLongueur : 41 cm.\r\\n \tLargeur : 41 cm.\r\\n \tHauteur : 109 cm.\r\\n \tCouleur : Gris\r\\n \tMati\u00e8re\u00a0: plastique.\r\\n",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/JEWkRRUM-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/JEWkRRUM-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lot+de+2+chaise+Tabouret+Perla+-Gris",
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:\/\/espacezied.tn\/storage\/products\/JEWkRRUM-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lot de 2 chaise Tabouret Perla -Gris
Sur Devis
0,000
TND
/ simple
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 : "BR718FD0SUCXWNAFAMZ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/lot-de-4-chaise-tabouret-perla-grege-BRRR9",
name: "Lot de 4 Chaise Tabouret Perla -Grege",
summary: "\r\\n \tLOT DE 4 - CHAISE TABOIURET - PERLA\r\\n \tLongueur : 41 cm.\r\\n \tLargeur : 41 cm.\r\\n \tHauteur : 109 cm.\r\\n \tCouleur : Gr\u00e8ge\r\\n \tMati\u00e8re\u00a0: plastique.\r\\n \tMod\u00e8le: perla\r\\n \tTaille (Longueur x Largeur x Hauteur cm): 12x\r\\...",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/rr0GbXCt-1773234269.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/rr0GbXCt-1773234269.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Lot+de+4++Chaise+Tabouret+Perla+-Grege",
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:\/\/espacezied.tn\/storage\/products\/rr0GbXCt-1773234269.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Lot de 4 Chaise Tabouret Perla -Grege
Sur Devis
0,000
TND
/ simple
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 : "SKU-ZMF1GAIENJ";
},
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:\/\/espacezied.tn\/catalogue\/produit\/porte-chaussure-en-plastique-effet-rotin-gris-noir-RWs6L",
name: "Porte chaussure en plastique - Effet Rotin - Gris & Noir",
summary: "Porte chaussure en plastique durable et solide 5 \u00e9tagesDimension: 52x30x 99 cm\u00c9quip\u00e9 de 5 \u00e9tag\u00e8res de rangement.Couleurs : Gris & Noi",
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: "simple",
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: "Non class\u00e9",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Porte+chaussure+en+plastique+-+Effet+Rotin+-+Gris+%26+Noir",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Porte chaussure en plastique - Effet Rotin - Gris & Noir
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
Segoe UI
Segoe UI
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 : "SKU-R9XMVDDAF4";
},
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:\/\/espacezied.tn\/catalogue\/produit\/plaque-de-cuisson-encastrable-2-feux-f812x-inox-30cm-garantie-2-ans-HHVI7",
name: "Plaque de cuisson encastrable - 2 feux - F.812X - Inox - 30cm - Garantie 2 ans",
summary: "Silver Dots",
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: "simple",
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: "Segoe UI",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Plaque+de+cuisson+encastrable++-+2+feux+-+F.812X+-+Inox+-+30cm+-+Garantie+2+ans",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
sans-serif;color: #313133\""><span style=\""font-size: 14px\"">de Cuisson de la marque FOCUS pose li...
Segoe UI
Plaque de cuisson encastrable - 2 feux - F.812X - Inox - 30cm - Garantie 2 ans
Sur Devis
0,000
TND
/ simple
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 : "SKU-WTUBSGRPXG";
},
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:\/\/espacezied.tn\/catalogue\/produit\/pese-personne-silver-40821-garantie-1-an-cMtAa",
name: "P\u00e8se Personne - Silver - 40.821 - Garantie 1 an",
summary: "Blanc",
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: "simple",
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: "Segoe UI",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+P%C3%A8se+Personne+-+Silver+-++40.821+-+Garantie+1+an",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
En Rupture
Sur Devis
0,000
TND
/ simple
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 : "SKU-KMOE1ZGJ7H";
},
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:\/\/espacezied.tn\/catalogue\/produit\/hotte-aspirante-casquette-f602x-inox-garantie-2-ans-yKXjm",
name: "Hotte aspirante Casquette F.602X - Inox - Garantie 2 ans",
summary: "Gris",
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: "simple",
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: "Segoe UI",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Hotte+aspirante+Casquette+F.602X+-+Inox+-+Garantie+2+ans",
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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Hotte aspirante Casquette F.602X - Inox - Garantie 2 ans
Sur Devis
0,000
TND
/ simple
À Suivre
Préparez-vous pour
Préparez-vous pour
ÉLECTROMENAGER
ÉLECTROMENAGER
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 : "SKU-JTLRWHAN4W";
},
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:\/\/espacezied.tn\/catalogue\/produit\/bouilloire-ki-431d10-6-inox-tefal-ynPKx",
name: "Bouilloire KI 431D10 (6) INOX TEFAL",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/SmOmuf1R-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/SmOmuf1R-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Bouilloire+KI+431D10+%286%29+INOX+TEFAL",
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:\/\/espacezied.tn\/storage\/products\/SmOmuf1R-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Bouilloire KI 431D10 (6) INOX TEFAL
Sur Devis
0,000
TND
/ simple
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 : "SKU-WZXMWXDKLT";
},
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:\/\/espacezied.tn\/catalogue\/produit\/boulloire-sans-fil-kenwood-zim11-000ss-17l-inox-xnGJW",
name: "BOULLOIRE SANS FIL KENWOOD ZIM11-000SS 1.7L-INOX",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/i7FzCEys-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/i7FzCEys-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+BOULLOIRE+SANS+FIL+KENWOOD+ZIM11-000SS+1.7L-INOX",
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:\/\/espacezied.tn\/storage\/products\/i7FzCEys-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
BOULLOIRE SANS FIL KENWOOD ZIM11-000SS 1.7L-INOX
Sur Devis
0,000
TND
/ simple
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 : "SKU-21GKBFL45V";
},
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:\/\/espacezied.tn\/catalogue\/produit\/moulinex-f68-m-air-fryer-fvK7T",
name: "Moulinex F68-M AIR FRYER",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/bGXKkFJB-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/bGXKkFJB-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+Moulinex+F68-M+AIR+FRYER",
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:\/\/espacezied.tn\/storage\/products\/bGXKkFJB-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
Moulinex F68-M AIR FRYER
Sur Devis
0,000
TND
/ simple
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 : "SKU-L5I0ZQVK9I";
},
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:\/\/espacezied.tn\/catalogue\/produit\/fer-a-vap-fv-1054-l0-8-tefal-tKjPl",
name: "FER A VAP FV 1054 L0 (8) TEFAL",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Q5dQBD3h-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/Q5dQBD3h-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+FER+A+VAP+FV+1054+L0+%288%29+TEFAL",
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:\/\/espacezied.tn\/storage\/products\/Q5dQBD3h-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
FER A VAP FV 1054 L0 (8) TEFAL
Sur Devis
0,000
TND
/ simple
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 : "SKU-GOR9LZC1BW";
},
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:\/\/espacezied.tn\/catalogue\/produit\/fer-a-vap-fv-2835eo-2400w-tefal-UcC08",
name: "FER A VAP FV 2835EO 2400W TEFAL",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/PleupsdS-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/PleupsdS-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+FER+A+VAP+FV+2835EO+2400W+TEFAL",
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:\/\/espacezied.tn\/storage\/products\/PleupsdS-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
FER A VAP FV 2835EO 2400W TEFAL
Sur Devis
0,000
TND
/ simple
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 : "SKU-WQFLDZAHUC";
},
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:\/\/espacezied.tn\/catalogue\/produit\/fer-a-vap-fv-5718eo-6-2500w-tefal-nWzGa",
name: "FER A VAP FV 5718EO (6) 2500W TEFAL",
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: "simple",
currency: "TND",
image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/EuVW3nvT-1773234290.webp",
active_image: this.activeImage || "https:\/\/espacezied.tn\/storage\/products\/EuVW3nvT-1773234290.webp",
gallery: activeGallery,
price: this.currentPrice,
price_formatted: this.formatPrice(this.currentPrice),
compare_price_formatted: "0,000",
seller: null,
category: "\u00c9LECTROMENAGER",
wa_link: "https:\/\/wa.me\/33123456789?text=Bonjour%2C+je+suis+int%C3%A9ress%C3%A9+par+%3A+FER+A+VAP+FV+5718EO+%286%29+2500W+TEFAL",
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:\/\/espacezied.tn\/storage\/products\/EuVW3nvT-1773234290.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://espacezied.tn/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://espacezied.tn/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: #94c11e; --secondary-color: #706e6f;">
Vite, plus que
Aucun avis
En Rupture
FER A VAP FV 5718EO (6) 2500W TEFAL
Sur Devis
0,000
TND
/ simple
Marques Officielles & Partenaires
Sofpince
Aprilla
Fakir
Remington
Beurer
Braun
Philips
Oral B
Ufesa
Babyliss
CLATRONIC
2
808
1272
1563
1586
Arial
TEFAL
et filtre anti-odeur en charbon optionnel
1463
luxell
1247
1421
Helvetica
Whirlpool
7 l et son corps en inox brossé avec logo embossé sauront s’adapter à votre cuisine</span></p>"
1190
1176
1323
1610
1221
961
Telefunken
Hoover
SINBO
Samsung
beper
KORKMAZ
MIDEA
gree
Focus
HYUNDAI
TOPMATIC
KENWOOD
TECHWOOD
KIWI
SUPER SIESTA
premium
Magimix
MOULINEX
sans-serif;font-size:13px;text-align:justify\"">75 x 70 x 72 cm</strong><span style=\""font-family:p...
sans-serif;color: #313133\""><span style=\""font-size: 14px\"">de Cuisson de la marque FOCUS pose li...
Sofpince
Aprilla
Fakir
Remington
Beurer
Braun
Philips
Oral B
Ufesa
Babyliss
CLATRONIC
2
808
1272
1563
1586
Arial
TEFAL
et filtre anti-odeur en charbon optionnel
1463
luxell
1247
1421
Helvetica
Whirlpool
7 l et son corps en inox brossé avec logo embossé sauront s’adapter à votre cuisine</span></p>"
1190
1176
1323
1610
1221
961
Telefunken
Hoover
SINBO
Samsung
beper
KORKMAZ
MIDEA
gree
Focus
HYUNDAI
TOPMATIC
KENWOOD
TECHWOOD
KIWI
SUPER SIESTA
premium
Magimix
MOULINEX
sans-serif;font-size:13px;text-align:justify\"">75 x 70 x 72 cm</strong><span style=\""font-family:p...
sans-serif;color: #313133\""><span style=\""font-size: 14px\"">de Cuisson de la marque FOCUS pose li...
Sofpince
Aprilla
Fakir
Remington
Beurer
Braun
Philips
Oral B
Ufesa
Babyliss
CLATRONIC
2
808
1272
1563
1586
Arial
TEFAL
et filtre anti-odeur en charbon optionnel
1463
luxell
1247
1421
Helvetica
Whirlpool
7 l et son corps en inox brossé avec logo embossé sauront s’adapter à votre cuisine</span></p>"
1190
1176
1323
1610
1221
961
Telefunken
Hoover
SINBO
Samsung
beper
KORKMAZ
MIDEA
gree
Focus
HYUNDAI
TOPMATIC
KENWOOD
TECHWOOD
KIWI
SUPER SIESTA
premium
Magimix
MOULINEX
sans-serif;font-size:13px;text-align:justify\"">75 x 70 x 72 cm</strong><span style=\""font-family:p...
sans-serif;color: #313133\""><span style=\""font-size: 14px\"">de Cuisson de la marque FOCUS pose li...
(4.8)
TND