Compare commits
2 Commits
ee59499bba
...
5741236e2c
Author | SHA1 | Date | |
---|---|---|---|
5741236e2c | |||
99549fb441 |
@ -1,7 +1,6 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -38,17 +38,33 @@ const filters = ref({
|
||||
PayeeID: null,
|
||||
Category: null,
|
||||
CategoryID: null,
|
||||
FromDate: null,
|
||||
ToDate: null,
|
||||
FromDate: new Date(1900, 0, 2),
|
||||
ToDate: new Date(2999,11,32),
|
||||
});
|
||||
|
||||
watch(() => filters.value.AccountID + filters.value.PayeeID + filters.value.CategoryID, function() {
|
||||
watch(() => filters.value.AccountID
|
||||
+ filters.value.PayeeID
|
||||
+ filters.value.CategoryID
|
||||
+ filters.value.FromDate?.toISOString()
|
||||
+ filters.value.ToDate?.toISOString(), function() {
|
||||
if(!hasFilters.value)
|
||||
return;
|
||||
transactions.GetFilteredTransactions(filters.value.AccountID, filters.value.CategoryID, filters.value.PayeeID);
|
||||
transactions.GetFilteredTransactions(
|
||||
filters.value.AccountID,
|
||||
filters.value.CategoryID,
|
||||
filters.value.PayeeID,
|
||||
filters.value.FromDate?.toISOString(),
|
||||
filters.value.ToDate?.toISOString(),
|
||||
);
|
||||
})
|
||||
|
||||
const hasFilters = computed(() => filters.value.AccountID != null || filters.value.PayeeID != null || filters.value.CategoryID);
|
||||
const hasFilters = computed(() =>
|
||||
filters.value.AccountID != null
|
||||
|| filters.value.PayeeID != null
|
||||
|| filters.value.CategoryID != null
|
||||
|| (filters.value.FromDate != null && filters.value.FromDate.getFullYear() > 1901)
|
||||
|| (filters.value.ToDate != null && filters.value.ToDate.getFullYear() < 2998))
|
||||
|
||||
const transactionsList = computed(() => {
|
||||
if (hasFilters.value){
|
||||
return transactions.FilteredTransactionsList;
|
||||
|
@ -3,10 +3,6 @@ import NewBudget from '../dialogs/NewBudget.vue';
|
||||
import RowCard from '../components/RowCard.vue';
|
||||
import { useSessionStore } from '../stores/session';
|
||||
|
||||
const props = defineProps<{
|
||||
budgetid: string,
|
||||
}>();
|
||||
|
||||
const BudgetsList = useSessionStore().BudgetsList;
|
||||
</script>
|
||||
|
||||
@ -24,7 +20,7 @@ const BudgetsList = useSessionStore().BudgetsList;
|
||||
<!--<svg class="w-24"></svg>-->
|
||||
<p class="w-24 text-center text-6xl" />
|
||||
<span class="text-lg">{{ budget.Name
|
||||
}}{{ budget.ID == budgetid ? " *" : "" }}</span>
|
||||
}}</span>
|
||||
</router-link>
|
||||
</RowCard>
|
||||
<NewBudget />
|
||||
|
@ -90,12 +90,14 @@ export const useTransactionsStore = defineStore("budget/transactions", {
|
||||
this.AddTransactions(transactions);
|
||||
this.ProblematicTransactions = [...transactions?.map((x : Transaction) => x.ID)];
|
||||
},
|
||||
async GetFilteredTransactions(accountID : string | null, categoryID : string | null, payeeID : string | null) {
|
||||
async GetFilteredTransactions(accountID : string | null, categoryID : string | null, payeeID : string | null, fromDate : string, toDate : string) {
|
||||
const budgetStore = useBudgetsStore();
|
||||
const payload = JSON.stringify({
|
||||
category_id: categoryID,
|
||||
payee_id: payeeID,
|
||||
account_id: accountID,
|
||||
from_date: fromDate,
|
||||
to_date: toDate,
|
||||
});
|
||||
const result = await POST("/budget/" + budgetStore.CurrentBudgetID + "/filtered-transactions", payload);
|
||||
const response = await result.json();
|
||||
|
Reference in New Issue
Block a user