diff --git a/app/Http/Controllers/ProductsCountController.php b/app/Http/Controllers/ProductsCountController.php new file mode 100644 index 0000000..457f4e3 --- /dev/null +++ b/app/Http/Controllers/ProductsCountController.php @@ -0,0 +1,13 @@ +get(); + } + + + +} diff --git a/lang/id.json b/lang/id.json index 228ef6b..3040526 100644 --- a/lang/id.json +++ b/lang/id.json @@ -135,5 +135,6 @@ "typeerror: can't access property \"code\", (intermediate value).country.country is undefined": "TypeError: can't access property \"code\", (intermediate value).country.country is undefined", "typeerror: can't access property \"code\", (intermediate value).country[0] is undefined": "TypeError: can't access property \"code\", (intermediate value).country[0] is undefined", "error: request failed with status code 419": "Error: Request failed with status code 419", - "error: network error": "Error: Network Error" + "error: network error": "Error: Network Error", + "error: ziggy error: route 'products.count' is not in the route list.": "Error: Ziggy error: route 'products.count' is not in the route list." } \ No newline at end of file diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 047b417..6e7c9d7 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -55,11 +55,10 @@ const gChartHeight = gChartWidth == 400 ? 250 : (screenWidth.value *65/100) - 20 console.log('GCH',screenWidth.value, screenHeight.value, gChartWidth,gChartHeight); const options = { region: 150, - colorAxis: { - colors : ['blue','red'], - minValue: 0, - maxValue: 1 }, - backgroundColor: '#e5e6f9', + colorAxis: {colors: ['#0000ff']}, + backgroundColor: '#81d4fa', + datalessRegionColor: '#f8bbd0', + //defaultColor: '#f5f5f5', width: gChartWidth, height: gChartHeight, }; @@ -84,11 +83,11 @@ const onHover = (data) => { }; const chart_coutries = computed(() => { - let countries = [["Country"]]; + let countries = [["Country", "Count"]]; for (let i=0; i < settingsStore.ccountry_list.length ; i++) { if (settingsStore.ccountry_list[i].offline == (settingsStore.online ? 'N' : 'Y') || settingsStore.online == true) - countries.push([settingsStore.ccountry_list[i].name]); + countries.push([settingsStore.ccountry_list[i].name, settingsStore.products_count[settingsStore.ccountry_list[i].code] ]); } return countries; }) @@ -253,6 +252,13 @@ const fetch = async () => { settingsStore.settings = response2.data; console.log("SETTINGS=",settingsStore.settings); + const response3 = await axios.get(route("products.count")); + settingsStore.products_count = Object.fromEntries( + response3.data.map((c) => [c.country, c.cnt]) + ); + console.log("PC=",settingsStore.products_count); + + } catch (e) { const response = await Swal.fire({ title: __("are you want to try again") + "?", diff --git a/resources/js/settingsStore.js b/resources/js/settingsStore.js index 54ec320..8690858 100644 --- a/resources/js/settingsStore.js +++ b/resources/js/settingsStore.js @@ -10,6 +10,7 @@ export const settingsStore = reactive({ currency: "EUR", online: false, ccountry_filter: [["Country"]], + products_count: {}, ccountry_list: [], currencyCoef: 1.0, settings: {}, diff --git a/routes/web.php b/routes/web.php index 77cfe1b..5a8e771 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,7 @@ use App\Http\Controllers\ProductsCompareController; use App\Http\Controllers\FeedbackController; use App\Http\Controllers\SettingsController; use App\Http\Controllers\OnlineCompareController; +use App\Http\Controllers\ProductsCountController; /* |-------------------------------------------------------------------------- | Web Routes @@ -32,7 +33,8 @@ Route::get('/exchange/', function () { return Inertia::render('IkeaExchange'); })->name('exchange'); Route::post('users-send-email', [FeedbackController::class, 'sendEmail'])->name('ajax.send.email'); -Route::get('/products/online', [OnlineCompareController::class,'compare'])->name('products.online.compare'); +//Route::get('/products/online', [OnlineCompareController::class,'compare'])->name('products.online.compare'); +Route::get('/products/count', [ProductsCountController::class,'index'])->name('products.count'); Route::get('/menu/get', [App\Http\Controllers\Superuser\UserMenuController::class, 'get'])->name('menu.user'); Route::get('/ip/get/{ip?}', [GeoIPController::class, 'index'])->name('geo.ip.get'); Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');