Remove billedTo filtering to show all bills to landlord
The billedTo field indicates payment responsibility (tenant vs landlord), not viewing permissions. Landlords should see and manage ALL bills. Changes: - LocationCard: Display all bills regardless of billedTo value - LocationCard: Calculate monthlyExpense from all paid bills - HomePage: Include all paid bills in monthlyExpense aggregation - printActions: Print all bills with barcodes regardless of billedTo - locationActions: Add billedTo property to fetchAllLocations result 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { fetchAllLocations } from '@/app/lib/actions/locationActions';
|
||||
import { fetchAvailableYears } from '@/app/lib/actions/monthActions';
|
||||
import { BilledTo, BillingLocation, YearMonth } from '@/app/lib/db-types';
|
||||
import { BillingLocation, YearMonth } from '@/app/lib/db-types';
|
||||
import { FC } from 'react';
|
||||
import { MonthLocationList } from '@/app/ui/MonthLocationList';
|
||||
|
||||
@@ -49,7 +49,7 @@ export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
[key]: {
|
||||
yearMonth: location.yearMonth,
|
||||
locations: [...locationsInMonth.locations, location],
|
||||
monthlyExpense: locationsInMonth.monthlyExpense + location.bills.reduce((acc, bill) => (bill.paid && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
monthlyExpense: locationsInMonth.monthlyExpense + location.bills.reduce((acc, bill) => bill.paid ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
[key]: {
|
||||
yearMonth: location.yearMonth,
|
||||
locations: [location],
|
||||
monthlyExpense: location.bills.reduce((acc, bill) => (bill.paid && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
monthlyExpense: location.bills.reduce((acc, bill) => bill.paid ? acc + (bill.payedAmount ?? 0) : acc, 0)
|
||||
}
|
||||
});
|
||||
}, {} as {[key:string]:{
|
||||
|
||||
Reference in New Issue
Block a user