Skip to content

Commit

Permalink
fix(Price add): show PriceAlreadyUploadedListCard footer only for rec…
Browse files Browse the repository at this point in the history
…eipts. ref #1074
  • Loading branch information
raphodn committed Dec 2, 2024
1 parent 9be00ed commit 93585fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
15 changes: 13 additions & 2 deletions src/components/PriceAlreadyUploadedListCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
</v-row>
</v-card-text>

<v-divider v-if="proofPriceUploadedList.length" />
<v-divider v-if="showCardFooter" />

<v-card-actions v-if="proofPriceUploadedList.length">
<v-card-actions v-if="showCardFooter">
<v-row>
<v-col cols="12">
<v-chip class="mr-1" label size="small" density="comfortable">
Expand All @@ -42,13 +42,18 @@

<script>
import { defineAsyncComponent } from 'vue'
import constants from '../constants'
import utils from '../utils.js'
export default {
components: {
PriceCard: defineAsyncComponent(() => import('../components/PriceCard.vue')),
},
props: {
proof: {
type: Object,
default: null
},
proofPriceUploadedList: {
type: Array,
default: () => []
Expand All @@ -67,6 +72,12 @@ export default {
showCard() {
return this.hideCardIfNoProofPriceUploaded && this.proofPriceUploadedList.length > 0
},
proofIsTypeReceipt() {
return this.proof && this.proof.type === constants.PROOF_TYPE_RECEIPT
},
showCardFooter() {
return this.proofIsTypeReceipt && this.proofPriceUploadedList.length > 0
},
proofPriceUploadedListSum() {
return this.proofPriceUploadedList.reduce((acc, priceUploaded) => {
return acc + parseFloat(priceUploaded.price)
Expand Down
6 changes: 3 additions & 3 deletions src/components/ProofFooterRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export default {
userIsProofOwner() {
return this.username && (this.proof.owner === this.username)
},
isTypeReceipt() {
proofIsTypeReceipt() {
return this.proof && this.proof.type === constants.PROOF_TYPE_RECEIPT
},
showReceiptPriceCount() {
return this.userIsProofOwner && this.isTypeReceipt && this.proof.receipt_price_count
return this.userIsProofOwner && this.proofIsTypeReceipt && this.proof.receipt_price_count
},
showReceiptPriceTotal() {
return this.userIsProofOwner && this.isTypeReceipt && this.proof.receipt_price_total
return this.userIsProofOwner && this.proofIsTypeReceipt && this.proof.receipt_price_total
},
},
methods: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/ProofMetadataInputRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
/>
</v-col>
</v-row>
<v-row v-if="isTypeReceipt">
<v-row v-if="proofIsTypeReceipt">
<v-col class="pb-0" cols="12">
<h3 class="mb-1">
{{ $t('Common.AdditionalInfo') }}
</h3>
</v-col>
</v-row>
<v-row v-if="isTypeReceipt" class="mt-0">
<v-row v-if="proofIsTypeReceipt" class="mt-0">
<v-col cols="6">
<v-text-field
v-model="proofMetadataForm.receipt_price_count"
Expand Down Expand Up @@ -97,7 +97,7 @@ export default {
userFavoriteCurrencies() {
return this.appStore.getUserFavoriteCurrencies
},
isTypeReceipt() {
proofIsTypeReceipt() {
return this.proofType === constants.PROOF_TYPE_RECEIPT
},
priceRules() {
Expand Down
2 changes: 1 addition & 1 deletion src/views/AddPriceMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<v-col v-if="proofFormFilled" cols="12" md="6">
<!-- Step 2a: product prices already uploaded -->
<PriceAlreadyUploadedListCard :proofPriceUploadedList="proofPriceUploadedList" />
<PriceAlreadyUploadedListCard :proof="proofObject" :proofPriceUploadedList="proofPriceUploadedList" />

<!-- Step 2b: new product price form -->
<v-btn
Expand Down

0 comments on commit 93585fa

Please sign in to comment.