0
0
Fork 0

fix: refs #7129 fixFilters

This commit is contained in:
Pablo Natek 2024-07-22 09:12:56 +02:00
parent bcf4f34862
commit af6a20729b
5 changed files with 96 additions and 30 deletions

View File

@ -177,7 +177,8 @@ function splitColumns(columns) {
if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true };
if ($props.useModel && col.columnFilter != false)
col.columnFilter = { ...col.columnFilter, inWhere: true };
splittedColumns.value.columns.push(col);
}
// Status column
@ -273,6 +274,10 @@ defineExpose({
:search-url="searchUrl"
/>
<VnTableOrder
v-if="
!(col?.columnFilter === false) &&
col?.name !== 'tableActions'
"
v-model="orders[col.name]"
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"

View File

@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar';
import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index';
import { toDate, toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios';
@ -30,7 +30,7 @@ const columns = computed(() => [
isId: true,
},
{
align: 'left',
align: 'center',
name: 'hasCmrDms',
label: t('route.cmr.list.hasCmrDms'),
component: 'checkbox',
@ -51,8 +51,18 @@ const columns = computed(() => [
{
align: 'left',
label: t('route.cmr.list.country'),
name: 'country',
name: 'countryFk',
cardVisible: true,
component: 'select',
attrs: {
url: 'countries',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
},
columnFilter: {
inWhere: true,
},
},
{
align: 'center',
@ -61,7 +71,6 @@ const columns = computed(() => [
cardVisible: true,
component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date),
@ -153,9 +162,18 @@ function downloadPdfs() {
</template>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row.ticketFk }}
{{ row.clientFk }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #column-shipped="{ row }">
{{ toDateHourMin(row.shipped) }}
</template>
<template #column-warehouseFk="{ row }">
{{ row.warehouseName }}
</template>
<template #column-countryFk="{ row }">
{{ row.countryName }}
</template>
</VnTable>
</template>

View File

@ -36,23 +36,20 @@ const tableRef = ref();
const columns = computed(() => [
{
align: 'left',
name: 'id',
name: 'routeFk',
label: 'Id',
chip: {
condition: () => true,
},
isId: true,
columnFilter: false,
},
{
align: 'left',
name: 'created',
label: t('Date'),
component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date),
columnFilter: false,
format: ({ created }) => toDate(created),
},
{
align: 'left',
@ -66,40 +63,63 @@ const columns = computed(() => [
label: t('Agency agreement'),
cardVisible: true,
},
{
align: 'left',
name: 'to',
label: t('To'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'from',
label: t('From'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'packages',
label: t('Packages'),
columnFilter: false,
},
{
align: 'left',
name: 'm3',
label: 'm³',
cardVisible: true,
columnFilter: {
inWhere: true,
},
columnFilter: false,
},
{
align: 'left',
name: 'kmTotal',
label: t('Km'),
cardVisible: true,
columnFilter: false,
},
{
align: 'left',
name: 'price',
label: t('Price'),
columnFilter: false,
},
{
align: 'left',
name: 'invoiceInFk',
label: t('Received'),
columnFilter: false,
},
{
align: 'left',
name: 'supplierName',
label: t('Autonomous'),
columnFilter: false,
},
{
align: 'right',

View File

@ -24,7 +24,6 @@ const selectedRows = ref([]);
const tableRef = ref([]);
const confirmationDialog = ref(false);
const startingDate = ref(null);
const refreshKey = ref(0);
const router = useRouter();
const routeFilter = {
include: [
@ -45,9 +44,7 @@ const columns = computed(() => [
condition: () => true,
},
isId: true,
columnFilter: {
name: 'search',
},
columnFilter: false,
},
{
align: 'left',
@ -107,13 +104,30 @@ const columns = computed(() => [
align: 'left',
name: 'created',
label: t('Date'),
columnFilter: false,
cardVisible: true,
create: true,
component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'to',
label: t('To'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'from',
label: t('From'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
@ -136,18 +150,21 @@ const columns = computed(() => [
name: 'started',
label: t('hourStarted'),
component: 'time',
columnFilter: false,
},
{
align: 'left',
name: 'finished',
label: t('hourFinished'),
component: 'time',
columnFilter: false,
},
{
align: 'left',
name: 'isOk',
label: t('Served'),
component: 'checkbox',
columnFilter: false,
},
{
align: 'right',
@ -183,8 +200,8 @@ const cloneRoutes = () => {
created: startingDate.value,
ids: selectedRows.value.map((row) => row?.id),
});
tableRef.value.reload();
startingDate.value = null;
tableRef.value.reload();
};
const showRouteReport = () => {
@ -220,7 +237,7 @@ const openTicketsDialog = (id) => {
id,
},
})
.onOk(() => refreshKey.value++);
.onOk(() => tableRef.value.reload());
};
</script>
@ -266,7 +283,6 @@ const openTicketsDialog = (id) => {
}"
save-url="Routes/crud"
:disable-option="{ card: true }"
:use-model="true"
table-height="85vh"
v-model:selected="selectedRows"
:table="{
@ -332,6 +348,8 @@ en:
hourStarted: Started hour
hourFinished: Finished hour
es:
From: Desde
To: Hasta
Worker: Trabajador
Agency: Agencia
Vehicle: Vehículo

View File

@ -2,7 +2,7 @@
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { dashIfEmpty } from 'src/filters';
import { toDate } from 'filters/index';
import { toDate, toDateHourMin } from 'filters/index';
import { useQuasar } from 'quasar';
import { useSummaryDialog } from 'composables/useSummaryDialog';
import toCurrency from 'filters/toCurrency';
@ -43,10 +43,9 @@ const columns = computed(() => [
label: t('ETD'),
component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date),
format: ({ created }) => toDate(created),
cardVisible: true,
},
{
@ -200,6 +199,12 @@ function confirmRemove() {
}"
:disable-option="{ card: true }"
>
<template #column-etd="{ row }">
{{ toDateHourMin(row.etd) }}
</template>
<template #column-supplierFk="{ row }">
{{ row.supplierFk }}
</template>
<template #more-create-dialog="{ data }">
<VnInputDate v-model="data.etd" />
<VnInputTime v-model="data.etd" />