diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 406017e..083ceaf 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -36,9 +36,33 @@ const sdropdown = ref([ const products = ref([]); + const countryHash = ref([]); const countryCurrency = ref({}); const showItemFilter = ref(false); +const rates = ref([]); +const options_items = ref([]); +const itemCode = ref(null); + +const options = { + region: 150, + + width: 500, + height: 310, +}; + +const chart_settings = { + packages: ['geochart', 'map'], + mapsApiKey: "AIzaSyAJaLArHgTmQPMOSogitG-umhZilVIgdNU", +}; + +const gchartEvents = ref({ + regionClick: () => { + const selection = getSelection() + console.log(selection); + console.log("T"); + } +},); let tproducts = computed(() => { console.log('PR=', products); @@ -51,15 +75,28 @@ let tproducts = computed(() => { prod.currency = 'EUR' } if (prod.tag == 'NONE') prod.tag = ''; - prod.calcPrice = Math.round(prod.calcPrice * currencyCoef.value * 100)/100; + prod.salesPrice = Math.round(prod.salesPrice * 100) / 100; + prod.calcPrice = Math.round(prod.calcPrice * currencyCoef.value * 100) / 100; prod.rate = currencyHash.value[prod.currency]; return prod; }) }) +const filterOptions = computed(() => { + const filterOptionsArray = []; + if (productsCriteria.value != 'All' && productsCriteria.value != null) { + filterOptionsArray.push({ + field: 'item', + comparison: '=', + criteria: productsCriteria.value, + }); + } + return filterOptionsArray; +}); + let uniqProducts = computed(() => { - var output = []; + var output = ['All',]; var keys = []; options_items.value.forEach((element) => { var key = element.item; @@ -72,6 +109,7 @@ let uniqProducts = computed(() => { return output; }); +const productsCriteria = ref(uniqProducts.value[0]); const type = 'GeoChart'; const form = useForm({ countries: '', @@ -111,29 +149,6 @@ const hresults = ref([ { text: "Price", value: "price", sortable: true }, { text: "Image", value: "img", sortable: false } ]) -const rates = ref([]); -const options_items = ref([]); -const itemCode = ref(null); - -const options = { - region: 150, - - width: 500, - height: 310, -}; - -const chart_settings = { - packages: ['geochart', 'map'], - mapsApiKey: "AIzaSyAJaLArHgTmQPMOSogitG-umhZilVIgdNU", -}; - -const gchartEvents = ref({ - regionClick: () => { - const selection = getSelection() - console.log(selection); - console.log("T"); - } -},); const sleep = (ms) => { return new Promise(resolve => setTimeout(resolve, ms)) @@ -221,6 +236,7 @@ const async_search = async () => { options_items.value = response.data.map((i) => { return { "item": i.name, "desc": i.typeName, "img": i.mainImageUrl, "code": i.code, "url": i.url, "price": i.salesPrice, "units": i.priceUnit, "descLong": i.mainImageAlt } }); console.log("VALUES=", options_items.value); + productsCriteria.value = null; } catch (e) { const response = await Swal.fire({ title: __('are you want to try again') + '?', @@ -366,13 +382,13 @@ const submit = () => {