calculator and other cleaning

This commit is contained in:
2025-07-04 22:39:51 +02:00
parent a2db817133
commit 0bab1d83a1
19 changed files with 420 additions and 93 deletions

View File

@ -12,7 +12,7 @@
{{ item }}
</div>
</div>
<a href="/lei_certificate_aurrie.pdf" target="_blank" rel="noopener noreferrer">{{ $t("Footer.Lei") }}</a>
<a href="/lei_certificate_aurrie.pdf" target="_blank" rel="noopener noreferrer">{{ $t("footer_lei") }}</a>
</div>
<div v-for="(section, index) in docs" :key="index" class="flex flex-col gap-[25px] sm:gap-8 max-w-[280px]">

View File

@ -0,0 +1,248 @@
<template>
<UiContainer class="space-25-75">
<div>
<div class="flex flex-col w-full">
<div class="relative flex flex-col">
<h1 class="text-3xl font-bold">
{{ component.front_section_lang.at(0).data.drawing_up_a_proposal_for_asave_contract }}
</h1>
<div class="flex flex-wrap flex-1">
<!-- left -->
<div class="w-full md:w-1/2 p-4">
<h3 class="w-full border-b my-2">
{{ component.front_section_lang.at(0).data.simulation_of_the_contract_proposal }}
</h3>
<p>{{ component.front_section_lang.at(0).data.monthly_savings }}</p>
<div class="my-8">
<div class="text-2xl">
{{ formater.price(store.monthlySavings) }}
</div>
<input v-model="store.monthlySavings" type="range" :max="store.getMaxAmount" :min="store.getMinAmount" class="w-full accent-button cursor-pointer" @change="investmentStore.getCalculator()">
</div>
<div class="my-8">
<div class="text-2xl">
{{ store.storagePeriod }}
</div>
<input v-model="store.storagePeriod" type="range" :max="investmentStore.maxYear" :min="investmentStore.minYear" class="w-full accent-button cursor-pointer" @change="investmentStore.getCalculator()">
</div>
</div>
<!-- right -->
<div class="w-full md:w-1/2 p-4">
<h3 class="w-full border-b my-2">
{{ component.front_section_lang.at(0).data.details_of_the_contract_proposal }}
</h3>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.current_price_per_bar }}</span>
<span>{{ formater.price(investmentStore.calculationResult.calculator_output.investment_piece.price) }}</span>
</p>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.money_for_spend }}</span>
<span>{{ formater.price(investmentStore.calculationResult.calculator_output.money_spent) }}</span>
</p>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.weight_per_bar }}</span>
<span>{{ getWeight }}</span>
</p>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.count }}</span>
<span>{{ investmentStore.calculationResult.calculator_output.max_pieces_in_package }}</span>
</p>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.contract_type }}</span>
<span>50/50</span>
</p>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.special_fee }}</span>
<span>{{ formater.price(investmentStore.calculationResult.calculator_output.total_input_price_increase) }}</span>
</p>
</div>
</div>
</div>
<!-- next section -->
<div class="flex flex-wrap">
<!-- left -->
<div class="w-full md:w-1/2 p-4">
<h3 class="w-full border-b my-2">
{{ component.front_section_lang.at(0).data.graphic_simulation_of_future_profits }}
</h3>
<p class="my-4 md:my-12">
<img :src="`data:image/svg+xml;base64,${investmentStore.calculationResult.chart}`" alt="" class="bg-white rounded-2xl p-2">
</p>
</div>
<!-- right -->
<div class="w-full md:w-1/2 p-4">
<h3 class="w-full border-b my-2">
{{ component.front_section_lang.at(0).data.summary_of_the_contract_proposal }}
</h3>
<p class="flex justify-between my-4">
<span>{{ component.front_section_lang.at(0).data.save }}</span>
<span>{{ component.front_section_lang.at(0).data.expected_value_of_savings }}</span>
</p>
<p class="flex justify-between my-4">
<span></span>
<span class="font-bold text-2xl">{{ formater.price(investmentStore.calculationResult.calculator_output.total_investement_value)
}}</span>
</p>
<div class="flex flex-col items-center">
<img :src="`/api/public/file/${investmentStore.calculationResult.calculator_output.investment_piece.cover_picture_uuid}_m.webp`" :alt="investmentStore.calculationResult.calculator_output.investment_piece.name" class="object-contain object-center w-48 max-h-64">
<span class="my-2 text-sm">{{ investmentStore.calculationResult.calculator_output.investment_piece.name }}</span>
</div>
</div>
</div>
</div>
<hr class="my-4">
<div class="flex w-full flex-wrap justify-center md:justify-end mt-8">
<a :href="getPrintLink" target="_blank" class="my-2 mx-4">
<UiButtonArrow :arrow="true" type="fill" class="mx-auto sm:m-0">
{{ component.front_section_lang.at(0).data.print }}
</UiButtonArrow>
</a>
<nuxt-link :to="getInvestLink" class="my-2 mx-4">
<UiButtonArrow :arrow="true" type="fill" class="mx-auto sm:m-0">
{{ component.front_section_lang.at(0).data.invest }}
</UiButtonArrow>
</nuxt-link>
</div>
</div>
</UiContainer>
</template>
<script setup lang="ts">
defineProps<{
component: {
id: number
name: string
img: string[]
component_name: string
is_no_lang: boolean
page_name: string
front_section_lang: {
data: {
drawing_up_a_proposal_for_asave_contract: string
simulation_of_the_contract_proposal: string
monthly_savings: string
details_of_the_contract_proposal: string
current_price_per_bar: string
money_for_spend: string
weight_per_bar: string
count: string
contract_type: string
special_fee: string
graphic_simulation_of_future_profits: string
summary_of_the_contract_proposal: string
save: string
expected_value_of_savings: string
print: string
invest: string
}
id_front_section: number
id_lang: number
}[]
}
}>()
const investmentStore = useInvestmentStore()
const store = useStore()
const formater = useFormater(useNuxtApp())
const userStore = useUserStore()
const router = useRouter()
const menuStore = useMenuStore()
await investmentStore.getCalculator()
const getWeight = computed(() => {
return investmentStore.calculationResult.calculator_output.investment_piece.features.find(feature => feature.feature_id === 1)?.value
})
const getPrintLink = computed(() => {
const query = new URLSearchParams({
monthly_deposit: String(store.monthlySavings),
years: String(store.storagePeriod),
grid: 'false',
legend: 'false',
title: 'false',
ingots_bought_dots: 'true',
draw_linear: 'true',
annotations: 'false',
show_real_value: 'false',
series_stroke_width: '1',
})
return `/api/public/plan-prediction/easy/plan-proposal?${query.toString()}`
})
const getInvestLink = computed(() => {
if (userStore.isLogged) {
return { path: '/golden-panel/save-contract' }
}
return { name: router.currentRoute.value.name, params: { id: menuStore.getLoginMenu()?.id, slug: menuStore.getLoginMenu()?.front_menu_lang.at(0)?.link_rewrite }, query: { to: btoa('/golden-panel/save-contract') } }
})
/*
INSERT INTO `front_page` (`created_at`, `updated_at`, `name`, `is_default`, `id`) VALUES ('2025-06-25 11:07:28.000','2025-06-25 11:07:28.000','investment-calculator','0','16');
INSERT INTO `front_menu` (`created_at`, `updated_at`, `active`, `position_id`, `id_front_page`, `is_default`, `is_root`, `id`) VALUES ('2025-06-25 11:07:28.000','2025-06-25 11:07:28.000','1','1','16','0','0','16');
INSERT INTO `front_menu_lang` (`name`, `id_lang`, `id_front_menu`, `link_rewrite`) VALUES ('investment','2','16','Investment');
INSERT INTO `front_menu_lang` (`link_rewrite`, `id_front_menu`, `id_lang`, `name`) VALUES ('inwestycja','16','1','Inwestycja');
INSERT INTO `front_menu_lang` (`name`, `id_lang`, `id_front_menu`, `link_rewrite`) VALUES ('investice','3','16','Investice');
INSERT INTO `front_section` (`id`, `created_at`, `updated_at`, `name`, `img`, `component_name`, `is_no_lang`) VALUES ('35','2025-06-25 11:07:28.000','2025-06-25 11:07:28.000','investment-calculator','[]','InvestmentBlock','0');
INSERT INTO `front_page_section` (`id_front_page`, `id_position`, `id_front_section`) VALUES ('16','1','35');
INSERT INTO `front_page_section` (`id_front_page`, `id_position`, `id_front_section`) VALUES ('16','2','4');
INSERT INTO `front_section_lang` (`data`, `id_front_section`, `id_lang`) VALUES ('{
"drawing_up_a_proposal_for_asave_contract": "Przygotowanie propozycji umowy SAVE",
"simulation_of_the_contract_proposal": "Symulacja propozycji umowy",
"monthly_savings": "Miesięczne oszczędności",
"details_of_the_contract_proposal": "Szczegóły propozycji umowy",
"current_price_per_bar": "Aktualna cena za sztabkę",
"money_for_spend": "Kwota do wydania",
"weight_per_bar": "Waga jednej sztabki",
"count": "Liczba",
"contract_type": "Typ umowy",
"special_fee": "Opłata specjalna",
"graphic_simulation_of_future_profits": "Graficzna symulacja przyszłych zysków",
"summary_of_the_contract_proposal": "Podsumowanie propozycji umowy",
"save": "Zaoszczędzona kwota",
"expected_value_of_savings": "Oczekiwana wartość oszczędności",
"print": "Drukuj",
"invest": "Zainwestuj"
}', '35', '1');
INSERT INTO `front_section_lang` (`data`, `id_front_section`, `id_lang`) VALUES ('{
"drawing_up_a_proposal_for_asave_contract": "Drawing up a proposal for a SAVE contract",
"simulation_of_the_contract_proposal": "Simulation of the contract proposal",
"monthly_savings": "Monthly savings",
"details_of_the_contract_proposal": "Details of the contract proposal",
"current_price_per_bar": "Current price per bar",
"money_for_spend": "Money for spend",
"weight_per_bar": "Weight per bar",
"count": "Count",
"contract_type": "Contract type",
"special_fee": "Special fee",
"graphic_simulation_of_future_profits": "Graphic simulation of future profits",
"summary_of_the_contract_proposal": "Summary of the contract proposal",
"save": "Saved Amount",
"expected_value_of_savings": "Expected value of savings",
"print": "Print",
"invest": "Invest"
}', '35', '2');
INSERT INTO `front_section_lang` (`data`, `id_front_section`, `id_lang`) VALUES ('{
"drawing_up_a_proposal_for_asave_contract": "Vypracování návrhu smlouvy SAVE",
"simulation_of_the_contract_proposal": "Simulace návrhu smlouvy",
"monthly_savings": "Měsíční úspory",
"details_of_the_contract_proposal": "Podrobnosti návrhu smlouvy",
"current_price_per_bar": "Aktuální cena za slitku",
"money_for_spend": "Částka k utracení",
"weight_per_bar": "Hmotnost slitku",
"count": "Počet",
"contract_type": "Typ smlouvy",
"special_fee": "Speciální poplatek",
"graphic_simulation_of_future_profits": "Grafická simulace budoucích zisků",
"summary_of_the_contract_proposal": "Shrnutí návrhu smlouvy",
"save": "Ušetřená částka",
"expected_value_of_savings": "Očekávaná hodnota úspor",
"print": "Tisk",
"invest": "Investovat"
}', '35', '3');
*/
</script>

