diff --git a/jsconfig.json b/jsconfig.json index ee1a17d04..d2a56002e 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -5,6 +5,7 @@ "src/*": ["src/*"], "app/*": ["*"], "components/*": ["src/components/*"], + "composables/*": ["src/composables/*"], "layouts/*": ["src/layouts/*"], "pages/*": ["src/pages/*"], "assets/*": ["src/assets/*"], diff --git a/quasar.config.js b/quasar.config.js index 828633cf6..83265295f 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -9,8 +9,8 @@ // https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js const ESLintPlugin = require('eslint-webpack-plugin'); - const { configure } = require('quasar/wrappers'); +const path = require('path'); module.exports = configure(function (ctx) { return { @@ -68,15 +68,23 @@ module.exports = configure(function (ctx) { chainWebpack(chain) { chain.module - .rule("i18n") + .rule('i18n') .resourceQuery(/blockType=i18n/) .type('javascript/auto') - .use("i18n") - .loader("@intlify/vue-i18n-loader") + .use('i18n') + .loader('@intlify/vue-i18n-loader') .end(); - chain.plugin('eslint-webpack-plugin') - .use(ESLintPlugin, [{ extensions: ['js', 'vue'] }]); + chain.plugin('eslint-webpack-plugin').use(ESLintPlugin, [{ extensions: ['js', 'vue'] }]); + }, + extendWebpack(cfg) { + cfg.resolve.alias = { + ...cfg.resolve.alias, // This adds the existing alias + + // Add your own alias like this + composables: path.resolve(__dirname, './src/composables'), + filters: path.resolve(__dirname, './src/filters'), + }; }, }, @@ -91,7 +99,7 @@ module.exports = configure(function (ctx) { target: 'http://0.0.0.0:3000', logLevel: 'debug', changeOrigin: true, - secure: false + secure: false, }, }, }, @@ -100,9 +108,9 @@ module.exports = configure(function (ctx) { framework: { config: { brand: { - primary: 'orange' + primary: 'orange', }, - dark: 'auto' + dark: 'auto', }, lang: 'es', diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index d36f8c4ea..2426be1c7 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -6,7 +6,7 @@ import axios from 'axios'; import { useState } from 'src/composables/useState'; import { useValidator } from 'src/composables/useValidator'; -import SkeletonForm from 'src/components/SkeletonForm.vue'; +import SkeletonForm from 'components/ui/SkeletonForm.vue'; const quasar = useQuasar(); const { t } = useI18n(); diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index e5c5676f7..c4c1e9892 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -2,7 +2,7 @@ import { useI18n } from 'vue-i18n'; import { useState } from 'src/composables/useState'; import { useSession } from 'src/composables/useSession'; -import UserPanel from 'src/components/UserPanel.vue'; +import UserPanel from 'components/UserPanel.vue'; import FavoriteModules from './FavoriteModules.vue'; const { t } = useI18n(); diff --git a/src/components/common/SendEmailDialog.vue b/src/components/common/SendEmailDialog.vue new file mode 100644 index 000000000..f8d80ac06 --- /dev/null +++ b/src/components/common/SendEmailDialog.vue @@ -0,0 +1,72 @@ + + + + + + +{ + "en": { + "sendEmailNotification": "Send email notification", + "notifyAddress": "The notification will be sent to the following address" + }, + "es": { + "sendEmailNotification": "Enviar notificación por correo", + "notifyAddress": "La notificación se enviará a la siguiente dirección" + } +} + diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 34575cfb4..d80c0498c 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -98,9 +98,5 @@ const { t } = useI18n(); justify-content: space-between; align-items: stretch; } - - #descriptor-skeleton .q-card__actions { - justify-content: space-between; - } } diff --git a/src/components/ui/SkeletonDescriptor.vue b/src/components/ui/SkeletonDescriptor.vue new file mode 100644 index 000000000..03623f4d1 --- /dev/null +++ b/src/components/ui/SkeletonDescriptor.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/components/SkeletonForm.vue b/src/components/ui/SkeletonForm.vue similarity index 100% rename from src/components/SkeletonForm.vue rename to src/components/ui/SkeletonForm.vue diff --git a/src/components/SkeletonSummary.vue b/src/components/ui/SkeletonSummary.vue similarity index 100% rename from src/components/SkeletonSummary.vue rename to src/components/ui/SkeletonSummary.vue diff --git a/src/composables/usePrintService.js b/src/composables/usePrintService.js new file mode 100644 index 000000000..110e4d864 --- /dev/null +++ b/src/composables/usePrintService.js @@ -0,0 +1,36 @@ +import { useSession } from './useSession'; +import axios from 'axios'; +import { useQuasar } from 'quasar'; + +export function usePrintService() { + const quasar = useQuasar(); + const { getToken } = useSession(); + + function sendEmail(path, params) { + return axios.post(path, params).then(() => + quasar.notify({ + message: 'Notification sent', + type: 'positive', + icon: 'check', + }) + ); + } + + function openReport(path, params) { + params = Object.assign( + { + access_token: getToken(), + }, + params + ); + + const query = new URLSearchParams(params).toString(); + + window.open(`api/${path}?${query}`); + } + + return { + sendEmail, + openReport, + }; +} diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 857df8d89..352a80263 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -13,12 +13,14 @@ export default { darkMode: 'Dark mode', logOut: 'Log out', dataSaved: 'Data saved', + dataDeleted: 'Data deleted', add: 'Add', create: 'Create', save: 'Save', remove: 'Remove', reset: 'Reset', cancel: 'Cancel', + confirm: 'Confirm', yes: 'Yes', no: 'No', noChanges: 'No changes to save', @@ -26,10 +28,10 @@ export default { confirmRemove: 'You are about to delete this row. Are you sure?', rowAdded: 'Row added', rowRemoved: 'Row removed', - pleaseWait: 'Please wait...' + pleaseWait: 'Please wait...', }, moduleIndex: { - allModules: 'All modules' + allModules: 'All modules', }, errors: { statusUnauthorized: 'Access denied', @@ -45,12 +47,12 @@ export default { keepLogin: 'Keep me logged in', loginSuccess: 'You have successfully logged in', loginError: 'Invalid username or password', - fieldRequired: 'This field is required' + fieldRequired: 'This field is required', }, dashboard: { pageTitles: { dashboard: 'Dashboard', - } + }, }, customer: { pageTitles: { @@ -58,13 +60,13 @@ export default { list: 'List', createCustomer: 'Create customer', summary: 'Summary', - basicData: 'Basic Data' + basicData: 'Basic Data', }, list: { phone: 'Phone', email: 'Email', customerOrders: 'Display customer orders', - moreOptions: 'More options' + moreOptions: 'More options', }, card: { customerList: 'Customer list', @@ -78,7 +80,7 @@ export default { isFrozen: 'Customer is frozen', hasDebt: 'Customer has debt', notChecked: 'Customer not checked', - noWebAccess: 'Web access is disabled' + noWebAccess: 'Web access is disabled', }, summary: { basicData: 'Basic data', @@ -145,8 +147,8 @@ export default { phone: 'Phone', mobile: 'Mobile', salesPerson: 'Sales person', - contactChannel: 'Contact channel' - } + contactChannel: 'Contact channel', + }, }, ticket: { pageTitles: { @@ -155,7 +157,7 @@ export default { createTicket: 'Create ticket', summary: 'Summary', basicData: 'Basic Data', - boxing: 'Boxing' + boxing: 'Boxing', }, list: { nickname: 'Nickname', @@ -163,7 +165,7 @@ export default { shipped: 'Shipped', landed: 'Landed', salesPerson: 'Sales person', - total: 'Total' + total: 'Total', }, card: { ticketId: 'Ticket ID', @@ -173,7 +175,7 @@ export default { agency: 'Agency', shipped: 'Shipped', warehouse: 'Warehouse', - customerCard: 'Customer card' + customerCard: 'Customer card', }, boxing: { expedition: 'Expedition', @@ -182,8 +184,8 @@ export default { worker: 'Worker', selectTime: 'Select time:', selectVideo: 'Select video:', - notFound: 'No videos available' - } + notFound: 'No videos available', + }, }, claim: { pageTitles: { @@ -193,21 +195,21 @@ export default { rmaList: 'RMA', summary: 'Summary', basicData: 'Basic Data', - rma: 'RMA' + rma: 'RMA', }, list: { customer: 'Customer', assignedTo: 'Assigned', created: 'Created', - state: 'State' + state: 'State', }, rmaList: { code: 'Code', - records: 'records' + records: 'records', }, rma: { user: 'User', - created: 'Created' + created: 'Created', }, card: { claimId: 'Claim ID', @@ -216,7 +218,7 @@ export default { state: 'State', ticketId: 'Ticket ID', customerSummary: 'Customer summary', - claimedTicket: 'Claimed ticket' + claimedTicket: 'Claimed ticket', }, summary: { customer: 'Customer', @@ -236,7 +238,7 @@ export default { actions: 'Actions', responsibility: 'Responsibility', company: 'Company', - person: 'Employee/Customer' + person: 'Employee/Customer', }, basicData: { customer: 'Customer', @@ -245,7 +247,7 @@ export default { state: 'State', packages: 'Packages', picked: 'Picked', - returnOfMaterial: 'Return of material authorization (RMA)' + returnOfMaterial: 'Return of material authorization (RMA)', }, }, components: { @@ -258,12 +260,12 @@ export default { noData: 'No data to display', openCard: 'View card', openSummary: 'Open summary', - viewDescription: 'View description' + viewDescription: 'View description', }, cardDescriptor: { mainList: 'Main list', summary: 'Summary', - moreOptions: 'More options' - } + moreOptions: 'More options', + }, }, }; diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 57ed01b0d..b326af337 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -13,12 +13,14 @@ export default { darkMode: 'Modo oscuro', logOut: 'Cerrar sesión', dataSaved: 'Datos guardados', + dataDeleted: 'Data deleted', add: 'Añadir', create: 'Crear', save: 'Guardar', remove: 'Eliminar', reset: 'Restaurar', cancel: 'Cancelar', + confirm: 'Confirmar', yes: 'Si', no: 'No', noChanges: 'Sin cambios que guardar', @@ -26,10 +28,10 @@ export default { confirmRemove: 'Vas a eliminar este registro. ¿Continuar?', rowAdded: 'Fila añadida', rowRemoved: 'Fila eliminada', - pleaseWait: 'Por favor, espera...' + pleaseWait: 'Por favor, espera...', }, moduleIndex: { - allModules: 'Todos los módulos' + allModules: 'Todos los módulos', }, errors: { statusUnauthorized: 'Acceso denegado', @@ -45,12 +47,12 @@ export default { keepLogin: 'Mantener sesión iniciada', loginSuccess: 'Inicio de sesión correcto', loginError: 'Nombre de usuario o contraseña incorrectos', - fieldRequired: 'Este campo es obligatorio' + fieldRequired: 'Este campo es obligatorio', }, dashboard: { pageTitles: { dashboard: 'Tablón', - } + }, }, customer: { pageTitles: { @@ -58,13 +60,13 @@ export default { list: 'Listado', createCustomer: 'Crear cliente', summary: 'Resumen', - basicData: 'Datos básicos' + basicData: 'Datos básicos', }, list: { phone: 'Teléfono', email: 'Email', customerOrders: 'Mostrar órdenes del cliente', - moreOptions: 'Más opciones' + moreOptions: 'Más opciones', }, card: { customerId: 'ID cliente', @@ -77,7 +79,7 @@ export default { isFrozen: 'El cliente está congelado', hasDebt: 'El cliente tiene riesgo', notChecked: 'El cliente no está comprobado', - noWebAccess: 'El acceso web está desactivado' + noWebAccess: 'El acceso web está desactivado', }, summary: { basicData: 'Datos básicos', @@ -144,8 +146,8 @@ export default { phone: 'Teléfono', mobile: 'Móvil', salesPerson: 'Comercial', - contactChannel: 'Canal de contacto' - } + contactChannel: 'Canal de contacto', + }, }, ticket: { pageTitles: { @@ -154,7 +156,7 @@ export default { createTicket: 'Crear ticket', summary: 'Resumen', basicData: 'Datos básicos', - boxing: 'Encajado' + boxing: 'Encajado', }, list: { nickname: 'Alias', @@ -162,7 +164,7 @@ export default { shipped: 'Enviado', landed: 'Entregado', salesPerson: 'Comercial', - total: 'Total' + total: 'Total', }, card: { ticketId: 'ID ticket', @@ -172,7 +174,7 @@ export default { agency: 'Agencia', shipped: 'Enviado', warehouse: 'Almacén', - customerCard: 'Ficha del cliente' + customerCard: 'Ficha del cliente', }, boxing: { expedition: 'Expedición', @@ -181,8 +183,8 @@ export default { worker: 'Trabajador', selectTime: 'Seleccionar hora:', selectVideo: 'Seleccionar vídeo:', - notFound: 'No hay vídeos disponibles' - } + notFound: 'No hay vídeos disponibles', + }, }, claim: { pageTitles: { @@ -192,21 +194,21 @@ export default { rmaList: 'RMA', summary: 'Resumen', basicData: 'Datos básicos', - rma: 'RMA' + rma: 'RMA', }, list: { customer: 'Cliente', assignedTo: 'Asignada a', created: 'Creada', - state: 'Estado' + state: 'Estado', }, rmaList: { code: 'Código', - records: 'registros' + records: 'registros', }, rma: { user: 'Usuario', - created: 'Creado' + created: 'Creado', }, card: { claimId: 'ID reclamación', @@ -215,7 +217,7 @@ export default { state: 'Estado', ticketId: 'ID ticket', customerSummary: 'Resumen del cliente', - claimedTicket: 'Ticket reclamado' + claimedTicket: 'Ticket reclamado', }, summary: { customer: 'Cliente', @@ -235,7 +237,7 @@ export default { actions: 'Acciones', responsibility: 'Responsabilidad', company: 'Empresa', - person: 'Comercial/Cliente' + person: 'Comercial/Cliente', }, basicData: { customer: 'Cliente', @@ -244,8 +246,8 @@ export default { state: 'Estado', packages: 'Bultos', picked: 'Recogida', - returnOfMaterial: 'Autorización de retorno de materiales (RMA)' - } + returnOfMaterial: 'Autorización de retorno de materiales (RMA)', + }, }, components: { topbar: {}, @@ -257,12 +259,12 @@ export default { noData: 'Sin datos que mostrar', openCard: 'Ver ficha', openSummary: 'Abrir detalles', - viewDescription: 'Ver descripción' + viewDescription: 'Ver descripción', }, cardDescriptor: { mainList: 'Listado principal', summary: 'Resumen', moreOptions: 'Más opciones', - } + }, }, }; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 0418c8f3b..be47ccbae 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,5 +1,5 @@