Replace billedToTenant boolean with billedTo enum
Migrated from boolean checkbox to enum-based radio buttons for better flexibility and clarity in tracking bill payment responsibility. Changes: - Added BilledTo enum with values 'tenant' and 'landlord' - Replaced Bill.billedToTenant (boolean) with Bill.billedTo (enum) - Updated BillEditForm to use radio buttons instead of checkbox - Updated billActions to handle billedTo enum values - Updated all display filtering to use enum comparison - Updated printActions barcode filtering - Updated translations for radio button labels (en/hr) The billedTo property is optional for backward compatibility - undefined values default to BilledTo.Tenant, maintaining current behavior where only tenant bills are displayed and calculated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use server';
|
||||
|
||||
import { getDbClient } from '../dbClient';
|
||||
import { BillingLocation, Bill } from '../db-types';
|
||||
import { BilledTo, BillingLocation, Bill } from '../db-types';
|
||||
import { AuthenticatedUser } from '../types/next-auth';
|
||||
import { withUser } from '../auth';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
@@ -42,7 +42,7 @@ 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.billedToTenant ?? true)) {
|
||||
if (bill.barcodeImage && bill.barcodeImage.trim() !== "" && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) {
|
||||
printData.push({
|
||||
locationName: location.name,
|
||||
billName: bill.name,
|
||||
|
||||
Reference in New Issue
Block a user