Compare commits
21 Commits
c7360e254a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f9420643e | |||
| a2caa6f847 | |||
| 33219a4d88 | |||
| 9d98ad7a10 | |||
| 2f407d9530 | |||
| cf8844471b | |||
| fbcc3226fe | |||
| 597f9c111f | |||
| a5c3da9436 | |||
| 49c0c94ec9 | |||
| 68418d1205 | |||
| f41e77a3a7 | |||
| 73de3a69b9 | |||
| bb1e38d274 | |||
| 9bbd65eaaf | |||
| 0a9205ea8b | |||
| 22756f3f31 | |||
| 8139bcbad9 | |||
| 399099a802 | |||
| 45c2fe0485 | |||
| f58b69cc15 |
@@ -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'
|
||||
27
.gitea/workflows/deploy.yml
Normal file
27
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
concurrency: production_environment
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: centos
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.1"
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install
|
||||
|
||||
- name: Deploy
|
||||
uses: deployphp/action@v1
|
||||
with:
|
||||
dep: deploy
|
||||
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
|
||||
{
|
||||
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");
|
||||
$countries = $request->input("countries");
|
||||
$currency = $request->input("currency");
|
||||
|
||||
Log::info("{codes} {countries}", ["codes" => $codes, "countries" => $countries]);
|
||||
|
||||
@@ -45,9 +46,14 @@ class ProductsCompareController extends Controller
|
||||
$products = $products->get();
|
||||
|
||||
$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) {
|
||||
$product["salesPrice"] = round(floatval($product["salesPrice"]) / $currencyRates[$product["country"]], 2);
|
||||
$products = $products->map(function ($product) use ($currencyRates, $coef) {
|
||||
$product["salesPrice"] = round(floatval(($product["salesPrice"]) / $currencyRates[$product["country"]]) * $coef, 2);
|
||||
return $product;
|
||||
});
|
||||
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"]]];
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
protected function search($item)
|
||||
protected function search($item,$country = '')
|
||||
{
|
||||
if (strlen($item) > 3) {
|
||||
return $this->where('typeName', 'LIKE', '%' . $item . '%')->orWhere('name', 'LIKE', '%' . $item . '%')->get();
|
||||
} else {
|
||||
return [];
|
||||
if (strlen($item) >= 2 && strlen($item) < 5) {
|
||||
$result = $this->where('name', 'LIKE', $item . '%');
|
||||
if ($country != '') $result = $result->where('country',$country);
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.7",
|
||||
"deployer/deployer": "^7.3",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
|
||||
45
composer.lock
generated
45
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ad6ab448ac9b62b01922490669b4c2b2",
|
||||
"content-hash": "86cdd8c61f5c7ee9dee51ebeae179259",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@@ -8787,6 +8787,49 @@
|
||||
],
|
||||
"time": "2023-08-25T18:43:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "deployer/deployer",
|
||||
"version": "v7.3.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/deployphp/deployer.git",
|
||||
"reference": "3535bdb2f6360662bd95f6e26fce31dbc269af64"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/deployphp/deployer/zipball/3535bdb2f6360662bd95f6e26fce31dbc269af64",
|
||||
"reference": "3535bdb2f6360662bd95f6e26fce31dbc269af64",
|
||||
"shasum": ""
|
||||
},
|
||||
"bin": [
|
||||
"dep"
|
||||
],
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anton Medvedev",
|
||||
"email": "anton@medv.io"
|
||||
}
|
||||
],
|
||||
"description": "Deployment Tool",
|
||||
"homepage": "https://deployer.org",
|
||||
"support": {
|
||||
"docs": "https://deployer.org/docs",
|
||||
"issues": "https://github.com/deployphp/deployer/issues",
|
||||
"source": "https://github.com/deployphp/deployer"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/antonmedv",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-07T10:27:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
"version": "2.0.0",
|
||||
|
||||
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,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
19
deploy.yaml
Normal file
19
deploy.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
import:
|
||||
- recipe/laravel.php
|
||||
|
||||
config:
|
||||
repository: 'https://git.bh.ttx.sk/jaro/ikea/'
|
||||
|
||||
hosts:
|
||||
web01.ttx.sk:
|
||||
remote_user: git
|
||||
deploy_path: '/var/www/html/ikea'
|
||||
|
||||
tasks:
|
||||
build:
|
||||
- cd: "/var/www/html/ikea/current"
|
||||
- run: "yarn install"
|
||||
- run: "yarn build"
|
||||
|
||||
after:
|
||||
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: acntry is not defined": "ReferenceError: aCntry is not defined",
|
||||
"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,24 +1,18 @@
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||
import Swal from 'sweetalert2';
|
||||
import LogoIkea from '@/assets/Ikea_logo.svg';
|
||||
|
||||
import Multiselect from 'vue-multiselect';
|
||||
import { GChart } from 'vue-google-charts';
|
||||
import { FwbDropdown, FwbListGroup, FwbListGroupItem } from 'flowbite-vue';
|
||||
|
||||
import EasyTable from "vue3-easy-data-table";
|
||||
import SearchInput from '@/Components/SearchInput.vue';
|
||||
//import autocomplete from '@trevoreyre/autocomplete-vue';
|
||||
import {
|
||||
FwbNavbar,
|
||||
FwbNavbarCollapse,
|
||||
FwbNavbarLink,
|
||||
FwbNavbarLogo,
|
||||
} from 'flowbite-vue';
|
||||
import GuestLayout from '../Layouts/GuestLayout.vue';
|
||||
|
||||
import { useForm } from '@inertiajs/inertia-vue3'
|
||||
import axios from 'axios';
|
||||
import IkeaLogo from './Ikea/IkeaLogo.vue';
|
||||
|
||||
const props = defineProps({
|
||||
const props = defineProps({
|
||||
products: {
|
||||
type: Object,
|
||||
default: []
|
||||
@@ -27,27 +21,36 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: []
|
||||
},
|
||||
})
|
||||
menu: {
|
||||
type: Object,
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
console.log(props.countryHash);
|
||||
console.log(props.countryHash);
|
||||
let tproducts = computed(() => {
|
||||
return props.products.map((prod) => {
|
||||
return props.products.map((prod) => {
|
||||
prod.salesPrice = parseFloat(prod.salesPrice);
|
||||
prod.country = props.countryHash[prod.country];
|
||||
return prod;
|
||||
} )
|
||||
})
|
||||
})
|
||||
|
||||
const type = 'GeoChart';
|
||||
const form = useForm({
|
||||
countries: '',
|
||||
country: '',
|
||||
codes: '',
|
||||
currency: 'EUR',
|
||||
});
|
||||
|
||||
const ccodes = ref([]);
|
||||
const ccountry = ref([]);
|
||||
const ccountry_filter = ref([['Country'],]);
|
||||
const ccountry_list = ref(['TEST']);
|
||||
const selected = ref(null);
|
||||
const article = ref('');
|
||||
const currency = ref([]);
|
||||
const hrates = ref([
|
||||
{ text: "Currency", value: "currency", sortable: true },
|
||||
{ text: "Country", value: "country_name", sortable: true },
|
||||
@@ -55,9 +58,9 @@ const hrates = ref([
|
||||
]);
|
||||
// { "country": "AT", "code": "50161321", "url": "https://www.ikea.com/at/de/p/hol-aufbewahrungstisch-akazie-50161321/", "name": "HOL", "typeName": "Aufbewahrungstisch", "mainImageUrl": "https://www.ikea.com/at/de/images/products/hol-aufbewahrungstisch-akazie__0104310_pe251255_s5.jpg", "itemNoGlobal": "50161321", "salesPrice": "80.99", "tag": "FAMILY_PRICE", "last_mod": "2023-12-03 16:44:24" },
|
||||
const hproducts = ref([
|
||||
{ text: "Country", value:"country", sortable: true},
|
||||
{ text: "Name", value:"name", sortable: true},
|
||||
{ text: "Price", value:"salesPrice", sortable: true}
|
||||
{ text: "Country", value: "country", sortable: true },
|
||||
{ text: "Name", value: "name", sortable: true },
|
||||
{ text: "Price", value: "salesPrice", sortable: true }
|
||||
]);
|
||||
|
||||
const rates = ref([]);
|
||||
@@ -84,7 +87,9 @@ const gchartEvents = ref({
|
||||
}
|
||||
},);
|
||||
|
||||
|
||||
const sleep = (ms) => {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
const fetch = async () => {
|
||||
try {
|
||||
@@ -114,6 +119,8 @@ const fetch_rates = async () => {
|
||||
try {
|
||||
const response = await axios.get(route('rates.index'))
|
||||
rates.value = response.data;
|
||||
currency.value = rates.value.map((currency) => currency.currency);
|
||||
currency.value.unshift('EUR');
|
||||
console.log("RATE=", rates.value);
|
||||
} catch (e) {
|
||||
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) => {
|
||||
try {
|
||||
if (item.length > 4) {
|
||||
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 } });
|
||||
if (item.length >= 2) {
|
||||
|
||||
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);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -148,9 +177,10 @@ const async_search = async (item) => {
|
||||
}
|
||||
}
|
||||
|
||||
function customLabel({ item, desc }) {
|
||||
|
||||
function customLabel({ item, desc, code }) {
|
||||
//console.log(item);
|
||||
return `${item} - ${desc}`;
|
||||
return `${item} - ${desc} - ${code}`;
|
||||
}
|
||||
const headers = ref([
|
||||
{ text: "Id", value: "id", sortable: true },
|
||||
@@ -170,37 +200,24 @@ function selectCountry(item, id) {
|
||||
|
||||
onMounted(fetch);
|
||||
onMounted(fetch_rates);
|
||||
onMounted(fetch_ccodes);
|
||||
|
||||
const submit = () => {
|
||||
form.post(route('products.compare'));
|
||||
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'));
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<fwb-navbar>
|
||||
<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">
|
||||
<GuestLayout>
|
||||
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
||||
<div class="justify-center rounded-md border-black border-8 max-h-[518px]">
|
||||
<GChart :events="gchartEvents" :type="type" :data="ccountry_filter" :options="options"
|
||||
@@ -216,12 +233,28 @@ const submit = () => {
|
||||
@select="selectCountry" @remove="selectCountry">
|
||||
</multiselect>
|
||||
</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>
|
||||
<span class="font-extrabold font-mono">Zadaj polozku</span>
|
||||
</div>
|
||||
<div>
|
||||
<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 class="text-end mt-2">
|
||||
<button type="submit"
|
||||
@@ -243,11 +276,16 @@ const submit = () => {
|
||||
<span class="font-extrabold font-mono">Vysledky vyhladavania</span>
|
||||
</div>
|
||||
<div>
|
||||
<EasyTable :rows-per-page=15 :headers="hproducts" :items="tproducts" alternating></EasyTable>
|
||||
<EasyTable :rows-per-page=15 :headers="hproducts" :items="tproducts" alternating>
|
||||
<template #item-name="{ name, url }">
|
||||
<a class="underline" target="_blank" :href="url">{{ name }}</a>
|
||||
</template>
|
||||
</EasyTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</GuestLayout>
|
||||
</template>
|
||||
<style>
|
||||
@import 'vue3-easy-data-table/dist/style.css';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@inertiaHead
|
||||
</head>
|
||||
|
||||
<body class="font-sans antialiased gradient">
|
||||
<body class="font-sans antialiased bg-gray-100">
|
||||
@inertia
|
||||
</body>
|
||||
|
||||
|
||||
@@ -23,13 +23,21 @@ use App\Http\Controllers\ProductsCompareController;
|
||||
Route::get('/', function () {
|
||||
return Inertia::render('IkeaRoot');
|
||||
})->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/codes/', [CountryCodeController::class, 'codes'])->name('ccountry.codes');
|
||||
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
|
||||
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
|
||||
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::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::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('/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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user