From c64a403ee2e2b28cd6a4f0fde8b2dabc4f2e7e72 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sat, 18 May 2024 11:17:58 +0200 Subject: [PATCH] feat: AccountSummary --- src/pages/Account/Card/AccountSummary.vue | 156 +++------------------- src/pages/Account/locale/en.yml | 9 ++ src/pages/Account/locale/es.yml | 9 ++ 3 files changed, 40 insertions(+), 134 deletions(-) diff --git a/src/pages/Account/Card/AccountSummary.vue b/src/pages/Account/Card/AccountSummary.vue index bc808f6b0..fb2bf6a2a 100644 --- a/src/pages/Account/Card/AccountSummary.vue +++ b/src/pages/Account/Card/AccountSummary.vue @@ -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 = {