This commit is contained in:
parent
ede1966449
commit
1312dbe2af
|
@ -24,7 +24,7 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
unRemovableParams: {
|
unremovableParams: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
@ -148,7 +148,7 @@ async function clearFilters() {
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||||
// Filtrar los params no removibles
|
// Filtrar los params no removibles
|
||||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||||
$props.unRemovableParams.includes(param)
|
$props.unremovableParams.includes(param)
|
||||||
);
|
);
|
||||||
const newParams = {};
|
const newParams = {};
|
||||||
// Conservar solo los params que no son removibles
|
// Conservar solo los params que no son removibles
|
||||||
|
@ -268,7 +268,7 @@ function sanitizer(params) {
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-for="chip of tags"
|
v-for="chip of tags"
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unRemovableParams.includes(chip.label)"
|
:removable="!unRemovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
|
|
|
@ -15,13 +15,16 @@ const warehouses = ref();
|
||||||
const groupedStates = ref();
|
const groupedStates = ref();
|
||||||
|
|
||||||
const handleScopeDays = (params, days, callback) => {
|
const handleScopeDays = (params, days, callback) => {
|
||||||
if (!days) {
|
const from = Date.vnNew();
|
||||||
Object.assign(params, { from: undefined, to: undefined, scopeDays: undefined });
|
from.setHours(0, 0, 0, 0);
|
||||||
} else {
|
|
||||||
params.from = Date.vnNew();
|
|
||||||
const to = Date.vnNew();
|
const to = Date.vnNew();
|
||||||
to.setDate(to.getDate() + days);
|
|
||||||
to.setHours(23, 59, 59, 999);
|
to.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
|
if (!days) {
|
||||||
|
Object.assign(params, { from, to, scopeDays: 1 });
|
||||||
|
} else {
|
||||||
|
params.from = from;
|
||||||
|
to.setDate(to.getDate() + days);
|
||||||
params.to = to;
|
params.to = to;
|
||||||
}
|
}
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
|
@ -29,12 +32,20 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" />
|
<FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" />
|
||||||
<FetchData url="AlertLevels" auto-load @on-fetch="(data) => (groupedStates = data)" />
|
<FetchData
|
||||||
|
url="AlertLevels"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="
|
||||||
|
(data) =>
|
||||||
|
(groupedStates = data.map((x) => Object.assign(x, { code: t(x.code) })))
|
||||||
|
"
|
||||||
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['from', 'to']"
|
:hidden-tags="['from', 'to']"
|
||||||
:custom-tags="['scopeDays']"
|
:custom-tags="['scopeDays']"
|
||||||
|
:unremovable-params="['from', 'to', 'scopeDays']"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
@ -73,7 +84,6 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<!-- Si se borran desde los tags no funciona-->
|
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
:label="t('params.scopeDays')"
|
:label="t('params.scopeDays')"
|
||||||
v-model="params.scopeDays"
|
v-model="params.scopeDays"
|
||||||
|
@ -229,6 +239,7 @@ en:
|
||||||
pending: Pending
|
pending: Pending
|
||||||
from: From
|
from: From
|
||||||
to: To
|
to: To
|
||||||
|
alertLevel: Grouped State
|
||||||
FREE: Free
|
FREE: Free
|
||||||
DELIVERED: Delivered
|
DELIVERED: Delivered
|
||||||
ON_PREPARATION: On preparation
|
ON_PREPARATION: On preparation
|
||||||
|
@ -253,6 +264,7 @@ es:
|
||||||
pending: Pendiente
|
pending: Pendiente
|
||||||
from: Desde
|
from: Desde
|
||||||
To: Hasta
|
To: Hasta
|
||||||
|
alertLevel: Estado agrupado
|
||||||
FREE: Libre
|
FREE: Libre
|
||||||
DELIVERED: Servido
|
DELIVERED: Servido
|
||||||
ON_PREPARATION: En preparación
|
ON_PREPARATION: En preparación
|
||||||
|
|
|
@ -25,7 +25,17 @@ const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const visibleColumns = ref([]);
|
const visibleColumns = ref([]);
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const from = computed(() => {
|
||||||
|
const date = Date.vnNew();
|
||||||
|
date.setHours(0, 0, 0, 0);
|
||||||
|
return date;
|
||||||
|
});
|
||||||
|
const to = computed(() => {
|
||||||
|
const date = Date.vnNew();
|
||||||
|
date.setDate(date.getDate() + 1);
|
||||||
|
date.setHours(23, 59, 59, 999);
|
||||||
|
return date;
|
||||||
|
});
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'stateFk':
|
case 'stateFk':
|
||||||
|
@ -345,6 +355,7 @@ const openTab = (id) =>
|
||||||
auto-load
|
auto-load
|
||||||
:row-click="({ id }) => openTab(id)"
|
:row-click="({ id }) => openTab(id)"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
|
:user-params="{ from, to, scopeDays: 1 }"
|
||||||
>
|
>
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
Loading…
Reference in New Issue