diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 3dc807e..b151bf6 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -87,7 +87,9 @@ const gchartEvents = ref({ } },); - +const sleep = (ms) => { + return new Promise(resolve => setTimeout(resolve, ms)) +} const fetch = async () => { try { @@ -137,7 +139,7 @@ const fetch_ccodes = async () => { try { const response = await axios.get(route('ccountry.codes')) ccodes.value = response.data; - ccodes.value = Object.entries(ccodes.value).map(([k,v]) => { if (v !== null) return { "country": k, "code": v } } ).filter( n => n); + ccodes.value = Object.entries(ccodes.value).map(([k, v]) => { if (v !== null) return { "country": k, "code": v } }).filter(n => n); console.log("ccodes=", ccodes.value); } catch (e) { const response = await Swal.fire({ @@ -155,8 +157,10 @@ const fetch_ccodes = async () => { const async_search = async (item) => { try { if (item.length >= 2) { - console.log('SEARCH',item,form.country.code,route('products.search', [item, form.country.code])); + + console.log('SEARCH', item, form.country.code, route('products.search', [item, form.country.code])); const response = await axios.get(route('products.search', [item, form.country.code])); + options_items.value = response.data.map((i) => { return { "item": i.name, "desc": i.typeName, "img": i.mainImageUrl, "code": i.code } }); console.log("VALUES=", options_items.value); } @@ -233,7 +237,8 @@ const submit = () => { Krajina produktu na vyhladanie
- +
@@ -241,7 +246,8 @@ const submit = () => {
+ :internal-search="false" placeholder="Find item" :searchable="true" :options="options_items" + @search-change="async_search" />
Prepocet do meny