forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
e2f47ab9ca
|
@ -29,7 +29,7 @@ module.exports = configure(function (/* ctx */) {
|
|||
// app boot file (/src/boot)
|
||||
// --> boot files are part of "main.js"
|
||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||
boot: ['i18n', 'axios'],
|
||||
boot: ['i18n', 'axios', 'vnDate'],
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||
css: ['app.scss'],
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
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();
|
||||
};
|
||||
});
|
|
@ -38,6 +38,10 @@ const props = defineProps({
|
|||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
offset: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
|
@ -58,6 +62,7 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
where: props.where,
|
||||
limit: props.limit,
|
||||
order: props.order,
|
||||
userParams: props.userParams
|
||||
});
|
||||
const store = arrayData.store;
|
||||
|
||||
|
@ -123,12 +128,20 @@ async function onLoad(...params) {
|
|||
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
v-if="!props.autoLoad && !store.data && !isLoading"
|
||||
class="info-row q-pa-md text-center"
|
||||
>
|
||||
<h5>
|
||||
{{ t('No data to display') }}
|
||||
</h5>
|
||||
</div>
|
||||
<div
|
||||
v-if="store.data && store.data.length === 0 && !isLoading"
|
||||
class="info-row q-pa-md text-center"
|
||||
>
|
||||
<h5>
|
||||
{{ t('components.smartCard.noData') }}
|
||||
{{ t('No results found') }}
|
||||
</h5>
|
||||
</div>
|
||||
<div v-if="props.autoLoad && !store.data" class="card-list q-gutter-y-md">
|
||||
|
@ -160,9 +173,6 @@ async function onLoad(...params) {
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// .q-infinite-scroll {
|
||||
// width: 100%;
|
||||
// }
|
||||
.info-row {
|
||||
width: 100%;
|
||||
|
||||
|
@ -171,3 +181,9 @@ async function onLoad(...params) {
|
|||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
No data to display: Sin datos que mostrar
|
||||
No results found: No se han encontrado resultados
|
||||
</i18n>
|
||||
|
|
|
@ -15,17 +15,23 @@ const props = defineProps({
|
|||
required: false,
|
||||
default: false,
|
||||
},
|
||||
params: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['refresh', 'clear']);
|
||||
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
const store = arrayData.store;
|
||||
const userParams = ref({});
|
||||
const userParams = ref(props.params);
|
||||
|
||||
onMounted(() => {
|
||||
const params = store.userParams;
|
||||
if (params) {
|
||||
|
||||
if (Object.keys(params).length > 0) {
|
||||
userParams.value = Object.assign({}, params);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,20 +20,27 @@ export function useArrayData(key, userOptions) {
|
|||
|
||||
const page = ref(1);
|
||||
|
||||
if (typeof userOptions === 'object') {
|
||||
if (userOptions.filter) store.filter = userOptions.filter;
|
||||
if (userOptions.url) store.url = userOptions.url;
|
||||
if (userOptions.limit) store.limit = userOptions.limit;
|
||||
if (userOptions.order) store.order = userOptions.order;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
setOptions()
|
||||
|
||||
const query = route.query;
|
||||
if (query.params) {
|
||||
store.userParams = JSON.parse(query.params);
|
||||
}
|
||||
});
|
||||
|
||||
function setOptions() {
|
||||
if (typeof userOptions === 'object') {
|
||||
for (const option in userOptions) {
|
||||
if (userOptions[option] == null) continue
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(store, option)) {
|
||||
store[option] = userOptions[option];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function fetch({ append = false }) {
|
||||
if (!store.url) return;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import toLowerCase from './toLowerCase';
|
||||
import toDate from './toDate';
|
||||
import toDateString from './toDateString';
|
||||
import toCurrency from './toCurrency';
|
||||
import toPercentage from './toPercentage';
|
||||
import toLowerCamel from './toLowerCamel';
|
||||
|
@ -9,6 +10,7 @@ export {
|
|||
toLowerCase,
|
||||
toLowerCamel,
|
||||
toDate,
|
||||
toDateString,
|
||||
toCurrency,
|
||||
toPercentage,
|
||||
dashIfEmpty,
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
export default function toDateString(date) {
|
||||
let day = date.getDate();
|
||||
let month = date.getMonth() + 1;
|
||||
let year = date.getFullYear();
|
||||
|
||||
if (day < 10) day = `0${day}`;
|
||||
if (month < 10) month = `0${month}`;
|
||||
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
|
@ -393,7 +393,6 @@ export default {
|
|||
logOut: 'Log Out',
|
||||
},
|
||||
smartCard: {
|
||||
noData: 'No data to display',
|
||||
openCard: 'View card',
|
||||
openSummary: 'Open summary',
|
||||
viewDescription: 'View description',
|
||||
|
|
|
@ -393,7 +393,6 @@ export default {
|
|||
logOut: 'Cerrar sesión',
|
||||
},
|
||||
smartCard: {
|
||||
noData: 'Sin datos que mostrar',
|
||||
openCard: 'Ver ficha',
|
||||
openSummary: 'Abrir detalles',
|
||||
viewDescription: 'Ver descripción',
|
||||
|
|
|
@ -16,7 +16,7 @@ const input = ref();
|
|||
|
||||
const newRma = ref({
|
||||
code: '',
|
||||
crated: new Date(),
|
||||
crated: Date.vnNew(),
|
||||
});
|
||||
|
||||
function onInputUpdate(value) {
|
||||
|
@ -35,7 +35,7 @@ async function submit() {
|
|||
|
||||
newRma.value = {
|
||||
code: '',
|
||||
created: new Date(),
|
||||
created: Date.vnNew(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import toDateString from 'filters/toDateString';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -12,6 +13,15 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const from = Date.vnNew()
|
||||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1)
|
||||
|
||||
const defaultParams = {
|
||||
from: toDateString(from),
|
||||
to: toDateString(to),
|
||||
};
|
||||
|
||||
const workers = ref();
|
||||
const provinces = ref();
|
||||
const states = ref();
|
||||
|
@ -30,7 +40,11 @@ const warehouses = ref();
|
|||
@on-fetch="(data) => (workers = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:params="defaultParams"
|
||||
:search-button="true"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
@ -57,7 +71,7 @@ const warehouses = ref();
|
|||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-input v-model="params.dateFrom" :label="t('From')" mask="date">
|
||||
<q-input v-model="params.from" :label="t('From')" mask="date">
|
||||
<template #append>
|
||||
<q-icon name="event" class="cursor-pointer">
|
||||
<q-popup-proxy
|
||||
|
@ -65,7 +79,7 @@ const warehouses = ref();
|
|||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<q-date v-model="params.dateFrom" landscape>
|
||||
<q-date v-model="params.from" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
|
@ -79,7 +93,6 @@ const warehouses = ref();
|
|||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
|
@ -90,7 +103,7 @@ const warehouses = ref();
|
|||
</q-input>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-input v-model="params.dateTo" :label="t('To')" mask="date">
|
||||
<q-input v-model="params.to" :label="t('To')" mask="date">
|
||||
<template #append>
|
||||
<q-icon name="event" class="cursor-pointer">
|
||||
<q-popup-proxy
|
||||
|
@ -98,7 +111,7 @@ const warehouses = ref();
|
|||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<q-date v-model="params.dateTo" landscape>
|
||||
<q-date v-model="params.to" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
|
@ -278,8 +291,8 @@ en:
|
|||
search: Contains
|
||||
clientFk: Customer
|
||||
orderFK: Order
|
||||
dateFrom: From
|
||||
dateTo: To
|
||||
from: From
|
||||
to: To
|
||||
salesPersonFk: Salesperson
|
||||
stateFk: State
|
||||
refFk: Invoice Ref.
|
||||
|
@ -295,8 +308,8 @@ es:
|
|||
search: Contiene
|
||||
clientFk: Cliente
|
||||
orderFK: Pedido
|
||||
dateFrom: Desde
|
||||
dateTo: Hasta
|
||||
from: Desde
|
||||
to: Hasta
|
||||
salesPersonFk: Comercial
|
||||
stateFk: Estado
|
||||
refFk: Ref. Factura
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useQuasar } from 'quasar';
|
|||
import { useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import Paginate from 'src/components/PaginateData.vue';
|
||||
import { toDate, toCurrency } from 'src/filters/index';
|
||||
import { toDate, toDateString, toCurrency } from 'src/filters/index';
|
||||
import TicketSummaryDialog from './Card/TicketSummaryDialog.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import TicketFilter from './TicketFilter.vue';
|
||||
|
@ -46,6 +46,15 @@ const filter = {
|
|||
],
|
||||
};
|
||||
|
||||
const from = Date.vnNew();
|
||||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
||||
const userParams = {
|
||||
from: toDateString(from),
|
||||
to: toDateString(to),
|
||||
};
|
||||
|
||||
function stateColor(row) {
|
||||
if (row.alertLevelCode === 'OK') return 'green';
|
||||
if (row.alertLevelCode === 'FREE') return 'blue-3';
|
||||
|
@ -104,6 +113,7 @@ function viewSummary(id) {
|
|||
data-key="TicketList"
|
||||
url="Tickets/filter"
|
||||
:filter="filter"
|
||||
:user-params="userParams"
|
||||
order="id DESC"
|
||||
auto-load
|
||||
>
|
||||
|
@ -123,9 +133,9 @@ function viewSummary(id) {
|
|||
<q-item-label caption>
|
||||
{{ t('ticket.list.nickname') }}
|
||||
</q-item-label>
|
||||
<q-item-label>{{
|
||||
row.nickname
|
||||
}}</q-item-label>
|
||||
<q-item-label>
|
||||
{{ row.nickname }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
|
|
Loading…
Reference in New Issue