tags and new analytics new in budget
This commit is contained in:
@@ -30,7 +30,7 @@ const budget = ref(new Budget())
|
||||
const create = async () => {
|
||||
|
||||
try {
|
||||
await createBudget(budget.value)
|
||||
await createBudget(budget.value, createRecurrentPayments.value)
|
||||
.then((res) => budget.value = res)
|
||||
.catch((err) => console.log(err));
|
||||
emits("budget-created", budget.value, createRecurrentPayments.value);
|
||||
@@ -115,10 +115,10 @@ onMounted(() => {
|
||||
<DatePicker v-model="budget.dateTo" id="dateTo" dateFormat="dd.mm.yy"/>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
<!-- <div class="flex flex-row items-center min-w-fit gap-4">-->
|
||||
<!-- <Checkbox v-model="createRecurrentPayments" binary/>-->
|
||||
<!-- Создать ежемесячные платежи?-->
|
||||
<!-- </div>-->
|
||||
<div class="flex flex-row items-center min-w-fit gap-4">
|
||||
<Checkbox v-model="createRecurrentPayments" binary/>
|
||||
Создать ежемесячные платежи?
|
||||
</div>
|
||||
<div v-if="categories.length ==0" class="text-red-500 font-bold">Сперва лучше создать категории</div>
|
||||
<div class="flex flex-row gap-2 justify-end items-center">
|
||||
<Button label="Создать" severity="success" icon="pi pi-save" @click="create"/>
|
||||
|
||||
@@ -10,9 +10,10 @@ import {Transaction} from "@/models/Transaction";
|
||||
import ProgressSpinner from "primevue/progressspinner";
|
||||
import {getUsers} from "@/services/userService";
|
||||
import Button from "primevue/button";
|
||||
import { EventBus } from '@/utils/EventBus.ts';
|
||||
import {EventBus} from '@/utils/EventBus.ts';
|
||||
import {useSpaceStore} from "@/stores/spaceStore";
|
||||
import router from "@/router";
|
||||
import {useDrawerStore} from "@/stores/drawerStore";
|
||||
|
||||
const loading = ref(false);
|
||||
const searchText = ref("");
|
||||
@@ -21,6 +22,8 @@ const limit = 20; // Количество транзакций на одну з
|
||||
const offset = ref(0); // Начальное смещение
|
||||
const allLoaded = ref(false); // Флаг для отслеживания окончания данных
|
||||
|
||||
const drawerStore = useDrawerStore()
|
||||
|
||||
// Функция для получения транзакций с параметрами limit и offset
|
||||
const fetchTransactions = async (reload) => {
|
||||
|
||||
@@ -28,7 +31,7 @@ const fetchTransactions = async (reload) => {
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await getTransactions( 'INSTANT', null, null, selectedUserId.value ? selectedUserId.value : null, null, reload ? offset.value : limit, reload ? 0 : offset.value);
|
||||
const response = await getTransactions('INSTANT', null, null, selectedUserId.value ? selectedUserId.value : null, null, reload ? offset.value : limit, reload ? 0 : offset.value);
|
||||
const newTransactions = response.data;
|
||||
|
||||
// Проверка на конец данных
|
||||
@@ -62,7 +65,6 @@ const switchUserFilter = async (user) => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const tgname = computed(() => {
|
||||
if (window.Telegram.WebApp) {
|
||||
const tg = window.Telegram.WebApp;
|
||||
@@ -112,35 +114,44 @@ const selectedTransactionType = ref(null)
|
||||
const spaceStore = useSpaceStore()
|
||||
const selectedSpace = computed(() => spaceStore.space)
|
||||
|
||||
watch( selectedSpace, async (newValue, oldValue) => {
|
||||
watch(selectedSpace, async (newValue, oldValue) => {
|
||||
if (newValue != oldValue) {
|
||||
await fetchTransactions(false)
|
||||
}
|
||||
})
|
||||
const types = ref([])
|
||||
onMounted(async () => {
|
||||
EventBus.on('transactions-updated', fetchTransactions,true);
|
||||
if (selectedSpace.value){
|
||||
EventBus.on('transactions-updated', fetchTransactions, true);
|
||||
if (selectedSpace.value) {
|
||||
await fetchTransactions(false); // Первоначальная загрузка данных
|
||||
|
||||
}
|
||||
// await fetchUsers();
|
||||
await getTransactionTypes().then( it => types.value = it.data);
|
||||
await getTransactionTypes().then(it => types.value = it.data);
|
||||
// window.addEventListener("scroll", handleScroll); // Добавляем обработчик прокрутки
|
||||
});
|
||||
|
||||
onUnmounted( async () => {
|
||||
onUnmounted(async () => {
|
||||
EventBus.off('transactions-updated', fetchTransactions);
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="px-4 bg-gray-100 h-full">
|
||||
<h2 class="text-4xl mb-6 font-bold">Список транзакций </h2>
|
||||
<div class="flex flex-col gap-4 p-4 bg-gray-100 h-full ">
|
||||
<div class="flex flex-row gap-4 items-center">
|
||||
<h2 class="text-4xl font-bold">Список транзакций </h2>
|
||||
<Button label="+ Создать" @click="{
|
||||
drawerStore.setCategoryType('EXPENSE');
|
||||
drawerStore.setTransactionType('INSTANT');
|
||||
drawerStore.visible = true
|
||||
}" size="small"/>
|
||||
</div>
|
||||
<div v-if="!selectedSpace" class="flex w-full h-full items-center justify-center">
|
||||
<p>Сперва нужно выбрать Пространство.
|
||||
<button class="text-blue-500 hover:underline" @click="router.push('/spaces').then((res) => router.go(0))">Перейти</button>
|
||||
<button class="text-blue-500 hover:underline" @click="router.push('/spaces').then((res) => router.go(0))">
|
||||
Перейти
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div v-else class="flex flex-col gap-2">
|
||||
@@ -158,9 +169,9 @@ onUnmounted( async () => {
|
||||
</button>
|
||||
|
||||
|
||||
<!-- <button v-for="type in types" class="rounded-xl border p-1 bg-white border-gray-300 mb-2 min-w-fit px-2">-->
|
||||
<!-- <p><span class="text-sm font-bold">{{ type.name }}</span></p>-->
|
||||
<!-- </button>-->
|
||||
<!-- <button v-for="type in types" class="rounded-xl border p-1 bg-white border-gray-300 mb-2 min-w-fit px-2">-->
|
||||
<!-- <p><span class="text-sm font-bold">{{ type.name }}</span></p>-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user