fix login spaces

This commit is contained in:
xds
2025-03-06 19:02:10 +03:00
parent 9cf471009d
commit 570f55f1ea
4 changed files with 22 additions and 13 deletions

View File

@@ -98,6 +98,24 @@ const spaceStore = useSpaceStore()
const spaces = computed(() => spaceStore.spaces);
const selectedSpace = computed(() => spaceStore.space)
watch(
selectedSpace,
(newValue, oldValue) => {
if (newValue) {
items.value.push({
label: 'Запись',
icon: 'pi pi-plus',
url:'',
command: () => {
drawerStore.setCategoryType('EXPENSE');
drawerStore.setTransactionType('INSTANT');
drawerStore.visible = true
}
})
}
}
)
const selectSpace = (space: Space) => {
spaceStore.setSpace(space.value);
@@ -158,16 +176,7 @@ const items = ref([
icon: 'pi pi-envelope',
url: '/settings',
},
{
label: 'Запись',
icon: 'pi pi-plus',
url:'',
command: () => {
drawerStore.setCategoryType('EXPENSE');
drawerStore.setTransactionType('INSTANT');
drawerStore.visible = true
}
}
]);

View File

@@ -4,7 +4,7 @@
<!-- Заголовок -->
<div class="flex flex-row gap-4 items-center">
<h2 class="text-4xl font-bold">Бюджеты</h2>
<Button label="+ Создать" @click="creationOpened=true" size="small"/>
<Button v-if="selectedSpace" label="+ Создать" @click="creationOpened=true" size="small"/>
<BudgetCreationView :opened="creationOpened" @budget-created="fetchBudgets"
@close-modal="creationOpened=false"/>
<StatusView :show="creationSuccessModal" :is-error="false" :message="'Бюджет создан!'"/>

View File

@@ -142,7 +142,7 @@ onUnmounted(async () => {
<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="{
<Button v-if="selectedSpace" label="+ Создать" @click="{
drawerStore.setCategoryType('EXPENSE');
drawerStore.setTransactionType('INSTANT');
drawerStore.visible = true

View File

@@ -113,7 +113,7 @@ onMounted(async () => {
<!-- Заголовок -->
<div class="flex flex-row gap-4 items-center">
<h2 class="text-4xl font-bold">Вишлисты</h2>
<Button label="+ Создать" @click="creationOpened=true" size="small"/>
<Button v-if="selectedSpace" label="+ Создать" @click="creationOpened=true" size="small"/>
<!-- <StatusView :show="creationSuccessModal" :is-error="false" :message="'Бюджет создан!'"/>-->
</div>
<!-- Плитка с бюджетами -->