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:
@@ -255,6 +255,7 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
_id: "$$bill._id",
|
||||
name: "$$bill.name",
|
||||
paid: "$$bill.paid",
|
||||
billedTo: "$$bill.billedTo",
|
||||
payedAmount: "$$bill.payedAmount",
|
||||
hasAttachment: { $ne: ["$$bill.attachment", null] },
|
||||
},
|
||||
@@ -273,6 +274,7 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
_id: { $toString: "$$bill._id" },
|
||||
name: "$$bill.name",
|
||||
paid: "$$bill.paid",
|
||||
billedTo: "$$bill.billedTo",
|
||||
payedAmount: "$$bill.payedAmount",
|
||||
hasAttachment: "$$bill.hasAttachment",
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use server';
|
||||
|
||||
import { getDbClient } from '../dbClient';
|
||||
import { BilledTo, BillingLocation, Bill } from '../db-types';
|
||||
import { BillingLocation } from '../db-types';
|
||||
import { AuthenticatedUser } from '../types/next-auth';
|
||||
import { withUser } from '../auth';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
@@ -41,8 +41,8 @@ export const fetchBarcodeDataForPrint = withUser(async (user: AuthenticatedUser,
|
||||
|
||||
for (const location of locations) {
|
||||
for (const bill of location.bills) {
|
||||
// Only include bills that are billed to tenant and have barcode images
|
||||
if (bill.barcodeImage && bill.barcodeImage.trim() !== "" && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) {
|
||||
// Only include bills that have barcode images
|
||||
if (bill.barcodeImage && bill.barcodeImage.trim() !== "") {
|
||||
printData.push({
|
||||
locationName: location.name,
|
||||
billName: bill.name,
|
||||
|
||||
Reference in New Issue
Block a user