From: Vincent Vanwaelscappel Date: Thu, 27 Apr 2023 18:24:17 +0000 (+0200) Subject: wip #5893 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=320d7590771a6d452799ddf4c81cc066f01da5bd;p=fluidbook-html5.git wip #5893 @0.5 --- diff --git a/js/libs/fluidbook/cart/fluidbook.cart.bastide.js b/js/libs/fluidbook/cart/fluidbook.cart.bastide.js index e5079bd4..28b4bcc8 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.bastide.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.bastide.js @@ -2,7 +2,7 @@ function FluidbookCartBastide(cart) { this.cart = cart; this.fluidbook = this.cart.fluidbook; this.data = this.fluidbook.settings.basketReferences; - this.form_endpoint = 'https://workshop.fluidbook.com/services/bastide'; // Where cart form is processed + this.form_endpoint = this.fluidbook.service.getBaseURL()+'bastide'; // Where cart form is processed this.init(); } diff --git a/js/libs/fluidbook/cart/fluidbook.cart.cfoc.js b/js/libs/fluidbook/cart/fluidbook.cart.cfoc.js index cdda3da4..403da75d 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.cfoc.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.cfoc.js @@ -4,7 +4,7 @@ function FluidbookCartCFOC(cart) { this.fluidbook = this.cart.fluidbook; this.data = this.fluidbook.settings.basketReferences; this.TVA_percentage = 20; // Displayed in Cart and used to calculate HT value from TTC - this.form_endpoint = 'https://workshop.fluidbook.com/services/CFOC'; // Where cart form is processed + this.form_endpoint = this.fluidbook.service.getBaseURL() + 'CFOC'; // Where cart form is processed this.init(); } @@ -56,7 +56,7 @@ FluidbookCartCFOC.prototype = { return true; }); - $(document).on('change', '#CFOC_user_details [name="profile"]', function() { + $(document).on('change', '#CFOC_user_details [name="profile"]', function () { let profile = $(this).val(); $('#CFOC_user_details form').addClass('hidden'); // Hide all forms @@ -76,7 +76,7 @@ FluidbookCartCFOC.prototype = { }); // Handle "Valider ma sélection" button in cart - $(document).on(this.fluidbook.input.clickEvent, '#CFOC_cart [data-validate-cart]', function(event) { + $(document).on(this.fluidbook.input.clickEvent, '#CFOC_cart [data-validate-cart]', function (event) { event.preventDefault(); // Use the built-in HTML5 validation to make sure all fields are valid in the cart @@ -92,7 +92,7 @@ FluidbookCartCFOC.prototype = { }); // Handle details form validation and submission - $(document).on(this.fluidbook.input.clickEvent, '#CFOC_user_details [data-send-cart]', function(event) { + $(document).on(this.fluidbook.input.clickEvent, '#CFOC_user_details [data-send-cart]', function (event) { event.preventDefault(); // Since there are multiple forms depending on the profile, @@ -116,7 +116,7 @@ FluidbookCartCFOC.prototype = { label: 'Profil', value: $('#CFOC_user_details select[name="profile"]').val() } - user_data.forEach(function(value, key) { + user_data.forEach(function (value, key) { user_details[key] = { label: forms[form_name][key]['label'], value: value, @@ -209,7 +209,7 @@ FluidbookCartCFOC.prototype = { this.items.unshift(item); this.save(); - setTimeout(function() { + setTimeout(function () { $this.fluidbook.tooltip.displayTooltip(fluidbook.l10n.__("the item has been added to your cart")); setTimeout($this.fluidbook.tooltip.hideTooltip, 3000); }, 100); @@ -263,7 +263,7 @@ FluidbookCartCFOC.prototype = { $.each($this.getColumnsForXLS(), function (key, title) { - switch(key) { + switch (key) { case 'QTE': item[key] = cart_item['quantity']; break; @@ -356,7 +356,7 @@ FluidbookCartCFOC.prototype = { // The columns should be the same as for the cart except we add "EAN" after LIGNE and skip "DELETE" let columns = {}; - $.each(this.getColumns(), function(key, title) { + $.each(this.getColumns(), function (key, title) { if (key === 'DELETE') return; @@ -451,22 +451,22 @@ FluidbookCartCFOC.prototype = { getCartContent: function () { if (this.getItemCount() === 0) { - return `
${ this.fluidbook.l10n.__('your cart is empty') }
`; + return `
${this.fluidbook.l10n.__('your cart is empty')}
`; } let $this = this; let columns = this.getColumns(); let content = - `
+ `
${Object.entries(columns) - .map(heading => ``) - .join('') - } + .map(heading => ``) + .join('') + } `; @@ -484,9 +484,9 @@ FluidbookCartCFOC.prototype = { let value = data[key] || '—'; // Fallback for missing values let output = ''; - switch(key) { + switch (key) { case 'LIGNE': - output = data['EXCLU'] ? '*' : ''; // Mark exclusive products with an asterisk + output = data['EXCLU'] ? '*' : ''; // Mark exclusive products with an asterisk output += value; break; case 'COULEUR': @@ -496,9 +496,9 @@ FluidbookCartCFOC.prototype = { let css_class = (item.EAN === '') ? 'alert' : ''; - output = ` + `; + $.each(colours, function (EAN, product) { let selected = (item.EAN === EAN) ? 'selected' : ''; output += ``; }); @@ -511,7 +511,7 @@ FluidbookCartCFOC.prototype = { case 'QTE': let min_quantity = data['QTE MINI'] || 1; - output = `
`; + output = `
`; output += `
${heading[1]}${heading[1]}