From 5867e751aa626481372e4a83f67d102dc95b92cf Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Fri, 17 Jan 2025 23:06:50 +0100 Subject: [PATCH] fix(Price add): Allow 'quantity bought' field to be decimal --- src/components/PriceAlreadyUploadedListCard.vue | 2 +- src/components/PriceInputRow.vue | 4 ++-- src/components/PricePriceRow.vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/PriceAlreadyUploadedListCard.vue b/src/components/PriceAlreadyUploadedListCard.vue index 4f5bef09af6..8aebfb78686 100644 --- a/src/components/PriceAlreadyUploadedListCard.vue +++ b/src/components/PriceAlreadyUploadedListCard.vue @@ -77,7 +77,7 @@ export default { }, proofPriceUploadedListSum() { return this.proofPriceUploadedList.reduce((acc, priceUploaded) => { - return acc + parseFloat(priceUploaded.price)*parseInt(priceUploaded.receipt_quantity) + return acc + parseFloat(priceUploaded.price)*parseFloat(priceUploaded.receipt_quantity) }, 0) } }, diff --git a/src/components/PriceInputRow.vue b/src/components/PriceInputRow.vue index 3c3fbcefce0..e72ce2bff67 100644 --- a/src/components/PriceInputRow.vue +++ b/src/components/PriceInputRow.vue @@ -64,7 +64,7 @@ density="compact" :label="$t('Common.QuantityBought')" type="text" - inputmode="numeric" + inputmode="decimal" :rules="receiptQuantityRules" :prepend-inner-icon="PROOF_TYPE_RECEIPT_ICON" hide-details="auto" @@ -143,7 +143,7 @@ export default { if (!this.priceForm.receipt_quantity) return [() => true] // optional field return [ value => !isNaN(value) || this.$t('PriceRules.Number'), - value => Number(value) >= 1 || this.$t('PriceRules.Positive'), + value => Number(value) >= 0 || this.$t('PriceRules.Positive'), ] }, productIsTypeCategory() { diff --git a/src/components/PricePriceRow.vue b/src/components/PricePriceRow.vue index bd55b7450a5..99eff78bb87 100644 --- a/src/components/PricePriceRow.vue +++ b/src/components/PricePriceRow.vue @@ -9,7 +9,7 @@ {{ $t('PriceCard.FullPrice') }} {{ getPriceValueDisplay(price.price_without_discount) }} - + x{{ price.receipt_quantity }}