feat: add multi-bill-edit page for batch bill status updates

- Add getLocationsByMonth server action with aggregation pipeline to calculate hasAttachment
- Add updateMonth server action for bulk bill status updates with path revalidation
- Create multi-bill-edit page at /home/multi-bill-edit/[year]/[month]
- Implement MultiBillEdit component with toggle functionality for all bills
- Add BillToggleBadge component integration for consistent bill display
- Add "set all as paid/unpaid" toggle button for batch operations
- Implement server-side redirect with success message after save
- Add Suspense boundary with loading skeleton
- Update translations for multi-bill-edit feature (Croatian and English)
- Ensure data freshness with unstable_noStore and revalidatePath

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-18 17:45:27 +01:00
parent e9ade045d8
commit 0145a2030d
10 changed files with 442 additions and 25 deletions

View File

@@ -0,0 +1,24 @@
import { FC } from "react"
import { Bill } from "@/app/lib/db-types"
import { TicketIcon } from "@heroicons/react/24/outline"
export interface BillBadgeProps {
locationId: string,
bill: Pick<Bill, 'name' | 'paid' | 'hasAttachment' | 'proofOfPayment'>,
onClick?: () => void
};
export const BillToggleBadge:FC<BillBadgeProps> = ({ bill: { name, paid, hasAttachment, proofOfPayment }, onClick}) => {
const className = `badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`;
return (
<div className={className} onClick={onClick}>
{name}
{
proofOfPayment?.uploadedAt ?
<TicketIcon className="h-[1em] w-[1em] inline-block ml-1" /> : null
}
</div>
);
}