Skip to content

Commit

Permalink
refactor(Price card): allow toggling price owner, date & created fiel…
Browse files Browse the repository at this point in the history
…ds. ref #806
  • Loading branch information
raphodn committed Sep 29, 2024
1 parent ac8258b commit ee44680
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/components/PriceCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</v-col>
</v-row>

<PriceFooterRow v-if="price && !hidePriceFooterRow" :price="price" :hidePriceLocation="hidePriceLocation" :hidePriceProof="hidePriceProof" :hideProductDetails="hideProductDetails" :readonly="readonly" />
<PriceFooterRow v-if="price && !hidePriceFooterRow" :price="price" :hidePriceLocation="hidePriceLocation" :hidePriceOwner="hidePriceOwner" :hidePriceDate="hidePriceDate" :hidePriceProof="hidePriceProof" :hidePriceCreated="hidePriceCreated" :hideProductDetails="hideProductDetails" :readonly="readonly" />
</v-container>
</v-card>
</template>
Expand Down Expand Up @@ -88,10 +88,22 @@ export default {
type: Boolean,
default: false
},
hidePriceOwner: {
type: Boolean,
default: true
},
hidePriceDate: {
type: Boolean,
default: false
},
hidePriceProof: {
type: Boolean,
default: false
},
hidePriceCreated: {
type: Boolean,
default: true
},
readonly: {
type: Boolean,
default: false
Expand Down
18 changes: 17 additions & 1 deletion src/components/PriceFooterRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<v-row style="margin-top:0;">
<v-col cols="11">
<LocationChip v-if="!hidePriceLocation" class="mr-1" :location="price.location" :locationId="price.location_id" :readonly="readonly" />
<DateChip class="mr-1" :date="price.date" :readonly="readonly" />
<UserChip v-if="!hidePriceOwner" class="mr-1" :username="price.owner" :readonly="readonly" />
<DateChip v-if="!hidePriceDate" class="mr-1" :date="price.date" :readonly="readonly" />
<ProofChip v-if="price.proof && !hidePriceProof" class="mr-1" :proof="price.proof" />
<RelativeDateTimeChip v-if="!hidePriceCreated" :dateTime="price.created" />
</v-col>
</v-row>

Expand All @@ -16,8 +18,10 @@ import { defineAsyncComponent } from 'vue'
export default {
components: {
LocationChip: defineAsyncComponent(() => import('../components/LocationChip.vue')),
UserChip: defineAsyncComponent(() => import('../components/UserChip.vue')),
DateChip: defineAsyncComponent(() => import('../components/DateChip.vue')),
ProofChip: defineAsyncComponent(() => import('../components/ProofChip.vue')),
RelativeDateTimeChip: defineAsyncComponent(() => import('../components/RelativeDateTimeChip.vue')),
PriceActionMenuButton: defineAsyncComponent(() => import('../components/PriceActionMenuButton.vue')),
},
props: {
Expand All @@ -29,10 +33,22 @@ export default {
type: Boolean,
default: false
},
hidePriceOwner: {
type: Boolean,
default: true
},
hidePriceDate: {
type: Boolean,
default: false
},
hidePriceProof: {
type: Boolean,
default: false
},
hidePriceCreated: {
type: Boolean,
default: true
},
hideProductDetails: {
type: Boolean,
default: false
Expand Down

0 comments on commit ee44680

Please sign in to comment.