diff --git a/.eslintrc.js b/.eslintrc.js index 253f6a52..f81a262f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,42 +1,69 @@ // http://eslint.org/docs/user-guide/configuring module.exports = { - root: true, - parser: 'babel-eslint', - parserOptions: { - sourceType: 'module' - }, - env: { - browser: true, - }, - extends: 'airbnb-base', - // required to lint *.vue files - plugins: [ - 'html' - ], - // check if imports actually resolve - 'settings': { - 'import/resolver': { - 'webpack': { - 'config': 'build/webpack.base.conf.js' - } - } - }, - // add your custom rules here - 'rules': { - // don't require .vue extension when importing - 'import/extensions': ['error', 'always', { - 'js': 'never', - 'vue': 'never' - }], - // allow optionalDependencies - "linebreak-style": 0, - 'import/no-extraneous-dependencies': ['error', { - 'optionalDependencies': ['test/unit/index.js'] - }], - // allow debugger during development + root: true, + parser: 'babel-eslint', + parserOptions: { + sourceType: 'module', + }, + env: { + browser: true, + }, + extends: 'airbnb-base', + // required to lint *.vue files + plugins: ['html'], + // check if imports actually resolve + settings: { + 'import/resolver': { + webpack: { + config: 'build/webpack.base.conf.js', + }, + }, + }, + // add your custom rules here + rules: { + 'comma-dangle': 'off', + 'arrow-parens': ['off', 'off'], // Desactiva la regla o ajusta según tu preferencia + 'import/no-extraneous-dependencies': 'off', // Desactiva la regla import/no-extraneous-dependencies + 'no-mixed-operators': 'off', // Activar la regla no-mixed-operators + indent: 'off', // Indentación con tabs + 'no-mixed-spaces-and-tabs': 'off', // Evitar mezcla de espacios y tabs + // 'indent': ['error', 'tab'], // Indentación con tabs + 'max-len': [ + 'error', + { + code: 120, + ignoreStrings: true, + ignoreTemplateLiterals: true, + ignoreComments: true, // Ignorar longitud de línea en comentarios largos + ignoreUrls: true, // Ignorar longitud de línea en URLs largas + ignoreRegExpLiterals: true, // Ignorar longitud de línea en expresiones regulares largas + ignorePattern: '^[ \t]*<(\\w+)([^>]*)>(.|\n)*?<\\/\\1>', // Ignorar líneas dentro de JSX + ignorePattern: '^\\s*\\{', // Ignorar líneas dentro de objetos de configuración largos + }, + ], + // don't require .vue extension when importing + 'import/extensions': [ + 'error', + 'always', + { + js: 'never', + vue: 'never', + }, + ], + // allow optionalDependencies + 'import/no-extraneous-dependencies': [ + 'error', + { + optionalDependencies: ['test/unit/index.js'], + }, + ], + 'linebreak-style': ['error', 'windows'], + // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 'no-tabs': 0, - 'indent': ['error', 'tab'] - } -} + // 'indent': 'off', + // 'no-mixed-spaces-and-tabs': 'off', + 'linebreak-style': 0, + }, +}; diff --git a/src/components/products/product-in-car.vue b/src/components/products/product-in-car.vue index 5a0cc93f..6b016a02 100644 --- a/src/components/products/product-in-car.vue +++ b/src/components/products/product-in-car.vue @@ -62,6 +62,8 @@ @@ -163,15 +165,32 @@ function showComments() { this.show = !this.show; } +function inputQuantity(value) { + this.product.quantity = Number(value); + this.clickQuantity(); +} + function clickQuantity(val) { let { quantity } = this.product; const { unit } = this.product; - const opt = { - more: 1, - less: -1, - }; - quantity += opt[val]; - quantity = quantity < 1 ? 1 : quantity; + if (val) { + if (this.product.id === 3581799) { + this.opt = { + more: 0.1, + less: -0.1, + }; + quantity += this.opt[val]; + quantity = +quantity.toFixed(2); + quantity = quantity < 0.1 ? 0.1 : quantity; + } else { + this.opt = { + more: 1, + less: -1, + }; + quantity += this.opt[val]; + quantity = quantity < 1 ? 1 : quantity; + } + } this.quantityStock = parseInt(unit.quantity * quantity, 10); if (this.showUnity) { if (quantity >= this.stockAvaible && !this.$allowOrderStockNegative) { @@ -222,6 +241,7 @@ function data() { return { comments: '', show: false, + opt: {}, maxQuantity: false, }; } @@ -245,6 +265,7 @@ export default { deleteProduct, showComments, goToProduct, + inputQuantity, }, props: { product: { diff --git a/src/components/shared/buttons/quantity-button.vue b/src/components/shared/buttons/quantity-button.vue index 4c97b8de..ab1ff929 100644 --- a/src/components/shared/buttons/quantity-button.vue +++ b/src/components/shared/buttons/quantity-button.vue @@ -1,11 +1,39 @@