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 VnTitle from 'src/components/common/VnTitle.vue';
import axios from 'axios'; import axios from 'axios';
import dashIfEmpty from 'src/filters/dashIfEmpty'; import dashIfEmpty from 'src/filters/dashIfEmpty';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute(); const route = useRoute();
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -25,95 +24,10 @@ const $props = defineProps({
default: 0, default: 0,
}, },
}); });
const { store } = useArrayData('Account');
const account = ref(store.data);
const entityId = computed(() => $props.id || route.params.id); 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 = { const filter = {
where: { id: entityId }, where: { id: entityId },
fields: ['id', 'nickname', 'name', 'role'], fields: ['id', 'nickname', 'name', 'role'],
@ -122,52 +36,26 @@ const filter = {
</script> </script>
<template> <template>
<CardSummary ref="summary" :url="`VnUsers/preview`" :filter="filter"> <CardSummary
<!-- <template #header="{ entity: { account } }"> ref="AccountSummary"
{{ account.id }} - {{ account.client.name }} ({{ account.client.id }}) :url="`VnUsers/preview`"
</template> --> :filter="filter"
<template #body="{ entity: { account } }"> @on-fetch="(data) => (account = data)"
>
<template #header>{{ account.id }} - {{ account.nickname }}</template>
<template #body>
<QCard class="vn-one"> <QCard class="vn-one">
{{ account }} <QCardSection class="q-pa-none">
<!-- <VnTitle :text="t('account.pageTitles.basicData')" /> --> <a
<!-- <VnLv class="header header-link"
:label="t('account.summary.created')" :href="`#/VnUser/${entityId}/basic-data`"
:value="toDate(account.created)" >
/> --> {{ t('globals.pageTitles.basicData') }}
<!-- <VnLv :label="t('account.summary.state')"> <QIcon name="open_in_new" />
<template #value> </a>
<QChip :color="stateColor(account.accountState.code)" dense> </QCardSection>
{{ account.accountState.description }} <VnLv :label="t('account.card.nickname')" :value="account.nickname" />
</QChip> <VnLv :label="t('account.card.role')" :value="account.role.name" />
</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)}`"
/> -->
</QCard> </QCard>
</template> </template>
</CardSummary> </CardSummary>

View File

@ -14,6 +14,15 @@ account:
privileges: Privileges privileges: Privileges
mailAlias: Mail Alias mailAlias: Mail Alias
mailForwarding: Mail Forwarding 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 search: Search user
role: role:
pageTitles: pageTitles:

View File

@ -14,6 +14,15 @@ account:
privileges: Privilegios privileges: Privilegios
mailAlias: Alias de correo mailAlias: Alias de correo
mailForwarding: Reenvío 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 search: Buscar usuario
role: role: