diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-12-28 15:13:28 -0500 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-12-28 15:13:28 -0500 |
commit | fceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4 (patch) | |
tree | 27cce6fc12a9984dd31aee0dac78340fe13366af /iridescence/src | |
parent | c0253e47b2f9dec260806e96536cd68202bc7674 (diff) | |
download | theglassyladies-fceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4.tar.xz theglassyladies-fceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4.zip |
only dollar amounts can be inserted (request), backend still stores as
cents
Diffstat (limited to 'iridescence/src')
-rw-r--r-- | iridescence/src/components/admin/ProductEditCard.vue | 12 | ||||
-rw-r--r-- | iridescence/src/views/Admin.vue | 3 | ||||
-rw-r--r-- | iridescence/src/views/Home.vue | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/iridescence/src/components/admin/ProductEditCard.vue b/iridescence/src/components/admin/ProductEditCard.vue index 88d8e91..603cb4f 100644 --- a/iridescence/src/components/admin/ProductEditCard.vue +++ b/iridescence/src/components/admin/ProductEditCard.vue @@ -128,8 +128,6 @@ </template> <script> -const dollarRe = /^\$?(\d+)\.(\d{2})/gm; - export default { name: "ProductEditCard", data: function() { @@ -204,12 +202,12 @@ export default { price: { get: function() { const cents = this.diff.cents || this.old.cents || 0; - return (cents / 100).toFixed(2); + return (cents / 100).toFixed(0); }, - set: function(price) { - const groups = dollarRe.exec(price); - if (groups && groups[1] && groups[2]) { - this.diff.cents = 100 * groups[1] + 1 * groups[2]; + set: function(dollars) { + const cents = dollars * 100; + if (isFinite(cents)) { + this.diff.cents = cents; } } }, diff --git a/iridescence/src/views/Admin.vue b/iridescence/src/views/Admin.vue index 6bb161a..eedafc7 100644 --- a/iridescence/src/views/Admin.vue +++ b/iridescence/src/views/Admin.vue @@ -40,6 +40,9 @@ export default { } }); } + }, + mounted() { + window.scrollTo(0, 0); } }; </script> diff --git a/iridescence/src/views/Home.vue b/iridescence/src/views/Home.vue index b512328..b63f16f 100644 --- a/iridescence/src/views/Home.vue +++ b/iridescence/src/views/Home.vue @@ -31,6 +31,9 @@ export default { ProductList, ProductDetail, ProductSearch + }, + mounted() { + window.scrollTo(0, 0); } }; </script> |