From: soufiane Date: Wed, 21 Jan 2026 15:43:25 +0000 (+0100) Subject: wait #7898 @1:30 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=252f5f73955fddb6b9e0879783159b49b3ca1c7b;p=fluidbook-html5.git wait #7898 @1:30 --- diff --git a/js/libs/fluidbook/cart/fluidbook.cart.kimplay.js b/js/libs/fluidbook/cart/fluidbook.cart.kimplay.js index e76ec519..e18d3225 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.kimplay.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.kimplay.js @@ -4,7 +4,7 @@ function FluidbookCartKimplay(cart) { this.data = this.fluidbook.settings.basketReferences; this.showAddToCartTooltips = false; this.items = {}; - this.formDataStorage = window.localStorage.getItem('formData') + this.formDataStorage = {}; this.ps = null; this.init(); } @@ -13,6 +13,7 @@ FluidbookCartKimplay.prototype = { init: function () { var $this = this; this.items = this.fluidbook.cache.get('cart', {}); + this.formDataStorage = this.fluidbook.cache.get('formData', {}); $(document).on(this.fluidbook.input.changeEvent, '#kimplaycart input[name=qty]', function() { let ref = $(this).data('ref') @@ -43,6 +44,11 @@ FluidbookCartKimplay.prototype = { $this.fluidbook.menu.closeView(); $this.save(); }); + + $(document).on(this.fluidbook.input.changeEvent, '#kimplay-sendcart-form input, #kimplay-sendcart-form textarea', function() { + $this.formDataStorage[$(this).attr('name')] = $(this).val() + $this.fluidbook.cache.set('formData', $this.formDataStorage); + }) }, emptyCart: function () { @@ -129,15 +135,6 @@ FluidbookCartKimplay.prototype = { return res; }, - setFormData: function () { - const form = document.getElementById("kimplay-sendcart-form"); - if(!form) { - return false; - } - const formData = new FormData(form); - window.localStorage.setItem('formData', JSON.stringify(formData)) - }, - updateCart: function () { if ($('#kimplaycart').length > 0) { $('#kimplaycart .content').html(this.getCartContent()); @@ -154,7 +151,6 @@ FluidbookCartKimplay.prototype = { }, openCart: function (p2, callback) { - console.log('okkkk') this._endMenu(this.fluidbook.l10n.__('my selection'), this.getCartContent(), function () { callback(); }); @@ -255,8 +251,8 @@ FluidbookCartKimplay.prototype = { }, getContactForm: function() { - let data = JSON.parse(this.formDataStorage); - if(!data) { + let data = this.formDataStorage; + if(data.length > 0) { data = { 'company':'', 'name':'', @@ -273,33 +269,33 @@ FluidbookCartKimplay.prototype = {
- +

- +

- +

- +

- +

- +

- +

*Champs obligatoires