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