0
0
Fork 0

feat: AccountSummary

This commit is contained in:
Javier Segarra 2024-05-18 11:17:58 +02:00
parent a2316fb222
commit c64a403ee2
3 changed files with 40 additions and 134 deletions

View File

@ -12,12 +12,11 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import axios from 'axios';
import dashIfEmpty from 'src/filters/dashIfEmpty';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const $props = defineProps({
id: {
@ -25,95 +24,10 @@ const $props = defineProps({
default: 0,
},
});
const { store } = useArrayData('Account');
const account = ref(store.data);
const entityId = computed(() => $props.id || route.params.id);
const detailsColumns = ref([
{
name: 'item',
label: 'account.summary.item',
field: (row) => row.sale.itemFk,
sortable: true,
},
{
name: 'landed',
label: 'account.summary.landed',
field: (row) => row.sale.ticket.landed,
format: (value) => toDate(value),
sortable: true,
},
{
name: 'quantity',
label: 'account.summary.quantity',
field: (row) => row.sale.quantity,
sortable: true,
},
{
name: 'accounted',
label: 'account.summary.accounted',
field: (row) => row.quantity,
sortable: true,
},
{
name: 'description',
label: 'globals.description',
field: (row) => row.sale.concept,
},
{
name: 'price',
label: 'account.summary.price',
field: (row) => row.sale.price,
sortable: true,
},
{
name: 'discount',
label: 'account.summary.discount',
field: (row) => row.sale.discount,
format: (value) => `${value} %`,
sortable: true,
},
{
name: 'total',
label: 'account.summary.total',
field: ({ sale }) =>
toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)),
sortable: true,
},
]);
const developmentColumns = ref([
{
name: 'accountReason',
label: 'account.summary.reason',
field: (row) => row.accountReason.description,
sortable: true,
},
{
name: 'accountResult',
label: 'account.summary.result',
field: (row) => row.accountResult.description,
sortable: true,
},
{
name: 'accountResponsible',
label: 'account.summary.responsible',
field: (row) => row.accountResponsible.description,
sortable: true,
},
{
name: 'worker',
label: 'account.summary.worker',
field: (row) => row.worker?.user.nickname,
sortable: true,
},
{
name: 'accountRedelivery',
label: 'account.summary.redelivery',
field: (row) => row.accountRedelivery.description,
sortable: true,
},
]);
const filter = {
where: { id: entityId },
fields: ['id', 'nickname', 'name', 'role'],
@ -122,52 +36,26 @@ const filter = {
</script>
<template>
<CardSummary ref="summary" :url="`VnUsers/preview`" :filter="filter">
<!-- <template #header="{ entity: { account } }">
{{ account.id }} - {{ account.client.name }} ({{ account.client.id }})
</template> -->
<template #body="{ entity: { account } }">
<CardSummary
ref="AccountSummary"
:url="`VnUsers/preview`"
:filter="filter"
@on-fetch="(data) => (account = data)"
>
<template #header>{{ account.id }} - {{ account.nickname }}</template>
<template #body>
<QCard class="vn-one">
{{ account }}
<!-- <VnTitle :text="t('account.pageTitles.basicData')" /> -->
<!-- <VnLv
:label="t('account.summary.created')"
:value="toDate(account.created)"
/> -->
<!-- <VnLv :label="t('account.summary.state')">
<template #value>
<QChip :color="stateColor(account.accountState.code)" dense>
{{ account.accountState.description }}
</QChip>
</template>
</VnLv> -->
<!-- <VnLv :label="t('globals.salesPerson')">
<template #value>
<VnUserLink
:name="account.client?.salesPersonUser?.name"
:worker-id="account.client?.salesPersonFk"
/>
</template>
</VnLv> -->
<!-- <VnLv :label="t('account.summary.attendedBy')">
<template #value>
<VnUserLink
:name="account.worker?.user?.nickname"
:worker-id="account.workerFk"
/>
</template>
</VnLv>
<VnLv :label="t('account.summary.customer')">
<template #value>
<span class="link cursor-pointer">
{{ account.client?.name }}
</span>
</template>
</VnLv>
<VnLv
:label="t('account.basicData.pickup')"
:value="`${dashIfEmpty(account.pickup)}`"
/> -->
<QCardSection class="q-pa-none">
<a
class="header header-link"
:href="`#/VnUser/${entityId}/basic-data`"
>
{{ t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</a>
</QCardSection>
<VnLv :label="t('account.card.nickname')" :value="account.nickname" />
<VnLv :label="t('account.card.role')" :value="account.role.name" />
</QCard>
</template>
</CardSummary>

View File

@ -14,6 +14,15 @@ account:
privileges: Privileges
mailAlias: Mail Alias
mailForwarding: Mail Forwarding
card:
nickname: Usuario
role: Rol
actions:
setPassword: Se password
disableAccount: Disable account
disableUser: Disable user
sync: Sync
delete: Delete
search: Search user
role:
pageTitles:

View File

@ -14,6 +14,15 @@ account:
privileges: Privilegios
mailAlias: Alias de correo
mailForwarding: Reenvío de correo
card:
nickname: Usuario
role: Rol
actions:
setPassword: Establecer contraseña
disableAccount: Deshabilitar cuenta
disableUser: Desactivar usuario
sync: Sincronizar
delete: Eliminar
search: Buscar usuario
role: