diff --git a/static/components/shopping-cart-list/shopping-cart-list.html b/static/components/shopping-cart-list/shopping-cart-list.html index 7cabd7f..b326603 100644 --- a/static/components/shopping-cart-list/shopping-cart-list.html +++ b/static/components/shopping-cart-list/shopping-cart-list.html @@ -25,15 +25,57 @@ - + - - - {{product.name}} - + + + + + + + + + + + + {{ product.name}} + + + {{ product.description }} + + + + + {{ formatCurrency(product.price, product.currency)}} + + + + + + + + + + + + {{ formatCurrency(product.price * product.orderedQuantity, product.currency)}} + + + + + + + + + + + diff --git a/static/components/shopping-cart-list/shopping-cart-list.js b/static/components/shopping-cart-list/shopping-cart-list.js index 369f6bb..b9024bc 100644 --- a/static/components/shopping-cart-list/shopping-cart-list.js +++ b/static/components/shopping-cart-list/shopping-cart-list.js @@ -11,7 +11,12 @@ async function shoppingCartList(path) { }, computed: {}, methods: { - + formatCurrency: function(value, unit){ + return formatCurrency(value, unit) + }, + removeProduct: function (stallId, productId) { + console.log('### stallId, productId', stallId, productId) + } }, created() { } }) diff --git a/static/js/utils.js b/static/js/utils.js index 7cd1392..a28c455 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -136,4 +136,11 @@ function isValidKey(key, prefix = 'n') { function isValidKeyHex(key) { return key?.toLowerCase()?.match(/^[0-9a-f]{64}$/) +} + +function formatCurrency(value, currency) { + return new Intl.NumberFormat(window.LOCALE, { + style: 'currency', + currency: currency + }).format(value) } \ No newline at end of file
{{ product.description }}