feat: refs #7984 add currency in sale
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-21 15:09:40 +01:00
parent 3c6a4c1e16
commit f076c62bab
3 changed files with 40 additions and 10 deletions

View File

@ -94,6 +94,7 @@ const filter = {
], ],
}, },
}, },
{ relation: 'currency' },
], ],
}; };

View File

@ -25,6 +25,7 @@ import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import VnUsesMana from 'src/components/ui/VnUsesMana.vue'; import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnCurrency from 'src/components/ui/VnCurrency.vue';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -622,7 +623,7 @@ watch(
</QBtnGroup> </QBtnGroup>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()"> <Teleport to="#right-panel" v-if="stateStore.isHeaderMounted() && store.data">
<div <div
class="q-pa-md q-mb-md q-ma-md color-vn-text" class="q-pa-md q-mb-md q-ma-md color-vn-text"
style="border: 2px solid black" style="border: 2px solid black"
@ -631,17 +632,35 @@ watch(
<span class="q-mr-xs color-vn-label" <span class="q-mr-xs color-vn-label"
>{{ t('ticketSale.subtotal') }}: >{{ t('ticketSale.subtotal') }}:
</span> </span>
<span>{{ toCurrency(store.data?.totalWithoutVat) }}</span> <VnCurrency
:model="store.data"
:currency-code="store.data.currency.code"
local-field="totalWithoutVat"
foreign-field="foreignTotalWithoutVat"
/>
</QCardSection> </QCardSection>
<QCardSection class="justify-end text-subtitle1" horizontal> <QCardSection class="justify-end text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label"> {{ t('ticketSale.tax') }}: </span> <span class="q-mr-xs color-vn-label"> {{ t('ticketSale.tax') }}: </span>
<span>{{ <VnCurrency
toCurrency(store.data?.totalWithVat - store.data?.totalWithoutVat) :model="{
}}</span> vat: store.data.totalWithVat - store.data?.totalWithoutVat,
foreignVat:
store.data.foreignTotalWithVat -
store.data?.foreignTotalWithoutVat,
}"
:currency-code="store.data.currency.code"
local-field="vat"
foreign-field="foreignVat"
/>
</QCardSection> </QCardSection>
<QCardSection class="justify-end text-weight-bold text-subtitle1" horizontal> <QCardSection class="justify-end text-weight-bold text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label"> {{ t('basicData.total') }}: </span> <span class="q-mr-xs color-vn-label"> {{ t('basicData.total') }}: </span>
<span>{{ toCurrency(store.data?.totalWithVat) }}</span> <VnCurrency
:model="store.data"
:currency-code="store.data.currency.code"
local-field="totalWithVat"
foreign-field="foreignTotalWithVat"
/>
</QCardSection> </QCardSection>
</div> </div>
</Teleport> </Teleport>
@ -798,7 +817,7 @@ watch(
<template #column-price="{ row }"> <template #column-price="{ row }">
<template v-if="isTicketEditable && row.id"> <template v-if="isTicketEditable && row.id">
<QBtn flat class="link" dense @click="onOpenEditPricePopover(row)"> <QBtn flat class="link" dense @click="onOpenEditPricePopover(row)">
{{ toCurrency(row.price) }} <VnCurrency :model="row" :currency-code="store.data.currency.code" />
</QBtn> </QBtn>
<TicketEditManaProxy <TicketEditManaProxy
ref="editPriceProxyRef" ref="editPriceProxyRef"
@ -813,7 +832,9 @@ watch(
/> />
</TicketEditManaProxy> </TicketEditManaProxy>
</template> </template>
<span v-else>{{ toCurrency(row.price) }}</span> <span v-else>
<VnCurrency :model="row" :currency-code="store.data.currency.code" />
</span>
</template> </template>
<template #column-discount="{ row }"> <template #column-discount="{ row }">
<template v-if="!isLocked && row.id"> <template v-if="!isLocked && row.id">
@ -840,7 +861,15 @@ watch(
<span v-else>{{ toPercentage(row.discount / 100) }}</span> <span v-else>{{ toPercentage(row.discount / 100) }}</span>
</template> </template>
<template #column-amount="{ row }"> <template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }} <VnCurrency
:model="{
amount: row.quantity * row.price,
foreignAmount: row.quantity * row.foreignPrice,
}"
:currency-code="store.data.currency.code"
local-field="amount"
foreign-field="foreignAmount"
/>
</template> </template>
</VnTable> </VnTable>

View File

@ -9,6 +9,7 @@ const ticketCard = {
menu: [ menu: [
'TicketBasicData', 'TicketBasicData',
'TicketSale', 'TicketSale',
'TicketService',
'TicketLog', 'TicketLog',
'TicketExpedition', 'TicketExpedition',
'TicketDms', 'TicketDms',
@ -19,7 +20,6 @@ const ticketCard = {
'TicketVolume', 'TicketVolume',
'TicketComponents', 'TicketComponents',
'TicketPackage', 'TicketPackage',
'TicketService',
'TicketSaleTracking', 'TicketSaleTracking',
'TicketBoxing', 'TicketBoxing',
'TicketSms', 'TicketSms',