Compare commits
19 Commits
45c2fe0485
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f9420643e | |||
| a2caa6f847 | |||
| 33219a4d88 | |||
| 9d98ad7a10 | |||
| 2f407d9530 | |||
| cf8844471b | |||
| fbcc3226fe | |||
| 597f9c111f | |||
| a5c3da9436 | |||
| 49c0c94ec9 | |||
| 68418d1205 | |||
| f41e77a3a7 | |||
| 73de3a69b9 | |||
| bb1e38d274 | |||
| 9bbd65eaaf | |||
| 0a9205ea8b | |||
| 22756f3f31 | |||
| 8139bcbad9 | |||
| 399099a802 |
@@ -1,21 +0,0 @@
|
|||||||
# .gitea/workflows/build.yaml
|
|
||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: linux-x64
|
|
||||||
steps:
|
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
|
||||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls -la /var/www/html
|
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
path: '/var/www/html'
|
|
||||||
@@ -8,7 +8,7 @@ concurrency: production_environment
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: linux-x64
|
runs-on: centos
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
18
Taskfile.yml
Normal file
18
Taskfile.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# https://taskfile.dev
|
||||||
|
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
vars:
|
||||||
|
GREETING: Hello, World!
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default:
|
||||||
|
cmds:
|
||||||
|
- echo "{{.GREETING}}"
|
||||||
|
silent: true
|
||||||
|
deploy:
|
||||||
|
cmds:
|
||||||
|
- vendor/bin/dep deploy
|
||||||
|
build:
|
||||||
|
cmds:
|
||||||
|
- vendor/bin/dep build
|
||||||
@@ -10,8 +10,8 @@ use Illuminate\Support\Facades\Log;
|
|||||||
|
|
||||||
class IkeaProductsController extends Controller
|
class IkeaProductsController extends Controller
|
||||||
{
|
{
|
||||||
public function search(Request $request, string $item)
|
public function search(Request $request, string $item, string $country = '')
|
||||||
{
|
{
|
||||||
return IkeaProducts::search($item);
|
return IkeaProducts::search($item, $country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class ProductsCompareController extends Controller
|
|||||||
{
|
{
|
||||||
$codes = $request->input("codes");
|
$codes = $request->input("codes");
|
||||||
$countries = $request->input("countries");
|
$countries = $request->input("countries");
|
||||||
|
$currency = $request->input("currency");
|
||||||
|
|
||||||
Log::info("{codes} {countries}", ["codes" => $codes, "countries" => $countries]);
|
Log::info("{codes} {countries}", ["codes" => $codes, "countries" => $countries]);
|
||||||
|
|
||||||
@@ -45,9 +46,14 @@ class ProductsCompareController extends Controller
|
|||||||
$products = $products->get();
|
$products = $products->get();
|
||||||
|
|
||||||
$currencyRates = CurrencyRates::rates2EUR("Y");
|
$currencyRates = CurrencyRates::rates2EUR("Y");
|
||||||
|
if ($currency == "EUR") {
|
||||||
|
$coef = 1;
|
||||||
|
} else {
|
||||||
|
$coef = floatval(CurrencyRates::where('currency',$currency)->first()->rate);
|
||||||
|
}
|
||||||
|
|
||||||
$products = $products->map(function ($product) use ($currencyRates) {
|
$products = $products->map(function ($product) use ($currencyRates, $coef) {
|
||||||
$product["salesPrice"] = round(floatval($product["salesPrice"]) / $currencyRates[$product["country"]], 2);
|
$product["salesPrice"] = round(floatval(($product["salesPrice"]) / $currencyRates[$product["country"]]) * $coef, 2);
|
||||||
return $product;
|
return $product;
|
||||||
});
|
});
|
||||||
Log::info("{products}", ["products" => $products]);
|
Log::info("{products}", ["products" => $products]);
|
||||||
|
|||||||
30
app/Http/Controllers/Superuser/UserMenuController.php
Normal file
30
app/Http/Controllers/Superuser/UserMenuController.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Superuser;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Menus\Menu as MenusMenu;
|
||||||
|
use App\Models\Menu;
|
||||||
|
use App\Models\Permission;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use RecursiveDirectoryIterator;
|
||||||
|
use RecursiveIteratorIterator;
|
||||||
|
use SplFileInfo;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class UserMenuController extends MenuController
|
||||||
|
{
|
||||||
|
public function get()
|
||||||
|
{
|
||||||
|
return Menu::with(['childs', 'permissions'])
|
||||||
|
->where('route_or_url','root')
|
||||||
|
->orderBy('position')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,4 +47,17 @@ class CurrencyRates extends Model
|
|||||||
return [$item["country_code"] => $rates[$item["currency_code"]]];
|
return [$item["country_code"] => $rates[$item["currency_code"]]];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function currencyCode() {
|
||||||
|
return CountryCode::active("Y")->mapWithKeys(function ($item) {
|
||||||
|
return [$item['currency_code'] => $item['country_code']];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function countryCurrency() {
|
||||||
|
return CountryCode::active("Y")->mapWithKeys(function ($item) {
|
||||||
|
return [$item["country_code"] => $item["currency_code"]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,18 @@ class IkeaProducts extends Model
|
|||||||
*/
|
*/
|
||||||
public $incrementing = false;
|
public $incrementing = false;
|
||||||
|
|
||||||
protected function search($item)
|
protected function search($item,$country = '')
|
||||||
{
|
{
|
||||||
if (strlen($item) > 3) {
|
if (strlen($item) >= 2 && strlen($item) < 5) {
|
||||||
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
|
$result = $this->where('name', 'LIKE', $item . '%');
|
||||||
} else {
|
if ($country != '') $result = $result->where('country',$country);
|
||||||
return [];
|
return $result->get();
|
||||||
|
} else if (strlen($item >= 5)) {
|
||||||
|
$result = $this->where(function ($query) use ($item) { $query->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%'); } );
|
||||||
|
if ($country != '') $result = $result->where('country',$country);
|
||||||
|
|
||||||
|
return $result->get();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
database/seeders/UserMenuSeeder.php
Normal file
44
database/seeders/UserMenuSeeder.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Menu;
|
||||||
|
use App\Models\Permission;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class UserMenuSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$ikea = Menu::create([
|
||||||
|
'name' => 'Ikea',
|
||||||
|
'icon' => "house-chimney",
|
||||||
|
'route_or_url' => 'root',
|
||||||
|
'position' => 1,
|
||||||
|
'deleteable' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$about = $ikea->childs()->create([
|
||||||
|
'name' => 'About',
|
||||||
|
'route_or_url' => 'about',
|
||||||
|
'icon' => 'circle-info',
|
||||||
|
'position' => 1,
|
||||||
|
'deleteable' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$exchange = $ikea->childs()->create([
|
||||||
|
'name' => 'Exchange',
|
||||||
|
'route_or_url' => 'exchange',
|
||||||
|
'icon' => 'circle-info',
|
||||||
|
'position' => 2,
|
||||||
|
'deleteable' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,9 @@ hosts:
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
- run: uptime
|
- cd: "/var/www/html/ikea/current"
|
||||||
|
- run: "yarn install"
|
||||||
|
- run: "yarn build"
|
||||||
|
|
||||||
after:
|
after:
|
||||||
deploy:failed: deploy:unlock
|
deploy:failed: deploy:unlock
|
||||||
|
|||||||
12
lang/id.json
12
lang/id.json
@@ -99,5 +99,15 @@
|
|||||||
"referenceerror: _code is not defined": "ReferenceError: _code is not defined",
|
"referenceerror: _code is not defined": "ReferenceError: _code is not defined",
|
||||||
"referenceerror: acntry is not defined": "ReferenceError: aCntry is not defined",
|
"referenceerror: acntry is not defined": "ReferenceError: aCntry is not defined",
|
||||||
"error: request failed with status code 500": "Error: Request failed with status code 500",
|
"error: request failed with status code 500": "Error: Request failed with status code 500",
|
||||||
"error: ziggy error: 'item' parameter is required for route 'products.search'.": "Error: Ziggy error: 'item' parameter is required for route 'products.search'."
|
"error: ziggy error: 'item' parameter is required for route 'products.search'.": "Error: Ziggy error: 'item' parameter is required for route 'products.search'.",
|
||||||
|
"firefox 122": "Firefox 122",
|
||||||
|
"ikea": "Ikea",
|
||||||
|
"about": "About",
|
||||||
|
"exachange": "Exachange",
|
||||||
|
"exchange": "Exchange",
|
||||||
|
"referenceerror: rates is not defined": "ReferenceError: rates is not defined",
|
||||||
|
"referenceerror: currency is not defined": "ReferenceError: currency is not defined",
|
||||||
|
"typeerror: can't access property \"unshift\", currency.velue is undefined": "TypeError: can't access property \"unshift\", currency.velue is undefined",
|
||||||
|
"item must be selected": "Item must be selected",
|
||||||
|
"typeerror: can't access property \"code\", form.country.value is undefined": "TypeError: can't access property \"code\", form.country.value is undefined"
|
||||||
}
|
}
|
||||||
60
resources/js/Layouts/GuestLayout.vue
Normal file
60
resources/js/Layouts/GuestLayout.vue
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<script setup>
|
||||||
|
import Swal from 'sweetalert2';
|
||||||
|
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||||
|
import { FwbDropdown, FwbListGroup, FwbListGroupItem } from 'flowbite-vue';
|
||||||
|
import LogoIkea from '@/assets/Ikea_logo.svg';
|
||||||
|
import {
|
||||||
|
FwbSelect,
|
||||||
|
FwbNavbar,
|
||||||
|
FwbNavbarCollapse,
|
||||||
|
FwbNavbarLink,
|
||||||
|
FwbNavbarLogo,
|
||||||
|
} from 'flowbite-vue';
|
||||||
|
|
||||||
|
const menu = ref([])
|
||||||
|
const fetch_menu = async () => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get(route('menu.user'))
|
||||||
|
menu.value = response.data;
|
||||||
|
} catch (e) {
|
||||||
|
const response = await Swal.fire({
|
||||||
|
title: __('are you want to try again') + '?',
|
||||||
|
text: __(`${e}`),
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
showCloseButton: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
response.isConfirmed && fetch()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(fetch_menu);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<fwb-navbar>
|
||||||
|
<template #logo>
|
||||||
|
<fwb-navbar-logo alt="IKEA Price Craweler" :image-url="LogoIkea" :link="route('root')">
|
||||||
|
IKEA Price Crawler
|
||||||
|
</fwb-navbar-logo>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #default="{ isShowMenu }">
|
||||||
|
<fwb-navbar-collapse :is-show-menu="isShowMenu" v-if="menu.length > 0">
|
||||||
|
<fwb-navbar-link :link="route(menu[0].route_or_url)">
|
||||||
|
Home
|
||||||
|
</fwb-navbar-link>
|
||||||
|
<template v-for="item in menu[0].childs" v-if="menu.length > 0">
|
||||||
|
<fwb-navbar-link :link="route(item.route_or_url)">
|
||||||
|
{{ item.name }}
|
||||||
|
</fwb-navbar-link>
|
||||||
|
</template>
|
||||||
|
</fwb-navbar-collapse>
|
||||||
|
</template>
|
||||||
|
</fwb-navbar>
|
||||||
|
<div class="m-3">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
34
resources/js/Pages/IkeaAbout.vue
Normal file
34
resources/js/Pages/IkeaAbout.vue
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||||
|
import GuestLayout from '../Layouts/GuestLayout.vue';
|
||||||
|
import { useForm } from '@inertiajs/inertia-vue3'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<GuestLayout>
|
||||||
|
<div class="flex items-center justify-center h-screen">
|
||||||
|
|
||||||
|
<div class="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
|
||||||
|
<h1>What is Ikea price comparison?</h1>
|
||||||
|
<p>
|
||||||
|
It is a community project of a group of enthusiasts from Slovakia.
|
||||||
|
This service provides price comparison of Ikea products in European countries.
|
||||||
|
Product prices are converted to EUR at the current rate and appear in resulting table.
|
||||||
|
Information about the prices of Ikea products is obtained online.
|
||||||
|
You can go to the appropriate product page by clicking on the country name.
|
||||||
|
Thanks to this service, you can find out in which country a given Ikea product is the cheapest (you can sort
|
||||||
|
them in the resulting table).
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
Enjoy :)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</GuestLayout>
|
||||||
|
</template>
|
||||||
|
<style>
|
||||||
|
@import 'vue3-easy-data-table/dist/style.css';
|
||||||
|
</style>
|
||||||
|
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||||
16
resources/js/Pages/IkeaExchange.vue
Normal file
16
resources/js/Pages/IkeaExchange.vue
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||||
|
import GuestLayout from '../Layouts/GuestLayout.vue';
|
||||||
|
import { useForm } from '@inertiajs/inertia-vue3'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<GuestLayout>
|
||||||
|
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
||||||
|
<h1>Exchange</h1>
|
||||||
|
</div>
|
||||||
|
</GuestLayout>
|
||||||
|
</template>
|
||||||
@@ -1,19 +1,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
import LogoIkea from '@/assets/Ikea_logo.svg';
|
|
||||||
import Multiselect from 'vue-multiselect';
|
import Multiselect from 'vue-multiselect';
|
||||||
import { GChart } from 'vue-google-charts';
|
import { GChart } from 'vue-google-charts';
|
||||||
import { FwbDropdown, FwbListGroup, FwbListGroupItem } from 'flowbite-vue';
|
|
||||||
import EasyTable from "vue3-easy-data-table";
|
import EasyTable from "vue3-easy-data-table";
|
||||||
import SearchInput from '@/Components/SearchInput.vue';
|
import GuestLayout from '../Layouts/GuestLayout.vue';
|
||||||
//import autocomplete from '@trevoreyre/autocomplete-vue';
|
|
||||||
import {
|
|
||||||
FwbNavbar,
|
|
||||||
FwbNavbarCollapse,
|
|
||||||
FwbNavbarLink,
|
|
||||||
FwbNavbarLogo,
|
|
||||||
} from 'flowbite-vue';
|
|
||||||
import { useForm } from '@inertiajs/inertia-vue3'
|
import { useForm } from '@inertiajs/inertia-vue3'
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import IkeaLogo from './Ikea/IkeaLogo.vue';
|
import IkeaLogo from './Ikea/IkeaLogo.vue';
|
||||||
@@ -27,6 +21,10 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
|
menu: {
|
||||||
|
type: Object,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(props.countryHash);
|
console.log(props.countryHash);
|
||||||
@@ -41,13 +39,18 @@ let tproducts = computed(() => {
|
|||||||
const type = 'GeoChart';
|
const type = 'GeoChart';
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
countries: '',
|
countries: '',
|
||||||
|
country: '',
|
||||||
codes: '',
|
codes: '',
|
||||||
|
currency: 'EUR',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ccodes = ref([]);
|
||||||
const ccountry = ref([]);
|
const ccountry = ref([]);
|
||||||
const ccountry_filter = ref([['Country'],]);
|
const ccountry_filter = ref([['Country'],]);
|
||||||
const ccountry_list = ref(['TEST']);
|
const ccountry_list = ref(['TEST']);
|
||||||
const selected = ref(null);
|
const selected = ref(null);
|
||||||
const article = ref('');
|
const article = ref('');
|
||||||
|
const currency = ref([]);
|
||||||
const hrates = ref([
|
const hrates = ref([
|
||||||
{ text: "Currency", value: "currency", sortable: true },
|
{ text: "Currency", value: "currency", sortable: true },
|
||||||
{ text: "Country", value: "country_name", sortable: true },
|
{ text: "Country", value: "country_name", sortable: true },
|
||||||
@@ -84,7 +87,9 @@ const gchartEvents = ref({
|
|||||||
}
|
}
|
||||||
},);
|
},);
|
||||||
|
|
||||||
|
const sleep = (ms) => {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
}
|
||||||
|
|
||||||
const fetch = async () => {
|
const fetch = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -114,6 +119,8 @@ const fetch_rates = async () => {
|
|||||||
try {
|
try {
|
||||||
const response = await axios.get(route('rates.index'))
|
const response = await axios.get(route('rates.index'))
|
||||||
rates.value = response.data;
|
rates.value = response.data;
|
||||||
|
currency.value = rates.value.map((currency) => currency.currency);
|
||||||
|
currency.value.unshift('EUR');
|
||||||
console.log("RATE=", rates.value);
|
console.log("RATE=", rates.value);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const response = await Swal.fire({
|
const response = await Swal.fire({
|
||||||
@@ -128,11 +135,33 @@ const fetch_rates = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
console.log("ccodes=", ccodes.value);
|
||||||
|
} catch (e) {
|
||||||
|
const response = await Swal.fire({
|
||||||
|
title: __('are you want to try again') + '?',
|
||||||
|
text: __(`${e}`),
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
showCloseButton: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
response.isConfirmed && fetch()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const async_search = async (item) => {
|
const async_search = async (item) => {
|
||||||
try {
|
try {
|
||||||
if (item.length > 4) {
|
if (item.length >= 2) {
|
||||||
const response = await axios.get(route('products.search', item));
|
|
||||||
options_items.value = response.data.map((i) => { return { "item": i.name, "desc": i.typeName, "img": i.mainImageUrl, "code": i.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, "url": i.url } });
|
||||||
console.log("VALUES=", options_items.value);
|
console.log("VALUES=", options_items.value);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -148,9 +177,10 @@ const async_search = async (item) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function customLabel({ item, desc }) {
|
|
||||||
|
function customLabel({ item, desc, code }) {
|
||||||
//console.log(item);
|
//console.log(item);
|
||||||
return `${item} - ${desc}`;
|
return `${item} - ${desc} - ${code}`;
|
||||||
}
|
}
|
||||||
const headers = ref([
|
const headers = ref([
|
||||||
{ text: "Id", value: "id", sortable: true },
|
{ text: "Id", value: "id", sortable: true },
|
||||||
@@ -170,37 +200,24 @@ function selectCountry(item, id) {
|
|||||||
|
|
||||||
onMounted(fetch);
|
onMounted(fetch);
|
||||||
onMounted(fetch_rates);
|
onMounted(fetch_rates);
|
||||||
|
onMounted(fetch_ccodes);
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
|
console.log('ITEM=', form);
|
||||||
|
if (form.codes.length == 0) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Empty code",
|
||||||
|
text: "You must enter product!",
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
form.post(route('products.compare'));
|
form.post(route('products.compare'));
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fwb-navbar>
|
<GuestLayout>
|
||||||
<template #logo>
|
|
||||||
<fwb-navbar-logo alt="IKEA Price Craweler" :image-url="LogoIkea" link="#">
|
|
||||||
IKEA Price Crawler
|
|
||||||
</fwb-navbar-logo>
|
|
||||||
</template>
|
|
||||||
<template #default="{ isShowMenu }">
|
|
||||||
<fwb-navbar-collapse :is-show-menu="isShowMenu">
|
|
||||||
<fwb-navbar-link is-active link="#">
|
|
||||||
Home
|
|
||||||
</fwb-navbar-link>
|
|
||||||
<fwb-navbar-link link="#">
|
|
||||||
Services
|
|
||||||
</fwb-navbar-link>
|
|
||||||
<fwb-navbar-link link="#">
|
|
||||||
Pricing
|
|
||||||
</fwb-navbar-link>
|
|
||||||
<fwb-navbar-link link="#">
|
|
||||||
Contact
|
|
||||||
</fwb-navbar-link>
|
|
||||||
</fwb-navbar-collapse>
|
|
||||||
</template>
|
|
||||||
</fwb-navbar>
|
|
||||||
<div class="m-3">
|
|
||||||
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
||||||
<div class="justify-center rounded-md border-black border-8 max-h-[518px]">
|
<div class="justify-center rounded-md border-black border-8 max-h-[518px]">
|
||||||
<GChart :events="gchartEvents" :type="type" :data="ccountry_filter" :options="options"
|
<GChart :events="gchartEvents" :type="type" :data="ccountry_filter" :options="options"
|
||||||
@@ -216,12 +233,28 @@ const submit = () => {
|
|||||||
@select="selectCountry" @remove="selectCountry">
|
@select="selectCountry" @remove="selectCountry">
|
||||||
</multiselect>
|
</multiselect>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-col start-0">
|
||||||
|
<span class="font-extrabold font-mono">Krajina produktu na vyhladanie</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<multiselect :close-on-select="false" :multiple="false" v-model="form.country" :options="ccodes"
|
||||||
|
label="country" track-by="code">
|
||||||
|
</multiselect>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="font-extrabold font-mono">Zadaj polozku</span>
|
<span class="font-extrabold font-mono">Zadaj polozku</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<multiselect v-model="form.codes" label="item" track-by="item" :custom-label="customLabel"
|
<multiselect v-model="form.codes" label="item" track-by="item" :custom-label="customLabel"
|
||||||
placeholder="Find item" :searchable="true" :options="options_items" @search-change="async_search" />
|
:internal-search="false" placeholder="Find item" :searchable="true" :options="options_items"
|
||||||
|
@search-change="async_search" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="font-extrabold font-mono">Prepocet do meny</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<multiselect v-model="form.currency" :multiple="false" :allow-empty="false" placeholder="Currency"
|
||||||
|
:searchable="true" :options="currency" />
|
||||||
</div>
|
</div>
|
||||||
<div class="text-end mt-2">
|
<div class="text-end mt-2">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
@@ -243,11 +276,16 @@ const submit = () => {
|
|||||||
<span class="font-extrabold font-mono">Vysledky vyhladavania</span>
|
<span class="font-extrabold font-mono">Vysledky vyhladavania</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<EasyTable :rows-per-page=15 :headers="hproducts" :items="tproducts" alternating></EasyTable>
|
<EasyTable :rows-per-page=15 :headers="hproducts" :items="tproducts" alternating>
|
||||||
</div>
|
<template #item-name="{ name, url }">
|
||||||
|
<a class="underline" target="_blank" :href="url">{{ name }}</a>
|
||||||
|
</template>
|
||||||
|
</EasyTable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</GuestLayout>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
@import 'vue3-easy-data-table/dist/style.css';
|
@import 'vue3-easy-data-table/dist/style.css';
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
@inertiaHead
|
@inertiaHead
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="font-sans antialiased gradient">
|
<body class="font-sans antialiased bg-gray-100">
|
||||||
@inertia
|
@inertia
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,21 @@ use App\Http\Controllers\ProductsCompareController;
|
|||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return Inertia::render('IkeaRoot');
|
return Inertia::render('IkeaRoot');
|
||||||
})->name('root');
|
})->name('root');
|
||||||
|
Route::get('/about/', function () {
|
||||||
|
return Inertia::render('IkeaAbout');
|
||||||
|
})->name('about');
|
||||||
|
Route::get('/exchange/', function () {
|
||||||
|
return Inertia::render('IkeaExchange');
|
||||||
|
})->name('exchange');
|
||||||
|
|
||||||
|
Route::get('/menu/get', [App\Http\Controllers\Superuser\UserMenuController::class, 'get'])->name('menu.user');
|
||||||
|
|
||||||
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
||||||
Route::get('/ccountry/codes/', [CountryCodeController::class, 'codes'])->name('ccountry.codes');
|
Route::get('/ccountry/codes/', [CountryCodeController::class, 'codes'])->name('ccountry.codes');
|
||||||
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
|
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
|
||||||
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
|
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
|
||||||
Route::get('/rates/', [CurrencyRatesController::class, 'index'])->name('rates.index');
|
Route::get('/rates/', [CurrencyRatesController::class, 'index'])->name('rates.index');
|
||||||
Route::get('/products/{item}', [IkeaProductsController::class, 'search'])->name('products.search');
|
Route::get('/products/{item}/{country?}', [IkeaProductsController::class, 'search'])->name('products.search');
|
||||||
Route::post('/products/compare/', [ProductsCompareController::class, 'compare'])->name('products.compare');
|
Route::post('/products/compare/', [ProductsCompareController::class, 'compare'])->name('products.compare');
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () {
|
Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () {
|
||||||
@@ -75,7 +83,7 @@ Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified']
|
|||||||
Route::get('/role/get', [App\Http\Controllers\Superuser\RoleController::class, 'get'])->name('role');
|
Route::get('/role/get', [App\Http\Controllers\Superuser\RoleController::class, 'get'])->name('role');
|
||||||
Route::post('/role/paginate', [App\Http\Controllers\Superuser\RoleController::class, 'paginate'])->name('role.paginate');
|
Route::post('/role/paginate', [App\Http\Controllers\Superuser\RoleController::class, 'paginate'])->name('role.paginate');
|
||||||
Route::post('/user/paginate', [App\Http\Controllers\Superuser\UserController::class, 'paginate'])->name('user.paginate');
|
Route::post('/user/paginate', [App\Http\Controllers\Superuser\UserController::class, 'paginate'])->name('user.paginate');
|
||||||
Route::post('/activity/login', [App\Http\Controllers\ActivityController::class, 'logins'])->name('activity.login');
|
Route::post('/activity/login', [App\Http\Controllers\ActivityController::class, 'logins'])->name('activity.login.post');
|
||||||
Route::get('/menu/get', [App\Http\Controllers\Superuser\MenuController::class, 'get'])->name('menu');
|
Route::get('/menu/get', [App\Http\Controllers\Superuser\MenuController::class, 'get'])->name('menu');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user