Map of product count
This commit is contained in:
13
app/Http/Controllers/ProductsCountController.php
Normal file
13
app/Http/Controllers/ProductsCountController.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Models\ProductsCount;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ProductsCountController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return ProductsCount::all();
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/Models/ProductsCount.php
Normal file
40
app/Models/ProductsCount.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ProductsCount extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 't_products_count';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
//protected $primaryKey = 'name';
|
||||||
|
/**
|
||||||
|
* Indicates if the model's ID is auto-incrementing.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected function get()
|
||||||
|
{
|
||||||
|
return $this->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.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",
|
"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: 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."
|
||||||
}
|
}
|
||||||
@@ -55,11 +55,10 @@ const gChartHeight = gChartWidth == 400 ? 250 : (screenWidth.value *65/100) - 20
|
|||||||
console.log('GCH',screenWidth.value, screenHeight.value, gChartWidth,gChartHeight);
|
console.log('GCH',screenWidth.value, screenHeight.value, gChartWidth,gChartHeight);
|
||||||
const options = {
|
const options = {
|
||||||
region: 150,
|
region: 150,
|
||||||
colorAxis: {
|
colorAxis: {colors: ['#0000ff']},
|
||||||
colors : ['blue','red'],
|
backgroundColor: '#81d4fa',
|
||||||
minValue: 0,
|
datalessRegionColor: '#f8bbd0',
|
||||||
maxValue: 1 },
|
//defaultColor: '#f5f5f5',
|
||||||
backgroundColor: '#e5e6f9',
|
|
||||||
width: gChartWidth,
|
width: gChartWidth,
|
||||||
height: gChartHeight,
|
height: gChartHeight,
|
||||||
};
|
};
|
||||||
@@ -84,11 +83,11 @@ const onHover = (data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const chart_coutries = computed(() => {
|
const chart_coutries = computed(() => {
|
||||||
let countries = [["Country"]];
|
let countries = [["Country", "Count"]];
|
||||||
|
|
||||||
for (let i=0; i < settingsStore.ccountry_list.length ; i++) {
|
for (let i=0; i < settingsStore.ccountry_list.length ; i++) {
|
||||||
if (settingsStore.ccountry_list[i].offline == (settingsStore.online ? 'N' : 'Y') || settingsStore.online == true)
|
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;
|
return countries;
|
||||||
})
|
})
|
||||||
@@ -253,6 +252,13 @@ const fetch = async () => {
|
|||||||
settingsStore.settings = response2.data;
|
settingsStore.settings = response2.data;
|
||||||
console.log("SETTINGS=",settingsStore.settings);
|
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) {
|
} catch (e) {
|
||||||
const response = await Swal.fire({
|
const response = await Swal.fire({
|
||||||
title: __("are you want to try again") + "?",
|
title: __("are you want to try again") + "?",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const settingsStore = reactive({
|
|||||||
currency: "EUR",
|
currency: "EUR",
|
||||||
online: false,
|
online: false,
|
||||||
ccountry_filter: [["Country"]],
|
ccountry_filter: [["Country"]],
|
||||||
|
products_count: {},
|
||||||
ccountry_list: [],
|
ccountry_list: [],
|
||||||
currencyCoef: 1.0,
|
currencyCoef: 1.0,
|
||||||
settings: {},
|
settings: {},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Http\Controllers\ProductsCompareController;
|
|||||||
use App\Http\Controllers\FeedbackController;
|
use App\Http\Controllers\FeedbackController;
|
||||||
use App\Http\Controllers\SettingsController;
|
use App\Http\Controllers\SettingsController;
|
||||||
use App\Http\Controllers\OnlineCompareController;
|
use App\Http\Controllers\OnlineCompareController;
|
||||||
|
use App\Http\Controllers\ProductsCountController;
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Web Routes
|
| Web Routes
|
||||||
@@ -32,7 +33,8 @@ Route::get('/exchange/', function () {
|
|||||||
return Inertia::render('IkeaExchange');
|
return Inertia::render('IkeaExchange');
|
||||||
})->name('exchange');
|
})->name('exchange');
|
||||||
Route::post('users-send-email', [FeedbackController::class, 'sendEmail'])->name('ajax.send.email');
|
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('/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('/ip/get/{ip?}', [GeoIPController::class, 'index'])->name('geo.ip.get');
|
||||||
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
||||||
|
|||||||
Reference in New Issue
Block a user