fixes
This commit is contained in:
32
src/App.vue
32
src/App.vue
@@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
<!-- Контентная часть заполняет оставшееся пространство -->
|
<!-- Контентная часть заполняет оставшееся пространство -->
|
||||||
<div class="flex-grow ">
|
<div class="flex-grow ">
|
||||||
|
<Button label="Sub" :class="checkNotif ? 'flex' : '!hidden'" @click="checkSubscribe"/>
|
||||||
<router-view/>
|
<router-view/>
|
||||||
</div>
|
</div>
|
||||||
<OverlayView class="w-full sticky invisible lg:visible top-0 z-10"/>
|
<OverlayView class="w-full sticky invisible lg:visible top-0 z-10"/>
|
||||||
{{not}}
|
|
||||||
<Button label="Sub" @click="checkSubscribe"/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -22,23 +21,30 @@ import OverlayView from "@/components/OverlayView.vue";
|
|||||||
import ToolBar from "@/components/ToolBar.vue";
|
import ToolBar from "@/components/ToolBar.vue";
|
||||||
import Button from "primevue/button";
|
import Button from "primevue/button";
|
||||||
import axiosSetup from "@/services/axiosSetup";
|
import axiosSetup from "@/services/axiosSetup";
|
||||||
import {onMounted, ref} from "vue";
|
import {computed, onMounted, ref} from "vue";
|
||||||
import {subscribeUserToPush} from "@/services/pushManager";
|
import {subscribeUserToPush} from "@/services/pushManager";
|
||||||
import apiClient from '@/services/axiosSetup';
|
import apiClient from '@/services/axiosSetup';
|
||||||
|
|
||||||
|
const checkNotif = computed(() => {
|
||||||
|
return 'Notification' in window && Notification.permission === 'default'
|
||||||
|
})
|
||||||
|
|
||||||
const not = ref(Notification.permission)
|
const checkSubscribe = async () => {
|
||||||
const checkSubscribe = async () => {
|
if ("Notification" in window) {
|
||||||
if (Notification.permission === 'default') {
|
if (Notification.permission === 'default') {
|
||||||
await Notification.requestPermission().then(sendSubscribe)
|
await Notification.requestPermission().then(sendSubscribe)
|
||||||
} else if (Notification.permission === 'granted') {
|
} else if (Notification.permission === 'granted') {
|
||||||
await sendSubscribe()
|
await sendSubscribe()
|
||||||
|
} else {
|
||||||
|
// Пользователь ранее отклонил запрос
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Пользователь ранее отклонил запрос
|
console.log("Notification API is not supported in this browser.");
|
||||||
|
// You may want to use an alternative method, like alerts or modals
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendSubscribe = async () => {
|
const sendSubscribe = async () => {
|
||||||
try {
|
try {
|
||||||
const subscription = await subscribeUserToPush();
|
const subscription = await subscribeUserToPush();
|
||||||
console.log("Push subscription:", subscription);
|
console.log("Push subscription:", subscription);
|
||||||
@@ -51,7 +57,7 @@ const sendSubscribe = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await checkSubscribe()
|
await checkSubscribe()
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
<!-- <i class="pi pi-check text-2xl" style="font-size: 1.5rem"></i>-->
|
<!-- <i class="pi pi-check text-2xl" style="font-size: 1.5rem"></i>-->
|
||||||
<p>Настройки</p>
|
<p>Настройки</p>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<button @click="refreshPage"><p class="text-left"><i class="pi pi-refresh"/>Обновить страницу</p></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -101,7 +102,9 @@ const transactionType = ref<TransactionType>()
|
|||||||
const categoryType = ref<CategoryType>()
|
const categoryType = ref<CategoryType>()
|
||||||
const drawerOpened = ref(false);
|
const drawerOpened = ref(false);
|
||||||
|
|
||||||
|
const refreshPage = () => {
|
||||||
|
window.location.reload(true)
|
||||||
|
}
|
||||||
const openDrawer = (selectedTransactionType = null, selectedCategoryType = null) => {
|
const openDrawer = (selectedTransactionType = null, selectedCategoryType = null) => {
|
||||||
if (selectedTransactionType && selectedCategoryType) {
|
if (selectedTransactionType && selectedCategoryType) {
|
||||||
transactionType.value = selectedTransactionType;
|
transactionType.value = selectedTransactionType;
|
||||||
|
|||||||
@@ -71,8 +71,10 @@ watch(
|
|||||||
|
|
||||||
<InputNumber v-else ref="inputRefs" type="text" v-model="props.category.currentLimit"
|
<InputNumber v-else ref="inputRefs" type="text" v-model="props.category.currentLimit"
|
||||||
class="text-lg font-bold border-b-2 border-gray-300 outline-none focus:border-blue-500 w-32 text-right"
|
class="text-lg font-bold border-b-2 border-gray-300 outline-none focus:border-blue-500 w-32 text-right"
|
||||||
:min="props.category.categoryPlannedLimit" :max="900000" :invalid="currentLimit < props.category.categoryPlannedLimit" v-tooltip.top="'Сумма не должна быть ниже суммы запланированных!'"/>
|
:min="props.category.categoryPlannedLimit" :max="900000" :invalid="currentLimit < props.category.categoryPlannedLimit"
|
||||||
<Button v-if="isEditing" @click="stopEditing" icon="pi pi-check" severity="success" rounded outlined
|
v-tooltip.top="'Сумма не должна быть ниже суммы запланированных!'"
|
||||||
|
unstyled />
|
||||||
|
<Button v-if="isEditing" @click="stopEditing" icon="pi pi-check" severity="success" rounded outlined
|
||||||
aria-label="Search"/>
|
aria-label="Search"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -96,23 +96,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid gap-5 items-center justify-items-center w-full">
|
<div class="grid gap-5 items-center justify-items-center w-full">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<button class="grid grid-cols-3 justify-between gap-5 items-center w-full"
|
<button class="grid grid-cols-3 justify-between gap-5 items-end w-full"
|
||||||
@click="detailedShowed = !detailedShowed">
|
@click="detailedShowed = !detailedShowed">
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<h4 class="text-lg">💳 Долги</h4>
|
<h4 class="text-sm lg:text-base">Долги</h4>
|
||||||
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
||||||
{{ loansRatio.toFixed(0) }} %
|
{{ loansRatio.toFixed(0) }} %
|
||||||
</div>
|
</div>
|
||||||
<!-- <p>Total Incomes</p>-->
|
<!-- <p>Total Incomes</p>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-center ">
|
<div class="flex flex-col items-center ">
|
||||||
<span class="text-base">💰Сбережения</span>
|
<span class="text-sm lg:text-base">Сбережения</span>
|
||||||
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
||||||
{{ savingRatio.toFixed(0) }} %
|
{{ savingRatio.toFixed(0) }} %
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-center ">
|
<div class="flex flex-col items-center ">
|
||||||
<h4 class="text-sm">🍎 Ежедневные</h4>
|
<h4 class="text-sm lg:text-base">Ежедневные</h4>
|
||||||
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
<div class="font-light bg-gray-100 p-1 rounded-lg box-shadow-inner w-full text-center">
|
||||||
{{ dailyRatio.toFixed(0) }} %
|
{{ dailyRatio.toFixed(0) }} %
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user