Exchange rates move
This commit is contained in:
@@ -9,6 +9,7 @@ class IkeaProducts extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
protected $table = 't_ikea_products';
|
protected $table = 't_ikea_products';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import:
|
import:
|
||||||
- recipe/laravel.php
|
- recipe/laravel.php
|
||||||
|
- contrib/php-fpm.php
|
||||||
|
|
||||||
config:
|
config:
|
||||||
repository: 'https://git.bh.ttx.sk/jaro/ikea/'
|
repository: 'https://git.bh.ttx.sk/jaro/ikea/'
|
||||||
@@ -14,6 +15,12 @@ hosts:
|
|||||||
branch: newlook
|
branch: newlook
|
||||||
deploy_path: '/var/www/html/ikea'
|
deploy_path: '/var/www/html/ikea'
|
||||||
bin/php: /usr/bin/php81
|
bin/php: /usr/bin/php81
|
||||||
|
php_fpm_version: 8.1
|
||||||
|
php_fpm_service: php81-php-fpm
|
||||||
|
after:
|
||||||
|
deploy: php-fpm:reload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
@@ -24,3 +31,4 @@ tasks:
|
|||||||
|
|
||||||
after:
|
after:
|
||||||
deploy:failed: deploy:unlock
|
deploy:failed: deploy:unlock
|
||||||
|
|
||||||
@@ -120,5 +120,8 @@
|
|||||||
"typeerror: can't access property \"map\", ccountry.value is undefined": "TypeError: can't access property \"map\", ccountry.value is undefined",
|
"typeerror: can't access property \"map\", ccountry.value is undefined": "TypeError: can't access property \"map\", ccountry.value is undefined",
|
||||||
"referenceerror: priceunit is not defined": "ReferenceError: priceUnit is not defined",
|
"referenceerror: priceunit is not defined": "ReferenceError: priceUnit is not defined",
|
||||||
"referenceerror: mainimagealt is not defined": "ReferenceError: mainImageAlt is not defined",
|
"referenceerror: mainimagealt is not defined": "ReferenceError: mainImageAlt is not defined",
|
||||||
"referenceerror: countrycurrency is not defined": "ReferenceError: countryCurrency is not defined"
|
"referenceerror: countrycurrency is not defined": "ReferenceError: countryCurrency is not defined",
|
||||||
|
"referenceerror: currencycountryrate is not defined": "ReferenceError: currencyCountryRate is not defined",
|
||||||
|
"referenceerror: ccountry is not defined": "ReferenceError: ccountry is not defined",
|
||||||
|
"typeerror: invalid assignment to const 'response'": "TypeError: invalid assignment to const 'response'"
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,76 @@
|
|||||||
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
import { getCurrentInstance, ref, onMounted, onUnmounted, nextTick, computed } from 'vue';
|
||||||
import GuestLayout from '../Layouts/GuestLayout.vue';
|
import GuestLayout from '../Layouts/GuestLayout.vue';
|
||||||
import { useForm } from '@inertiajs/inertia-vue3'
|
import { useForm } from '@inertiajs/inertia-vue3'
|
||||||
|
|
||||||
|
import EasyTable from "vue3-easy-data-table";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const headers = ref([
|
||||||
|
{ text: "Id", value: "id", sortable: true },
|
||||||
|
{ text: "Country", value: "country", sortable: true },
|
||||||
|
{ text: "Currency", value: "currency", sortable: true },
|
||||||
|
{ text: "Rate", value: "rate", sortable: true },
|
||||||
|
]);
|
||||||
|
const currencyCountryRate = ref([]);
|
||||||
|
const rates = ref([]);
|
||||||
|
const currencyHash = ref({});
|
||||||
|
const currency = ref([]);
|
||||||
|
const countryCurrency = ref([]);
|
||||||
|
const ccountry = ref([]);
|
||||||
|
|
||||||
|
const fetch_rates = async () => {
|
||||||
|
try {
|
||||||
|
var response = await axios.get(route('rates.index'));
|
||||||
|
rates.value = response.data;
|
||||||
|
response = await axios.get(route('ccountry.active'))
|
||||||
|
ccountry.value = response.data
|
||||||
|
|
||||||
|
currency.value = rates.value.map((currency) => currency.currency);
|
||||||
|
countryCurrency.value = Object.fromEntries(
|
||||||
|
rates.value.map((currency) => [currency.country_name, currency.currency])
|
||||||
|
);
|
||||||
|
currencyHash.value = Object.fromEntries(
|
||||||
|
rates.value.map((currency) => [currency.currency, currency.rate]),
|
||||||
|
);
|
||||||
|
var i = 1;
|
||||||
|
currencyCountryRate.value = ccountry.value.map((country) => {
|
||||||
|
console.log(country);
|
||||||
|
return { "country": country.country_name, "currency": country.currency_code, "rate": currencyHash.value[country.currency_code], "id": i++ }
|
||||||
|
});
|
||||||
|
currency.value.unshift('EUR');
|
||||||
|
console.log("RATE=", rates.value);
|
||||||
|
console.log('HASH=', currencyHash.value);
|
||||||
|
console.log('CCC=',currencyCountryRate);
|
||||||
|
} 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_rates);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<GuestLayout>
|
<GuestLayout>
|
||||||
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
<div class="flex flex-wrap gap-2 justify-center align-middle ">
|
||||||
<h1>Exchange</h1>
|
<div class="text-center grid-flow-col max-w-fit justify-items-center">
|
||||||
|
<div class="font-extrabold">Exchange rates and coutry list</div>
|
||||||
|
<div class="mt-5">
|
||||||
|
<EasyTable :rows-per-page=10 :headers="headers" :items="currencyCountryRate" alternating></EasyTable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GuestLayout>
|
</GuestLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@import 'vue3-easy-data-table/dist/style.css';
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -174,6 +174,9 @@ const ccountry_list = ref(['TEST']);
|
|||||||
const currencyHash = ref({});
|
const currencyHash = ref({});
|
||||||
const currency = ref([]);
|
const currency = ref([]);
|
||||||
const currencyCoef = ref(1.0);
|
const currencyCoef = ref(1.0);
|
||||||
|
|
||||||
|
const items = 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 },
|
||||||
@@ -237,6 +240,7 @@ const fetch_rates = async () => {
|
|||||||
currencyHash.value = Object.fromEntries(
|
currencyHash.value = Object.fromEntries(
|
||||||
rates.value.map((currency) => [currency.currency, currency.rate]),
|
rates.value.map((currency) => [currency.currency, currency.rate]),
|
||||||
);
|
);
|
||||||
|
|
||||||
currency.value.unshift('EUR');
|
currency.value.unshift('EUR');
|
||||||
console.log("RATE=", rates.value);
|
console.log("RATE=", rates.value);
|
||||||
console.log('HASH=', currencyHash.value);
|
console.log('HASH=', currencyHash.value);
|
||||||
@@ -303,12 +307,6 @@ function customLabel({ item, desc, code }) {
|
|||||||
//console.log(item);
|
//console.log(item);
|
||||||
return `${item} - ${desc} - ${code}`;
|
return `${item} - ${desc} - ${code}`;
|
||||||
}
|
}
|
||||||
const headers = ref([
|
|
||||||
{ text: "Id", value: "id", sortable: true },
|
|
||||||
{ text: "Country", value: "country", sortable: true },
|
|
||||||
{ text: "Currency", value: "currency" },
|
|
||||||
]);
|
|
||||||
const items = ref([]);
|
|
||||||
|
|
||||||
function selectCountry(item, id) {
|
function selectCountry(item, id) {
|
||||||
let cCntry = [['Country'],];
|
let cCntry = [['Country'],];
|
||||||
@@ -463,18 +461,8 @@ const submit = () => {
|
|||||||
</template>
|
</template>
|
||||||
</EasyTable>
|
</EasyTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-5">
|
|
||||||
<EasyTable :rows-per-page=10 :headers="headers" :items="items" alternating></EasyTable>
|
|
||||||
</div>
|
|
||||||
<div class="mt-5">
|
|
||||||
<EasyTable :rows-per-page=15 :headers="hrates" :items="rates" alternating></EasyTable>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user