From bf2094163dfd41c45b9fcef034ae44f66a4a7a23 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 16 Jul 2024 22:02:31 -0300 Subject: [PATCH] More linting and formatting --- .eslintrc.js | 32 +- .prettierrc.js | 2 +- .vscode/settings.json | 13 +- src/App.vue | 6 +- src/layouts/LoginLayout.vue | 38 +- src/layouts/MainLayout.vue | 332 +++++----- src/pages/Cms/Home.vue | 89 +-- src/pages/Ecomerce/Catalog.vue | 911 ++++++++++++++------------- src/pages/Ecomerce/Invoices.vue | 236 +++---- src/pages/Ecomerce/Orders.vue | 303 ++++----- src/pages/Ecomerce/Ticket.vue | 181 +++--- src/pages/ErrorNotFound.vue | 38 +- src/pages/IndexPage.vue | 18 +- src/pages/Login/Login.vue | 250 ++++---- src/pages/Login/RememberPassword.vue | 144 ++--- src/pages/Login/ResetPassword.vue | 149 ++--- src/stores/user.js | 41 +- 17 files changed, 1416 insertions(+), 1367 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4265d98f..56f4da50 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,22 +15,19 @@ module.exports = { 'vue/setup-compiler-macros': true, }, - extends: [ - // Base ESLint recommended rules - // 'eslint:recommended', - - // Uncomment any of the lines below to choose desired strictness, - // but leave only one uncommented! - // See https://eslint.vuejs.org/rules/#available-rules - 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention) - // 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability) - // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) - - 'standard' - - ], + extends: [ + // Base ESLint recommended rules + // 'eslint:recommended', + // Uncomment any of the lines below to choose desired strictness, + // but leave only one uncommented! + // See https://eslint.vuejs.org/rules/#available-rules + 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention) + // 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability) + // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) + 'standard', + ], plugins: ['vue', 'prettier'], @@ -71,13 +68,14 @@ module.exports = { // allow debugger during development only 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', }, - overrides: [ + overrides: [ { extends: ['plugin:vue/vue3-essential'], files: ['src/**/*.{js,vue,scss}'], // Aplica ESLint solo a archivos .js, .vue y .scss dentro de src (Proyecto de quasar) rules: { - semi: 'off', - indent: ['error', 4, { SwitchCase: 1 }], + semi: 'off', + indent: ['error', 4, { SwitchCase: 1 }], + 'space-before-function-paren': 'off', }, }, ], diff --git a/.prettierrc.js b/.prettierrc.js index 44b30174..a2a0c655 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -3,7 +3,7 @@ module.exports = { tabWidth: 4, useTabs: false, singleQuote: true, - trailingComma: 'all', bracketSpacing: true, arrowParens: 'avoid', + trailingComma: 'none' }; diff --git a/.vscode/settings.json b/.vscode/settings.json index e7d7d29c..484a898f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,14 +4,7 @@ "editor.bracketPairColorization.enabled": true, "editor.guides.bracketPairs": true, "editor.formatOnSave": true, - "editor.defaultFormatter": "dbaeumer.vscode-eslint", - "editor.codeActionsOnSave": [ - "source.fixAll.eslint" - ], - "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "vue" - ], + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": ["source.fixAll.eslint"], + "eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"] } diff --git a/src/App.vue b/src/App.vue index 7b59c16c..69fb8958 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,11 +1,11 @@ diff --git a/src/layouts/LoginLayout.vue b/src/layouts/LoginLayout.vue index d04343ac..197e7499 100644 --- a/src/layouts/LoginLayout.vue +++ b/src/layouts/LoginLayout.vue @@ -1,34 +1,34 @@ diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 2bdd86eb..e57ad273 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,129 +1,131 @@ @@ -131,107 +133,107 @@ @import 'src/css/responsive'; .q-drawer { - .q-item { - padding-left: 38px; - } - .q-list .q-list .q-item { - padding-left: 50px; - } + .q-item { + padding-left: 38px; + } + .q-list .q-list .q-item { + padding-left: 50px; + } } .q-page-container > * { - padding: 16px; + padding: 16px; } #actions > div { - display: flex; - align-items: center; + display: flex; + align-items: center; } @include mobile { - #actions > div { - .q-btn { - border-radius: 50%; - padding: 10px; + #actions > div { + .q-btn { + border-radius: 50%; + padding: 10px; - &__content { - & > .q-icon { - margin-right: 0; + &__content { + & > .q-icon { + margin-right: 0; + } + & > .block { + display: none !important; + } + } } - & > .block { - display: none !important; - } - } } - } } en-US: - visitor: Visitor + visitor: Visitor es-ES: - visitor: Visitante + visitor: Visitante diff --git a/src/pages/Cms/Home.vue b/src/pages/Cms/Home.vue index 161599fe..9decfa92 100644 --- a/src/pages/Cms/Home.vue +++ b/src/pages/Cms/Home.vue @@ -1,76 +1,77 @@ en-US: - startOrder: Start order + startOrder: Start order es-ES: - startOrder: Empezar pedido + startOrder: Empezar pedido ca-ES: - startOrder: Començar comanda + startOrder: Començar comanda fr-FR: - startOrder: Lancer commande + startOrder: Lancer commande pt-PT: - startOrder: Comece uma encomenda + startOrder: Comece uma encomenda diff --git a/src/pages/Ecomerce/Catalog.vue b/src/pages/Ecomerce/Catalog.vue index 8840b513..0b7220e8 100644 --- a/src/pages/Ecomerce/Catalog.vue +++ b/src/pages/Ecomerce/Catalog.vue @@ -1,346 +1,357 @@ es-ES: - gridView: Vista de rejilla - listView: Vista de lista - shoppingCart: Cesta de la compra - warehouse: Almacén - agency: Agencia - modify: Modificar - category: Categoría - deleteFilter: Quitar filtro - filterBy: Filtrar por - family: Familia - orderBy: Ordernar por - pleaseSetFilter: Elige un filtro en el menú de la derecha - search: Buscar + gridView: Vista de rejilla + listView: Vista de lista + shoppingCart: Cesta de la compra + warehouse: Almacén + agency: Agencia + modify: Modificar + category: Categoría + deleteFilter: Quitar filtro + filterBy: Filtrar por + family: Familia + orderBy: Ordernar por + pleaseSetFilter: Elige un filtro en el menú de la derecha + search: Buscar diff --git a/src/pages/Ecomerce/Invoices.vue b/src/pages/Ecomerce/Invoices.vue index 554ede85..8509d0ad 100644 --- a/src/pages/Ecomerce/Invoices.vue +++ b/src/pages/Ecomerce/Invoices.vue @@ -1,86 +1,96 @@ en-US: - noInvoicesFound: No invoices found - serial: Serial - issued: Date - amount: Import - downloadInvoicePdf: Download invoice PDF - notDownloadable: Not available for download, request the invoice to your salesperson + noInvoicesFound: No invoices found + serial: Serial + issued: Date + amount: Import + downloadInvoicePdf: Download invoice PDF + notDownloadable: Not available for download, request the invoice to your salesperson es-ES: - noInvoicesFound: No se han encontrado facturas - serial: Serie - issued: Fecha - amount: Importe - downloadInvoicePdf: Descargar factura en PDF - notDownloadable: No disponible para descarga, solicita la factura a tu comercial + noInvoicesFound: No se han encontrado facturas + serial: Serie + issued: Fecha + amount: Importe + downloadInvoicePdf: Descargar factura en PDF + notDownloadable: No disponible para descarga, solicita la factura a tu comercial ca-ES: - noInvoicesFound: No s'han trobat factures - serial: Sèrie - issued: Data - amount: Import - downloadInvoicePdf: Descarregar PDF - notDownloadable: No disponible per cescarrega, sol·licita la factura al teu comercial + noInvoicesFound: No s'han trobat factures + serial: Sèrie + issued: Data + amount: Import + downloadInvoicePdf: Descarregar PDF + notDownloadable: No disponible per cescarrega, sol·licita la factura al teu comercial fr-FR: - noInvoicesFound: Aucune facture trouvée - serial: Série - issued: Date - amount: Montant - downloadInvoicePdf: Télécharger le PDF - notDownloadable: Non disponible en téléchargement, demander la facture à votre commercial + noInvoicesFound: Aucune facture trouvée + serial: Série + issued: Date + amount: Montant + downloadInvoicePdf: Télécharger le PDF + notDownloadable: Non disponible en téléchargement, demander la facture à votre commercial pt-PT: - noInvoicesFound: Nenhuma fatura encontrada - serial: Serie - issued: Data - amount: Importe - downloadInvoicePdf: Baixar PDF - notDownloadable: Não disponível para download, solicite a fatura ao seu comercial + noInvoicesFound: Nenhuma fatura encontrada + serial: Serie + issued: Data + amount: Importe + downloadInvoicePdf: Baixar PDF + notDownloadable: Não disponível para download, solicite a fatura ao seu comercial diff --git a/src/pages/Ecomerce/Orders.vue b/src/pages/Ecomerce/Orders.vue index b1be1e21..db78e700 100644 --- a/src/pages/Ecomerce/Orders.vue +++ b/src/pages/Ecomerce/Orders.vue @@ -1,194 +1,199 @@ en-US: - startOrder: Start order - noOrdersFound: No orders found - makePayment: Make payment - shoppingCart: Shopping cart - balance: 'Balance:' - paymentInfo: >- - The amount shown is your slope (negative) or favorable balance today, it - disregards future orders. For get your order shipped, this amount must be - equal to or greater than 0. If you want to make a down payment, click the - payment button, delete the suggested amount and enter the amount you want. + startOrder: Start order + noOrdersFound: No orders found + makePayment: Make payment + shoppingCart: Shopping cart + balance: 'Balance:' + paymentInfo: >- + The amount shown is your slope (negative) or favorable balance today, it + disregards future orders. For get your order shipped, this amount must be + equal to or greater than 0. If you want to make a down payment, click the + payment button, delete the suggested amount and enter the amount you want. es-ES: - startOrder: Empezar pedido - noOrdersFound: No se encontrado pedidos - makePayment: Realizar pago - shoppingCart: Cesta de la compra - balance: 'Saldo:' - paymentInfo: >- - La cantidad mostrada es tu saldo pendiente (negativa) o favorable a día de - hoy, no tiene en cuenta pedidos del futuro. Para que tu pedido sea enviado, - esta cantidad debe ser igual o mayor que 0. Si quieres realizar una entrega a - cuenta, pulsa el botón de pago, borra la cantidad sugerida e introduce la - cantidad que desees. + startOrder: Empezar pedido + noOrdersFound: No se encontrado pedidos + makePayment: Realizar pago + shoppingCart: Cesta de la compra + balance: 'Saldo:' + paymentInfo: >- + La cantidad mostrada es tu saldo pendiente (negativa) o favorable a día de + hoy, no tiene en cuenta pedidos del futuro. Para que tu pedido sea enviado, + esta cantidad debe ser igual o mayor que 0. Si quieres realizar una entrega a + cuenta, pulsa el botón de pago, borra la cantidad sugerida e introduce la + cantidad que desees. ca-ES: - startOrder: Començar encàrrec - noOrdersFound: No s'han trobat comandes - makePayment: Realitzar pagament - shoppingCart: Cistella de la compra - balance: 'Saldo:' - paymentInfo: >- - La quantitat mostrada és el teu saldo pendent (negatiu) o favorable a dia - d'avui, no té en compte comandes del futur. Perquè la teva comanda sigui - enviat, aquesta quantitat ha de ser igual o més gran que 0. Si vols fer un - lliurament a compte, prem el botó de pagament, esborra la quantitat suggerida - e introdueix la quantitat que vulguis. + startOrder: Començar encàrrec + noOrdersFound: No s'han trobat comandes + makePayment: Realitzar pagament + shoppingCart: Cistella de la compra + balance: 'Saldo:' + paymentInfo: >- + La quantitat mostrada és el teu saldo pendent (negatiu) o favorable a dia + d'avui, no té en compte comandes del futur. Perquè la teva comanda sigui + enviat, aquesta quantitat ha de ser igual o més gran que 0. Si vols fer un + lliurament a compte, prem el botó de pagament, esborra la quantitat suggerida + e introdueix la quantitat que vulguis. fr-FR: - startOrder: Acheter - noOrdersFound: Aucune commande trouvée - makePayment: Effectuer un paiement - shoppingCart: Panier - balance: 'Balance:' - paymentInfo: >- - Le montant indiqué est votre pente (négative) ou balance favorable - aujourd'hui, ne tient pas compte pour les commandes futures. Obtenir votre - commande est expédiée, ce montant doit être égal ou supérieur à 0. Si vous - voulez faire un versement, le montant suggéré effacé et entrez le montant que - vous souhaitez. + startOrder: Acheter + noOrdersFound: Aucune commande trouvée + makePayment: Effectuer un paiement + shoppingCart: Panier + balance: 'Balance:' + paymentInfo: >- + Le montant indiqué est votre pente (négative) ou balance favorable + aujourd'hui, ne tient pas compte pour les commandes futures. Obtenir votre + commande est expédiée, ce montant doit être égal ou supérieur à 0. Si vous + voulez faire un versement, le montant suggéré effacé et entrez le montant que + vous souhaitez. pt-PT: - startOrder: Iniciar encomenda - noOrdersFound: Nenhum pedido encontrado - makePayment: Realizar pagamento - shoppingCart: Cesta da compra - balance: 'Saldo:' - paymentInfo: >- - A quantidade mostrada é seu saldo pendente (negativo) ou favorável a dia de - hoje, não se vincula a pedidos futuros. Para que seu pedido seja enviado, esta - quantidade deve ser igual ou superior a 0. Se queres realizar um depósito à - conta, clique no botão de pagamento, apague a quantidade sugerida e introduza - a quantidade que deseje. + startOrder: Iniciar encomenda + noOrdersFound: Nenhum pedido encontrado + makePayment: Realizar pagamento + shoppingCart: Cesta da compra + balance: 'Saldo:' + paymentInfo: >- + A quantidade mostrada é seu saldo pendente (negativo) ou favorável a dia de + hoje, não se vincula a pedidos futuros. Para que seu pedido seja enviado, esta + quantidade deve ser igual ou superior a 0. Se queres realizar um depósito à + conta, clique no botão de pagamento, apague a quantidade sugerida e introduza + a quantidade que deseje. diff --git a/src/pages/Ecomerce/Ticket.vue b/src/pages/Ecomerce/Ticket.vue index 00b154e8..d226fe2a 100644 --- a/src/pages/Ecomerce/Ticket.vue +++ b/src/pages/Ecomerce/Ticket.vue @@ -1,136 +1,145 @@ diff --git a/src/pages/ErrorNotFound.vue b/src/pages/ErrorNotFound.vue index 9d500b37..7b09909d 100644 --- a/src/pages/ErrorNotFound.vue +++ b/src/pages/ErrorNotFound.vue @@ -1,29 +1,31 @@ diff --git a/src/pages/IndexPage.vue b/src/pages/IndexPage.vue index fdb03f80..08265eb2 100644 --- a/src/pages/IndexPage.vue +++ b/src/pages/IndexPage.vue @@ -1,17 +1,17 @@ diff --git a/src/pages/Login/Login.vue b/src/pages/Login/Login.vue index b754b107..0582489b 100644 --- a/src/pages/Login/Login.vue +++ b/src/pages/Login/Login.vue @@ -1,72 +1,78 @@ en-US: - user: User - password: Password - remindMe: Remind me - logInAsGuest: Log in as guest - logIn: Log in - loginMail: infoverdnatura.es - loginPhone: +34 607 562 391 - haveForgottenPassword: Have you forgotten your password? - notACustomerYet: Not a customer yet? - signUp: Register + user: User + password: Password + remindMe: Remind me + logInAsGuest: Log in as guest + logIn: Log in + loginMail: infoverdnatura.es + loginPhone: +34 607 562 391 + haveForgottenPassword: Have you forgotten your password? + notACustomerYet: Not a customer yet? + signUp: Register es-ES: - user: Usuario - password: Contraseña - remindMe: Recuérdame - logInAsGuest: Entrar como invitado - logIn: Iniciar sesión - loginMail: infoverdnatura.es - loginPhone: +34 963 242 100 - haveForgottenPassword: ¿Has olvidado tu contraseña? - notACustomerYet: ¿Todavía no eres cliente? - signUp: Registrarme + user: Usuario + password: Contraseña + remindMe: Recuérdame + logInAsGuest: Entrar como invitado + logIn: Iniciar sesión + loginMail: infoverdnatura.es + loginPhone: +34 963 242 100 + haveForgottenPassword: ¿Has olvidado tu contraseña? + notACustomerYet: ¿Todavía no eres cliente? + signUp: Registrarme diff --git a/src/pages/Login/RememberPassword.vue b/src/pages/Login/RememberPassword.vue index d0ed9110..73e647c9 100644 --- a/src/pages/Login/RememberPassword.vue +++ b/src/pages/Login/RememberPassword.vue @@ -1,108 +1,108 @@ en-US: - user: User - inputEmail: Input email - rememberPassword: Rememeber password - dontWorry: Don't worry! - fillData: Fill the data - weSendEmail: We will sent you an email to recover your password - weHaveSentEmailToRecover: We've sent you an email where you can recover your password - send: Send - return: Return + user: User + inputEmail: Input email + rememberPassword: Rememeber password + dontWorry: Don't worry! + fillData: Fill the data + weSendEmail: We will sent you an email to recover your password + weHaveSentEmailToRecover: We've sent you an email where you can recover your password + send: Send + return: Return es-ES: - user: Usuario - inputEmail: Introduce el correo electrónico - rememberPassword: Recordar contraseña - dontWorry: ¡No te preocupes! - fillData: Rellena los datos - weSendEmail: Te enviaremos un correo para restablecer tu contraseña - weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña - send: Enviar - return: Volver + user: Usuario + inputEmail: Introduce el correo electrónico + rememberPassword: Recordar contraseña + dontWorry: ¡No te preocupes! + fillData: Rellena los datos + weSendEmail: Te enviaremos un correo para restablecer tu contraseña + weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña + send: Enviar + return: Volver diff --git a/src/pages/Login/ResetPassword.vue b/src/pages/Login/ResetPassword.vue index bb332842..48686ced 100644 --- a/src/pages/Login/ResetPassword.vue +++ b/src/pages/Login/ResetPassword.vue @@ -1,99 +1,106 @@ diff --git a/src/stores/user.js b/src/stores/user.js index ca713e95..5b3c3c91 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -1,10 +1,11 @@ -import { defineStore } from 'pinia' -import { api, jApi } from 'boot/axios' +import { defineStore } from 'pinia'; +import { api, jApi } from 'boot/axios'; export const userStore = defineStore('user', { state: () => { const token = - sessionStorage.getItem('vnToken') || localStorage.getItem('vnToken') + sessionStorage.getItem('vnToken') || + localStorage.getItem('vnToken'); return { token, @@ -12,50 +13,50 @@ export const userStore = defineStore('user', { name: null, nickname: null, isGuest: false - } + }; }, getters: { - loggedIn: (state) => state.token != null + loggedIn: state => state.token != null }, actions: { - async login (user, password, remember) { - const params = { user, password } - const res = await api.post('Accounts/login', params) + async login(user, password, remember) { + const params = { user, password }; + const res = await api.post('Accounts/login', params); if (remember) { - localStorage.setItem('vnToken', res.data.token) + localStorage.setItem('vnToken', res.data.token); } else { - sessionStorage.setItem('vnToken', res.data.token) + sessionStorage.setItem('vnToken', res.data.token); } this.$patch({ token: res.data.token, name: user - }) + }); }, - async logout () { + async logout() { if (this.token != null) { try { - await api.post('Accounts/logout') + await api.post('Accounts/logout'); } catch (e) {} - localStorage.removeItem('vnToken') - sessionStorage.removeItem('vnToken') + localStorage.removeItem('vnToken'); + sessionStorage.removeItem('vnToken'); } - this.$reset() + this.$reset(); }, - async loadData () { + async loadData() { const userData = await jApi.getObject( 'SELECT id, nickname FROM account.myUser' - ) + ); this.$patch({ id: userData.id, nickname: userData.nickname - }) + }); } } -}) +});