Modulo Administración #78
|
@ -6,7 +6,7 @@ export function currency(val) {
|
||||||
return typeof val === 'number' ? val.toFixed(2) + '€' : val;
|
return typeof val === 'number' ? val.toFixed(2) + '€' : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function date(val, format) {
|
export function date(val, format = 'YYYY-MM-DD') {
|
||||||
if (val == null) return val;
|
if (val == null) return val;
|
||||||
if (!(val instanceof Date)) {
|
if (!(val instanceof Date)) {
|
||||||
val = new Date(val);
|
val = new Date(val);
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
import { ref, inject, watch, computed } from 'vue';
|
import { ref, inject, watch, computed } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { date as qdate } from 'quasar';
|
|
||||||
|
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import { formatDateTitle } from 'src/lib/filters.js';
|
import { formatDateTitle, date } from 'src/lib/filters.js';
|
||||||
import { useAppStore } from 'stores/app';
|
import { useAppStore } from 'stores/app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
|
@ -39,8 +38,8 @@ const getVisits = async () => {
|
||||||
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
|
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
|
||||||
GROUP BY browser ORDER BY visits DESC`,
|
GROUP BY browser ORDER BY visits DESC`,
|
||||||
{
|
{
|
||||||
from: qdate.formatDate(from.value, 'YYYY-MM-DD'),
|
from: date(from.value),
|
||||||
to: qdate.formatDate(to.value, 'YYYY-MM-DD')
|
to: date(to.value)
|
||||||
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
visitsData.value = visitsResponse;
|
visitsData.value = visitsResponse;
|
||||||
|
@ -60,8 +59,8 @@ watch(
|
||||||
async () => {
|
async () => {
|
||||||
await router.replace({
|
await router.replace({
|
||||||
query: {
|
query: {
|
||||||
from: qdate.formatDate(from.value, 'YYYY-MM-DD'),
|
from: date(from.value),
|
||||||
to: qdate.formatDate(to.value, 'YYYY-MM-DD')
|
to: date(to.value)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await getVisits();
|
await getVisits();
|
||||||
|
|
Loading…
Reference in New Issue
En esta linea y la 62, asi como la contigua se repite la lógica.
Nos juntamos para centralizar/refactorizar
5456db8add