]> _ Git - pmi.git/commitdiff
wait #6364 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Oct 2023 08:38:00 +0000 (10:38 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Oct 2023 08:38:00 +0000 (10:38 +0200)
data/pmi.csv [deleted file]
resources/js/app.js
resources/views/components/cart-add.blade.php

diff --git a/data/pmi.csv b/data/pmi.csv
deleted file mode 100644 (file)
index 7dd50a4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-Reference Produit;Nom du Produit - FR;Fournisseur;Categorie;Publier 
-1500;1500 | Cellule de force galette;INTERFACE;Force;1
-FP2000;FP2000 | Capteur de pression différentielle configurable;HONEYWELL;Pression;0
-1200HC;1200HC | Capteur de force de compression haute précision;INTERFACE;Force;1
-AD2.5D;AD2.5D | Capteur de force 6-axes;AMTI;Force;1
-AMP-SG2-U2;AMP-SG2-U2 | Conditionneur 2 ponts de jauges pour collecteur tournant;MICHIGAN SCIENTIFIC;Amplificateur conditionneur;1
-AMP-TC-M1;AMP-TC-M1 | Amplificateur thermocouple 3 voies;MICHIGAN SCIENTIFIC;Amplificateur conditionneur;1
-ASC-5521;ASC 5521 | Accelerometre tri-axe MEMS capacitif;ASC GmbH;Acceleration;1
-ASC-IMU 7-LN;ASC IMU 7LN | Centrale inertielle MEMS 6 axes ;ASC GmbH;Acceleration;1
-ASC-OS-115LN;ASC OS 115LN | Accelerometre 1-axe MEMS Capacitif +/- 400g;ASC GmbH;Acceleration;1
-ASMP;ASMP | Accelerometre angulaire +/- 1000G;JEWELL;Acceleration;1
-B4-2W;B4-2W | Collecteur tubulaire 50,8 mm - étanche;MICHIGAN SCIENTIFIC;Collecteur tournant;1
-CPA-1.25;CPA-1,25 | Load Pin 8,1 tonnes;STRAINSERT;Force;1
-CT2;CT2 | Boitier électronique pour capteur de roue dynamométrique;MICHIGAN SCIENTIFIC;Amplificateur conditionneur;1
-DigiVIT;DigiVIT | Mesure de position-déplacement sans contact - sortie numérique;KAMAN;Deplacement;1
-DXA-100;DXA-100 | Accelerometre asservi linéaire 1 axe RS-485;JEWELL;Acceleration;1
-DXI-100;DXI-100 | Inclinomètre asservi 1-axe - RS-485 - IP67;JEWELL;Inclinaison;1
-FL50;FL 50 | Cellule de force plate - 22,6 tonnes;STRAINSERT;Force;1
-FM-100;FM 100 | Force de pincement porte;DRIVE TEST;Anti-pincement;1
-FM-200;FM-200 | Force de pincement toit ouvrant - vitre - hayon;DRIVE TEST;Anti-pincement;1
-FX-HM;FX-HM | Capteur potentiométrique à câble - 38,1 mm - 0-10VDC;UNIMEASURE;Deplacement;1
-NT-GAR-750;NT-GAR-750 | Capteur de déplacement linéaire;NEWTEK;Deplacement;1
-GSV-8DS;GSV-8DS | Boitier d'acquisition 8 ponts de jauges USB 24-bit;ME-MESSYSTEME;Système d'acquisition;1
-GSV-4USB;GSV-4USB | Boitier d'acquisition 4 ponts de jauges USB 24-bit;ME-MESSYSTEME;Système d'acquisition;1
-NT-HE-750;NT-HE-750 | Capteur de déplacement linéaire;NEWTEK;Deplacement;1
-HRDT;HRDT | Capteur de couple rotatif sans contact;INTERFACE;Couple;1
-HX-V;HX-V | Capteur déplacement et vitesse à câble;UNIMEASURE;Deplacement;1
-IX510;IX510 | Capteur de pression pneu;XSENSOR Technology Corporation;Cartographie de pression;1
-JDI-100;JDI-100 | Inclinomètre MEMS 1 axe - RS-485 - IP67;JEWELL;Inclinaison;1
-K6D27;K6D27 | Capteur de forces 6 axes - 50N/200N/1Nm;ME-MESSYSTEME;Force;1
-KD-1925;KD-1925 | Capteur de déplacement sans contact - conditions extrêmes;KAMAN;Deplacement;1
-KD-2306;KD 2306 | Mesure de position-déplacement sans contact mono-voie;KAMAN;Deplacement;1
-LCA-165;LCA-165 | Accelerometre asservi linéaire 1-Axe ferroviaire;JEWELL;Acceleration;1
-LCF-196;LCF-196 | Inclinomètre asservi biaxe - haute précision - IP65;JEWELL;Inclinaison;1
-LSM;LSM | Accelerometre asservi linéaire 1 axe compact;JEWELL;Acceleration;1
-LW12.8-50;LW12.8-50 | Roue dynamométrique 6 axes 50kN 6,5 kNm;MICHIGAN SCIENTIFIC;Roue dynamometrique;1
-LW-2T-100K;LW-2T-100K | Roue dynamométrique 6 axes 445kN 135 kNm;MICHIGAN SCIENTIFIC;Roue dynamometrique;1
-LWAMP;LWAMP-12-8 - Conditionneur Numérique;MICHIGAN SCIENTIFIC;Amplificateur conditionneur;1
-LX-PA;LX-PA | Capteur à câble potentiométrique - 50 à 1250 mm;UNIMEASURE;Deplacement;1
-LX205;LX205 | Nappe de capteurs de pression haute résolution;XSENSOR Technology Corporation;Cartographie de pression;1
-LX210;LX210 - Nappe de capteurs de pression;XSENSOR Technology Corporation;Cartographie de pression;1
-NT-M-375;NT-M-375 | Capteur de déplacement linéaire;NEWTEK;Deplacement;1
-MBP;MBP | Capteur de force petite taille, protection surcharge;INTERFACE;Force;1
-MC5;MC5| Capteur de force cylindrique 6-axes;AMTI;Force;1
-Model-415;Model 415 | Capteur de pression absolue - 4-20mA - 0-1380 bar;HONEYWELL;Pression;0
-MRT;MRT | Capteur de couple miniature;INTERFACE;Couple;1
-P100;P100 | Capteur de position linéaire haute résolution cylindrique;POSITEK;Deplacement;1
-P500;P500 | Capteur de position angulaire à induction;POSITEK;Deplacement;1
-S4;S4 S6 S8 S10 |4 à 10 connections - montage bout d'arbre;MICHIGAN SCIENTIFIC;Collecteur tournant;1
-S125;S125 | Capteur de position linéaire IP68 350 bar;POSITEK;Deplacement;1
-SGA3A;SGA3A | Module conditionneur 3 ponts de jauges;MICHIGAN SCIENTIFIC;Amplificateur conditionneur;1
-SMT-9700;SMT-9700 | Mesure de déplacement sans contact 1 à 3 voies;KAMAN;Deplacement;1
-SR10M;SR10M SR20M SR36M | Collecteur fin d'axe haute durabilité;MICHIGAN SCIENTIFIC;Collecteur tournant;1
-SSM;SSM | Capteur de force type S extrême;INTERFACE;Force;1
-ThreadChecker;ThreadChecker | Contrôle de taraudage sans contact;KAMAN;Controle-de-taraudage;1
-TR3D-B;Square Three Axis Load Cell up to 7000N;MICHIGAN SCIENTIFIC;Force;1
-TS11;Flange Style Reaction Torque Transducer;INTERFACE;Couple;1
-TW12.8;TW12.8;MICHIGAN SCIENTIFIC;Roue dynamometrique;1
-TWHR;TWHR2000;MICHIGAN SCIENTIFIC;Roue dynamometrique;1
-X500;X500 | Capteur de position angulaire à induction;POSITEK;Deplacement;1
-ZX-PA;ZX-PA | Capteur à câble potentiométrique -38 mm - 25Hz;UNIMEASURE;Deplacement;1
index 9f5b7c292db35c4e94e7df75cd509046032bd899..03a5e00bfe3dc06d7b9bcc4e73be72c31e46ee16 100644 (file)
@@ -91,7 +91,7 @@ const app = new Vue({
 
     beforeMount() {
         this.items = JSON.parse(this.$el.dataset.cartItems);
-        this.tab = window.location.hash.replace('#','') || 'infos'
+        this.tab = window.location.hash.replace('#', '') || 'infos'
         this.getUser()
 
         eventBus.$on('send-id', data => {
@@ -101,6 +101,10 @@ const app = new Vue({
 
     mounted() {
         eventBus.$on('add-item', data => {
+            if (!this.statusConfig) {
+                alert('Configuration incomplète');
+                return;
+            }
             data.action = 'add';
             data.ref = data.ref !== "" ? data.ref : this.ref;
             data.price = data.price !== undefined ? data.price : this.price;
@@ -121,17 +125,18 @@ const app = new Vue({
         });
 
         this.ref = this.$refs.refProduct?.dataset.ref
-        this.price = this.$refs.optprice ?.dataset.default
-        this.statusText = this.$refs.statusConfig ?.dataset.incomplete
-        this.discount = this.$refs.discount ?.dataset.value
-        this.validateAction = this.$refs.forgotpwd ?.dataset.status //specific code for the forgot password confirmation
+        this.price = this.$refs.optprice?.dataset.default
+        this.statusText = this.$refs.statusConfig?.dataset.incomplete
+        this.discount = this.$refs.discount?.dataset.value
+        this.validateAction = this.$refs.forgotpwd?.dataset.status //specific code for the forgot password confirmation
 
         let option = this.$refs.optionsExist?.dataset.val;
         this.statusConfig = !option && this.price ? true : false
+
     },
 
     watch: {
-        errorsForm: function(newValue, old) {
+        errorsForm: function (newValue, old) {
             this.errorsForm = newValue ??= old
         }
     },
@@ -147,7 +152,7 @@ const app = new Vue({
         },
 
         cartItemHasPriceCount() {
-            return this.items.length ? this.items.filter(n => n.price !== "" && !isNaN(n.price) && n.price > 0 ).length: 0
+            return this.items.length ? this.items.filter(n => n.price !== "" && !isNaN(n.price) && n.price > 0).length : 0
         },
 
         total() {
@@ -182,7 +187,7 @@ const app = new Vue({
             axios.post('/ajax/cart', data)
                 .then(function (response) {
                     if (response.data.needs_update) {
-                        console.log("response",response.data.cart_data)
+                        console.log("response", response.data.cart_data)
                         root.items = response.data.cart_data;
                     }
 
@@ -222,7 +227,7 @@ const app = new Vue({
          * The following functions are used for login,register and account page
          *
          */
-        scrollToTop(){
+        scrollToTop() {
             window.scrollTo({
                 top: 0,
                 behavior: "smooth"
@@ -231,8 +236,8 @@ const app = new Vue({
         lockTab(tab) {
             // Add hash to url to stay in same tab when page is reloading
             // It used in account page when we navigate between different tab
-            let fullUrl = window.location.origin+window.location.pathname
-            history.pushState("", "", fullUrl+'#'+tab);
+            let fullUrl = window.location.origin + window.location.pathname
+            history.pushState("", "", fullUrl + '#' + tab);
         },
         activeTab(tab) {
             this.tab = tab
@@ -248,35 +253,35 @@ const app = new Vue({
             let errors = document.querySelector('.form-errors'),
                 errorInput = document.querySelectorAll('.error')
 
-            if(errors)
+            if (errors)
                 for (var i = 0; i < errorInput.length; i++) {
                     errorInput[i].classList.remove('error');
                 }
 
             this.errorsForm = {}
         },
-        errorHandling(data, root, form){
+        errorHandling(data, root, form) {
             if (data.response) {
-                let errors = { 'errors': data.response.data.errors, 'id': form }
+                let errors = {'errors': data.response.data.errors, 'id': form}
 
                 root.removeErrorsForm()
                 root.errorsForm = errors
 
                 for (let k in errors['errors']) {
-                    if(k.indexOf('.')){
+                    if (k.indexOf('.')) {
                         let keys = k.split('.')
-                        for(let i = 0; i < keys.length; i++){
-                            if(i !== 0){
-                                k += '['+keys[i]+']'
-                            }else{
+                        for (let i = 0; i < keys.length; i++) {
+                            if (i !== 0) {
+                                k += '[' + keys[i] + ']'
+                            } else {
                                 k = keys[i]
                             }
                         }
                     }
                     let el = document.querySelector('[name*="' + k + '"]')
 
-                    if(form)
-                        el = document.querySelector(form+' [name*="' + k + '"]')
+                    if (form)
+                        el = document.querySelector(form + ' [name*="' + k + '"]')
 
                     el.classList.add('error')
                 }
@@ -284,8 +289,8 @@ const app = new Vue({
         },
         animateDelete(el, parent = null) {
             el.animate([
-                    { opacity: 1 },
-                    { opacity: 0 }
+                    {opacity: 1},
+                    {opacity: 0}
                 ],
                 {
                     duration: 1000
@@ -310,9 +315,9 @@ const app = new Vue({
                     }
                 })
                 .catch(function (error) {
-                    root.errorHandling(error, root)
-                }
-            )
+                        root.errorHandling(error, root)
+                    }
+                )
         },
         signin() {
             let root = this,
@@ -324,25 +329,25 @@ const app = new Vue({
 
             axios.post('/ajax/signin', data)
                 .then(function (response) {
-                    if(lastVisitedUrl){
-                        if(lastVisitedUrl.includes('pm-instrumentation')){
+                    if (lastVisitedUrl) {
+                        if (lastVisitedUrl.includes('pm-instrumentation')) {
                             window.location.replace(lastVisitedUrl)
-                        }else{
+                        } else {
                             window.location.replace(homeUrl)
                         }
-                    }else{
+                    } else {
                         window.location.replace(homeUrl)
                     }
                 })
                 .catch(function (error) {
-                    if (error.response && 419 === error.response.status) {
-                        window.location.reload()
-                    }
-                    if(error.response) {
-                        root.errorHandling(error, root)
+                        if (error.response && 419 === error.response.status) {
+                            window.location.reload()
+                        }
+                        if (error.response) {
+                            root.errorHandling(error, root)
+                        }
                     }
-                }
-            )
+                )
         },
         signup() {
             let root = this,
@@ -363,10 +368,10 @@ const app = new Vue({
                     this.scrollToTop()
                 })
                 .catch(function (error) {
-                    root.errorHandling(error, root)
-                    this.scrollToTop()
-                }
-            )
+                        root.errorHandling(error, root)
+                        this.scrollToTop()
+                    }
+                )
         },
         getUser() {
             let root = this
@@ -433,25 +438,25 @@ const app = new Vue({
                     root.form[id] = response.data
                 })
                 .catch(function (error) {
-                    root.errorHandling(error, root)
-                }
-            )
+                        root.errorHandling(error, root)
+                    }
+                )
         },
         getAddressesData() {
             const form_test = document.getElementById('addresses-form')
             const forms = document.querySelectorAll('form[id^="update-address"]')
             const formDataCollection = {},
-                  keys = {};
+                keys = {};
 
-            forms.forEach(function(form,k){
+            forms.forEach(function (form, k) {
                 formDataCollection[k] = {};
                 const form_ = document.getElementById(form.id)
-                for(let i = 0; i < form_.length; i++) {
-                    if(form_[i].dataset.name !== undefined) {
+                for (let i = 0; i < form_.length; i++) {
+                    if (form_[i].dataset.name !== undefined) {
                         if (form_[i].dataset.name.includes("_address")) {
                             if (!form_[i].checked) {
                                 form_[i].value = ""
-                            }else {
+                            } else {
                                 form_[i].value = "on"
                             }
                         }
@@ -473,26 +478,26 @@ const app = new Vue({
                     root.validateAction = true
                 })
                 .catch(function (error) {
-                    root.errorHandling(error, root, formId)
-                }
-            )
+                        root.errorHandling(error, root, formId)
+                    }
+                )
         },
         deleteAddress(index, form) {
             let root = this,
                 form_ = document.getElementById(form),
-                data = { index: index }
+                data = {index: index}
 
             axios.post('/ajax/deleteaddress', data)
                 .then(function (response) {
-                    if(response.data)
+                    if (response.data)
                         root.addresses = response.data
 
                     this.animateDelete(form_, true)
                 })
                 .catch(function (error) {
-                    return error;
-                }
-            )
+                        return error;
+                    }
+                )
         },
         /**
          *
@@ -503,8 +508,8 @@ const app = new Vue({
 
             const selectOptions = document.querySelectorAll(".opt-select")
 
-            selectOptions.forEach(function(e, i) {
-                let nextIndex = i+1
+            selectOptions.forEach(function (e, i) {
+                let nextIndex = i + 1
                 options.push(e.selectedOptions[0])
                 let r = e.selectedOptions[0].dataset.ref;
                 placeholder += r ? r : '-'
@@ -514,14 +519,14 @@ const app = new Vue({
             let prices = options.map(opt => parseFloat(opt.dataset.price)).filter(n => !isNaN(n)),
                 refs = options.map(opt => opt.dataset.ref).filter(n => n !== undefined).join("|")
 
-            if(prices.length === selectOptions.length) {
+            if (prices.length === selectOptions.length) {
                 this.statusConfig = true
                 this.statusText = this.$refs.statusConfig.dataset.completed
             }
 
             let total = prices.reduce((init, current) => init + current)
 
-            this.ref = this.$refs.refProduct.dataset.ref+'|'+placeholder
+            this.ref = this.$refs.refProduct.dataset.ref + '|' + placeholder
             this.price = total + parseFloat(this.$refs.optprice.dataset.default)
             this.price = parseFloat(this.price)
         },
@@ -531,7 +536,7 @@ const app = new Vue({
         storeCart() {
             let root = this,
                 data = {
-                    name: "Panier du "+document.querySelector('[name="now"]').dataset.content,
+                    name: "Panier du " + document.querySelector('[name="now"]').dataset.content,
                     user_id: this.user.id,
                     addresses: this.addresses,
                     products: this.items
@@ -547,32 +552,32 @@ const app = new Vue({
                 })
         },
         toggleName(event) {
-            const   id = event.target.dataset.input,
-                    editText = event.target.dataset.edittext,
-                    defaultText = event.target.dataset.defaulttext,
-                    el = document.getElementById('cart-name-'+id)
+            const id = event.target.dataset.input,
+                editText = event.target.dataset.edittext,
+                defaultText = event.target.dataset.defaulttext,
+                el = document.getElementById('cart-name-' + id)
 
-            if(el.value.length > 0)
+            if (el.value.length > 0)
                 var state = el.classList.toggle("readonly")
 
-            if(!state) {
+            if (!state) {
                 el.focus()
                 el.removeAttribute('readonly')
                 event.target.innerText = editText
             } else {
                 axios.post('/ajax/updateNameSavedcart', {id: id, text: el.value})
-                .then(function (response) {
-                    event.target.innerText = defaultText
-                    el.setAttribute('readonly', 'readonly')
-                })
-                .catch(function (error) {
-                })
+                    .then(function (response) {
+                        event.target.innerText = defaultText
+                        el.setAttribute('readonly', 'readonly')
+                    })
+                    .catch(function (error) {
+                    })
             }
         },
         removeSavedCart(event) {
-            const   id = event.target.dataset.id ?? event.target.parentElement.dataset.id,
-                    el = document.getElementById('cart-saved-'+id),
-                    root = this
+            const id = event.target.dataset.id ?? event.target.parentElement.dataset.id,
+                el = document.getElementById('cart-saved-' + id),
+                root = this
 
             axios.post('/ajax/deleteSavedcart', {id: id})
                 .then(function (response) {
@@ -584,7 +589,7 @@ const app = new Vue({
         savedCartToCurrent(event) {
             const id = event.target.dataset.id;
 
-            let homeUrl = window.location.origin+'/';
+            let homeUrl = window.location.origin + '/';
             homeUrl += event.target.dataset.to ?? 'mon-panier'
 
             axios.post('/ajax/savedCartToCurrent', {id: id})
@@ -635,12 +640,12 @@ const app = new Vue({
         },
         formatPrice(price) {
             let price_ = price.toString()
-            let baseFormat = price_.replace(",","")
+            let baseFormat = price_.replace(",", "")
             let toFloat = parseFloat(baseFormat);
             let withDecimal = toFloat.toFixed(2);
-            let withoutComma = withDecimal.replace(",","");
-            let pointToComma = withoutComma.replace(".",",");
-            return pointToComma.replace(" ","");
+            let withoutComma = withDecimal.replace(",", "");
+            let pointToComma = withoutComma.replace(".", ",");
+            return pointToComma.replace(" ", "");
         },
     },
     /**
@@ -742,7 +747,7 @@ $(document).on('click', 'button.cart-add', function () {
     }, 2000)
 });
 
-$(document).on("click", "#open-configurator", function() {
+$(document).on("click", "#open-configurator", function () {
     $(this).hide()
     $("#product-price-container, #features-quotes").removeClass("hidden")
 })
index 2ce34a2e8770369d72968f97c7c40e6ffee41715..5f17c01e22b71f6023ba3b3d481250ea20471198 100644 (file)
@@ -14,7 +14,7 @@
 @endphp
 
 @if(isset($template) && $template === "product-detail")
-    <button data-ref="{{ $reference }}" data-product-id="{{ $id }}" class="btn cart-add" :class="{ 'pointer-events-none bg-grey-disabled' : (!isNaN(price) && !statusConfig) }">
+    <button data-ref="{{ $reference }}" data-product-id="{{ $id }}" class="btn cart-add" :class="{ 'pointer-events-none bg-grey-disabled' : (!isNaN(price) || !statusConfig) }">
         @elseif(isset($template) && $template === "miniature" && $options)
             <a href="{{ $link }}" class="btn text-center">
                 @else