diff --git a/app/Http/Controllers/System/DashboardController.php b/app/Http/Controllers/System/DashboardController.php
index 511c9a9b..11f10ae5 100644
--- a/app/Http/Controllers/System/DashboardController.php
+++ b/app/Http/Controllers/System/DashboardController.php
@@ -29,6 +29,7 @@ public function __invoke()
$teamId = $request->user()->current_team_id;
$budget = BudgetMonth::getMonthAssignmentTotal($teamId, $startDate);
$transactionsTotal = TransactionService::getExpensesTotal($teamId, $startDate, $endDate);
+ $netWorth = collect(TransactionService::getNetWorth($teamId, $startDate, $endDate))->reverse()->values();
$plannedMeals = $this->mealService->getMealSchedule($teamId);
$nextPayments = $this->plannedService->getPlanned($teamId);
@@ -37,6 +38,7 @@ public function __invoke()
'meals' => PlannedMealResource::collection($plannedMeals),
'budgetTotal' => $budget,
'transactionTotal' => $transactionsTotal,
+ 'netWorth' => $netWorth,
'expenses' => ReportService::generateCurrentPreviousReport($teamId, 'month', 1),
'spendingSummary' => ReportService::generateExpensesByPeriod($teamId, $startDate),
'onboarding' => function () use ($team) {
diff --git a/resources/js/Components/WidgetContainer.vue b/resources/js/Components/WidgetContainer.vue
index efc5f5bf..e9174a81 100644
--- a/resources/js/Components/WidgetContainer.vue
+++ b/resources/js/Components/WidgetContainer.vue
@@ -71,7 +71,7 @@ const { isTab: isCurrentTab, selectedTab, tabs: widgetTabs } = useTabs(
-
-
-
+
+
+
diff --git a/resources/js/domains/budget/models/budget.ts b/resources/js/domains/budget/models/budget.ts
index 5997c3c8..e6b4fb98 100644
--- a/resources/js/domains/budget/models/budget.ts
+++ b/resources/js/domains/budget/models/budget.ts
@@ -1,5 +1,10 @@
import { ICategory } from "@/domains/transactions/models";
+export interface IBudgetStat {
+ spending: number;
+ total: number;
+ saving: number;
+}
export interface BudgetTarget {
amount: number
category_id: number;
@@ -91,5 +96,6 @@ const targetTypeNames = {
}
export const getTargetName = (code: string) => {
+ // @ts-ignore: is name
return targetTypeNames[code] ?? code;
}
diff --git a/resources/js/domains/meal/components/MealWidget.vue b/resources/js/domains/meal/components/MealWidget.vue
index ab51c54e..f1f31dfd 100644
--- a/resources/js/domains/meal/components/MealWidget.vue
+++ b/resources/js/domains/meal/components/MealWidget.vue
@@ -14,7 +14,7 @@ const defaultShadow = window?.cardShadow ?? "";
-
+
{{ $t('Menu for today') }}
diff --git a/resources/js/domains/budget/components/BudgetTracker.vue b/resources/js/domains/transactions/components/AccountsTracker.vue
similarity index 68%
rename from resources/js/domains/budget/components/BudgetTracker.vue
rename to resources/js/domains/transactions/components/AccountsTracker.vue
index 46f04c39..585f0bda 100644
--- a/resources/js/domains/budget/components/BudgetTracker.vue
+++ b/resources/js/domains/transactions/components/AccountsTracker.vue
@@ -1,6 +1,6 @@
-
-
+
{{ message }} {{ username }}
@@ -56,14 +54,14 @@ const isMultiple = (value: any) => {
- Edit budget
+ Transactions
-
-
+
+
{
-
- {{ formatMoney(section.value) }}
+
-
+
-
+
diff --git a/resources/js/domains/transactions/components/ExpenseChartWidgetRow.vue b/resources/js/domains/transactions/components/ExpenseChartWidgetRow.vue
index bc38ce87..9f95e4a5 100644
--- a/resources/js/domains/transactions/components/ExpenseChartWidgetRow.vue
+++ b/resources/js/domains/transactions/components/ExpenseChartWidgetRow.vue
@@ -70,7 +70,7 @@ const detailColumn = computed(() => {
- {{ title ?? item.name }}: {{ classes }}
+ {{ title ?? item.name }}:
{
-
Next Payments
-
+ Next Payments
+
) => {
+
+ const getEntryBalance = (monthEntry: INetWorthEntry = { assets: "0", debts: "0"}) => {
+ return parseFloat(monthEntry.assets) + parseFloat(monthEntry.debts) ?? 0;
+ };
+
+ const lastMonth = computed(() => {
+ return getEntryBalance(netWorthData.value?.at?.(-2))
+ });
+
+ const thisMonth = computed(() => {
+ return getEntryBalance(netWorthData?.value.at?.(-1))
+ });
+ const monthMovement = computed(() => {
+ return thisMonth.value - lastMonth.value;
+ });
+
+ const monthMovementVariance = computed(() => {
+ return (monthMovement.value / lastMonth.value * 100.00).toFixed(2);
+ });
+
+ return {
+ monthMovementVariance,
+ monthMovement,
+ thisMonth,
+ lastMonth
+ }
+}