From c499946400c775f311d52236d9d1fef3f19a68ff Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Thu, 30 Apr 2020 21:31:30 -0400 Subject: moved search into InventorySearch and started work on filters; updated quantity display --- iridescence/src/components/InventoryCard.vue | 13 ++++++++- iridescence/src/components/InventoryFilter.vue | 39 ++++++-------------------- iridescence/src/components/InventoryList.vue | 20 ++++++------- iridescence/src/components/InventorySearch.vue | 36 ++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 44 deletions(-) create mode 100644 iridescence/src/components/InventorySearch.vue (limited to 'iridescence/src/components') 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 @@

{{ dollars(cents) }}

-

{{ quantity }} in stock.

+

{{ stock }}

@@ -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) } diff --git a/iridescence/src/components/InventoryFilter.vue b/iridescence/src/components/InventoryFilter.vue index 365c1e8..58547eb 100644 --- a/iridescence/src/components/InventoryFilter.vue +++ b/iridescence/src/components/InventoryFilter.vue @@ -1,40 +1,17 @@ diff --git a/iridescence/src/components/InventoryList.vue b/iridescence/src/components/InventoryList.vue index dbda9a4..a4962cd 100644 --- a/iridescence/src/components/InventoryList.vue +++ b/iridescence/src/components/InventoryList.vue @@ -1,18 +1,14 @@ diff --git a/iridescence/src/components/InventorySearch.vue b/iridescence/src/components/InventorySearch.vue new file mode 100644 index 0000000..fbcaabb --- /dev/null +++ b/iridescence/src/components/InventorySearch.vue @@ -0,0 +1,36 @@ + + + -- cgit v1.2.3