summaryrefslogtreecommitdiff
path: root/iridescence/src/components/admin
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-12-28 15:13:28 -0500
committerAdam T. Carpenter <atc@53hor.net>2020-12-28 15:13:28 -0500
commitfceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4 (patch)
tree27cce6fc12a9984dd31aee0dac78340fe13366af /iridescence/src/components/admin
parentc0253e47b2f9dec260806e96536cd68202bc7674 (diff)
downloadtheglassyladies-fceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4.tar.xz
theglassyladies-fceb8ffc0c551d0da5bfd936bbc4a54b07e8f4c4.zip
only dollar amounts can be inserted (request), backend still stores as
cents
Diffstat (limited to 'iridescence/src/components/admin')
-rw-r--r--iridescence/src/components/admin/ProductEditCard.vue12
1 files changed, 5 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;
}
}
},