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