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