diff --git a/quasar.config.js b/quasar.config.js index 0c26af27..a657b9de 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -24,7 +24,7 @@ module.exports = configure(function (ctx) { // app boot file (/src/boot) // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli-webpack/boot-files - boot: ['i18n', 'axios', 'error-handler', 'app'], + boot: ['i18n', 'axios', 'vnDate', 'error-handler', 'app'], // https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js#Property%3A-css css: ['app.scss', 'width.scss', 'responsive.scss'], diff --git a/src/boot/vnDate.js b/src/boot/vnDate.js new file mode 100644 index 00000000..cbd92e62 --- /dev/null +++ b/src/boot/vnDate.js @@ -0,0 +1,20 @@ +import { boot } from 'quasar/wrappers'; + +export default boot(() => { + Date.vnUTC = () => { + const env = process.env.NODE_ENV; + if (!env || env === 'development') { + return new Date(Date.UTC(2001, 0, 1, 11)); + } + + return new Date(); + }; + + Date.vnNew = () => { + return new Date(Date.vnUTC()); + }; + + Date.vnNow = () => { + return new Date(Date.vnUTC()).getTime(); + }; +}); diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue new file mode 100644 index 00000000..7ba3c726 --- /dev/null +++ b/src/components/common/VnInputDate.vue @@ -0,0 +1,174 @@ + + + + + + +en-US: + openDate: Open date +es-ES: + openDate: Abrir fecha +ca-ES: + openDate: Obrir data +fr-FR: + openDate: Ouvrir la date +pt-PT: + openDate: Abrir data + diff --git a/src/i18n/ca-ES/index.js b/src/i18n/ca-ES/index.js index b782633f..d8326f73 100644 --- a/src/i18n/ca-ES/index.js +++ b/src/i18n/ca-ES/index.js @@ -54,5 +54,6 @@ export default { controlPanel: 'Panell de control', adminConnections: 'Connexions', // - orderLoadedIntoBasket: 'Comanda carregada a la cistella!' + orderLoadedIntoBasket: 'Comanda carregada a la cistella!', + at: 'a les' }; diff --git a/src/i18n/en-US/index.js b/src/i18n/en-US/index.js index 54114010..19fa5495 100644 --- a/src/i18n/en-US/index.js +++ b/src/i18n/en-US/index.js @@ -68,6 +68,7 @@ export default { adminConnections: 'Connections', // orderLoadedIntoBasket: 'Order loaded into basket!', + at: 'at', orders: 'Orders', order: 'Pending order', diff --git a/src/i18n/es-ES/index.js b/src/i18n/es-ES/index.js index 746ae312..a6f2aac1 100644 --- a/src/i18n/es-ES/index.js +++ b/src/i18n/es-ES/index.js @@ -74,6 +74,7 @@ export default { adminConnections: 'Conexiones', // orderLoadedIntoBasket: '¡Pedido cargado en la cesta!', + at: 'a las', orders: 'Pedidos', order: 'Pedido pendiente', diff --git a/src/i18n/fr-FR/index.js b/src/i18n/fr-FR/index.js index 53fe2bd4..157667f1 100644 --- a/src/i18n/fr-FR/index.js +++ b/src/i18n/fr-FR/index.js @@ -54,5 +54,6 @@ export default { controlPanel: 'Panneau de configuration', adminConnections: 'Connexions', // - orderLoadedIntoBasket: 'Commande chargée dans le panier!' + orderLoadedIntoBasket: 'Commande chargée dans le panier!', + at: 'à' }; diff --git a/src/i18n/pt-PT/index.js b/src/i18n/pt-PT/index.js index e2fc87cf..734fe01c 100644 --- a/src/i18n/pt-PT/index.js +++ b/src/i18n/pt-PT/index.js @@ -55,5 +55,6 @@ export default { controlPanel: 'Painel de controle', adminConnections: 'Conexões', // - orderLoadedIntoBasket: 'Pedido carregado na cesta!' + orderLoadedIntoBasket: 'Pedido carregado na cesta!', + at: 'às' }; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 43c1ad1c..67a94b45 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -189,7 +189,7 @@ const logoutSupplantedUser = async () => { } @include mobile { - #actions > div { + #actions { .q-btn { border-radius: 50%; padding: 10px; diff --git a/src/lib/filters.js b/src/lib/filters.js index 88d3f33b..fcdd5b21 100644 --- a/src/lib/filters.js +++ b/src/lib/filters.js @@ -14,16 +14,32 @@ export function date(val, format) { return qdate.formatDate(val, format, i18n.global.tm('date')); } -export const formatDateTitle = timeStamp => { +/** + * @param {Date} timeStamp - La marca de tiempo que se va a formatear. Si no se proporciona, la función devolverá una cadena vacía. + * @param {Object} options - Un objeto que contiene las opciones de formato. + * @param {boolean} options.showTime - Indica si se debe mostrar la hora en el formato de la fecha. + * @param {boolean} options.showSeconds - Indica si se deben mostrar los segundos en el formato de la hora. Solo se aplica si showTime es true. + * @param {boolean} options.shortDay - Indica si se debe usar una versión corta del día (por ejemplo, "Mon" en lugar de "Monday"). + * @returns {string} La fecha formateada como un título. + */ +export const formatStringDate = (timeStamp, options) => { + if (!timeStamp) return ''; + const { t, messages, locale } = i18n.global; - const formattedString = qdate.formatDate( - timeStamp, - `dddd, D [${t('of')}] MMMM [${t('of')}] YYYY`, - { - days: messages.value[locale.value].date.days, - months: messages.value[locale.value].date.months - } - ); + + const timeFormat = options.showTime + ? options.showSeconds + ? ` [${t('at')}] hh:mm:ss` + : ` [${t('at')}] hh:mm` + : ''; + const day = options.shortDay ? 'dd' : 'dddd'; + + const formatString = `${day}, D [${t('of')}] MMMM [${t('of')}] YYYY${timeFormat}`; + + const formattedString = qdate.formatDate(timeStamp, formatString, { + days: messages.value[locale.value].date.days, + months: messages.value[locale.value].date.months + }); return formattedString; }; diff --git a/src/pages/Admin/LinksView.vue b/src/pages/Admin/LinksView.vue index eed9cbc8..3e884b58 100644 --- a/src/pages/Admin/LinksView.vue +++ b/src/pages/Admin/LinksView.vue @@ -64,16 +64,3 @@ onMounted(async () => getLinks()); text-align: center; } - - -en-US: - addAddress: Add address -es-ES: - addAddress: Añadir dirección -ca-ES: - addAddress: Afegir adreça -fr-FR: - addAddress: Ajouter une adresse -pt-PT: - addAddress: Adicionar Morada - diff --git a/src/pages/Admin/VisitsView.vue b/src/pages/Admin/VisitsView.vue new file mode 100644 index 00000000..563b2a48 --- /dev/null +++ b/src/pages/Admin/VisitsView.vue @@ -0,0 +1,191 @@ + + + + + + + +en-US: + from: From + to: To + visits: Visits + news: New + connections: Connections + refresh: Refresh +es-ES: + from: Desde + to: Hasta + visits: Visitas + news: Nuevas + connections: Conexiones + refresh: Actualizar +ca-ES: + from: Desde + to: Fins + visits: Visites + news: Noves + connections: Connexions + refresh: Actualitzar +fr-FR: + from: À partir de + to: Jusqu'à + visits: Visites + news: Nouveau + connections: Connexions + refresh: Rafraîchir +pt-PT: + from: Desde + to: Até + visits: Visitas + news: Novo + connections: Conexões + refresh: Atualizar + diff --git a/src/router/routes.js b/src/router/routes.js index 71112809..21488827 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -81,8 +81,8 @@ const routes = [ }, { name: 'adminVisits', - path: 'admin/visits' - // component: () => import('pages/Admin/VisitsView.vue') + path: 'admin/visits', + component: () => import('pages/Admin/VisitsView.vue') }, { name: 'adminNews',