diff options
Diffstat (limited to 'iridescence/src/components/InventoryCard.vue')
-rw-r--r-- | iridescence/src/components/InventoryCard.vue | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/iridescence/src/components/InventoryCard.vue b/iridescence/src/components/InventoryCard.vue index 75e683a..6bcc548 100644 --- a/iridescence/src/components/InventoryCard.vue +++ b/iridescence/src/components/InventoryCard.vue @@ -15,7 +15,7 @@ <p class="subtitle is-4"> {{ dollars(cents) }} </p> - <p class="subtitle is-6">{{ quantity }} in stock.</p> + <p class="subtitle is-6">{{ stock }}</p> </div> <div class="content"> @@ -37,6 +37,17 @@ export default { imgPath: String, description: String }, + computed: { + stock() { + if (this.quantity < 0) { + return "Made to order"; + } else if (this.quantity == 0) { + return "Out of stock"; + } else { + return [this.quantity, "in stock"].join(" "); + } + } + }, methods: { dollars: cents => "$ " + (cents / 100).toFixed(2) } |