Modulo Administración #78

Merged
jsegarra merged 19 commits from wbuezas/hedera-web-mindshore:feature/Administracion into 4922-vueMigration 2024-08-23 19:29:46 +00:00
2 changed files with 6 additions and 7 deletions
Showing only changes of commit 5456db8add - Show all commits

View File

@ -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);

View File

@ -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)

En esta linea y la 62, asi como la contigua se repite la lógica.

Nos juntamos para centralizar/refactorizar

En esta linea y la 62, asi como la contigua se repite la lógica. Nos juntamos para centralizar/refactorizar
5456db8addc3a2f5f377ce8deecdea250eaaf8dc
} }
); );
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();