0
0
Fork 0

Correcciones solicitadas en la revision del pr

This commit is contained in:
carlosfonseca 2024-01-26 10:47:36 -05:00
parent 1d6625a9be
commit ed926189dd
2 changed files with 33 additions and 33 deletions

View File

@ -1,9 +1,8 @@
<script setup> <script setup>
import { computed, onBeforeMount, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import axios from 'axios';
import { date, QCheckbox, QBtn, useQuasar } from 'quasar'; import { date, QCheckbox, QBtn, useQuasar } from 'quasar';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
@ -24,8 +23,19 @@ const companiesOptions = ref([]);
const companyId = ref(442); const companyId = ref(442);
const rows = ref(null); const rows = ref(null);
const workerId = ref(0); const workerId = ref(0);
const receiptsRef = ref(null);
const clientRisksRef = ref(null);
const filterCompanies = { order: ['code'] }; const filterCompanies = { order: ['code'] };
const params = {
clientId: `${route.params.id}`,
companyId: companyId.value,
filter: { limit: 20 },
};
const filter = {
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: `${route.params.id}`, companyFk: companyId.value },
};
const tableColumnComponents = { const tableColumnComponents = {
payed: { payed: {
@ -91,7 +101,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'created', field: 'created',
format: (value) => date.formatDate(value, 'DD/MM/YYYY hh:mm:ss'), format: (value) => date.formatDate(value, 'DD/MM/YYYY hh:mm'),
label: t('Creation date'), label: t('Creation date'),
name: 'created', name: 'created',
}, },
@ -141,36 +151,10 @@ const columns = computed(() => [
}, },
]); ]);
onBeforeMount(() => {
getData();
});
const getData = () => { const getData = () => {
getReceipts();
getClientRisks();
};
const getReceipts = async () => {
const params = {
clientId: `${route.params.id}`,
companyId: companyId.value,
filter: { limit: 20 },
};
const { data } = await axios.get('Receipts/filter', { params });
rows.value = data;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}; receiptsRef.value?.fetch();
clientRisksRef.value?.fetch();
const getClientRisks = async () => {
const filter = {
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: `${route.params.id}`, companyFk: companyId.value },
};
const { data } = await axios.get('ClientRisks', {
params: { filter: JSON.stringify(filter) },
});
clientRisks.value = data;
console.log(clientRisks.value[0].amount);
}; };
const showNewPaymentDialog = () => { const showNewPaymentDialog = () => {
@ -197,6 +181,20 @@ const updateCompanyId = (id) => {
auto-load auto-load
url="Companies" url="Companies"
/> />
<FetchData
:params="params"
@on-fetch="(data) => (rows = data)"
auto-load
ref="receiptsRef"
url="Receipts/filter"
/>
<FetchData
:filter="filter"
@on-fetch="(data) => (clientRisks = data)"
auto-load
ref="clientRisksRef"
url="ClientRisks"
/>
<QTable <QTable
:columns="columns" :columns="columns"
@ -215,7 +213,9 @@ const updateCompanyId = (id) => {
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)" @click="tableColumnComponents[props.col.name].event(props)"
> >
{{ props.value }} <template v-if="props.col.name !== 'isConciliate'">
{{ props.value }}
</template>
<WorkerDescriptorProxy :id="workerId" /> <WorkerDescriptorProxy :id="workerId" />
</component> </component>
</QTr> </QTr>

View File

@ -129,7 +129,7 @@ const onDataSaved = async () => {
@on-data-saved="onDataSaved()" @on-data-saved="onDataSaved()"
> >
<template #form="{ data }"> <template #form="{ data }">
<span ref="closeButton" class="close-icon" v-close-popup> <span ref="closeButton" class="row justify-end close-icon" v-close-popup>
<QIcon name="close" size="sm" /> <QIcon name="close" size="sm" />
</span> </span>