fix: CustomerDefaulter

This commit is contained in:
Javier Segarra 2024-04-26 11:27:55 +02:00
parent 7831a69aa9
commit 320f6afd17
1 changed files with 35 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox, useQuasar } from 'quasar';
import { useStateStore } from 'stores/useStateStore';
import { toCurrency, toDate } from 'filters/index';
@ -14,9 +15,11 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const quasar = useQuasar();
const dataRef = ref(null);
const balanceDueTotal = ref(0);
const selected = ref([]);
@ -184,22 +187,45 @@ const viewAddObservation = (rowsSelected) => {
});
};
const refreshData = () => {
setRows();
const refreshData = async () => {
await dataRef.value.fetch();
};
const onFetch = (data) => {
for (const element of data) {
element.isWorker = element.businessTypeFk === 'worker';
}
rows.value = data;
setRows(data);
};
</script>
<template>
<FetchData :filter="filter" @on-fetch="onFetch" auto-load url="Defaulters/filter" />
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport></template
>
<FetchData
ref="dataRef"
:filter="filter"
@on-fetch="onFetch"
auto-load
url="Defaulters/filter"
/>
<QDrawer 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">
<CustomerNotificationsFilter data-key="CustomerDefaulter" />
</QScrollArea>
@ -214,7 +240,9 @@ const onFetch = (data) => {
icon="vn:notes"
:disabled="!selected.length"
@click.stop="viewAddObservation(selected)"
/>
>
<QTooltip>{{ t('Add observation') }}</QTooltip>
</QBtn>
</div>
</template>
</VnSubToolbar>
@ -289,6 +317,7 @@ const onFetch = (data) => {
<i18n>
es:
Add observation: Añadir observación
Client: Cliente
Is worker: Es trabajador
Salesperson: Comercial