forked from verdnatura/salix-front
fix: CustomerDefaulter paginate
This commit is contained in:
parent
b5951a5cef
commit
dac00236bc
|
@ -6,8 +6,7 @@ import { QBtn, QCheckbox, useQuasar } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
import { toCurrency, toDate } from 'filters/index';
|
import { toCurrency, toDate } from 'filters/index';
|
||||||
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
|
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
|
||||||
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
||||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
|
@ -16,6 +15,7 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
const refreshKey = ref(0);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -23,7 +23,6 @@ const dataRef = ref(null);
|
||||||
|
|
||||||
const balanceDueTotal = ref(0);
|
const balanceDueTotal = ref(0);
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
client: {
|
client: {
|
||||||
|
@ -171,7 +170,6 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const setRows = (data) => {
|
const setRows = (data) => {
|
||||||
rows.value = data;
|
|
||||||
balanceDueTotal.value = data.reduce((accumulator, currentValue) => {
|
balanceDueTotal.value = data.reduce((accumulator, currentValue) => {
|
||||||
return accumulator + (currentValue['amount'] || 0);
|
return accumulator + (currentValue['amount'] || 0);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -217,13 +215,6 @@ const onFetch = (data) => {
|
||||||
</div>
|
</div>
|
||||||
</Teleport></template
|
</Teleport></template
|
||||||
>
|
>
|
||||||
<FetchData
|
|
||||||
ref="dataRef"
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="onFetch"
|
|
||||||
auto-load
|
|
||||||
url="Defaulters/filter"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<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">
|
||||||
|
@ -248,6 +239,16 @@ const onFetch = (data) => {
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
|
<VnPaginate
|
||||||
|
@on-fetch="onFetch"
|
||||||
|
data-key="CustomerDefaulter"
|
||||||
|
:key="refreshKey"
|
||||||
|
:filter="filter"
|
||||||
|
auto-load
|
||||||
|
url="Defaulters/filter"
|
||||||
|
>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<div class="q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
@ -261,9 +262,15 @@ const onFetch = (data) => {
|
||||||
<QTh>
|
<QTh>
|
||||||
<QCheckbox v-model="props.selected" />
|
<QCheckbox v-model="props.selected" />
|
||||||
</QTh>
|
</QTh>
|
||||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
<QTh
|
||||||
|
v-for="col in props.cols"
|
||||||
|
:key="col.name"
|
||||||
|
:props="props"
|
||||||
|
>
|
||||||
{{ t(col.label) }}
|
{{ t(col.label) }}
|
||||||
<QTooltip v-if="col.tooltip">{{ col.tooltip }}</QTooltip>
|
<QTooltip v-if="col.tooltip">{{
|
||||||
|
col.tooltip
|
||||||
|
}}</QTooltip>
|
||||||
</QTh>
|
</QTh>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
@ -272,13 +279,28 @@ const onFetch = (data) => {
|
||||||
<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
|
||||||
|
)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-if="props.col.name !== 'isWorker'">
|
<template v-if="props.col.name !== 'isWorker'">
|
||||||
<div v-if="props.col.name === 'lastObservation'">
|
<div
|
||||||
|
v-if="
|
||||||
|
props.col.name === 'lastObservation'
|
||||||
|
"
|
||||||
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
type="textarea"
|
type="textarea"
|
||||||
v-model="props.value"
|
v-model="props.value"
|
||||||
|
@ -304,7 +326,8 @@ const onFetch = (data) => {
|
||||||
</QTr>
|
</QTr>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable></div></template
|
||||||
|
></VnPaginate>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue