Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
The currency should display the code instead of a number. (#2984)
Browse files Browse the repository at this point in the history
* PanJiaChen#2903

* Update fieldAmount.vue

---------

Co-authored-by: Edwin Betancourt <[email protected]>
  • Loading branch information
elsiosanchez and EdwinBetanc0urt authored Nov 14, 2024
1 parent f5160e8 commit 3c51e37
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
Contributor(s): Elsio Sanchez elsiosanchez15@outlook.com https://github.com/elsiosanchez
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A.
Contributor(s): Elsio Sanchez elsiosanchez15@outlook.com https://github.com/elsiosanchez
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
Expand Down Expand Up @@ -42,17 +44,21 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.

<script>
import { defineComponent, computed, ref } from '@vue/composition-api'

// import lang from '@/lang'
import store from '@/store'

// // Utils and Helper Methods
// import { formatPrice, formatQuantity } from '@/utils/ADempiere/formatValue/numberFormat'
// import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
// import { displayLineProductPriceValue } from '@/utils/ADempiere/dictionary/form/VPOS'
// import { copyToClipboard } from '@/utils/ADempiere/coreUtils.js'
import { formatPrice } from '@/utils/ADempiere/formatValue/numberFormat'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'

export default defineComponent({
name: 'fieldAmount',

props: {
valueAmount: {
type: Number,
Expand All @@ -77,6 +83,7 @@ export default defineComponent({
default: false
}
},

setup(props) {
// Ref
const isFocus = ref(false)
Expand All @@ -96,6 +103,7 @@ export default defineComponent({
// Methods
const displayValue = computed(() => {
const currency = store.getters.getAvailableCurrencies.currencie
if (!isEmptyValue(props.valueDisplay)) return props.valueDisplay
return formatPrice({ value: Number(totalAmount.value), currency: currency.iso_code })
})
function customFocusGained(event) {
Expand All @@ -112,6 +120,7 @@ export default defineComponent({
function customFocusLost(event) {
isFocus.value = false
}

return {
// Ref
amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default defineComponent({
})

const amountDisplay = computed(() => {
return formatPrice({ value: Number(amount), currency: currencyPayment.iso_code })
return formatPrice({ value: Number(amount.value), currency: currencyPayment.value.iso_code })
})

const listPaymentsOpenst = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
>
<field-amount
:value-amount="amount"
:value-display="amount"
:value-display="amountDisplay"
:handle-change="updateAmount"
/>
</el-form-item>
Expand Down Expand Up @@ -201,7 +201,7 @@ export default defineComponent({
})

const amountDisplay = computed(() => {
return formatPrice({ value: Number(amount), currency: currencyPayment.iso_code })
return formatPrice({ value: Number(amount.value), currency: currencyPayment.value.iso_code })
})

const listPaymentsOpenst = computed(() => {
Expand Down

0 comments on commit 3c51e37

Please sign in to comment.