diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 77a86f8..00f0c02 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -41,18 +41,19 @@ const countryCurrency = ref({}); const showItemFilter = ref(false); let tproducts = computed(() => { - console.log('PR=',products); - console.log('CC=',countryCurrency.value); + console.log('PR=', products); + console.log('CC=', countryCurrency.value); return products.value.map((prod) => { prod.currency = countryCurrency.value[prod.countryName]; - if (currencyHash.value[prod.currency]) prod.calcPrice = prod.salesPrice/currencyHash.value[prod.currency]; + if (currencyHash.value[prod.currency]) prod.calcPrice = prod.salesPrice / currencyHash.value[prod.currency]; else { prod.calcPrice = prod.salesPrice; prod.currency = 'EUR' } + if (prod.tag == 'NONE') prod.tag = ''; prod.calcPrice = (prod.calcPrice * currencyCoef.value).toFixed(2); prod.rate = currencyHash.value[prod.currency]; - + return prod; }) }) @@ -95,9 +96,9 @@ const hrates = ref([ // { "country": "AT", "code": "50161321", "url": "https://www.ikea.com/at/de/p/hol-aufbewahrungstisch-akazie-50161321/", "name": "HOL", "typeName": "Aufbewahrungstisch", "mainImageUrl": "https://www.ikea.com/at/de/images/products/hol-aufbewahrungstisch-akazie__0104310_pe251255_s5.jpg", "itemNoGlobal": "50161321", "salesPrice": "80.99", "tag": "FAMILY_PRICE", "last_mod": "2023-12-03 16:44:24" }, const hproducts = ref([ { text: "Country", value: "countryName", sortable: true }, - // { text: "Name", value: "name", sortable: true }, + { text: "Tag", value: "tag", sortable: true }, { text: "Local Price", value: "salesPrice", sortable: true }, - { text: "Cur", value: "currency", sortable: false}, + { text: "Cur", value: "currency", sortable: false }, { text: "Rate", value: "rate" }, { text: "Price", value: "calcPrice", sortable: true } ]); @@ -167,8 +168,8 @@ const fetch_rates = async () => { const response = await axios.get(route('rates.index')) rates.value = response.data; currency.value = rates.value.map((currency) => currency.currency); - countryCurrency.value = Object.fromEntries( - rates.value.map((currency) => [currency.country_name, currency.currency ]) + countryCurrency.value = Object.fromEntries( + rates.value.map((currency) => [currency.country_name, currency.currency]) ); currencyHash.value = Object.fromEntries( rates.value.map((currency) => [currency.currency, currency.rate]),