mpa/langs/currency
This commit is contained in:
parent
c9348dc092
commit
a7c4ff51ca
71
components/CurrSelector.vue
Normal file
71
components/CurrSelector.vue
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<UCollapsible
|
||||||
|
v-model="isOpen"
|
||||||
|
class="flex flex-col gap-2"
|
||||||
|
:ui="{
|
||||||
|
content: 'absolute top-20',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<UButton
|
||||||
|
color="neutral"
|
||||||
|
variant="subtle"
|
||||||
|
trailing-icon="i-lucide-chevron-down"
|
||||||
|
class="m-0 bg-bg-dark ring-0 text-xl font-medium uppercase cursor-pointer hover:bg-inherit"
|
||||||
|
block
|
||||||
|
@click="isOpen = !isOpen"
|
||||||
|
>
|
||||||
|
{{ selectedCountry }}/{{ selectedCurrency }}
|
||||||
|
</UButton>
|
||||||
|
|
||||||
|
<template #content>
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<USelect
|
||||||
|
v-model="selectedCountry"
|
||||||
|
:items="menuStore.countryList"
|
||||||
|
class="w-48"
|
||||||
|
value-key="iso_code"
|
||||||
|
>
|
||||||
|
<template #leading="{ modelValue }">
|
||||||
|
<div class="flex items-center gap-2 text-xl font-medium uppercase">
|
||||||
|
{{ modelValue }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item="{ item }">
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer w-full">
|
||||||
|
<p class="text-xl font-medium">{{ item?.name }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</USelect>
|
||||||
|
<USelect
|
||||||
|
v-model="selectedCurrency"
|
||||||
|
:items="menuStore.currencies"
|
||||||
|
class="w-48"
|
||||||
|
value-key="iso_code"
|
||||||
|
>
|
||||||
|
<template #leading="{ modelValue }">
|
||||||
|
<div class="flex items-center gap-2 text-xl font-medium uppercase">
|
||||||
|
{{ modelValue }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item="{ item }">
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer w-full">
|
||||||
|
<p class="text-xl font-medium">{{ item?.name }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</USelect>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</UCollapsible>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "#imports";
|
||||||
|
|
||||||
|
const isOpen = ref(false);
|
||||||
|
const menuStore = useMenuStore();
|
||||||
|
|
||||||
|
const selectedCountry = ref(menuStore.countryList[0].iso_code);
|
||||||
|
const selectedCurrency = ref(menuStore.currencies[0].iso_code);
|
||||||
|
</script>
|
@ -31,6 +31,7 @@
|
|||||||
<i class="uil uil-shopping-cart text-[31px] cursor-pointer"></i>
|
<i class="uil uil-shopping-cart text-[31px] cursor-pointer"></i>
|
||||||
</div>
|
</div>
|
||||||
<LangSwitcher />
|
<LangSwitcher />
|
||||||
|
<CurrSelector />
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
<button
|
<button
|
||||||
class="hover:bg-button-hover bg-button cursor-pointer rounded-xl px-6 py-3 font-medium text-white transition-all"
|
class="hover:bg-button-hover bg-button cursor-pointer rounded-xl px-6 py-3 font-medium text-white transition-all"
|
||||||
@ -284,7 +285,6 @@
|
|||||||
import LangSwitcher from "./LangSwitcher.vue";
|
import LangSwitcher from "./LangSwitcher.vue";
|
||||||
|
|
||||||
const menuStore = useMenuStore();
|
const menuStore = useMenuStore();
|
||||||
const store = useStore();
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const colorMode = useColorMode();
|
const colorMode = useColorMode();
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
@update:model-value="setLocale"
|
@update:model-value="setLocale"
|
||||||
>
|
>
|
||||||
<template #leading="{ modelValue }">
|
<template #leading="{ modelValue }">
|
||||||
<div class="flex items-center gap-2 text-xl font-medium">
|
<div class="flex items-center gap-2 text-xl font-medium uppercase">
|
||||||
{{ locales.find((item) => item.code === modelValue)?.name }}
|
{{ locales.find((item) => item.code === modelValue)?.code }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -28,7 +28,7 @@
|
|||||||
:name="item.icon as string"
|
:name="item.icon as string"
|
||||||
class="size-5 rounded-full border border-button/40"
|
class="size-5 rounded-full border border-button/40"
|
||||||
/>
|
/>
|
||||||
<p class="text-xl font-medium">{{ item.name }}</p>
|
<p class="text-xl font-medium uppercase">{{ item.code }}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</USelect>
|
</USelect>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -42,16 +42,16 @@
|
|||||||
|
|
||||||
<!-- Map block with same layout rules -->
|
<!-- Map block with same layout rules -->
|
||||||
<div class="w-full xl:max-w-[48%] md:mx-10 xl:m-0 flex flex-col gap-4 items-center">
|
<div class="w-full xl:max-w-[48%] md:mx-10 xl:m-0 flex flex-col gap-4 items-center">
|
||||||
<h1>Jsme tu pro vás napříč Evropou</h1>
|
<h1 class="text-sm sm:text-xl uppercase">Jsme tu pro vás napříč Evropou</h1>
|
||||||
<MapBlock />
|
<MapBlock />
|
||||||
<div class="flex items-center gap-4 w-full justify-end">
|
<div class="flex items-center gap-4 w-full justify-end">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div class="w-2 h-2 rounded-[2px] bg-accent-green"></div>
|
<div class="w-3 h-3 rounded-[2.8px] bg-button"></div>
|
||||||
<p>Partners</p>
|
<p class="text-sm sm:text-lg">Partners</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div class="w-2 h-2 rounded-[2px] bg-accent-green"></div>
|
<div class="w-3 h-3 rounded-[2.8px] bg-bg-block"></div>
|
||||||
<p>Customers</p>
|
<p class="text-sm sm:text-lg">Customers</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -72,32 +72,9 @@ type Component = {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Partner {
|
|
||||||
code: string;
|
|
||||||
country_iso: string;
|
|
||||||
region_iso: string;
|
|
||||||
first_name: string;
|
|
||||||
last_name: string;
|
|
||||||
job_position: string;
|
|
||||||
commissioning_entity_name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
component: Component;
|
component: Component;
|
||||||
data: Object;
|
data: Object;
|
||||||
infoData: Object;
|
infoData: Object;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const countryISOs = ref("");
|
|
||||||
const isDefault = ref<boolean>(true);
|
|
||||||
const activeCountry = ref<string>("");
|
|
||||||
|
|
||||||
let partnersList = ref([] as Partner[]);
|
|
||||||
let partnersCountries = ref([] as any[]);
|
|
||||||
|
|
||||||
const backToEurope = () => {
|
|
||||||
isDefault.value = true;
|
|
||||||
activeCountry.value = "";
|
|
||||||
partnersList.value = [];
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||||
|
|
||||||
const props = defineProps<{ component: Component }>();
|
defineProps<{ component: Component }>();
|
||||||
type Component = {
|
type Component = {
|
||||||
image_collection: string;
|
image_collection: string;
|
||||||
section_id: string;
|
section_id: string;
|
||||||
@ -84,15 +84,13 @@ async function updateItemCount() {
|
|||||||
else itemCount.value = 1;
|
else itemCount.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(itemCount, async() => {
|
watch(itemCount, async () => {
|
||||||
await productStore.getList(itemCount.value);
|
await productStore.getList(itemCount.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await updateItemCount();
|
await updateItemCount();
|
||||||
window.addEventListener("resize", updateItemCount);
|
window.addEventListener("resize", updateItemCount);
|
||||||
|
|
||||||
await productStore.getList(itemCount.value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
@ -20,9 +20,9 @@ export default defineNuxtConfig({
|
|||||||
|
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: [
|
locales: [
|
||||||
{ code: "pl", name: "Pl", icon: "circle-flags:pl" },
|
{ code: "pl", name: "Polski", icon: "circle-flags:pl" },
|
||||||
{ code: "en", name: "EN", icon: "circle-flags:gb" },
|
{ code: "en", name: "English", icon: "circle-flags:gb" },
|
||||||
{ code: "cs", name: "CZR", icon: "circle-flags:cz" }
|
{ code: "cs", name: "Čeština", icon: "circle-flags:cz" }
|
||||||
],
|
],
|
||||||
lazy: true,
|
lazy: true,
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
|
@ -4,4 +4,6 @@ export default defineNuxtPlugin(async () => {
|
|||||||
const menuStore = useMenuStore();
|
const menuStore = useMenuStore();
|
||||||
await menuStore.loadMenu();
|
await menuStore.loadMenu();
|
||||||
await menuStore.loadFooter();
|
await menuStore.loadFooter();
|
||||||
|
await menuStore.getCountryList();
|
||||||
|
await menuStore.getCurrencies();
|
||||||
});
|
});
|
129
stores/mapStore.ts
Normal file
129
stores/mapStore.ts
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
import type { CountryList, PartnersList } from "~/types";
|
||||||
|
|
||||||
|
export const useMapStore = defineStore("mapStore", () => {
|
||||||
|
const partnersList = ref<PartnersList[]>([
|
||||||
|
{
|
||||||
|
country_iso: "cz",
|
||||||
|
total: 9,
|
||||||
|
country_name: "Czech Republic",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country_iso: "de",
|
||||||
|
total: 1,
|
||||||
|
country_name: "Germany",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country_iso: "ie",
|
||||||
|
total: 1,
|
||||||
|
country_name: "Ireland",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country_iso: "nl",
|
||||||
|
total: 1,
|
||||||
|
country_name: "Netherlands",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country_iso: "pl",
|
||||||
|
total: 61,
|
||||||
|
country_name: "Poland",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const customersList = ref([
|
||||||
|
"be",
|
||||||
|
"cz",
|
||||||
|
"de",
|
||||||
|
"dk",
|
||||||
|
"gb",
|
||||||
|
"ie",
|
||||||
|
"it",
|
||||||
|
"nl",
|
||||||
|
"no",
|
||||||
|
"pl",
|
||||||
|
"sk",
|
||||||
|
"at",
|
||||||
|
"lt",
|
||||||
|
"is",
|
||||||
|
"se"
|
||||||
|
]);
|
||||||
|
|
||||||
|
const countryList = ref<CountryList[]>()
|
||||||
|
const countries = ref<CountryList[]>()
|
||||||
|
|
||||||
|
// async function getPartnersList() {
|
||||||
|
// try {
|
||||||
|
// const res = await fetch(
|
||||||
|
// `http://127.0.0.1:4000/api/public/partners/count`,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (!res.ok) {
|
||||||
|
// throw new Error(`HTTP error: ${res.status}`);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const data = await res.json();
|
||||||
|
// partnersList.value = data.data
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("getList error:", error);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async function getCustomerList() {
|
||||||
|
// try {
|
||||||
|
// const res = await fetch(
|
||||||
|
// `http://127.0.0.1:4000/api/public/customer/countries`,
|
||||||
|
// {
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (!res.ok) {
|
||||||
|
// throw new Error(`HTTP error: ${res.status}`);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const data = await res.json();
|
||||||
|
// customersList.value = data.data
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("getList error:", error);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
async function getCountries() {
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`http://127.0.0.1:4000/api/public/countries`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP error: ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
countries.value = data.ata
|
||||||
|
} catch (error) {
|
||||||
|
console.error("getList error:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
partnersList,
|
||||||
|
customersList,
|
||||||
|
// countryList,
|
||||||
|
countries,
|
||||||
|
// getPartnersList,
|
||||||
|
// getCustomerList,
|
||||||
|
getCountries
|
||||||
|
};
|
||||||
|
});
|
@ -1,5 +1,7 @@
|
|||||||
import { usePB } from "~/composables/usePB";
|
import { usePB } from "~/composables/usePB";
|
||||||
import type {
|
import type {
|
||||||
|
CountryList,
|
||||||
|
Currencies,
|
||||||
FooterListResponse,
|
FooterListResponse,
|
||||||
MenuListResponse,
|
MenuListResponse,
|
||||||
PBFooterItem,
|
PBFooterItem,
|
||||||
@ -29,13 +31,19 @@ export const useMenuStore = defineStore("menuStore", () => {
|
|||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { $i18n } = useNuxtApp();
|
const { $i18n } = useNuxtApp();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const openMenu = ref(false);
|
const openMenu = ref(false);
|
||||||
const openDropDown = ref(false);
|
const openDropDown = ref(false);
|
||||||
|
|
||||||
|
|
||||||
const defaultMenu = ref();
|
const defaultMenu = ref();
|
||||||
const menu = ref<UIMenuItem[]>([]);
|
const menu = ref<UIMenuItem[]>([]);
|
||||||
const menuItems = ref<MenuListResponse>();
|
const menuItems = ref<MenuListResponse>();
|
||||||
|
|
||||||
const footerItems = ref<FooterListResponse>();
|
const footerItems = ref<FooterListResponse>();
|
||||||
|
const countryList = ref<CountryList[]>();
|
||||||
|
const currencies = ref<Currencies[]>();
|
||||||
|
|
||||||
const loadMenu = async () => {
|
const loadMenu = async () => {
|
||||||
try {
|
try {
|
||||||
@ -73,6 +81,52 @@ export const useMenuStore = defineStore("menuStore", () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getCountryList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`http://127.0.0.1:4000/api/public/country/list`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP error: ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
countryList.value = data.data
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("getList error:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCurrencies = async () => {
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
`http://127.0.0.1:4000/api/public/currencies`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP error: ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
currencies.value = data.data.items
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("getList error:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const navigateToItem = (item?: UIMenuItem) => {
|
const navigateToItem = (item?: UIMenuItem) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
router.push({
|
router.push({
|
||||||
@ -91,11 +145,6 @@ export const useMenuStore = defineStore("menuStore", () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch($i18n.locale, async () => {
|
|
||||||
await loadMenu();
|
|
||||||
await loadFooter();
|
|
||||||
});
|
|
||||||
|
|
||||||
const getFirstImage = () => {
|
const getFirstImage = () => {
|
||||||
const req = useRequestEvent();
|
const req = useRequestEvent();
|
||||||
const url = useRequestURL();
|
const url = useRequestURL();
|
||||||
@ -111,7 +160,6 @@ export const useMenuStore = defineStore("menuStore", () => {
|
|||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const headMeta = computed(() => {
|
const headMeta = computed(() => {
|
||||||
const item = menuItems.value?.items.find(
|
const item = menuItems.value?.items.find(
|
||||||
(item) => item.id_page === route.params.id
|
(item) => item.id_page === route.params.id
|
||||||
@ -174,16 +222,24 @@ export const useMenuStore = defineStore("menuStore", () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch($i18n.locale, async () => {
|
||||||
|
await loadMenu();
|
||||||
|
await loadFooter();
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
menu,
|
menu,
|
||||||
menuItems,
|
menuItems,
|
||||||
footerItems,
|
footerItems,
|
||||||
openMenu,
|
openMenu,
|
||||||
openDropDown,
|
openDropDown,
|
||||||
|
countryList,
|
||||||
|
currencies,
|
||||||
loadMenu,
|
loadMenu,
|
||||||
loadFooter,
|
loadFooter,
|
||||||
|
getCountryList,
|
||||||
navigateToItem,
|
navigateToItem,
|
||||||
redirectToPage,
|
redirectToPage,
|
||||||
|
getCurrencies,
|
||||||
defaultMenu,
|
defaultMenu,
|
||||||
headMeta,
|
headMeta,
|
||||||
};
|
};
|
||||||
|
@ -94,4 +94,36 @@ export type componentsListType = {
|
|||||||
component: PBPageItem;
|
component: PBPageItem;
|
||||||
componentInstance: DefineComponent;
|
componentInstance: DefineComponent;
|
||||||
data: SectionLangData;
|
data: SectionLangData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// menuStore
|
||||||
|
export type CountryList = {
|
||||||
|
call_prefix: string;
|
||||||
|
currency_iso_code: string;
|
||||||
|
iso_code: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Countries = {
|
||||||
|
call_prefix: string;
|
||||||
|
currency_iso_code: string;
|
||||||
|
iso_code: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PartnersList = {
|
||||||
|
country_iso: string;
|
||||||
|
country_name: string;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Currencies = {
|
||||||
|
iso_code: string;
|
||||||
|
name: string;
|
||||||
|
UpdatedAt: string;
|
||||||
|
iso_code_num: number;
|
||||||
|
precision: number;
|
||||||
|
sign: string;
|
||||||
|
active: boolean;
|
||||||
|
suffix: boolean;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user