to payee
This commit is contained in:
@@ -30,11 +30,23 @@ function extractTransactions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. Filter by group key
|
// 2. Filter by group key
|
||||||
if (selectedGroupKey?.tags && selectedGroupKey.tags.length > 0) {
|
if (selectedGroupKey) {
|
||||||
return rawTxns.filter(txn => {
|
rawTxns = rawTxns.filter(txn => {
|
||||||
if (!txn.tags) return false;
|
let match = true;
|
||||||
const txnTags = txn.tags.map(t => typeof t === "string" ? t : t.name);
|
if (selectedGroupKey.tags && selectedGroupKey.tags.length > 0) {
|
||||||
return selectedGroupKey.tags!.every(selectedTag => txnTags.includes(selectedTag));
|
if (!txn.tags) match = false;
|
||||||
|
else {
|
||||||
|
const txnTags = txn.tags.map(t => typeof t === "string" ? t : t.name);
|
||||||
|
if (!selectedGroupKey.tags.every(selectedTag => txnTags.includes(selectedTag))) match = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (match && selectedGroupKey.payee && selectedGroupKey.payee.length > 0) {
|
||||||
|
if (!txn.payee || !txn.payee.name) match = false;
|
||||||
|
else {
|
||||||
|
if (!selectedGroupKey.payee.includes(txn.payee.name)) match = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return match;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,15 @@ export default function TopTags({
|
|||||||
isFetching={isFetching}
|
isFetching={isFetching}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (setSelectedGroupKey) {
|
if (setSelectedGroupKey) {
|
||||||
setSelectedGroupKey(isSelected ? null : { tags: [item.tag] });
|
let newKey = selectedGroupKey ? { ...selectedGroupKey } : {};
|
||||||
|
|
||||||
|
if (isSelected) {
|
||||||
|
delete newKey.tags;
|
||||||
|
} else {
|
||||||
|
newKey.tags = [item.tag];
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelectedGroupKey(Object.keys(newKey).length ? newKey : null);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import HistoryChart from "./components/HistoryChart";
|
|||||||
import LatestItems from "./components/LatestItems";
|
import LatestItems from "./components/LatestItems";
|
||||||
import { DashboardConfig } from "./components/Dashboard";
|
import { DashboardConfig } from "./components/Dashboard";
|
||||||
import TopTags from "./components/ProgressCard/TopTags";
|
import TopTags from "./components/ProgressCard/TopTags";
|
||||||
|
import TopPayees from "./components/ProgressCard/TopPayees";
|
||||||
|
|
||||||
export const configuration: DashboardConfig = {
|
export const configuration: DashboardConfig = {
|
||||||
sections: [
|
sections: [
|
||||||
@@ -12,7 +13,6 @@ export const configuration: DashboardConfig = {
|
|||||||
component: HistoryChart,
|
component: HistoryChart,
|
||||||
settings: {
|
settings: {
|
||||||
tabs: ["Weekly", "Monthly"],
|
tabs: ["Weekly", "Monthly"],
|
||||||
// tabs: ["Weekly", "Monthly", "Yearly", "Financial Year", "All Time"],
|
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
size: 12,
|
size: 12,
|
||||||
@@ -29,6 +29,17 @@ export const configuration: DashboardConfig = {
|
|||||||
size: 12,
|
size: 12,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "top-payees",
|
||||||
|
title: 'Top Payees',
|
||||||
|
component: TopPayees,
|
||||||
|
settings: {
|
||||||
|
compact: true,
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
size: 12,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "items",
|
id: "items",
|
||||||
title: 'Recent Transactions',
|
title: 'Recent Transactions',
|
||||||
|
|||||||
Reference in New Issue
Block a user