fix: CustomerNotifications paginate

This commit is contained in:
Javier Segarra 2024-05-09 10:15:24 +02:00
parent 2fc3868a25
commit b5951a5cef
1 changed files with 48 additions and 30 deletions

View File

@ -2,16 +2,15 @@
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar';
import FetchData from 'components/FetchData.vue';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsCampaignConsumption from './CustomerNotificationsCampaignConsumption.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const rows = ref([]);
const selected = ref([]);
const selectedCustomerId = ref(0);
@ -75,6 +74,7 @@ const columns = computed(() => [
name: 'email',
},
]);
const refreshKey = ref(0);
const selectCustomerId = (id) => {
selectedCustomerId.value = id;
@ -99,12 +99,6 @@ const selectCustomerId = (id) => {
</div>
</Teleport>
</template>
<FetchData
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
url="Clients"
/>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
@ -121,30 +115,54 @@ const selectCustomerId = (id) => {
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
selection="multiple"
v-model:selected="selected"
<VnPaginate
:key="refreshKey"
data-key="CustomerNotifications"
url="Clients"
auto-load
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)"
>
{{ props.value }}
<CustomerDescriptorProxy :id="selectedCustomerId" />
</component>
</QTr>
</QTd>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable
:columns="columns"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
selection="multiple"
v-model:selected="selected"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="
tableColumnComponents[props.col.name]
.component
"
class="col-content"
v-bind="
tableColumnComponents[props.col.name].props(
props
)
"
@click="
tableColumnComponents[props.col.name].event(
props
)
"
>
{{ props.value }}
<CustomerDescriptorProxy
:id="selectedCustomerId"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</div>
</template>
</QTable>
</VnPaginate>
</QPage>
</template>