fixes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import Drawer from "primevue/drawer";
|
||||
import InputText from "primevue/inputtext";
|
||||
import DatePicker from "primevue/datepicker";
|
||||
import FloatLabel from "primevue/floatlabel";
|
||||
@@ -21,6 +20,8 @@ import {getCategories, getCategoryTypes} from "@/services/categoryService";
|
||||
import {useToast} from "primevue/usetoast";
|
||||
import LoadingView from "@/components/LoadingView.vue";
|
||||
import BudgetTransactionView from "@/components/budgets/BudgetTransactionView.vue";
|
||||
import {useUserStore} from "@/stores/userStore";
|
||||
import DrawerForm from "@/components/DrawerForm.vue";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -73,6 +74,11 @@ const incomeCategories = ref<Category[]>([]);
|
||||
const categoryTypes = ref<CategoryType[]>([]);
|
||||
const transactionTypes = ref<TransactionType[]>([]);
|
||||
|
||||
const userStore = useUserStore();
|
||||
const user = computed( () => userStore.user)
|
||||
|
||||
const isReady = computed(() => !loading.value && loadingUser.value)
|
||||
|
||||
// Получение категорий и типов транзакций
|
||||
const fetchCategoriesAndTypes = async () => {
|
||||
try {
|
||||
@@ -260,9 +266,9 @@ onMounted(async () => {
|
||||
await fetchCategoriesAndTypes();
|
||||
|
||||
prepareData();
|
||||
if (!transactions.value && !isEditing.value) {
|
||||
console.log()
|
||||
await getTransactions('INSTANT', 'EXPENSE' ).then(transactionsResponse => transactions.value = transactionsResponse.data);
|
||||
|
||||
if ( !isEditing.value) {
|
||||
await getTransactions('INSTANT', 'EXPENSE',null, user.value.id ).then(transactionsResponse => transactions.value = transactionsResponse.data);
|
||||
transactions.value = transactions.value.slice(0,3)
|
||||
console.log(transactions.value.slice(0,3))
|
||||
}
|
||||
@@ -278,9 +284,8 @@ onMounted(async () => {
|
||||
<div class="card flex justify-center h-dvh">
|
||||
|
||||
|
||||
<Drawer :visible="visible" :header="isEditing ? 'Изменить транзакцию' : 'Создать транзакцию'" :showCloseIcon="false"
|
||||
position="right" @hide="closeDrawer"
|
||||
class="!w-128 ">
|
||||
<DrawerForm>
|
||||
|
||||
<div v-if="result" class="absolute top-0 left-0 w-full h-full flex items-center justify-center z-50">
|
||||
<div
|
||||
class=" px-10 py-5 rounded-lg border border-gray-200 flex flex-col items-center gap-4"
|
||||
@@ -301,11 +306,9 @@ onMounted(async () => {
|
||||
|
||||
<LoadingView v-if="loading"/>
|
||||
<div v-else class=" grid gap-4 w-full ">
|
||||
|
||||
<div class="relative w-full justify-center justify-items-center ">
|
||||
<div class="flex flex-col justify-items-center gap-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<!-- {{editedTransaction.value.transactionType}}-->
|
||||
<Select v-if="!isEditing" v-model="editedTransaction.transactionType" :allow-empty="false"
|
||||
:options="transactionTypes"
|
||||
optionLabel="name"
|
||||
@@ -427,7 +430,7 @@ onMounted(async () => {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Drawer>
|
||||
</DrawerForm>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user