View File

@ -73,22 +73,11 @@
<div class="flex flex-col gap-4">
<div class="flex justify-between">
<p>{{ $t("monthly_savings") }}</p>
<p
class="text-accent-green-light dark:text-accent-green-dark font-bold"
>
{{ store.monthlySavings }}
{{ menuStore.selectedCurrency?.sign }}
<p class="text-accent-green-light dark:text-accent-green-dark font-bold">
{{ formater.price(store.monthlySavings) }}
</p>
</div>
<input
v-model="store.monthlySavings"
type="range"
max="600"
:min="store.minValue"
class="w-full accent-button cursor-pointer"
@mouseup="store.getCalculator()"
@touchend="store.getCalculator()"
>
<input v-model="store.monthlySavings" type="range" :max="store.getMaxAmount" :min="store.getMinAmount" class="w-full accent-button cursor-pointer" @change="store.getCalculator()">
</div>
<div class="flex flex-col gap-4">
<div class="flex justify-between">
@ -99,14 +88,7 @@
{{ store.storagePeriod }}
</p>
</div>
<input
v-model="store.storagePeriod"
type="range"
max="20"
class="w-full accent-button cursor-pointer"
@mouseup="store.getCalculator()"
@touchend="store.getCalculator()"
>
<input v-model="store.storagePeriod" type="range" max="20" class="w-full accent-button cursor-pointer" @change="store.getCalculator()">
</div>
</div>
<div
@ -117,17 +99,14 @@
<h2
class="h2-bold-bounded text-accent-green-light dark:text-accent-green-dark"
>
{{ menuStore.selectedCurrency?.sign }} {{ store.totalInvestment }}
{{ formater.price(store.totalInvestment) }}
</h2>
</div>
<UiButtonArrow :arrow="true"
type="fill"
class="mx-auto sm:m-0"
>
{{
component.front_section_lang[0].data.button
}}
</UiButtonArrow>
<nuxt-link :to="{ name: `id-slug___${$i18n.locale}`, params: { id: menuStore.getInvestmentCalculatorMenu()?.id, slug: menuStore.getInvestmentCalculatorMenu()?.front_menu_lang.at(0)?.link_rewrite } }">
<UiButtonArrow :arrow="true" type="fill" class="mx-auto sm:m-0">
{{ component.front_section_lang[0].data.button }}
</UiButtonArrow>
</nuxt-link>
</div>
</div>
</div>
@ -168,9 +147,11 @@ defineProps<{
const store = useStore()
const menuStore = useMenuStore()
const { $session } = useNuxtApp()
const itemCount = ref(4)
const productStore = useProductStore()
const formater = useFormater(useNuxtApp())
async function updateItemCount() {
const width = window.innerWidth
@ -185,6 +166,10 @@ watch(itemCount, async () => {
await productStore.getList(itemCount.value)
})
watch($session.cookieData, async () => {
await productStore.getList(itemCount.value)
})
onMounted(async () => {
await updateItemCount()
window.addEventListener('resize', updateItemCount)

View File

@ -43,6 +43,7 @@ defineProps<{
const menuStore = useMenuStore()
const itemCount = ref(4)
const productStore = useProductStore()
const { $session } = useNuxtApp()
async function updateItemCount() {
const width = window.innerWidth
@ -57,6 +58,10 @@ watch(itemCount, async () => {
await productStore.getList(itemCount.value)
})
watch($session.cookieData, async () => {
await productStore.getList(itemCount.value)
})
onMounted(async () => {
await updateItemCount()
window.addEventListener('resize', updateItemCount)

View File

@ -29,7 +29,7 @@
<div class="flex items-center justify-between">
<p
class="text-accent-green-light font-inter text-[12px] sm:text-[21px] md:text-2xl leading-[150%] font-bold">
{{ product.formatted_price }}
{{ formater.price(product.price) }}
</p>
<button
class="w-[22px] h-[22px] sm:w-9 sm:h-9 md:w-12 md:h-12 rounded-[5px] text-bg-light sm:rounded-xl bg-button cursor-pointer hover:bg-button-hover transition-all flex items-center justify-center p-1"
@ -57,7 +57,7 @@ defineProps<{ product: Product }>()
const productStore = useProductStore()
const menuStore = useMenuStore()
const formater = useFormater(useNuxtApp())
function handleImageError(event: Event) {
const img = event.target as HTMLImageElement
img.src = '/photo.svg'

View File

@ -13,7 +13,7 @@
</button>
</div>
</transition>
<div class="space-y-10 sm:space-y-[75px]">
<div ref="productBlockRef" class="space-y-10 sm:space-y-[75px]">
<div class="flex flex-col items-start xl:flex-row gap-[40px] sm:gap-[100px] border-b-2 border-block pb-[25px]">
<!-- images block -->
<button
@ -70,14 +70,14 @@
}}</span>
</p>
</div>
<div class="mx-auto sm:mx-0 group flex cursor-pointer items-center justify-start gap-2 whitespace-nowrap">
<div class="mx-auto sm:mx-0 group flex cursor-pointer items-center justify-start gap-2 whitespace-nowrap" @click="productStore.incrementCartItem(product.id)">
<button
class="h-[40px] cursor-pointer min-w-40 rounded-[10px] px-[22px] transition-all sm:h-[50px] md:h-[65px] md:rounded-[15px] md:px-[42px] bg-button text-text-dark group-hover:bg-button-hover">
Add to cart
</button>
<div :disabled="!product.sale_active" class="
flex h-[40px] w-[40px] items-center justify-center rounded-[10px] p-2.5 transition-all sm:h-[50px] sm:w-[50px] md:h-[65px] md:w-[65px] md:rounded-[15px] bg-button text-text-dark group-hover:bg-button-hover
" @click="productStore.incrementCartItem(product.id)">
">
<i class="uil uil-shopping-cart text-[23px] sm:text-[33px]"></i>
</div>
</div>
@ -115,7 +115,7 @@
.link_rewrite,
},
query: { prod_id: item?.id, name: item?.link_rewrite },
}">
}" @click.stop.prevent="scrollToTop">
<div
class="w-[200px] sm:w-[260px] md:w-[290px] sm:py-5 sm:px-[15px] py-[15px] px-[10px] bg-block rounded-2xl flex flex-col items-center gap-5 sm:gap-7 h-full">
<img :src="`/api/public/file/${item.cover_picture_uuid}.webp`" alt="pics"
@ -176,10 +176,11 @@ const menuStore = useMenuStore()
const { $session } = useNuxtApp()
const productStore = useProductStore()
const dropdownRef = ref()
const productBlockRef = ref()
// const addToCart = (p: ProductItem) => {
// alert('add to cart product: ' + p.name)
// }
function scrollToTop() {
productBlockRef.value?.scrollIntoView({ behavior: 'smooth' })
}
const formatPrice = (p: number) => {
const formatdecimal = new Intl.NumberFormat(

View File

@ -94,12 +94,7 @@
<div
class="flex items-center justify-between gap-2 uppercase text-sm sm:text-xl border border-block placeholder:text-gray dark:placeholder:text-button-disabled text-bg-dark dark:text-bg-light rounded-lg px-6 w-full h-[50px] sm:h-[67px]">
<p class="truncate whitespace-nowrap">
{{
component.front_section_lang
&& component.front_section_lang[0].data.account_types.find(
(item) => item.name === modelValue,
)?.name
}}
{{ component.front_section_lang.at(0).data.account_types.find((item: any) => item.name === modelValue)?.name }}
</p>
<span>
<i class="uil uil-angle-down text-2xl font-light cursor-pointer" /></span>

View File

@ -350,10 +350,7 @@ async function loadMoreProducts() {
qParams.append('p', `${page.value}`)
qParams.append('elems', `${elems.value}`)
qParams.append(
'features',
selectedFilters.value.length > 0 ? selectedFilters.value : null,
)
qParams.append('features', selectedFilters.value.length > 0 ? `${selectedFilters.value}` : '')
try {
const { data } = await useMyFetch<GenericResponseItems<ProductType[]>>(
@ -395,7 +392,7 @@ const changeCategory = (item: CategoryItem) => {
categoryId.value = item.id
}
watch(selectedFilters, async (newQuestion: string) => {
watch(selectedFilters, async (newQuestion) => {
if (newQuestion) {
page.value = 1
reachedEnd.value = false
@ -407,7 +404,7 @@ watch(selectedFilters, async (newQuestion: string) => {
qParams.append('elems', `${elems.value}`)
qParams.append(
'features',
selectedFilters.value.length > 0 ? selectedFilters.value : null,
selectedFilters.value.length > 0 ? `${selectedFilters.value}` : '',
)
try {
@ -443,7 +440,7 @@ watch(categoryId, async (newCategoryId) => {
qParams.append('elems', `${elems.value}`)
qParams.append(
'features',
selectedFilters.value.length > 0 ? selectedFilters.value : null,
selectedFilters.value.length > 0 ? `${selectedFilters.value}` : '',
)
try {